specdacular 0.10.0 → 0.11.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 (60) hide show
  1. package/README.md +3 -3
  2. package/bin/install.js +3 -1
  3. package/bin/specd.js +135 -0
  4. package/commands/specd.best-practices.md +75 -0
  5. package/commands/specd.docs.md +81 -0
  6. package/commands/specd.docs.review.md +80 -0
  7. package/commands/specd.generate-skills.learn.md +65 -0
  8. package/commands/specd.new-project.md +58 -0
  9. package/commands/specd.new-runner-task.md +52 -0
  10. package/commands/specd.new.md +6 -6
  11. package/commands/specd.runner-status.md +27 -0
  12. package/package.json +6 -2
  13. package/runner/main/agent/parser.js +39 -0
  14. package/runner/main/agent/runner.js +137 -0
  15. package/runner/main/agent/template.js +16 -0
  16. package/runner/main/bootstrap.js +69 -0
  17. package/runner/main/db.js +45 -0
  18. package/runner/main/index.js +103 -0
  19. package/runner/main/ipc.js +72 -0
  20. package/runner/main/notifications/telegram.js +45 -0
  21. package/runner/main/orchestrator.js +193 -0
  22. package/runner/main/paths.js +36 -0
  23. package/runner/main/pipeline/resolver.js +20 -0
  24. package/runner/main/pipeline/sequencer.js +42 -0
  25. package/runner/main/server/api.js +125 -0
  26. package/runner/main/server/index.js +33 -0
  27. package/runner/main/server/websocket.js +24 -0
  28. package/runner/main/state/manager.js +83 -0
  29. package/runner/main/template-manager.js +41 -0
  30. package/runner/main/test/agent-parser.test.js +44 -0
  31. package/runner/main/test/bootstrap.test.js +58 -0
  32. package/runner/main/test/db.test.js +72 -0
  33. package/runner/main/test/paths.test.js +29 -0
  34. package/runner/main/test/state-manager.test.js +72 -0
  35. package/runner/main/test/template-manager.test.js +66 -0
  36. package/runner/main/worktree/manager.js +95 -0
  37. package/runner/package.json +22 -0
  38. package/runner/preload.js +19 -0
  39. package/specdacular/HELP.md +20 -11
  40. package/specdacular/agents/best-practices-researcher.md +271 -0
  41. package/specdacular/agents/project-researcher.md +409 -0
  42. package/specdacular/references/load-context.md +4 -7
  43. package/specdacular/templates/orchestrator/CONCERNS.md +1 -1
  44. package/specdacular/templates/orchestrator/PROJECTS.md +3 -4
  45. package/specdacular/templates/tasks/PLAN.md +2 -2
  46. package/specdacular/templates/tasks/PROJECT.md +52 -0
  47. package/specdacular/templates/tasks/REQUIREMENTS.md +75 -0
  48. package/specdacular/workflows/best-practices.md +472 -0
  49. package/specdacular/workflows/context-add.md +16 -30
  50. package/specdacular/workflows/context-manual-review.md +7 -7
  51. package/specdacular/workflows/docs-review.md +273 -0
  52. package/specdacular/workflows/docs.md +420 -0
  53. package/specdacular/workflows/generate-learn-skill.md +214 -0
  54. package/specdacular/workflows/new-project.md +799 -0
  55. package/specdacular/workflows/new.md +5 -4
  56. package/specdacular/workflows/orchestrator/new.md +4 -4
  57. package/specdacular/workflows/orchestrator/plan.md +6 -6
  58. package/commands/specd.codebase.map.md +0 -72
  59. package/commands/specd.codebase.review.md +0 -39
  60. package/specdacular/workflows/map-codebase.md +0 -715
@@ -1,7 +1,7 @@
1
1
  <purpose>
2
- Guide the user to add new content to a codebase context file (.specd/codebase/*.md). Identifies the correct file and section, checks for duplicates, confirms placement, and writes the content with a USER_MODIFIED tag.
2
+ Guide the user to add new content to a codebase doc file (docs/*.md). Identifies the correct file and section, checks for duplicates, confirms placement, and writes the content with a USER_MODIFIED tag.
3
3
 
4
- Output: Updated context file with new content added to the correct section.
4
+ Output: Updated doc file with new content added to the correct section.
5
5
  </purpose>
6
6
 
7
7
  <philosophy>
@@ -43,17 +43,17 @@ After writing content, update the document-level `Last Modified:` timestamp. If
43
43
  <process>
44
44
 
45
45
  <step name="validate">
46
- Check that codebase context files exist.
46
+ Check that codebase doc files exist.
47
47
 
48
48
  ```bash
49
- ls .specd/codebase/*.md 2>/dev/null
49
+ grep -rl "generated_by: specd" docs/ 2>/dev/null || ls docs/*.md 2>/dev/null
50
50
  ```
51
51
 
52
52
  **If no files found:**
53
53
  ```
54
- No codebase context files found.
54
+ No codebase doc files found.
55
55
 
56
- Run /specd.codebase.map to generate codebase documentation.
56
+ Run /specd.docs to generate topic-based documentation.
57
57
  ```
58
58
  End workflow.
59
59
 
@@ -81,7 +81,7 @@ Determine where the content belongs.
81
81
 
82
82
  Search all context files for key terms from the user's description:
83
83
 
84
- Use Grep to search `.specd/codebase/*.md` for the main keywords/concepts from the user's input.
84
+ Use Grep to search `docs/*.md` for the main keywords/concepts from the user's input.
85
85
 
86
86
  **If similar content found:**
87
87
  ```
@@ -105,11 +105,10 @@ If "Cancel": End workflow.
105
105
 
106
106
  **Step 2: Identify best file**
107
107
 
108
- Based on the content type, determine the target file:
109
- - **MAP.md** — Entry points, modules, functions, integrations, data flow
110
- - **PATTERNS.md** — Code patterns, conventions, examples to follow
111
- - **STRUCTURE.md** Directory layout, where to put new files, naming conventions
112
- - **CONCERNS.md** — Gotchas, anti-patterns, tech debt, fragile areas, warnings
108
+ Based on the content type, determine the target file from docs/:
109
+ - **rules.md** — Always-true project rules, conventions, import patterns
110
+ - **{topic}.md** — Topic-specific docs (e.g., react-query.md, testing-patterns.md, project-structure.md)
111
+ - Read the CLAUDE.md routing table to see which docs exist and what they cover
113
112
 
114
113
  **Step 3: Identify best section**
115
114
 
@@ -142,27 +141,14 @@ Use AskUserQuestion:
142
141
  - "Cancel" — Don't add
143
142
 
144
143
  **If "Different section":**
145
- Show all sections across all 4 files as options:
144
+ Show all sections across all doc files as options:
146
145
 
147
146
  ```
148
147
  Available sections:
149
148
 
150
- MAP.md:
151
- ## Entry Points
152
- ## Core Modules
153
- ...
154
-
155
- PATTERNS.md:
156
- ## Workflow/Command Pattern
157
- ...
158
-
159
- STRUCTURE.md:
160
- ## Directory Layout
161
- ...
162
-
163
- CONCERNS.md:
164
- ## Gotchas
165
- ## Anti-patterns
149
+ {For each docs/*.md file:}
150
+ {filename}:
151
+ {list of ## headings}
166
152
  ...
167
153
  ```
168
154
 
@@ -203,7 +189,7 @@ Continue to commit.
203
189
  <step name="commit">
204
190
  @~/.claude/specdacular/references/commit-docs.md
205
191
 
206
- - **$FILES:** `.specd/codebase/{file}`
192
+ - **$FILES:** `docs/{file}`
207
193
  - **$MESSAGE:** `docs: add to {file} — {brief description of what was added}`
208
194
  - **$LABEL:** `context addition`
209
195
 
@@ -1,5 +1,5 @@
1
1
  <purpose>
2
- Manual review of a codebase context file (.specd/codebase/*.md). Shows a section list and lets the user pick which section to review, edit, remove, re-map, or add new content.
2
+ Manual review of a codebase doc file (docs/*.md). Shows a section list and lets the user pick which section to review, edit, remove, re-map, or add new content.
3
3
 
4
4
  Edits are tagged with `<!-- USER_MODIFIED: YYYY-MM-DD -->`. Re-mapping spawns a targeted agent for just that section and shows a semantic diff.
5
5
 
@@ -88,17 +88,17 @@ Never skip tagging. Never defer to a later step.
88
88
  <process>
89
89
 
90
90
  <step name="validate">
91
- Check that codebase context files exist.
91
+ Check that codebase doc files exist.
92
92
 
93
93
  ```bash
94
- ls .specd/codebase/*.md 2>/dev/null
94
+ grep -rl "generated_by: specd" docs/ 2>/dev/null || ls docs/*.md 2>/dev/null
95
95
  ```
96
96
 
97
97
  **If no files found:**
98
98
  ```
99
- No codebase context files found.
99
+ No codebase doc files found.
100
100
 
101
- Run /specd.codebase.map to generate codebase documentation.
101
+ Run /specd.docs to generate topic-based documentation.
102
102
  ```
103
103
  End workflow.
104
104
 
@@ -262,7 +262,7 @@ description: "Re-map section: {section title}"
262
262
  ```
263
263
  Focus: {MAPPER_FOCUS}
264
264
 
265
- You are re-mapping a SINGLE SECTION of .specd/codebase/{file}.
265
+ You are re-mapping a SINGLE SECTION of docs/{file}.
266
266
 
267
267
  Section heading: {exact heading text}
268
268
  Heading level: {## or ###}
@@ -360,7 +360,7 @@ Still commit the timestamp update (Last Reviewed changed).
360
360
 
361
361
  @~/.claude/specdacular/references/commit-docs.md
362
362
 
363
- - **$FILES:** `.specd/codebase/{file}`
363
+ - **$FILES:** `docs/{file}`
364
364
  - **$MESSAGE:** `docs: review {file}` with brief summary of changes
365
365
  - **$LABEL:** `context review`
366
366
 
@@ -0,0 +1,273 @@
1
+ <purpose>
2
+ Audit existing topic docs for accuracy, staleness, and coverage gaps. Optionally research best practices for the detected stack. Update frontmatter review dates after user approval.
3
+
4
+ **Output:** Review findings, updated docs and review dates, CLAUDE.md routing table changes if docs added/removed.
5
+ </purpose>
6
+
7
+ <philosophy>
8
+
9
+ ## Trust But Verify
10
+
11
+ Docs were generated from real code, but code changes. The review checks whether docs still reflect reality.
12
+
13
+ ## Freshness Is Not Accuracy
14
+
15
+ A doc can be stale (old review date) but still accurate, or fresh but drifted (code changed right after review). Check both dimensions.
16
+
17
+ ## Research Is Additive
18
+
19
+ Research agents suggest improvements based on current best practices. They don't override what the codebase actually does — they propose what it could do better.
20
+
21
+ ## User Decides
22
+
23
+ Present findings. Let the user choose what to update. Don't auto-fix.
24
+
25
+ </philosophy>
26
+
27
+ <process>
28
+
29
+ <step name="discover_docs">
30
+ Find all specd-generated docs and parse their frontmatter.
31
+
32
+ **Read CLAUDE.md routing table:**
33
+ ```bash
34
+ [ -f "CLAUDE.md" ] && cat CLAUDE.md || echo "no_claude_md"
35
+ ```
36
+
37
+ Extract `$DOCS_DIR` from routing table paths. Default to `docs/` if not found.
38
+
39
+ **Find specd-generated docs:**
40
+ ```bash
41
+ grep -rl "generated_by: specd" $DOCS_DIR/ 2>/dev/null
42
+ ```
43
+
44
+ **For each doc found, parse frontmatter:**
45
+ Read the file, extract:
46
+ - `last_reviewed` date
47
+ - `generated_by` field
48
+ - Doc topic/name from filename
49
+
50
+ If no specd-generated docs found:
51
+ ```
52
+ No specd-generated docs found. Run /specd.docs first to generate topic docs.
53
+ ```
54
+ End workflow.
55
+
56
+ Build `$DOC_LIST` — array of docs with their metadata.
57
+
58
+ Continue to assess_freshness.
59
+ </step>
60
+
61
+ <step name="assess_freshness">
62
+ Check how fresh each doc is based on review dates and git history.
63
+
64
+ **For each doc in `$DOC_LIST`:**
65
+
66
+ 1. Calculate days since `last_reviewed`:
67
+ ```bash
68
+ # Days between last_reviewed and today
69
+ echo $(( ($(date +%s) - $(date -d "{last_reviewed}" +%s)) / 86400 ))
70
+ ```
71
+
72
+ 2. Check if significant code changed since last review:
73
+ ```bash
74
+ git log --since="{last_reviewed}" --name-only --pretty=format: -- "src/" "lib/" "app/" | sort -u | head -20
75
+ ```
76
+
77
+ 3. Classify freshness:
78
+ - **Fresh** — reviewed within 30 days, no significant code changes
79
+ - **Aging** — reviewed 30-90 days ago
80
+ - **Stale** — reviewed 90+ days ago
81
+ - **Code changed** — significant changes to source files since last review (regardless of age)
82
+
83
+ Continue to check_accuracy.
84
+ </step>
85
+
86
+ <step name="check_accuracy">
87
+ Spot-check doc content against current code.
88
+
89
+ **For each doc in `$DOC_LIST`:**
90
+
91
+ 1. **File path check:** Extract all file paths mentioned in the doc. Verify each exists:
92
+ ```bash
93
+ # For each path referenced in the doc
94
+ [ -f "{path}" ] && echo "exists" || echo "missing: {path}"
95
+ ```
96
+
97
+ 2. **Pattern check:** For docs that describe code patterns (with code examples), spot-check a few:
98
+ - Read the referenced source file
99
+ - Check if the pattern described still matches the actual code
100
+ - Note any significant differences
101
+
102
+ 3. **Rules check (for rules.md):** Verify each rule still applies:
103
+ - Import conventions — check a few imports in source files
104
+ - Naming conventions — check recent files follow the pattern
105
+ - File placement — check if new files follow the described structure
106
+
107
+ 4. **Classify accuracy:**
108
+ - **Accurate** — spot-checks pass, content matches code
109
+ - **Minor drift** — small inaccuracies (renamed function, moved file)
110
+ - **Major drift** — significant patterns changed, doc is misleading
111
+ - **Obsolete** — technology/pattern no longer exists in codebase
112
+
113
+ Continue to detect_gaps.
114
+ </step>
115
+
116
+ <step name="detect_gaps">
117
+ Find technologies and patterns in the code not covered by existing docs.
118
+
119
+ **Scan codebase for technology markers:**
120
+ ```bash
121
+ # Check package.json / go.mod / Cargo.toml for dependencies
122
+ cat package.json 2>/dev/null | grep -E '"dependencies"|"devDependencies"' -A 50
123
+ cat go.mod 2>/dev/null
124
+ cat Cargo.toml 2>/dev/null
125
+
126
+ # Check for common patterns in source files
127
+ grep -rl "import.*from" src/ 2>/dev/null | head -10
128
+ ```
129
+
130
+ **Compare against existing doc topics:**
131
+ - List technologies/frameworks used in the code
132
+ - List topics covered by existing docs
133
+ - Identify gaps: technologies in code but not documented
134
+ - Identify obsolete: topics in docs but technology no longer in code
135
+
136
+ **Propose new docs** for significant gaps (technology used in 3+ files).
137
+ **Propose removal** for obsolete topics.
138
+
139
+ Continue to research_improvements.
140
+ </step>
141
+
142
+ <step name="research_improvements">
143
+ Optionally research best practices for the detected stack.
144
+
145
+ Use AskUserQuestion:
146
+ - header: "Research?"
147
+ - question: "Want me to research current best practices for your stack to suggest improvements?"
148
+ - options:
149
+ - "Yes — research improvements" — Spawn research agents for detected technologies
150
+ - "No — just review accuracy" — Skip research, go to findings
151
+
152
+ **If user says yes:**
153
+
154
+ For each major technology detected in the codebase, spawn a research agent:
155
+
156
+ Use Agent tool:
157
+ - description: "Research {technology} best practices"
158
+ - prompt: "Research current best practices for {technology} in {year}. Focus on:
159
+ - Common patterns and anti-patterns
160
+ - Performance recommendations
161
+ - Security considerations
162
+ - Migration guidance for newer versions
163
+ Return a concise list of actionable suggestions."
164
+
165
+ Collect research results. For each suggestion, note:
166
+ - What the codebase currently does
167
+ - What best practice recommends
168
+ - Impact level (low/medium/high)
169
+
170
+ Continue to present_findings.
171
+ </step>
172
+
173
+ <step name="present_findings">
174
+ Show review results to user.
175
+
176
+ ```
177
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
178
+ DOCS REVIEW
179
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
180
+
181
+ {count} docs reviewed
182
+
183
+ {For each doc:}
184
+ {✅|⚠️|❌|🔍} {doc name} — {Accurate|Minor drift|Major drift|Stale|Obsolete}
185
+ Last reviewed: {date} ({N} days ago)
186
+ {If drifted: "Drift: {specific inaccuracy}"}
187
+ {If code changed: "Code changed: {N} files modified since review"}
188
+ ```
189
+
190
+ **If gaps found:**
191
+ ```
192
+ Coverage gaps:
193
+ - {technology/pattern} — Used in {N} files, not documented
194
+ Proposed: docs/{topic}.md
195
+ ```
196
+
197
+ **If obsolete docs found:**
198
+ ```
199
+ Possibly obsolete:
200
+ - {doc name} — {technology} no longer found in codebase
201
+ ```
202
+
203
+ **If research done:**
204
+ ```
205
+ Improvement suggestions:
206
+ {For each suggestion:}
207
+ - [{impact}] {suggestion}
208
+ Current: {what code does}
209
+ Recommended: {what best practice says}
210
+ ```
211
+
212
+ Continue to apply_updates.
213
+ </step>
214
+
215
+ <step name="apply_updates">
216
+ Let user choose what actions to take.
217
+
218
+ Use AskUserQuestion:
219
+ - header: "Actions"
220
+ - question: "What would you like to do with these findings?"
221
+ - multiSelect: true
222
+ - options:
223
+ - "Update drifted docs" — Fix inaccuracies in docs that have drifted
224
+ - "Generate new docs for gaps" — Create docs for uncovered topics
225
+ - "Remove obsolete docs" — Delete docs for removed technologies
226
+ - "Mark accurate docs as reviewed" — Update last_reviewed to today
227
+
228
+ **For "Update drifted docs":**
229
+ For each drifted doc, read the current code and update the doc content to match reality. Update frontmatter `last_reviewed` to today.
230
+
231
+ **For "Generate new docs for gaps":**
232
+ For significant gaps, generate new topic docs. This may require re-running mapper agents for fresh codebase data, or the review workflow can generate targeted docs from its own analysis. Add new docs to CLAUDE.md routing table (between section markers).
233
+
234
+ **For "Remove obsolete docs":**
235
+ Delete obsolete doc files. Remove their entries from CLAUDE.md routing table.
236
+
237
+ **For "Mark accurate docs as reviewed":**
238
+ For each doc classified as accurate, update `last_reviewed` in frontmatter to today's date.
239
+
240
+ **Update CLAUDE.md routing table** if docs were added or removed:
241
+ - Add new entries for generated docs
242
+ - Remove entries for deleted docs
243
+ - Keep within `<!-- specd:docs-routing:start -->` / `<!-- specd:docs-routing:end -->` markers
244
+
245
+ **Do not auto-commit.** User manages commits.
246
+
247
+ **Present completion:**
248
+ ```
249
+ Review complete.
250
+
251
+ Updated: {count} docs
252
+ Generated: {count} new docs
253
+ Removed: {count} obsolete docs
254
+ Reviewed: {count} docs marked as fresh
255
+ ```
256
+
257
+ End workflow.
258
+ </step>
259
+
260
+ </process>
261
+
262
+ <success_criteria>
263
+ - All specd-generated docs found via frontmatter scan
264
+ - Freshness assessed using last_reviewed dates + git history
265
+ - Accuracy spot-checked against current code (file paths, patterns, rules)
266
+ - Coverage gaps detected by comparing codebase vs. doc topics
267
+ - Research is optional — user chooses
268
+ - Findings presented with clear per-doc status
269
+ - User selects which actions to take (multiSelect)
270
+ - Frontmatter last_reviewed updated on approved docs
271
+ - CLAUDE.md routing table updated if docs added/removed
272
+ - No auto-commit — user manages commits
273
+ </success_criteria>