gsd-code-first 1.0.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/LICENSE +21 -0
- package/README.ja-JP.md +834 -0
- package/README.ko-KR.md +823 -0
- package/README.md +937 -0
- package/README.pt-BR.md +452 -0
- package/README.zh-CN.md +800 -0
- package/agents/gsd-advisor-researcher.md +104 -0
- package/agents/gsd-annotator.md +148 -0
- package/agents/gsd-arc-executor.md +537 -0
- package/agents/gsd-arc-planner.md +374 -0
- package/agents/gsd-assumptions-analyzer.md +105 -0
- package/agents/gsd-code-planner.md +155 -0
- package/agents/gsd-codebase-mapper.md +770 -0
- package/agents/gsd-debugger.md +1373 -0
- package/agents/gsd-executor.md +509 -0
- package/agents/gsd-integration-checker.md +443 -0
- package/agents/gsd-nyquist-auditor.md +176 -0
- package/agents/gsd-phase-researcher.md +698 -0
- package/agents/gsd-plan-checker.md +773 -0
- package/agents/gsd-planner.md +1354 -0
- package/agents/gsd-project-researcher.md +654 -0
- package/agents/gsd-prototyper.md +161 -0
- package/agents/gsd-research-synthesizer.md +247 -0
- package/agents/gsd-roadmapper.md +679 -0
- package/agents/gsd-ui-auditor.md +439 -0
- package/agents/gsd-ui-checker.md +300 -0
- package/agents/gsd-ui-researcher.md +357 -0
- package/agents/gsd-user-profiler.md +171 -0
- package/agents/gsd-verifier.md +700 -0
- package/bin/install.js +5009 -0
- package/commands/gsd/add-backlog.md +76 -0
- package/commands/gsd/add-phase.md +43 -0
- package/commands/gsd/add-tests.md +41 -0
- package/commands/gsd/add-todo.md +47 -0
- package/commands/gsd/annotate.md +54 -0
- package/commands/gsd/audit-milestone.md +36 -0
- package/commands/gsd/audit-uat.md +24 -0
- package/commands/gsd/autonomous.md +41 -0
- package/commands/gsd/check-todos.md +45 -0
- package/commands/gsd/cleanup.md +18 -0
- package/commands/gsd/complete-milestone.md +136 -0
- package/commands/gsd/debug.md +173 -0
- package/commands/gsd/deep-plan.md +52 -0
- package/commands/gsd/discuss-phase.md +64 -0
- package/commands/gsd/do.md +30 -0
- package/commands/gsd/execute-phase.md +59 -0
- package/commands/gsd/extract-plan.md +35 -0
- package/commands/gsd/fast.md +30 -0
- package/commands/gsd/forensics.md +56 -0
- package/commands/gsd/health.md +22 -0
- package/commands/gsd/help.md +22 -0
- package/commands/gsd/insert-phase.md +32 -0
- package/commands/gsd/iterate.md +124 -0
- package/commands/gsd/join-discord.md +18 -0
- package/commands/gsd/list-phase-assumptions.md +46 -0
- package/commands/gsd/list-workspaces.md +19 -0
- package/commands/gsd/manager.md +39 -0
- package/commands/gsd/map-codebase.md +71 -0
- package/commands/gsd/milestone-summary.md +51 -0
- package/commands/gsd/new-milestone.md +44 -0
- package/commands/gsd/new-project.md +42 -0
- package/commands/gsd/new-workspace.md +44 -0
- package/commands/gsd/next.md +24 -0
- package/commands/gsd/note.md +34 -0
- package/commands/gsd/pause-work.md +38 -0
- package/commands/gsd/plan-milestone-gaps.md +34 -0
- package/commands/gsd/plan-phase.md +47 -0
- package/commands/gsd/plant-seed.md +28 -0
- package/commands/gsd/pr-branch.md +25 -0
- package/commands/gsd/profile-user.md +46 -0
- package/commands/gsd/progress.md +24 -0
- package/commands/gsd/prototype.md +56 -0
- package/commands/gsd/quick.md +47 -0
- package/commands/gsd/reapply-patches.md +123 -0
- package/commands/gsd/remove-phase.md +31 -0
- package/commands/gsd/remove-workspace.md +26 -0
- package/commands/gsd/research-phase.md +195 -0
- package/commands/gsd/resume-work.md +40 -0
- package/commands/gsd/review-backlog.md +61 -0
- package/commands/gsd/review.md +37 -0
- package/commands/gsd/session-report.md +19 -0
- package/commands/gsd/set-mode.md +41 -0
- package/commands/gsd/set-profile.md +12 -0
- package/commands/gsd/settings.md +36 -0
- package/commands/gsd/ship.md +23 -0
- package/commands/gsd/stats.md +18 -0
- package/commands/gsd/thread.md +127 -0
- package/commands/gsd/ui-phase.md +34 -0
- package/commands/gsd/ui-review.md +32 -0
- package/commands/gsd/update.md +37 -0
- package/commands/gsd/validate-phase.md +35 -0
- package/commands/gsd/verify-work.md +38 -0
- package/commands/gsd/workstreams.md +63 -0
- package/get-shit-done/bin/gsd-tools.cjs +946 -0
- package/get-shit-done/bin/lib/arc-scanner.cjs +341 -0
- package/get-shit-done/bin/lib/commands.cjs +959 -0
- package/get-shit-done/bin/lib/config.cjs +466 -0
- package/get-shit-done/bin/lib/core.cjs +1230 -0
- package/get-shit-done/bin/lib/frontmatter.cjs +336 -0
- package/get-shit-done/bin/lib/init.cjs +1442 -0
- package/get-shit-done/bin/lib/milestone.cjs +252 -0
- package/get-shit-done/bin/lib/model-profiles.cjs +68 -0
- package/get-shit-done/bin/lib/phase.cjs +888 -0
- package/get-shit-done/bin/lib/profile-output.cjs +952 -0
- package/get-shit-done/bin/lib/profile-pipeline.cjs +539 -0
- package/get-shit-done/bin/lib/roadmap.cjs +329 -0
- package/get-shit-done/bin/lib/security.cjs +382 -0
- package/get-shit-done/bin/lib/state.cjs +1031 -0
- package/get-shit-done/bin/lib/template.cjs +222 -0
- package/get-shit-done/bin/lib/uat.cjs +282 -0
- package/get-shit-done/bin/lib/verify.cjs +888 -0
- package/get-shit-done/bin/lib/workstream.cjs +491 -0
- package/get-shit-done/commands/gsd/workstreams.md +63 -0
- package/get-shit-done/references/arc-standard.md +315 -0
- package/get-shit-done/references/checkpoints.md +778 -0
- package/get-shit-done/references/continuation-format.md +249 -0
- package/get-shit-done/references/decimal-phase-calculation.md +64 -0
- package/get-shit-done/references/git-integration.md +295 -0
- package/get-shit-done/references/git-planning-commit.md +38 -0
- package/get-shit-done/references/model-profile-resolution.md +36 -0
- package/get-shit-done/references/model-profiles.md +139 -0
- package/get-shit-done/references/phase-argument-parsing.md +61 -0
- package/get-shit-done/references/planning-config.md +202 -0
- package/get-shit-done/references/questioning.md +162 -0
- package/get-shit-done/references/tdd.md +263 -0
- package/get-shit-done/references/ui-brand.md +160 -0
- package/get-shit-done/references/user-profiling.md +681 -0
- package/get-shit-done/references/verification-patterns.md +612 -0
- package/get-shit-done/references/workstream-flag.md +58 -0
- package/get-shit-done/templates/DEBUG.md +164 -0
- package/get-shit-done/templates/UAT.md +265 -0
- package/get-shit-done/templates/UI-SPEC.md +100 -0
- package/get-shit-done/templates/VALIDATION.md +76 -0
- package/get-shit-done/templates/claude-md.md +122 -0
- package/get-shit-done/templates/codebase/architecture.md +255 -0
- package/get-shit-done/templates/codebase/concerns.md +310 -0
- package/get-shit-done/templates/codebase/conventions.md +307 -0
- package/get-shit-done/templates/codebase/integrations.md +280 -0
- package/get-shit-done/templates/codebase/stack.md +186 -0
- package/get-shit-done/templates/codebase/structure.md +285 -0
- package/get-shit-done/templates/codebase/testing.md +480 -0
- package/get-shit-done/templates/config.json +44 -0
- package/get-shit-done/templates/context.md +352 -0
- package/get-shit-done/templates/continue-here.md +78 -0
- package/get-shit-done/templates/copilot-instructions.md +7 -0
- package/get-shit-done/templates/debug-subagent-prompt.md +91 -0
- package/get-shit-done/templates/dev-preferences.md +21 -0
- package/get-shit-done/templates/discovery.md +146 -0
- package/get-shit-done/templates/discussion-log.md +63 -0
- package/get-shit-done/templates/milestone-archive.md +123 -0
- package/get-shit-done/templates/milestone.md +115 -0
- package/get-shit-done/templates/phase-prompt.md +610 -0
- package/get-shit-done/templates/planner-subagent-prompt.md +117 -0
- package/get-shit-done/templates/project.md +186 -0
- package/get-shit-done/templates/requirements.md +231 -0
- package/get-shit-done/templates/research-project/ARCHITECTURE.md +204 -0
- package/get-shit-done/templates/research-project/FEATURES.md +147 -0
- package/get-shit-done/templates/research-project/PITFALLS.md +200 -0
- package/get-shit-done/templates/research-project/STACK.md +120 -0
- package/get-shit-done/templates/research-project/SUMMARY.md +170 -0
- package/get-shit-done/templates/research.md +552 -0
- package/get-shit-done/templates/retrospective.md +54 -0
- package/get-shit-done/templates/roadmap.md +202 -0
- package/get-shit-done/templates/state.md +176 -0
- package/get-shit-done/templates/summary-complex.md +59 -0
- package/get-shit-done/templates/summary-minimal.md +41 -0
- package/get-shit-done/templates/summary-standard.md +48 -0
- package/get-shit-done/templates/summary.md +248 -0
- package/get-shit-done/templates/user-profile.md +146 -0
- package/get-shit-done/templates/user-setup.md +311 -0
- package/get-shit-done/templates/verification-report.md +322 -0
- package/get-shit-done/workflows/add-phase.md +112 -0
- package/get-shit-done/workflows/add-tests.md +351 -0
- package/get-shit-done/workflows/add-todo.md +158 -0
- package/get-shit-done/workflows/audit-milestone.md +340 -0
- package/get-shit-done/workflows/audit-uat.md +109 -0
- package/get-shit-done/workflows/autonomous.md +891 -0
- package/get-shit-done/workflows/check-todos.md +177 -0
- package/get-shit-done/workflows/cleanup.md +152 -0
- package/get-shit-done/workflows/complete-milestone.md +767 -0
- package/get-shit-done/workflows/diagnose-issues.md +231 -0
- package/get-shit-done/workflows/discovery-phase.md +289 -0
- package/get-shit-done/workflows/discuss-phase-assumptions.md +653 -0
- package/get-shit-done/workflows/discuss-phase.md +1049 -0
- package/get-shit-done/workflows/do.md +104 -0
- package/get-shit-done/workflows/execute-phase.md +846 -0
- package/get-shit-done/workflows/execute-plan.md +514 -0
- package/get-shit-done/workflows/fast.md +105 -0
- package/get-shit-done/workflows/forensics.md +265 -0
- package/get-shit-done/workflows/health.md +181 -0
- package/get-shit-done/workflows/help.md +634 -0
- package/get-shit-done/workflows/insert-phase.md +130 -0
- package/get-shit-done/workflows/list-phase-assumptions.md +178 -0
- package/get-shit-done/workflows/list-workspaces.md +56 -0
- package/get-shit-done/workflows/manager.md +362 -0
- package/get-shit-done/workflows/map-codebase.md +377 -0
- package/get-shit-done/workflows/milestone-summary.md +223 -0
- package/get-shit-done/workflows/new-milestone.md +486 -0
- package/get-shit-done/workflows/new-project.md +1250 -0
- package/get-shit-done/workflows/new-workspace.md +237 -0
- package/get-shit-done/workflows/next.md +97 -0
- package/get-shit-done/workflows/node-repair.md +92 -0
- package/get-shit-done/workflows/note.md +156 -0
- package/get-shit-done/workflows/pause-work.md +176 -0
- package/get-shit-done/workflows/plan-milestone-gaps.md +273 -0
- package/get-shit-done/workflows/plan-phase.md +859 -0
- package/get-shit-done/workflows/plant-seed.md +169 -0
- package/get-shit-done/workflows/pr-branch.md +129 -0
- package/get-shit-done/workflows/profile-user.md +450 -0
- package/get-shit-done/workflows/progress.md +507 -0
- package/get-shit-done/workflows/quick.md +757 -0
- package/get-shit-done/workflows/remove-phase.md +155 -0
- package/get-shit-done/workflows/remove-workspace.md +90 -0
- package/get-shit-done/workflows/research-phase.md +82 -0
- package/get-shit-done/workflows/resume-project.md +326 -0
- package/get-shit-done/workflows/review.md +228 -0
- package/get-shit-done/workflows/session-report.md +146 -0
- package/get-shit-done/workflows/settings.md +283 -0
- package/get-shit-done/workflows/ship.md +228 -0
- package/get-shit-done/workflows/stats.md +60 -0
- package/get-shit-done/workflows/transition.md +671 -0
- package/get-shit-done/workflows/ui-phase.md +302 -0
- package/get-shit-done/workflows/ui-review.md +165 -0
- package/get-shit-done/workflows/update.md +323 -0
- package/get-shit-done/workflows/validate-phase.md +174 -0
- package/get-shit-done/workflows/verify-phase.md +254 -0
- package/get-shit-done/workflows/verify-work.md +637 -0
- package/hooks/dist/gsd-check-update.js +114 -0
- package/hooks/dist/gsd-context-monitor.js +156 -0
- package/hooks/dist/gsd-prompt-guard.js +96 -0
- package/hooks/dist/gsd-statusline.js +119 -0
- package/hooks/dist/gsd-workflow-guard.js +94 -0
- package/package.json +52 -0
- package/scripts/base64-scan.sh +262 -0
- package/scripts/build-hooks.js +82 -0
- package/scripts/prompt-injection-scan.sh +198 -0
- package/scripts/run-tests.cjs +29 -0
- package/scripts/secret-scan.sh +227 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
# Forensics Workflow
|
|
2
|
+
|
|
3
|
+
Post-mortem investigation for failed or stuck GSD workflows. Analyzes git history,
|
|
4
|
+
`.planning/` artifacts, and file system state to detect anomalies and generate a
|
|
5
|
+
structured diagnostic report.
|
|
6
|
+
|
|
7
|
+
**Principle:** This is a read-only investigation. Do not modify project files.
|
|
8
|
+
Only write the forensic report.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Step 1: Get Problem Description
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
PROBLEM="$ARGUMENTS"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If `$ARGUMENTS` is empty, ask the user:
|
|
19
|
+
> "What went wrong? Describe the issue — e.g., 'autonomous mode got stuck on phase 3',
|
|
20
|
+
> 'execute-phase failed silently', 'costs seem unusually high'."
|
|
21
|
+
|
|
22
|
+
Record the problem description for the report.
|
|
23
|
+
|
|
24
|
+
## Step 2: Gather Evidence
|
|
25
|
+
|
|
26
|
+
Collect data from all available sources. Missing sources are fine — adapt to what exists.
|
|
27
|
+
|
|
28
|
+
### 2a. Git History
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Recent commits (last 30)
|
|
32
|
+
git log --oneline -30
|
|
33
|
+
|
|
34
|
+
# Commits with timestamps for gap analysis
|
|
35
|
+
git log --format="%H %ai %s" -30
|
|
36
|
+
|
|
37
|
+
# Files changed in recent commits (detect repeated edits)
|
|
38
|
+
git log --name-only --format="" -20 | sort | uniq -c | sort -rn | head -20
|
|
39
|
+
|
|
40
|
+
# Uncommitted work
|
|
41
|
+
git status --short
|
|
42
|
+
git diff --stat
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Record:
|
|
46
|
+
- Commit timeline (dates, messages, frequency)
|
|
47
|
+
- Most-edited files (potential stuck-loop indicator)
|
|
48
|
+
- Uncommitted changes (potential crash/interruption indicator)
|
|
49
|
+
|
|
50
|
+
### 2b. Planning State
|
|
51
|
+
|
|
52
|
+
Read these files if they exist:
|
|
53
|
+
- `.planning/STATE.md` — current milestone, phase, progress, blockers, last session
|
|
54
|
+
- `.planning/ROADMAP.md` — phase list with status
|
|
55
|
+
- `.planning/config.json` — workflow configuration
|
|
56
|
+
|
|
57
|
+
Extract:
|
|
58
|
+
- Current phase and its status
|
|
59
|
+
- Last recorded session stop point
|
|
60
|
+
- Any blockers or flags
|
|
61
|
+
|
|
62
|
+
### 2c. Phase Artifacts
|
|
63
|
+
|
|
64
|
+
For each phase directory in `.planning/phases/*/`:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
ls .planning/phases/*/
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For each phase, check which artifacts exist:
|
|
71
|
+
- `{padded}-PLAN.md` or `{padded}-PLAN-*.md` (execution plans)
|
|
72
|
+
- `{padded}-SUMMARY.md` (completion summary)
|
|
73
|
+
- `{padded}-VERIFICATION.md` (quality verification)
|
|
74
|
+
- `{padded}-CONTEXT.md` (design decisions)
|
|
75
|
+
- `{padded}-RESEARCH.md` (pre-planning research)
|
|
76
|
+
|
|
77
|
+
Track: which phases have complete artifact sets vs gaps.
|
|
78
|
+
|
|
79
|
+
### 2d. Session Reports
|
|
80
|
+
|
|
81
|
+
Read `.planning/reports/SESSION_REPORT.md` if it exists — extract last session outcomes,
|
|
82
|
+
work completed, token estimates.
|
|
83
|
+
|
|
84
|
+
### 2e. Git Worktree State
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git worktree list
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Check for orphaned worktrees (from crashed agents).
|
|
91
|
+
|
|
92
|
+
## Step 3: Detect Anomalies
|
|
93
|
+
|
|
94
|
+
Evaluate the gathered evidence against these anomaly patterns:
|
|
95
|
+
|
|
96
|
+
### Stuck Loop Detection
|
|
97
|
+
|
|
98
|
+
**Signal:** Same file appears in 3+ consecutive commits within a short time window.
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Look for files committed repeatedly in sequence
|
|
102
|
+
git log --name-only --format="---COMMIT---" -20
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Parse commit boundaries. If any file appears in 3+ consecutive commits, flag as:
|
|
106
|
+
- **Confidence HIGH** if the commit messages are similar (e.g., "fix:", "fix:", "fix:" on same file)
|
|
107
|
+
- **Confidence MEDIUM** if the file appears frequently but commit messages vary
|
|
108
|
+
|
|
109
|
+
### Missing Artifact Detection
|
|
110
|
+
|
|
111
|
+
**Signal:** Phase appears complete (has commits, is past in roadmap) but lacks expected artifacts.
|
|
112
|
+
|
|
113
|
+
For each phase that should be complete:
|
|
114
|
+
- PLAN.md missing → planning step was skipped
|
|
115
|
+
- SUMMARY.md missing → phase was not properly closed
|
|
116
|
+
- VERIFICATION.md missing → quality check was skipped
|
|
117
|
+
|
|
118
|
+
### Abandoned Work Detection
|
|
119
|
+
|
|
120
|
+
**Signal:** Large gap between last commit and current time, with STATE.md showing mid-execution.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Time since last commit
|
|
124
|
+
git log -1 --format="%ai"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
If STATE.md shows an active phase but the last commit is >2 hours old and there are
|
|
128
|
+
uncommitted changes, flag as potential abandonment or crash.
|
|
129
|
+
|
|
130
|
+
### Crash/Interruption Detection
|
|
131
|
+
|
|
132
|
+
**Signal:** Uncommitted changes + STATE.md shows mid-execution + orphaned worktrees.
|
|
133
|
+
|
|
134
|
+
Combine:
|
|
135
|
+
- `git status` shows modified/staged files
|
|
136
|
+
- STATE.md has an active execution entry
|
|
137
|
+
- `git worktree list` shows worktrees beyond the main one
|
|
138
|
+
|
|
139
|
+
### Scope Drift Detection
|
|
140
|
+
|
|
141
|
+
**Signal:** Recent commits touch files outside the current phase's expected scope.
|
|
142
|
+
|
|
143
|
+
Read the current phase PLAN.md to determine expected file paths. Compare against
|
|
144
|
+
files actually modified in recent commits. Flag any files that are clearly outside
|
|
145
|
+
the phase's domain.
|
|
146
|
+
|
|
147
|
+
### Test Regression Detection
|
|
148
|
+
|
|
149
|
+
**Signal:** Commit messages containing "fix test", "revert", or re-commits of test files.
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
git log --oneline -20 | grep -iE "fix test|revert|broken|regression|fail"
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Step 4: Generate Report
|
|
156
|
+
|
|
157
|
+
Create the forensics directory if needed:
|
|
158
|
+
```bash
|
|
159
|
+
mkdir -p .planning/forensics
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Write to `.planning/forensics/report-$(date +%Y%m%d-%H%M%S).md`:
|
|
163
|
+
|
|
164
|
+
```markdown
|
|
165
|
+
# Forensic Report
|
|
166
|
+
|
|
167
|
+
**Generated:** {ISO timestamp}
|
|
168
|
+
**Problem:** {user's description}
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Evidence Summary
|
|
173
|
+
|
|
174
|
+
### Git Activity
|
|
175
|
+
- **Last commit:** {date} — "{message}"
|
|
176
|
+
- **Commits (last 30):** {count}
|
|
177
|
+
- **Time span:** {earliest} → {latest}
|
|
178
|
+
- **Uncommitted changes:** {yes/no — list if yes}
|
|
179
|
+
- **Active worktrees:** {count — list if >1}
|
|
180
|
+
|
|
181
|
+
### Planning State
|
|
182
|
+
- **Current milestone:** {version or "none"}
|
|
183
|
+
- **Current phase:** {number — name — status}
|
|
184
|
+
- **Last session:** {stopped_at from STATE.md}
|
|
185
|
+
- **Blockers:** {any flags from STATE.md}
|
|
186
|
+
|
|
187
|
+
### Artifact Completeness
|
|
188
|
+
| Phase | PLAN | CONTEXT | RESEARCH | SUMMARY | VERIFICATION |
|
|
189
|
+
|-------|------|---------|----------|---------|-------------|
|
|
190
|
+
{for each phase: name | ✅/❌ per artifact}
|
|
191
|
+
|
|
192
|
+
## Anomalies Detected
|
|
193
|
+
|
|
194
|
+
### {Anomaly Type} — {Confidence: HIGH/MEDIUM/LOW}
|
|
195
|
+
**Evidence:** {specific commits, files, or state data}
|
|
196
|
+
**Interpretation:** {what this likely means}
|
|
197
|
+
|
|
198
|
+
{repeat for each anomaly found}
|
|
199
|
+
|
|
200
|
+
## Root Cause Hypothesis
|
|
201
|
+
|
|
202
|
+
Based on the evidence above, the most likely explanation is:
|
|
203
|
+
|
|
204
|
+
{1-3 sentence hypothesis grounded in the anomalies}
|
|
205
|
+
|
|
206
|
+
## Recommended Actions
|
|
207
|
+
|
|
208
|
+
1. {Specific, actionable remediation step}
|
|
209
|
+
2. {Another step if applicable}
|
|
210
|
+
3. {Recovery command if applicable — e.g., `/gsd:resume-work`, `/gsd:execute-phase N`}
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
*Report generated by `/gsd:forensics`. All paths redacted for portability.*
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Redaction rules:**
|
|
218
|
+
- Replace absolute paths with relative paths (strip `$HOME` prefix)
|
|
219
|
+
- Remove any API keys, tokens, or credentials found in git diff output
|
|
220
|
+
- Truncate large diffs to first 50 lines
|
|
221
|
+
|
|
222
|
+
## Step 5: Present Report
|
|
223
|
+
|
|
224
|
+
Display the full forensic report inline.
|
|
225
|
+
|
|
226
|
+
## Step 6: Offer Interactive Investigation
|
|
227
|
+
|
|
228
|
+
> "Report saved to `.planning/forensics/report-{timestamp}.md`.
|
|
229
|
+
>
|
|
230
|
+
> I can dig deeper into any finding. Want me to:
|
|
231
|
+
> - Trace a specific anomaly to its root cause?
|
|
232
|
+
> - Read specific files referenced in the evidence?
|
|
233
|
+
> - Check if a similar issue has been reported before?"
|
|
234
|
+
|
|
235
|
+
If the user asks follow-up questions, answer from the evidence already gathered.
|
|
236
|
+
Read additional files only if specifically needed.
|
|
237
|
+
|
|
238
|
+
## Step 7: Offer Issue Creation
|
|
239
|
+
|
|
240
|
+
If actionable anomalies were found (HIGH or MEDIUM confidence):
|
|
241
|
+
|
|
242
|
+
> "Want me to create a GitHub issue for this? I'll format the findings and redact paths."
|
|
243
|
+
|
|
244
|
+
If confirmed:
|
|
245
|
+
```bash
|
|
246
|
+
# Check if "bug" label exists before using it
|
|
247
|
+
BUG_LABEL=$(gh label list --search "bug" --json name -q '.[0].name' 2>/dev/null)
|
|
248
|
+
LABEL_FLAG=""
|
|
249
|
+
if [ -n "$BUG_LABEL" ]; then
|
|
250
|
+
LABEL_FLAG="--label bug"
|
|
251
|
+
fi
|
|
252
|
+
|
|
253
|
+
gh issue create \
|
|
254
|
+
--title "bug: {concise description from anomaly}" \
|
|
255
|
+
$LABEL_FLAG \
|
|
256
|
+
--body "{formatted findings from report}"
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Step 8: Update STATE.md
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
gsd-tools.cjs state record-session \
|
|
263
|
+
--stopped-at "Forensic investigation complete" \
|
|
264
|
+
--resume-file ".planning/forensics/report-{timestamp}.md"
|
|
265
|
+
```
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Validate `.planning/` directory integrity and report actionable issues. Checks for missing files, invalid configurations, inconsistent state, and orphaned plans. Optionally repairs auto-fixable issues.
|
|
3
|
+
</purpose>
|
|
4
|
+
|
|
5
|
+
<required_reading>
|
|
6
|
+
Read all files referenced by the invoking prompt's execution_context before starting.
|
|
7
|
+
</required_reading>
|
|
8
|
+
|
|
9
|
+
<process>
|
|
10
|
+
|
|
11
|
+
<step name="parse_args">
|
|
12
|
+
**Parse arguments:**
|
|
13
|
+
|
|
14
|
+
Check if `--repair` flag is present in the command arguments.
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
REPAIR_FLAG=""
|
|
18
|
+
if arguments contain "--repair"; then
|
|
19
|
+
REPAIR_FLAG="--repair"
|
|
20
|
+
fi
|
|
21
|
+
```
|
|
22
|
+
</step>
|
|
23
|
+
|
|
24
|
+
<step name="run_health_check">
|
|
25
|
+
**Run health validation:**
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" validate health $REPAIR_FLAG
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Parse JSON output:
|
|
32
|
+
- `status`: "healthy" | "degraded" | "broken"
|
|
33
|
+
- `errors[]`: Critical issues (code, message, fix, repairable)
|
|
34
|
+
- `warnings[]`: Non-critical issues
|
|
35
|
+
- `info[]`: Informational notes
|
|
36
|
+
- `repairable_count`: Number of auto-fixable issues
|
|
37
|
+
- `repairs_performed[]`: Actions taken if --repair was used
|
|
38
|
+
</step>
|
|
39
|
+
|
|
40
|
+
<step name="format_output">
|
|
41
|
+
**Format and display results:**
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
45
|
+
GSD Health Check
|
|
46
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
47
|
+
|
|
48
|
+
Status: HEALTHY | DEGRADED | BROKEN
|
|
49
|
+
Errors: N | Warnings: N | Info: N
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**If repairs were performed:**
|
|
53
|
+
```
|
|
54
|
+
## Repairs Performed
|
|
55
|
+
|
|
56
|
+
- ✓ config.json: Created with defaults
|
|
57
|
+
- ✓ STATE.md: Regenerated from roadmap
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**If errors exist:**
|
|
61
|
+
```
|
|
62
|
+
## Errors
|
|
63
|
+
|
|
64
|
+
- [E001] config.json: JSON parse error at line 5
|
|
65
|
+
Fix: Run /gsd:health --repair to reset to defaults
|
|
66
|
+
|
|
67
|
+
- [E002] PROJECT.md not found
|
|
68
|
+
Fix: Run /gsd:new-project to create
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
**If warnings exist:**
|
|
72
|
+
```
|
|
73
|
+
## Warnings
|
|
74
|
+
|
|
75
|
+
- [W002] STATE.md references phase 5, but only phases 1-3 exist
|
|
76
|
+
Fix: Review STATE.md manually before changing it; repair will not overwrite an existing STATE.md
|
|
77
|
+
|
|
78
|
+
- [W005] Phase directory "1-setup" doesn't follow NN-name format
|
|
79
|
+
Fix: Rename to match pattern (e.g., 01-setup)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**If info exists:**
|
|
83
|
+
```
|
|
84
|
+
## Info
|
|
85
|
+
|
|
86
|
+
- [I001] 02-implementation/02-01-PLAN.md has no SUMMARY.md
|
|
87
|
+
Note: May be in progress
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Footer (if repairable issues exist and --repair was NOT used):**
|
|
91
|
+
```
|
|
92
|
+
---
|
|
93
|
+
N issues can be auto-repaired. Run: /gsd:health --repair
|
|
94
|
+
```
|
|
95
|
+
</step>
|
|
96
|
+
|
|
97
|
+
<step name="offer_repair">
|
|
98
|
+
**If repairable issues exist and --repair was NOT used:**
|
|
99
|
+
|
|
100
|
+
Ask user if they want to run repairs:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
Would you like to run /gsd:health --repair to fix N issues automatically?
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
If yes, re-run with --repair flag and display results.
|
|
107
|
+
</step>
|
|
108
|
+
|
|
109
|
+
<step name="verify_repairs">
|
|
110
|
+
**If repairs were performed:**
|
|
111
|
+
|
|
112
|
+
Re-run health check without --repair to confirm issues are resolved:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" validate health
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Report final status.
|
|
119
|
+
</step>
|
|
120
|
+
|
|
121
|
+
</process>
|
|
122
|
+
|
|
123
|
+
<error_codes>
|
|
124
|
+
|
|
125
|
+
| Code | Severity | Description | Repairable |
|
|
126
|
+
|------|----------|-------------|------------|
|
|
127
|
+
| E001 | error | .planning/ directory not found | No |
|
|
128
|
+
| E002 | error | PROJECT.md not found | No |
|
|
129
|
+
| E003 | error | ROADMAP.md not found | No |
|
|
130
|
+
| E004 | error | STATE.md not found | Yes |
|
|
131
|
+
| E005 | error | config.json parse error | Yes |
|
|
132
|
+
| W001 | warning | PROJECT.md missing required section | No |
|
|
133
|
+
| W002 | warning | STATE.md references invalid phase | No |
|
|
134
|
+
| W003 | warning | config.json not found | Yes |
|
|
135
|
+
| W004 | warning | config.json invalid field value | No |
|
|
136
|
+
| W005 | warning | Phase directory naming mismatch | No |
|
|
137
|
+
| W006 | warning | Phase in ROADMAP but no directory | No |
|
|
138
|
+
| W007 | warning | Phase on disk but not in ROADMAP | No |
|
|
139
|
+
| W008 | warning | config.json: workflow.nyquist_validation absent (defaults to enabled but agents may skip) | Yes |
|
|
140
|
+
| W009 | warning | Phase has Validation Architecture in RESEARCH.md but no VALIDATION.md | No |
|
|
141
|
+
| I001 | info | Plan without SUMMARY (may be in progress) | No |
|
|
142
|
+
|
|
143
|
+
</error_codes>
|
|
144
|
+
|
|
145
|
+
<repair_actions>
|
|
146
|
+
|
|
147
|
+
| Action | Effect | Risk |
|
|
148
|
+
|--------|--------|------|
|
|
149
|
+
| createConfig | Create config.json with defaults | None |
|
|
150
|
+
| resetConfig | Delete + recreate config.json | Loses custom settings |
|
|
151
|
+
| regenerateState | Create STATE.md from ROADMAP structure when it is missing | Loses session history |
|
|
152
|
+
| addNyquistKey | Add workflow.nyquist_validation: true to config.json | None — matches existing default |
|
|
153
|
+
|
|
154
|
+
**Not repairable (too risky):**
|
|
155
|
+
- PROJECT.md, ROADMAP.md content
|
|
156
|
+
- Phase directory renaming
|
|
157
|
+
- Orphaned plan cleanup
|
|
158
|
+
|
|
159
|
+
</repair_actions>
|
|
160
|
+
|
|
161
|
+
<stale_task_cleanup>
|
|
162
|
+
**Windows-specific:** Check for stale Claude Code task directories that accumulate on crash/freeze.
|
|
163
|
+
These are left behind when subagents are force-killed and consume disk space.
|
|
164
|
+
|
|
165
|
+
When `--repair` is active, detect and clean up:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# Check for stale task directories (older than 24 hours)
|
|
169
|
+
TASKS_DIR="$HOME/.claude/tasks"
|
|
170
|
+
if [ -d "$TASKS_DIR" ]; then
|
|
171
|
+
STALE_COUNT=$( (find "$TASKS_DIR" -maxdepth 1 -type d -mtime +1 2>/dev/null || true) | wc -l )
|
|
172
|
+
if [ "$STALE_COUNT" -gt 0 ]; then
|
|
173
|
+
echo "⚠️ Found $STALE_COUNT stale task directories in ~/.claude/tasks/"
|
|
174
|
+
echo " These are leftover from crashed subagent sessions."
|
|
175
|
+
echo " Run: rm -rf ~/.claude/tasks/* (safe — only affects dead sessions)"
|
|
176
|
+
fi
|
|
177
|
+
fi
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Report as info diagnostic: `I002 | info | Stale subagent task directories found | Yes (--repair removes them)`
|
|
181
|
+
</stale_task_cleanup>
|