specweave 1.0.550 → 1.0.552

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 (166) hide show
  1. package/CLAUDE.md +1 -1
  2. package/bin/specweave.js +23 -1
  3. package/dist/src/cli/commands/hook.d.ts +15 -0
  4. package/dist/src/cli/commands/hook.d.ts.map +1 -0
  5. package/dist/src/cli/commands/hook.js +61 -0
  6. package/dist/src/cli/commands/hook.js.map +1 -0
  7. package/dist/src/cli/commands/init.d.ts.map +1 -1
  8. package/dist/src/cli/commands/init.js +5 -0
  9. package/dist/src/cli/commands/init.js.map +1 -1
  10. package/dist/src/cli/commands/refresh-plugins.d.ts.map +1 -1
  11. package/dist/src/cli/commands/refresh-plugins.js +11 -1
  12. package/dist/src/cli/commands/refresh-plugins.js.map +1 -1
  13. package/dist/src/cli/commands/sync-setup.d.ts.map +1 -1
  14. package/dist/src/cli/commands/sync-setup.js +7 -3
  15. package/dist/src/cli/commands/sync-setup.js.map +1 -1
  16. package/dist/src/cli/helpers/issue-tracker/project-mapping-wizard.d.ts +9 -0
  17. package/dist/src/cli/helpers/issue-tracker/project-mapping-wizard.d.ts.map +1 -1
  18. package/dist/src/cli/helpers/issue-tracker/project-mapping-wizard.js +9 -3
  19. package/dist/src/cli/helpers/issue-tracker/project-mapping-wizard.js.map +1 -1
  20. package/dist/src/config/types.d.ts +2 -2
  21. package/dist/src/core/config/types.d.ts +18 -2
  22. package/dist/src/core/config/types.d.ts.map +1 -1
  23. package/dist/src/core/config/types.js.map +1 -1
  24. package/dist/src/core/hooks/handlers/hook-router.d.ts +19 -0
  25. package/dist/src/core/hooks/handlers/hook-router.d.ts.map +1 -0
  26. package/dist/src/core/hooks/handlers/hook-router.js +75 -0
  27. package/dist/src/core/hooks/handlers/hook-router.js.map +1 -0
  28. package/dist/src/core/hooks/handlers/index.d.ts +10 -0
  29. package/dist/src/core/hooks/handlers/index.d.ts.map +1 -0
  30. package/dist/src/core/hooks/handlers/index.js +9 -0
  31. package/dist/src/core/hooks/handlers/index.js.map +1 -0
  32. package/dist/src/core/hooks/handlers/post-tool-use-analytics.d.ts +11 -0
  33. package/dist/src/core/hooks/handlers/post-tool-use-analytics.d.ts.map +1 -0
  34. package/dist/src/core/hooks/handlers/post-tool-use-analytics.js +73 -0
  35. package/dist/src/core/hooks/handlers/post-tool-use-analytics.js.map +1 -0
  36. package/dist/src/core/hooks/handlers/post-tool-use.d.ts +11 -0
  37. package/dist/src/core/hooks/handlers/post-tool-use.d.ts.map +1 -0
  38. package/dist/src/core/hooks/handlers/post-tool-use.js +76 -0
  39. package/dist/src/core/hooks/handlers/post-tool-use.js.map +1 -0
  40. package/dist/src/core/hooks/handlers/pre-compact.d.ts +11 -0
  41. package/dist/src/core/hooks/handlers/pre-compact.d.ts.map +1 -0
  42. package/dist/src/core/hooks/handlers/pre-compact.js +77 -0
  43. package/dist/src/core/hooks/handlers/pre-compact.js.map +1 -0
  44. package/dist/src/core/hooks/handlers/pre-tool-use.d.ts +11 -0
  45. package/dist/src/core/hooks/handlers/pre-tool-use.d.ts.map +1 -0
  46. package/dist/src/core/hooks/handlers/pre-tool-use.js +318 -0
  47. package/dist/src/core/hooks/handlers/pre-tool-use.js.map +1 -0
  48. package/dist/src/core/hooks/handlers/session-start.d.ts +9 -0
  49. package/dist/src/core/hooks/handlers/session-start.d.ts.map +1 -0
  50. package/dist/src/core/hooks/handlers/session-start.js +111 -0
  51. package/dist/src/core/hooks/handlers/session-start.js.map +1 -0
  52. package/dist/src/core/hooks/handlers/stop-auto.d.ts +16 -0
  53. package/dist/src/core/hooks/handlers/stop-auto.d.ts.map +1 -0
  54. package/dist/src/core/hooks/handlers/stop-auto.js +122 -0
  55. package/dist/src/core/hooks/handlers/stop-auto.js.map +1 -0
  56. package/dist/src/core/hooks/handlers/stop-reflect.d.ts +14 -0
  57. package/dist/src/core/hooks/handlers/stop-reflect.d.ts.map +1 -0
  58. package/dist/src/core/hooks/handlers/stop-reflect.js +43 -0
  59. package/dist/src/core/hooks/handlers/stop-reflect.js.map +1 -0
  60. package/dist/src/core/hooks/handlers/stop-sync.d.ts +15 -0
  61. package/dist/src/core/hooks/handlers/stop-sync.d.ts.map +1 -0
  62. package/dist/src/core/hooks/handlers/stop-sync.js +68 -0
  63. package/dist/src/core/hooks/handlers/stop-sync.js.map +1 -0
  64. package/dist/src/core/hooks/handlers/types.d.ts +63 -0
  65. package/dist/src/core/hooks/handlers/types.d.ts.map +1 -0
  66. package/dist/src/core/hooks/handlers/types.js +27 -0
  67. package/dist/src/core/hooks/handlers/types.js.map +1 -0
  68. package/dist/src/core/hooks/handlers/user-prompt-submit.d.ts +14 -0
  69. package/dist/src/core/hooks/handlers/user-prompt-submit.d.ts.map +1 -0
  70. package/dist/src/core/hooks/handlers/user-prompt-submit.js +173 -0
  71. package/dist/src/core/hooks/handlers/user-prompt-submit.js.map +1 -0
  72. package/dist/src/core/hooks/handlers/utils.d.ts +25 -0
  73. package/dist/src/core/hooks/handlers/utils.d.ts.map +1 -0
  74. package/dist/src/core/hooks/handlers/utils.js +64 -0
  75. package/dist/src/core/hooks/handlers/utils.js.map +1 -0
  76. package/dist/src/core/increment/completion-validator.d.ts.map +1 -1
  77. package/dist/src/core/increment/completion-validator.js +32 -0
  78. package/dist/src/core/increment/completion-validator.js.map +1 -1
  79. package/dist/src/init/research/types.d.ts +1 -1
  80. package/dist/src/sync/sync-target-resolver.js.map +1 -1
  81. package/dist/src/utils/lock-manager.d.ts.map +1 -1
  82. package/dist/src/utils/lock-manager.js +5 -0
  83. package/dist/src/utils/lock-manager.js.map +1 -1
  84. package/dist/src/utils/plugin-copier.d.ts +10 -0
  85. package/dist/src/utils/plugin-copier.d.ts.map +1 -1
  86. package/dist/src/utils/plugin-copier.js +63 -35
  87. package/dist/src/utils/plugin-copier.js.map +1 -1
  88. package/package.json +1 -1
  89. package/plugins/specweave/agents/sw-closer.md +3 -2
  90. package/plugins/specweave/hooks/hooks.json +10 -10
  91. package/plugins/specweave/skills/code-reviewer/SKILL.md +180 -16
  92. package/plugins/specweave/skills/code-reviewer/agents/reviewer-comments.md +83 -0
  93. package/plugins/specweave/skills/code-reviewer/agents/reviewer-silent-failures.md +19 -0
  94. package/plugins/specweave/skills/code-reviewer/agents/reviewer-spec-compliance.md +19 -0
  95. package/plugins/specweave/skills/code-reviewer/agents/reviewer-tests.md +101 -0
  96. package/plugins/specweave/skills/code-reviewer/agents/reviewer-types.md +20 -0
  97. package/plugins/specweave/skills/done/SKILL.md +56 -21
  98. package/plugins/specweave/skills/grill/SKILL.md +1 -1
  99. package/plugins/specweave/skills/team-lead/agents/reviewer-logic.md +19 -0
  100. package/plugins/specweave/skills/team-lead/agents/reviewer-performance.md +20 -0
  101. package/plugins/specweave/skills/team-lead/agents/reviewer-security.md +20 -0
  102. package/src/templates/CLAUDE.md.template +7 -4
  103. package/plugins/specweave/hooks/README.md +0 -493
  104. package/plugins/specweave/hooks/_archive/stop-auto-v4-legacy.sh +0 -1319
  105. package/plugins/specweave/hooks/lib/common-setup.sh +0 -144
  106. package/plugins/specweave/hooks/lib/hook-errors.sh +0 -414
  107. package/plugins/specweave/hooks/lib/migrate-increment-work.sh +0 -245
  108. package/plugins/specweave/hooks/lib/resolve-package.sh +0 -146
  109. package/plugins/specweave/hooks/lib/scheduler-startup.sh +0 -135
  110. package/plugins/specweave/hooks/lib/score-increment.sh +0 -87
  111. package/plugins/specweave/hooks/lib/sync-spec-content.sh +0 -193
  112. package/plugins/specweave/hooks/lib/update-active-increment.sh +0 -95
  113. package/plugins/specweave/hooks/lib/update-status-line.sh +0 -233
  114. package/plugins/specweave/hooks/lib/validate-spec-status.sh +0 -171
  115. package/plugins/specweave/hooks/llm-judge-validator.sh +0 -219
  116. package/plugins/specweave/hooks/log-decision.sh +0 -168
  117. package/plugins/specweave/hooks/pre-compact.sh +0 -64
  118. package/plugins/specweave/hooks/startup-health-check.sh +0 -64
  119. package/plugins/specweave/hooks/stop-auto-v5.sh +0 -276
  120. package/plugins/specweave/hooks/stop-reflect.sh +0 -336
  121. package/plugins/specweave/hooks/stop-sync.sh +0 -283
  122. package/plugins/specweave/hooks/tests/test-auto-context-integration.sh +0 -126
  123. package/plugins/specweave/hooks/tests/test-stop-auto-enriched.sh +0 -128
  124. package/plugins/specweave/hooks/universal/dispatcher.mjs +0 -336
  125. package/plugins/specweave/hooks/universal/fail-fast-wrapper.sh +0 -325
  126. package/plugins/specweave/hooks/universal/hook-wrapper.cmd +0 -26
  127. package/plugins/specweave/hooks/universal/hook-wrapper.sh +0 -69
  128. package/plugins/specweave/hooks/universal/run-hook.sh +0 -20
  129. package/plugins/specweave/hooks/universal/session-start.cmd +0 -16
  130. package/plugins/specweave/hooks/universal/session-start.ps1 +0 -16
  131. package/plugins/specweave/hooks/user-prompt-submit.sh +0 -2550
  132. package/plugins/specweave/hooks/v2/detectors/lifecycle-detector.sh +0 -87
  133. package/plugins/specweave/hooks/v2/detectors/us-completion-detector.sh +0 -186
  134. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use-analytics.sh +0 -83
  135. package/plugins/specweave/hooks/v2/dispatchers/post-tool-use.sh +0 -447
  136. package/plugins/specweave/hooks/v2/dispatchers/pre-tool-use.sh +0 -104
  137. package/plugins/specweave/hooks/v2/dispatchers/session-start.sh +0 -270
  138. package/plugins/specweave/hooks/v2/guards/completion-guard.sh +0 -14
  139. package/plugins/specweave/hooks/v2/guards/increment-duplicate-guard.sh +0 -14
  140. package/plugins/specweave/hooks/v2/guards/increment-existence-guard.sh +0 -240
  141. package/plugins/specweave/hooks/v2/guards/interview-enforcement-guard.sh +0 -171
  142. package/plugins/specweave/hooks/v2/guards/metadata-json-guard.sh +0 -14
  143. package/plugins/specweave/hooks/v2/guards/skill-chain-enforcement-guard.sh +0 -222
  144. package/plugins/specweave/hooks/v2/guards/spec-template-enforcement-guard.sh +0 -21
  145. package/plugins/specweave/hooks/v2/guards/spec-validation-guard.sh +0 -14
  146. package/plugins/specweave/hooks/v2/guards/status-completion-guard.sh +0 -84
  147. package/plugins/specweave/hooks/v2/guards/task-ac-sync-guard.sh +0 -475
  148. package/plugins/specweave/hooks/v2/guards/tdd-enforcement-guard.sh +0 -268
  149. package/plugins/specweave/hooks/v2/handlers/ac-sync-dispatcher.sh +0 -332
  150. package/plugins/specweave/hooks/v2/handlers/ac-validation-handler.sh +0 -50
  151. package/plugins/specweave/hooks/v2/handlers/github-sync-handler.sh +0 -347
  152. package/plugins/specweave/hooks/v2/handlers/living-docs-handler.sh +0 -83
  153. package/plugins/specweave/hooks/v2/handlers/living-specs-handler.sh +0 -268
  154. package/plugins/specweave/hooks/v2/handlers/project-bridge-handler.sh +0 -104
  155. package/plugins/specweave/hooks/v2/handlers/status-line-handler.sh +0 -165
  156. package/plugins/specweave/hooks/v2/handlers/status-update.sh +0 -61
  157. package/plugins/specweave/hooks/v2/handlers/universal-auto-create-dispatcher.sh +0 -270
  158. package/plugins/specweave/hooks/v2/integrations/ado-post-living-docs-update.sh +0 -367
  159. package/plugins/specweave/hooks/v2/integrations/ado-post-task.sh +0 -179
  160. package/plugins/specweave/hooks/v2/integrations/github-auto-create-handler.sh +0 -553
  161. package/plugins/specweave/hooks/v2/integrations/github-post-task.sh +0 -345
  162. package/plugins/specweave/hooks/v2/integrations/jira-post-task.sh +0 -180
  163. package/plugins/specweave/hooks/v2/lib/check-provider-enabled.sh +0 -52
  164. package/plugins/specweave/hooks/v2/queue/enqueue.sh +0 -81
  165. package/plugins/specweave/hooks/v2/session-end.sh +0 -139
  166. package/plugins/specweave/hooks/validate-skill-activations.sh +0 -227
@@ -1,493 +0,0 @@
1
- # SpecWeave Core Plugin Hooks
2
-
3
- **Plugin**: `specweave` (core plugin)
4
- **Location**: `plugins/specweave/hooks/`
5
-
6
- ---
7
-
8
- ## Purpose
9
-
10
- Core hooks automate SpecWeave's fundamental workflows:
11
- - **Sound notifications** when tasks complete (plays when task marked `[x]` in tasks.md)
12
- - **Living docs sync** after task completion
13
- - **Translation** of non-English documentation
14
- - **Self-reflection** for AI-driven quality improvements
15
- - **Auto mode loops** for autonomous execution
16
-
17
- **Note**: External tool sync (GitHub, JIRA, Azure DevOps) has been moved to respective plugin hooks. See "Architecture Changes" section below.
18
-
19
- ---
20
-
21
- ## Available Hooks
22
-
23
- ### 1. `user-prompt-submit.sh`
24
- **Triggers**: BEFORE user's command executes (prompt-based hook)
25
-
26
- **Actions** (Zero-Token Validation):
27
- 1. **Discipline enforcement** - Blocks `sw:increment` if incomplete increments exist
28
- 2. **Context injection** - Adds active increment status to every prompt
29
- 3. **Command suggestions** - Guides users to SpecWeave commands
30
-
31
- **Why This Is Better**:
32
- - ✅ **Zero LLM tokens** - Shell script validation (no PM agent invocation)
33
- - ✅ **Instant blocking** - User gets feedback before Claude even thinks
34
- - ✅ **Always current** - Context injected into every conversation
35
- - ✅ **Better UX** - Proactive guidance for new users
36
-
37
- **Example Output** (blocking):
38
- ```json
39
- {
40
- "decision": "block",
41
- "reason": "❌ Cannot create new increment! You have 2 incomplete increment(s)..."
42
- }
43
- ```
44
-
45
- **Example Output** (context injection):
46
- ```json
47
- {
48
- "decision": "approve",
49
- "systemMessage": "📍 Active Increment: 0017-sync-architecture-fix (73% complete, 11/15 tasks)\n\n💡 TIP: Consider using SpecWeave commands..."
50
- }
51
- ```
52
-
53
- ---
54
-
55
- ### 2. `post-task-completion.sh`
56
- **Triggers**: After ANY task is marked complete (via TodoWrite tool)
57
-
58
- **Actions** (Core Concerns Only):
59
- 1. **Session-end detection** - Smart inactivity tracking (15s threshold)
60
- 2. **Sound notification** - Glass.aiff on macOS (only when session truly ends)
61
- 3. **tasks.md updates** - Sync completion status from TodoWrite
62
- 4. **Living docs sync** - Update permanent specs after completion
63
- 5. **Translation** - Auto-translate non-English docs to English
64
- 6. **Self-reflection** - Prepare AI reflection context
65
-
66
- **Sound**: Glass.aiff (or system equivalent)
67
-
68
- **Architecture Note**: External tool sync (GitHub, JIRA, ADO) has been **removed from this hook** and moved to respective plugin hooks:
69
- - `plugins/specweave-github/hooks/post-task-completion.sh`
70
- - `plugins/specweave-jira/hooks/post-task-completion.sh`
71
- - `plugins/specweave-ado/hooks/post-task-completion.sh`
72
-
73
- **Benefits**:
74
- - ✅ **27% smaller** (330 lines, down from 452)
75
- - ✅ **No external tool dependencies** (gh CLI, JIRA API, ADO API)
76
- - ✅ **Cleaner separation** (core vs. external concerns)
77
- - ✅ **Optional plugins** (GitHub sync only runs if plugin installed)
78
-
79
- ---
80
-
81
- ### 2. `human-input-required.sh`
82
- **Triggers**: When Claude needs clarification or approval
83
-
84
- **Actions**:
85
- 1. Plays notification sound (Ping.aiff on macOS, equivalent on Linux/Windows)
86
- 2. Logs the question/requirement to `.specweave/logs/hooks.log`
87
- 3. Records in current work context (`.specweave/work/current-*/notes.md`)
88
-
89
- **Sound**: Ping.aiff (or system equivalent)
90
-
91
- ---
92
-
93
- ### 3. `docs-changed.sh`
94
- **Triggers**: After file changes are detected (git)
95
-
96
- **Actions**:
97
- 1. Detects if documentation files changed (`.specweave/docs/`, `.specweave/increments/`)
98
- 2. Plays notification sound if docs changed
99
- 3. Recommends review workflow
100
- 4. Logs documentation changes
101
-
102
- **Sound**: Ping.aiff (warning sound)
103
-
104
- **Use case**: During implementation, if architecture needs to change, this hook alerts the user to review and approve doc updates before continuing
105
-
106
- ---
107
-
108
- ### 4. `pre-implementation.sh`
109
- **Triggers**: Before starting implementation of a task
110
-
111
- **Actions**:
112
- 1. Detects if project is brownfield (has existing code)
113
- 2. Checks for baseline tests
114
- 3. Recommends regression prevention steps
115
- 4. Logs pre-implementation check
116
-
117
- **Use case**: Prevents breaking existing code by ensuring baseline tests exist
118
-
119
- ---
120
-
121
- ### 5. `stop-auto.sh` (Auto Mode)
122
- **Triggers**: When Claude tries to exit during autonomous execution (`sw:auto`)
123
-
124
- **Actions**:
125
- 1. Checks if all tasks are complete
126
- 2. Validates test execution (unit + E2E)
127
- 3. Verifies completion criteria met
128
- 4. Blocks exit if work incomplete
129
- 5. Re-feeds prompt to continue iteration
130
-
131
- **Configuration**: Registered in `hooks/hooks.json`:
132
- ```json
133
- {
134
- "hooks": {
135
- "Stop": [{
136
- "hooks": [{
137
- "type": "command",
138
- "command": "${CLAUDE_PLUGIN_ROOT}/hooks/stop-auto.sh"
139
- }]
140
- }]
141
- }
142
- }
143
- ```
144
-
145
- **Use case**: Enables autonomous execution loops. Claude works until ALL tasks complete and tests pass, then gracefully exits.
146
-
147
- **See**: `sw:auto` command documentation for full auto mode details.
148
-
149
- ---
150
-
151
- ### 🔊 Task Completion Sound
152
-
153
- **Triggers**: Automatically when any task is marked `[x]` in tasks.md
154
-
155
- **How It Works**:
156
- - Monitors task completion count in `.specweave/state/.last-task-completion`
157
- - Plays pleasant sound (Glass.aiff) when count increases
158
- - Runs in background (never blocks or delays hook execution)
159
- - **Smart auto mode detection**: Skips during `sw:auto` (Stop hook plays ONE sound at END)
160
-
161
- **Behavior by Mode**:
162
- - **Normal mode**: Sound plays after EACH task completion
163
- - **Auto mode** (`sw:auto`): NO sounds during execution, ONE completion sound when main orchestrator finishes
164
-
165
- **Platforms**:
166
- - macOS: `Glass.aiff` (built-in system sound)
167
- - Linux (PulseAudio): `/usr/share/sounds/freedesktop/stereo/complete.oga`
168
- - Linux (ALSA): `/usr/share/sounds/alsa/Front_Center.wav`
169
-
170
- **Implementation**: Integrated into `PostToolUse` hook dispatcher (`v2/dispatchers/post-tool-use.sh`)
171
-
172
- ---
173
-
174
- ## How Hooks Work (Claude Code Native)
175
-
176
- **CRITICAL**: Hooks are **NOT copied** to `.claude/hooks/`. They stay in `plugins/specweave/hooks/` and Claude Code discovers them automatically.
177
-
178
- ### Hook Discovery (Automatic)
179
-
180
- 1. **Plugin Installation**: When you install the `specweave` plugin via `/plugin install specweave` (or automatically during `specweave init`)
181
- 2. **Hook Registration**: Claude Code reads `plugins/specweave/.claude-plugin/plugin.json` which points to `hooks/hooks.json`
182
- 3. **Hook Discovery**: Claude Code loads `plugins/specweave/hooks/hooks.json` which references hook scripts:
183
- ```json
184
- {
185
- "hooks": {
186
- "PostToolUse": [{
187
- "matcher": "TodoWrite",
188
- "hooks": [{
189
- "type": "command",
190
- "command": "${CLAUDE_PLUGIN_ROOT}/hooks/post-task-completion.sh"
191
- }]
192
- }]
193
- }
194
- }
195
- ```
196
- 4. **Execution**: When `TodoWrite` fires, Claude Code executes `plugins/specweave/hooks/post-task-completion.sh` using the `${CLAUDE_PLUGIN_ROOT}` variable
197
-
198
- **Key Insight**: `${CLAUDE_PLUGIN_ROOT}` resolves to the installed plugin directory automatically. NO copying needed!
199
-
200
- ### Installation (Automatic)
201
-
202
- Hooks are installed automatically when you:
203
-
204
- ```bash
205
- # Option 1: Full project initialization
206
- specweave init my-project
207
-
208
- # Option 2: Plugin installation (if already initialized)
209
- /plugin install specweave
210
- ```
211
-
212
- **Result**: Claude Code automatically discovers and registers hooks. Nothing to copy or configure manually!
213
-
214
- ---
215
-
216
- ## Configuration
217
-
218
- Hooks are configured via `.specweave/config.json` (created automatically during `specweave init`):
219
-
220
- ```json
221
- {
222
- "hooks": {
223
- "post_task_completion": {
224
- "sync_living_docs": true, // Sync specs to living docs
225
- "sync_tasks_md": true, // Update tasks.md with completion status
226
- "external_tracker_sync": true // Sync to GitHub/Jira/ADO (if configured)
227
- },
228
- "post_increment_planning": {
229
- "auto_create_issue": true // Auto-create GitHub issue after planning
230
- }
231
- },
232
- "sync": {
233
- "enabled": true,
234
- "activeProfile": "github-default",
235
- "profiles": {
236
- "github-default": {
237
- "provider": "github",
238
- "config": {
239
- "owner": "your-org",
240
- "repo": "your-repo"
241
- }
242
- }
243
- }
244
- }
245
- }
246
- ```
247
-
248
- ### Hook Behavior
249
-
250
- **post-task-completion**:
251
- - `sync_living_docs: true` - Automatically syncs increment specs to `.specweave/docs/internal/specs/` after task completion
252
- - `sync_tasks_md: true` - Updates `tasks.md` with completion status from `TodoWrite` events
253
- - `external_tracker_sync: true` - Syncs progress to GitHub/Jira/ADO (requires sync profile configured)
254
-
255
- **post-increment-planning**:
256
- - `auto_create_issue: true` - Automatically creates GitHub issue after `sw:increment` completes
257
-
258
- ### Sound Notifications
259
-
260
- Sound notifications work automatically (platform-specific):
261
- - **macOS**: Uses `afplay` (Glass.aiff, Ping.aiff)
262
- - **Linux**: Uses `paplay` or `aplay` (system sounds)
263
- - **Windows**: Uses PowerShell `Media.SoundPlayer` (chimes.wav, notify.wav)
264
-
265
- ---
266
-
267
- ## Disabling Hooks
268
-
269
- ### Option 1: Configuration (Recommended)
270
- Edit `.specweave/config.json`:
271
- ```json
272
- {
273
- "hooks": {
274
- "post_task_completion": {
275
- "sync_living_docs": false, // Disable living docs sync
276
- "sync_tasks_md": false, // Disable tasks.md updates
277
- "external_tracker_sync": false // Disable external sync
278
- }
279
- }
280
- }
281
- ```
282
-
283
- ### Option 2: Uninstall Plugin (Nuclear)
284
- ```bash
285
- /plugin uninstall specweave
286
- ```
287
- **Warning**: This disables ALL SpecWeave functionality, not just hooks!
288
-
289
- ---
290
-
291
- ## Customizing Hooks
292
-
293
- Hooks are bash scripts in the plugin. To customize:
294
-
295
- 1. **For development** (SpecWeave repo contributors):
296
- - Edit `plugins/specweave/hooks/post-task-completion.sh`
297
- - Changes take effect immediately (hooks run from plugin directory)
298
-
299
- 2. **For users** (project using SpecWeave):
300
- - NOT RECOMMENDED - Hooks are plugin-managed
301
- - Configure behavior via `.specweave/config.json` instead
302
-
303
- ---
304
-
305
- ## Testing Hooks
306
-
307
- ### Validate Hook Syntax
308
- ```bash
309
- # Test core hook
310
- bash -n plugins/specweave/hooks/post-task-completion.sh
311
-
312
- # Test plugin hooks (if using external sync)
313
- bash -n plugins/specweave-github/hooks/post-task-completion.sh
314
- ```
315
-
316
- ### Test Integrated Workflow
317
- 1. Create increment: `sw:increment "test feature"`
318
- 2. Complete a task (via TodoWrite)
319
- 3. Check logs: `tail -f .specweave/logs/hooks-debug.log`
320
- 4. Verify hook execution in logs
321
-
322
- ---
323
-
324
- ## Hook Execution Order
325
-
326
- During a typical workflow:
327
-
328
- ```
329
- 1. pre-implementation.sh ← Before starting task
330
-
331
- 2. [User implements task]
332
-
333
- 3. docs-changed.sh ← If docs modified
334
-
335
- 4. human-input-required.sh ← If approval needed
336
-
337
- 5. [User approves]
338
-
339
- 6. post-task-completion.sh ← After task complete
340
- ```
341
-
342
- ---
343
-
344
- ## Logs
345
-
346
- All hooks log to:
347
- - `.specweave/logs/hooks.log` - General hook activity
348
- - `.specweave/logs/tasks.log` - Task completions
349
- - `.specweave/work/current-*/notes.md` - Current work context
350
-
351
- Logs are gitignored (in `.specweave/logs/`)
352
-
353
- ---
354
-
355
- ## Architecture Changes
356
-
357
- ### What Changed
358
-
359
- **External tool sync logic has been moved from core plugin to respective plugin hooks**:
360
-
361
- | External Tool | Old Location | New Location |
362
- |---------------|-------------|--------------|
363
- | **GitHub Issues** | `plugins/specweave/hooks/post-task-completion.sh` (lines 227-333) | `plugins/specweave-github/hooks/post-task-completion.sh` |
364
- | **JIRA** | `plugins/specweave/hooks/post-task-completion.sh` (lines 335-345) | `plugins/specweave-jira/hooks/post-task-completion.sh` |
365
- | **Azure DevOps** | `plugins/specweave/hooks/post-task-completion.sh` (lines 347-357) | `plugins/specweave-ado/hooks/post-task-completion.sh` |
366
-
367
- **Result**:
368
- - ✅ Core hook: 452 lines → 330 lines (27% reduction)
369
- - ✅ Each plugin hook: ~150-240 lines (self-contained)
370
- - ✅ Total: 871 lines (vs. 452 monolithic lines)
371
-
372
- ### Why This Change?
373
-
374
- **Problem (Before the change)**:
375
- ```
376
- Core hook (500+ lines)
377
- ├── Core concerns (sound, docs, translation)
378
- ├── GitHub sync logic (107 lines) ← Embedded in core!
379
- ├── JIRA sync logic (11 lines) ← Embedded in core!
380
- └── Azure DevOps sync logic (11 lines) ← Embedded in core!
381
-
382
- Issues:
383
- ❌ Tight coupling (core depends on gh CLI, JIRA API, ADO API)
384
- ❌ Cannot opt out of GitHub sync even if not using it
385
- ❌ Testing complexity (must mock all external tools)
386
- ❌ Violates separation of concerns
387
- ```
388
-
389
- **Solution (Current)**:
390
- ```
391
- Core hook (330 lines) GitHub plugin hook (241 lines)
392
- ├── Core concerns only ├── GitHub API calls
393
- ├── Issue checkbox updates
394
- └── Progress comments
395
-
396
- JIRA plugin hook (150 lines) ADO plugin hook (150 lines)
397
- ├── JIRA API calls ├── Azure DevOps API calls
398
- └── Issue status updates └── Work item updates
399
-
400
- Benefits:
401
- ✅ Separation of concerns (core vs. external tools)
402
- ✅ Optional plugins (GitHub sync only if plugin installed)
403
- ✅ Independent testing (test each hook in isolation)
404
- ✅ No external dependencies in core plugin
405
- ✅ Parallel execution (Claude Code runs all hooks concurrently)
406
- ```
407
-
408
- ### How It Works (Claude Code's Hook System)
409
-
410
- **When a task completes**:
411
- 1. `TodoWrite` tool fires
412
- 2. Claude Code triggers `PostToolUse` event
413
- 3. **ALL registered hooks fire in parallel**:
414
- - Core hook: Sound + Living docs + Translation + Reflection
415
- - GitHub hook: Update issue checkboxes (if `specweave-github` installed)
416
- - JIRA hook: Update issue status (if `specweave-jira` installed)
417
- - ADO hook: Update work item (if `specweave-ado` installed)
418
-
419
- **Key Insight**: Each plugin registers its own hooks via `hooks.json`, enabling clean modularity.
420
-
421
- ### Migration Guide
422
-
423
- **For existing projects**:
424
-
425
- **Option 1: Automatic (Recommended)**
426
- ```bash
427
- # Re-run init to update hooks
428
- specweave init .
429
- # Overwrites .claude/hooks/ with new structure
430
- ```
431
-
432
- **Option 2: Manual (Not Recommended)**
433
- ```bash
434
- # Remove old monolithic hook
435
- rm .claude/hooks/post-task-completion.sh
436
-
437
- # Copy new plugin hooks
438
- cp -r plugins/specweave/hooks/.claude/hooks/
439
- cp -r plugins/specweave-github/hooks/ .claude/hooks/ (if using GitHub)
440
- cp -r plugins/specweave-jira/hooks/ .claude/hooks/ (if using JIRA)
441
- cp -r plugins/specweave-ado/hooks/ .claude/hooks/ (if using ADO)
442
- ```
443
-
444
- **No breaking changes**: Existing increments with GitHub/JIRA/ADO links will continue to sync automatically.
445
-
446
- ### Testing the New Architecture
447
-
448
- **Test core hook independently**:
449
- ```bash
450
- bash -n plugins/specweave/hooks/post-task-completion.sh
451
- # Should show no syntax errors
452
- ```
453
-
454
- **Test plugin hooks independently**:
455
- ```bash
456
- bash -n plugins/specweave-github/hooks/post-task-completion.sh
457
- bash -n plugins/specweave-jira/hooks/post-task-completion.sh
458
- bash -n plugins/specweave-ado/hooks/post-task-completion.sh
459
- ```
460
-
461
- **Test integrated workflow**:
462
- 1. Create increment: `sw:increment "test"`
463
- 2. Create GitHub issue: `sw-github:create-issue 0001`
464
- 3. Complete a task (TodoWrite)
465
- 4. Check logs: `tail -f .specweave/logs/hooks-debug.log`
466
- 5. Verify:
467
- - Core hook logs: `[$(date)]` messages
468
- - GitHub hook logs: `[$(date)] [GitHub]` messages
469
- - GitHub issue updated with checkboxes
470
-
471
- ### Related Documentation
472
-
473
- - **Architecture Analysis**: `.specweave/increments/0018-strict-increment-discipline-enforcement/reports/HOOKS-ARCHITECTURE-ANALYSIS.md`
474
- - **GitHub Plugin Hooks**: `plugins/specweave-github/hooks/README.md`
475
- - **JIRA Plugin Hooks**: `plugins/specweave-jira/hooks/README.md`
476
- - **ADO Plugin Hooks**: `plugins/specweave-ado/hooks/README.md`
477
- - **Claude Code Hooks Guide**: https://code.claude.com/docs/en/hooks-guide
478
-
479
- ---
480
-
481
- ## Future Enhancements
482
-
483
- Planned hooks:
484
- - `pre-commit.sh` - Validate before git commit
485
- - `pre-push.sh` - Run tests before push
486
- - `post-deploy.sh` - Actions after deployment
487
- - `cost-alert.sh` - Alert if infrastructure costs exceed budget
488
-
489
- ---
490
-
491
- **For more information**, see:
492
- - [Autonomous Workflow](../../ai-execution-files/reports/SPECWEAVE-AUTONOMOUS-WORKFLOW.md)
493
- - [Increment 0002: Role-Based Agents](../../.specweave/increments/0002-role-based-agents/)