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,251 @@
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>
@@ -0,0 +1,64 @@
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
+ - `symptoms_prefilled: true` (skip symptom gathering)
55
+ - `goal: find_root_cause_only` (diagnose but don't fix)
56
+ - Pre-filled symptoms from the gap's test_id, expected, and actual fields
57
+
58
+ Collect all ROOT CAUSE FOUND responses, update UAT.md with root_cause for each gap.
59
+
60
+ **After diagnosis — create fix action plans:**
61
+
62
+ Review diagnosed gaps and create fix action plans targeting each root cause.
63
+ Plans should be concrete, executable steps referencing specific files to change.
64
+ </process>