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
7 changes: 5 additions & 2 deletions packages/app/src/app/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { type BootstrapSummary, validateNodeMajorVersion } from "../core/bootstr
import { bootstrapProject } from "../shell/bootstrap.js"
import { formatUsage, readCliOptions } from "../shell/cli.js"

const formatProjectDirectoryHint = (projectDir: string): string =>
projectDir.split(/[\\/]/g).filter(Boolean).at(-1) ?? projectDir

export const formatSuccess = (summary: BootstrapSummary): string =>
[
"",
Expand All @@ -12,8 +15,8 @@ export const formatSuccess = (summary: BootstrapSummary): string =>
`MCP ready for: ${summary.mcpAgents.join(", ")}`,
"Dependencies already installed with pnpm.",
"Next:",
` cd "${summary.projectDir}"`,
" pnpm run agent",
` cd ${formatProjectDirectoryHint(summary.projectDir)}`,
" pnpm run dev",
].join("\n")

const cliProgram = pipe(
Expand Down
20 changes: 16 additions & 4 deletions packages/app/tests/program.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest"
import { formatSuccess } from "../src/app/program.js"

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

expect(output).toContain("Dependencies already installed with pnpm.")
expect(output).toContain('cd "/tmp/demo-project"')
expect(output).toContain("pnpm run agent")
expect(output).toContain("cd demo-project")
expect(output).toContain("pnpm run dev")
expect(output).not.toContain('cd "/tmp/demo-project"')
expect(output).not.toContain("pnpm run agent")
expect(output).not.toContain("&&")
expect(output).not.toContain("npm run dev")
})

it("uses the last path segment for Windows-style project paths too", () => {
const output = formatSuccess({
projectDir: "D:\\Projects\\test-box\\spawndock-app-11",
projectName: "Spawndock App 11",
previewOrigin: "https://api.example.com/preview/spawndock-app-11",
mcpAgents: ["OpenCode"],
})

expect(output).toContain("Next:\n cd spawndock-app-11\n pnpm run dev")
})
})