gsd-opencode 1.33.2 → 1.35.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 (130) hide show
  1. package/agents/gsd-advisor-researcher.md +23 -0
  2. package/agents/gsd-ai-researcher.md +142 -0
  3. package/agents/gsd-code-fixer.md +523 -0
  4. package/agents/gsd-code-reviewer.md +361 -0
  5. package/agents/gsd-debugger.md +14 -1
  6. package/agents/gsd-domain-researcher.md +162 -0
  7. package/agents/gsd-eval-auditor.md +170 -0
  8. package/agents/gsd-eval-planner.md +161 -0
  9. package/agents/gsd-executor.md +70 -7
  10. package/agents/gsd-framework-selector.md +167 -0
  11. package/agents/gsd-intel-updater.md +320 -0
  12. package/agents/gsd-phase-researcher.md +26 -0
  13. package/agents/gsd-plan-checker.md +12 -0
  14. package/agents/gsd-planner.md +16 -6
  15. package/agents/gsd-project-researcher.md +23 -0
  16. package/agents/gsd-ui-researcher.md +23 -0
  17. package/agents/gsd-verifier.md +55 -1
  18. package/commands/gsd/gsd-add-backlog.md +1 -1
  19. package/commands/gsd/gsd-add-phase.md +1 -1
  20. package/commands/gsd/gsd-add-todo.md +1 -1
  21. package/commands/gsd/gsd-ai-integration-phase.md +36 -0
  22. package/commands/gsd/gsd-audit-fix.md +33 -0
  23. package/commands/gsd/gsd-autonomous.md +1 -0
  24. package/commands/gsd/gsd-check-todos.md +1 -1
  25. package/commands/gsd/gsd-code-review-fix.md +52 -0
  26. package/commands/gsd/gsd-code-review.md +55 -0
  27. package/commands/gsd/gsd-complete-milestone.md +1 -1
  28. package/commands/gsd/gsd-debug.md +1 -1
  29. package/commands/gsd/gsd-eval-review.md +32 -0
  30. package/commands/gsd/gsd-explore.md +27 -0
  31. package/commands/gsd/gsd-from-gsd2.md +45 -0
  32. package/commands/gsd/gsd-health.md +1 -1
  33. package/commands/gsd/gsd-import.md +36 -0
  34. package/commands/gsd/gsd-insert-phase.md +1 -1
  35. package/commands/gsd/gsd-intel.md +183 -0
  36. package/commands/gsd/gsd-manager.md +1 -1
  37. package/commands/gsd/gsd-next.md +2 -0
  38. package/commands/gsd/gsd-reapply-patches.md +58 -3
  39. package/commands/gsd/gsd-remove-phase.md +1 -1
  40. package/commands/gsd/gsd-review.md +4 -2
  41. package/commands/gsd/gsd-scan.md +26 -0
  42. package/commands/gsd/gsd-set-profile.md +1 -1
  43. package/commands/gsd/gsd-thread.md +1 -1
  44. package/commands/gsd/gsd-undo.md +34 -0
  45. package/commands/gsd/gsd-workstreams.md +6 -6
  46. package/get-shit-done/bin/gsd-tools.cjs +143 -5
  47. package/get-shit-done/bin/lib/commands.cjs +10 -2
  48. package/get-shit-done/bin/lib/config.cjs +71 -37
  49. package/get-shit-done/bin/lib/core.cjs +70 -8
  50. package/get-shit-done/bin/lib/gsd2-import.cjs +511 -0
  51. package/get-shit-done/bin/lib/init.cjs +20 -6
  52. package/get-shit-done/bin/lib/intel.cjs +660 -0
  53. package/get-shit-done/bin/lib/learnings.cjs +378 -0
  54. package/get-shit-done/bin/lib/milestone.cjs +25 -15
  55. package/get-shit-done/bin/lib/model-profiles.cjs +17 -17
  56. package/get-shit-done/bin/lib/phase.cjs +148 -112
  57. package/get-shit-done/bin/lib/roadmap.cjs +12 -5
  58. package/get-shit-done/bin/lib/security.cjs +119 -0
  59. package/get-shit-done/bin/lib/state.cjs +283 -221
  60. package/get-shit-done/bin/lib/template.cjs +8 -4
  61. package/get-shit-done/bin/lib/verify.cjs +42 -5
  62. package/get-shit-done/references/ai-evals.md +156 -0
  63. package/get-shit-done/references/ai-frameworks.md +186 -0
  64. package/get-shit-done/references/common-bug-patterns.md +114 -0
  65. package/get-shit-done/references/few-shot-examples/plan-checker.md +73 -0
  66. package/get-shit-done/references/few-shot-examples/verifier.md +109 -0
  67. package/get-shit-done/references/gates.md +70 -0
  68. package/get-shit-done/references/ios-scaffold.md +123 -0
  69. package/get-shit-done/references/model-profile-resolution.md +6 -7
  70. package/get-shit-done/references/model-profiles.md +20 -14
  71. package/get-shit-done/references/planning-config.md +237 -0
  72. package/get-shit-done/references/thinking-models-debug.md +44 -0
  73. package/get-shit-done/references/thinking-models-execution.md +50 -0
  74. package/get-shit-done/references/thinking-models-planning.md +62 -0
  75. package/get-shit-done/references/thinking-models-research.md +50 -0
  76. package/get-shit-done/references/thinking-models-verification.md +55 -0
  77. package/get-shit-done/references/thinking-partner.md +96 -0
  78. package/get-shit-done/references/universal-anti-patterns.md +6 -1
  79. package/get-shit-done/references/verification-overrides.md +227 -0
  80. package/get-shit-done/templates/AI-SPEC.md +246 -0
  81. package/get-shit-done/workflows/add-tests.md +3 -0
  82. package/get-shit-done/workflows/add-todo.md +2 -0
  83. package/get-shit-done/workflows/ai-integration-phase.md +284 -0
  84. package/get-shit-done/workflows/audit-fix.md +154 -0
  85. package/get-shit-done/workflows/autonomous.md +33 -2
  86. package/get-shit-done/workflows/check-todos.md +2 -0
  87. package/get-shit-done/workflows/cleanup.md +2 -0
  88. package/get-shit-done/workflows/code-review-fix.md +497 -0
  89. package/get-shit-done/workflows/code-review.md +515 -0
  90. package/get-shit-done/workflows/complete-milestone.md +40 -15
  91. package/get-shit-done/workflows/diagnose-issues.md +1 -1
  92. package/get-shit-done/workflows/discovery-phase.md +3 -1
  93. package/get-shit-done/workflows/discuss-phase-assumptions.md +1 -1
  94. package/get-shit-done/workflows/discuss-phase.md +21 -7
  95. package/get-shit-done/workflows/do.md +2 -0
  96. package/get-shit-done/workflows/docs-update.md +2 -0
  97. package/get-shit-done/workflows/eval-review.md +155 -0
  98. package/get-shit-done/workflows/execute-phase.md +307 -57
  99. package/get-shit-done/workflows/execute-plan.md +64 -93
  100. package/get-shit-done/workflows/explore.md +136 -0
  101. package/get-shit-done/workflows/help.md +1 -1
  102. package/get-shit-done/workflows/import.md +273 -0
  103. package/get-shit-done/workflows/inbox.md +387 -0
  104. package/get-shit-done/workflows/manager.md +4 -10
  105. package/get-shit-done/workflows/new-milestone.md +3 -1
  106. package/get-shit-done/workflows/new-project.md +2 -0
  107. package/get-shit-done/workflows/new-workspace.md +2 -0
  108. package/get-shit-done/workflows/next.md +56 -0
  109. package/get-shit-done/workflows/note.md +2 -0
  110. package/get-shit-done/workflows/plan-phase.md +97 -17
  111. package/get-shit-done/workflows/plant-seed.md +3 -0
  112. package/get-shit-done/workflows/pr-branch.md +41 -13
  113. package/get-shit-done/workflows/profile-user.md +4 -2
  114. package/get-shit-done/workflows/quick.md +99 -4
  115. package/get-shit-done/workflows/remove-workspace.md +2 -0
  116. package/get-shit-done/workflows/review.md +53 -6
  117. package/get-shit-done/workflows/scan.md +98 -0
  118. package/get-shit-done/workflows/secure-phase.md +2 -0
  119. package/get-shit-done/workflows/settings.md +18 -3
  120. package/get-shit-done/workflows/ship.md +3 -0
  121. package/get-shit-done/workflows/ui-phase.md +10 -2
  122. package/get-shit-done/workflows/ui-review.md +2 -0
  123. package/get-shit-done/workflows/undo.md +314 -0
  124. package/get-shit-done/workflows/update.md +2 -0
  125. package/get-shit-done/workflows/validate-phase.md +2 -0
  126. package/get-shit-done/workflows/verify-phase.md +83 -0
  127. package/get-shit-done/workflows/verify-work.md +12 -1
  128. package/package.json +1 -1
  129. package/skills/gsd-code-review/SKILL.md +48 -0
  130. package/skills/gsd-code-review-fix/SKILL.md +44 -0
@@ -9,6 +9,7 @@ read all files referenced by the invoking prompt's execution_context before star
9
9
  @$HOME/.config/opencode/get-shit-done/references/revision-loop.md
10
10
  @$HOME/.config/opencode/get-shit-done/references/gate-prompts.md
11
11
  @$HOME/.config/opencode/get-shit-done/references/agent-contracts.md
12
+ @$HOME/.config/opencode/get-shit-done/references/gates.md
12
13
  </required_reading>
13
14
 
14
15
  <available_agent_types>
@@ -45,7 +46,7 @@ Parse JSON for: `researcher_model`, `planner_model`, `checker_model`, `research_
45
46
 
46
47
  ## 2. Parse and Normalize Arguments
47
48
 
48
- Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--prd <filepath>`, `--reviews`, `--text`).
49
+ Extract from $ARGUMENTS: phase number (integer or decimal like `2.1`), flags (`--research`, `--skip-research`, `--gaps`, `--skip-verify`, `--skip-ui`, `--prd <filepath>`, `--reviews`, `--text`).
49
50
 
50
51
  Set `TEXT_MODE=true` if `--text` is present in $ARGUMENTS OR `text_mode` from init JSON is `true`. When `TEXT_MODE` is active, replace every `question` call with a plain-text numbered list and ask the user to type their choice number. This is required for OpenCode remote sessions (`/rc` mode) where TUI menus don't work through the OpenCode App.
51
52
 
@@ -240,6 +241,46 @@ If "Run discuss-phase first":
240
241
  ```
241
242
  **Exit the plan-phase workflow. Do not continue.**
242
243
 
244
+ ## 4.5. Check AI-SPEC
245
+
246
+ **Skip if:** `ai_integration_phase_enabled` from config is false, or `--skip-ai-spec` flag provided.
247
+
248
+ ```bash
249
+ AI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-AI-SPEC.md 2>/dev/null | head -1)
250
+ AI_PHASE_CFG=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ai_integration_phase 2>/dev/null || echo "true")
251
+ ```
252
+
253
+ **Skip if `AI_PHASE_CFG` is `false`.**
254
+
255
+ **If `AI_SPEC_FILE` is empty:** Check phase goal for AI keywords:
256
+ ```bash
257
+ echo "${phase_goal}" | grep -qi "agent\|llm\|rag\|chatbot\|embedding\|langchain\|llamaindex\|crewai\|langgraph\|openai\|anthropic\|vector\|eval\|ai system"
258
+ ```
259
+
260
+ **If AI keywords detected AND no AI-SPEC.md:**
261
+ ```
262
+ ◆ Note: This phase appears to involve AI system development.
263
+ Consider running /gsd-ai-integration-phase {N} before planning to:
264
+ - Select the right framework for your use case
265
+ - Research its docs and best practices
266
+ - Design an evaluation strategy
267
+
268
+ Continue planning without AI-SPEC? (non-blocking — /gsd-ai-integration-phase can be run after)
269
+ ```
270
+
271
+ Use question with options:
272
+ - "Continue — plan without AI-SPEC"
273
+ - "Stop — I'll run /gsd-ai-integration-phase {N} first"
274
+
275
+ If "Stop": Exit with `/gsd-ai-integration-phase {N}` reminder.
276
+ If "Continue": Proceed. (Non-blocking — planner will note AI-SPEC is absent.)
277
+
278
+ **If `AI_SPEC_FILE` is non-empty:** Extract framework for planner context:
279
+ ```bash
280
+ FRAMEWORK_LINE=$(grep "Selected Framework:" "${AI_SPEC_FILE}" | head -1)
281
+ ```
282
+ Pass `ai_spec_path` and `framework_line` to planner in step 7 so it can reference the AI design contract.
283
+
243
284
  ## 5. Handle Research
244
285
 
245
286
  **Skip if:** `--gaps` flag or `--skip-research` flag or `--reviews` flag.
@@ -417,6 +458,8 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
417
458
 
418
459
  **If UI-SPEC.md found:** Set `UI_SPEC_PATH=$UI_SPEC_FILE`. Display: `Using UI design contract: ${UI_SPEC_PATH}`
419
460
 
461
+ **If UI-SPEC.md missing AND `--skip-ui` flag is present in $ARGUMENTS:** Skip silently to step 6.
462
+
420
463
  **If UI-SPEC.md missing AND `UI_GATE_CFG` is `true`:**
421
464
 
422
465
  read auto-chain state:
@@ -439,24 +482,18 @@ Continue to step 6.
439
482
 
440
483
  **If `AUTO_CHAIN` is `false` (manual invocation):**
441
484
 
442
- If `TEXT_MODE` is true, present as a plain-text numbered list:
443
- ```
444
- Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?
445
-
446
- 1. Generate UI-SPEC first — Run /gsd-ui-phase {N} then re-run /gsd-plan-phase {N}
447
- 2. Continue without UI-SPEC
448
- 3. Not a frontend phase
485
+ Output this markdown directly (not as a code block):
449
486
 
450
- Enter number:
487
+ ```
488
+ ## ⚠ UI-SPEC.md missing for Phase {N}
489
+ ▶ Recommended next step:
490
+ `/gsd-ui-phase {N} ${GSD_WS}` — generate UI design contract before planning
491
+ ───────────────────────────────────────────────
492
+ Also available:
493
+ - `/gsd-plan-phase {N} --skip-ui ${GSD_WS}` — plan without UI-SPEC (not recommended for frontend phases)
451
494
  ```
452
495
 
453
- Otherwise use question:
454
- - header: "UI Design Contract"
455
- - question: "Phase {N} has frontend indicators but no UI-SPEC.md. Generate a design contract before planning?"
456
- - options:
457
- - "Generate UI-SPEC first" → Display: "Run `/gsd-ui-phase {N} ${GSD_WS}` then re-run `/gsd-plan-phase {N} ${GSD_WS}`". Exit workflow.
458
- - "Continue without UI-SPEC" → Continue to step 6.
459
- - "Not a frontend phase" → Continue to step 6.
496
+ **Exit the plan-phase workflow. Do not continue.**
460
497
 
461
498
  **If `HAS_UI` is 1 (no frontend indicators):** Skip silently to step 5.7.
462
499
 
@@ -757,13 +794,56 @@ ${AGENT_SKILLS_CHECKER}
757
794
  - **`## VERIFICATION PASSED`:** Display confirmation, proceed to step 13.
758
795
  - **`## ISSUES FOUND`:** Display issues, check iteration count, proceed to step 12.
759
796
 
797
+ **Thinking partner for architectural tradeoffs (conditional):**
798
+ If `features.thinking_partner` is enabled, scan the checker's issues for architectural tradeoff keywords
799
+ ("architecture", "approach", "strategy", "pattern", "vs", "alternative"). If found:
800
+
801
+ ```
802
+ The plan-checker flagged an architectural decision point:
803
+ {issue description}
804
+
805
+ Brief analysis:
806
+ - Option A: {approach_from_plan} — {pros/cons}
807
+ - Option B: {alternative_approach} — {pros/cons}
808
+ - Recommendation: {choice} aligned with {phase_goal}
809
+
810
+ Apply this to the revision? [Yes] / [No, I'll decide]
811
+ ```
812
+
813
+ If yes: include the recommendation in the revision prompt. If no: proceed to revision loop as normal.
814
+ If thinking_partner disabled: skip this block entirely.
815
+
760
816
  ## 12. Revision Loop (Max 3 Iterations)
761
817
 
762
818
  Track `iteration_count` (starts at 1 after initial plan + check).
819
+ Track `prev_issue_count` (initialized to `Infinity` before the loop begins).
820
+ Track `stall_reentry_count` (starts at 0; incremented each time "Adjust approach" re-enters step 8).
763
821
 
764
822
  **If iteration_count < 3:**
765
823
 
766
- Display: `Sending back to planner for revision... (iteration {N}/3)`
824
+ Parse issue count from checker return: count BLOCKER + WARNING entries in the YAML issues block (structured output from gsd-plan-checker). If the checker's return contains no YAML issues block (i.e., the plan was approved with no issues), treat `issue_count` as 0 and skip the stall check — the plan passed. Proceed to step 13.
825
+
826
+ Display: `Revision iteration {N}/3 -- {blocker_count} blockers, {warning_count} warnings`
827
+
828
+ **Stall detection:** If `issue_count >= prev_issue_count`:
829
+ Display: `Revision loop stalled — issue count not decreasing ({issue_count} issues remain after {N} iterations)`
830
+
831
+ **If `stall_reentry_count < 2`:**
832
+ Ask user:
833
+ question: "Issues remain after {N} revision attempts with no progress. Proceed with current output?"
834
+ Options: "Proceed anyway" | "Adjust approach"
835
+ If "Proceed anyway": accept current plans and continue to step 13.
836
+ If "Adjust approach": increment `stall_reentry_count`, open freeform discussion, then re-enter step 8 (full replanning). Note: re-entry resets `iteration_count` and `prev_issue_count` but `stall_reentry_count` persists across re-entries and is capped at 2.
837
+
838
+ **If `stall_reentry_count >= 2`:**
839
+ Display: `Stall persists after 2 re-planning attempts. The following issues could not be resolved automatically:`
840
+ List the remaining issues from the checker.
841
+ Suggest: "Consider resolving these issues manually or running `/gsd-debug` to investigate root causes."
842
+ Options: "Proceed anyway" | "Abandon"
843
+ If "Proceed anyway": accept current plans and continue to step 13.
844
+ If "Abandon": stop workflow.
845
+
846
+ Set `prev_issue_count = issue_count`.
767
847
 
768
848
  Revision prompt:
769
849
 
@@ -32,6 +32,9 @@ mkdir -p .planning/seeds
32
32
  <step name="gather_context">
33
33
  Ask focused questions to build a complete seed:
34
34
 
35
+
36
+ **Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `question` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-OpenCode runtimes (OpenAI Codex, Gemini CLI, etc.) where `question` is not available.
37
+
35
38
  ```
36
39
  question(
37
40
  header: "Trigger",
@@ -1,7 +1,8 @@
1
1
  <objective>
2
- Create a clean branch for pull requests by filtering out .planning/ commits.
3
- The PR branch contains only code changes reviewers don't see GSD artifacts
4
- (PLAN.md, SUMMARY.md, STATE.md, CONTEXT.md, etc.).
2
+ Create a clean branch for pull requests by filtering out transient .planning/ commits.
3
+ The PR branch contains only code changes and structural planning state reviewers
4
+ don't see GSD transient artifacts (PLAN.md, SUMMARY.md, CONTEXT.md, RESEARCH.md, etc.)
5
+ but milestone archives, STATE.md, ROADMAP.md, and PROJECT.md changes are preserved.
5
6
 
6
7
  Uses git cherry-pick with path filtering to rebuild a clean history.
7
8
  </objective>
@@ -48,24 +49,47 @@ Classify commits:
48
49
  git log --oneline "$TARGET".."$CURRENT_BRANCH" --no-merges
49
50
  ```
50
51
 
51
- For each commit, check if it ONLY touches .planning/ files:
52
+ **Structural planning files** always preserved (repository planning state):
53
+ - `.planning/STATE.md`
54
+ - `.planning/ROADMAP.md`
55
+ - `.planning/MILESTONES.md`
56
+ - `.planning/PROJECT.md`
57
+ - `.planning/REQUIREMENTS.md`
58
+ - `.planning/milestones/**`
59
+
60
+ **Transient planning files** — excluded from PR branch (reviewer noise):
61
+ - `.planning/phases/**` (PLAN.md, SUMMARY.md, CONTEXT.md, RESEARCH.md, etc.)
62
+ - `.planning/quick/**`
63
+ - `.planning/research/**`
64
+ - `.planning/threads/**`
65
+ - `.planning/todos/**`
66
+ - `.planning/debug/**`
67
+ - `.planning/seeds/**`
68
+ - `.planning/codebase/**`
69
+ - `.planning/ui-reviews/**`
70
+
71
+ For each commit, check what it touches:
52
72
 
53
73
  ```bash
54
74
  # For each commit hash
55
75
  FILES=$(git diff-tree --no-commit-id --name-only -r $HASH)
56
- ALL_PLANNING=$(echo "$FILES" | grep -v "^\.planning/" | wc -l)
76
+ NON_PLANNING=$(echo "$FILES" | grep -v "^\.planning/" | wc -l)
77
+ STRUCTURAL=$(echo "$FILES" | grep -E "^\.planning/(STATE|ROADMAP|MILESTONES|PROJECT|REQUIREMENTS)\.md|^\.planning/milestones/" | wc -l)
78
+ TRANSIENT_ONLY=$(echo "$FILES" | grep "^\.planning/" | grep -vE "^\.planning/(STATE|ROADMAP|MILESTONES|PROJECT|REQUIREMENTS)\.md|^\.planning/milestones/" | wc -l)
57
79
  ```
58
80
 
59
81
  Classify:
60
82
  - **Code commits**: Touch at least one non-.planning/ file → INCLUDE
61
- - **Planning-only commits**: Touch only .planning/ files → EXCLUDE
62
- - **Mixed commits**: Touch both INCLUDE (planning changes come along)
83
+ - **Structural planning commits**: Touch only structural .planning/ files (STATE.md, ROADMAP.md, MILESTONES.md, PROJECT.md, REQUIREMENTS.md, milestones/**) INCLUDE
84
+ - **Transient planning commits**: Touch only transient .planning/ files (phases/, quick/, research/, etc.) → EXCLUDE
85
+ - **Mixed commits**: Touch code + any planning files → INCLUDE (transient planning changes come along; acceptable in mixed context)
63
86
 
64
87
  Display analysis:
65
88
  ```
66
- Commits to include: {N} (code changes)
67
- Commits to exclude: {N} (planning-only)
89
+ Commits to include: {N} (code changes + structural planning)
90
+ Commits to exclude: {N} (transient planning-only)
68
91
  Mixed commits: {N} (code + planning — included)
92
+ Structural planning commits: {N} (STATE/ROADMAP/milestone updates — included)
69
93
  ```
70
94
  </step>
71
95
 
@@ -77,13 +101,17 @@ PR_BRANCH="${CURRENT_BRANCH}-pr"
77
101
  git checkout -b "$PR_BRANCH" "$TARGET"
78
102
  ```
79
103
 
80
- Cherry-pick only code commits (in order):
104
+ Cherry-pick code commits and structural planning commits (in order):
81
105
 
82
106
  ```bash
83
- for HASH in $CODE_COMMITS; do
107
+ for HASH in $CODE_AND_STRUCTURAL_COMMITS; do
84
108
  git cherry-pick "$HASH" --no-commit
85
- # Remove any .planning/ files that came along in mixed commits
86
- git rm -r --cached .planning/ 2>/dev/null || true
109
+ # Remove only transient .planning/ subdirectories that came along in mixed commits.
110
+ # DO NOT remove structural files (STATE.md, ROADMAP.md, MILESTONES.md, PROJECT.md,
111
+ # REQUIREMENTS.md, milestones/) — these must survive into the PR branch.
112
+ for dir in phases quick research threads todos debug seeds codebase ui-reviews; do
113
+ git rm -r --cached ".planning/$dir/" 2>/dev/null || true
114
+ done
87
115
  git commit -C "$HASH"
88
116
  done
89
117
  ```
@@ -30,6 +30,8 @@ PROFILE_PATH="$HOME/.config/opencode/get-shit-done/USER-PROFILE.md"
30
30
 
31
31
  **If profile exists AND --refresh NOT set AND --questionnaire NOT set:**
32
32
 
33
+
34
+ **Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `question` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-OpenCode runtimes (OpenAI Codex, Gemini CLI, etc.) where `question` is not available.
33
35
  Use question:
34
36
  - header: "Existing Profile"
35
37
  - question: "You already have a profile. What would you like to do?"
@@ -46,7 +48,7 @@ If "Cancel": Display "No changes made." and exit.
46
48
 
47
49
  Backup existing profile:
48
50
  ```bash
49
- cp "$HOME/.config/opencode/get-shit-done/USER-PROFILE.md" "$HOME/.config/opencode/get-shit-done/USER-PROFILE.backup.md"
51
+ cp "$HOME/.config/opencode/get-shit-done/USER-PROFILE.md" "$HOME/.OpenCode/USER-PROFILE.backup.md"
50
52
  ```
51
53
 
52
54
  Display: "Re-analyzing your sessions to update your profile."
@@ -381,7 +383,7 @@ read both old backup and new analysis to compare dimension ratings/confidence.
381
383
 
382
384
  read the backed-up profile:
383
385
  ```bash
384
- BACKUP_PATH="$HOME/.config/opencode/get-shit-done/USER-PROFILE.backup.md"
386
+ BACKUP_PATH="$HOME/.OpenCode/USER-PROFILE.backup.md"
385
387
  ```
386
388
 
387
389
  Compare each dimension's rating and confidence between old and new. Display diff table showing only changed dimensions:
@@ -23,6 +23,7 @@ Valid GSD subagent types (use exact names — do not fall back to 'general'):
23
23
  - gsd-plan-checker — Reviews plan quality before execution
24
24
  - gsd-executor — Executes plan tasks, commits, creates SUMMARY.md
25
25
  - gsd-verifier — Verifies phase completion, checks quality gates
26
+ - gsd-code-reviewer — Reviews source files for bugs, security issues, and code quality
26
27
  </available_agent_types>
27
28
 
28
29
  <process>
@@ -37,6 +38,9 @@ Parse `$ARGUMENTS` for:
37
38
 
38
39
  If `$DESCRIPTION` is empty after parsing, prompt user interactively:
39
40
 
41
+
42
+ **Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `question` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-OpenCode runtimes (OpenAI Codex, Gemini CLI, etc.) where `question` is not available.
43
+
40
44
  ```
41
45
  question(
42
46
  header: "Quick task",
@@ -545,8 +549,10 @@ ${USE_WORKTREES !== "false" ? `
545
549
  <worktree_branch_check>
546
550
  FIRST ACTION before any other work: verify this worktree branch is based on the correct commit.
547
551
  Run: git merge-base HEAD ${EXPECTED_BASE}
548
- If the result differs from ${EXPECTED_BASE}, run: git reset --soft ${EXPECTED_BASE}
549
- This corrects a known issue on Windows where EnterWorktree creates branches from main instead of the feature branch HEAD.
552
+ If the result differs from ${EXPECTED_BASE}, hard-reset to the correct base (safe — runs before any agent work):
553
+ git reset --hard ${EXPECTED_BASE}
554
+ Then verify: if [ "$(git rev-parse HEAD)" != "${EXPECTED_BASE}" ]; then echo "ERROR: Could not correct worktree base"; exit 1; fi
555
+ This corrects a known issue where EnterWorktree creates branches from main instead of the feature branch HEAD (affects all platforms).
550
556
  </worktree_branch_check>
551
557
  ` : ''}
552
558
 
@@ -577,7 +583,44 @@ After executor returns:
577
583
  for WT in $WORKTREES; do
578
584
  WT_BRANCH=$(git -C "$WT" rev-parse --abbrev-ref HEAD 2>/dev/null)
579
585
  if [ -n "$WT_BRANCH" ] && [ "$WT_BRANCH" != "HEAD" ]; then
580
- git merge "$WT_BRANCH" --no-edit -m "chore: merge quick task worktree ($WT_BRANCH)" 2>&1 || echo "⚠ Merge conflict — resolve manually"
586
+ # --- Orchestrator file protection (#1756) ---
587
+ # Backup STATE.md and ROADMAP.md before merge (main always wins)
588
+ STATE_BACKUP=$(mktemp)
589
+ ROADMAP_BACKUP=$(mktemp)
590
+ git show HEAD:.planning/STATE.md > "$STATE_BACKUP" 2>/dev/null || true
591
+ git show HEAD:.planning/ROADMAP.md > "$ROADMAP_BACKUP" 2>/dev/null || true
592
+
593
+ # Snapshot files on main to detect resurrections
594
+ PRE_MERGE_FILES=$(git ls-files .planning/)
595
+
596
+ git merge "$WT_BRANCH" --no-edit -m "chore: merge quick task worktree ($WT_BRANCH)" 2>&1 || {
597
+ echo "⚠ Merge conflict — resolve manually"
598
+ rm -f "$STATE_BACKUP" "$ROADMAP_BACKUP"
599
+ continue
600
+ }
601
+
602
+ # Restore orchestrator-owned files
603
+ if [ -s "$STATE_BACKUP" ]; then cp "$STATE_BACKUP" .planning/STATE.md; fi
604
+ if [ -s "$ROADMAP_BACKUP" ]; then cp "$ROADMAP_BACKUP" .planning/ROADMAP.md; fi
605
+ rm -f "$STATE_BACKUP" "$ROADMAP_BACKUP"
606
+
607
+ # Remove files deleted on main but re-added by worktree
608
+ DELETED_FILES=$(git diff --diff-filter=A --name-only HEAD~1 -- .planning/ 2>/dev/null || true)
609
+ for RESURRECTED in $DELETED_FILES; do
610
+ if ! echo "$PRE_MERGE_FILES" | grep -qxF "$RESURRECTED"; then
611
+ git rm -f "$RESURRECTED" 2>/dev/null || true
612
+ fi
613
+ done
614
+
615
+ if ! git diff --quiet .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || \
616
+ [ -n "$DELETED_FILES" ]; then
617
+ COMMIT_DOCS=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get commit_docs 2>/dev/null || echo "true")
618
+ if [ "$COMMIT_DOCS" != "false" ]; then
619
+ git add .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || true
620
+ git commit --amend --no-edit 2>/dev/null || true
621
+ fi
622
+ fi
623
+
581
624
  git worktree remove "$WT" --force 2>/dev/null || true
582
625
  git branch -D "$WT_BRANCH" 2>/dev/null || true
583
626
  fi
@@ -596,6 +639,51 @@ Note: For quick tasks producing multiple plans (rare), spawn executors in parall
596
639
 
597
640
  ---
598
641
 
642
+ **Step 6.25: Code review (auto)**
643
+
644
+ Skip this step entirely if `$FULL_MODE` is false.
645
+
646
+ **Config gate:**
647
+ ```bash
648
+ CODE_REVIEW_ENABLED=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.code_review 2>/dev/null || echo "true")
649
+ ```
650
+ If `"false"`, skip with message "Code review skipped (workflow.code_review=false)".
651
+
652
+ **Scope files from executor's commits:**
653
+ ```bash
654
+ # Find the diff base: last commit before quick task started
655
+ # Use git log to find commits referencing the quick task id, then take the parent of the oldest
656
+ QUICK_COMMITS=$(git log --oneline --format="%H" --grep="${quick_id}" 2>/dev/null)
657
+ if [ -n "$QUICK_COMMITS" ]; then
658
+ DIFF_BASE=$(echo "$QUICK_COMMITS" | tail -1)^
659
+ # Verify parent exists (guard against first commit in repo)
660
+ git rev-parse "${DIFF_BASE}" >/dev/null 2>&1 || DIFF_BASE=$(echo "$QUICK_COMMITS" | tail -1)
661
+ else
662
+ # No commits found for this quick task — skip review
663
+ DIFF_BASE=""
664
+ fi
665
+
666
+ if [ -n "$DIFF_BASE" ]; then
667
+ CHANGED_FILES=$(git diff --name-only "${DIFF_BASE}..HEAD" -- . ':!.planning' 2>/dev/null | tr '\n' ' ')
668
+ else
669
+ CHANGED_FILES=""
670
+ fi
671
+ ```
672
+
673
+ If `CHANGED_FILES` is empty, skip with "No source files changed — skipping code review."
674
+
675
+ **Invoke review:**
676
+ ```
677
+ @gsd-code-reviewer "Review these files for bugs, security issues, and code quality.
678
+ Files: ${CHANGED_FILES}
679
+ Output: ${QUICK_DIR}/${quick_id}-REVIEW.md
680
+ Depth: quick"
681
+ ```
682
+
683
+ If review produces findings, display advisory message. **Error handling:** Failures are non-blocking — catch and proceed.
684
+
685
+ ---
686
+
599
687
  **Step 6.5: Verification (only when `$VALIDATE_MODE`)**
600
688
 
601
689
  Skip this step entirely if NOT `$VALIDATE_MODE`.
@@ -708,7 +796,14 @@ Build file list:
708
796
  ```bash
709
797
  # Explicitly stage all artifacts before commit — PLAN.md may be untracked
710
798
  # if the executor ran without worktree isolation and committed docs early
711
- git add ${file_list} 2>/dev/null
799
+ # Filter .planning/ files from staging if commit_docs is disabled (#1783)
800
+ COMMIT_DOCS=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get commit_docs 2>/dev/null || echo "true")
801
+ if [ "$COMMIT_DOCS" = "false" ]; then
802
+ file_list_filtered=$(echo "${file_list}" | tr ' ' '\n' | grep -v '^\.planning/' | tr '\n' ' ')
803
+ git add ${file_list_filtered} 2>/dev/null
804
+ else
805
+ git add ${file_list} 2>/dev/null
806
+ fi
712
807
  node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit "docs(quick-${quick_id}): ${DESCRIPTION}" --files ${file_list}
713
808
  ```
714
809
 
@@ -23,6 +23,8 @@ Parse JSON for: `workspace_name`, `workspace_path`, `has_manifest`, `strategy`,
23
23
 
24
24
  First run `/gsd-list-workspaces` to show available workspaces, then ask:
25
25
 
26
+
27
+ **Text mode (`workflow.text_mode: true` in config or `--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS` OR `text_mode` from init JSON is `true`. When TEXT_MODE is active, replace every `question` call with a plain-text numbered list and ask the user to type their choice number. This is required for non-OpenCode runtimes (OpenAI Codex, Gemini CLI, etc.) where `question` is not available.
26
28
  Use question:
27
29
  - header: "Remove Workspace"
28
30
  - question: "Which workspace do you want to remove?"
@@ -20,6 +20,8 @@ command -v OpenCode >/dev/null 2>&1 && echo "OpenCode:available" || echo "OpenCo
20
20
  command -v codex >/dev/null 2>&1 && echo "codex:available" || echo "codex:missing"
21
21
  command -v coderabbit >/dev/null 2>&1 && echo "coderabbit:available" || echo "coderabbit:missing"
22
22
  command -v opencode >/dev/null 2>&1 && echo "opencode:available" || echo "opencode:missing"
23
+ command -v qwen >/dev/null 2>&1 && echo "qwen:available" || echo "qwen:missing"
24
+ command -v cursor >/dev/null 2>&1 && echo "cursor:available" || echo "cursor:missing"
23
25
  ```
24
26
 
25
27
  Parse flags from `$ARGUMENTS`:
@@ -28,6 +30,8 @@ Parse flags from `$ARGUMENTS`:
28
30
  - `--codex` → include Codex
29
31
  - `--coderabbit` → include CodeRabbit
30
32
  - `--opencode` → include OpenCode
33
+ - `--qwen` → include Qwen Code
34
+ - `--cursor` → include Cursor
31
35
  - `--all` → include all available
32
36
  - No flags → include all available
33
37
 
@@ -38,6 +42,8 @@ No external AI CLIs found. Install at least one:
38
42
  - codex: https://github.com/openai/codex
39
43
  - OpenCode: https://github.com/anthropics/OpenCode-code
40
44
  - opencode: https://opencode.ai (leverages GitHub Copilot subscription models)
45
+ - qwen: https://github.com/nicepkg/qwen-code (Alibaba Qwen models)
46
+ - cursor: https://cursor.com (Cursor IDE agent mode)
41
47
 
42
48
  Then run /gsd-review again.
43
49
  ```
@@ -139,26 +145,47 @@ write to a temp file: `/tmp/gsd-review-prompt-{phase}.md`
139
145
  </step>
140
146
 
141
147
  <step name="invoke_reviewers">
148
+ read model preferences from planning config. Null/missing values fall back to CLI defaults.
149
+
150
+ ```bash
151
+ GEMINI_MODEL=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get review.models.gemini --raw 2>/dev/null || true)
152
+ CLAUDE_MODEL=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get review.models.OpenCode --raw 2>/dev/null || true)
153
+ CODEX_MODEL=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get review.models.codex --raw 2>/dev/null || true)
154
+ OPENCODE_MODEL=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get review.models.opencode --raw 2>/dev/null || true)
155
+ ```
156
+
142
157
  For each selected CLI, invoke in sequence (not parallel — avoid rate limits):
143
158
 
144
159
  **Gemini:**
145
160
  ```bash
146
- gemini -p "$(cat /tmp/gsd-review-prompt-{phase}.md)" 2>/dev/null > /tmp/gsd-review-gemini-{phase}.md
161
+ if [ -n "$GEMINI_MODEL" ] && [ "$GEMINI_MODEL" != "null" ]; then
162
+ gemini -m "$GEMINI_MODEL" -p "$(cat /tmp/gsd-review-prompt-{phase}.md)" 2>/dev/null > /tmp/gsd-review-gemini-{phase}.md
163
+ else
164
+ gemini -p "$(cat /tmp/gsd-review-prompt-{phase}.md)" 2>/dev/null > /tmp/gsd-review-gemini-{phase}.md
165
+ fi
147
166
  ```
148
167
 
149
168
  **OpenCode (separate session):**
150
169
  ```bash
151
- OpenCode -p "$(cat /tmp/gsd-review-prompt-{phase}.md)" --no-input 2>/dev/null > /tmp/gsd-review-OpenCode-{phase}.md
170
+ if [ -n "$CLAUDE_MODEL" ] && [ "$CLAUDE_MODEL" != "null" ]; then
171
+ OpenCode --model "$CLAUDE_MODEL" -p "$(cat /tmp/gsd-review-prompt-{phase}.md)" 2>/dev/null > /tmp/gsd-review-OpenCode-{phase}.md
172
+ else
173
+ OpenCode -p "$(cat /tmp/gsd-review-prompt-{phase}.md)" 2>/dev/null > /tmp/gsd-review-OpenCode-{phase}.md
174
+ fi
152
175
  ```
153
176
 
154
177
  **Codex:**
155
178
  ```bash
156
- codex exec --skip-git-repo-check "$(cat /tmp/gsd-review-prompt-{phase}.md)" 2>/dev/null > /tmp/gsd-review-codex-{phase}.md
179
+ if [ -n "$CODEX_MODEL" ] && [ "$CODEX_MODEL" != "null" ]; then
180
+ codex exec --model "$CODEX_MODEL" --skip-git-repo-check "$(cat /tmp/gsd-review-prompt-{phase}.md)" 2>/dev/null > /tmp/gsd-review-codex-{phase}.md
181
+ else
182
+ codex exec --skip-git-repo-check "$(cat /tmp/gsd-review-prompt-{phase}.md)" 2>/dev/null > /tmp/gsd-review-codex-{phase}.md
183
+ fi
157
184
  ```
158
185
 
159
186
  **CodeRabbit:**
160
187
 
161
- Note: CodeRabbit reviews the current git diff/working tree — it does not accept a prompt. It may take up to 5 minutes. Use `timeout: 360000` on the bash tool call.
188
+ Note: CodeRabbit reviews the current git diff/working tree — it does not accept a prompt or model flag. It may take up to 5 minutes. Use `timeout: 360000` on the bash tool call.
162
189
 
163
190
  ```bash
164
191
  coderabbit review --prompt-only 2>/dev/null > /tmp/gsd-review-coderabbit-{phase}.md
@@ -166,12 +193,32 @@ coderabbit review --prompt-only 2>/dev/null > /tmp/gsd-review-coderabbit-{phase}
166
193
 
167
194
  **OpenCode (via GitHub Copilot):**
168
195
  ```bash
169
- cat /tmp/gsd-review-prompt-{phase}.md | opencode run - 2>/dev/null > /tmp/gsd-review-opencode-{phase}.md
196
+ if [ -n "$OPENCODE_MODEL" ] && [ "$OPENCODE_MODEL" != "null" ]; then
197
+ cat /tmp/gsd-review-prompt-{phase}.md | opencode run --model "$OPENCODE_MODEL" - 2>/dev/null > /tmp/gsd-review-opencode-{phase}.md
198
+ else
199
+ cat /tmp/gsd-review-prompt-{phase}.md | opencode run - 2>/dev/null > /tmp/gsd-review-opencode-{phase}.md
200
+ fi
170
201
  if [ ! -s /tmp/gsd-review-opencode-{phase}.md ]; then
171
202
  echo "OpenCode review failed or returned empty output." > /tmp/gsd-review-opencode-{phase}.md
172
203
  fi
173
204
  ```
174
205
 
206
+ **Qwen Code:**
207
+ ```bash
208
+ qwen "$(cat /tmp/gsd-review-prompt-{phase}.md)" 2>/dev/null > /tmp/gsd-review-qwen-{phase}.md
209
+ if [ ! -s /tmp/gsd-review-qwen-{phase}.md ]; then
210
+ echo "Qwen review failed or returned empty output." > /tmp/gsd-review-qwen-{phase}.md
211
+ fi
212
+ ```
213
+
214
+ **Cursor:**
215
+ ```bash
216
+ cat /tmp/gsd-review-prompt-{phase}.md | cursor agent -p --mode ask --trust 2>/dev/null > /tmp/gsd-review-cursor-{phase}.md
217
+ if [ ! -s /tmp/gsd-review-cursor-{phase}.md ]; then
218
+ echo "Cursor review failed or returned empty output." > /tmp/gsd-review-cursor-{phase}.md
219
+ fi
220
+ ```
221
+
175
222
  If a CLI fails, log the error and continue with remaining CLIs.
176
223
 
177
224
  Display progress:
@@ -191,7 +238,7 @@ Combine all review responses into `{phase_dir}/{padded_phase}-REVIEWS.md`:
191
238
  ```markdown
192
239
  ---
193
240
  phase: {N}
194
- reviewers: [gemini, OpenCode, codex, coderabbit, opencode]
241
+ reviewers: [gemini, OpenCode, codex, coderabbit, opencode, qwen, cursor]
195
242
  reviewed_at: {ISO timestamp}
196
243
  plans_reviewed: [{list of PLAN.md files}]
197
244
  ---
@@ -0,0 +1,98 @@
1
+ <objective>
2
+ Lightweight codebase assessment. Spawns a single gsd-codebase-mapper agent for one focus area,
3
+ producing targeted documents in `.planning/codebase/`.
4
+ </objective>
5
+
6
+ <required_reading>
7
+ read all files referenced by the invoking prompt's execution_context before starting.
8
+ </required_reading>
9
+
10
+ <available_agent_types>
11
+ Valid GSD subagent types (use exact names — do not fall back to 'general'):
12
+ - gsd-codebase-mapper — Maps project structure and dependencies
13
+ </available_agent_types>
14
+
15
+ <process>
16
+
17
+ ## Focus-to-Document Mapping
18
+
19
+ | Focus | Documents Produced |
20
+ |-------|-------------------|
21
+ | `tech` | STACK.md, INTEGRATIONS.md |
22
+ | `arch` | ARCHITECTURE.md, STRUCTURE.md |
23
+ | `quality` | CONVENTIONS.md, TESTING.md |
24
+ | `concerns` | CONCERNS.md |
25
+ | `tech+arch` | STACK.md, INTEGRATIONS.md, ARCHITECTURE.md, STRUCTURE.md |
26
+
27
+ ## Step 1: Parse arguments and resolve focus
28
+
29
+ Parse the user's input for `--focus <area>`. Default to `tech+arch` if not specified.
30
+
31
+ Validate that the focus is one of: `tech`, `arch`, `quality`, `concerns`, `tech+arch`.
32
+
33
+ If invalid:
34
+ ```
35
+ Unknown focus area: "{input}". Valid options: tech, arch, quality, concerns, tech+arch
36
+ ```
37
+ Exit.
38
+
39
+ ## Step 2: Check for existing documents
40
+
41
+ ```bash
42
+ INIT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" init map-codebase 2>/dev/null || echo "{}")
43
+ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
44
+ ```
45
+
46
+ Look up which documents would be produced for the selected focus (from the mapping table above).
47
+
48
+ For each target document, check if it already exists in `.planning/codebase/`:
49
+ ```bash
50
+ ls -la .planning/codebase/{DOCUMENT}.md 2>/dev/null
51
+ ```
52
+
53
+ If any exist, show their modification dates and ask:
54
+ ```
55
+ Existing documents found:
56
+ - STACK.md (modified 2026-04-03)
57
+ - INTEGRATIONS.md (modified 2026-04-01)
58
+
59
+ Overwrite with fresh scan? [y/N]
60
+ ```
61
+
62
+ If user says no, exit.
63
+
64
+ ## Step 3: Create output directory
65
+
66
+ ```bash
67
+ mkdir -p .planning/codebase
68
+ ```
69
+
70
+ ## Step 4: Spawn mapper agent
71
+
72
+ Spawn a single `gsd-codebase-mapper` agent with the selected focus area:
73
+
74
+ ```
75
+ @gsd-codebase-mapper "Scan this codebase with focus: {focus}. write results to .planning/codebase/. Produce only: {document_list}"
76
+ ```
77
+
78
+ ## Step 5: Report
79
+
80
+ ```
81
+ ## Scan Complete
82
+
83
+ **Focus:** {focus}
84
+ **Documents produced:**
85
+ {list of documents written with line counts}
86
+
87
+ Use `/gsd-map-codebase` for a comprehensive 4-area parallel scan.
88
+ ```
89
+
90
+ </process>
91
+
92
+ <success_criteria>
93
+ - [ ] Focus area correctly parsed (default: tech+arch)
94
+ - [ ] Existing documents detected with modification dates shown
95
+ - [ ] User prompted before overwriting
96
+ - [ ] Single mapper agent spawned with correct focus
97
+ - [ ] Output documents written to .planning/codebase/
98
+ </success_criteria>