@ahmed118glitch/get-shit-done-codex 1.18.3 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/README.md +101 -85
  3. package/agents/gsd-phase-researcher.md +1 -1
  4. package/agents/gsd-roadmapper.md +39 -5
  5. package/agents/gsd-verifier.md +2 -2
  6. package/bin/install-codex.js +100 -100
  7. package/bin/install.js +65 -8
  8. package/commands/gsd/discuss-phase.md +1 -1
  9. package/commands/gsd/reapply-patches.md +3 -3
  10. package/commands/gsd/verify-work.md +1 -1
  11. package/get-shit-done/bin/gsd-tools.js +106 -19
  12. package/get-shit-done/bin/gsd-tools.test.js +44 -0
  13. package/get-shit-done/references/model-profile-resolution.md +4 -2
  14. package/get-shit-done/references/model-profiles.md +3 -0
  15. package/get-shit-done/references/questioning.md +1 -0
  16. package/get-shit-done/templates/UAT.md +1 -1
  17. package/get-shit-done/templates/context.md +2 -2
  18. package/get-shit-done/templates/planner-subagent-prompt.md +4 -4
  19. package/get-shit-done/templates/research.md +2 -2
  20. package/get-shit-done/templates/verification-report.md +1 -1
  21. package/get-shit-done/workflows/diagnose-issues.md +1 -1
  22. package/get-shit-done/workflows/discovery-phase.md +1 -1
  23. package/get-shit-done/workflows/discuss-phase.md +3 -3
  24. package/get-shit-done/workflows/execute-phase.md +51 -2
  25. package/get-shit-done/workflows/help.md +4 -4
  26. package/get-shit-done/workflows/new-milestone.md +1 -1
  27. package/get-shit-done/workflows/new-project.md +3 -3
  28. package/get-shit-done/workflows/plan-phase.md +1 -1
  29. package/get-shit-done/workflows/progress.md +2 -2
  30. package/get-shit-done/workflows/update.md +14 -12
  31. package/get-shit-done/workflows/verify-work.md +3 -3
  32. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,22 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.19.0] - 2026-02-15
10
+
11
+ ### Added
12
+ - Brave Search integration for researchers (requires BRAVE_API_KEY environment variable)
13
+ - GitHub issue templates for bug reports and feature requests
14
+ - Security policy for responsible disclosure
15
+ - Auto-labeling workflow for new issues
16
+
17
+ ### Fixed
18
+ - UAT gaps and debug sessions now auto-resolve after gap-closure phase execution (#580)
19
+ - Fall back to ROADMAP.md when phase directory missing (#521)
20
+ - Template hook paths for OpenCode/Gemini runtimes (#585)
21
+ - Accept both `##` and `###` phase headers, detect malformed ROADMAPs (#598, #599)
22
+ - Use `{phase_num}` instead of ambiguous `{phase}` for filenames (#601)
23
+ - Add package.json to prevent ESM inheritance issues (#602)
24
+
9
25
  ## [1.18.0] - 2026-02-08
10
26
 
11
27
  ### Added
@@ -1206,7 +1222,8 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
1206
1222
  - YOLO mode for autonomous execution
1207
1223
  - Interactive mode with checkpoints
1208
1224
 
1209
- [Unreleased]: https://github.com/glittercowboy/get-shit-done/compare/v1.18.0...HEAD
1225
+ [Unreleased]: https://github.com/glittercowboy/get-shit-done/compare/v1.19.0...HEAD
1226
+ [1.19.0]: https://github.com/glittercowboy/get-shit-done/releases/tag/v1.19.0
1210
1227
  [1.18.0]: https://github.com/glittercowboy/get-shit-done/releases/tag/v1.18.0
1211
1228
  [1.17.0]: https://github.com/glittercowboy/get-shit-done/releases/tag/v1.17.0
1212
1229
  [1.16.0]: https://github.com/glittercowboy/get-shit-done/releases/tag/v1.16.0
package/README.md CHANGED
@@ -1,86 +1,102 @@
1
- # Get Shit Done (GSD)
2
-
3
- Get Shit Done is a planning-first workflow system for AI coding agents. This repository packages the core GSD engine, workflow templates, runtime command surfaces, and a Codex prompt layer.
4
-
5
- ## What Is In This Repository
6
-
7
- - `commands/gsd/`: command source files used by runtime installers
8
- - `get-shit-done/bin/gsd-tools.js`: core CLI utilities and state/workflow helpers
9
- - `get-shit-done/workflows/`: end-to-end command workflows
10
- - `get-shit-done/templates/`: planning and state templates
11
- - `get-shit-done/references/`: supporting reference docs
12
- - `agents/`: role-specific agent instruction files
13
- - `hooks/` and `scripts/build-hooks.js`: hook sources and build pipeline
14
- - `.codex/prompts/` and `.codex/skills/`: Codex-native prompt and skill layer
15
-
16
- ## Install
17
-
18
- Prerequisite: Node.js `>=16.7.0`.
19
-
20
- ```bash
21
- npx @ahmed118glitch/get-shit-done-codex@latest --path .
22
- ```
23
-
24
- Common examples:
25
-
26
- ```bash
27
- # Install Codex files into the current project directory
28
- npx @ahmed118glitch/get-shit-done-codex@latest --path .
29
-
30
- # Install into an explicit target folder:
31
- npx @ahmed118glitch/get-shit-done-codex@latest --path /path/to/project
32
-
33
- # Install shared copy under your home directory as well:
34
- npx @ahmed118glitch/get-shit-done-codex@latest --global
35
-
36
- # Run the runtime installer (Claude/OpenCode/Gemini) from this scoped package:
37
- npx --yes --package=@ahmed118glitch/get-shit-done-codex@latest get-shit-done-cc --help
38
- ```
39
-
40
- ## Runtime Command Surface
41
-
42
- - Claude Code and Gemini CLI use `/gsd:<command>` (example: `/gsd:help`)
43
- - OpenCode uses `/gsd-<command>` (example: `/gsd-help`)
44
- - Codex prompt files are in `.codex/prompts/gsd-*.md`
45
-
46
- ## Quick Workflow
47
-
48
- 1. Start a project with `new-project`
49
- 2. Plan a phase with `plan-phase`
50
- 3. Execute the phase with `execute-phase`
51
- 4. Verify with `verify-work`
52
- 5. Repeat per phase or milestone
53
-
54
- Installed commands create and update planning artifacts under `.planning/` (for example: `PROJECT.md`, `REQUIREMENTS.md`, `ROADMAP.md`, `STATE.md`).
55
-
56
- ## Source Paths vs Installed Paths
57
-
58
- Repository source paths:
59
-
60
- - `commands/gsd/*`
61
- - `get-shit-done/workflows/*`
62
- - `get-shit-done/templates/*`
63
-
64
- Installed runtime targets:
65
-
66
- - Claude global: `~/.claude`
67
- - OpenCode global: `~/.config/opencode` (or platform XDG equivalent)
68
- - Gemini global: `~/.gemini`
69
- - Local mode: runtime folders in the current project
70
-
71
- ## Development
72
-
73
- ```bash
74
- npm test
75
- npm run build:hooks
76
- ```
77
-
78
- Keep command and workflow behavior aligned across `commands/gsd/` and `get-shit-done/workflows/` when making changes.
79
-
80
- ## Security
81
-
82
- Report vulnerabilities privately via `SECURITY.md`.
83
-
84
- ## License
85
-
1
+ # Get Shit Done (GSD)
2
+
3
+ Get Shit Done is a planning-first workflow system for AI coding agents. This repository packages the core GSD engine, workflow templates, runtime command surfaces, and a Codex prompt layer.
4
+
5
+ ## What Is In This Repository
6
+
7
+ - `commands/gsd/`: command source files used by runtime installers
8
+ - `get-shit-done/bin/gsd-tools.js`: core CLI utilities and state/workflow helpers
9
+ - `get-shit-done/workflows/`: end-to-end command workflows
10
+ - `get-shit-done/templates/`: planning and state templates
11
+ - `get-shit-done/references/`: supporting reference docs
12
+ - `agents/`: role-specific agent instruction files
13
+ - `hooks/` and `scripts/build-hooks.js`: hook sources and build pipeline
14
+ - `.codex/prompts/` and `.codex/skills/`: Codex-native prompt and skill layer
15
+
16
+ ## Install
17
+
18
+ Prerequisite: Node.js `>=16.7.0`.
19
+
20
+ ```bash
21
+ npx @ahmed118glitch/get-shit-done-codex@latest --path .
22
+ ```
23
+
24
+ Common examples:
25
+
26
+ ```bash
27
+ # Install Codex files into the current project directory
28
+ npx @ahmed118glitch/get-shit-done-codex@latest --path .
29
+
30
+ # Install into an explicit target folder:
31
+ npx @ahmed118glitch/get-shit-done-codex@latest --path /path/to/project
32
+
33
+ # Install shared copy under your home directory as well:
34
+ npx @ahmed118glitch/get-shit-done-codex@latest --global
35
+
36
+ # Run the runtime installer from this scoped package (examples):
37
+ npx --yes --package=@ahmed118glitch/get-shit-done-codex@latest get-shit-done-cc --all --global
38
+ npx --yes --package=@ahmed118glitch/get-shit-done-codex@latest get-shit-done-cc --claude --local
39
+ ```
40
+
41
+ Global install writes prompts to `~/.codex/prompts` (not nested).
42
+
43
+ ## Verify Install
44
+
45
+ ```bash
46
+ # Project prompts
47
+ ls ./.codex/prompts/gsd-*.md
48
+
49
+ # Global prompts (if you used --global)
50
+ ls ~/.codex/prompts/gsd-*.md
51
+ ```
52
+
53
+ ## Runtime Command Surface
54
+
55
+ - Claude Code and Gemini CLI use `/gsd:<command>` (example: `/gsd:help`)
56
+ - OpenCode uses `/gsd-<command>` (example: `/gsd-help`)
57
+ - Codex prompt files are in `.codex/prompts/gsd-*.md`
58
+
59
+ ## Quick Workflow
60
+
61
+ Use the command surface above (`/gsd:<command>`, `/gsd-<command>`, or Codex `gsd-*` prompts).
62
+
63
+ 1. Start a project with `new-project`
64
+ 2. Plan a phase with `plan-phase`
65
+ 3. Execute the phase with `execute-phase`
66
+ 4. Verify with `verify-work`
67
+ 5. Repeat per phase or milestone
68
+
69
+ Installed commands create and update planning artifacts under `.planning/` (for example: `PROJECT.md`, `REQUIREMENTS.md`, `ROADMAP.md`, `STATE.md`).
70
+
71
+ ## Source Paths vs Installed Paths
72
+
73
+ Repository source paths:
74
+
75
+ - `commands/gsd/*`
76
+ - `get-shit-done/workflows/*`
77
+ - `get-shit-done/templates/*`
78
+
79
+ Installed runtime targets:
80
+
81
+ - Claude global: `~/.claude`
82
+ - OpenCode global: `~/.config/opencode` (or platform XDG equivalent)
83
+ - Gemini global: `~/.gemini`
84
+ - Codex global prompts/skills: `~/.codex/prompts`, `~/.codex/skills`
85
+ - Local mode: runtime folders in the current project
86
+
87
+ ## Development
88
+
89
+ ```bash
90
+ npm test
91
+ npm run build:hooks
92
+ ```
93
+
94
+ Keep command and workflow behavior aligned across `commands/gsd/` and `get-shit-done/workflows/` when making changes.
95
+
96
+ ## Security
97
+
98
+ Report vulnerabilities privately via `SECURITY.md`.
99
+
100
+ ## License
101
+
86
102
  MIT (`LICENSE`).
@@ -177,7 +177,7 @@ Priority: Context7 > Official Docs > Official GitHub > Verified WebSearch > Unve
177
177
 
178
178
  ## RESEARCH.md Structure
179
179
 
180
- **Location:** `.planning/phases/XX-name/{phase}-RESEARCH.md`
180
+ **Location:** `.planning/phases/XX-name/{phase_num}-RESEARCH.md`
181
181
 
182
182
  ```markdown
183
183
  # Phase [X]: [Name] - Research
@@ -286,12 +286,46 @@ After roadmap creation, REQUIREMENTS.md gets updated with phase mappings:
286
286
 
287
287
  ## ROADMAP.md Structure
288
288
 
289
- Use template from `~/.claude/get-shit-done/templates/roadmap.md`.
289
+ **CRITICAL: ROADMAP.md requires TWO phase representations. Both are mandatory.**
290
290
 
291
- Key sections:
292
- - Overview (2-3 sentences)
293
- - Phases with Goal, Dependencies, Requirements, Success Criteria
294
- - Progress table
291
+ ### 1. Summary Checklist (under `## Phases`)
292
+
293
+ ```markdown
294
+ - [ ] **Phase 1: Name** - One-line description
295
+ - [ ] **Phase 2: Name** - One-line description
296
+ - [ ] **Phase 3: Name** - One-line description
297
+ ```
298
+
299
+ ### 2. Detail Sections (under `## Phase Details`)
300
+
301
+ ```markdown
302
+ ### Phase 1: Name
303
+ **Goal**: What this phase delivers
304
+ **Depends on**: Nothing (first phase)
305
+ **Requirements**: REQ-01, REQ-02
306
+ **Success Criteria** (what must be TRUE):
307
+ 1. Observable behavior from user perspective
308
+ 2. Observable behavior from user perspective
309
+ **Plans**: TBD
310
+
311
+ ### Phase 2: Name
312
+ **Goal**: What this phase delivers
313
+ **Depends on**: Phase 1
314
+ ...
315
+ ```
316
+
317
+ **The `### Phase X:` headers are parsed by downstream tools.** If you only write the summary checklist, phase lookups will fail.
318
+
319
+ ### 3. Progress Table
320
+
321
+ ```markdown
322
+ | Phase | Plans Complete | Status | Completed |
323
+ |-------|----------------|--------|-----------|
324
+ | 1. Name | 0/3 | Not started | - |
325
+ | 2. Name | 0/2 | Not started | - |
326
+ ```
327
+
328
+ Reference full template: `~/.claude/get-shit-done/templates/roadmap.md`
295
329
 
296
330
  ## STATE.md Structure
297
331
 
@@ -317,7 +317,7 @@ gaps:
317
317
 
318
318
  ## Create VERIFICATION.md
319
319
 
320
- Create `.planning/phases/{phase_dir}/{phase}-VERIFICATION.md`:
320
+ Create `.planning/phases/{phase_dir}/{phase_num}-VERIFICATION.md`:
321
321
 
322
322
  ```markdown
323
323
  ---
@@ -411,7 +411,7 @@ Return with:
411
411
 
412
412
  **Status:** {passed | gaps_found | human_needed}
413
413
  **Score:** {N}/{M} must-haves verified
414
- **Report:** .planning/phases/{phase_dir}/{phase}-VERIFICATION.md
414
+ **Report:** .planning/phases/{phase_dir}/{phase_num}-VERIFICATION.md
415
415
 
416
416
  {If passed:}
417
417
  All must-haves verified. Phase goal achieved. Ready to proceed.
@@ -1,100 +1,100 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
- const os = require('os');
6
-
7
- const args = process.argv.slice(2);
8
- const pkg = require('../package.json');
9
- const repoRoot = path.resolve(__dirname, '..');
10
-
11
- const helpText = `
12
- ${pkg.name} v${pkg.version}
13
-
14
- Usage:
15
- get-shit-done-codex [--path <target-dir>] [--help]
16
-
17
- Options:
18
- --path <target-dir> Install into this directory (defaults to current directory)
19
- --global Also install .claude to your home directory (for manual sharing)
20
- --help, -h Show this help message
21
-
22
- Examples:
23
- npx @ahmed118glitch/get-shit-done-codex@latest --path .
24
- npx @ahmed118glitch/get-shit-done-codex@latest --path ./my-project
25
- `;
26
-
27
- if (args.includes('--help') || args.includes('-h')) {
28
- console.log(helpText);
29
- process.exit(0);
30
- }
31
-
32
- const pathArgIndex = args.findIndex((arg, index) => {
33
- if (arg === '--path') return true;
34
- return false;
35
- });
36
- let targetDir = process.cwd();
37
- if (pathArgIndex !== -1) {
38
- const userPath = args[pathArgIndex + 1];
39
- if (!userPath || userPath.startsWith('-')) {
40
- console.error('Error: --path requires a directory argument.');
41
- process.exit(1);
42
- }
43
- targetDir = path.resolve(process.cwd(), userPath);
44
- }
45
-
46
- const installGlobal = args.includes('--global');
47
-
48
- function copyRecursive(source, destination) {
49
- if (!fs.existsSync(source)) return;
50
- fs.cpSync(source, destination, { recursive: true, force: true });
51
- }
52
-
53
- function ensureDir(dirPath) {
54
- fs.mkdirSync(dirPath, { recursive: true });
55
- }
56
-
57
- function resolveSourceDir(repoRelative, fallbackRelative) {
58
- const primary = path.join(repoRoot, repoRelative);
59
- const fallback = fallbackRelative ? path.join(repoRoot, fallbackRelative) : null;
60
-
61
- if (fs.existsSync(primary)) return primary;
62
- if (fallback && fs.existsSync(fallback)) return fallback;
63
-
64
- const fallbackMessage = fallbackRelative ? ` or ${fallbackRelative}` : '';
65
- throw new Error(`Missing source directory "${repoRelative}"${fallbackMessage} in repository root ${repoRoot}`);
66
- }
67
-
68
- function copyCodexToDirectory(baseDir) {
69
- const targetCodex = path.join(baseDir, '.codex');
70
- const targetClaude = path.join(baseDir, '.claude');
71
- const sourceCodex = path.join(repoRoot, '.codex');
72
- const sourceGetShitDone = resolveSourceDir('get-shit-done', '.claude/get-shit-done');
73
- const sourceAgents = resolveSourceDir('agents', '.claude/agents');
74
-
75
- ensureDir(baseDir);
76
- ensureDir(targetCodex);
77
- ensureDir(targetClaude);
78
-
79
- copyRecursive(sourceCodex, targetCodex);
80
- copyRecursive(sourceGetShitDone, path.join(targetClaude, 'get-shit-done'));
81
- copyRecursive(sourceAgents, path.join(targetClaude, 'agents'));
82
- }
83
-
84
- copyCodexToDirectory(targetDir);
85
-
86
- if (installGlobal) {
87
- // Global installs should place prompts at ~/.codex/prompts (not ~/.codex/.codex/prompts).
88
- const globalBase = os.homedir();
89
- copyCodexToDirectory(globalBase);
90
- }
91
-
92
- console.log(`\n${pkg.name} installed to:`);
93
- console.log(` local: ${targetDir}`);
94
- if (installGlobal) {
95
- console.log(' global: ~/.codex');
96
- }
97
- console.log('\nNext steps:');
98
- console.log(' 1) Open your project in Codex');
99
- console.log(' 2) Run prompt gsd-new-project, then gsd-plan-phase, gsd-execute-phase');
100
- console.log(' 3) Use .codex/prompts/* for all GSD commands in this fork');
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const os = require('os');
6
+
7
+ const args = process.argv.slice(2);
8
+ const pkg = require('../package.json');
9
+ const repoRoot = path.resolve(__dirname, '..');
10
+
11
+ const helpText = `
12
+ ${pkg.name} v${pkg.version}
13
+
14
+ Usage:
15
+ get-shit-done-codex [--path <target-dir>] [--help]
16
+
17
+ Options:
18
+ --path <target-dir> Install into this directory (defaults to current directory)
19
+ --global Also install .claude to your home directory (for manual sharing)
20
+ --help, -h Show this help message
21
+
22
+ Examples:
23
+ npx @ahmed118glitch/get-shit-done-codex@latest --path .
24
+ npx @ahmed118glitch/get-shit-done-codex@latest --path ./my-project
25
+ `;
26
+
27
+ if (args.includes('--help') || args.includes('-h')) {
28
+ console.log(helpText);
29
+ process.exit(0);
30
+ }
31
+
32
+ const pathArgIndex = args.findIndex((arg, index) => {
33
+ if (arg === '--path') return true;
34
+ return false;
35
+ });
36
+ let targetDir = process.cwd();
37
+ if (pathArgIndex !== -1) {
38
+ const userPath = args[pathArgIndex + 1];
39
+ if (!userPath || userPath.startsWith('-')) {
40
+ console.error('Error: --path requires a directory argument.');
41
+ process.exit(1);
42
+ }
43
+ targetDir = path.resolve(process.cwd(), userPath);
44
+ }
45
+
46
+ const installGlobal = args.includes('--global');
47
+
48
+ function copyRecursive(source, destination) {
49
+ if (!fs.existsSync(source)) return;
50
+ fs.cpSync(source, destination, { recursive: true, force: true });
51
+ }
52
+
53
+ function ensureDir(dirPath) {
54
+ fs.mkdirSync(dirPath, { recursive: true });
55
+ }
56
+
57
+ function resolveSourceDir(repoRelative, fallbackRelative) {
58
+ const primary = path.join(repoRoot, repoRelative);
59
+ const fallback = fallbackRelative ? path.join(repoRoot, fallbackRelative) : null;
60
+
61
+ if (fs.existsSync(primary)) return primary;
62
+ if (fallback && fs.existsSync(fallback)) return fallback;
63
+
64
+ const fallbackMessage = fallbackRelative ? ` or ${fallbackRelative}` : '';
65
+ throw new Error(`Missing source directory "${repoRelative}"${fallbackMessage} in repository root ${repoRoot}`);
66
+ }
67
+
68
+ function copyCodexToDirectory(baseDir) {
69
+ const targetCodex = path.join(baseDir, '.codex');
70
+ const targetClaude = path.join(baseDir, '.claude');
71
+ const sourceCodex = path.join(repoRoot, '.codex');
72
+ const sourceGetShitDone = resolveSourceDir('get-shit-done', '.claude/get-shit-done');
73
+ const sourceAgents = resolveSourceDir('agents', '.claude/agents');
74
+
75
+ ensureDir(baseDir);
76
+ ensureDir(targetCodex);
77
+ ensureDir(targetClaude);
78
+
79
+ copyRecursive(sourceCodex, targetCodex);
80
+ copyRecursive(sourceGetShitDone, path.join(targetClaude, 'get-shit-done'));
81
+ copyRecursive(sourceAgents, path.join(targetClaude, 'agents'));
82
+ }
83
+
84
+ copyCodexToDirectory(targetDir);
85
+
86
+ if (installGlobal) {
87
+ // Global installs should place prompts at ~/.codex/prompts (not ~/.codex/.codex/prompts).
88
+ const globalBase = os.homedir();
89
+ copyCodexToDirectory(globalBase);
90
+ }
91
+
92
+ console.log(`\n${pkg.name} installed to:`);
93
+ console.log(` local: ${targetDir}`);
94
+ if (installGlobal) {
95
+ console.log(' global: ~/.codex');
96
+ }
97
+ console.log('\nNext steps:');
98
+ console.log(' 1) Open your project in Codex');
99
+ console.log(' 2) Run prompt gsd-new-project, then gsd-plan-phase, gsd-execute-phase');
100
+ console.log(' 3) Use .codex/prompts/* for all GSD commands in this fork');
package/bin/install.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
@@ -46,6 +46,27 @@ function getDirName(runtime) {
46
46
  return '.claude';
47
47
  }
48
48
 
49
+ /**
50
+ * Get the config directory path relative to home directory for a runtime
51
+ * Used for templating hooks that use path.join(homeDir, '<configDir>', ...)
52
+ * @param {string} runtime - 'claude', 'opencode', or 'gemini'
53
+ * @param {boolean} isGlobal - Whether this is a global install
54
+ */
55
+ function getConfigDirFromHome(runtime, isGlobal) {
56
+ if (!isGlobal) {
57
+ // Local installs use the same dir name pattern
58
+ return getDirName(runtime);
59
+ }
60
+ // Global installs - OpenCode uses XDG path structure
61
+ if (runtime === 'opencode') {
62
+ // OpenCode: ~/.config/opencode -> '.config', 'opencode'
63
+ // Return as comma-separated for path.join() replacement
64
+ return "'.config', 'opencode'";
65
+ }
66
+ if (runtime === 'gemini') return "'.gemini'";
67
+ return "'.claude'";
68
+ }
69
+
49
70
  /**
50
71
  * Get the global config directory for OpenCode
51
72
  * OpenCode follows XDG Base Directory spec and uses ~/.config/opencode/
@@ -626,9 +647,11 @@ function copyFlattenedCommands(srcDir, destDir, prefix, pathPrefix, runtime) {
626
647
  const destPath = path.join(destDir, destName);
627
648
 
628
649
  let content = fs.readFileSync(srcPath, 'utf8');
629
- const claudeDirRegex = /~\/\.claude\//g;
650
+ const globalClaudeRegex = /~\/\.claude\//g;
651
+ const localClaudeRegex = /\.\/\.claude\//g;
630
652
  const opencodeDirRegex = /~\/\.opencode\//g;
631
- content = content.replace(claudeDirRegex, pathPrefix);
653
+ content = content.replace(globalClaudeRegex, pathPrefix);
654
+ content = content.replace(localClaudeRegex, `./${getDirName(runtime)}/`);
632
655
  content = content.replace(opencodeDirRegex, pathPrefix);
633
656
  content = processAttribution(content, getCommitAttribution(runtime));
634
657
  content = convertClaudeToOpencodeFrontmatter(content);
@@ -665,10 +688,12 @@ function copyWithPathReplacement(srcDir, destDir, pathPrefix, runtime) {
665
688
  if (entry.isDirectory()) {
666
689
  copyWithPathReplacement(srcPath, destPath, pathPrefix, runtime);
667
690
  } else if (entry.name.endsWith('.md')) {
668
- // Always replace ~/.claude/ as it is the source of truth in the repo
691
+ // Replace ~/.claude/ and ./.claude/ with runtime-appropriate paths
669
692
  let content = fs.readFileSync(srcPath, 'utf8');
670
- const claudeDirRegex = /~\/\.claude\//g;
671
- content = content.replace(claudeDirRegex, pathPrefix);
693
+ const globalClaudeRegex = /~\/\.claude\//g;
694
+ const localClaudeRegex = /\.\/\.claude\//g;
695
+ content = content.replace(globalClaudeRegex, pathPrefix);
696
+ content = content.replace(localClaudeRegex, `./${dirName}/`);
672
697
  content = processAttribution(content, getCommitAttribution(runtime));
673
698
 
674
699
  // Convert frontmatter for opencode compatibility
@@ -867,7 +892,23 @@ function uninstall(isGlobal, runtime = 'claude') {
867
892
  }
868
893
  }
869
894
 
870
- // 5. Clean up settings.json (remove GSD hooks and statusline)
895
+ // 5. Remove GSD package.json (CommonJS mode marker)
896
+ const pkgJsonPath = path.join(targetDir, 'package.json');
897
+ if (fs.existsSync(pkgJsonPath)) {
898
+ try {
899
+ const content = fs.readFileSync(pkgJsonPath, 'utf8').trim();
900
+ // Only remove if it's our minimal CommonJS marker
901
+ if (content === '{"type":"commonjs"}') {
902
+ fs.unlinkSync(pkgJsonPath);
903
+ removedCount++;
904
+ console.log(` ${green}✓${reset} Removed GSD package.json`);
905
+ }
906
+ } catch (e) {
907
+ // Ignore read errors
908
+ }
909
+ }
910
+
911
+ // 6. Clean up settings.json (remove GSD hooks and statusline)
871
912
  const settingsPath = path.join(targetDir, 'settings.json');
872
913
  if (fs.existsSync(settingsPath)) {
873
914
  let settings = readSettings(settingsPath);
@@ -1405,17 +1446,33 @@ function install(isGlobal, runtime = 'claude') {
1405
1446
  failures.push('VERSION');
1406
1447
  }
1407
1448
 
1449
+ // Write package.json to force CommonJS mode for GSD scripts
1450
+ // Prevents "require is not defined" errors when project has "type": "module"
1451
+ // Node.js walks up looking for package.json - this stops inheritance from project
1452
+ const pkgJsonDest = path.join(targetDir, 'package.json');
1453
+ fs.writeFileSync(pkgJsonDest, '{"type":"commonjs"}\n');
1454
+ console.log(` ${green}✓${reset} Wrote package.json (CommonJS mode)`);
1455
+
1408
1456
  // Copy hooks from dist/ (bundled with dependencies)
1457
+ // Template paths for the target runtime (replaces '.claude' with correct config dir)
1409
1458
  const hooksSrc = path.join(src, 'hooks', 'dist');
1410
1459
  if (fs.existsSync(hooksSrc)) {
1411
1460
  const hooksDest = path.join(targetDir, 'hooks');
1412
1461
  fs.mkdirSync(hooksDest, { recursive: true });
1413
1462
  const hookEntries = fs.readdirSync(hooksSrc);
1463
+ const configDirReplacement = getConfigDirFromHome(runtime, isGlobal);
1414
1464
  for (const entry of hookEntries) {
1415
1465
  const srcFile = path.join(hooksSrc, entry);
1416
1466
  if (fs.statSync(srcFile).isFile()) {
1417
1467
  const destFile = path.join(hooksDest, entry);
1418
- fs.copyFileSync(srcFile, destFile);
1468
+ // Template .js files to replace '.claude' with runtime-specific config dir
1469
+ if (entry.endsWith('.js')) {
1470
+ let content = fs.readFileSync(srcFile, 'utf8');
1471
+ content = content.replace(/'\.claude'/g, configDirReplacement);
1472
+ fs.writeFileSync(destFile, content);
1473
+ } else {
1474
+ fs.copyFileSync(srcFile, destFile);
1475
+ }
1419
1476
  }
1420
1477
  }
1421
1478
  if (verifyInstalled(hooksDest, 'hooks')) {
@@ -20,7 +20,7 @@ Extract implementation decisions that downstream agents need — researcher and
20
20
  3. Deep-dive each selected area until satisfied
21
21
  4. Create CONTEXT.md with decisions that guide research and planning
22
22
 
23
- **Output:** `{phase}-CONTEXT.md` — decisions clear enough that downstream agents can act without asking the user again
23
+ **Output:** `{phase_num}-CONTEXT.md` — decisions clear enough that downstream agents can act without asking the user again
24
24
  </objective>
25
25
 
26
26
  <execution_context>
@@ -14,11 +14,11 @@ After a GSD update wipes and reinstalls files, this command merges user's previo
14
14
  Check for local patches directory:
15
15
 
16
16
  ```bash
17
- # Global install
18
- PATCHES_DIR="${HOME}/.claude/gsd-local-patches"
17
+ # Global install (path templated at install time)
18
+ PATCHES_DIR=~/.claude/gsd-local-patches
19
19
  # Local install fallback
20
20
  if [ ! -d "$PATCHES_DIR" ]; then
21
- PATCHES_DIR="./.claude/gsd-local-patches"
21
+ PATCHES_DIR=./.claude/gsd-local-patches
22
22
  fi
23
23
  ```
24
24
 
@@ -16,7 +16,7 @@ Validate built features through conversational testing with persistent state.
16
16
 
17
17
  Purpose: Confirm what Claude built actually works from user's perspective. One test at a time, plain text responses, no interrogation. When issues are found, automatically diagnose, plan fixes, and prepare for execution.
18
18
 
19
- Output: {phase}-UAT.md tracking all test results. If issues found: diagnosed gaps, verified fix plans ready for /gsd:execute-phase
19
+ Output: {phase_num}-UAT.md tracking all test results. If issues found: diagnosed gaps, verified fix plans ready for /gsd:execute-phase
20
20
  </objective>
21
21
 
22
22
  <execution_context>