From 1dbd1429ca6a28fb9eac93dadf300fa613f1646d Mon Sep 17 00:00:00 2001 From: Grey Newell Date: Thu, 30 Apr 2026 10:39:46 -0400 Subject: [PATCH 1/3] test: failing test for npm postinstall getting-started message (#159) Co-Authored-By: Claude Sonnet 4.6 --- cmd/npm_package_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 cmd/npm_package_test.go diff --git a/cmd/npm_package_test.go b/cmd/npm_package_test.go new file mode 100644 index 0000000..0bfc7ca --- /dev/null +++ b/cmd/npm_package_test.go @@ -0,0 +1,35 @@ +package cmd + +import ( + "os" + "strings" + "testing" +) + +// TestNpmPackageHasPostinstallMessage verifies that npm/install.js prints a +// getting-started message after the binary is installed, directing users to +// run 'supermodel' inside their project directory. +// +// Resolves: https://github.com/supermodeltools/cli/issues/159 +func TestNpmPackageHasPostinstallMessage(t *testing.T) { + data, err := os.ReadFile("../npm/install.js") + if err != nil { + t.Fatalf("could not read npm/install.js: %v", err) + } + content := string(data) + + t.Run("does not run setup wizard at install time", func(t *testing.T) { + if strings.Contains(content, `" setup`) || strings.Contains(content, "supermodel setup") { + t.Error("npm/install.js must not run the setup subcommand at install time") + } + }) + + t.Run("includes getting-started message", func(t *testing.T) { + lower := strings.ToLower(content) + hasRunSupermodel := strings.Contains(lower, "run 'supermodel'") || strings.Contains(lower, `run "supermodel"`) + hasGetStarted := strings.Contains(lower, "get started") + if !hasRunSupermodel && !hasGetStarted { + t.Error("npm/install.js must print a getting-started message directing users to run 'supermodel' in their project directory") + } + }) +} From 58342a143621d9ca814f994f7cb03dc52557e19a Mon Sep 17 00:00:00 2001 From: Grey Newell Date: Thu, 30 Apr 2026 10:39:46 -0400 Subject: [PATCH 2/3] fix: print getting-started message after npm install Closes #159. Co-Authored-By: Claude Sonnet 4.6 --- npm/install.js | 1 + 1 file changed, 1 insertion(+) diff --git a/npm/install.js b/npm/install.js index c3b6b43..c005683 100644 --- a/npm/install.js +++ b/npm/install.js @@ -125,6 +125,7 @@ if (require.main === module) { if (process.platform !== "win32") fs.chmodSync(BIN_PATH, 0o755); fs.unlinkSync(tmpArchive); console.log(`[supermodel] Installed to ${BIN_PATH}`); + console.log("\nsupermodel installed. Run 'supermodel' inside your project directory to get started.\n"); }); } From b5896f60b870b82922cf310cee3284b0a2a91363 Mon Sep 17 00:00:00 2001 From: Grey Newell Date: Thu, 30 Apr 2026 10:44:32 -0400 Subject: [PATCH 3/3] test: strengthen assertion to require both run-supermodel and get-started CodeRabbit feedback: use && instead of || so the test requires both the 'run supermodel' instruction and the 'get started' phrase. Co-Authored-By: Claude Sonnet 4.6 --- cmd/npm_package_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/npm_package_test.go b/cmd/npm_package_test.go index 0bfc7ca..4278958 100644 --- a/cmd/npm_package_test.go +++ b/cmd/npm_package_test.go @@ -28,7 +28,7 @@ func TestNpmPackageHasPostinstallMessage(t *testing.T) { lower := strings.ToLower(content) hasRunSupermodel := strings.Contains(lower, "run 'supermodel'") || strings.Contains(lower, `run "supermodel"`) hasGetStarted := strings.Contains(lower, "get started") - if !hasRunSupermodel && !hasGetStarted { + if !hasRunSupermodel || !hasGetStarted { t.Error("npm/install.js must print a getting-started message directing users to run 'supermodel' in their project directory") } })