diff --git a/.changeset/help-examples-app-name.md b/.changeset/help-examples-app-name.md new file mode 100644 index 00000000..8ca94cd1 --- /dev/null +++ b/.changeset/help-examples-app-name.md @@ -0,0 +1,5 @@ +--- +"sandbox": patch +--- + +Use the invoked app name in help examples so `vercel sandbox --help` shows `vercel sandbox ...` commands instead of the standalone `sandbox ...` form, which is not on PATH for Vercel CLI users. diff --git a/packages/sandbox/src/app.ts b/packages/sandbox/src/app.ts index 84e8dc7f..5dbdb0c4 100644 --- a/packages/sandbox/src/app.ts +++ b/packages/sandbox/src/app.ts @@ -17,9 +17,10 @@ import { snapshots } from "./commands/snapshots"; import { sessions } from "./commands/sessions"; import { config } from "./commands/config"; -export const app = (opts?: { withoutAuth?: boolean; appName?: string }) => - subcommands({ - name: opts?.appName ?? "sandbox", +export const app = (opts?: { withoutAuth?: boolean; appName?: string }) => { + const appName = opts?.appName ?? "sandbox"; + return subcommands({ + name: appName, description: "Interfacing with Vercel Sandbox", version, cmds: { @@ -45,15 +46,16 @@ export const app = (opts?: { withoutAuth?: boolean; appName?: string }) => examples: [ { description: "Create a sandbox and start a shell", - command: "sandbox sh", + command: `${appName} sh`, }, { description: "Run a command in a new sandbox", - command: `sandbox run -- node -e "console.log('hello')"`, + command: `${appName} run -- node -e "console.log('hello')"`, }, { description: "Execute command in an existing sandbox", - command: `sandbox exec -- npm test`, + command: `${appName} exec -- npm test`, }, ], }); +};