specweave 0.26.10 → 0.26.13
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.
- package/CLAUDE.md +95 -520
- package/dist/plugins/specweave-github/lib/completion-calculator.d.ts +4 -1
- package/dist/plugins/specweave-github/lib/completion-calculator.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/completion-calculator.js +49 -29
- package/dist/plugins/specweave-github/lib/completion-calculator.js.map +1 -1
- package/dist/src/cli/commands/init.js +2 -2
- package/dist/src/cli/commands/init.js.map +1 -1
- package/dist/src/core/increment/increment-archiver.d.ts +3 -0
- package/dist/src/core/increment/increment-archiver.d.ts.map +1 -1
- package/dist/src/core/increment/increment-archiver.js +35 -4
- package/dist/src/core/increment/increment-archiver.js.map +1 -1
- package/dist/src/core/living-docs/feature-archiver.d.ts +5 -0
- package/dist/src/core/living-docs/feature-archiver.d.ts.map +1 -1
- package/dist/src/core/living-docs/feature-archiver.js +66 -18
- package/dist/src/core/living-docs/feature-archiver.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/commands/specweave-archive.md +10 -1
- package/plugins/specweave/hooks/hooks.json +10 -0
- package/plugins/specweave/hooks/lib/update-active-increment.sh +96 -0
- package/plugins/specweave/hooks/lib/update-status-line.sh +153 -189
- package/plugins/specweave/hooks/post-edit-write-consolidated.sh +6 -0
- package/plugins/specweave/hooks/post-metadata-change.sh +9 -0
- package/plugins/specweave/hooks/post-task-completion.sh +8 -0
- package/plugins/specweave/hooks/post-task-edit.sh +37 -0
- package/plugins/specweave/hooks/pre-command-deduplication.sh +43 -53
- package/plugins/specweave/hooks/pre-tool-use.sh +5 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +143 -289
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +18 -0
- package/plugins/specweave-github/lib/completion-calculator.js +34 -16
- package/plugins/specweave-github/lib/completion-calculator.ts +54 -32
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +27 -0
- package/src/templates/AGENTS.md.template +301 -2452
- package/src/templates/CLAUDE.md.template +99 -667
|
@@ -212,8 +212,11 @@ export class CompletionCalculator {
|
|
|
212
212
|
* Process:
|
|
213
213
|
* 1. Find increment link in user story's "Implementation" section
|
|
214
214
|
* 2. Read increment's tasks.md
|
|
215
|
-
* 3. Filter tasks that reference this user story
|
|
215
|
+
* 3. Filter tasks that reference this user story (via **User Story** field OR AC-IDs)
|
|
216
216
|
* 4. Extract completion status from **Status**: [x] or [ ]
|
|
217
|
+
*
|
|
218
|
+
* IMPORTANT: Checks **User Story** field FIRST (handles multi-story tasks like "US-001, US-002"),
|
|
219
|
+
* then falls back to AC-based filtering. Also handles "Satisfies ACs: All" correctly.
|
|
217
220
|
*/
|
|
218
221
|
private async extractTasks(userStoryContent: string, userStoryId: string): Promise<Task[]> {
|
|
219
222
|
const tasks: Task[] = [];
|
|
@@ -252,12 +255,20 @@ export class CompletionCalculator {
|
|
|
252
255
|
|
|
253
256
|
const tasksContent = await readFile(tasksPath, 'utf-8');
|
|
254
257
|
|
|
255
|
-
//
|
|
258
|
+
// Normalize the current user story ID for comparison
|
|
259
|
+
// Handles: "US-001", "US-1", "US001", "001"
|
|
260
|
+
const normalizeUsId = (id: string): string => {
|
|
261
|
+
const num = id.replace(/^US-?0*/, ''); // Remove "US-", "US", and leading zeros
|
|
262
|
+
return `US-${num.padStart(3, '0')}`; // Normalize to "US-001" format
|
|
263
|
+
};
|
|
264
|
+
const normalizedCurrentUs = normalizeUsId(userStoryId);
|
|
265
|
+
|
|
266
|
+
// Extract tasks that reference this User Story
|
|
256
267
|
// Pattern:
|
|
257
268
|
// ### T-001: Task Title
|
|
258
|
-
// **User Story**:
|
|
259
|
-
// **
|
|
260
|
-
// **
|
|
269
|
+
// **User Story**: US-001, US-002 ← Check this FIRST!
|
|
270
|
+
// **Satisfies ACs**: AC-US1-01, AC-US1-02 (or "All")
|
|
271
|
+
// **Status**: [x] completed
|
|
261
272
|
const taskPattern = /###?\s+(T-\d+):\s*([^\n]+)\n([\s\S]*?)(?=\n###?\s+T-\d+:|$)/g;
|
|
262
273
|
let match;
|
|
263
274
|
|
|
@@ -266,34 +277,41 @@ export class CompletionCalculator {
|
|
|
266
277
|
const taskTitle = match[2].trim();
|
|
267
278
|
const taskBody = match[3];
|
|
268
279
|
|
|
269
|
-
//
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
280
|
+
// PRIORITY 1: Check **User Story** field directly (handles multi-story tasks!)
|
|
281
|
+
// Pattern: **User Story**: US-001, US-002, US-003
|
|
282
|
+
const userStoryFieldMatch = taskBody.match(/\*\*User Story\*\*:\s*([^\n]+)/);
|
|
283
|
+
let belongsToThisUS = false;
|
|
284
|
+
|
|
285
|
+
if (userStoryFieldMatch) {
|
|
286
|
+
const userStoryList = userStoryFieldMatch[1].trim();
|
|
287
|
+
// Split by comma and check if any matches current user story
|
|
288
|
+
const userStoryIds = userStoryList.split(',').map((us) => us.trim());
|
|
289
|
+
belongsToThisUS = userStoryIds.some((usId) => {
|
|
290
|
+
return normalizeUsId(usId) === normalizedCurrentUs;
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// PRIORITY 2: Fall back to AC-based filtering (legacy support)
|
|
295
|
+
if (!belongsToThisUS) {
|
|
296
|
+
const acMatch = taskBody.match(/\*\*(?:Satisfies ACs?|AC)\*\*:\s*([^\n]+)/);
|
|
297
|
+
if (acMatch) {
|
|
298
|
+
const acList = acMatch[1].trim();
|
|
299
|
+
|
|
300
|
+
// Handle special "All" case - if "All", include task if User Story field matched
|
|
301
|
+
// (already handled above), otherwise skip AC-based check for "All"
|
|
302
|
+
if (acList.toLowerCase() !== 'all') {
|
|
303
|
+
const acIds = acList.split(',').map((ac) => ac.trim());
|
|
304
|
+
belongsToThisUS = acIds.some((acId) => {
|
|
305
|
+
// Extract US ID from AC-ID: AC-US1-01 → US-001
|
|
306
|
+
const usMatch = acId.match(/AC-([A-Z]+\d+)-/);
|
|
307
|
+
if (!usMatch) return false;
|
|
308
|
+
|
|
309
|
+
const extractedUsId = usMatch[1]; // e.g., "US1" or "US001"
|
|
310
|
+
return normalizeUsId(extractedUsId) === normalizedCurrentUs;
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
}
|
|
273
314
|
}
|
|
274
|
-
const acList = acMatch[1].trim();
|
|
275
|
-
|
|
276
|
-
// Check if any AC in this task belongs to current User Story
|
|
277
|
-
// AC-US1-01 → US-001
|
|
278
|
-
// AC-US001-01 → US-001
|
|
279
|
-
const acIds = acList.split(',').map((ac) => ac.trim());
|
|
280
|
-
const belongsToThisUS = acIds.some((acId) => {
|
|
281
|
-
// Extract US ID from AC-ID
|
|
282
|
-
// AC-US1-01 → US1 → US-001
|
|
283
|
-
// AC-US001-01 → US001 → US-001
|
|
284
|
-
const usMatch = acId.match(/AC-([A-Z]+\d+)-/);
|
|
285
|
-
if (!usMatch) return false;
|
|
286
|
-
|
|
287
|
-
// Normalize to US-XXX format (pad with zeros)
|
|
288
|
-
const extractedUsId = usMatch[1]; // e.g., "US1" or "US001"
|
|
289
|
-
const extractedNum = extractedUsId.replace(/^US/, ''); // "1" or "001"
|
|
290
|
-
const normalizedExtracted = `US-${extractedNum.padStart(3, '0')}`; // "US-001"
|
|
291
|
-
|
|
292
|
-
const currentNum = userStoryId.replace(/^US-?/, ''); // "001" or "1"
|
|
293
|
-
const normalizedCurrent = `US-${currentNum.padStart(3, '0')}`; // "US-001"
|
|
294
|
-
|
|
295
|
-
return normalizedExtracted === normalizedCurrent;
|
|
296
|
-
});
|
|
297
315
|
|
|
298
316
|
if (!belongsToThisUS) {
|
|
299
317
|
continue;
|
|
@@ -303,6 +321,10 @@ export class CompletionCalculator {
|
|
|
303
321
|
const statusMatch = taskBody.match(/\*\*Status\*\*:\s*\[([x ])\]/);
|
|
304
322
|
const completed = statusMatch ? statusMatch[1] === 'x' : false;
|
|
305
323
|
|
|
324
|
+
// Extract AC list for userStories field (for backward compatibility)
|
|
325
|
+
const acMatch = taskBody.match(/\*\*(?:Satisfies ACs?|AC)\*\*:\s*([^\n]+)/);
|
|
326
|
+
const acIds = acMatch ? acMatch[1].trim().split(',').map((ac) => ac.trim()) : [];
|
|
327
|
+
|
|
306
328
|
tasks.push({
|
|
307
329
|
id: taskId,
|
|
308
330
|
title: taskTitle,
|
|
@@ -979,3 +979,30 @@
|
|
|
979
979
|
[2025-11-24 13:51:36] 🎯 Post-Increment-Completion Hook Triggered
|
|
980
980
|
[2025-11-24 13:51:36] ⚠️ DORA calculator not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-release/hooks/dist/src/metrics/dora-calculator.js
|
|
981
981
|
[2025-11-24 13:51:36] Run: npm run build
|
|
982
|
+
[2025-11-24 14:07:40] 🎯 Post-Increment-Completion Hook Triggered
|
|
983
|
+
[2025-11-24 14:07:40] ⚠️ DORA calculator not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-release/hooks/dist/src/metrics/dora-calculator.js
|
|
984
|
+
[2025-11-24 14:07:40] Run: npm run build
|
|
985
|
+
[2025-11-24 14:07:40] 🎯 Post-Increment-Completion Hook Triggered
|
|
986
|
+
[2025-11-24 14:07:40] ⚠️ DORA calculator not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-release/hooks/dist/src/metrics/dora-calculator.js
|
|
987
|
+
[2025-11-24 14:07:40] Run: npm run build
|
|
988
|
+
[2025-11-24 14:07:40] 🎯 Post-Increment-Completion Hook Triggered
|
|
989
|
+
[2025-11-24 14:07:40] ⚠️ DORA calculator not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-release/hooks/dist/src/metrics/dora-calculator.js
|
|
990
|
+
[2025-11-24 14:07:41] Run: npm run build
|
|
991
|
+
[2025-11-24 14:08:03] 🎯 Post-Increment-Completion Hook Triggered
|
|
992
|
+
[2025-11-24 14:08:03] ⚠️ DORA calculator not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-release/hooks/dist/src/metrics/dora-calculator.js
|
|
993
|
+
[2025-11-24 14:08:03] Run: npm run build
|
|
994
|
+
[2025-11-24 14:08:03] 🎯 Post-Increment-Completion Hook Triggered
|
|
995
|
+
[2025-11-24 14:08:03] ⚠️ DORA calculator not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-release/hooks/dist/src/metrics/dora-calculator.js
|
|
996
|
+
[2025-11-24 14:08:03] Run: npm run build
|
|
997
|
+
[2025-11-24 14:08:03] 🎯 Post-Increment-Completion Hook Triggered
|
|
998
|
+
[2025-11-24 14:08:03] ⚠️ DORA calculator not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-release/hooks/dist/src/metrics/dora-calculator.js
|
|
999
|
+
[2025-11-24 14:08:03] Run: npm run build
|
|
1000
|
+
[2025-11-24 15:02:47] 🎯 Post-Increment-Completion Hook Triggered
|
|
1001
|
+
[2025-11-24 15:02:47] ⚠️ DORA calculator not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-release/hooks/dist/src/metrics/dora-calculator.js
|
|
1002
|
+
[2025-11-24 15:02:47] Run: npm run build
|
|
1003
|
+
[2025-11-24 15:02:47] 🎯 Post-Increment-Completion Hook Triggered
|
|
1004
|
+
[2025-11-24 15:02:47] ⚠️ DORA calculator not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-release/hooks/dist/src/metrics/dora-calculator.js
|
|
1005
|
+
[2025-11-24 15:02:47] Run: npm run build
|
|
1006
|
+
[2025-11-24 15:02:47] 🎯 Post-Increment-Completion Hook Triggered
|
|
1007
|
+
[2025-11-24 15:02:47] ⚠️ DORA calculator not found at /Users/antonabyzov/Projects/github/specweave/plugins/specweave-release/hooks/dist/src/metrics/dora-calculator.js
|
|
1008
|
+
[2025-11-24 15:02:47] Run: npm run build
|