declare-cc 1.0.8 → 2.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.
Files changed (75) hide show
  1. package/README.md +153 -187
  2. package/dist/client/assets/index-BVuhr02G.css +1 -0
  3. package/dist/client/assets/index-DujGXAYw.js +9 -0
  4. package/dist/client/index.html +23 -0
  5. package/dist/index.js +17459 -0
  6. package/package.json +38 -45
  7. package/src/agents/prompts/00-research.md +90 -0
  8. package/src/agents/prompts/01-vision.md +38 -0
  9. package/src/agents/prompts/02-declarations.md +47 -0
  10. package/src/agents/prompts/03-milestones.md +43 -0
  11. package/src/agents/prompts/04-actions.md +90 -0
  12. package/src/agents/prompts/05-execution.md +63 -0
  13. package/src/agents/prompts/06-verification.md +104 -0
  14. package/LICENSE +0 -21
  15. package/agents/declare-codebase-mapper.md +0 -761
  16. package/agents/declare-debugger.md +0 -1198
  17. package/agents/declare-executor.md +0 -353
  18. package/agents/declare-integration-checker.md +0 -440
  19. package/agents/declare-plan-checker.md +0 -608
  20. package/agents/declare-planner.md +0 -1015
  21. package/agents/declare-research-synthesizer.md +0 -309
  22. package/agents/declare-researcher.md +0 -484
  23. package/agents/declare-roadmapper.md +0 -639
  24. package/agents/declare-verifier.md +0 -555
  25. package/bin/declare.js +0 -16
  26. package/bin/install.js +0 -1907
  27. package/commands/declare/actions.md +0 -113
  28. package/commands/declare/add-todo.md +0 -41
  29. package/commands/declare/audit.md +0 -76
  30. package/commands/declare/check-todos.md +0 -125
  31. package/commands/declare/complete-milestone.md +0 -215
  32. package/commands/declare/dashboard.md +0 -65
  33. package/commands/declare/debug.md +0 -162
  34. package/commands/declare/discuss.md +0 -65
  35. package/commands/declare/execute.md +0 -521
  36. package/commands/declare/future.md +0 -72
  37. package/commands/declare/health.md +0 -92
  38. package/commands/declare/help.md +0 -31
  39. package/commands/declare/init.md +0 -39
  40. package/commands/declare/map-codebase.md +0 -149
  41. package/commands/declare/milestones.md +0 -98
  42. package/commands/declare/new-cycle.md +0 -172
  43. package/commands/declare/new-project.md +0 -565
  44. package/commands/declare/pause.md +0 -138
  45. package/commands/declare/plan.md +0 -320
  46. package/commands/declare/prioritize.md +0 -65
  47. package/commands/declare/progress.md +0 -116
  48. package/commands/declare/quick.md +0 -119
  49. package/commands/declare/reapply-patches.md +0 -178
  50. package/commands/declare/research.md +0 -267
  51. package/commands/declare/resume.md +0 -146
  52. package/commands/declare/set-profile.md +0 -66
  53. package/commands/declare/settings.md +0 -119
  54. package/commands/declare/status.md +0 -65
  55. package/commands/declare/trace.md +0 -81
  56. package/commands/declare/update.md +0 -251
  57. package/commands/declare/verify.md +0 -65
  58. package/commands/declare/visualize.md +0 -74
  59. package/dist/declare-tools.cjs +0 -9439
  60. package/dist/public/app.js +0 -8331
  61. package/dist/public/index.html +0 -3939
  62. package/hooks/declare-activity.js +0 -106
  63. package/hooks/declare-check-update.js +0 -62
  64. package/hooks/declare-server.js +0 -116
  65. package/hooks/declare-statusline.js +0 -91
  66. package/scripts/build-hooks.js +0 -42
  67. package/scripts/release.js +0 -50
  68. package/templates/future.md +0 -4
  69. package/templates/milestones.md +0 -11
  70. package/workflows/actions.md +0 -89
  71. package/workflows/discuss.md +0 -476
  72. package/workflows/future.md +0 -185
  73. package/workflows/milestones.md +0 -87
  74. package/workflows/scope.md +0 -94
  75. package/workflows/verify.md +0 -504
@@ -1,119 +0,0 @@
1
- ---
2
- description: Configure Declare workflow settings interactively
3
- allowed-tools:
4
- - Read
5
- - Bash
6
- - AskUserQuestion
7
- ---
8
-
9
- Interactive configuration of Declare workflow settings and model profile.
10
-
11
- **Step 1: Read current config.**
12
-
13
- ```bash
14
- node dist/declare-tools.cjs config-get model_profile
15
- ```
16
-
17
- ```bash
18
- node dist/declare-tools.cjs config-get workflow.research
19
- ```
20
-
21
- ```bash
22
- node dist/declare-tools.cjs config-get workflow.plan_check
23
- ```
24
-
25
- ```bash
26
- node dist/declare-tools.cjs config-get workflow.auto_advance
27
- ```
28
-
29
- Extract current values (use defaults if key not found: model_profile="quality", research=true, plan_check=true, auto_advance=false).
30
-
31
- **Step 2: Ask the 5 configuration questions in sequence using AskUserQuestion.**
32
-
33
- For each question, show the current value so the user knows what's selected now. Accept Enter to keep the current value.
34
-
35
- **Question 1: Model profile**
36
-
37
- ```
38
- Which model profile should Declare agents use?
39
-
40
- 1. quality — claude-opus-4-5 for all agents (highest quality, most spend)
41
- 2. balanced — claude-sonnet-4-5 for execution, opus-4-5 for planning (recommended)
42
- 3. budget — claude-haiku-3-5 for execution, sonnet-4-5 for planning (low spend)
43
-
44
- Current: [current value]
45
- Enter 1, 2, or 3 (or press Enter to keep current):
46
- ```
47
-
48
- **Question 2: Research phase**
49
-
50
- ```
51
- Enable research phase before milestone planning?
52
- Research gives agents web context but takes extra time.
53
-
54
- Current: [true/false]
55
- Enter yes/no (or press Enter to keep current):
56
- ```
57
-
58
- **Question 3: Plan check**
59
-
60
- ```
61
- Enable plan-checker review loop after planning?
62
- Plan-checker validates plans before execution starts.
63
-
64
- Current: [true/false]
65
- Enter yes/no (or press Enter to keep current):
66
- ```
67
-
68
- **Question 4: Auto-advance**
69
-
70
- ```
71
- Enable auto-advance mode?
72
- In auto mode, checkpoints are skipped and agents continue without pausing for human verification.
73
- Only enable if you trust the agents to proceed without review.
74
-
75
- Current: [true/false]
76
- Enter yes/no (or press Enter to keep current):
77
- ```
78
-
79
- **Step 3: Parse answers and persist each changed setting.**
80
-
81
- Map answers to values:
82
- - Profile "1" → "quality", "2" → "balanced", "3" → "budget". Empty input → keep current.
83
- - "yes"/"y" → true, "no"/"n" → false. Empty input → keep current.
84
-
85
- For each setting that changed, run config-set:
86
-
87
- ```bash
88
- node dist/declare-tools.cjs config-set --key model_profile --value <profile>
89
- ```
90
-
91
- ```bash
92
- node dist/declare-tools.cjs config-set --key workflow.research --value <true|false>
93
- ```
94
-
95
- ```bash
96
- node dist/declare-tools.cjs config-set --key workflow.plan_check --value <true|false>
97
- ```
98
-
99
- ```bash
100
- node dist/declare-tools.cjs config-set --key workflow.auto_advance --value <true|false>
101
- ```
102
-
103
- **Step 4: Display confirmation.**
104
-
105
- Show a summary table of the final configuration:
106
-
107
- ```
108
- Declare settings saved.
109
-
110
- Model profile : [profile]
111
- Research : [enabled/disabled]
112
- Plan check : [enabled/disabled]
113
- Auto-advance : [enabled/disabled]
114
-
115
- Quick commands:
116
- /declare:set-profile quality|balanced|budget — switch profile
117
- /declare:health — check project health
118
- /declare:settings — open this menu
119
- ```
@@ -1,65 +0,0 @@
1
- ---
2
- description: Show graph state, layer counts, health indicators, and last activity
3
- allowed-tools:
4
- - Read
5
- - Bash
6
- - Grep
7
- - Glob
8
- ---
9
-
10
- Show the current state of the Declare project graph.
11
-
12
- **Step 1: Run the status tool.**
13
-
14
- ```bash
15
- node dist/declare-tools.cjs status
16
- ```
17
-
18
- Parse the JSON output.
19
-
20
- **Step 2: Handle errors.**
21
-
22
- If the output contains an `error` field (e.g., "No Declare project found"), display the error and suggest running `/declare:init`.
23
-
24
- **Step 3: Format the status display.**
25
-
26
- Render a rich visual summary with these sections:
27
-
28
- **Project header:** Display the project name prominently.
29
-
30
- **Graph Stats:** Show counts in a compact format:
31
- - Declarations: N
32
- - Milestones: N
33
- - Actions: N
34
- - Edges: N
35
-
36
- **Status Distribution:** Show the breakdown by status (PENDING/ACTIVE/DONE) as a visual bar or counts.
37
-
38
- **Validation Health:**
39
- - If `health` is "healthy": show a pass indicator
40
- - If `health` is "warnings": show warnings with the validation error list
41
- - If `health` is "errors": show errors with the validation error list and actionable suggestions for each
42
-
43
- For each validation error, provide a brief suggestion:
44
- - `orphan`: "Connect this node to a parent with an edge"
45
- - `cycle`: "Check for circular dependencies in your graph"
46
- - `broken_edge`: "The target node may have been removed -- update or remove the edge"
47
-
48
- **Last Activity:** Show the timestamp and commit message from the last git activity.
49
-
50
- **Performance:** If the status output contains a `performance` field (non-null):
51
-
52
- Show the project rollup first:
53
- "Performance: [rollup.performance] (alignment: [rollup.alignment] x integrity: [rollup.integrity])"
54
-
55
- Then show per-declaration breakdown:
56
-
57
- | Declaration | Alignment | Integrity | Performance |
58
- |-------------|-----------|-----------|-------------|
59
- | D-XX: [title] | HIGH | MEDIUM | MEDIUM |
60
-
61
- If `performance` is null, skip this section entirely (graceful degradation for projects with no declarations).
62
-
63
- Keep the "Performance: HIGH (alignment: HIGH x integrity: HIGH)" plain text label format -- qualitative labels only, never numeric scores.
64
-
65
- The overall feel should be like a dashboard -- compact, scannable, with clear health indicators.
@@ -1,81 +0,0 @@
1
- ---
2
- description: Trace a node's why-chain upward through the DAG to its source declarations
3
- allowed-tools:
4
- - Read
5
- - Bash
6
- - Grep
7
- - Glob
8
- ---
9
-
10
- Trace why a node exists by following its upward causation chain through the Declare DAG.
11
-
12
- **Step 1: Determine the node to trace.**
13
-
14
- If `$ARGUMENTS` contains a node ID (matching pattern `A-XX`, `M-XX`, or `D-XX`):
15
- - Use that ID directly. Proceed to Step 2.
16
-
17
- If `$ARGUMENTS` contains `--output <path>`, note the output path but still look for a node ID in the remaining arguments.
18
-
19
- If `$ARGUMENTS` is empty or contains no node ID (interactive mode):
20
- - Run the tool without arguments to get available nodes:
21
-
22
- ```bash
23
- node dist/declare-tools.cjs trace
24
- ```
25
-
26
- - Parse the JSON output. It contains a `nodes` object with `declarations`, `milestones`, and `actions` arrays.
27
- - Present a numbered list grouped by type:
28
-
29
- **Declarations:**
30
- 1. D-01: [title] [STATUS]
31
- 2. D-02: [title] [STATUS]
32
-
33
- **Milestones:**
34
- 3. M-01: [title] [STATUS]
35
- ...
36
-
37
- **Actions:**
38
- N. A-01: [title] [STATUS]
39
- ...
40
-
41
- - Ask the user: "Which node would you like to trace? Provide the ID (e.g., A-01)."
42
- - Wait for the user's response, then use their provided ID in Step 2.
43
-
44
- **Step 2: Run the trace.**
45
-
46
- Build the command:
47
-
48
- ```bash
49
- node dist/declare-tools.cjs trace <node-id>
50
- ```
51
-
52
- If `--output <path>` was provided in `$ARGUMENTS`, append it:
53
-
54
- ```bash
55
- node dist/declare-tools.cjs trace <node-id> --output <path>
56
- ```
57
-
58
- Run the command and parse the JSON output.
59
-
60
- **Step 3: Handle errors.**
61
-
62
- If the output contains an `error` field:
63
- - Display the error message.
64
- - If the error mentions "not found", suggest running `/declare:trace` without arguments to see available nodes.
65
- - If the error mentions "No Declare project", suggest running `/declare:init`.
66
-
67
- **Step 4: Display the trace.**
68
-
69
- Use the `formatted` field from the JSON output as the primary display. It contains a pre-rendered tree with Unicode connectors showing the why-chain from the traced node upward to its source declarations.
70
-
71
- Display it in a code block for proper formatting:
72
-
73
- ```
74
- [contents of formatted field]
75
- ```
76
-
77
- Below the tree, add context:
78
- - "Traced **N** path(s) from **[node-id]** to source declarations."
79
- - If `truncated` is true: "Showing 20 of [totalPaths] paths. Use --output to capture all paths."
80
-
81
- If `outputFile` is present in the result, inform the user: "Output written to [path]."
@@ -1,251 +0,0 @@
1
- ---
2
- description: Update declare-cc to the latest npm version with local-patch preservation
3
- allowed-tools:
4
- - Read
5
- - Write
6
- - Bash
7
- - Glob
8
- - Grep
9
- - AskUserQuestion
10
- ---
11
-
12
- <purpose>
13
- Check whether a newer version of declare-cc is available on npm, show the version diff, back up any locally-modified files before the update runs, execute the install, reapply patches, and confirm the result.
14
- </purpose>
15
-
16
- <process>
17
-
18
- ## Step 1: Get the installed version
19
-
20
- Run the declare-tools help command and parse the version field from its JSON output:
21
-
22
- ```bash
23
- node dist/declare-tools.cjs help
24
- ```
25
-
26
- Parse the JSON. The version is in the `version` field.
27
-
28
- If the command fails or returns no version:
29
- ```
30
- Could not read installed version.
31
- Make sure you are running this command from the declare-cc project root (the directory containing dist/declare-tools.cjs).
32
- ```
33
- Exit.
34
-
35
- Store as `INSTALLED_VERSION`.
36
-
37
- ## Step 2: Check the latest npm version
38
-
39
- ```bash
40
- npm view declare-cc version 2>/dev/null
41
- ```
42
-
43
- If the command fails or returns empty output:
44
- ```
45
- Could not check for updates (offline or npm unavailable).
46
-
47
- To update manually: npx declare-cc@latest
48
- ```
49
- Exit.
50
-
51
- Store as `LATEST_VERSION`.
52
-
53
- ## Step 3: Compare versions
54
-
55
- Parse both as semver (split on `.`, compare major/minor/patch numerically).
56
-
57
- **If installed == latest:**
58
- ```
59
- declare-cc is up to date (v{INSTALLED_VERSION})
60
- ```
61
- Exit.
62
-
63
- **If installed > latest:**
64
- ```
65
- ## Declare Update
66
-
67
- **Installed:** v{INSTALLED_VERSION}
68
- **Latest:** v{LATEST_VERSION}
69
-
70
- You are ahead of the latest npm release (development build?). No update needed.
71
- ```
72
- Exit.
73
-
74
- **If installed < latest:** proceed to Step 4.
75
-
76
- ## Step 4: Show version diff and confirm
77
-
78
- Display the pending update:
79
-
80
- ```
81
- ## Declare Update Available
82
-
83
- **Installed:** v{INSTALLED_VERSION}
84
- **Latest:** v{LATEST_VERSION}
85
- ```
86
-
87
- Use AskUserQuestion:
88
- - Question: "Update to v{LATEST_VERSION}?"
89
- - Options:
90
- - "Yes, update now"
91
- - "No, cancel"
92
-
93
- If the user cancels: exit.
94
-
95
- ## Step 5: Scan for local modifications
96
-
97
- Before updating, check whether any files inside `.claude/commands/declare/` differ from what the package originally installed.
98
-
99
- **5a. Locate the baseline manifest.**
100
-
101
- The installer writes a manifest at install time. Check for it:
102
-
103
- ```bash
104
- # repo-relative path
105
- cat .claude/commands/declare/.install-manifest.json 2>/dev/null
106
- ```
107
-
108
- If the manifest exists, parse it. It contains an array of `{ path, hash }` entries where `hash` is the SHA-256 of the file at install time.
109
-
110
- If the manifest does not exist, skip the diff scan and proceed directly to Step 6 with a note:
111
- ```
112
- No install manifest found — skipping local-modification scan.
113
- (Patches will not be backed up automatically.)
114
- ```
115
-
116
- **5b. Hash each tracked file and compare.**
117
-
118
- For each entry in the manifest:
119
-
120
- ```bash
121
- # compute current hash
122
- shasum -a 256 ".claude/commands/declare/{entry.path}" 2>/dev/null | awk '{print $1}'
123
- ```
124
-
125
- If the current hash differs from the manifest hash, the file has been locally modified.
126
-
127
- **5c. If modifications found, back them up.**
128
-
129
- Create the backup directory (repo-relative):
130
-
131
- ```bash
132
- mkdir -p .planning/declare-local-patches
133
- ```
134
-
135
- Write a backup metadata file `.planning/declare-local-patches/backup-meta.json`:
136
-
137
- ```json
138
- {
139
- "from_version": "{INSTALLED_VERSION}",
140
- "backup_date": "{ISO timestamp}",
141
- "files": [
142
- { "path": ".claude/commands/declare/{file}", "backup_name": "{safe-filename}" }
143
- ]
144
- }
145
- ```
146
-
147
- Copy each modified file:
148
-
149
- ```bash
150
- cp ".claude/commands/declare/{file}" ".planning/declare-local-patches/{safe-filename}"
151
- ```
152
-
153
- Display a summary:
154
-
155
- ```
156
- ## Local Modifications Detected
157
-
158
- The following files differ from the original installation and have been backed up:
159
-
160
- | File | Backup |
161
- |------|--------|
162
- | .claude/commands/declare/{file} | .planning/declare-local-patches/{safe-filename} |
163
-
164
- These will be reapplied automatically after the update.
165
- Run /declare:reapply-patches manually at any time to review or re-merge them.
166
- ```
167
-
168
- **5d. If no modifications found:**
169
- ```
170
- No local modifications detected. Proceeding with clean update.
171
- ```
172
-
173
- ## Step 6: Run the update
174
-
175
- ```bash
176
- npx declare-cc@latest
177
- ```
178
-
179
- Capture stdout and stderr. If the command exits non-zero:
180
- ```
181
- ## Update Failed
182
-
183
- The installer returned an error:
184
-
185
- {stderr}
186
-
187
- You can retry manually: npx declare-cc@latest
188
- Your patch backups (if any) are preserved in .planning/declare-local-patches/
189
- ```
190
- Exit.
191
-
192
- ## Step 7: Reapply patches (if any were backed up)
193
-
194
- If patches were backed up in Step 5, reapply them automatically.
195
-
196
- Read `.planning/declare-local-patches/backup-meta.json`.
197
-
198
- For each backed-up file:
199
-
200
- 1. Read the backed-up (user's modified) version from `.planning/declare-local-patches/{safe-filename}`.
201
- 2. Read the newly installed version from `.claude/commands/declare/{file}`.
202
- 3. If the files are identical (the upstream incorporated the change): report `Skipped (already upstream)` and continue.
203
- 4. If the files differ: apply the user's version directly over the newly installed file.
204
- - Write the backed-up content to `.claude/commands/declare/{file}`.
205
- - Report `Reapplied`.
206
-
207
- Display result table:
208
-
209
- ```
210
- ## Patches Reapplied
211
-
212
- | File | Result |
213
- |------|--------|
214
- | .claude/commands/declare/{file} | Reapplied |
215
- | .claude/commands/declare/{file} | Skipped (already upstream) |
216
- ```
217
-
218
- If any reapplied file differs significantly from the new upstream version (the file changed in a way that may conflict), display:
219
- ```
220
- Note: {file} was reapplied from your backup but the upstream also changed this file.
221
- Run /declare:reapply-patches to review the diff and resolve conflicts manually.
222
- ```
223
-
224
- ## Step 8: Confirm completion
225
-
226
- ```
227
- ## Declare Updated
228
-
229
- v{INSTALLED_VERSION} -> v{LATEST_VERSION}
230
-
231
- Restart Claude Code to pick up the new commands.
232
- ```
233
-
234
- If patches were reapplied:
235
- ```
236
- Your local modifications have been reapplied. Run /declare:reapply-patches to verify or adjust.
237
- ```
238
-
239
- </process>
240
-
241
- <success_criteria>
242
- - [ ] Installed version read from node dist/declare-tools.cjs help
243
- - [ ] Latest version checked via npm view declare-cc version
244
- - [ ] No-op if already up to date
245
- - [ ] Version diff shown and user confirms before proceeding
246
- - [ ] Local modifications scanned against install manifest
247
- - [ ] Modified files backed up to .planning/declare-local-patches/
248
- - [ ] Update run via npx declare-cc@latest
249
- - [ ] Patches reapplied after update
250
- - [ ] Completion confirmed with restart reminder
251
- </success_criteria>
@@ -1,65 +0,0 @@
1
- ---
2
- name: declare:verify
3
- description: Validate milestone deliverables through conversational UAT. When issues found, diagnoses root causes and creates fix plans.
4
- argument-hint: "[milestone ID, e.g., 'M-08']"
5
- allowed-tools:
6
- - Read
7
- - Bash
8
- - Glob
9
- - Grep
10
- - Edit
11
- - Write
12
- - Task
13
- ---
14
- <objective>
15
- Validate milestone deliverables through conversational testing with persistent state.
16
-
17
- Purpose: Confirm what was built actually works from user's perspective. One test at a time, plain text responses, no interrogation. When issues are found, automatically diagnose root causes (spawn parallel declare-debugger agents) and create fix action plans.
18
-
19
- Output: {milestone_id}-UAT.md in milestone folder tracking all test results. If issues found: diagnosed gaps with root causes, verified fix action plans ready for `/declare:execute M-{id} --gaps-only`.
20
- </objective>
21
-
22
- <execution_context>
23
- @workflows/verify.md
24
- </execution_context>
25
-
26
- <context>
27
- Milestone: $ARGUMENTS (optional)
28
- - If provided: Test specific milestone (e.g., "M-08")
29
- - If not provided: Check for active sessions or prompt for milestone ID
30
-
31
- @.planning/STATE.md
32
- </context>
33
-
34
- <process>
35
- Execute the verify workflow from @workflows/verify.md end-to-end.
36
- Preserve all workflow gates: session management, test presentation, diagnosis, fix planning, routing.
37
-
38
- **Loading milestone plans:**
39
- ```bash
40
- # List PLAN.md files in milestone directory
41
- MILESTONE_DIR=$(echo "$ARGUMENTS" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
42
- ls ".planning/milestones/${MILESTONE_DIR}/"*-PLAN.md 2>/dev/null
43
- ```
44
-
45
- **Writing UAT results:**
46
- ```bash
47
- node dist/declare-tools.cjs commit "test(${MILESTONE_ID}): complete UAT - ${PASSED} passed, ${ISSUES} issues" \
48
- --files ".planning/milestones/${MILESTONE_DIR}/${MILESTONE_ID}-UAT.md"
49
- ```
50
-
51
- **On gaps found — spawn parallel declare-debugger agents (one per gap):**
52
-
53
- For each gap in the UAT Gaps section, spawn a declare-debugger agent with:
54
- - `model: "opus"`
55
- - `symptoms_prefilled: true` (skip symptom gathering)
56
- - `goal: find_root_cause_only` (diagnose but don't fix)
57
- - Pre-filled symptoms from the gap's test_id, expected, and actual fields
58
-
59
- Collect all ROOT CAUSE FOUND responses, update UAT.md with root_cause for each gap.
60
-
61
- **After diagnosis — create fix action plans:**
62
-
63
- Review diagnosed gaps and create fix action plans targeting each root cause.
64
- Plans should be concrete, executable steps referencing specific files to change.
65
- </process>
@@ -1,74 +0,0 @@
1
- ---
2
- description: Visualize the Declare DAG as a top-down ASCII tree with status markers
3
- allowed-tools:
4
- - Read
5
- - Bash
6
- - Grep
7
- - Glob
8
- - Write
9
- ---
10
-
11
- Render the Declare DAG as a top-down tree showing declarations, milestones, and actions with their status.
12
-
13
- **Step 1: Build the command.**
14
-
15
- Start with the base command:
16
-
17
- ```bash
18
- node dist/declare-tools.cjs visualize
19
- ```
20
-
21
- If `$ARGUMENTS` contains a scope ID (matching pattern `D-XX` or `M-XX`):
22
- - Append it to scope the visualization to that subtree:
23
-
24
- ```bash
25
- node dist/declare-tools.cjs visualize <scope-id>
26
- ```
27
-
28
- If `$ARGUMENTS` contains `--output <path>`:
29
- - Append it to write the tree to a file:
30
-
31
- ```bash
32
- node dist/declare-tools.cjs visualize --output <path>
33
- ```
34
-
35
- Both scope and output can be combined:
36
-
37
- ```bash
38
- node dist/declare-tools.cjs visualize <scope-id> --output <path>
39
- ```
40
-
41
- **Step 2: Run the command and parse JSON output.**
42
-
43
- **Step 3: Handle errors.**
44
-
45
- If the output contains an `error` field:
46
- - Display the error message.
47
- - If "not found", suggest valid IDs by running `/declare:status` to see available nodes.
48
- - If "No Declare project", suggest running `/declare:init`.
49
-
50
- **Step 4: Display the tree.**
51
-
52
- Use the `formatted` field from the JSON output directly. It contains the pre-rendered ASCII tree with Unicode box-drawing connectors and status markers.
53
-
54
- Display it in a code block for proper alignment:
55
-
56
- ```
57
- [contents of formatted field]
58
- ```
59
-
60
- **Status marker legend:**
61
- - `[checkmark]` = DONE
62
- - `[>]` = ACTIVE
63
- - `[circle]` = PENDING
64
- - `[!]` = BLOCKED (has non-done children)
65
-
66
- **Step 5: Show stats.**
67
-
68
- Below the tree, display: "**N** declarations, **N** milestones, **N** actions"
69
-
70
- Using the `stats` object from the JSON output.
71
-
72
- If scope was used, note: "Scoped to subtree of **[scope-id]**."
73
-
74
- If `outputFile` is present in the result, inform the user: "Output written to [path]."