* fix(installer): deploy commands directory in local installs (#1736) Local Claude installs now populate .claude/commands/gsd/ with command .md files. Claude Code reads local project commands from .claude/commands/gsd/, not .claude/skills/ — only the global ~/.claude/skills/ is used for the skills format. The previous code deployed skills/ for both global and local installs, causing all /gsd-* commands to return "Unknown skill" after a local install. Global installs continue to use skills/gsd-xxx/SKILL.md (Claude Code 2.1.88+ format). Local installs now use commands/gsd/xxx.md (the format Claude Code reads for local project commands). Also adds execute-phase.md to the prompt-injection scan allowlist (the workflow grew past 50K chars, matching the existing discuss-phase.md exemption). Closes #1736 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(installer): fix test cleanup pattern and uninstall local/global split (#1736) Replace try/finally with t.after() in all 3 regression tests per CONTRIBUTING.md conventions. Split the Claude Code uninstall branch on isGlobal: global removes skills/gsd-*/ directories (with legacy commands/gsd/ cleanup), local removes commands/gsd/ as the primary install location since #1736. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
83 lines
2.7 KiB
JavaScript
83 lines
2.7 KiB
JavaScript
/**
|
|
* Regression test for #1736: local Claude install missing commands/gsd/
|
|
*
|
|
* After a fresh local install (`--claude --local`), all /gsd-* commands
|
|
* except /gsd-help return "Unknown skill: gsd-quick" because
|
|
* .claude/commands/gsd/ is not populated. Claude Code reads local project
|
|
* commands from .claude/commands/gsd/ (the commands/ format), not from
|
|
* .claude/skills/ — only the global ~/.claude/skills/ is used for skills.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
process.env.GSD_TEST_MODE = '1';
|
|
|
|
const { describe, test, beforeEach, afterEach } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
const os = require('os');
|
|
const { execFileSync } = require('child_process');
|
|
|
|
const INSTALL_SRC = path.join(__dirname, '..', 'bin', 'install.js');
|
|
const { install, copyCommandsAsClaudeSkills } = require(INSTALL_SRC);
|
|
|
|
// ─── #1736: local install deploys commands/gsd/ ─────────────────────────────
|
|
|
|
describe('#1736: local Claude install populates .claude/commands/gsd/', () => {
|
|
let tmpDir;
|
|
|
|
beforeEach(() => {
|
|
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsd-local-install-1736-'));
|
|
});
|
|
|
|
afterEach(() => {
|
|
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
});
|
|
|
|
test('local install creates .claude/commands/gsd/ directory', (t) => {
|
|
const origCwd = process.cwd();
|
|
t.after(() => { process.chdir(origCwd); });
|
|
process.chdir(tmpDir);
|
|
install(false, 'claude');
|
|
|
|
const commandsDir = path.join(tmpDir, '.claude', 'commands', 'gsd');
|
|
assert.ok(
|
|
fs.existsSync(commandsDir),
|
|
'.claude/commands/gsd/ directory must exist after local install'
|
|
);
|
|
});
|
|
|
|
test('local install deploys at least one .md command file to .claude/commands/gsd/', (t) => {
|
|
const origCwd = process.cwd();
|
|
t.after(() => { process.chdir(origCwd); });
|
|
process.chdir(tmpDir);
|
|
install(false, 'claude');
|
|
|
|
const commandsDir = path.join(tmpDir, '.claude', 'commands', 'gsd');
|
|
assert.ok(
|
|
fs.existsSync(commandsDir),
|
|
'.claude/commands/gsd/ must exist'
|
|
);
|
|
|
|
const files = fs.readdirSync(commandsDir).filter(f => f.endsWith('.md'));
|
|
assert.ok(
|
|
files.length > 0,
|
|
`.claude/commands/gsd/ must contain at least one .md file, found: ${JSON.stringify(files)}`
|
|
);
|
|
});
|
|
|
|
test('local install deploys quick.md to .claude/commands/gsd/', (t) => {
|
|
const origCwd = process.cwd();
|
|
t.after(() => { process.chdir(origCwd); });
|
|
process.chdir(tmpDir);
|
|
install(false, 'claude');
|
|
|
|
const quickCmd = path.join(tmpDir, '.claude', 'commands', 'gsd', 'quick.md');
|
|
assert.ok(
|
|
fs.existsSync(quickCmd),
|
|
'.claude/commands/gsd/quick.md must exist after local install'
|
|
);
|
|
});
|
|
});
|