declare-cc 0.2.0 → 0.3.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 (63) hide show
  1. package/README.md +126 -27
  2. package/agents/declare-codebase-mapper.md +761 -0
  3. package/agents/declare-debugger.md +1198 -0
  4. package/agents/declare-plan-checker.md +608 -0
  5. package/agents/declare-planner.md +1015 -0
  6. package/agents/declare-research-synthesizer.md +309 -0
  7. package/agents/declare-researcher.md +484 -0
  8. package/commands/declare/add-todo.md +41 -0
  9. package/commands/declare/audit.md +76 -0
  10. package/commands/declare/check-todos.md +125 -0
  11. package/commands/declare/complete-milestone.md +215 -0
  12. package/commands/declare/dashboard.md +76 -0
  13. package/commands/{gsd → declare}/debug.md +11 -11
  14. package/commands/declare/discuss.md +65 -0
  15. package/commands/declare/health.md +92 -0
  16. package/commands/declare/map-codebase.md +149 -0
  17. package/commands/declare/new-milestone.md +172 -0
  18. package/commands/declare/new-project.md +565 -0
  19. package/commands/declare/pause.md +138 -0
  20. package/commands/declare/plan.md +236 -0
  21. package/commands/declare/progress.md +116 -0
  22. package/commands/declare/quick.md +119 -0
  23. package/commands/declare/reapply-patches.md +178 -0
  24. package/commands/declare/research.md +267 -0
  25. package/commands/declare/resume.md +146 -0
  26. package/commands/declare/set-profile.md +66 -0
  27. package/commands/declare/settings.md +119 -0
  28. package/commands/declare/update.md +251 -0
  29. package/commands/declare/verify.md +64 -0
  30. package/dist/declare-tools.cjs +1234 -3
  31. package/package.json +1 -1
  32. package/workflows/discuss.md +476 -0
  33. package/workflows/verify.md +504 -0
  34. package/commands/gsd/add-phase.md +0 -39
  35. package/commands/gsd/add-todo.md +0 -42
  36. package/commands/gsd/audit-milestone.md +0 -42
  37. package/commands/gsd/check-todos.md +0 -41
  38. package/commands/gsd/cleanup.md +0 -18
  39. package/commands/gsd/complete-milestone.md +0 -136
  40. package/commands/gsd/discuss-phase.md +0 -87
  41. package/commands/gsd/execute-phase.md +0 -42
  42. package/commands/gsd/health.md +0 -22
  43. package/commands/gsd/help.md +0 -22
  44. package/commands/gsd/insert-phase.md +0 -33
  45. package/commands/gsd/join-discord.md +0 -18
  46. package/commands/gsd/list-phase-assumptions.md +0 -50
  47. package/commands/gsd/map-codebase.md +0 -71
  48. package/commands/gsd/new-milestone.md +0 -51
  49. package/commands/gsd/new-project.md +0 -42
  50. package/commands/gsd/new-project.md.bak +0 -1041
  51. package/commands/gsd/pause-work.md +0 -35
  52. package/commands/gsd/plan-milestone-gaps.md +0 -40
  53. package/commands/gsd/plan-phase.md +0 -44
  54. package/commands/gsd/progress.md +0 -24
  55. package/commands/gsd/quick.md +0 -40
  56. package/commands/gsd/reapply-patches.md +0 -110
  57. package/commands/gsd/remove-phase.md +0 -32
  58. package/commands/gsd/research-phase.md +0 -187
  59. package/commands/gsd/resume-work.md +0 -40
  60. package/commands/gsd/set-profile.md +0 -34
  61. package/commands/gsd/settings.md +0 -36
  62. package/commands/gsd/update.md +0 -37
  63. package/commands/gsd/verify-work.md +0 -39
@@ -0,0 +1,125 @@
1
+ ---
2
+ description: List pending todos and select one to work on or route to a milestone
3
+ argument-hint: ""
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Bash
8
+ - Task
9
+ ---
10
+
11
+ List all pending todos, let the user select one, and offer to act on it now or plan it into the next milestone.
12
+
13
+ **Step 1: Load pending todos.**
14
+
15
+ ```bash
16
+ node dist/declare-tools.cjs check-todos
17
+ ```
18
+
19
+ Parse the JSON output. It contains a `todos` array with `{id, description, created, path}` objects.
20
+
21
+ If `todos` is empty:
22
+
23
+ ```
24
+ No pending todos. Capture ideas with `/declare:add-todo`.
25
+ ```
26
+
27
+ Stop.
28
+
29
+ **Step 2: Display the todo list.**
30
+
31
+ ```
32
+ ## Pending Todos ([count])
33
+
34
+ 1. [id]: [description] — [created]
35
+ 2. [id]: [description] — [created]
36
+ ...
37
+ ```
38
+
39
+ Ask: "Which todo would you like to look at? Enter the number, ID, or 'skip' to exit."
40
+
41
+ **Step 3: Load the selected todo.**
42
+
43
+ Wait for the user's response.
44
+
45
+ If "skip" or empty: exit.
46
+
47
+ Identify the selected todo by number or ID from the list.
48
+
49
+ Read the todo file at its `path`:
50
+
51
+ ```bash
52
+ cat [path]
53
+ ```
54
+
55
+ Display the full todo content so the user can review it.
56
+
57
+ **Step 4: Offer actions.**
58
+
59
+ Ask: "What would you like to do with this todo?"
60
+
61
+ Present these options:
62
+
63
+ ```
64
+ 1. Work on it now (spawn a quick task agent)
65
+ 2. Add to next milestone planning
66
+ 3. Mark as completed (move to completed/)
67
+ 4. Skip (leave pending)
68
+ ```
69
+
70
+ **Step 5: Execute the chosen action.**
71
+
72
+ **Option 1 — Work on it now:**
73
+
74
+ Spawn a Task agent:
75
+
76
+ ```
77
+ Execute this todo task. Make atomic commits after each logical unit of work.
78
+
79
+ Task: [description]
80
+ Context file: [path]
81
+
82
+ Read the context file. Do the work. When complete, report what was done, files changed, and commit hashes.
83
+ ```
84
+
85
+ After the agent completes, display its report, then ask: "Mark this todo as completed? (yes/no)"
86
+
87
+ If yes: run:
88
+
89
+ ```bash
90
+ node dist/declare-tools.cjs complete-todo --id [id]
91
+ ```
92
+
93
+ Display: "Todo [id] marked as completed."
94
+
95
+ **Option 2 — Add to next milestone planning:**
96
+
97
+ Ask: "Which milestone should this feed into? (e.g. M-14, or 'new' to create a new one)"
98
+
99
+ If the user provides a milestone ID, display:
100
+
101
+ ```
102
+ Noted: "[description]" should be considered when planning [milestone-id].
103
+ ```
104
+
105
+ Add this note as a reminder: suggest the user mention it when running `/declare:milestones` or `/declare:actions` for that milestone.
106
+
107
+ **Option 3 — Mark as completed:**
108
+
109
+ ```bash
110
+ node dist/declare-tools.cjs complete-todo --id [id]
111
+ ```
112
+
113
+ Parse the JSON output and display: "Todo [id] moved to completed/."
114
+
115
+ **Option 4 — Skip:**
116
+
117
+ Display: "Todo left pending."
118
+
119
+ **Step 6: Offer to review another todo.**
120
+
121
+ After completing any action (or skipping), ask: "Would you like to review another todo? (yes/no)"
122
+
123
+ If yes: return to Step 2 with the updated list (reload to reflect any completions).
124
+
125
+ If no: exit.
@@ -0,0 +1,215 @@
1
+ ---
2
+ description: Archive a completed Declare milestone — snapshot graph, tag release, and prepare for next cycle
3
+ allowed-tools:
4
+ - Read
5
+ - Write
6
+ - Bash
7
+ - Glob
8
+ - Grep
9
+ - AskUserQuestion
10
+ argument-hint: "[vX.Y]"
11
+ ---
12
+
13
+ Archive a completed Declare milestone: snapshot the graph, check milestone statuses, update PROJECT.md, create a git tag, and prepare for the next cycle.
14
+
15
+ **Step 0: Determine version.**
16
+
17
+ Parse `$ARGUMENTS` for a version string matching `vX.Y` or `X.Y`.
18
+
19
+ If no version in `$ARGUMENTS`, ask: "What version are we completing? (e.g., v1.0)"
20
+
21
+ Normalize to `vX.Y` format (prepend `v` if absent).
22
+
23
+ **Step 1: Pre-flight check — verify milestone statuses.**
24
+
25
+ Load the full graph:
26
+
27
+ ```bash
28
+ node dist/declare-tools.cjs load-graph
29
+ ```
30
+
31
+ Parse the JSON output. If it contains an `error` field, tell the user to run `/declare:init` first and stop.
32
+
33
+ For each milestone in the graph, check its `status` field. A milestone is complete when its status is `DONE`, `KEPT`, `HONORED`, or `RENEGOTIATED`.
34
+
35
+ Milestones are NOT complete if their status is `PENDING`, `ACTIVE`, or `BROKEN`.
36
+
37
+ Present a status table:
38
+
39
+ ```
40
+ ## Pre-flight Check: vX.Y
41
+
42
+ | Milestone | Title | Status | Complete? |
43
+ | --------- | ------------------------------ | ------- | --------- |
44
+ | M-01 | Context capture per milestone | KEPT | YES |
45
+ | M-02 | Milestone research pipeline | PENDING | NO |
46
+ ```
47
+
48
+ If any milestones are NOT complete, show a warning:
49
+
50
+ ```
51
+ Warning: [N] milestone(s) not yet complete:
52
+ - M-XX: [title] (PENDING)
53
+ - M-YY: [title] (BROKEN)
54
+
55
+ Options:
56
+ 1. Proceed anyway — mark version complete with known incomplete milestones
57
+ 2. Stop — complete remaining milestones first, then re-run
58
+ ```
59
+
60
+ If the user chooses to stop, end here.
61
+
62
+ If the user proceeds with incomplete milestones, note them as known gaps in Step 5.
63
+
64
+ If ALL milestones are complete, display:
65
+
66
+ ```
67
+ All [N] milestones complete. Proceeding with vX.Y completion.
68
+ ```
69
+
70
+ **Step 2: Gather stats from git log.**
71
+
72
+ ```bash
73
+ git log --oneline | wc -l
74
+ git log --oneline --since="$(git log --format='%ai' | tail -1)" | wc -l
75
+ git diff --stat HEAD~$(git log --oneline | wc -l | tr -d ' ')..HEAD 2>/dev/null | tail -1 || echo "stats unavailable"
76
+ git log --format="%ai" | tail -1
77
+ git log --format="%ai" | head -1
78
+ ```
79
+
80
+ If a previous git tag exists, calculate stats since that tag:
81
+
82
+ ```bash
83
+ # Check for existing tags
84
+ git tag --list "v*" | sort -V | tail -1
85
+
86
+ # If previous tag exists (e.g., v0.9), use it as the range start
87
+ PREV_TAG=$(git tag --list "v*" | sort -V | tail -1)
88
+ if [ -n "$PREV_TAG" ]; then
89
+ git log --oneline "$PREV_TAG"..HEAD | wc -l
90
+ git diff --stat "$PREV_TAG"..HEAD | tail -1
91
+ git log --format="%ai" "$PREV_TAG"..HEAD | tail -1
92
+ fi
93
+ ```
94
+
95
+ Present:
96
+
97
+ ```
98
+ ## Milestone Stats: vX.Y
99
+
100
+ - Milestones: [N] total ([N complete] complete, [N incomplete] incomplete)
101
+ - Commits since last tag: [N] commits
102
+ - Files changed: [M] files, [+N/-N] lines
103
+ - Timeline: [Start date] → [End date] ([N] days)
104
+ ```
105
+
106
+ **Step 3: Archive graph snapshot.**
107
+
108
+ Run the complete-milestone CJS command to snapshot the current graph state:
109
+
110
+ ```bash
111
+ node dist/declare-tools.cjs complete-milestone --version vX.Y
112
+ ```
113
+
114
+ Parse the JSON output.
115
+
116
+ If it contains an `error` field, display it and stop.
117
+
118
+ On success, display:
119
+
120
+ ```
121
+ ## Archive Complete
122
+
123
+ Snapshot saved to .planning/milestones/vX.Y/
124
+
125
+ Files archived:
126
+ - .planning/milestones/vX.Y/FUTURE.md
127
+ - .planning/milestones/vX.Y/MILESTONES.md
128
+ - .planning/milestones/vX.Y/M-XX-*/PLAN.md (for each milestone folder)
129
+ ```
130
+
131
+ **Step 4: Update PROJECT.md "Current State" section.**
132
+
133
+ Read `.planning/PROJECT.md`:
134
+
135
+ ```bash
136
+ cat .planning/PROJECT.md
137
+ ```
138
+
139
+ Locate or create a `## Current State` section. Update it to reflect the completed version:
140
+
141
+ ```markdown
142
+ ## Current State
143
+
144
+ **Version shipped:** vX.Y (YYYY-MM-DD)
145
+ **Milestones completed:** [N] ([M-01, M-02, ...])
146
+ **Known gaps:** [list incomplete milestones, or "None"]
147
+ **Next step:** Run /declare:new-milestone to start vX.Z cycle
148
+ ```
149
+
150
+ If the section already exists, update it in place. If it does not exist, append it after the last section.
151
+
152
+ Write the updated PROJECT.md back.
153
+
154
+ **Step 5: Create git tag.**
155
+
156
+ ```bash
157
+ git tag -a vX.Y -m "$(cat <<'TAGMSG'
158
+ Declare vX.Y
159
+
160
+ Milestones shipped:
161
+ - M-XX: [title]
162
+ - M-YY: [title]
163
+
164
+ [Brief one-line summary of what this version delivers]
165
+
166
+ See .planning/milestones/vX.Y/ for full graph snapshot.
167
+ TAGMSG
168
+ )"
169
+ ```
170
+
171
+ Confirm: "Tagged: vX.Y"
172
+
173
+ **Step 6: Commit archived files.**
174
+
175
+ Stage and commit all archive files and updated documents:
176
+
177
+ ```bash
178
+ git add .planning/milestones/vX.Y/ .planning/PROJECT.md
179
+ git commit -m "chore: archive vX.Y milestone snapshot
180
+
181
+ - Snapshot: .planning/milestones/vX.Y/
182
+ - PROJECT.md: updated Current State section
183
+ "
184
+ ```
185
+
186
+ **Step 7: Show completion summary.**
187
+
188
+ ```
189
+ ## vX.Y Complete
190
+
191
+ **Milestones shipped:** [N]
192
+ **Archive:** .planning/milestones/vX.Y/
193
+ **Git tag:** vX.Y
194
+ **PROJECT.md:** Updated
195
+
196
+ ---
197
+
198
+ Next: Start the next milestone cycle.
199
+
200
+ Run /declare:new-milestone
201
+ ```
202
+
203
+ **Error handling:**
204
+
205
+ - If `node dist/declare-tools.cjs load-graph` returns an error, suggest running `/declare:init` first.
206
+ - If `node dist/declare-tools.cjs complete-milestone` returns an error containing "already exists", ask the user if they want to delete the existing archive and retry.
207
+ - If git is not initialized, inform the user that git tagging requires `git init` and a prior commit.
208
+
209
+ **Key patterns:**
210
+
211
+ - Pre-flight check surfaces incomplete milestones before archiving — never silently proceed.
212
+ - Archive is a snapshot, not a destructive operation — FUTURE.md and MILESTONES.md remain in place.
213
+ - PROJECT.md is the persistent memory across versions — always update it.
214
+ - Git tag marks the historical release point for the snapshot.
215
+ - This command archives only — use /declare:new-milestone to reset for the next cycle.
@@ -0,0 +1,76 @@
1
+ ---
2
+ description: Open the interactive DAG dashboard in the browser (starts the server if needed)
3
+ allowed-tools:
4
+ - Bash
5
+ ---
6
+
7
+ Open the Declare interactive DAG dashboard — a live web UI showing declarations, milestones, and actions as a navigable graph.
8
+
9
+ **Step 1: Check if the server is already running.**
10
+
11
+ ```bash
12
+ curl -sf http://localhost:3847/api/graph -o /dev/null && echo "RUNNING" || echo "NOT_RUNNING"
13
+ ```
14
+
15
+ **Step 2: Start the server if it is not running.**
16
+
17
+ If the output from Step 1 is `NOT_RUNNING`:
18
+
19
+ Start the server in the background, capturing its PID:
20
+
21
+ ```bash
22
+ nohup node dist/declare-tools.cjs serve --port 3847 > /tmp/declare-dashboard.log 2>&1 &
23
+ echo $!
24
+ ```
25
+
26
+ Then wait briefly and confirm it started:
27
+
28
+ ```bash
29
+ sleep 1 && curl -sf http://localhost:3847/api/graph -o /dev/null && echo "STARTED" || echo "FAILED"
30
+ ```
31
+
32
+ If the result is `FAILED`, report the error and show the last lines of the log:
33
+
34
+ ```bash
35
+ tail -20 /tmp/declare-dashboard.log
36
+ ```
37
+
38
+ **Step 3: Open the dashboard in the browser.**
39
+
40
+ Detect the OS and open the URL:
41
+
42
+ ```bash
43
+ if [[ "$OSTYPE" == "darwin"* ]]; then
44
+ open http://localhost:3847
45
+ else
46
+ xdg-open http://localhost:3847 2>/dev/null || echo "Visit http://localhost:3847 in your browser"
47
+ fi
48
+ ```
49
+
50
+ **Step 4: Confirm to the user.**
51
+
52
+ Show the user:
53
+
54
+ ```
55
+ Dashboard running at http://localhost:3847
56
+
57
+ The graph auto-refreshes every 5 seconds.
58
+ Click any node to inspect its details.
59
+
60
+ Server log: /tmp/declare-dashboard.log
61
+ To stop: kill <PID>
62
+ ```
63
+
64
+ Where `<PID>` is the process ID captured in Step 2 (or a reminder to find it with `lsof -ti :3847`).
65
+
66
+ If the server was already running (Step 1 returned `RUNNING`), say "Server was already running."
67
+
68
+ **Step 5: Tail server output (optional).**
69
+
70
+ If `$ARGUMENTS` contains `--tail` or `--log`:
71
+
72
+ ```bash
73
+ tail -f /tmp/declare-dashboard.log
74
+ ```
75
+
76
+ Otherwise, skip this step.
@@ -1,7 +1,7 @@
1
1
  ---
2
- name: gsd:debug
2
+ name: declare:debug
3
3
  description: Systematic debugging with persistent state across context resets
4
- argument-hint: [issue description]
4
+ argument-hint: "[issue description]"
5
5
  allowed-tools:
6
6
  - Read
7
7
  - Bash
@@ -12,9 +12,9 @@ allowed-tools:
12
12
  <objective>
13
13
  Debug issues using scientific method with subagent isolation.
14
14
 
15
- **Orchestrator role:** Gather symptoms, spawn gsd-debugger agent, handle checkpoints, spawn continuations.
15
+ **Orchestrator role:** Gather symptoms, spawn declare-debugger agent, handle checkpoints, spawn continuations.
16
16
 
17
- **Why subagent:** Investigation burns context fast (reading files, forming hypotheses, testing). Fresh 200k context per investigation. Main context stays lean for user interaction.
17
+ **Why subagent:** Investigation burns context fast (reading files, forming hypotheses, testing). Fresh context per investigation. Main context stays lean for user interaction.
18
18
  </objective>
19
19
 
20
20
  <context>
@@ -31,12 +31,12 @@ ls .planning/debug/*.md 2>/dev/null | grep -v resolved | head -5
31
31
  ## 0. Initialize Context
32
32
 
33
33
  ```bash
34
- INIT=$(node ~/.claude/get-shit-done/bin/gsd-tools.cjs state load)
34
+ INIT=$(node dist/declare-tools.cjs get-state)
35
35
  ```
36
36
 
37
37
  Extract `commit_docs` from init JSON. Resolve debugger model:
38
38
  ```bash
39
- DEBUGGER_MODEL=$(node ~/.claude/get-shit-done/bin/gsd-tools.cjs resolve-model gsd-debugger --raw)
39
+ DEBUGGER_MODEL=$(node dist/declare-tools.cjs config-get debugger_model 2>/dev/null || echo "claude-opus-4-5")
40
40
  ```
41
41
 
42
42
  ## 1. Check Active Sessions
@@ -60,7 +60,7 @@ Use AskUserQuestion for each:
60
60
 
61
61
  After all gathered, confirm ready to investigate.
62
62
 
63
- ## 3. Spawn gsd-debugger Agent
63
+ ## 3. Spawn declare-debugger Agent
64
64
 
65
65
  Fill prompt and spawn:
66
66
 
@@ -92,7 +92,7 @@ Create: .planning/debug/{slug}.md
92
92
  ```
93
93
  Task(
94
94
  prompt=filled_prompt,
95
- subagent_type="gsd-debugger",
95
+ subagent_type="declare-debugger",
96
96
  model="{debugger_model}",
97
97
  description="Debug {slug}"
98
98
  )
@@ -104,7 +104,7 @@ Task(
104
104
  - Display root cause and evidence summary
105
105
  - Offer options:
106
106
  - "Fix now" - spawn fix subagent
107
- - "Plan fix" - suggest /gsd:plan-phase --gaps
107
+ - "Plan fix" - suggest `/declare:plan` to address root cause
108
108
  - "Manual fix" - done
109
109
 
110
110
  **If `## CHECKPOINT REACHED`:**
@@ -145,7 +145,7 @@ goal: find_and_fix
145
145
  ```
146
146
  Task(
147
147
  prompt=continuation_prompt,
148
- subagent_type="gsd-debugger",
148
+ subagent_type="declare-debugger",
149
149
  model="{debugger_model}",
150
150
  description="Continue debug {slug}"
151
151
  )
@@ -156,7 +156,7 @@ Task(
156
156
  <success_criteria>
157
157
  - [ ] Active sessions checked
158
158
  - [ ] Symptoms gathered (if new)
159
- - [ ] gsd-debugger spawned with context
159
+ - [ ] declare-debugger spawned with context
160
160
  - [ ] Checkpoints handled correctly
161
161
  - [ ] Root cause confirmed before fixing
162
162
  </success_criteria>
@@ -0,0 +1,65 @@
1
+ ---
2
+ description: Gather milestone context through adaptive questioning before execution
3
+ allowed-tools:
4
+ - Read
5
+ - Write
6
+ - Bash
7
+ - Glob
8
+ - Grep
9
+ - AskUserQuestion
10
+ - Task
11
+ argument-hint: "<M-XX> [--auto]"
12
+ ---
13
+
14
+ Extract implementation decisions that downstream agents need — the planner and executor will use CONTEXT.md to know what choices are locked.
15
+
16
+ **How it works:**
17
+ 1. Analyze the milestone to identify gray areas (behavior, output, flow, etc.)
18
+ 2. Present gray areas — user selects which to discuss
19
+ 3. Deep-dive each selected area until satisfied
20
+ 4. Create CONTEXT.md with decisions that guide planning and execution
21
+
22
+ **Output:** `CONTEXT.md` in the milestone folder — decisions clear enough that downstream agents can act without asking the user again.
23
+
24
+ **Step 1: Load the graph.**
25
+
26
+ ```bash
27
+ node dist/declare-tools.cjs load-graph
28
+ ```
29
+
30
+ Parse the JSON output. If it contains an `error` field, tell the user to run `/declare:init` first and stop.
31
+
32
+ Extract milestone data. Identify the milestone matching `$ARGUMENTS` (e.g., `M-01`). If no milestone ID is provided, tell the user to provide one (e.g., `/declare:discuss M-01`) and stop.
33
+
34
+ If the milestone ID is not found in the graph, tell the user and stop:
35
+ ```
36
+ Milestone [M-XX] not found.
37
+
38
+ Use /declare:status to see available milestones.
39
+ ```
40
+
41
+ **Step 2: Follow the discuss workflow.**
42
+
43
+ Read and follow all steps in:
44
+
45
+ @workflows/discuss.md
46
+
47
+ Pass the loaded graph state and milestone data into the workflow.
48
+
49
+ The milestone directory is: `.planning/milestones/[M-XX]-[slug]/`
50
+
51
+ CONTEXT.md is written to: `.planning/milestones/[M-XX]-[slug]/CONTEXT.md`
52
+
53
+ **Step 3: Commit context.**
54
+
55
+ After CONTEXT.md is written, commit it:
56
+
57
+ ```bash
58
+ node dist/declare-tools.cjs commit "docs(M-XX): capture milestone context" --files ".planning/milestones/[M-XX]-[slug]/CONTEXT.md"
59
+ ```
60
+
61
+ Replace `M-XX` and `[M-XX]-[slug]` with the actual milestone ID and slug.
62
+
63
+ **Step 4: Handle auto-advance.**
64
+
65
+ Check for `--auto` in `$ARGUMENTS` and follow the auto-advance step in the workflow.
@@ -0,0 +1,92 @@
1
+ ---
2
+ description: Diagnose .planning/ directory health and optionally repair issues
3
+ argument-hint: [--repair]
4
+ allowed-tools:
5
+ - Read
6
+ - Bash
7
+ - Write
8
+ ---
9
+
10
+ Validate `.planning/` directory integrity and report actionable issues.
11
+
12
+ **Step 1: Parse arguments.**
13
+
14
+ Check `$ARGUMENTS` for the `--repair` flag.
15
+
16
+ **Step 2: Run health check.**
17
+
18
+ If `--repair` was passed:
19
+
20
+ ```bash
21
+ node dist/declare-tools.cjs health-check --repair
22
+ ```
23
+
24
+ Otherwise:
25
+
26
+ ```bash
27
+ node dist/declare-tools.cjs health-check
28
+ ```
29
+
30
+ Parse the JSON output. It contains:
31
+ - `healthy`: boolean — whether all checks passed
32
+ - `issues`: array of `{ type, message, path, fixable }` objects
33
+ - `repaired`: array of strings describing what was fixed (only present when `--repair` was used)
34
+
35
+ **Step 3: Display results.**
36
+
37
+ **If healthy (no issues):**
38
+
39
+ ```
40
+ .planning/ health: OK
41
+
42
+ All checks passed:
43
+ FUTURE.md — exists and parseable
44
+ MILESTONES.md — exists and parseable
45
+ config.json — exists and parseable
46
+ Milestone folders — all referenced milestones have folders
47
+ Orphan check — no orphaned milestone folders
48
+ ```
49
+
50
+ **If there are issues:**
51
+
52
+ Show a header with the count:
53
+
54
+ ```
55
+ .planning/ health: [N] issue(s) found
56
+ ```
57
+
58
+ Then list each issue clearly:
59
+
60
+ ```
61
+ [type indicator] [message]
62
+ Path: [path]
63
+ Fixable: yes / no
64
+ ```
65
+
66
+ Use these type indicators:
67
+ - `missing_file` → "MISSING"
68
+ - `parse_error` → "PARSE ERROR"
69
+ - `missing_folder` → "MISSING FOLDER"
70
+ - `orphaned_folder` → "ORPHAN"
71
+
72
+ **If `--repair` was used and repairs were made:**
73
+
74
+ ```
75
+ Repaired [N] issue(s):
76
+ - [repair description]
77
+ ...
78
+
79
+ Remaining issues: [N] (require manual intervention)
80
+ ```
81
+
82
+ **Step 4: Suggest next steps.**
83
+
84
+ If there are unfixable issues, suggest:
85
+ - Missing FUTURE.md or MILESTONES.md: "Run `/declare:init` to recreate missing files"
86
+ - Parse errors: "Manually inspect and fix the file at [path]"
87
+ - Orphaned folders: "Remove or reconnect the folder: [path]"
88
+
89
+ If there are fixable issues and `--repair` was NOT passed:
90
+ ```
91
+ Run `/declare:health --repair` to automatically fix [N] fixable issue(s).
92
+ ```