specweave 1.0.31 → 1.0.33

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 (123) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CLAUDE.md +205 -148
  3. package/README.md +0 -2
  4. package/bin/specweave.js +11 -0
  5. package/dist/src/cli/commands/init.js +1 -1
  6. package/dist/src/cli/commands/init.js.map +1 -1
  7. package/dist/src/cli/commands/update-instructions.d.ts +16 -0
  8. package/dist/src/cli/commands/update-instructions.d.ts.map +1 -0
  9. package/dist/src/cli/commands/update-instructions.js +134 -0
  10. package/dist/src/cli/commands/update-instructions.js.map +1 -0
  11. package/dist/src/cli/helpers/init/directory-structure.d.ts +28 -1
  12. package/dist/src/cli/helpers/init/directory-structure.d.ts.map +1 -1
  13. package/dist/src/cli/helpers/init/directory-structure.js +163 -33
  14. package/dist/src/cli/helpers/init/directory-structure.js.map +1 -1
  15. package/dist/src/cli/helpers/init/index.d.ts +2 -1
  16. package/dist/src/cli/helpers/init/index.d.ts.map +1 -1
  17. package/dist/src/cli/helpers/init/index.js +3 -1
  18. package/dist/src/cli/helpers/init/index.js.map +1 -1
  19. package/dist/src/cli/helpers/init/instruction-file-merger.d.ts +23 -0
  20. package/dist/src/cli/helpers/init/instruction-file-merger.d.ts.map +1 -0
  21. package/dist/src/cli/helpers/init/instruction-file-merger.js +243 -0
  22. package/dist/src/cli/helpers/init/instruction-file-merger.js.map +1 -0
  23. package/dist/src/cli/helpers/init/plugin-installer.js +49 -0
  24. package/dist/src/cli/helpers/init/plugin-installer.js.map +1 -1
  25. package/dist/src/config/types.d.ts +2 -2
  26. package/dist/src/core/living-docs/external-sync-orchestrator.d.ts +26 -0
  27. package/dist/src/core/living-docs/external-sync-orchestrator.d.ts.map +1 -1
  28. package/dist/src/core/living-docs/external-sync-orchestrator.js +61 -0
  29. package/dist/src/core/living-docs/external-sync-orchestrator.js.map +1 -1
  30. package/dist/src/core/living-docs/scaffolding/index.d.ts +12 -0
  31. package/dist/src/core/living-docs/scaffolding/index.d.ts.map +1 -0
  32. package/dist/src/core/living-docs/scaffolding/index.js +15 -0
  33. package/dist/src/core/living-docs/scaffolding/index.js.map +1 -0
  34. package/dist/src/core/living-docs/scaffolding/merger.d.ts +183 -0
  35. package/dist/src/core/living-docs/scaffolding/merger.d.ts.map +1 -0
  36. package/dist/src/core/living-docs/scaffolding/merger.js +523 -0
  37. package/dist/src/core/living-docs/scaffolding/merger.js.map +1 -0
  38. package/dist/src/core/living-docs/scaffolding/scaffold.d.ts +102 -0
  39. package/dist/src/core/living-docs/scaffolding/scaffold.d.ts.map +1 -0
  40. package/dist/src/core/living-docs/scaffolding/scaffold.js +346 -0
  41. package/dist/src/core/living-docs/scaffolding/scaffold.js.map +1 -0
  42. package/dist/src/core/living-docs/scaffolding/template-engine.d.ts +108 -0
  43. package/dist/src/core/living-docs/scaffolding/template-engine.d.ts.map +1 -0
  44. package/dist/src/core/living-docs/scaffolding/template-engine.js +204 -0
  45. package/dist/src/core/living-docs/scaffolding/template-engine.js.map +1 -0
  46. package/dist/src/core/living-docs/sync-helpers/generators.d.ts +38 -2
  47. package/dist/src/core/living-docs/sync-helpers/generators.d.ts.map +1 -1
  48. package/dist/src/core/living-docs/sync-helpers/generators.js +65 -10
  49. package/dist/src/core/living-docs/sync-helpers/generators.js.map +1 -1
  50. package/dist/src/core/living-docs/sync-helpers/index.d.ts +1 -1
  51. package/dist/src/core/living-docs/sync-helpers/index.d.ts.map +1 -1
  52. package/dist/src/core/living-docs/sync-helpers/index.js.map +1 -1
  53. package/dist/src/core/tools/index.d.ts +11 -0
  54. package/dist/src/core/tools/index.d.ts.map +1 -0
  55. package/dist/src/core/tools/index.js +10 -0
  56. package/dist/src/core/tools/index.js.map +1 -0
  57. package/dist/src/core/tools/tool-event-bus.d.ts +33 -0
  58. package/dist/src/core/tools/tool-event-bus.d.ts.map +1 -0
  59. package/dist/src/core/tools/tool-event-bus.js +84 -0
  60. package/dist/src/core/tools/tool-event-bus.js.map +1 -0
  61. package/dist/src/core/tools/tool-index-builder.d.ts +27 -0
  62. package/dist/src/core/tools/tool-index-builder.d.ts.map +1 -0
  63. package/dist/src/core/tools/tool-index-builder.js +289 -0
  64. package/dist/src/core/tools/tool-index-builder.js.map +1 -0
  65. package/dist/src/core/tools/tool-registry.d.ts +51 -0
  66. package/dist/src/core/tools/tool-registry.d.ts.map +1 -0
  67. package/dist/src/core/tools/tool-registry.js +224 -0
  68. package/dist/src/core/tools/tool-registry.js.map +1 -0
  69. package/dist/src/core/tools/tool-search-engine.d.ts +22 -0
  70. package/dist/src/core/tools/tool-search-engine.d.ts.map +1 -0
  71. package/dist/src/core/tools/tool-search-engine.js +174 -0
  72. package/dist/src/core/tools/tool-search-engine.js.map +1 -0
  73. package/dist/src/core/tools/types/tool-registry-types.d.ts +112 -0
  74. package/dist/src/core/tools/types/tool-registry-types.d.ts.map +1 -0
  75. package/dist/src/core/tools/types/tool-registry-types.js +7 -0
  76. package/dist/src/core/tools/types/tool-registry-types.js.map +1 -0
  77. package/dist/src/init/compliance/types.d.ts +1 -1
  78. package/package.json +1 -1
  79. package/plugins/specweave/hooks/hooks.json +3 -13
  80. package/plugins/specweave/hooks/lib/common-setup.sh +47 -321
  81. package/plugins/specweave/hooks/lib/migrate-increment-work.sh +5 -5
  82. package/plugins/specweave/hooks/lib/sync-spec-content.sh +5 -5
  83. package/plugins/specweave/hooks/universal/dispatcher.mjs +4 -5
  84. package/plugins/specweave/hooks/universal/fail-fast-wrapper.sh +43 -296
  85. package/plugins/specweave/hooks/universal/hook-wrapper.sh +3 -1
  86. package/plugins/specweave/hooks/user-prompt-submit.sh +1 -1
  87. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +2 -2
  88. package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +1 -10
  89. package/plugins/specweave/hooks/v2/guards/completion-guard.sh +12 -29
  90. package/plugins/specweave/hooks/v2/guards/increment-duplicate-guard.sh +27 -29
  91. package/plugins/specweave/hooks/v2/guards/metadata-json-guard.sh +10 -4
  92. package/plugins/specweave/hooks/v2/guards/spec-validation-guard.sh +139 -0
  93. package/plugins/specweave/hooks/v2/guards/task-ac-sync-guard.sh +4 -2
  94. package/plugins/specweave/hooks/v2/session-end.sh +3 -1
  95. package/plugins/specweave/hooks/v2/session-start.sh +3 -1
  96. package/plugins/specweave/skills/increment-planner/templates/plan.md +14 -0
  97. package/plugins/specweave/skills/update-instructions/SKILL.md +80 -0
  98. package/plugins/specweave-ado/hooks/post-living-docs-update.sh +1 -1
  99. package/plugins/specweave-mobile/README.md +55 -35
  100. package/plugins/specweave-mobile/agents/mobile-architect/AGENT.md +805 -329
  101. package/plugins/specweave-mobile/skills/expo-workflow/SKILL.md +226 -9
  102. package/plugins/specweave-mobile/skills/native-modules/SKILL.md +221 -20
  103. package/plugins/specweave-mobile/skills/performance-optimization/SKILL.md +186 -14
  104. package/plugins/specweave-mobile/skills/react-native-setup/SKILL.md +151 -54
  105. package/plugins/specweave-release/commands/npm.md +61 -17
  106. package/plugins/specweave-release/hooks/post-task-completion.sh +2 -3
  107. package/src/templates/AGENTS.md.template +34 -0
  108. package/src/templates/CLAUDE.md.template +121 -155
  109. package/plugins/specweave/hooks/config-env-separator.sh +0 -99
  110. package/plugins/specweave/hooks/github-metadata-guard.sh +0 -73
  111. package/plugins/specweave/hooks/lib/circuit-breaker.sh +0 -381
  112. package/plugins/specweave/hooks/lib/crash-prevention.sh +0 -336
  113. package/plugins/specweave/hooks/lib/logging.sh +0 -231
  114. package/plugins/specweave/hooks/lib/metrics.sh +0 -347
  115. package/plugins/specweave/hooks/lib/semaphore.sh +0 -216
  116. package/plugins/specweave/hooks/project-folder-guard.sh +0 -274
  117. package/plugins/specweave/hooks/spec-project-validator.sh +0 -210
  118. package/plugins/specweave/hooks/v2/guards/bash-file-guard.sh +0 -212
  119. package/plugins/specweave/hooks/v2/guards/bash-file-guard.test.sh +0 -163
  120. package/plugins/specweave/hooks/v2/guards/features-folder-guard.sh +0 -51
  121. package/plugins/specweave/hooks/v2/guards/increment-root-guard.sh +0 -63
  122. package/plugins/specweave/hooks/v2/guards/per-us-project-validator.sh +0 -335
  123. package/plugins/specweave/hooks/v2/guards/per-us-project-validator.test.sh +0 -406
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: sw-release:npm
3
- description: Bump patch version, auto-commit dirty changes, push to GitHub, build, publish to npmjs.org. Use --quick for save+release (no GH workflow). Use --ci for GitHub Actions publish. Use --only for local publish without git push. Use --only --local for version bump only.
3
+ description: Full patch release - auto-commit, push, build, npm publish, AND GitHub Release creation. Use --quick for save+release (no GH release). Use --ci for GitHub Actions publish. Use --only for local publish without git push. Use --only --local for version bump only.
4
4
  ---
5
5
 
6
6
  # /sw-release:npm - NPM Release Automation
@@ -49,9 +49,9 @@ fi
49
49
 
50
50
  | Command | Flow | Use Case |
51
51
  |---------|------|----------|
52
- | `/sw-release:npm` | Auto-commit → **PUSH** → Bump → Build → **Publish** → Push tag | **DEFAULT: INSTANT RELEASE** |
53
- | `/sw-release:npm --quick` | Auto-commit → **PUSH** → Bump → Build → **Publish locally** → NO GH workflow | **QUICK: Save + Local Release** |
54
- | `/sw-release:npm --ci` | Bump → Push → **CI publishes** | Let GitHub Actions handle npm publish |
52
+ | `/sw-release:npm` | Auto-commit → **PUSH** → Bump → Build → **Publish** → Push tag → **GH Release** | **DEFAULT: FULL RELEASE** |
53
+ | `/sw-release:npm --quick` | Auto-commit → **PUSH** → Bump → Build → **Publish locally** → NO GH release | **QUICK: Save + Local Release** |
54
+ | `/sw-release:npm --ci` | Bump → Push → **CI publishes + GH Release** | Let GitHub Actions handle everything |
55
55
  | `/sw-release:npm --only` | Bump → Build → **Publish locally** → NO push | Quick local release, push later |
56
56
  | `/sw-release:npm --only --local` | **Bump ONLY** → NO build, NO publish, NO git | FASTEST: Local testing only |
57
57
  | `/sw-release:npm --stable` | Same as default, but promotes prerelease to stable | **PROMOTE TO STABLE** |
@@ -198,14 +198,56 @@ npm publish --registry https://registry.npmjs.org
198
198
  git push origin develop --follow-tags
199
199
  ```
200
200
 
201
- ### 8. Report Results
201
+ ### 8. Create GitHub Release
202
+
203
+ ```bash
204
+ # Get the new version
205
+ NEW_VERSION=$(node -p "require('./package.json').version")
206
+
207
+ # Extract release notes from CHANGELOG.md (if available)
208
+ if [ -f CHANGELOG.md ] && grep -q "## \[$NEW_VERSION\]" CHANGELOG.md; then
209
+ # Extract notes between current version header and next version header
210
+ awk "/## \[$NEW_VERSION\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md > /tmp/release-notes.md
211
+ else
212
+ # Generate minimal release notes from recent commits
213
+ echo "## What's Changed" > /tmp/release-notes.md
214
+ echo "" >> /tmp/release-notes.md
215
+ LAST_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
216
+ if [ -n "$LAST_TAG" ]; then
217
+ git log --oneline "$LAST_TAG"..HEAD~1 --no-merges | head -10 | sed 's/^[a-f0-9]* /- /' >> /tmp/release-notes.md
218
+ else
219
+ git log --oneline -10 --no-merges | sed 's/^[a-f0-9]* /- /' >> /tmp/release-notes.md
220
+ fi
221
+ fi
222
+
223
+ # Create GitHub release (prerelease if version contains -rc, -beta, -alpha)
224
+ if [[ "$NEW_VERSION" == *"-rc"* ]] || [[ "$NEW_VERSION" == *"-beta"* ]] || [[ "$NEW_VERSION" == *"-alpha"* ]]; then
225
+ gh release create "v$NEW_VERSION" \
226
+ --title "v$NEW_VERSION" \
227
+ --notes-file /tmp/release-notes.md \
228
+ --prerelease
229
+ else
230
+ gh release create "v$NEW_VERSION" \
231
+ --title "v$NEW_VERSION" \
232
+ --notes-file /tmp/release-notes.md \
233
+ --latest
234
+ fi
235
+ ```
236
+
237
+ **What this does**:
238
+ - Extracts release notes from CHANGELOG.md (or generates from commits)
239
+ - Creates GitHub Release with proper title and notes
240
+ - Marks prereleases appropriately (rc, beta, alpha)
241
+ - Marks stable releases as "latest"
242
+
243
+ ### 9. Report Results
202
244
 
203
245
  ```markdown
204
- ✅ **Instant release complete!**
246
+ ✅ **Full patch release complete!**
205
247
 
206
248
  📦 **Version**: vX.Y.Z
207
249
  🔗 **NPM**: https://www.npmjs.com/package/specweave
208
- 🏷️ **GitHub**: https://github.com/anton-abyzov/specweave/releases/tag/vX.Y.Z
250
+ 🏷️ **GitHub Release**: https://github.com/anton-abyzov/specweave/releases/tag/vX.Y.Z
209
251
 
210
252
  **What happened**:
211
253
  - ✅ Dirty changes auto-committed
@@ -214,6 +256,7 @@ git push origin develop --follow-tags
214
256
  - ✅ Package built
215
257
  - ✅ Published to npmjs.org
216
258
  - ✅ Version tag pushed to GitHub
259
+ - ✅ GitHub Release created with release notes
217
260
 
218
261
  **Verify**: `npm view specweave version --registry https://registry.npmjs.org`
219
262
  ```
@@ -227,6 +270,7 @@ git push origin develop --follow-tags
227
270
  ✅ Package rebuilt
228
271
  ✅ Published to npmjs.org (explicit registry!)
229
272
  ✅ Version commit + tag pushed to GitHub
273
+ ✅ **GitHub Release created with release notes**
230
274
 
231
275
  ---
232
276
 
@@ -549,10 +593,10 @@ Show the user:
549
593
  ## Quick Reference
550
594
 
551
595
  ```bash
552
- # DEFAULT: Instant release (auto-commits dirty, publishes, pushes + tag)
596
+ # DEFAULT: Full release (auto-commits dirty, publishes, pushes + tag, GH release)
553
597
  /sw-release:npm
554
598
 
555
- # QUICK: Save + local release (auto-commits, pushes, publishes - NO GH workflow)
599
+ # QUICK: Save + local release (auto-commits, pushes, publishes - NO GH release)
556
600
  /sw-release:npm --quick
557
601
 
558
602
  # CI release (GitHub Actions handles npm publish) - requires clean tree
@@ -568,14 +612,14 @@ Show the user:
568
612
  /sw-release:npm --stable
569
613
  ```
570
614
 
571
- | Scenario | Command | Prerelease Handling | Git Pushed | Tag Pushed |
572
- |----------|---------|---------------------|------------|------------|
573
- | **INSTANT RELEASE** | (no flags) | `rc.1`→`rc.2` (smart) | ✅ Yes | ✅ Yes |
574
- | **QUICK RELEASE** | `--quick` | `rc.1`→`rc.2` (smart) | ✅ Yes | ❌ No |
575
- | CI release | `--ci` | `rc.1`→`rc.2` (smart) | ✅ Yes | ✅ Yes |
576
- | Local publish | `--only` | `rc.1`→`rc.2` (smart) | ❌ No | ❌ No |
577
- | Local bump | `--only --local` | `rc.1`→`rc.2` (smart) | ❌ No | ❌ No |
578
- | **PROMOTE** | `--stable` | `rc.X`→`X.Y.Z+1` | ✅ Yes | ✅ Yes |
615
+ | Scenario | Command | Prerelease Handling | Git Pushed | Tag Pushed | GH Release |
616
+ |----------|---------|---------------------|------------|------------|------------|
617
+ | **FULL RELEASE** | (no flags) | `rc.1`→`rc.2` (smart) | ✅ Yes | ✅ Yes | ✅ Yes |
618
+ | **QUICK RELEASE** | `--quick` | `rc.1`→`rc.2` (smart) | ✅ Yes | ❌ No | ❌ No |
619
+ | CI release | `--ci` | `rc.1`→`rc.2` (smart) | ✅ Yes | ✅ Yes | ✅ (via CI) |
620
+ | Local publish | `--only` | `rc.1`→`rc.2` (smart) | ❌ No | ❌ No | ❌ No |
621
+ | Local bump | `--only --local` | `rc.1`→`rc.2` (smart) | ❌ No | ❌ No | ❌ No |
622
+ | **PROMOTE** | `--stable` | `rc.X`→`X.Y.Z+1` | ✅ Yes | ✅ Yes | ✅ Yes |
579
623
 
580
624
  ---
581
625
 
@@ -8,9 +8,8 @@
8
8
 
9
9
  # CRITICAL (v0.25.2): NEVER use 'set -e' in hooks - causes Claude Code crashes
10
10
  # See: CLAUDE.md Section 9a (Hook Safety Checklist), ADR-0060 (Hook Performance)
11
- set +e # Allow commands to fail without terminating script
12
- set -u # Fail on undefined variables
13
- set -o pipefail # Fail if any command in pipeline fails
11
+ # v1.0.33 - Fixed: removed set -o pipefail for hook safety
12
+ set +e # CRITICAL: Never use set -e or pipefail in hooks (causes cascading failures)
14
13
 
15
14
  # Constants
16
15
  SPECWEAVE_ROOT="${SPECWEAVE_ROOT:-$(pwd)}"
@@ -17,6 +17,7 @@
17
17
 
18
18
  ---
19
19
 
20
+ <!-- SECTION:index -->
20
21
  ## Section Index (Use Ctrl+F to Navigate)
21
22
 
22
23
  | Section | Search For | Purpose |
@@ -28,18 +29,22 @@
28
29
  | Sync | `#sync-workflow` | When/how to sync |
29
30
  | Context | `#context-loading` | Token savings (70%+) |
30
31
  | Troubleshoot | `#troubleshooting` | Common issues |
32
+ <!-- /SECTION -->
31
33
 
32
34
  ---
33
35
 
36
+ <!-- SECTION:quickstart required -->
34
37
  ## Quick Start
35
38
 
36
39
  1. **Get Project Context FIRST**: `specweave context projects` (save the output!)
37
40
  2. **Create Your First Increment**: `/sw:increment "your-feature"`
38
41
  3. **Customize**: Edit spec.md - **EVERY User Story needs `**Project**:` field!**
39
42
  4. **Execute**: `/sw:do` to start implementation
43
+ <!-- /SECTION -->
40
44
 
41
45
  ---
42
46
 
47
+ <!-- SECTION:rules required -->
43
48
  ## Essential Rules {#essential-rules}
44
49
 
45
50
  ```
@@ -62,9 +67,11 @@
62
67
  ├── scripts/ # Helper scripts
63
68
  └── logs/ # Execution logs
64
69
  ```
70
+ <!-- /SECTION -->
65
71
 
66
72
  ---
67
73
 
74
+ <!-- SECTION:commands required -->
68
75
  ## Commands Reference {#commands}
69
76
 
70
77
  ### Core Commands
@@ -86,9 +93,11 @@
86
93
  | `/sw-github:sync 0001` | Sync increment to GitHub issue |
87
94
  | `/sw-jira:sync 0001` | Sync to Jira |
88
95
  | `/sw-ado:sync 0001` | Sync to Azure DevOps |
96
+ <!-- /SECTION -->
89
97
 
90
98
  ---
91
99
 
100
+ <!-- SECTION:nonclaudetools required -->
92
101
  ## Non-Claude Tools (Cursor, Copilot, etc.) {#non-claude-tools}
93
102
 
94
103
  **CRITICAL**: Claude Code has automatic hooks. Other tools DO NOT.
@@ -339,9 +348,11 @@ cat plugins/specweave/commands/increment.md
339
348
  ```
340
349
 
341
350
  **Without these manual steps, your work won't be tracked!**
351
+ <!-- /SECTION -->
342
352
 
343
353
  ---
344
354
 
355
+ <!-- SECTION:syncworkflow -->
345
356
  ## Sync Workflow {#sync-workflow}
346
357
 
347
358
  ### Source of Truth Hierarchy
@@ -421,9 +432,11 @@ TASK COMPLETED
421
432
  | `PostIncrementDone` | Increment closed | Closes issues, syncs all docs |
422
433
 
423
434
  **Non-Claude tools**: NO HOOKS EXIST. See "Hook Behavior You Must Mimic" section above.
435
+ <!-- /SECTION -->
424
436
 
425
437
  ---
426
438
 
439
+ <!-- SECTION:contextloading -->
427
440
  ## Context Loading {#context-loading}
428
441
 
429
442
  ### Efficient Context Management
@@ -441,9 +454,11 @@ Read only what's needed for the current task:
441
454
  2. Reference `spec.md` for acceptance criteria
442
455
  3. Load living docs only when needed for context
443
456
  4. Avoid loading entire documentation trees
457
+ <!-- /SECTION -->
444
458
 
445
459
  ---
446
460
 
461
+ <!-- SECTION:structure -->
447
462
  ## Project Structure
448
463
 
449
464
  ```
@@ -462,17 +477,21 @@ Read only what's needed for the current task:
462
477
  │ └── delivery/ # CI/CD, deployment guides
463
478
  └── state/ # Runtime state (active increment, caches)
464
479
  ```
480
+ <!-- /SECTION -->
465
481
 
466
482
  ---
467
483
 
484
+ <!-- SECTION:agents -->
468
485
  ## Agents (Roles)
469
486
 
470
487
  {AGENTS_SECTION}
471
488
 
472
489
  **Usage**: Adopt role perspective when working on related tasks.
490
+ <!-- /SECTION -->
473
491
 
474
492
  ---
475
493
 
494
+ <!-- SECTION:skills -->
476
495
  ## Skills (Capabilities)
477
496
 
478
497
  {SKILLS_SECTION}
@@ -520,9 +539,11 @@ AI: [Creates .specweave/increments/0001-auth/spec.md with **Project**: my-app pe
520
539
  ```
521
540
 
522
541
  **⛔ CRITICAL**: The AI MUST run `specweave context projects` BEFORE creating spec.md, and use the output values in every `**Project**:` field!
542
+ <!-- /SECTION -->
523
543
 
524
544
  ---
525
545
 
546
+ <!-- SECTION:taskformat required -->
526
547
  ## Task Format
527
548
 
528
549
  ```markdown
@@ -534,7 +555,11 @@ AI: [Creates .specweave/increments/0001-auth/spec.md with **Project**: my-app pe
534
555
  **Test Plan** (BDD):
535
556
  - Given [context] → When [action] → Then [result]
536
557
  ```
558
+ <!-- /SECTION -->
537
559
 
560
+ ---
561
+
562
+ <!-- SECTION:usformat required -->
538
563
  ## User Story Format (CRITICAL for spec.md) {#user-story-format}
539
564
 
540
565
  **⛔ MANDATORY: Every User Story MUST have `**Project**:` field!**
@@ -566,9 +591,11 @@ specweave context projects
566
591
  # {"level":2,"projects":[...],"boardsByProject":{"corp":[{"id":"digital-ops"}]}}
567
592
  # → Use: **Project**: corp AND **Board**: digital-ops
568
593
  ```
594
+ <!-- /SECTION -->
569
595
 
570
596
  ---
571
597
 
598
+ <!-- SECTION:workflows -->
572
599
  ## Workflows
573
600
 
574
601
  ### Creating Increment
@@ -623,9 +650,11 @@ title: "Feature Title"
623
650
  2. PM validates 3 gates (tasks, tests, docs)
624
651
  3. Living docs synced automatically
625
652
  4. GitHub issue closed (if enabled)
653
+ <!-- /SECTION -->
626
654
 
627
655
  ---
628
656
 
657
+ <!-- SECTION:plugincommands -->
629
658
  ## Plugin Commands
630
659
 
631
660
  | Command | Plugin |
@@ -633,9 +662,11 @@ title: "Feature Title"
633
662
  | `/sw-github:sync` | GitHub sync |
634
663
  | `/sw-jira:sync` | Jira sync |
635
664
  | `/sw-ado:sync` | Azure DevOps |
665
+ <!-- /SECTION -->
636
666
 
637
667
  ---
638
668
 
669
+ <!-- SECTION:troubleshooting required -->
639
670
  ## Troubleshooting {#troubleshooting}
640
671
 
641
672
  ### Commands Not Working
@@ -738,9 +769,11 @@ npx playwright test
738
769
  - Reading skill files manually
739
770
  - Following the workflows inside
740
771
  - Running `npx` instead of MCP tools (better anyway!)
772
+ <!-- /SECTION -->
741
773
 
742
774
  ---
743
775
 
776
+ <!-- SECTION:docs -->
744
777
  ## Documentation
745
778
 
746
779
  | Resource | Purpose |
@@ -749,6 +782,7 @@ npx playwright test
749
782
  | AGENTS.md | This file (non-Claude tools) |
750
783
  | spec-weave.com | Official documentation |
751
784
  | .specweave/docs/ | Project-specific docs |
785
+ <!-- /SECTION -->
752
786
 
753
787
  ---
754
788
 
@@ -1,208 +1,174 @@
1
- # {PROJECT_NAME} - SpecWeave Quick Reference
1
+ # {PROJECT_NAME} - SpecWeave Reference
2
2
 
3
- **Framework**: SpecWeave (spec-first development)
4
- **Source of Truth**: `spec.md` + `tasks.md` (not internal TODO)
3
+ <!-- SECTION:header required -->
4
+ **Framework**: SpecWeave | **Truth**: `spec.md` + `tasks.md`
5
+ <!-- /SECTION -->
5
6
 
6
- ---
7
+ <!-- SECTION:start -->
8
+ ## Getting Started
7
9
 
8
- ## Critical Rules
10
+ **Initial increment**: `0001-project-setup` (auto-created by `specweave init`)
9
11
 
10
- ### 1. File Organization
11
- **NEVER pollute project root!** All AI-generated files → increment folders.
12
+ **Options**:
13
+ 1. **Start fresh**: `rm -rf .specweave/increments/0001-project-setup``/sw:increment "your-feature"`
14
+ 2. **Customize**: Edit spec.md and use for setup tasks
15
+ <!-- /SECTION -->
12
16
 
13
- ```
14
- .specweave/increments/####-name/
15
- ├── spec.md, plan.md, tasks.md ← ONLY these at root
16
- ├── reports/ ← Reports, summaries, analysis
17
- ├── scripts/ ← Helper scripts, migrations
18
- └── logs/ ← Execution logs, temp data
19
- ```
17
+ <!-- SECTION:autodetect -->
18
+ ## Auto-Detection
20
19
 
21
- ### 2. Source of Truth
22
- After completing work, **IMMEDIATELY update both files**:
23
- ```typescript
24
- TodoWrite([{task: "T-001", status: "completed"}]);
25
- Edit("tasks.md", "**Status**: [ ] pending", "**Status**: [x] completed");
26
- Edit("spec.md", "- [ ] **AC-US1-01**", "- [x] **AC-US1-01**");
27
- ```
20
+ SpecWeave auto-detects product descriptions and routes to `/sw:increment`:
28
21
 
29
- ### 3. Increment Numbers Must Be Unique
30
- **Format**: `####-descriptive-name` (e.g., `0001-user-auth`)
31
- **Check before creating**: `ls -1 .specweave/increments/ | grep -E "^[0-9]{4}-" | sort | tail -5`
22
+ **Signals** (5+ = auto-route): Project name | Features list (3+) | Tech stack | Timeline/MVP | Problem statement | Business model
32
23
 
33
- ### 4. Emergency Minimal Mode
24
+ **Opt-out phrases**: "Just brainstorm first" | "Don't plan yet" | "Quick discussion" | "Let's explore ideas"
25
+ <!-- /SECTION -->
34
26
 
35
- **Activates ONLY on**: "emergency mode", "minimal mode ON", "crashed N times"
27
+ <!-- SECTION:metarule required -->
28
+ ## Meta-Rule: Think-Before-Act
36
29
 
37
- **Rules:** `READ: limit:50 | EDIT: 1/response | AGENTS: none | FLOW: "Done. Next?"`
30
+ **Satisfy dependencies BEFORE dependent operations.**
38
31
 
39
- **Phrase:** `EMERGENCY MODE. 1 edit. 50 lines max. No agents.`
32
+ ```
33
+ ❌ node script.js → Error → npm run build
34
+ ✅ npm run build → node script.js → Success
35
+ ```
36
+ <!-- /SECTION -->
40
37
 
41
- ---
38
+ <!-- SECTION:rules required -->
39
+ ## Rules
42
40
 
43
- ## Core Workflow
41
+ 1. **Files** → `.specweave/increments/####-name/` (spec.md, plan.md, tasks.md at root; reports/, scripts/, logs/ subfolders)
42
+ 2. **Update immediately**: `Edit("tasks.md", "[ ] pending", "[x] completed")` + `Edit("spec.md", "[ ] AC-", "[x] AC-")`
43
+ 3. **Unique IDs**: Check `ls .specweave/increments/ | grep "^[0-9]" | tail -5`
44
+ 4. **Emergency**: "emergency mode" → 1 edit, 50 lines max, no agents
45
+ 5. **Root clean**: NEVER create .md/reports/scripts in project root → use increment folders
46
+ <!-- /SECTION -->
44
47
 
45
- ```
46
- /sw:increment "feature" → /sw:do → /sw:progress → /sw:done 0001
47
- ```
48
+ <!-- SECTION:workflow required -->
49
+ ## Workflow
48
50
 
49
- | Command | Purpose |
50
- |---------|---------|
51
- | `/sw:increment "X"` | Plan new feature |
52
- | `/sw:do` | Execute implementation |
53
- | `/sw:progress` | Check status |
54
- | `/sw:validate 0001` | Quality check |
55
- | `/sw:done 0001` | Close increment |
51
+ `/sw:increment "X"` `/sw:do` → `/sw:progress` → `/sw:done 0001`
56
52
 
57
- **Sync Commands** (if plugins installed):
58
- - `/sw-github:sync` - Sync to GitHub Issues
59
- - `/sw-jira:sync` - Sync to Jira
60
- - `/sw-ado:sync` - Sync to Azure DevOps
53
+ | Cmd | Action |
54
+ |-----|--------|
55
+ | `/sw:increment` | Plan feature |
56
+ | `/sw:do` | Execute |
57
+ | `/sw:validate` | Quality check |
58
+ | `/sw:done` | Close |
59
+ | `/sw-github:sync` | GitHub sync |
60
+ | `/sw-jira:sync` | Jira sync |
61
61
 
62
- ---
62
+ **Natural language**: "Let's build X" → `/sw:increment` | "What's status?" → `/sw:progress` | "We're done" → `/sw:done`
63
+ <!-- /SECTION -->
63
64
 
64
- ## Project Structure
65
+ <!-- SECTION:structure -->
66
+ ## Structure
65
67
 
66
68
  ```
67
69
  .specweave/
68
- ├── increments/ # Feature increments (####-name/)
69
- │ └── 0001-feature/
70
- │ ├── metadata.json # Increment metadata - REQUIRED
71
- │ ├── spec.md # WHAT & WHY
72
- │ ├── plan.md # HOW (optional)
73
- │ └── tasks.md # Checklist with embedded tests
70
+ ├── increments/####-name/ # metadata.json, spec.md, tasks.md
74
71
  ├── docs/internal/
75
- │ ├── strategy/ # Business specs
76
- │ ├── specs/ # Living docs (post-completion)
77
- └── {project}/ # Project-specific specs
78
- │ ├── architecture/ # Technical design, ADRs
79
- │ └── operations/ # Runbooks, SLOs
80
- └── config.json # Project configuration
72
+ │ ├── specs/{project}/ # Living docs
73
+ │ ├── architecture/adr/ # ADRs
74
+ │ └── operations/ # Runbooks
75
+ └── config.json
81
76
  ```
82
77
 
83
- ---
78
+ **Multi-repo**: Clone to `/repositories`, not root → `repositories/backend/src/...`
79
+ <!-- /SECTION -->
84
80
 
85
- ## Task Format (Mandatory)
81
+ <!-- SECTION:taskformat required -->
82
+ ## Task Format
86
83
 
87
84
  ```markdown
88
- ### T-001: Task Title
89
- **User Story**: US-001 REQUIRED
90
- **Satisfies ACs**: AC-US1-01 ← REQUIRED
91
- **Status**: [x] completed
92
-
93
- **Test Plan** (BDD):
94
- - **Given** [context] → **When** [action] → **Then** [result]
85
+ ### T-001: Title
86
+ **User Story**: US-001 | **Satisfies ACs**: AC-US1-01 | **Status**: [x] completed
87
+ **Test**: Given [X] → When [Y] → Then [Z]
95
88
  ```
89
+ <!-- /SECTION -->
96
90
 
97
- ---
98
-
99
- ## Increment Files
100
-
101
- **Required files** for every increment:
102
- 1. `metadata.json` - Increment metadata (status, type, dates) - MUST create FIRST
103
- 2. `spec.md` - User stories, acceptance criteria
104
- 3. `tasks.md` - Implementation tasks with embedded tests
91
+ <!-- SECTION:secrets required -->
92
+ ## Secrets Check
105
93
 
106
- **Optional**:
107
- - `plan.md` - Technical design (for complex features only)
108
- - `reports/` - Completion reports, analyses
109
-
110
- ---
94
+ **BEFORE CLI tools**: Check existing config first!
95
+ ```bash
96
+ grep -E "(GITHUB_TOKEN|JIRA_|ADO_)" .env 2>/dev/null
97
+ cat .specweave/config.json | grep -A5 '"sync"'
98
+ gh auth status
99
+ ```
100
+ <!-- /SECTION -->
111
101
 
112
- ## Automatic Syncing (Hooks)
102
+ <!-- SECTION:syncing -->
103
+ ## Auto-Sync (Hooks)
113
104
 
114
- After **EVERY task completion**, hooks automatically:
115
- 1. Update `tasks.md` status
116
- 2. Sync to living docs (`.specweave/docs/internal/specs/`)
117
- 3. Sync to external trackers (GitHub/Jira/ADO) if configured
105
+ Post-task: updates tasks.md living docs → external trackers (if configured)
118
106
 
119
- **Configuration** (`.specweave/config.json`):
120
- ```json
121
- {
122
- "hooks": {
123
- "post_task_completion": {
124
- "sync_living_docs": true,
125
- "external_tracker_sync": true
126
- }
127
- }
128
- }
129
- ```
107
+ Config: `.specweave/config.json` → `hooks.post_task_completion`
108
+ <!-- /SECTION -->
130
109
 
131
- ---
132
-
133
- ## GitHub Sync Mapping
110
+ <!-- SECTION:mapping -->
111
+ ## GitHub Mapping
134
112
 
135
113
  | SpecWeave | GitHub |
136
114
  |-----------|--------|
137
- | Feature (FS-XXX) | Milestone |
138
- | User Story (US-XXX) | Issue |
139
- | Task (T-XXX) | Checkbox |
140
-
141
- **Issue Title Format**: `[FS-XXX][US-YYY] User Story Title`
142
-
143
- ---
144
-
145
- ## Tech Stack
146
-
147
- **Type**: {MONOREPO_OR_SINGLE}
148
-
149
- {#IF_SINGLE_STACK}
150
- - Language: {DETECTED_LANGUAGE}
151
- - Framework: {DETECTED_FRAMEWORK}
152
- - Database: {SPECIFIED_DATABASE}
153
- {#ENDIF}
154
-
155
- {#IF_MONOREPO}
156
- **Services**:
157
- - {SERVICE_1_NAME}: {SERVICE_1_LANGUAGE} ({SERVICE_1_PATH}/)
158
- - {SERVICE_2_NAME}: {SERVICE_2_LANGUAGE} ({SERVICE_2_PATH}/)
159
- {#ENDIF}
160
-
161
- ---
115
+ | Feature FS-XXX | Milestone |
116
+ | Story US-XXX | Issue `[FS-XXX][US-YYY] Title` |
117
+ | Task T-XXX | Checkbox |
118
+ <!-- /SECTION -->
162
119
 
120
+ <!-- SECTION:testing -->
163
121
  ## Testing
164
122
 
165
- **Test-Aware Planning**: Tests embedded in `tasks.md` (BDD format)
166
- - Unit tests: >80% coverage
167
- - Integration tests: Critical paths
168
- - E2E tests: When UI exists
169
-
170
- **Test Files**: `.test.ts` (Vitest), NOT `.spec.ts`
171
-
172
- ---
123
+ BDD in tasks.md | Unit >80% | `.test.ts` (Vitest)
173
124
 
174
- ## File Size
125
+ ```typescript
126
+ // Vitest pattern: vi.fn() not jest.fn(), import not require
127
+ import { vi } from 'vitest';
128
+ vi.mock('fs', () => ({ readFile: vi.fn() }));
129
+ ```
130
+ <!-- /SECTION -->
175
131
 
176
- **Max 1500 lines/file**. Over 1000 → extract before adding code.
132
+ <!-- SECTION:limits -->
133
+ ## Limits
177
134
 
178
- ---
135
+ **Max 1500 lines/file** — extract before adding
136
+ <!-- /SECTION -->
179
137
 
138
+ <!-- SECTION:troubleshooting required -->
180
139
  ## Troubleshooting
181
140
 
182
- | Issue | Solution |
183
- |-------|----------|
184
- | Skills not activating | Restart Claude Code |
185
- | Commands not found | Check plugin: `/plugin list --installed` |
186
- | Root polluted | Move files to increment folders |
187
- | Tasks out of sync | `/sw:sync-tasks` |
188
- | Can't find increment | `/sw:status` |
189
-
190
- ---
141
+ | Issue | Fix |
142
+ |-------|-----|
143
+ | Skills missing | Restart Claude Code |
144
+ | Commands gone | `/plugin list --installed` |
145
+ | Out of sync | `/sw:sync-tasks` |
146
+ | Find increment | `/sw:status` |
147
+ | Root polluted | Move files to `.specweave/increments/####/reports/` |
148
+ | Duplicate IDs | `/sw:fix-duplicates` |
149
+ | External not syncing | Check `config.json` → `external_tracker_sync: true` |
150
+ <!-- /SECTION -->
191
151
 
192
- ## Documentation
152
+ <!-- SECTION:principles -->
153
+ ## Principles
193
154
 
194
- - **Quick Reference**: This file
195
- - **Full Docs**: https://spec-weave.com
196
- - **Project Docs**: `.specweave/docs/internal/`
155
+ 1. **Spec-first**: `/sw:increment` before coding
156
+ 2. **Docs = truth**: Specs guide implementation
157
+ 3. **Incremental**: Small, validated increments
158
+ 4. **Traceable**: All work → specs → ACs
159
+ 5. **Clean**: All files in increment folders
160
+ <!-- /SECTION -->
197
161
 
198
- ---
162
+ <!-- SECTION:linking -->
163
+ ## Bidirectional Linking
199
164
 
200
- ## Project-Specific Notes
165
+ Tasks ↔ User Stories auto-linked via AC-IDs: `AC-US1-01` → `US-001`
201
166
 
202
- {#CUSTOM_NOTES}
203
- <!-- Add project-specific conventions here -->
204
- {#ENDCUSTOM}
167
+ Task format: `**AC**: AC-US1-01, AC-US1-02` (CRITICAL for linking)
168
+ <!-- /SECTION -->
205
169
 
206
- ---
170
+ <!-- SECTION:docs -->
171
+ ## Docs
207
172
 
208
- **SpecWeave**: Specification-first AI development framework
173
+ [spec-weave.com](https://spec-weave.com) | `.specweave/docs/internal/`
174
+ <!-- /SECTION -->