Skip to content

Commit 48efe72

Browse files
authored
Merge pull request #26 from SpawnDock/fix/bootstrap-next-command-output
fix: simplify bootstrap next-step output
2 parents 61fabf3 + 27ecebe commit 48efe72

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

packages/app/src/app/program.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { type BootstrapSummary, validateNodeMajorVersion } from "../core/bootstr
33
import { bootstrapProject } from "../shell/bootstrap.js"
44
import { formatUsage, readCliOptions } from "../shell/cli.js"
55

6+
const formatProjectDirectoryHint = (projectDir: string): string =>
7+
projectDir.split(/[\\/]/g).filter(Boolean).at(-1) ?? projectDir
8+
69
export const formatSuccess = (summary: BootstrapSummary): string =>
710
[
811
"",
@@ -12,8 +15,8 @@ export const formatSuccess = (summary: BootstrapSummary): string =>
1215
`MCP ready for: ${summary.mcpAgents.join(", ")}`,
1316
"Dependencies already installed with pnpm.",
1417
"Next:",
15-
` cd "${summary.projectDir}"`,
16-
" pnpm run agent",
18+
` cd ${formatProjectDirectoryHint(summary.projectDir)}`,
19+
" pnpm run dev",
1720
].join("\n")
1821

1922
const cliProgram = pipe(

packages/app/tests/program.test.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"
22
import { formatSuccess } from "../src/app/program.js"
33

44
describe("formatSuccess", () => {
5-
it("guides users to pnpm after bootstrap succeeds", () => {
5+
it("guides users to the project directory and pnpm dev after bootstrap succeeds", () => {
66
const output = formatSuccess({
77
projectDir: "/tmp/demo-project",
88
projectName: "Demo Project",
@@ -11,9 +11,21 @@ describe("formatSuccess", () => {
1111
})
1212

1313
expect(output).toContain("Dependencies already installed with pnpm.")
14-
expect(output).toContain('cd "/tmp/demo-project"')
15-
expect(output).toContain("pnpm run agent")
14+
expect(output).toContain("cd demo-project")
15+
expect(output).toContain("pnpm run dev")
16+
expect(output).not.toContain('cd "/tmp/demo-project"')
17+
expect(output).not.toContain("pnpm run agent")
1618
expect(output).not.toContain("&&")
17-
expect(output).not.toContain("npm run dev")
19+
})
20+
21+
it("uses the last path segment for Windows-style project paths too", () => {
22+
const output = formatSuccess({
23+
projectDir: "D:\\Projects\\test-box\\spawndock-app-11",
24+
projectName: "Spawndock App 11",
25+
previewOrigin: "https://api.example.com/preview/spawndock-app-11",
26+
mcpAgents: ["OpenCode"],
27+
})
28+
29+
expect(output).toContain("Next:\n cd spawndock-app-11\n pnpm run dev")
1830
})
1931
})

0 commit comments

Comments
 (0)