specweave 0.17.16 → 0.18.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 (161) hide show
  1. package/CLAUDE.md +405 -2495
  2. package/README.md +92 -2
  3. package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts.map +1 -1
  4. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js +188 -36
  5. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js.map +1 -1
  6. package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts +54 -0
  7. package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts.map +1 -0
  8. package/dist/plugins/specweave-ado/lib/ado-status-sync.js +86 -0
  9. package/dist/plugins/specweave-ado/lib/ado-status-sync.js.map +1 -0
  10. package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts +139 -0
  11. package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts.map +1 -0
  12. package/dist/plugins/specweave-github/lib/duplicate-detector.js +389 -0
  13. package/dist/plugins/specweave-github/lib/duplicate-detector.js.map +1 -0
  14. package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts +26 -0
  15. package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts.map +1 -0
  16. package/dist/plugins/specweave-github/lib/enhanced-github-sync.js +249 -0
  17. package/dist/plugins/specweave-github/lib/enhanced-github-sync.js.map +1 -0
  18. package/dist/plugins/specweave-github/lib/github-client.d.ts +1 -1
  19. package/dist/plugins/specweave-github/lib/github-client.d.ts.map +1 -1
  20. package/dist/plugins/specweave-github/lib/github-client.js +25 -13
  21. package/dist/plugins/specweave-github/lib/github-client.js.map +1 -1
  22. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts +83 -0
  23. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts.map +1 -0
  24. package/dist/plugins/specweave-github/lib/github-epic-sync.js +451 -0
  25. package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +1 -0
  26. package/dist/plugins/specweave-github/lib/github-status-sync.d.ts +43 -0
  27. package/dist/plugins/specweave-github/lib/github-status-sync.d.ts.map +1 -0
  28. package/dist/plugins/specweave-github/lib/github-status-sync.js +82 -0
  29. package/dist/plugins/specweave-github/lib/github-status-sync.js.map +1 -0
  30. package/dist/plugins/specweave-github/lib/task-sync.d.ts +5 -0
  31. package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -1
  32. package/dist/plugins/specweave-github/lib/task-sync.js +38 -2
  33. package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -1
  34. package/dist/plugins/specweave-jira/lib/jira-epic-sync.d.ts +66 -0
  35. package/dist/plugins/specweave-jira/lib/jira-epic-sync.d.ts.map +1 -0
  36. package/dist/plugins/specweave-jira/lib/jira-epic-sync.js +274 -0
  37. package/dist/plugins/specweave-jira/lib/jira-epic-sync.js.map +1 -0
  38. package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts +56 -0
  39. package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts.map +1 -0
  40. package/dist/plugins/specweave-jira/lib/jira-status-sync.js +93 -0
  41. package/dist/plugins/specweave-jira/lib/jira-status-sync.js.map +1 -0
  42. package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
  43. package/dist/src/cli/helpers/issue-tracker/index.js +48 -3
  44. package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
  45. package/dist/src/core/living-docs/hierarchy-mapper.d.ts +142 -0
  46. package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -0
  47. package/dist/src/core/living-docs/hierarchy-mapper.js +453 -0
  48. package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -0
  49. package/dist/src/core/living-docs/index.d.ts +10 -84
  50. package/dist/src/core/living-docs/index.d.ts.map +1 -1
  51. package/dist/src/core/living-docs/index.js +10 -164
  52. package/dist/src/core/living-docs/index.js.map +1 -1
  53. package/dist/src/core/living-docs/spec-distributor.d.ts +106 -0
  54. package/dist/src/core/living-docs/spec-distributor.d.ts.map +1 -0
  55. package/dist/src/core/living-docs/spec-distributor.js +823 -0
  56. package/dist/src/core/living-docs/spec-distributor.js.map +1 -0
  57. package/dist/src/core/living-docs/types.d.ts +201 -0
  58. package/dist/src/core/living-docs/types.d.ts.map +1 -0
  59. package/dist/src/core/living-docs/types.js +15 -0
  60. package/dist/src/core/living-docs/types.js.map +1 -0
  61. package/dist/src/core/logging/prompt-logger.d.ts +70 -0
  62. package/dist/src/core/logging/prompt-logger.d.ts.map +1 -0
  63. package/dist/src/core/logging/prompt-logger.js +247 -0
  64. package/dist/src/core/logging/prompt-logger.js.map +1 -0
  65. package/dist/src/core/status-line/status-line-manager.d.ts +15 -24
  66. package/dist/src/core/status-line/status-line-manager.d.ts.map +1 -1
  67. package/dist/src/core/status-line/status-line-manager.js +33 -70
  68. package/dist/src/core/status-line/status-line-manager.js.map +1 -1
  69. package/dist/src/core/status-line/types.d.ts +19 -31
  70. package/dist/src/core/status-line/types.d.ts.map +1 -1
  71. package/dist/src/core/status-line/types.js +5 -9
  72. package/dist/src/core/status-line/types.js.map +1 -1
  73. package/dist/src/core/sync/conflict-resolver.d.ts +66 -0
  74. package/dist/src/core/sync/conflict-resolver.d.ts.map +1 -0
  75. package/dist/src/core/sync/conflict-resolver.js +108 -0
  76. package/dist/src/core/sync/conflict-resolver.js.map +1 -0
  77. package/dist/src/core/sync/enhanced-content-builder.d.ts +77 -0
  78. package/dist/src/core/sync/enhanced-content-builder.d.ts.map +1 -0
  79. package/dist/src/core/sync/enhanced-content-builder.js +199 -0
  80. package/dist/src/core/sync/enhanced-content-builder.js.map +1 -0
  81. package/dist/src/core/sync/label-detector.d.ts +66 -0
  82. package/dist/src/core/sync/label-detector.d.ts.map +1 -0
  83. package/dist/src/core/sync/label-detector.js +211 -0
  84. package/dist/src/core/sync/label-detector.js.map +1 -0
  85. package/dist/src/core/sync/retry-logic.d.ts +64 -0
  86. package/dist/src/core/sync/retry-logic.d.ts.map +1 -0
  87. package/dist/src/core/sync/retry-logic.js +165 -0
  88. package/dist/src/core/sync/retry-logic.js.map +1 -0
  89. package/dist/src/core/sync/spec-increment-mapper.d.ts +100 -0
  90. package/dist/src/core/sync/spec-increment-mapper.d.ts.map +1 -0
  91. package/dist/src/core/sync/spec-increment-mapper.js +424 -0
  92. package/dist/src/core/sync/spec-increment-mapper.js.map +1 -0
  93. package/dist/src/core/sync/status-cache.d.ts +91 -0
  94. package/dist/src/core/sync/status-cache.d.ts.map +1 -0
  95. package/dist/src/core/sync/status-cache.js +140 -0
  96. package/dist/src/core/sync/status-cache.js.map +1 -0
  97. package/dist/src/core/sync/status-mapper.d.ts +69 -0
  98. package/dist/src/core/sync/status-mapper.d.ts.map +1 -0
  99. package/dist/src/core/sync/status-mapper.js +90 -0
  100. package/dist/src/core/sync/status-mapper.js.map +1 -0
  101. package/dist/src/core/sync/status-sync-engine.d.ts +162 -0
  102. package/dist/src/core/sync/status-sync-engine.d.ts.map +1 -0
  103. package/dist/src/core/sync/status-sync-engine.js +347 -0
  104. package/dist/src/core/sync/status-sync-engine.js.map +1 -0
  105. package/dist/src/core/sync/sync-event-logger.d.ts +99 -0
  106. package/dist/src/core/sync/sync-event-logger.d.ts.map +1 -0
  107. package/dist/src/core/sync/sync-event-logger.js +103 -0
  108. package/dist/src/core/sync/sync-event-logger.js.map +1 -0
  109. package/dist/src/core/sync/workflow-detector.d.ts +95 -0
  110. package/dist/src/core/sync/workflow-detector.d.ts.map +1 -0
  111. package/dist/src/core/sync/workflow-detector.js +175 -0
  112. package/dist/src/core/sync/workflow-detector.js.map +1 -0
  113. package/dist/src/core/types/config.d.ts.map +1 -1
  114. package/dist/src/core/types/config.js +31 -0
  115. package/dist/src/core/types/config.js.map +1 -1
  116. package/dist/src/utils/github-url.d.ts +53 -0
  117. package/dist/src/utils/github-url.d.ts.map +1 -0
  118. package/dist/src/utils/github-url.js +90 -0
  119. package/dist/src/utils/github-url.js.map +1 -0
  120. package/dist/src/utils/spec-parser.d.ts +145 -0
  121. package/dist/src/utils/spec-parser.d.ts.map +1 -0
  122. package/dist/src/utils/spec-parser.js +640 -0
  123. package/dist/src/utils/spec-parser.js.map +1 -0
  124. package/package.json +1 -1
  125. package/plugins/specweave/agents/pm/AGENT.md +1 -1
  126. package/plugins/specweave/agents/pm/templates/increment-spec.md +158 -0
  127. package/plugins/specweave/agents/pm/templates/living-docs-spec.md +113 -0
  128. package/plugins/specweave/commands/specweave-done.md +163 -0
  129. package/plugins/specweave/hooks/lib/update-status-line.sh +79 -111
  130. package/plugins/specweave/hooks/post-increment-planning.sh +107 -35
  131. package/plugins/specweave/lib/hooks/sync-living-docs.js +139 -34
  132. package/plugins/specweave/lib/hooks/sync-living-docs.ts +234 -38
  133. package/plugins/specweave/skills/SKILLS-INDEX.md +4 -24
  134. package/plugins/specweave/skills/increment-planner/SKILL.md +94 -0
  135. package/plugins/specweave/skills/increment-work-router/SKILL.md +466 -0
  136. package/plugins/specweave-ado/lib/ado-status-sync.js +80 -0
  137. package/plugins/specweave-ado/lib/ado-status-sync.ts +121 -0
  138. package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +205 -0
  139. package/plugins/specweave-github/commands/specweave-github-sync-epic.md +248 -0
  140. package/plugins/specweave-github/lib/duplicate-detector.js +370 -0
  141. package/plugins/specweave-github/lib/duplicate-detector.ts +525 -0
  142. package/plugins/specweave-github/lib/enhanced-github-sync.js +220 -0
  143. package/plugins/specweave-github/lib/enhanced-github-sync.ts +322 -0
  144. package/plugins/specweave-github/lib/github-client.js +21 -10
  145. package/plugins/specweave-github/lib/github-client.ts +27 -16
  146. package/plugins/specweave-github/lib/github-epic-sync.js +489 -0
  147. package/plugins/specweave-github/lib/github-epic-sync.ts +690 -0
  148. package/plugins/specweave-github/lib/github-status-sync.js +71 -0
  149. package/plugins/specweave-github/lib/github-status-sync.ts +107 -0
  150. package/plugins/specweave-github/lib/task-sync.js +33 -2
  151. package/plugins/specweave-github/lib/task-sync.ts +44 -2
  152. package/plugins/specweave-jira/commands/specweave-jira-sync-epic.md +267 -0
  153. package/plugins/specweave-jira/lib/enhanced-jira-sync.ts.disabled +222 -0
  154. package/plugins/specweave-jira/lib/jira-epic-sync.js +304 -0
  155. package/plugins/specweave-jira/lib/jira-epic-sync.ts +459 -0
  156. package/plugins/specweave-jira/lib/jira-status-sync.js +79 -0
  157. package/plugins/specweave-jira/lib/jira-status-sync.ts +139 -0
  158. package/src/templates/AGENTS.md.template +88 -1
  159. package/src/templates/CLAUDE.md.template +49 -0
  160. package/plugins/specweave/skills/increment-quality-judge/SKILL.md +0 -524
  161. package/plugins/specweave/skills/plugin-installer/SKILL.md +0 -353
@@ -0,0 +1,466 @@
1
+ ---
2
+ name: increment-work-router
3
+ description: Smart work continuation system that detects implementation intent and routes to active increment or creates new one. Activates for implement, complete, build, add, develop, work on, continue, resume, finish, fix, resolve, address, let's implement, let's build, start working, begin implementation, add feature, create feature.
4
+ ---
5
+
6
+ # Increment Work Router - Smart Work Continuation
7
+
8
+ ## Purpose
9
+
10
+ The increment-work-router skill is an **intelligent work continuation system** that:
11
+ - ✅ Detects implementation/continuation intent (not just new projects)
12
+ - ✅ Checks for active increments automatically
13
+ - ✅ Routes to existing increment OR creates new one
14
+ - ✅ Bridges the gap between planning and execution
15
+
16
+ **Key Insight**: When user says "implement X" or "complete Y", they expect the system to handle routing intelligently without manual commands.
17
+
18
+ ## When to Activate
19
+
20
+ This skill activates when user expresses **implementation/continuation intent**:
21
+
22
+ ### High-Confidence Triggers (Auto-Route)
23
+
24
+ **Action Verbs** (with specific target):
25
+ - "Implement [feature]"
26
+ - "Complete [task]"
27
+ - "Build [component]"
28
+ - "Add [functionality]"
29
+ - "Develop [module]"
30
+ - "Create [feature]"
31
+
32
+ **Continuation Phrases**:
33
+ - "Work on [feature]"
34
+ - "Continue [increment]"
35
+ - "Resume [work]"
36
+ - "Finish [task]"
37
+ - "Let's implement [X]"
38
+ - "Let's build [Y]"
39
+ - "Start working on [Z]"
40
+
41
+ **Bug/Fix Intent**:
42
+ - "Fix [issue]"
43
+ - "Resolve [bug]"
44
+ - "Address [problem]"
45
+
46
+ ### Medium-Confidence Triggers (Clarify)
47
+
48
+ **Vague Intent** (needs target clarification):
49
+ - "Let's continue"
50
+ - "Keep working"
51
+ - "What's next?"
52
+ - "Continue where we left off"
53
+
54
+ ### Don't Activate For
55
+
56
+ **Planning/Discussion** (let other skills handle):
57
+ - "What should we build?" → project-kickstarter
58
+ - "How does X work?" → Regular conversation
59
+ - "Should we use Y?" → Technical discussion
60
+ - "Plan a new feature" → increment-planner
61
+
62
+ **Already in Workflow**:
63
+ - User is already executing `/specweave:do`
64
+ - Increment planning is in progress
65
+ - Another skill is handling the request
66
+
67
+ ## Core Algorithm
68
+
69
+ ### Step 1: Detect Intent
70
+
71
+ Scan user message for implementation keywords:
72
+ ```
73
+ Action verbs: implement, complete, build, add, develop, create
74
+ Continuation: work on, continue, resume, finish, start
75
+ Bug/Fix: fix, resolve, address
76
+ ```
77
+
78
+ Calculate confidence:
79
+ - **High (>80%)**: Action verb + specific target ("implement user auth")
80
+ - **Medium (50-80%)**: Action verb only ("let's continue")
81
+ - **Low (<50%)**: No clear intent
82
+
83
+ ### Step 2: Check Active Increments
84
+
85
+ **Read increment state:**
86
+ ```bash
87
+ # Find all increments with status = "active"
88
+ find .specweave/increments -name "metadata.json" -type f \
89
+ -exec jq -r 'select(.status == "active") | .id' {} \;
90
+ ```
91
+
92
+ **Three scenarios:**
93
+ 1. **One active increment** → Check relevance and route
94
+ 2. **Multiple active increments** → Ask user to select
95
+ 3. **No active increments** → Suggest creating new one
96
+
97
+ ### Step 3: Check Relevance (if active increment exists)
98
+
99
+ **Relatedness Analysis:**
100
+ Compare user's request against active increment:
101
+ - Check increment title/description
102
+ - Check task list (tasks.md)
103
+ - Check spec.md for related features
104
+
105
+ **Scoring:**
106
+ - **High match (>70%)**: Same feature area → Auto-resume
107
+ - **Medium match (40-70%)**: Related area → Ask confirmation
108
+ - **Low match (<40%)**: Unrelated → Suggest new increment
109
+
110
+ ### Step 4: Route Intelligently
111
+
112
+ **Scenario A: High relevance to active increment**
113
+ ```
114
+ User: "Implement user authentication"
115
+ Active: 0031-user-authentication-system
116
+
117
+ ✅ High match → Auto-resume:
118
+
119
+ "I see you have an active increment for user authentication (0031).
120
+ Resuming work on that increment now with /specweave:do..."
121
+
122
+ [Automatically invokes /specweave:do]
123
+ ```
124
+
125
+ **Scenario B: Unrelated to active increment**
126
+ ```
127
+ User: "Implement payment processing"
128
+ Active: 0031-user-authentication-system
129
+
130
+ ⚠️ Low match → Ask:
131
+
132
+ "I see you have an active increment (0031-user-authentication-system).
133
+
134
+ Your request for payment processing seems unrelated. Would you like to:
135
+ 1. **Create new increment** for payment processing (recommended)
136
+ 2. **Continue current increment** (0031) and add payment to it
137
+ 3. **Pause current** and create new increment
138
+
139
+ What would you prefer?"
140
+ ```
141
+
142
+ **Scenario C: No active increment**
143
+ ```
144
+ User: "Implement user authentication"
145
+ Active: None
146
+
147
+ → Suggest new increment:
148
+
149
+ "No active increment found. Let's create one for user authentication.
150
+
151
+ I'm going to create a SpecWeave increment with:
152
+ - Specification (WHAT & WHY)
153
+ - Technical plan (HOW)
154
+ - Task breakdown (STEPS with embedded tests)
155
+
156
+ Creating increment now with /specweave:increment..."
157
+
158
+ [Automatically invokes /specweave:increment "user authentication"]
159
+ ```
160
+
161
+ **Scenario D: Multiple active increments**
162
+ ```
163
+ User: "Continue working"
164
+ Active: 0031-user-auth, 0032-payment-system
165
+
166
+ → Ask to clarify:
167
+
168
+ "You have 2 active increments:
169
+ 1. **0031-user-authentication-system** (3/10 tasks complete)
170
+ 2. **0032-payment-processing** (1/8 tasks complete)
171
+
172
+ Which one would you like to work on?"
173
+ ```
174
+
175
+ **Scenario E: Vague continuation intent**
176
+ ```
177
+ User: "Let's continue"
178
+ Active: 0031-user-authentication-system
179
+
180
+ ✅ Auto-resume (only one active):
181
+
182
+ "Resuming increment 0031-user-authentication-system...
183
+ Progress: 3/10 tasks complete (30%)
184
+
185
+ Next task: T-004 Implement password hashing
186
+
187
+ [Automatically invokes /specweave:do]"
188
+ ```
189
+
190
+ ## Integration Architecture
191
+
192
+ **Workflow:**
193
+ ```
194
+ User: "Implement [feature]"
195
+
196
+ increment-work-router (detects intent)
197
+
198
+ [Check .specweave/increments/*/metadata.json]
199
+
200
+ ┌───────────────────┬──────────────────┬────────────────┐
201
+ │ Active increment │ Multiple active │ No active │
202
+ │ (relevant) │ (ambiguous) │ (none) │
203
+ └─────┬─────────────┴──────┬───────────┴──────┬─────────┘
204
+ │ │ │
205
+ ↓ ↓ ↓
206
+ /specweave:do Ask to select /specweave:increment
207
+ (auto-resume) (clarify) (create new)
208
+ ```
209
+
210
+ **Calls:**
211
+ - `/specweave:do` - Resume active increment
212
+ - `/specweave:increment` - Create new increment
213
+ - `/specweave:status` - Check increment state (if needed)
214
+
215
+ **Called By:**
216
+ - Automatically when implementation intent detected
217
+ - Works alongside `project-kickstarter` (projects) and `increment-planner` (planning)
218
+
219
+ ## Decision Matrix
220
+
221
+ | User Intent | Active Increments | Relevance | Action |
222
+ |-------------|------------------|-----------|--------|
223
+ | "Implement auth" | 1 (auth-related) | High (>70%) | Auto `/specweave:do` |
224
+ | "Implement auth" | 1 (unrelated) | Low (<40%) | Ask: New or add to current? |
225
+ | "Implement auth" | 0 | N/A | Auto `/specweave:increment` |
226
+ | "Implement auth" | 2+ | N/A | Ask which increment |
227
+ | "Let's continue" | 1 | N/A | Auto `/specweave:do` |
228
+ | "Let's continue" | 2+ | N/A | Ask which increment |
229
+ | "Let's continue" | 0 | N/A | "No active increment. What should we build?" |
230
+
231
+ ## Relevance Matching Logic
232
+
233
+ **How to determine if request relates to active increment:**
234
+
235
+ ```typescript
236
+ function calculateRelevance(userRequest: string, increment: Increment): number {
237
+ let score = 0;
238
+
239
+ // 1. Title/ID match (strongest signal)
240
+ if (increment.title.toLowerCase().includes(extractKeywords(userRequest))) {
241
+ score += 40;
242
+ }
243
+
244
+ // 2. Tasks match (check tasks.md)
245
+ const tasks = readTasksFile(increment);
246
+ const matchingTasks = tasks.filter(t =>
247
+ t.title.toLowerCase().includes(extractKeywords(userRequest))
248
+ );
249
+ score += (matchingTasks.length / tasks.length) * 30;
250
+
251
+ // 3. Spec match (check spec.md user stories)
252
+ const spec = readSpecFile(increment);
253
+ if (spec.includes(extractKeywords(userRequest))) {
254
+ score += 20;
255
+ }
256
+
257
+ // 4. Type match (feature vs bug vs hotfix)
258
+ const requestType = detectType(userRequest);
259
+ if (requestType === increment.type) {
260
+ score += 10;
261
+ }
262
+
263
+ return score; // 0-100
264
+ }
265
+ ```
266
+
267
+ **Example:**
268
+ ```
269
+ User: "Implement JWT token refresh"
270
+ Active: 0031-user-authentication-system
271
+
272
+ Checks:
273
+ ✅ Title contains "authentication" (user mentions "JWT token") → +40 points
274
+ ✅ Tasks.md has "T-005: Implement JWT refresh logic" → +30 points
275
+ ✅ Spec.md mentions "token management" → +20 points
276
+ ✅ Both are "feature" type → +10 points
277
+
278
+ Total: 100/100 → High relevance → Auto-resume
279
+ ```
280
+
281
+ ## Examples
282
+
283
+ ### Example 1: Auto-Resume (High Relevance)
284
+
285
+ **Context:**
286
+ ```
287
+ Active: 0031-user-authentication-system
288
+ Progress: 3/10 tasks complete
289
+ ```
290
+
291
+ **User:**
292
+ ```
293
+ Implement JWT token refresh
294
+ ```
295
+
296
+ **increment-work-router:**
297
+ ```
298
+ ✅ Intent detected: "implement" + specific target
299
+ ✅ Active increment found: 0031-user-authentication-system
300
+ ✅ Relevance check: 95% match (authentication-related)
301
+
302
+ → AUTO-RESUME
303
+
304
+ "I see you have an active increment for user authentication (0031).
305
+ Task T-005 'Implement JWT token refresh' is already in your plan.
306
+
307
+ Resuming increment 0031 now with /specweave:do...
308
+
309
+ [Automatically invokes /specweave:do]
310
+ ```
311
+
312
+ ### Example 2: Create New (No Active Increment)
313
+
314
+ **Context:**
315
+ ```
316
+ Active: None
317
+ ```
318
+
319
+ **User:**
320
+ ```
321
+ Implement payment processing with Stripe
322
+ ```
323
+
324
+ **increment-work-router:**
325
+ ```
326
+ ✅ Intent detected: "implement" + specific target
327
+ ❌ No active increment found
328
+
329
+ → CREATE NEW
330
+
331
+ "No active increment found. Let's create one for payment processing.
332
+
333
+ I'm going to create a SpecWeave increment with:
334
+ - Specification (Stripe integration requirements)
335
+ - Technical plan (API integration, webhooks, security)
336
+ - Task breakdown (implementation steps with tests)
337
+
338
+ Creating increment now with /specweave:increment...
339
+
340
+ [Automatically invokes /specweave:increment "payment processing with Stripe"]
341
+ ```
342
+
343
+ ### Example 3: Unrelated Request (Ask)
344
+
345
+ **Context:**
346
+ ```
347
+ Active: 0031-user-authentication-system
348
+ Progress: 3/10 tasks complete
349
+ ```
350
+
351
+ **User:**
352
+ ```
353
+ Implement email notifications
354
+ ```
355
+
356
+ **increment-work-router:**
357
+ ```
358
+ ✅ Intent detected: "implement" + specific target
359
+ ✅ Active increment found: 0031-user-authentication-system
360
+ ⚠️ Relevance check: 15% match (unrelated)
361
+
362
+ → ASK FOR CLARIFICATION
363
+
364
+ "I see you have an active increment (0031-user-authentication-system) with 3/10 tasks complete.
365
+
366
+ Your request for email notifications seems unrelated. Would you like to:
367
+ 1. **Create new increment** for email notifications (recommended - keeps work focused)
368
+ 2. **Add to current increment** (0031) - if notifications are for auth emails
369
+ 3. **Pause current increment** and start notifications
370
+
371
+ SpecWeave works best with focused increments. What would you prefer?"
372
+ ```
373
+
374
+ ### Example 4: Multiple Active (Clarify)
375
+
376
+ **Context:**
377
+ ```
378
+ Active: 0031-user-authentication-system (3/10 tasks)
379
+ Active: 0032-payment-processing (1/8 tasks)
380
+ ```
381
+
382
+ **User:**
383
+ ```
384
+ Let's continue working
385
+ ```
386
+
387
+ **increment-work-router:**
388
+ ```
389
+ ✅ Intent detected: "continue" (vague)
390
+ ✅ Multiple active increments found: 2
391
+
392
+ → ASK TO SELECT
393
+
394
+ "You have 2 active increments:
395
+
396
+ 1. **0031-user-authentication-system**
397
+ - Progress: 3/10 tasks (30%)
398
+ - Next: T-004 Implement password hashing
399
+
400
+ 2. **0032-payment-processing**
401
+ - Progress: 1/8 tasks (12%)
402
+ - Next: T-002 Set up Stripe SDK
403
+
404
+ Which one would you like to work on?"
405
+
406
+ [Wait for user selection, then invoke /specweave:do {selected-id}]
407
+ ```
408
+
409
+ ### Example 5: Vague Intent + Single Active (Auto-Resume)
410
+
411
+ **Context:**
412
+ ```
413
+ Active: 0031-user-authentication-system (3/10 tasks)
414
+ ```
415
+
416
+ **User:**
417
+ ```
418
+ What's next?
419
+ ```
420
+
421
+ **increment-work-router:**
422
+ ```
423
+ ✅ Intent detected: "what's next" (continuation)
424
+ ✅ One active increment: 0031-user-authentication-system
425
+
426
+ → AUTO-RESUME
427
+
428
+ "Resuming increment 0031-user-authentication-system...
429
+ Progress: 3/10 tasks complete (30%)
430
+
431
+ Next task: **T-004 Implement password hashing**
432
+
433
+ [Automatically invokes /specweave:do]"
434
+ ```
435
+
436
+ ## Opt-Out Mechanism
437
+
438
+ Users can override auto-routing with explicit instructions:
439
+ - "Don't resume, create new" → Forces new increment
440
+ - "Just discuss first" → Regular conversation
441
+ - "Plan without implementing" → Routes to `/specweave:increment` only
442
+ - "Show me the current state" → Uses `/specweave:status` instead
443
+
444
+ ## Success Criteria
445
+
446
+ - ✅ Users can say "implement X" and work starts automatically
447
+ - ✅ Smart routing to active increments (no manual `/specweave:do`)
448
+ - ✅ Detects unrelated requests and prevents scope creep
449
+ - ✅ No "which increment?" confusion (auto-handles single active)
450
+ - ✅ Clear choices when ambiguous (multiple active or unrelated)
451
+ - ✅ Seamless integration with existing skills (project-kickstarter, increment-planner)
452
+
453
+ ## Related Skills
454
+
455
+ - **project-kickstarter**: For NEW project descriptions (complements, doesn't overlap)
456
+ - **increment-planner**: For creating increment structure (invoked by this skill)
457
+ - **specweave-detector**: For checking SpecWeave context
458
+
459
+ ---
460
+
461
+ **Key Distinction:**
462
+ - `project-kickstarter` = "I want to BUILD a new product" (project-level)
463
+ - `increment-work-router` = "IMPLEMENT this feature/task" (execution-level)
464
+ - `increment-planner` = "PLAN this increment" (planning-level)
465
+
466
+ This skill bridges planning → execution by auto-detecting implementation intent.
@@ -0,0 +1,80 @@
1
+ import axios from "axios";
2
+ class AdoStatusSync {
3
+ constructor(organization, project, personalAccessToken) {
4
+ this.organization = organization;
5
+ this.project = project;
6
+ this.client = axios.create({
7
+ baseURL: `https://dev.azure.com/${organization}/${project}/_apis`,
8
+ auth: {
9
+ username: "",
10
+ // Empty for PAT auth
11
+ password: personalAccessToken
12
+ },
13
+ headers: {
14
+ "Content-Type": "application/json-patch+json",
15
+ "Accept": "application/json"
16
+ }
17
+ });
18
+ }
19
+ /**
20
+ * Get current status from ADO work item
21
+ *
22
+ * @param workItemId - ADO work item ID (e.g., 123)
23
+ * @returns Current work item state
24
+ */
25
+ async getStatus(workItemId) {
26
+ const response = await this.client.get(
27
+ `/wit/workitems/${workItemId}?api-version=7.0`
28
+ );
29
+ return {
30
+ state: response.data.fields["System.State"]
31
+ };
32
+ }
33
+ /**
34
+ * Update ADO work item state
35
+ *
36
+ * Uses JSON Patch format to update System.State field.
37
+ *
38
+ * @param workItemId - ADO work item ID (e.g., 123)
39
+ * @param status - Desired status
40
+ */
41
+ async updateStatus(workItemId, status) {
42
+ const patch = [
43
+ {
44
+ op: "add",
45
+ path: "/fields/System.State",
46
+ value: status.state
47
+ }
48
+ ];
49
+ await this.client.patch(
50
+ `/wit/workitems/${workItemId}?api-version=7.0`,
51
+ patch
52
+ );
53
+ }
54
+ /**
55
+ * Post comment about status change to ADO work item
56
+ *
57
+ * @param workItemId - ADO work item ID (e.g., 123)
58
+ * @param oldStatus - Previous SpecWeave status
59
+ * @param newStatus - New SpecWeave status
60
+ */
61
+ async postStatusComment(workItemId, oldStatus, newStatus) {
62
+ const text = `\u{1F504} Status Update
63
+
64
+ SpecWeave status changed:
65
+ \u2022 From: ${oldStatus}
66
+ \u2022 To: ${newStatus}
67
+ \u2022 When: ${(/* @__PURE__ */ new Date()).toISOString()}
68
+
69
+ Synced from SpecWeave`;
70
+ await this.client.post(
71
+ `/wit/workitems/${workItemId}/comments?api-version=7.0-preview.3`,
72
+ {
73
+ text
74
+ }
75
+ );
76
+ }
77
+ }
78
+ export {
79
+ AdoStatusSync
80
+ };
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Azure DevOps Status Sync
3
+ *
4
+ * Synchronizes SpecWeave increment statuses with ADO work item states.
5
+ *
6
+ * ADO Work Item State Updates:
7
+ * - Uses JSON Patch format for updates
8
+ * - System.State field controls work item state
9
+ * - Available states: New, Active, On Hold, Resolved, Closed, Removed
10
+ *
11
+ * @module ado-status-sync
12
+ */
13
+
14
+ import axios, { AxiosInstance } from 'axios';
15
+
16
+ /**
17
+ * External status representation (ADO-specific)
18
+ */
19
+ export interface ExternalStatus {
20
+ state: string; // e.g., "New", "Active", "Closed"
21
+ }
22
+
23
+ /**
24
+ * Azure DevOps Status Sync
25
+ *
26
+ * Handles status synchronization with ADO work items.
27
+ */
28
+ export class AdoStatusSync {
29
+ private client: AxiosInstance;
30
+ private organization: string;
31
+ private project: string;
32
+
33
+ constructor(
34
+ organization: string,
35
+ project: string,
36
+ personalAccessToken: string
37
+ ) {
38
+ this.organization = organization;
39
+ this.project = project;
40
+
41
+ // Create ADO API client
42
+ this.client = axios.create({
43
+ baseURL: `https://dev.azure.com/${organization}/${project}/_apis`,
44
+ auth: {
45
+ username: '', // Empty for PAT auth
46
+ password: personalAccessToken
47
+ },
48
+ headers: {
49
+ 'Content-Type': 'application/json-patch+json',
50
+ 'Accept': 'application/json'
51
+ }
52
+ });
53
+ }
54
+
55
+ /**
56
+ * Get current status from ADO work item
57
+ *
58
+ * @param workItemId - ADO work item ID (e.g., 123)
59
+ * @returns Current work item state
60
+ */
61
+ async getStatus(workItemId: number): Promise<ExternalStatus> {
62
+ const response = await this.client.get(
63
+ `/wit/workitems/${workItemId}?api-version=7.0`
64
+ );
65
+
66
+ return {
67
+ state: response.data.fields['System.State']
68
+ };
69
+ }
70
+
71
+ /**
72
+ * Update ADO work item state
73
+ *
74
+ * Uses JSON Patch format to update System.State field.
75
+ *
76
+ * @param workItemId - ADO work item ID (e.g., 123)
77
+ * @param status - Desired status
78
+ */
79
+ async updateStatus(workItemId: number, status: ExternalStatus): Promise<void> {
80
+ // ADO uses JSON Patch format for updates
81
+ const patch = [
82
+ {
83
+ op: 'add',
84
+ path: '/fields/System.State',
85
+ value: status.state
86
+ }
87
+ ];
88
+
89
+ await this.client.patch(
90
+ `/wit/workitems/${workItemId}?api-version=7.0`,
91
+ patch
92
+ );
93
+ }
94
+
95
+ /**
96
+ * Post comment about status change to ADO work item
97
+ *
98
+ * @param workItemId - ADO work item ID (e.g., 123)
99
+ * @param oldStatus - Previous SpecWeave status
100
+ * @param newStatus - New SpecWeave status
101
+ */
102
+ async postStatusComment(
103
+ workItemId: number,
104
+ oldStatus: string,
105
+ newStatus: string
106
+ ): Promise<void> {
107
+ const text = `🔄 Status Update\n\n` +
108
+ `SpecWeave status changed:\n` +
109
+ `• From: ${oldStatus}\n` +
110
+ `• To: ${newStatus}\n` +
111
+ `• When: ${new Date().toISOString()}\n\n` +
112
+ `Synced from SpecWeave`;
113
+
114
+ await this.client.post(
115
+ `/wit/workitems/${workItemId}/comments?api-version=7.0-preview.3`,
116
+ {
117
+ text
118
+ }
119
+ );
120
+ }
121
+ }