fix: replace removed gsd-sdk prompt references (#355)

* fix: replace removed gsd-sdk prompt references

* chore: add changeset
This commit is contained in:
Colin Johnson
2026-05-26 18:55:40 -04:00
committed by GitHub
parent ed149ff283
commit 7a3822fce1
25 changed files with 115 additions and 121 deletions

View File

@@ -1,10 +1,8 @@
/**
* Regression guard for #1766: $GSD_TOOLS env var undefined
* Regression guards for shipped prompt references to gsd-tools.cjs.
*
* All command files must use the resolved path to gsd-tools.cjs
* ($HOME/.claude/get-shit-done/bin/gsd-tools.cjs), not the undefined
* $GSD_TOOLS variable. This test catches any command file that
* references the undefined variable.
* Command and agent prompts must instruct clean installs to use the supported
* `gsd-tools query` binary, not the removed standalone `gsd-sdk query` binary.
*/
const { describe, test } = require('node:test');
@@ -13,49 +11,46 @@ const fs = require('fs');
const path = require('path');
const COMMANDS_DIR = path.join(__dirname, '..', 'commands', 'gsd');
const AGENTS_DIR = path.join(__dirname, '..', 'agents');
function mdFiles(dir) {
return fs.readdirSync(dir)
.filter(f => f.endsWith('.md'))
.map(f => path.join(dir, f));
}
function rel(file) {
return path.relative(path.join(__dirname, '..'), file);
}
describe('command files: gsd-tools path references (#1766)', () => {
test('no command file references undefined $GSD_TOOLS variable', () => {
const files = fs.readdirSync(COMMANDS_DIR).filter(f => f.endsWith('.md'));
test('shipped agents and commands do not instruct removed SDK query binaries', () => {
const files = [...mdFiles(COMMANDS_DIR), ...mdFiles(AGENTS_DIR)];
const violations = [];
for (const file of files) {
const content = fs.readFileSync(path.join(COMMANDS_DIR, file), 'utf-8');
// Match $GSD_TOOLS or "$GSD_TOOLS" or ${GSD_TOOLS} used as a path
// (not as a documentation reference)
const content = fs.readFileSync(file, 'utf-8');
const lines = content.split('\n');
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
if (/\$GSD_TOOLS\b/.test(line) && /node\s/.test(line)) {
violations.push(`${file}:${i + 1}: ${line.trim()}`);
if (/\bgsd-sdk\s+query\b|\$GSD_SDK\s+query/.test(lines[i])) {
violations.push(`${rel(file)}:${i + 1}: ${lines[i].trim()}`);
}
}
}
assert.strictEqual(violations.length, 0,
'Command files must not reference undefined $GSD_TOOLS. ' +
'Use $HOME/.claude/get-shit-done/bin/gsd-tools.cjs instead.\n' +
'Shipped agent/command prompts must use gsd-tools query, not removed SDK query forms.\n' +
'Violations:\n' + violations.join('\n'));
});
test('workstreams.md documents gsd-sdk query or legacy gsd-tools.cjs', () => {
test('workstreams.md documents the supported gsd-tools query binary', () => {
const content = fs.readFileSync(
path.join(COMMANDS_DIR, 'workstreams.md'), 'utf-8'
);
assert.ok(
/gsd-sdk\s+query/.test(content) || /gsd-tools\.cjs/.test(content),
'workstreams.md should document gsd-sdk query or gsd-tools.cjs'
/gsd-tools query workstream\.list/.test(content),
'workstreams.md should document gsd-tools query workstream.list'
);
const lines = content.split('\n');
for (const line of lines) {
if (/node\s/.test(line)) {
assert.ok(
line.includes('gsd-tools.cjs'),
'Each node invocation must reference gsd-tools.cjs, got: ' + line.trim()
);
}
}
});
});