Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions cmd/install_script_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cmd

import (
"os"
"regexp"
"testing"
)

func TestInstallScript(t *testing.T) {
data, err := os.ReadFile("../install.sh")
if err != nil {
t.Fatalf("could not read install.sh: %v", err)
}
content := string(data)

t.Run("does not run setup wizard at install time", func(t *testing.T) {
// Match command execution shape only — not arbitrary text mentions.
setupInvocation := regexp.MustCompile(`(?m)^\s*"\$INSTALL_DIR/\$BINARY"\s+setup\b`)
if setupInvocation.MatchString(content) {
t.Error("install.sh must not run the setup subcommand at install time — the wizard now auto-launches from bare 'supermodel' in a project directory (PR #152)")
}
})

t.Run("includes getting-started message", func(t *testing.T) {
hasRunSupermodel := regexp.MustCompile(`(?i)\brun\s+['"]?supermodel['"]?\b`).MatchString(content)
hasProjectContext := regexp.MustCompile(`(?i)\b(in|inside)\s+your\s+project\b|\bproject\s+directory\b`).MatchString(content)
if !hasRunSupermodel || !hasProjectContext {
t.Error("install.sh must include a getting-started message directing users to run 'supermodel' in their project directory")
}
})
}
9 changes: 2 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,5 @@ install -m755 "$TMP/$BINARY" "$INSTALL_DIR/$BINARY"
echo "Installed: $INSTALL_DIR/$BINARY"
"$INSTALL_DIR/$BINARY" version

# Run the setup wizard when a controlling terminal is available.
# Use /dev/tty as stdin so interactive prompts work even in piped installs
# (e.g. curl … | sh), where stdin is the pipe rather than the terminal.
if { </dev/tty; } 2>/dev/null; then
echo ""
"$INSTALL_DIR/$BINARY" setup </dev/tty
fi
echo ""
echo "Run 'supermodel' inside your project directory to get started."
Loading