gsd-opencode 1.33.3 → 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.
- package/agents/gsd-advisor-researcher.md +23 -0
- package/agents/gsd-ai-researcher.md +142 -0
- package/agents/gsd-code-fixer.md +523 -0
- package/agents/gsd-code-reviewer.md +361 -0
- package/agents/gsd-debugger.md +14 -1
- package/agents/gsd-domain-researcher.md +162 -0
- package/agents/gsd-eval-auditor.md +170 -0
- package/agents/gsd-eval-planner.md +161 -0
- package/agents/gsd-executor.md +70 -7
- package/agents/gsd-framework-selector.md +167 -0
- package/agents/gsd-intel-updater.md +320 -0
- package/agents/gsd-phase-researcher.md +26 -0
- package/agents/gsd-plan-checker.md +12 -0
- package/agents/gsd-planner.md +16 -6
- package/agents/gsd-project-researcher.md +23 -0
- package/agents/gsd-ui-researcher.md +23 -0
- package/agents/gsd-verifier.md +55 -1
- package/commands/gsd/gsd-ai-integration-phase.md +36 -0
- package/commands/gsd/gsd-audit-fix.md +33 -0
- package/commands/gsd/gsd-autonomous.md +1 -0
- package/commands/gsd/gsd-code-review-fix.md +52 -0
- package/commands/gsd/gsd-code-review.md +55 -0
- package/commands/gsd/gsd-eval-review.md +32 -0
- package/commands/gsd/gsd-explore.md +27 -0
- package/commands/gsd/gsd-from-gsd2.md +45 -0
- package/commands/gsd/gsd-import.md +36 -0
- package/commands/gsd/gsd-intel.md +183 -0
- package/commands/gsd/gsd-next.md +2 -0
- package/commands/gsd/gsd-reapply-patches.md +58 -3
- package/commands/gsd/gsd-review.md +4 -2
- package/commands/gsd/gsd-scan.md +26 -0
- package/commands/gsd/gsd-undo.md +34 -0
- package/commands/gsd/gsd-workstreams.md +6 -6
- package/get-shit-done/bin/gsd-tools.cjs +143 -5
- package/get-shit-done/bin/lib/commands.cjs +10 -2
- package/get-shit-done/bin/lib/config.cjs +71 -37
- package/get-shit-done/bin/lib/core.cjs +70 -8
- package/get-shit-done/bin/lib/gsd2-import.cjs +511 -0
- package/get-shit-done/bin/lib/init.cjs +20 -6
- package/get-shit-done/bin/lib/intel.cjs +660 -0
- package/get-shit-done/bin/lib/learnings.cjs +378 -0
- package/get-shit-done/bin/lib/milestone.cjs +25 -15
- package/get-shit-done/bin/lib/model-profiles.cjs +17 -17
- package/get-shit-done/bin/lib/phase.cjs +148 -112
- package/get-shit-done/bin/lib/roadmap.cjs +12 -5
- package/get-shit-done/bin/lib/security.cjs +119 -0
- package/get-shit-done/bin/lib/state.cjs +283 -221
- package/get-shit-done/bin/lib/template.cjs +8 -4
- package/get-shit-done/bin/lib/verify.cjs +42 -5
- package/get-shit-done/references/ai-evals.md +156 -0
- package/get-shit-done/references/ai-frameworks.md +186 -0
- package/get-shit-done/references/common-bug-patterns.md +114 -0
- package/get-shit-done/references/few-shot-examples/plan-checker.md +73 -0
- package/get-shit-done/references/few-shot-examples/verifier.md +109 -0
- package/get-shit-done/references/gates.md +70 -0
- package/get-shit-done/references/ios-scaffold.md +123 -0
- package/get-shit-done/references/model-profile-resolution.md +6 -7
- package/get-shit-done/references/model-profiles.md +20 -14
- package/get-shit-done/references/planning-config.md +237 -0
- package/get-shit-done/references/thinking-models-debug.md +44 -0
- package/get-shit-done/references/thinking-models-execution.md +50 -0
- package/get-shit-done/references/thinking-models-planning.md +62 -0
- package/get-shit-done/references/thinking-models-research.md +50 -0
- package/get-shit-done/references/thinking-models-verification.md +55 -0
- package/get-shit-done/references/thinking-partner.md +96 -0
- package/get-shit-done/references/universal-anti-patterns.md +6 -1
- package/get-shit-done/references/verification-overrides.md +227 -0
- package/get-shit-done/templates/AI-SPEC.md +246 -0
- package/get-shit-done/workflows/add-tests.md +3 -0
- package/get-shit-done/workflows/add-todo.md +2 -0
- package/get-shit-done/workflows/ai-integration-phase.md +284 -0
- package/get-shit-done/workflows/audit-fix.md +154 -0
- package/get-shit-done/workflows/autonomous.md +33 -2
- package/get-shit-done/workflows/check-todos.md +2 -0
- package/get-shit-done/workflows/cleanup.md +2 -0
- package/get-shit-done/workflows/code-review-fix.md +497 -0
- package/get-shit-done/workflows/code-review.md +515 -0
- package/get-shit-done/workflows/complete-milestone.md +40 -15
- package/get-shit-done/workflows/diagnose-issues.md +1 -1
- package/get-shit-done/workflows/discovery-phase.md +3 -1
- package/get-shit-done/workflows/discuss-phase-assumptions.md +1 -1
- package/get-shit-done/workflows/discuss-phase.md +21 -7
- package/get-shit-done/workflows/do.md +2 -0
- package/get-shit-done/workflows/docs-update.md +2 -0
- package/get-shit-done/workflows/eval-review.md +155 -0
- package/get-shit-done/workflows/execute-phase.md +307 -57
- package/get-shit-done/workflows/execute-plan.md +64 -93
- package/get-shit-done/workflows/explore.md +136 -0
- package/get-shit-done/workflows/help.md +1 -1
- package/get-shit-done/workflows/import.md +273 -0
- package/get-shit-done/workflows/inbox.md +387 -0
- package/get-shit-done/workflows/manager.md +4 -10
- package/get-shit-done/workflows/new-milestone.md +3 -1
- package/get-shit-done/workflows/new-project.md +2 -0
- package/get-shit-done/workflows/new-workspace.md +2 -0
- package/get-shit-done/workflows/next.md +56 -0
- package/get-shit-done/workflows/note.md +2 -0
- package/get-shit-done/workflows/plan-phase.md +97 -17
- package/get-shit-done/workflows/plant-seed.md +3 -0
- package/get-shit-done/workflows/pr-branch.md +41 -13
- package/get-shit-done/workflows/profile-user.md +4 -2
- package/get-shit-done/workflows/quick.md +99 -4
- package/get-shit-done/workflows/remove-workspace.md +2 -0
- package/get-shit-done/workflows/review.md +53 -6
- package/get-shit-done/workflows/scan.md +98 -0
- package/get-shit-done/workflows/secure-phase.md +2 -0
- package/get-shit-done/workflows/settings.md +18 -3
- package/get-shit-done/workflows/ship.md +3 -0
- package/get-shit-done/workflows/ui-phase.md +10 -2
- package/get-shit-done/workflows/ui-review.md +2 -0
- package/get-shit-done/workflows/undo.md +314 -0
- package/get-shit-done/workflows/update.md +2 -0
- package/get-shit-done/workflows/validate-phase.md +2 -0
- package/get-shit-done/workflows/verify-phase.md +83 -0
- package/get-shit-done/workflows/verify-work.md +12 -1
- package/package.json +1 -1
- package/skills/gsd-code-review/SKILL.md +48 -0
- package/skills/gsd-code-review-fix/SKILL.md +44 -0
|
@@ -319,7 +319,11 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1)
|
|
|
319
319
|
**If `INTERACTIVE` is set:** Dispatch plan as a background agent to keep the main context lean. While plan runs, the workflow can immediately start discussing the next phase (see step 4).
|
|
320
320
|
|
|
321
321
|
```
|
|
322
|
-
|
|
322
|
+
Agent(
|
|
323
|
+
description="Plan phase ${PHASE_NUM}: ${PHASE_NAME}",
|
|
324
|
+
run_in_background=true,
|
|
325
|
+
prompt="Run plan-phase for phase ${PHASE_NUM}: skill(skill=\"gsd:plan-phase\", args=\"${PHASE_NUM}\")"
|
|
326
|
+
)
|
|
323
327
|
```
|
|
324
328
|
|
|
325
329
|
Store the agent task_id. After discuss for the next phase completes (or if no next phase), wait for the plan agent to finish before proceeding to execute.
|
|
@@ -337,7 +341,11 @@ Verify plan produced output — re-run `init phase-op` and check `has_plans`. If
|
|
|
337
341
|
**If `INTERACTIVE` is set:** Wait for the plan agent to complete (if not already), verify plans exist, then dispatch execute as a background agent:
|
|
338
342
|
|
|
339
343
|
```
|
|
340
|
-
|
|
344
|
+
Agent(
|
|
345
|
+
description="Execute phase ${PHASE_NUM}: ${PHASE_NAME}",
|
|
346
|
+
run_in_background=true,
|
|
347
|
+
prompt="Run execute-phase for phase ${PHASE_NUM}: skill(skill=\"gsd:execute-phase\", args=\"${PHASE_NUM} --no-transition\")"
|
|
348
|
+
)
|
|
341
349
|
```
|
|
342
350
|
|
|
343
351
|
Store the agent task_id. The workflow can now start discussing the next phase while this phase executes in the background. Before starting post-execution routing for this phase, wait for the execute agent to complete.
|
|
@@ -348,6 +356,27 @@ Store the agent task_id. The workflow can now start discussing the next phase wh
|
|
|
348
356
|
skill(skill="gsd-execute-phase", args="${PHASE_NUM} --no-transition")
|
|
349
357
|
```
|
|
350
358
|
|
|
359
|
+
**3c.5. Code Review and Fix**
|
|
360
|
+
|
|
361
|
+
Auto-invoke code review and fix chain. Autonomous mode chains both review and fix (unlike execute-phase/quick which only suggest fix).
|
|
362
|
+
|
|
363
|
+
**Config gate:**
|
|
364
|
+
```bash
|
|
365
|
+
CODE_REVIEW_ENABLED=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.code_review 2>/dev/null || echo "true")
|
|
366
|
+
```
|
|
367
|
+
If `"false"`: display "Code review skipped (workflow.code_review=false)" and proceed to 3d.
|
|
368
|
+
|
|
369
|
+
```
|
|
370
|
+
skill(skill="gsd-code-review", args="${PHASE_NUM}")
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Parse status from REVIEW.md frontmatter. If "clean" or "skipped": proceed to 3d. If findings found: auto-invoke:
|
|
374
|
+
```
|
|
375
|
+
skill(skill="gsd-code-review-fix", args="${PHASE_NUM} --auto")
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
**Error handling:** If either skill fails, catch the error, display as non-blocking, and proceed to 3d.
|
|
379
|
+
|
|
351
380
|
**3d. Post-Execution Routing**
|
|
352
381
|
|
|
353
382
|
**If `INTERACTIVE` is set:** Wait for the execute agent to complete before reading verification results.
|
|
@@ -383,6 +412,8 @@ Proceed to iterate step.
|
|
|
383
412
|
|
|
384
413
|
read the human_verification section from VERIFICATION.md to get the count and items requiring manual testing.
|
|
385
414
|
|
|
415
|
+
|
|
416
|
+
**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.
|
|
386
417
|
Display the items, then ask user via question:
|
|
387
418
|
- **question:** "Phase ${PHASE_NUM} has items needing manual verification. Validate now or continue to next phase?"
|
|
388
419
|
- **options:** "Validate now" / "Continue without validation"
|
|
@@ -102,6 +102,8 @@ If `.planning/ROADMAP.md` exists:
|
|
|
102
102
|
<step name="offer_actions">
|
|
103
103
|
**If todo maps to a roadmap phase:**
|
|
104
104
|
|
|
105
|
+
|
|
106
|
+
**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.
|
|
105
107
|
Use question:
|
|
106
108
|
- header: "Action"
|
|
107
109
|
- question: "This todo relates to Phase [N]: [name]. What would you like to do?"
|
|
@@ -93,6 +93,8 @@ No phase directories found to archive. Phases may have been removed or archived
|
|
|
93
93
|
|
|
94
94
|
Stop here.
|
|
95
95
|
|
|
96
|
+
|
|
97
|
+
**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.
|
|
96
98
|
question: "Proceed with archiving?" with options: "Yes — archive listed phases" | "Cancel"
|
|
97
99
|
|
|
98
100
|
If "Cancel": Stop.
|
|
@@ -0,0 +1,497 @@
|
|
|
1
|
+
<objective>
|
|
2
|
+
Auto-fix issues from REVIEW.md. Validates phase, checks config gate, verifies REVIEW.md exists and has fixable issues, spawns gsd-code-fixer agent, handles --auto iteration loop (capped at 3), commits REVIEW-FIX.md once at the end, and presents results.
|
|
3
|
+
</objective>
|
|
4
|
+
|
|
5
|
+
<required_reading>
|
|
6
|
+
read all files referenced by the invoking prompt's execution_context before starting.
|
|
7
|
+
</required_reading>
|
|
8
|
+
|
|
9
|
+
<available_agent_types>
|
|
10
|
+
- gsd-code-fixer: Applies fixes to code review findings
|
|
11
|
+
- gsd-code-reviewer: Reviews source files for bugs and issues
|
|
12
|
+
</available_agent_types>
|
|
13
|
+
|
|
14
|
+
<process>
|
|
15
|
+
|
|
16
|
+
<step name="initialize">
|
|
17
|
+
Parse arguments and load project state:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
PHASE_ARG="${1}"
|
|
21
|
+
INIT=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}")
|
|
22
|
+
if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Parse from init JSON: `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `padded_phase`, `commit_docs`.
|
|
26
|
+
|
|
27
|
+
**Input sanitization (defense-in-depth):**
|
|
28
|
+
```bash
|
|
29
|
+
# Validate PADDED_PHASE contains only digits and optional dot (e.g., "02", "03.1")
|
|
30
|
+
if ! [[ "$PADDED_PHASE" =~ ^[0-9]+(\.[0-9]+)?$ ]]; then
|
|
31
|
+
echo "Error: Invalid phase number format: '${PADDED_PHASE}'. Expected digits (e.g., 02, 03.1)."
|
|
32
|
+
# Exit workflow
|
|
33
|
+
fi
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Phase validation (before config gate):**
|
|
37
|
+
If `phase_found` is false, report error and exit:
|
|
38
|
+
```
|
|
39
|
+
Error: Phase ${PHASE_ARG} not found. Run /gsd-status to see available phases.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
This runs BEFORE config gate check so user errors are surfaced immediately regardless of config state.
|
|
43
|
+
|
|
44
|
+
Parse optional flags from $ARGUMENTS:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
FIX_ALL=false
|
|
48
|
+
AUTO_MODE=false
|
|
49
|
+
for arg in "$@"; do
|
|
50
|
+
if [[ "$arg" == "--all" ]]; then FIX_ALL=true; fi
|
|
51
|
+
if [[ "$arg" == "--auto" ]]; then AUTO_MODE=true; fi
|
|
52
|
+
done
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Compute scope variable:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
if [ "$FIX_ALL" = "true" ]; then
|
|
59
|
+
FIX_SCOPE="all"
|
|
60
|
+
else
|
|
61
|
+
FIX_SCOPE="critical_warning"
|
|
62
|
+
fi
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Compute review and fix report paths:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
REVIEW_PATH="${PHASE_DIR}/${PADDED_PHASE}-REVIEW.md"
|
|
69
|
+
FIX_REPORT_PATH="${PHASE_DIR}/${PADDED_PHASE}-REVIEW-FIX.md"
|
|
70
|
+
```
|
|
71
|
+
</step>
|
|
72
|
+
|
|
73
|
+
<step name="check_config_gate">
|
|
74
|
+
Check if code review is enabled via config:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
CODE_REVIEW_ENABLED=$(node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" config-get workflow.code_review 2>/dev/null || echo "true")
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If CODE_REVIEW_ENABLED is "false":
|
|
81
|
+
```
|
|
82
|
+
Code review fix skipped (workflow.code_review=false in config)
|
|
83
|
+
```
|
|
84
|
+
Exit workflow.
|
|
85
|
+
|
|
86
|
+
Default is true — only skip on explicit false. This check runs AFTER phase validation so invalid phase errors are shown first.
|
|
87
|
+
|
|
88
|
+
Note: This reuses the `workflow.code_review` config key rather than introducing a separate `workflow.code_review_fix` key. Rationale: fixes are meaningless without review, so a single toggle makes sense. If independent control is needed later, a separate key can be added in v2.
|
|
89
|
+
</step>
|
|
90
|
+
|
|
91
|
+
<step name="check_review_exists">
|
|
92
|
+
Verify that REVIEW.md exists:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
if [ ! -f "${REVIEW_PATH}" ]; then
|
|
96
|
+
echo "Error: No REVIEW.md found for Phase ${PHASE_ARG}. Run /gsd-code-review ${PHASE_ARG} first."
|
|
97
|
+
exit 1
|
|
98
|
+
fi
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Do NOT auto-run code-review. Require explicit user action to ensure review intent is clear.
|
|
102
|
+
</step>
|
|
103
|
+
|
|
104
|
+
<step name="check_review_status">
|
|
105
|
+
Parse REVIEW.md frontmatter to check status and extract context for --auto loop:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Parse status field
|
|
109
|
+
REVIEW_STATUS=$(REVIEW_PATH="${REVIEW_PATH}" node -e "
|
|
110
|
+
const fs = require('fs');
|
|
111
|
+
const content = fs.readFileSync(process.env.REVIEW_PATH, 'utf-8');
|
|
112
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
113
|
+
if (match && /status:\s*(\S+)/.test(match[1])) {
|
|
114
|
+
console.log(match[1].match(/status:\s*(\S+)/)[1]);
|
|
115
|
+
} else {
|
|
116
|
+
console.log('unknown');
|
|
117
|
+
}
|
|
118
|
+
" 2>/dev/null)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
If status is "clean" or "skipped":
|
|
122
|
+
```
|
|
123
|
+
No issues to fix in Phase ${PHASE_ARG} REVIEW.md (status: ${REVIEW_STATUS}).
|
|
124
|
+
```
|
|
125
|
+
Exit workflow.
|
|
126
|
+
|
|
127
|
+
If status is "unknown":
|
|
128
|
+
```
|
|
129
|
+
Warning: Could not parse REVIEW.md status. Proceeding with fix attempt.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Extract review depth for --auto re-review:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
REVIEW_DEPTH=$(REVIEW_PATH="${REVIEW_PATH}" node -e "
|
|
136
|
+
const fs = require('fs');
|
|
137
|
+
const content = fs.readFileSync(process.env.REVIEW_PATH, 'utf-8');
|
|
138
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
139
|
+
if (match && /depth:\s*(\S+)/.test(match[1])) {
|
|
140
|
+
console.log(match[1].match(/depth:\s*(\S+)/)[1]);
|
|
141
|
+
} else {
|
|
142
|
+
console.log('standard');
|
|
143
|
+
}
|
|
144
|
+
" 2>/dev/null)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Extract original review file list for --auto re-review scope persistence:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Extract review file list — portable bash 3.2+ (no mapfile, handles spaces in paths)
|
|
151
|
+
REVIEW_FILES_ARRAY=()
|
|
152
|
+
while IFS= read -r line; do
|
|
153
|
+
[ -n "$line" ] && REVIEW_FILES_ARRAY+=("$line")
|
|
154
|
+
done < <(REVIEW_PATH="${REVIEW_PATH}" node -e "
|
|
155
|
+
const fs = require('fs');
|
|
156
|
+
const content = fs.readFileSync(process.env.REVIEW_PATH, 'utf-8');
|
|
157
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
158
|
+
if (match) {
|
|
159
|
+
const fm = match[1];
|
|
160
|
+
// Try YAML array format: files_reviewed_list: [file1, file2]
|
|
161
|
+
const bracketMatch = fm.match(/files_reviewed_list:\s*\[([^\]]+)\]/);
|
|
162
|
+
if (bracketMatch) {
|
|
163
|
+
bracketMatch[1].split(',').map(f => f.trim()).filter(Boolean).forEach(f => console.log(f));
|
|
164
|
+
} else {
|
|
165
|
+
// Try YAML list format: files_reviewed_list:\n - file1\n - file2
|
|
166
|
+
let inList = false;
|
|
167
|
+
for (const line of fm.split('\n')) {
|
|
168
|
+
if (/files_reviewed_list:/.test(line)) { inList = true; continue; }
|
|
169
|
+
if (inList && /^\s+-\s+(.+)/.test(line)) { console.log(line.match(/^\s+-\s+(.+)/)[1].trim()); }
|
|
170
|
+
else if (inList && /^\S/.test(line)) { break; }
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
" 2>/dev/null)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
If REVIEW.md contains a `files_reviewed_list` frontmatter field, use that as the re-review scope. If not present, fall back to re-reviewing the full phase (same behavior as initial code-review).
|
|
178
|
+
</step>
|
|
179
|
+
|
|
180
|
+
<step name="spawn_fixer">
|
|
181
|
+
Spawn the gsd-code-fixer agent with config:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# Build config for agent
|
|
185
|
+
echo "Applying fixes from ${REVIEW_PATH}..."
|
|
186
|
+
echo "Fix scope: ${FIX_SCOPE}"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Use task() to spawn agent:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
@gsd-code-fixer "
|
|
193
|
+
<files_to_read>
|
|
194
|
+
${REVIEW_PATH}
|
|
195
|
+
</files_to_read>
|
|
196
|
+
|
|
197
|
+
<config>
|
|
198
|
+
phase_dir: ${PHASE_DIR}
|
|
199
|
+
padded_phase: ${PADDED_PHASE}
|
|
200
|
+
review_path: ${REVIEW_PATH}
|
|
201
|
+
fix_scope: ${FIX_SCOPE}
|
|
202
|
+
fix_report_path: ${FIX_REPORT_PATH}
|
|
203
|
+
iteration: 1
|
|
204
|
+
</config>
|
|
205
|
+
|
|
206
|
+
read REVIEW.md findings, apply fixes, commit each atomically, write REVIEW-FIX.md. Do NOT commit REVIEW-FIX.md (orchestrator handles that).
|
|
207
|
+
"
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Agent failure handling:**
|
|
211
|
+
|
|
212
|
+
If task() fails:
|
|
213
|
+
```
|
|
214
|
+
Error: Code fix agent failed: ${error_message}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Check if FIX_REPORT_PATH exists:
|
|
218
|
+
- If yes: "Partial success — some fixes may have been committed."
|
|
219
|
+
- If no: "No fixes applied."
|
|
220
|
+
|
|
221
|
+
Either way:
|
|
222
|
+
```
|
|
223
|
+
Some fix commits may already exist in git history — check git log for fix(${PADDED_PHASE}) commits.
|
|
224
|
+
You can retry with /gsd-code-review-fix ${PHASE_ARG}.
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Exit workflow (skip auto loop).
|
|
228
|
+
</step>
|
|
229
|
+
|
|
230
|
+
<step name="auto_iteration_loop">
|
|
231
|
+
Only runs if AUTO_MODE is true. If AUTO_MODE is false, skip this step entirely.
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
if [ "$AUTO_MODE" = "true" ]; then
|
|
235
|
+
# Iteration semantics: the initial fix pass (step 5) is iteration 1.
|
|
236
|
+
# This loop runs iterations 2..MAX_ITERATIONS (re-review + re-fix cycles).
|
|
237
|
+
# Total fix passes = MAX_ITERATIONS. Loop uses -lt (not -le) intentionally.
|
|
238
|
+
ITERATION=1
|
|
239
|
+
MAX_ITERATIONS=3
|
|
240
|
+
|
|
241
|
+
while [ $ITERATION -lt $MAX_ITERATIONS ]; do
|
|
242
|
+
ITERATION=$((ITERATION + 1))
|
|
243
|
+
|
|
244
|
+
echo ""
|
|
245
|
+
echo "═══════════════════════════════════════════════════════"
|
|
246
|
+
echo " --auto: Starting iteration ${ITERATION}/${MAX_ITERATIONS}"
|
|
247
|
+
echo "═══════════════════════════════════════════════════════"
|
|
248
|
+
echo ""
|
|
249
|
+
|
|
250
|
+
# Re-review using same depth and file scope as original review
|
|
251
|
+
echo "Re-reviewing phase ${PHASE_ARG} at ${REVIEW_DEPTH} depth..."
|
|
252
|
+
|
|
253
|
+
# Backup previous REVIEW.md and REVIEW-FIX.md before overwriting
|
|
254
|
+
if [ -f "${REVIEW_PATH}" ]; then
|
|
255
|
+
cp "${REVIEW_PATH}" "${REVIEW_PATH%.md}.iter${ITERATION}.md" 2>/dev/null || true
|
|
256
|
+
fi
|
|
257
|
+
if [ -f "${FIX_REPORT_PATH}" ]; then
|
|
258
|
+
cp "${FIX_REPORT_PATH}" "${FIX_REPORT_PATH%.md}.iter${ITERATION}.md" 2>/dev/null || true
|
|
259
|
+
fi
|
|
260
|
+
|
|
261
|
+
# If original review had explicit file list, pass it safely to re-review agent
|
|
262
|
+
FILES_CONFIG=""
|
|
263
|
+
if [ ${#REVIEW_FILES_ARRAY[@]} -gt 0 ]; then
|
|
264
|
+
FILES_CONFIG="files:"
|
|
265
|
+
for f in "${REVIEW_FILES_ARRAY[@]}"; do
|
|
266
|
+
FILES_CONFIG="${FILES_CONFIG}
|
|
267
|
+
- ${f}"
|
|
268
|
+
done
|
|
269
|
+
fi
|
|
270
|
+
|
|
271
|
+
# Spawn gsd-code-reviewer agent to re-review
|
|
272
|
+
# (This overwrites REVIEW_PATH with latest review state)
|
|
273
|
+
@gsd-code-reviewer "
|
|
274
|
+
<config>
|
|
275
|
+
depth: ${REVIEW_DEPTH}
|
|
276
|
+
phase_dir: ${PHASE_DIR}
|
|
277
|
+
review_path: ${REVIEW_PATH}
|
|
278
|
+
${FILES_CONFIG}
|
|
279
|
+
</config>
|
|
280
|
+
|
|
281
|
+
Re-review the phase at ${REVIEW_DEPTH} depth. write findings to ${REVIEW_PATH}.
|
|
282
|
+
Do NOT commit the output — the orchestrator handles that.
|
|
283
|
+
"
|
|
284
|
+
|
|
285
|
+
# Check new REVIEW.md status
|
|
286
|
+
NEW_STATUS=$(REVIEW_PATH="${REVIEW_PATH}" node -e "
|
|
287
|
+
const fs = require('fs');
|
|
288
|
+
const content = fs.readFileSync(process.env.REVIEW_PATH, 'utf-8');
|
|
289
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
290
|
+
if (match && /status:\s*(\S+)/.test(match[1])) {
|
|
291
|
+
console.log(match[1].match(/status:\s*(\S+)/)[1]);
|
|
292
|
+
} else {
|
|
293
|
+
console.log('unknown');
|
|
294
|
+
}
|
|
295
|
+
" 2>/dev/null)
|
|
296
|
+
|
|
297
|
+
if [ "$NEW_STATUS" = "clean" ]; then
|
|
298
|
+
echo ""
|
|
299
|
+
echo "✓ All issues resolved after iteration ${ITERATION}."
|
|
300
|
+
break
|
|
301
|
+
fi
|
|
302
|
+
|
|
303
|
+
# Still has issues — spawn fixer again
|
|
304
|
+
echo "Issues remain. Applying fixes for iteration ${ITERATION}..."
|
|
305
|
+
|
|
306
|
+
@gsd-code-fixer "
|
|
307
|
+
<files_to_read>
|
|
308
|
+
${REVIEW_PATH}
|
|
309
|
+
</files_to_read>
|
|
310
|
+
|
|
311
|
+
<config>
|
|
312
|
+
phase_dir: ${PHASE_DIR}
|
|
313
|
+
padded_phase: ${PADDED_PHASE}
|
|
314
|
+
review_path: ${REVIEW_PATH}
|
|
315
|
+
fix_scope: ${FIX_SCOPE}
|
|
316
|
+
fix_report_path: ${FIX_REPORT_PATH}
|
|
317
|
+
iteration: ${ITERATION}
|
|
318
|
+
</config>
|
|
319
|
+
|
|
320
|
+
read REVIEW.md findings, apply fixes, commit each atomically, write REVIEW-FIX.md (overwrite previous). Do NOT commit REVIEW-FIX.md.
|
|
321
|
+
"
|
|
322
|
+
|
|
323
|
+
# Check if fixer succeeded
|
|
324
|
+
if [ ! -f "${FIX_REPORT_PATH}" ]; then
|
|
325
|
+
echo "Warning: Iteration ${ITERATION} fixer failed to produce fix report. Stopping auto-loop."
|
|
326
|
+
break
|
|
327
|
+
fi
|
|
328
|
+
done
|
|
329
|
+
|
|
330
|
+
# After loop completes
|
|
331
|
+
if [ $ITERATION -ge $MAX_ITERATIONS ]; then
|
|
332
|
+
echo ""
|
|
333
|
+
echo "⚠ Reached maximum iterations (${MAX_ITERATIONS}). Remaining issues documented in REVIEW-FIX.md."
|
|
334
|
+
fi
|
|
335
|
+
fi
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Key design decisions for --auto (addresses ALL review HIGH concerns):
|
|
339
|
+
1. **Re-review scope**: Uses REVIEW_FILES_ARRAY from original REVIEW.md frontmatter, falling back to full phase scope. Scope is NOT lost between iterations. Uses portable while-read loop (bash 3.2+ compatible, handles spaces in paths).
|
|
340
|
+
2. **Artifact semantics**: REVIEW.md is overwritten by each re-review (latest review state). REVIEW-FIX.md is overwritten by each fixer iteration (latest fix state with iteration count). There is ONE final version of each artifact, not per-iteration copies.
|
|
341
|
+
Backup files (.iterN.md) preserve history for post-mortem analysis if iterations degrade.
|
|
342
|
+
3. **Commit timing**: Fix commits happen per-finding inside the agent. REVIEW-FIX.md is NOT committed until step 7 (after ALL iterations complete). Only ONE docs commit for REVIEW-FIX.md, not one per iteration.
|
|
343
|
+
</step>
|
|
344
|
+
|
|
345
|
+
<step name="commit_fix_report">
|
|
346
|
+
After ALL iterations complete (or single pass in non-auto mode), validate and commit REVIEW-FIX.md:
|
|
347
|
+
|
|
348
|
+
```bash
|
|
349
|
+
if [ -f "${FIX_REPORT_PATH}" ]; then
|
|
350
|
+
# Validate REVIEW-FIX.md has valid YAML frontmatter with status field
|
|
351
|
+
HAS_STATUS=$(REVIEW_PATH="${REVIEW_PATH}" node -e "
|
|
352
|
+
const fs = require('fs');
|
|
353
|
+
const content = fs.readFileSync(process.env.FIX_REPORT_PATH, 'utf-8');
|
|
354
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
355
|
+
if (match && /status:/.test(match[1])) { console.log('valid'); } else { console.log('invalid'); }
|
|
356
|
+
" 2>/dev/null)
|
|
357
|
+
|
|
358
|
+
if [ "$HAS_STATUS" = "valid" ]; then
|
|
359
|
+
echo "REVIEW-FIX.md created at ${FIX_REPORT_PATH}"
|
|
360
|
+
|
|
361
|
+
if [ "$COMMIT_DOCS" = "true" ]; then
|
|
362
|
+
node "$HOME/.config/opencode/get-shit-done/bin/gsd-tools.cjs" commit \
|
|
363
|
+
"docs(${PADDED_PHASE}): add code review fix report" \
|
|
364
|
+
--files "${FIX_REPORT_PATH}"
|
|
365
|
+
fi
|
|
366
|
+
else
|
|
367
|
+
echo "Warning: REVIEW-FIX.md has invalid frontmatter (no status field). Not committing."
|
|
368
|
+
echo "Agent may have produced malformed output. Review manually: ${FIX_REPORT_PATH}"
|
|
369
|
+
fi
|
|
370
|
+
else
|
|
371
|
+
echo "Warning: REVIEW-FIX.md not found at ${FIX_REPORT_PATH}."
|
|
372
|
+
echo "Agent may have failed before writing report."
|
|
373
|
+
echo "Check git log for any fix(${PADDED_PHASE}) commits that were applied."
|
|
374
|
+
fi
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
This commit happens ONCE at the end of the workflow, after all iterations (if --auto) complete. Not per-iteration.
|
|
378
|
+
</step>
|
|
379
|
+
|
|
380
|
+
<step name="present_results">
|
|
381
|
+
Parse REVIEW-FIX.md frontmatter and present formatted summary to user.
|
|
382
|
+
|
|
383
|
+
First check if fix report exists:
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
if [ ! -f "${FIX_REPORT_PATH}" ]; then
|
|
387
|
+
echo ""
|
|
388
|
+
echo "═══════════════════════════════════════════════════════════════"
|
|
389
|
+
echo ""
|
|
390
|
+
echo " ⚠ No fix report generated"
|
|
391
|
+
echo ""
|
|
392
|
+
echo "───────────────────────────────────────────────────────────────"
|
|
393
|
+
echo ""
|
|
394
|
+
echo "The fixer agent may have failed before completing."
|
|
395
|
+
echo "Check git log for any fix(${PADDED_PHASE}) commits."
|
|
396
|
+
echo ""
|
|
397
|
+
echo "Retry: /gsd-code-review-fix ${PHASE_ARG}"
|
|
398
|
+
echo ""
|
|
399
|
+
echo "═══════════════════════════════════════════════════════════════"
|
|
400
|
+
exit 1
|
|
401
|
+
fi
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
Extract frontmatter fields:
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
# Extract only the YAML frontmatter block (between first two --- lines)
|
|
408
|
+
FIX_FRONTMATTER=$(REVIEW_PATH="${REVIEW_PATH}" node -e "
|
|
409
|
+
const fs = require('fs');
|
|
410
|
+
const content = fs.readFileSync(process.env.FIX_REPORT_PATH, 'utf-8');
|
|
411
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
412
|
+
if (match) process.stdout.write(match[1]);
|
|
413
|
+
" 2>/dev/null)
|
|
414
|
+
|
|
415
|
+
# Parse fields from frontmatter only (not full file)
|
|
416
|
+
FIX_STATUS=$(echo "$FIX_FRONTMATTER" | grep "^status:" | cut -d: -f2 | xargs)
|
|
417
|
+
FINDINGS_IN_SCOPE=$(echo "$FIX_FRONTMATTER" | grep "^findings_in_scope:" | cut -d: -f2 | xargs)
|
|
418
|
+
FIXED_COUNT=$(echo "$FIX_FRONTMATTER" | grep "^fixed:" | cut -d: -f2 | xargs)
|
|
419
|
+
SKIPPED_COUNT=$(echo "$FIX_FRONTMATTER" | grep "^skipped:" | cut -d: -f2 | xargs)
|
|
420
|
+
ITERATION_COUNT=$(echo "$FIX_FRONTMATTER" | grep "^iteration:" | cut -d: -f2 | xargs)
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
Display formatted inline summary:
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
echo ""
|
|
427
|
+
echo "═══════════════════════════════════════════════════════════════"
|
|
428
|
+
echo ""
|
|
429
|
+
echo " Code Review Fix Complete: Phase ${PHASE_NUMBER} (${PHASE_NAME})"
|
|
430
|
+
echo ""
|
|
431
|
+
echo "───────────────────────────────────────────────────────────────"
|
|
432
|
+
echo ""
|
|
433
|
+
echo " Fix Scope: ${FIX_SCOPE}"
|
|
434
|
+
echo " Findings: ${FINDINGS_IN_SCOPE}"
|
|
435
|
+
echo " Fixed: ${FIXED_COUNT}"
|
|
436
|
+
echo " Skipped: ${SKIPPED_COUNT}"
|
|
437
|
+
if [ "$AUTO_MODE" = "true" ]; then
|
|
438
|
+
echo " Iterations: ${ITERATION_COUNT}"
|
|
439
|
+
fi
|
|
440
|
+
echo " Status: ${FIX_STATUS}"
|
|
441
|
+
echo ""
|
|
442
|
+
echo "───────────────────────────────────────────────────────────────"
|
|
443
|
+
echo ""
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
If status is "all_fixed":
|
|
447
|
+
```bash
|
|
448
|
+
if [ "$FIX_STATUS" = "all_fixed" ]; then
|
|
449
|
+
echo "✓ All issues resolved."
|
|
450
|
+
echo ""
|
|
451
|
+
echo "Full report: ${FIX_REPORT_PATH}"
|
|
452
|
+
echo ""
|
|
453
|
+
echo "Next step:"
|
|
454
|
+
echo " /gsd-verify-work — Verify phase completion"
|
|
455
|
+
echo ""
|
|
456
|
+
fi
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
If status is "partial" or "none_fixed":
|
|
460
|
+
```bash
|
|
461
|
+
if [ "$FIX_STATUS" = "partial" ] || [ "$FIX_STATUS" = "none_fixed" ]; then
|
|
462
|
+
echo "⚠ Some issues could not be fixed automatically."
|
|
463
|
+
echo ""
|
|
464
|
+
echo "Full report: ${FIX_REPORT_PATH}"
|
|
465
|
+
echo ""
|
|
466
|
+
echo "Next steps:"
|
|
467
|
+
echo " cat ${FIX_REPORT_PATH} — View fix report"
|
|
468
|
+
echo " /gsd-code-review ${PHASE_NUMBER} — Re-review code"
|
|
469
|
+
echo " /gsd-verify-work — Verify phase completion"
|
|
470
|
+
echo ""
|
|
471
|
+
fi
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
```bash
|
|
475
|
+
echo "═══════════════════════════════════════════════════════════════"
|
|
476
|
+
```
|
|
477
|
+
</step>
|
|
478
|
+
|
|
479
|
+
</process>
|
|
480
|
+
|
|
481
|
+
<platform_notes>
|
|
482
|
+
**Windows:** This workflow uses bash features (arrays, variable expansion, while loops). On Windows, it requires Git bash or WSL. Native PowerShell is not supported. The CI matrix (Ubuntu/macOS/Windows) runs under Git bash on Windows runners, which provides bash compatibility.
|
|
483
|
+
</platform_notes>
|
|
484
|
+
|
|
485
|
+
<success_criteria>
|
|
486
|
+
- [ ] Phase validated before config gate check
|
|
487
|
+
- [ ] Config gate checked (workflow.code_review)
|
|
488
|
+
- [ ] REVIEW.md existence verified (error if missing)
|
|
489
|
+
- [ ] REVIEW.md status checked (skip if clean/skipped)
|
|
490
|
+
- [ ] Agent spawned with correct config (review_path, fix_scope, fix_report_path)
|
|
491
|
+
- [ ] Agent failure handled with partial-success awareness (some fix commits may exist)
|
|
492
|
+
- [ ] --auto iteration loop respects 3-iteration cap
|
|
493
|
+
- [ ] --auto re-review uses persisted file scope (not lost between iterations)
|
|
494
|
+
- [ ] REVIEW-FIX.md committed ONCE after all iterations (not per-iteration)
|
|
495
|
+
- [ ] Missing fix report handled with explicit error message in present_results
|
|
496
|
+
- [ ] Results presented inline with next step suggestion
|
|
497
|
+
</success_criteria>
|