fix: remove marketing text from runtime prompt, fix #1656 and #1657 (#1672)

* chore: ignore .worktrees directory

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(install): remove marketing taglines from runtime selection prompt

Closes #1654

The runtime selection menu had promotional copy appended to some
entries ("open source, the #1 AI coding platform on OpenRouter",
"open source, free models"). Replaced with just the name and path.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(kilo): update test to assert marketing tagline is removed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tests): use process.execPath so tests pass in shells without node on PATH

Three test patterns called bare `node` via shell, which fails in Claude Code
sessions where `node` is not on PATH:

- helpers.cjs string branch: execSync(`node ...`) → execFileSync(process.execPath)
  with a shell-style tokenizer that handles quoted args and inner-quote stripping
- hooks-opt-in.test.cjs: spawnSync('bash', ...) for hooks that call `node`
  internally → spawnHook() wrapper that injects process.execPath dir into PATH
- concurrency-safety.test.cjs: exec(`node ...`) for concurrent patch test
  → exec(`"${process.execPath}" ...`)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: resolve #1656 and #1657 — bash hooks missing from dist, SDK install prompt

#1656: Community bash hooks (gsd-session-state.sh, gsd-validate-commit.sh,
gsd-phase-boundary.sh) were never included in HOOKS_TO_COPY in build-hooks.js,
so hooks/dist/ never contained them and the installer could not copy them to
user machines. Fixed by adding the three .sh files to the copy array with
chmod +x preservation and skipping JS syntax validation for shell scripts.

#1657: promptSdk() called installSdk() which ran `npm install -g @gsd-build/sdk`
— a package that does not exist on npm, causing visible errors during interactive
installs. Removed promptSdk(), installSdk(), --sdk flag, and all call sites.

Regression tests in tests/bugs-1656-1657.test.cjs guard both fixes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: sort runtime list alphabetically after Claude Code

- Claude Code stays pinned at position 1
- Remaining 10 runtimes sorted A-Z: Antigravity(2), Augment(3), Codex(4),
  Copilot(5), Cursor(6), Gemini(7), Kilo(8), OpenCode(9), Trae(10), Windsurf(11)
- Updated runtimeMap, allRuntimes, and prompt display in promptRuntime()
- Updated multi-runtime-select, kilo-install, copilot-install tests to match

Also fix #1656 regression test: run build-hooks.js in before() hook so
hooks/dist/ is populated on CI (directory is gitignored; build runs via
prepublishOnly before publish, not during npm ci).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Boucher
2026-04-04 14:15:30 -04:00
committed by GitHub
parent e66f7e889e
commit ca6a273685
9 changed files with 194 additions and 173 deletions

View File

@@ -70,7 +70,6 @@ const hasCursor = args.includes('--cursor');
const hasWindsurf = args.includes('--windsurf');
const hasAugment = args.includes('--augment');
const hasTrae = args.includes('--trae');
const hasSdk = args.includes('--sdk');
const hasBoth = args.includes('--both'); // Legacy flag, keeps working
const hasAll = args.includes('--all');
const hasUninstall = args.includes('--uninstall') || args.includes('-u');
@@ -394,7 +393,7 @@ if (hasUninstall) {
// Show help if requested
if (hasHelp) {
console.log(` ${yellow}Usage:${reset} npx get-shit-done-cc [options]\n\n ${yellow}Options:${reset}\n ${cyan}-g, --global${reset} Install globally (to config directory)\n ${cyan}-l, --local${reset} Install locally (to current directory)\n ${cyan}--claude${reset} Install for Claude Code only\n ${cyan}--opencode${reset} Install for OpenCode only\n ${cyan}--gemini${reset} Install for Gemini only\n ${cyan}--kilo${reset} Install for Kilo only\n ${cyan}--codex${reset} Install for Codex only\n ${cyan}--copilot${reset} Install for Copilot only\n ${cyan}--antigravity${reset} Install for Antigravity only\n ${cyan}--cursor${reset} Install for Cursor only\n ${cyan}--windsurf${reset} Install for Windsurf only\n ${cyan}--augment${reset} Install for Augment only\n ${cyan}--trae${reset} Install for Trae only\n ${cyan}--all${reset} Install for all runtimes\n ${cyan}--sdk${reset} Also install GSD SDK CLI (gsd-sdk)\n ${cyan}-u, --uninstall${reset} Uninstall GSD (remove all GSD files)\n ${cyan}-c, --config-dir <path>${reset} Specify custom config directory\n ${cyan}-h, --help${reset} Show this help message\n ${cyan}--force-statusline${reset} Replace existing statusline config\n\n ${yellow}Examples:${reset}\n ${dim}# Interactive install (prompts for runtime and location)${reset}\n npx get-shit-done-cc\n\n ${dim}# Install for Claude Code globally${reset}\n npx get-shit-done-cc --claude --global\n\n ${dim}# Install for Gemini globally${reset}\n npx get-shit-done-cc --gemini --global\n\n ${dim}# Install for Kilo globally${reset}\n npx get-shit-done-cc --kilo --global\n\n ${dim}# Install for Codex globally${reset}\n npx get-shit-done-cc --codex --global\n\n ${dim}# Install for Copilot globally${reset}\n npx get-shit-done-cc --copilot --global\n\n ${dim}# Install for Copilot locally${reset}\n npx get-shit-done-cc --copilot --local\n\n ${dim}# Install for Antigravity globally${reset}\n npx get-shit-done-cc --antigravity --global\n\n ${dim}# Install for Antigravity locally${reset}\n npx get-shit-done-cc --antigravity --local\n\n ${dim}# Install for Cursor globally${reset}\n npx get-shit-done-cc --cursor --global\n\n ${dim}# Install for Cursor locally${reset}\n npx get-shit-done-cc --cursor --local\n\n ${dim}# Install for Windsurf globally${reset}\n npx get-shit-done-cc --windsurf --global\n\n ${dim}# Install for Windsurf locally${reset}\n npx get-shit-done-cc --windsurf --local\n\n ${dim}# Install for Augment globally${reset}\n npx get-shit-done-cc --augment --global\n\n ${dim}# Install for Augment locally${reset}\n npx get-shit-done-cc --augment --local\n\n ${dim}# Install for Trae globally${reset}\n npx get-shit-done-cc --trae --global\n\n ${dim}# Install for Trae locally${reset}\n npx get-shit-done-cc --trae --local\n\n ${dim}# Install for all runtimes globally${reset}\n npx get-shit-done-cc --all --global\n\n ${dim}# Install to custom config directory${reset}\n npx get-shit-done-cc --kilo --global --config-dir ~/.kilo-work\n\n ${dim}# Install to current project only${reset}\n npx get-shit-done-cc --claude --local\n\n ${dim}# Uninstall GSD from Cursor globally${reset}\n npx get-shit-done-cc --cursor --global --uninstall\n\n ${yellow}Notes:${reset}\n The --config-dir option is useful when you have multiple configurations.\n It takes priority over CLAUDE_CONFIG_DIR / OPENCODE_CONFIG_DIR / GEMINI_CONFIG_DIR / KILO_CONFIG_DIR / CODEX_HOME / COPILOT_CONFIG_DIR / ANTIGRAVITY_CONFIG_DIR / CURSOR_CONFIG_DIR / WINDSURF_CONFIG_DIR / AUGMENT_CONFIG_DIR / TRAE_CONFIG_DIR environment variables.\n`);
console.log(` ${yellow}Usage:${reset} npx get-shit-done-cc [options]\n\n ${yellow}Options:${reset}\n ${cyan}-g, --global${reset} Install globally (to config directory)\n ${cyan}-l, --local${reset} Install locally (to current directory)\n ${cyan}--claude${reset} Install for Claude Code only\n ${cyan}--opencode${reset} Install for OpenCode only\n ${cyan}--gemini${reset} Install for Gemini only\n ${cyan}--kilo${reset} Install for Kilo only\n ${cyan}--codex${reset} Install for Codex only\n ${cyan}--copilot${reset} Install for Copilot only\n ${cyan}--antigravity${reset} Install for Antigravity only\n ${cyan}--cursor${reset} Install for Cursor only\n ${cyan}--windsurf${reset} Install for Windsurf only\n ${cyan}--augment${reset} Install for Augment only\n ${cyan}--trae${reset} Install for Trae only\n ${cyan}--all${reset} Install for all runtimes\n ${cyan}-u, --uninstall${reset} Uninstall GSD (remove all GSD files)\n ${cyan}-c, --config-dir <path>${reset} Specify custom config directory\n ${cyan}-h, --help${reset} Show this help message\n ${cyan}--force-statusline${reset} Replace existing statusline config\n\n ${yellow}Examples:${reset}\n ${dim}# Interactive install (prompts for runtime and location)${reset}\n npx get-shit-done-cc\n\n ${dim}# Install for Claude Code globally${reset}\n npx get-shit-done-cc --claude --global\n\n ${dim}# Install for Gemini globally${reset}\n npx get-shit-done-cc --gemini --global\n\n ${dim}# Install for Kilo globally${reset}\n npx get-shit-done-cc --kilo --global\n\n ${dim}# Install for Codex globally${reset}\n npx get-shit-done-cc --codex --global\n\n ${dim}# Install for Copilot globally${reset}\n npx get-shit-done-cc --copilot --global\n\n ${dim}# Install for Copilot locally${reset}\n npx get-shit-done-cc --copilot --local\n\n ${dim}# Install for Antigravity globally${reset}\n npx get-shit-done-cc --antigravity --global\n\n ${dim}# Install for Antigravity locally${reset}\n npx get-shit-done-cc --antigravity --local\n\n ${dim}# Install for Cursor globally${reset}\n npx get-shit-done-cc --cursor --global\n\n ${dim}# Install for Cursor locally${reset}\n npx get-shit-done-cc --cursor --local\n\n ${dim}# Install for Windsurf globally${reset}\n npx get-shit-done-cc --windsurf --global\n\n ${dim}# Install for Windsurf locally${reset}\n npx get-shit-done-cc --windsurf --local\n\n ${dim}# Install for Augment globally${reset}\n npx get-shit-done-cc --augment --global\n\n ${dim}# Install for Augment locally${reset}\n npx get-shit-done-cc --augment --local\n\n ${dim}# Install for Trae globally${reset}\n npx get-shit-done-cc --trae --global\n\n ${dim}# Install for Trae locally${reset}\n npx get-shit-done-cc --trae --local\n\n ${dim}# Install for all runtimes globally${reset}\n npx get-shit-done-cc --all --global\n\n ${dim}# Install to custom config directory${reset}\n npx get-shit-done-cc --kilo --global --config-dir ~/.kilo-work\n\n ${dim}# Install to current project only${reset}\n npx get-shit-done-cc --claude --local\n\n ${dim}# Uninstall GSD from Cursor globally${reset}\n npx get-shit-done-cc --cursor --global --uninstall\n\n ${yellow}Notes:${reset}\n The --config-dir option is useful when you have multiple configurations.\n It takes priority over CLAUDE_CONFIG_DIR / OPENCODE_CONFIG_DIR / GEMINI_CONFIG_DIR / KILO_CONFIG_DIR / CODEX_HOME / COPILOT_CONFIG_DIR / ANTIGRAVITY_CONFIG_DIR / CURSOR_CONFIG_DIR / WINDSURF_CONFIG_DIR / AUGMENT_CONFIG_DIR / TRAE_CONFIG_DIR environment variables.\n`);
process.exit(0);
}
@@ -5888,71 +5887,6 @@ function handleStatusline(settings, isInteractive, callback) {
});
}
/**
* Install the GSD SDK globally via npm.
* @returns {boolean} true if install succeeded
*/
function installSdk() {
const sdkVersion = pkg.version;
const sdkPkg = `@gsd-build/sdk@${sdkVersion}`;
console.log(`\n ${cyan}Installing GSD SDK...${reset}`);
console.log(` ${dim}npm install -g ${sdkPkg}${reset}\n`);
try {
require('child_process').execSync(`npm install -g ${sdkPkg}`, { stdio: 'inherit' });
console.log(`\n ${green}${reset} GSD SDK installed (${cyan}gsd-sdk${reset} command available)`);
return true;
} catch (e) {
console.log(`\n ${yellow}${reset} SDK install failed: ${e.message}`);
console.log(` ${dim}You can install it manually: npm install -g ${sdkPkg}${reset}`);
return false;
}
}
/**
* Prompt the user to optionally install the GSD SDK.
* Called after runtime installation completes.
* @param {Function} callback - called with true/false
*/
function promptSdk(callback) {
if (!process.stdin.isTTY) {
callback(false);
return;
}
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let answered = false;
rl.on('close', () => {
if (!answered) {
answered = true;
callback(false);
}
});
console.log(`
${yellow}Also install the GSD SDK?${reset}
The SDK provides a standalone CLI for autonomous execution:
${dim}gsd-sdk init @prd.md${reset} Bootstrap a project from a PRD
${dim}gsd-sdk auto${reset} Run full autonomous lifecycle
${dim}gsd-sdk run "prompt"${reset} Execute a milestone from text
${cyan}1${reset}) No
${cyan}2${reset}) Yes ${dim}(runs: npm install -g @gsd-build/sdk)${reset}
`);
rl.question(` Choice ${dim}[1]${reset}: `, (answer) => {
answered = true;
rl.close();
const choice = answer.trim() || '1';
callback(choice === '2');
});
}
/**
* Prompt for runtime selection
*/
@@ -5974,30 +5908,30 @@ function promptRuntime(callback) {
const runtimeMap = {
'1': 'claude',
'2': 'kilo',
'3': 'opencode',
'4': 'gemini',
'5': 'codex',
'6': 'copilot',
'7': 'antigravity',
'8': 'cursor',
'9': 'windsurf',
'10': 'augment',
'11': 'trae'
'2': 'antigravity',
'3': 'augment',
'4': 'codex',
'5': 'copilot',
'6': 'cursor',
'7': 'gemini',
'8': 'kilo',
'9': 'opencode',
'10': 'trae',
'11': 'windsurf'
};
const allRuntimes = ['claude', 'kilo', 'opencode', 'gemini', 'codex', 'copilot', 'antigravity', 'cursor', 'windsurf', 'augment', 'trae'];
const allRuntimes = ['claude', 'antigravity', 'augment', 'codex', 'copilot', 'cursor', 'gemini', 'kilo', 'opencode', 'trae', 'windsurf'];
console.log(` ${yellow}Which runtime(s) would you like to install for?${reset}\n\n ${cyan}1${reset}) Claude Code ${dim}(~/.claude)${reset}
${cyan}2${reset}) Kilo ${dim}(~/.config/kilo)${reset}
${cyan}3${reset}) OpenCode ${dim}(~/.config/opencode)${reset}
${cyan}4${reset}) Gemini ${dim}(~/.gemini)${reset}
${cyan}5${reset}) Codex ${dim}(~/.codex)${reset}
${cyan}6${reset}) Copilot ${dim}(~/.copilot)${reset}
${cyan}7${reset}) Antigravity ${dim}(~/.gemini/antigravity)${reset}
${cyan}8${reset}) Cursor ${dim}(~/.cursor)${reset}
${cyan}9${reset}) Windsurf ${dim}(~/.windsurf)${reset}
${cyan}10${reset}) Augment ${dim}(~/.augment)${reset}
${cyan}11${reset}) Trae ${dim}(~/.trae)${reset}
${cyan}2${reset}) Antigravity ${dim}(~/.gemini/antigravity)${reset}
${cyan}3${reset}) Augment ${dim}(~/.augment)${reset}
${cyan}4${reset}) Codex ${dim}(~/.codex)${reset}
${cyan}5${reset}) Copilot ${dim}(~/.copilot)${reset}
${cyan}6${reset}) Cursor ${dim}(~/.cursor)${reset}
${cyan}7${reset}) Gemini ${dim}(~/.gemini)${reset}
${cyan}8${reset}) Kilo ${dim}(~/.config/kilo)${reset}
${cyan}9${reset}) OpenCode ${dim}(~/.config/opencode)${reset}
${cyan}10${reset}) Trae ${dim}(~/.trae)${reset}
${cyan}11${reset}) Windsurf ${dim}(~/.windsurf)${reset}
${cyan}12${reset}) All
${dim}Select multiple: 1,2,6 or 1 2 6${reset}
@@ -6104,18 +6038,7 @@ function installAllRuntimes(runtimes, isGlobal, isInteractive) {
}
};
if (hasSdk) {
// --sdk flag: install without prompting
installSdk();
printSummaries();
} else if (isInteractive) {
promptSdk((wantsSdk) => {
if (wantsSdk) installSdk();
printSummaries();
});
} else {
printSummaries();
}
printSummaries();
};
if (primaryStatuslineResult) {
@@ -6184,8 +6107,6 @@ if (process.env.GSD_TEST_MODE) {
writeManifest,
reportLocalPatches,
validateHookFields,
installSdk,
promptSdk,
};
} else {

View File

@@ -20,7 +20,11 @@ const HOOKS_TO_COPY = [
'gsd-prompt-guard.js',
'gsd-read-guard.js',
'gsd-statusline.js',
'gsd-workflow-guard.js'
'gsd-workflow-guard.js',
// Community hooks (bash, opt-in via .planning/config.json hooks.community)
'gsd-session-state.sh',
'gsd-validate-commit.sh',
'gsd-phase-boundary.sh'
];
/**
@@ -60,16 +64,22 @@ function build() {
continue;
}
// Validate syntax before copying
const syntaxError = validateSyntax(src);
if (syntaxError) {
console.error(`\x1b[31m✗ ${hook}: SyntaxError — ${syntaxError}\x1b[0m`);
hasErrors = true;
continue;
// Validate JS syntax before copying (.sh files skip — not Node.js)
if (hook.endsWith('.js')) {
const syntaxError = validateSyntax(src);
if (syntaxError) {
console.error(`\x1b[31m✗ ${hook}: SyntaxError — ${syntaxError}\x1b[0m`);
hasErrors = true;
continue;
}
}
console.log(`\x1b[32m✓\x1b[0m Copying ${hook}...`);
fs.copyFileSync(src, dest);
// Preserve executable bit for shell scripts
if (hook.endsWith('.sh')) {
try { fs.chmodSync(dest, 0o755); } catch (e) { /* Windows */ }
}
}
if (hasErrors) {

View File

@@ -0,0 +1,69 @@
/**
* Regression tests for:
* #1656 — 3 bash hooks referenced in settings.json but never installed
* #1657 — SDK install prompt fires and fails during interactive install
*/
'use strict';
process.env.GSD_TEST_MODE = '1';
const { test, describe, before } = require('node:test');
const assert = require('node:assert');
const fs = require('fs');
const path = require('path');
const { execFileSync } = require('child_process');
const HOOKS_DIST = path.join(__dirname, '..', 'hooks', 'dist');
const BUILD_SCRIPT = path.join(__dirname, '..', 'scripts', 'build-hooks.js');
const INSTALL_SRC = path.join(__dirname, '..', 'bin', 'install.js');
// ─── #1656 ───────────────────────────────────────────────────────────────────
describe('#1656: community .sh hooks must be present in hooks/dist', () => {
// Run the build script once before checking outputs.
// hooks/dist/ is gitignored so it must be generated; this mirrors what
// `npm run build:hooks` (prepublishOnly) does before publish.
before(() => {
execFileSync(process.execPath, [BUILD_SCRIPT], {
encoding: 'utf-8',
stdio: 'pipe',
});
});
test('gsd-session-state.sh exists in hooks/dist', () => {
const p = path.join(HOOKS_DIST, 'gsd-session-state.sh');
assert.ok(fs.existsSync(p), 'gsd-session-state.sh must be in hooks/dist/ so the installer can copy it');
});
test('gsd-validate-commit.sh exists in hooks/dist', () => {
const p = path.join(HOOKS_DIST, 'gsd-validate-commit.sh');
assert.ok(fs.existsSync(p), 'gsd-validate-commit.sh must be in hooks/dist/ so the installer can copy it');
});
test('gsd-phase-boundary.sh exists in hooks/dist', () => {
const p = path.join(HOOKS_DIST, 'gsd-phase-boundary.sh');
assert.ok(fs.existsSync(p), 'gsd-phase-boundary.sh must be in hooks/dist/ so the installer can copy it');
});
});
// ─── #1657 ───────────────────────────────────────────────────────────────────
describe('#1657: SDK prompt must not appear in installer source', () => {
let src;
test('install.js does not contain promptSdk call', () => {
src = fs.readFileSync(INSTALL_SRC, 'utf-8');
assert.ok(
!src.includes('promptSdk('),
'promptSdk() must not be called — SDK prompt causes install failures when package does not exist on npm'
);
});
test('install.js does not contain --sdk flag handling', () => {
src = src || fs.readFileSync(INSTALL_SRC, 'utf-8');
assert.ok(
!src.includes("args.includes('--sdk')"),
'--sdk flag must be removed to prevent users triggering a broken SDK install'
);
});
});

View File

@@ -343,8 +343,9 @@ describe('multi-process concurrent write tests', () => {
);
const toolsPath = TOOLS_PATH;
const cmdA = `node "${toolsPath}" state patch --Status Complete --cwd "${tmpDir}"`;
const cmdB = `node "${toolsPath}" state patch --"Current Plan" 01-02 --cwd "${tmpDir}"`;
const nodeBin = process.execPath;
const cmdA = `"${nodeBin}" "${toolsPath}" state patch --Status Complete --cwd "${tmpDir}"`;
const cmdB = `"${nodeBin}" "${toolsPath}" state patch --"Current Plan" 01-02 --cwd "${tmpDir}"`;
const [resultA, resultB] = await Promise.all([
execAsync(cmdA, { encoding: 'utf-8' }).catch(e => e),
@@ -384,8 +385,9 @@ describe('multi-process concurrent write tests', () => {
);
const toolsPath = TOOLS_PATH;
const cmdA = `node "${toolsPath}" state patch --Status Complete --cwd "${tmpDir}"`;
const cmdB = `node "${toolsPath}" state patch --"Current Plan" 01-02 --cwd "${tmpDir}"`;
const nodeBin = process.execPath;
const cmdA = `"${nodeBin}" "${toolsPath}" state patch --Status Complete --cwd "${tmpDir}"`;
const cmdB = `"${nodeBin}" "${toolsPath}" state patch --"Current Plan" 01-02 --cwd "${tmpDir}"`;
await Promise.all([
execAsync(cmdA, { encoding: 'utf-8' }).catch(() => {}),

View File

@@ -139,8 +139,8 @@ describe('Source code integration (Copilot)', () => {
assert.ok(src.includes('--copilot'), 'help text has --copilot option');
});
test('CLI-02: promptRuntime runtimeMap has Copilot as option 6', () => {
assert.ok(src.includes("'6': 'copilot'"), 'runtimeMap has 6 -> copilot');
test('CLI-02: promptRuntime runtimeMap has Copilot as option 5', () => {
assert.ok(src.includes("'5': 'copilot'"), 'runtimeMap has 5 -> copilot');
});
test('CLI-02: promptRuntime allRuntimes array includes copilot', () => {

View File

@@ -46,7 +46,14 @@ function runGsdTools(args, cwd = process.cwd(), env = {}) {
env: childEnv,
});
} else {
result = execSync(`node "${TOOLS_PATH}" ${args}`, {
// Split shell-style string into argv, stripping surrounding quotes, so we
// can invoke execFileSync with process.execPath instead of relying on
// `node` being on PATH (it isn't in Claude Code shell sessions).
// Apply shell-style quote removal: strip surrounding quotes from quoted
// sequences anywhere in a token (handles both "foo bar" and --"foo bar").
const argv = (args.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g) || [])
.map(t => t.replace(/"([^"]*)"/g, '$1').replace(/'([^']*)'/g, '$1'));
result = execFileSync(process.execPath, [TOOLS_PATH, ...argv], {
cwd,
encoding: 'utf-8',
stdio: ['pipe', 'pipe', 'pipe'],

View File

@@ -18,6 +18,18 @@ const { spawnSync } = require('child_process');
const HOOKS_DIR = path.join(__dirname, '..', 'hooks');
const isWindows = process.platform === 'win32';
// Ensure the running node binary is on PATH so bash hooks can call `node`
// (Claude Code shell sessions do not have `node` on PATH).
const hookEnv = {
...process.env,
PATH: `${path.dirname(process.execPath)}:${process.env.PATH || '/usr/local/bin:/usr/bin:/bin'}`,
};
// Wrapper that always injects hookEnv so bash hooks can find `node`.
function spawnHook(hookPath, options) {
return spawnSync('bash', [hookPath], { ...options, env: hookEnv });
}
// ─── Helpers ────────────────────────────────────────────────────────────────
function createTempProject(prefix = 'gsd-hook-test-') {
@@ -212,7 +224,7 @@ describe('opt-in gating behavior', { skip: isWindows ? 'bash hooks require unix
tool_input: { command: 'git commit -m "WIP save"' }
});
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: tmpDir,
@@ -231,7 +243,7 @@ describe('opt-in gating behavior', { skip: isWindows ? 'bash hooks require unix
});
try {
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: bareDir,
@@ -248,7 +260,7 @@ describe('opt-in gating behavior', { skip: isWindows ? 'bash hooks require unix
writeMinimalStateMd(tmpDir);
const hookPath = path.join(HOOKS_DIR, 'gsd-session-state.sh');
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input: '',
encoding: 'utf-8',
cwd: tmpDir,
@@ -269,7 +281,7 @@ describe('opt-in gating behavior', { skip: isWindows ? 'bash hooks require unix
tool_input: { file_path: '.planning/STATE.md' }
});
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: tmpDir,
@@ -305,7 +317,7 @@ describe('hook execution when enabled', { skip: isWindows ? 'bash hooks require
tool_input: { command: 'git commit -m "fix(core): add locking mechanism"' }
});
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: tmpDir,
@@ -320,7 +332,7 @@ describe('hook execution when enabled', { skip: isWindows ? 'bash hooks require
tool_input: { command: 'git commit -m "WIP save"' }
});
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: tmpDir,
@@ -337,7 +349,7 @@ describe('hook execution when enabled', { skip: isWindows ? 'bash hooks require
tool_input: { command: 'git push origin main' }
});
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: tmpDir,
@@ -350,7 +362,7 @@ describe('hook execution when enabled', { skip: isWindows ? 'bash hooks require
writeMinimalStateMd(tmpDir);
const hookPath = path.join(HOOKS_DIR, 'gsd-session-state.sh');
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input: '',
encoding: 'utf-8',
cwd: tmpDir,
@@ -371,7 +383,7 @@ describe('hook execution when enabled', { skip: isWindows ? 'bash hooks require
const hookPath = path.join(HOOKS_DIR, 'gsd-session-state.sh');
try {
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input: '',
encoding: 'utf-8',
cwd: noStateDir,
@@ -393,7 +405,7 @@ describe('hook execution when enabled', { skip: isWindows ? 'bash hooks require
tool_input: { file_path: '.planning/STATE.md' }
});
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: tmpDir,
@@ -429,7 +441,7 @@ describe('hook security tests', { skip: isWindows ? 'bash hooks require unix she
tool_input: { command: 'git commit -m "$(rm -rf /)"' }
});
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: tmpDir,
@@ -445,7 +457,7 @@ describe('hook security tests', { skip: isWindows ? 'bash hooks require unix she
tool_input: { command: 'git commit -m "`whoami`"' }
});
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: tmpDir,
@@ -461,7 +473,7 @@ describe('hook security tests', { skip: isWindows ? 'bash hooks require unix she
tool_input: { command: 'git commit -m "fix(api/v2): handle edge case"' }
});
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: tmpDir,
@@ -474,7 +486,7 @@ describe('hook security tests', { skip: isWindows ? 'bash hooks require unix she
const hookPath = path.join(HOOKS_DIR, 'gsd-phase-boundary.sh');
const input = 'not json at all';
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: tmpDir,
@@ -495,7 +507,7 @@ describe('hook security tests', { skip: isWindows ? 'bash hooks require unix she
tool_input: { command: 'git commit -m "WIP save"' }
});
const result = spawnSync('bash', [hookPath], {
const result = spawnHook(hookPath, {
input,
encoding: 'utf-8',
cwd: tmpDir,

View File

@@ -221,12 +221,12 @@ describe('Source code integration (Kilo)', () => {
assert.ok(src.includes("'kilo'"), '--all includes kilo runtime');
});
test('promptRuntime runtimeMap has Kilo as option 2', () => {
assert.ok(src.includes("'2': 'kilo'"), 'runtimeMap has 2 -> kilo');
test('promptRuntime runtimeMap has Kilo as option 8', () => {
assert.ok(src.includes("'8': 'kilo'"), 'runtimeMap has 8 -> kilo');
});
test('prompt text shows Kilo above OpenCode without marketing copy', () => {
assert.ok(src.includes('2${reset}) Kilo'), 'prompt lists Kilo as option 2');
assert.ok(src.includes('8${reset}) Kilo'), 'prompt lists Kilo as option 8');
assert.ok(!src.includes('the #1 AI coding platform on OpenRouter'), 'prompt does not include marketing tagline');
});

View File

@@ -19,18 +19,18 @@ const installSrc = fs.readFileSync(
// Extract runtimeMap from source for validation
const runtimeMap = {
'1': 'claude',
'2': 'kilo',
'3': 'opencode',
'4': 'gemini',
'5': 'codex',
'6': 'copilot',
'7': 'antigravity',
'8': 'cursor',
'9': 'windsurf',
'10': 'augment',
'11': 'trae'
'2': 'antigravity',
'3': 'augment',
'4': 'codex',
'5': 'copilot',
'6': 'cursor',
'7': 'gemini',
'8': 'kilo',
'9': 'opencode',
'10': 'trae',
'11': 'windsurf'
};
const allRuntimes = ['claude', 'kilo', 'opencode', 'gemini', 'codex', 'copilot', 'antigravity', 'cursor', 'windsurf', 'augment', 'trae'];
const allRuntimes = ['claude', 'antigravity', 'augment', 'codex', 'copilot', 'cursor', 'gemini', 'kilo', 'opencode', 'trae', 'windsurf'];
/**
* Simulate the parsing logic from promptRuntime without requiring readline.
@@ -58,39 +58,39 @@ function parseRuntimeInput(input) {
describe('multi-runtime selection parsing', () => {
test('single choice returns single runtime', () => {
assert.deepStrictEqual(parseRuntimeInput('1'), ['claude']);
assert.deepStrictEqual(parseRuntimeInput('2'), ['kilo']);
assert.deepStrictEqual(parseRuntimeInput('3'), ['opencode']);
assert.deepStrictEqual(parseRuntimeInput('4'), ['gemini']);
assert.deepStrictEqual(parseRuntimeInput('5'), ['codex']);
assert.deepStrictEqual(parseRuntimeInput('8'), ['cursor']);
assert.deepStrictEqual(parseRuntimeInput('2'), ['antigravity']);
assert.deepStrictEqual(parseRuntimeInput('3'), ['augment']);
assert.deepStrictEqual(parseRuntimeInput('4'), ['codex']);
assert.deepStrictEqual(parseRuntimeInput('5'), ['copilot']);
assert.deepStrictEqual(parseRuntimeInput('6'), ['cursor']);
});
test('comma-separated choices return multiple runtimes', () => {
assert.deepStrictEqual(parseRuntimeInput('1,5,7'), ['claude', 'codex', 'antigravity']);
assert.deepStrictEqual(parseRuntimeInput('2,3'), ['kilo', 'opencode']);
assert.deepStrictEqual(parseRuntimeInput('3,4'), ['opencode', 'gemini']);
assert.deepStrictEqual(parseRuntimeInput('1,5,7'), ['claude', 'copilot', 'gemini']);
assert.deepStrictEqual(parseRuntimeInput('2,3'), ['antigravity', 'augment']);
assert.deepStrictEqual(parseRuntimeInput('3,4'), ['augment', 'codex']);
});
test('space-separated choices return multiple runtimes', () => {
assert.deepStrictEqual(parseRuntimeInput('1 5 7'), ['claude', 'codex', 'antigravity']);
assert.deepStrictEqual(parseRuntimeInput('6 8'), ['copilot', 'cursor']);
assert.deepStrictEqual(parseRuntimeInput('1 5 7'), ['claude', 'copilot', 'gemini']);
assert.deepStrictEqual(parseRuntimeInput('6 8'), ['cursor', 'kilo']);
});
test('mixed comma and space separators work', () => {
assert.deepStrictEqual(parseRuntimeInput('1, 5, 7'), ['claude', 'codex', 'antigravity']);
assert.deepStrictEqual(parseRuntimeInput('2 , 6'), ['kilo', 'copilot']);
assert.deepStrictEqual(parseRuntimeInput('1, 5, 7'), ['claude', 'copilot', 'gemini']);
assert.deepStrictEqual(parseRuntimeInput('2 , 6'), ['antigravity', 'cursor']);
});
test('single choice for windsurf', () => {
assert.deepStrictEqual(parseRuntimeInput('9'), ['windsurf']);
});
test('single choice for augment', () => {
assert.deepStrictEqual(parseRuntimeInput('10'), ['augment']);
test('single choice for opencode', () => {
assert.deepStrictEqual(parseRuntimeInput('9'), ['opencode']);
});
test('single choice for trae', () => {
assert.deepStrictEqual(parseRuntimeInput('11'), ['trae']);
assert.deepStrictEqual(parseRuntimeInput('10'), ['trae']);
});
test('single choice for windsurf', () => {
assert.deepStrictEqual(parseRuntimeInput('11'), ['windsurf']);
});
test('choice 12 returns all runtimes', () => {
@@ -109,23 +109,23 @@ describe('multi-runtime selection parsing', () => {
});
test('invalid choices mixed with valid are filtered out', () => {
assert.deepStrictEqual(parseRuntimeInput('1,13,5'), ['claude', 'codex']);
assert.deepStrictEqual(parseRuntimeInput('abc 3 xyz'), ['opencode']);
assert.deepStrictEqual(parseRuntimeInput('1,13,5'), ['claude', 'copilot']);
assert.deepStrictEqual(parseRuntimeInput('abc 3 xyz'), ['augment']);
});
test('duplicate choices are deduplicated', () => {
assert.deepStrictEqual(parseRuntimeInput('1,1,1'), ['claude']);
assert.deepStrictEqual(parseRuntimeInput('5,5,7,7'), ['codex', 'antigravity']);
assert.deepStrictEqual(parseRuntimeInput('5,5,7,7'), ['copilot', 'gemini']);
});
test('preserves selection order', () => {
assert.deepStrictEqual(parseRuntimeInput('7,1,5'), ['antigravity', 'claude', 'codex']);
assert.deepStrictEqual(parseRuntimeInput('8,2,6'), ['cursor', 'kilo', 'copilot']);
assert.deepStrictEqual(parseRuntimeInput('7,1,5'), ['gemini', 'claude', 'copilot']);
assert.deepStrictEqual(parseRuntimeInput('8,2,6'), ['kilo', 'antigravity', 'cursor']);
});
});
describe('install.js source contains multi-select support', () => {
test('runtimeMap is defined with all 10 runtimes', () => {
test('runtimeMap is defined with all 11 runtimes', () => {
for (const [key, name] of Object.entries(runtimeMap)) {
assert.ok(
installSrc.includes(`'${key}': '${name}'`),
@@ -149,10 +149,10 @@ describe('install.js source contains multi-select support', () => {
);
});
test('prompt lists Augment as option 10 and All as option 12', () => {
test('prompt lists Trae as option 10 and All as option 12', () => {
assert.ok(
installSrc.includes('10${reset}) Augment'),
'prompt lists Augment as option 10'
installSrc.includes('10${reset}) Trae'),
'prompt lists Trae as option 10'
);
assert.ok(
installSrc.includes('12${reset}) All'),