Files
get-shit-done/tests/bugs-1656-1657.test.cjs
Tom Boucher ca6a273685 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>
2026-04-04 14:15:30 -04:00

70 lines
2.8 KiB
JavaScript

/**
* 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'
);
});
});