specweave 0.22.2 → 0.22.4
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 +300 -920
- package/dist/src/cli/commands/repair-status-desync.d.ts +69 -0
- package/dist/src/cli/commands/repair-status-desync.d.ts.map +1 -0
- package/dist/src/cli/commands/repair-status-desync.js +221 -0
- package/dist/src/cli/commands/repair-status-desync.js.map +1 -0
- package/dist/src/cli/commands/sync-specs.d.ts +4 -1
- package/dist/src/cli/commands/sync-specs.d.ts.map +1 -1
- package/dist/src/cli/commands/sync-specs.js +99 -49
- package/dist/src/cli/commands/sync-specs.js.map +1 -1
- package/dist/src/cli/commands/validate-status-sync.d.ts +52 -0
- package/dist/src/cli/commands/validate-status-sync.d.ts.map +1 -0
- package/dist/src/cli/commands/validate-status-sync.js +176 -0
- package/dist/src/cli/commands/validate-status-sync.js.map +1 -0
- package/dist/src/cli/update-status-line.d.ts +16 -0
- package/dist/src/cli/update-status-line.d.ts.map +1 -0
- package/dist/src/cli/update-status-line.js +44 -0
- package/dist/src/cli/update-status-line.js.map +1 -0
- package/dist/src/core/cicd/workflow-monitor.d.ts +4 -0
- package/dist/src/core/cicd/workflow-monitor.d.ts.map +1 -1
- package/dist/src/core/cicd/workflow-monitor.js +6 -2
- package/dist/src/core/cicd/workflow-monitor.js.map +1 -1
- package/dist/src/core/increment/completion-validator.d.ts +56 -0
- package/dist/src/core/increment/completion-validator.d.ts.map +1 -0
- package/dist/src/core/increment/completion-validator.js +102 -0
- package/dist/src/core/increment/completion-validator.js.map +1 -0
- package/dist/src/core/increment/increment-archiver.d.ts +4 -1
- package/dist/src/core/increment/increment-archiver.d.ts.map +1 -1
- package/dist/src/core/increment/increment-archiver.js +21 -9
- package/dist/src/core/increment/increment-archiver.js.map +1 -1
- package/dist/src/core/increment/metadata-manager.d.ts +22 -0
- package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
- package/dist/src/core/increment/metadata-manager.js +62 -0
- package/dist/src/core/increment/metadata-manager.js.map +1 -1
- package/dist/src/core/increment/spec-frontmatter-updater.d.ts +78 -0
- package/dist/src/core/increment/spec-frontmatter-updater.d.ts.map +1 -0
- package/dist/src/core/increment/spec-frontmatter-updater.js +152 -0
- package/dist/src/core/increment/spec-frontmatter-updater.js.map +1 -0
- package/dist/src/core/increment/spec-sync-manager.d.ts +5 -1
- package/dist/src/core/increment/spec-sync-manager.d.ts.map +1 -1
- package/dist/src/core/increment/spec-sync-manager.js +4 -2
- package/dist/src/core/increment/spec-sync-manager.js.map +1 -1
- package/dist/src/core/increment-utils.d.ts.map +1 -1
- package/dist/src/core/increment-utils.js +18 -1
- package/dist/src/core/increment-utils.js.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.d.ts +5 -1
- package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -1
- package/dist/src/core/living-docs/living-docs-sync.js +36 -33
- package/dist/src/core/living-docs/living-docs-sync.js.map +1 -1
- package/dist/src/core/living-docs/task-project-specific-generator.d.ts.map +1 -1
- package/dist/src/core/living-docs/task-project-specific-generator.js +13 -8
- package/dist/src/core/living-docs/task-project-specific-generator.js.map +1 -1
- package/dist/src/core/status-line/status-line-manager.d.ts +3 -2
- package/dist/src/core/status-line/status-line-manager.d.ts.map +1 -1
- package/dist/src/core/status-line/status-line-manager.js +42 -17
- package/dist/src/core/status-line/status-line-manager.js.map +1 -1
- package/dist/src/core/status-line/status-line-updater.d.ts +67 -0
- package/dist/src/core/status-line/status-line-updater.d.ts.map +1 -0
- package/dist/src/core/status-line/status-line-updater.js +203 -0
- package/dist/src/core/status-line/status-line-updater.js.map +1 -0
- package/dist/src/core/status-line/types.d.ts +19 -5
- package/dist/src/core/status-line/types.d.ts.map +1 -1
- package/dist/src/core/status-line/types.js +3 -3
- package/dist/src/core/status-line/types.js.map +1 -1
- package/dist/src/integrations/jira/jira-incremental-mapper.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-incremental-mapper.js +4 -0
- package/dist/src/integrations/jira/jira-incremental-mapper.js.map +1 -1
- package/dist/src/integrations/jira/jira-mapper.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-mapper.js +4 -0
- package/dist/src/integrations/jira/jira-mapper.js.map +1 -1
- package/dist/src/utils/logger.d.ts +48 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +53 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/package.json +3 -2
- package/plugins/specweave/agents/code-standards-detective/AGENT.md +828 -0
- package/plugins/specweave/agents/test-aware-planner/templates/task-non-testable.md.template +12 -0
- package/plugins/specweave/agents/test-aware-planner/templates/task-testable.md.template +12 -0
- package/plugins/specweave/commands/specweave-analyze-standards.sh +315 -0
- package/plugins/specweave/commands/specweave-done.md +91 -4
- package/plugins/specweave/commands/specweave-reopen.md +29 -2
- package/plugins/specweave/commands/specweave-sync-docs.md +137 -22
- package/plugins/specweave/commands/specweave-update-status.md +151 -0
- package/plugins/specweave/hooks/lib/update-status-line.sh +39 -8
- package/plugins/specweave/hooks/user-prompt-submit.sh +21 -0
- package/plugins/specweave/hooks/validate-increment-completion.sh +113 -0
- package/plugins/specweave/skills/brownfield-analyzer/SKILL.md +40 -3
- package/plugins/specweave/skills/code-standards-analyzer/SKILL.md +455 -0
- package/plugins/specweave/templates/coding-standards.md.template +447 -0
- package/plugins/specweave-ado/lib/ado-multi-project-sync.js +0 -1
- package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +21 -0
- package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
- package/plugins/specweave-ado/lib/enhanced-ado-sync.js +0 -170
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +0 -3222
|
@@ -17,34 +17,60 @@ Arguments provided: [user's arguments]
|
|
|
17
17
|
|
|
18
18
|
**Parse the input**:
|
|
19
19
|
- Check for explicit mode: `review`, `update`, or none (auto-detect)
|
|
20
|
-
- Check for increment ID: `0001`, `0002`, etc., or none (
|
|
20
|
+
- Check for increment ID: `0001`, `0002`, etc., or none (sync all - NEW DEFAULT)
|
|
21
|
+
- Check for `--all` flag (explicit sync all)
|
|
22
|
+
|
|
23
|
+
**NEW DEFAULT BEHAVIOR (v0.23.0+)**:
|
|
24
|
+
- **No arguments** → Sync all increments with spec.md (batch mode)
|
|
25
|
+
- **Specific increment ID** → Sync that increment only
|
|
26
|
+
- **`--all` flag** → Sync all increments (explicit)
|
|
21
27
|
|
|
22
28
|
**Auto-detect logic**:
|
|
23
29
|
|
|
24
|
-
1. **If increment ID provided**:
|
|
30
|
+
1. **If no increment ID provided (NEW DEFAULT)**:
|
|
25
31
|
```bash
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
# Sync ALL increments with spec.md
|
|
33
|
+
echo "🔄 Syncing all increments..."
|
|
34
|
+
npx specweave sync-specs
|
|
35
|
+
# This will sync all non-archived increments
|
|
29
36
|
```
|
|
30
37
|
|
|
31
|
-
2. **If
|
|
38
|
+
2. **If increment ID provided**:
|
|
32
39
|
```bash
|
|
33
|
-
#
|
|
34
|
-
|
|
40
|
+
# Read the increment's spec.md to check status
|
|
41
|
+
INCREMENT_PATH=".specweave/increments/{increment_id}"
|
|
42
|
+
STATUS=$(grep "^status:" "$INCREMENT_PATH/spec.md" | cut -d: -f2 | tr -d ' ')
|
|
35
43
|
```
|
|
36
44
|
|
|
37
45
|
3. **Determine mode**:
|
|
38
46
|
```
|
|
39
|
-
If
|
|
40
|
-
|
|
41
|
-
If
|
|
42
|
-
|
|
47
|
+
If no increment ID → BATCH SYNC MODE (sync all)
|
|
48
|
+
|
|
49
|
+
If increment ID provided:
|
|
50
|
+
If status = "planned" → REVIEW MODE
|
|
51
|
+
If status = "in-progress" → UPDATE MODE
|
|
52
|
+
If status = "completed" → UPDATE MODE
|
|
53
|
+
If status = "closed" → UPDATE MODE
|
|
43
54
|
|
|
44
55
|
If explicit mode provided → Use that mode
|
|
45
56
|
```
|
|
46
57
|
|
|
47
|
-
**Output**:
|
|
58
|
+
**Output (Batch Mode)**:
|
|
59
|
+
```
|
|
60
|
+
🔄 Syncing all increments...
|
|
61
|
+
|
|
62
|
+
📚 Syncing 0040-vitest-living-docs-mock-fixes → FS-040...
|
|
63
|
+
✅ Synced 3 tasks to US-001
|
|
64
|
+
✅ Synced 0040 → FS-040
|
|
65
|
+
|
|
66
|
+
📚 Syncing 0041-living-docs-test-fixes → FS-041...
|
|
67
|
+
✅ Synced 2 tasks to US-001
|
|
68
|
+
✅ Synced 0041 → FS-041
|
|
69
|
+
|
|
70
|
+
✅ Sync complete: 15 increments synced, 0 failed
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Output (Single Mode)**:
|
|
48
74
|
```
|
|
49
75
|
🔍 Detected increment: {increment_id}
|
|
50
76
|
📊 Status: {status}
|
|
@@ -243,6 +269,57 @@ Synchronize living documentation in `.specweave/docs/` with learnings and decisi
|
|
|
243
269
|
|
|
244
270
|
### Execution Steps:
|
|
245
271
|
|
|
272
|
+
#### 0. 🔄 SYNC LIVING SPECS (User Stories, ACs, Tasks) - CRITICAL FIRST STEP
|
|
273
|
+
|
|
274
|
+
**🚨 MANDATORY: This MUST run FIRST before syncing strategic docs!**
|
|
275
|
+
|
|
276
|
+
Execute the living specs sync using the TypeScript CLI:
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
import { syncSpecs } from './dist/src/cli/commands/sync-specs.js';
|
|
280
|
+
|
|
281
|
+
console.log('═══════════════════════════════════════════════════════');
|
|
282
|
+
console.log('📋 STEP 0: SYNCING LIVING SPECS');
|
|
283
|
+
console.log('═══════════════════════════════════════════════════════\n');
|
|
284
|
+
console.log('🔄 Syncing user stories, acceptance criteria, and tasks...\n');
|
|
285
|
+
|
|
286
|
+
// Call sync-specs to sync living docs structure
|
|
287
|
+
await syncSpecs(['{increment_id}']);
|
|
288
|
+
|
|
289
|
+
console.log('\n✅ Living specs synced successfully!');
|
|
290
|
+
console.log(' - User stories created/updated in .specweave/docs/internal/specs/');
|
|
291
|
+
console.log(' - Acceptance criteria synchronized with completion status');
|
|
292
|
+
console.log(' - Tasks linked to user stories\n');
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**What this step does**:
|
|
296
|
+
- ✅ Parses increment spec.md and extracts user stories with ACs
|
|
297
|
+
- ✅ Syncs AC completion status from spec.md to user story files
|
|
298
|
+
- ✅ Updates task mappings in user story files
|
|
299
|
+
- ✅ Creates/updates feature files and README
|
|
300
|
+
- ✅ Ensures living specs are in sync BEFORE strategic docs
|
|
301
|
+
|
|
302
|
+
**Output**:
|
|
303
|
+
```
|
|
304
|
+
🎯 Target increment: {increment_id}
|
|
305
|
+
📁 Increment path: .specweave/increments/{increment_id}
|
|
306
|
+
🔄 Mode: Specs-only sync (Universal Hierarchy)
|
|
307
|
+
|
|
308
|
+
Processing...
|
|
309
|
+
📚 Syncing {increment_id} → {FS-XXX}...
|
|
310
|
+
✅ Synced 3 tasks to US-001
|
|
311
|
+
✅ Synced 2 tasks to US-002
|
|
312
|
+
|
|
313
|
+
✅ Synced {increment_id} → {FS-XXX}
|
|
314
|
+
Created: 5 files
|
|
315
|
+
|
|
316
|
+
═══════════════════════════════════════════════════════
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**CRITICAL**: If this step fails, STOP and report error. Do not proceed to strategic docs sync.
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
246
323
|
#### 1. Analyze Increment Artifacts
|
|
247
324
|
|
|
248
325
|
```bash
|
|
@@ -510,7 +587,16 @@ Increment: {increment_id} ({title})
|
|
|
510
587
|
Status: {status} → Documentation Updated
|
|
511
588
|
|
|
512
589
|
───────────────────────────────────────────────────────
|
|
513
|
-
|
|
590
|
+
📋 LIVING SPECS SYNCED (Step 0)
|
|
591
|
+
───────────────────────────────────────────────────────
|
|
592
|
+
|
|
593
|
+
✅ User Stories: {count} created/updated in .specweave/docs/internal/specs/
|
|
594
|
+
✅ Acceptance Criteria: Synchronized with completion status from spec.md
|
|
595
|
+
✅ Tasks: Linked to user stories with completion tracking
|
|
596
|
+
✅ Feature Files: Created/updated in .specweave/docs/internal/specs/_features/
|
|
597
|
+
|
|
598
|
+
───────────────────────────────────────────────────────
|
|
599
|
+
📊 STRATEGIC DOCS CHANGES (Steps 1-5)
|
|
514
600
|
───────────────────────────────────────────────────────
|
|
515
601
|
|
|
516
602
|
Created:
|
|
@@ -544,20 +630,27 @@ To restore: cp {file}.backup {file}
|
|
|
544
630
|
───────────────────────────────────────────────────────
|
|
545
631
|
|
|
546
632
|
1. Review updated documentation:
|
|
633
|
+
- Living specs: .specweave/docs/internal/specs/
|
|
547
634
|
- Public docs: .specweave/docs/public/
|
|
548
635
|
- Internal docs: .specweave/docs/internal/
|
|
549
636
|
- New ADRs: .specweave/docs/internal/architecture/adr/
|
|
550
637
|
|
|
551
|
-
2.
|
|
638
|
+
2. Verify living specs sync:
|
|
639
|
+
- Check user story files for updated AC checkboxes
|
|
640
|
+
- Verify tasks are linked correctly
|
|
641
|
+
- Confirm feature files are up to date
|
|
642
|
+
|
|
643
|
+
3. (Optional) Generate Docusaurus site:
|
|
552
644
|
- Use 'docusaurus' skill to publish updated docs
|
|
553
645
|
|
|
554
|
-
|
|
646
|
+
4. Commit changes:
|
|
555
647
|
git add .specweave/docs/
|
|
556
648
|
git commit -m "docs: sync from increment {increment_id}"
|
|
557
649
|
|
|
558
650
|
═══════════════════════════════════════════════════════
|
|
559
651
|
|
|
560
|
-
|
|
652
|
+
ALL documentation is now in sync with increment {increment_id}! 🎉
|
|
653
|
+
(Living specs + Strategic docs)
|
|
561
654
|
```
|
|
562
655
|
|
|
563
656
|
---
|
|
@@ -612,20 +705,42 @@ Usage: /specweave:sync-docs [review|update] [increment_id]
|
|
|
612
705
|
|
|
613
706
|
## EXAMPLES
|
|
614
707
|
|
|
615
|
-
### Example 1:
|
|
708
|
+
### Example 1: Sync all increments (NEW DEFAULT)
|
|
616
709
|
```
|
|
617
710
|
User: /specweave:sync-docs
|
|
618
711
|
|
|
619
712
|
Output:
|
|
620
|
-
|
|
713
|
+
🔄 Syncing all increments...
|
|
714
|
+
|
|
715
|
+
📚 Syncing 0040-vitest-living-docs-mock-fixes → FS-040...
|
|
716
|
+
✅ Synced 3 tasks to US-001
|
|
717
|
+
✅ Synced 0040 → FS-040
|
|
718
|
+
|
|
719
|
+
📚 Syncing 0041-living-docs-test-fixes → FS-041...
|
|
720
|
+
✅ Synced 2 tasks to US-001
|
|
721
|
+
✅ Synced 0041 → FS-041
|
|
722
|
+
|
|
723
|
+
📚 Syncing 0042-test-infrastructure-cleanup → FS-042...
|
|
724
|
+
✅ Synced 5 tasks to US-002
|
|
725
|
+
✅ Synced 0042 → FS-042
|
|
726
|
+
|
|
727
|
+
✅ Sync complete: 15 increments synced, 0 failed
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
### Example 2: Sync specific increment
|
|
731
|
+
```
|
|
732
|
+
User: /specweave:sync-docs 0042
|
|
733
|
+
|
|
734
|
+
Output:
|
|
735
|
+
🔍 Detected increment: 0042
|
|
621
736
|
📊 Status: completed
|
|
622
737
|
🎯 Mode: UPDATE
|
|
623
738
|
|
|
624
739
|
Proceeding with UPDATE mode...
|
|
625
|
-
{... executes update mode}
|
|
740
|
+
{... executes update mode for 0042 only}
|
|
626
741
|
```
|
|
627
742
|
|
|
628
|
-
### Example
|
|
743
|
+
### Example 3: Explicit review mode
|
|
629
744
|
```
|
|
630
745
|
User: /specweave:sync-docs review 0003
|
|
631
746
|
|
|
@@ -637,7 +752,7 @@ Output:
|
|
|
637
752
|
{... shows strategic documentation summary}
|
|
638
753
|
```
|
|
639
754
|
|
|
640
|
-
### Example
|
|
755
|
+
### Example 4: Explicit update mode with increment
|
|
641
756
|
```
|
|
642
757
|
User: /specweave:sync-docs update 0002
|
|
643
758
|
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specweave:update-status
|
|
3
|
+
description: Force-update status line cache with latest increment status
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Update Status Line
|
|
7
|
+
|
|
8
|
+
**Purpose**: Force-refresh status line cache when it appears stale or after making changes.
|
|
9
|
+
|
|
10
|
+
**Use When**:
|
|
11
|
+
- Status line doesn't reflect recent changes
|
|
12
|
+
- After completing tasks (want to see updated progress immediately)
|
|
13
|
+
- After status transitions (active → completed)
|
|
14
|
+
- Before checking progress with `/specweave:progress`
|
|
15
|
+
- When status line shows outdated information
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## How It Works
|
|
20
|
+
|
|
21
|
+
1. **Scan All Increments**
|
|
22
|
+
- Reads all spec.md files in `.specweave/increments/`
|
|
23
|
+
- Identifies open increments (status = active/planning/in-progress)
|
|
24
|
+
- Extracts creation dates from YAML frontmatter
|
|
25
|
+
|
|
26
|
+
2. **Select Current Increment**
|
|
27
|
+
- Sorts by creation date (oldest first)
|
|
28
|
+
- Takes first as current active increment
|
|
29
|
+
- Counts total open increments
|
|
30
|
+
|
|
31
|
+
3. **Parse Task Progress**
|
|
32
|
+
- Reads tasks.md from current increment
|
|
33
|
+
- Uses TaskCounter for accurate counting (no overcounting)
|
|
34
|
+
- Calculates: completed, total, percentage
|
|
35
|
+
|
|
36
|
+
4. **Update Cache**
|
|
37
|
+
- Writes `.specweave/state/status-line.json`
|
|
38
|
+
- Atomic write (temp file → rename)
|
|
39
|
+
- Runs SYNCHRONOUSLY (user waits ~50-100ms)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Force-update status line (no arguments)
|
|
47
|
+
/specweave:update-status
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Output**:
|
|
51
|
+
```
|
|
52
|
+
✓ Status line cache updated
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Example
|
|
58
|
+
|
|
59
|
+
**Before Update** (stale cache):
|
|
60
|
+
```
|
|
61
|
+
Status Line: [0043] ████░░░░ 5/8 tasks (2 open)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**After Update** (fresh cache):
|
|
65
|
+
```
|
|
66
|
+
Status Line: [0043] ████████ 8/8 tasks (1 open) ✓
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Integration with Other Commands
|
|
72
|
+
|
|
73
|
+
This command is automatically called by:
|
|
74
|
+
|
|
75
|
+
1. **`/specweave:progress`**
|
|
76
|
+
- Ensures status line is fresh before showing progress
|
|
77
|
+
- User always sees accurate completion percentages
|
|
78
|
+
|
|
79
|
+
2. **`/specweave:done`**
|
|
80
|
+
- Refreshes status line before PM validation
|
|
81
|
+
- Ensures final progress is accurate
|
|
82
|
+
|
|
83
|
+
3. **`/specweave:status`**
|
|
84
|
+
- Updates cache before showing increment list
|
|
85
|
+
- Shows current increment status
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Technical Details
|
|
90
|
+
|
|
91
|
+
**Performance**: ~50-100ms (synchronous execution)
|
|
92
|
+
|
|
93
|
+
**Cache Location**: `.specweave/state/status-line.json`
|
|
94
|
+
|
|
95
|
+
**Cache Format**:
|
|
96
|
+
```json
|
|
97
|
+
{
|
|
98
|
+
"current": {
|
|
99
|
+
"id": "0043-spec-md-desync-fix",
|
|
100
|
+
"name": "0043-spec-md-desync-fix",
|
|
101
|
+
"completed": 8,
|
|
102
|
+
"total": 8,
|
|
103
|
+
"percentage": 100
|
|
104
|
+
},
|
|
105
|
+
"openCount": 1,
|
|
106
|
+
"lastUpdate": "2025-11-18T15:30:00Z"
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Source of Truth**:
|
|
111
|
+
- Increment status: `spec.md` YAML frontmatter (NOT metadata.json)
|
|
112
|
+
- Task progress: `tasks.md` (TaskCounter for accuracy)
|
|
113
|
+
|
|
114
|
+
**Atomicity**: Uses temp file → rename pattern to prevent cache corruption
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Troubleshooting
|
|
119
|
+
|
|
120
|
+
**Status line still stale after update?**
|
|
121
|
+
1. Check if `.specweave/state/status-line.json` was modified
|
|
122
|
+
2. Verify spec.md has correct status in YAML frontmatter
|
|
123
|
+
3. Check tasks.md has proper task format (## T-001, etc.)
|
|
124
|
+
|
|
125
|
+
**Error: "Failed to update status line"**
|
|
126
|
+
- Ensure `.specweave/increments/` exists
|
|
127
|
+
- Check file permissions on `.specweave/state/`
|
|
128
|
+
- Verify spec.md has valid YAML frontmatter
|
|
129
|
+
|
|
130
|
+
**Cache shows wrong increment?**
|
|
131
|
+
- Status line shows oldest active increment by default
|
|
132
|
+
- Complete older increments first
|
|
133
|
+
- Or check `created` date in spec.md frontmatter
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## Implementation
|
|
138
|
+
|
|
139
|
+
**CLI**: `src/cli/update-status-line.ts`
|
|
140
|
+
**Core Logic**: `src/core/status-line/status-line-updater.ts`
|
|
141
|
+
**Hook (async)**: `plugins/specweave/hooks/lib/update-status-line.sh`
|
|
142
|
+
|
|
143
|
+
**Difference from Hook**:
|
|
144
|
+
- **Command**: SYNCHRONOUS (user waits, sees immediate result)
|
|
145
|
+
- **Hook**: ASYNCHRONOUS (background refresh, no blocking)
|
|
146
|
+
|
|
147
|
+
Both use same logic, different execution model.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
**This command ensures status line is ALWAYS fresh when you need it!** ✓
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
#
|
|
3
|
-
# update-status-line.sh (
|
|
3
|
+
# update-status-line.sh (Enhanced with AC Metrics)
|
|
4
4
|
#
|
|
5
5
|
# Updates status line cache with current increment progress.
|
|
6
|
-
# Shows: [increment-name] ████░░░░ X/Y tasks (Z open)
|
|
6
|
+
# Shows: [increment-name] ████░░░░ X/Y tasks | A/B ACs (Z open)
|
|
7
7
|
#
|
|
8
8
|
# Logic:
|
|
9
9
|
# 1. Scan all spec.md for status=active/planning (SOURCE OF TRUTH!)
|
|
10
10
|
# 2. Take first (oldest) as current increment
|
|
11
11
|
# 3. Count all active/planning as openCount
|
|
12
|
-
# 4. Parse current increment's tasks.md for progress
|
|
13
|
-
# 5.
|
|
12
|
+
# 4. Parse current increment's tasks.md for task progress
|
|
13
|
+
# 5. Parse current increment's spec.md for AC progress
|
|
14
|
+
# 6. Write to cache
|
|
14
15
|
#
|
|
15
16
|
# Performance: 50-100ms (runs async, user doesn't wait)
|
|
16
17
|
|
|
@@ -105,8 +106,11 @@ if [[ -f "$TASKS_FILE" ]]; then
|
|
|
105
106
|
TOTAL_TASKS=$(grep -cE '^##+ T-' "$TASKS_FILE" 2>/dev/null || echo 0)
|
|
106
107
|
TOTAL_TASKS=$(echo "$TOTAL_TASKS" | tr -d '\n\r ' || echo 0)
|
|
107
108
|
|
|
108
|
-
# Count completed tasks -
|
|
109
|
-
|
|
109
|
+
# Count completed tasks - recognize all three completion marker formats:
|
|
110
|
+
# 1. **Completed**: <date> (preferred format)
|
|
111
|
+
# 2. **Status**: [x] (legacy format)
|
|
112
|
+
# 3. [x] at line start (legacy checkbox format)
|
|
113
|
+
COMPLETED_TASKS=$(grep -cE '(\*\*Completed\*\*:|\*\*Status\*\*:\s*\[x\]|^\[x\])' "$TASKS_FILE" 2>/dev/null || echo 0)
|
|
110
114
|
COMPLETED_TASKS=$(echo "$COMPLETED_TASKS" | tr -d '\n\r ' || echo 0)
|
|
111
115
|
|
|
112
116
|
# Calculate percentage
|
|
@@ -116,19 +120,44 @@ if [[ -f "$TASKS_FILE" ]]; then
|
|
|
116
120
|
fi
|
|
117
121
|
fi
|
|
118
122
|
|
|
123
|
+
# Step 4b: Parse spec.md for AC (Acceptance Criteria) progress
|
|
124
|
+
SPEC_FILE="$INCREMENTS_DIR/$CURRENT_INCREMENT/spec.md"
|
|
125
|
+
TOTAL_ACS=0
|
|
126
|
+
COMPLETED_ACS=0
|
|
127
|
+
OPEN_ACS=0
|
|
128
|
+
|
|
129
|
+
if [[ -f "$SPEC_FILE" ]]; then
|
|
130
|
+
# Count total ACs: both checked and unchecked
|
|
131
|
+
# Pattern: - [ ] **AC- OR - [x] **AC-
|
|
132
|
+
TOTAL_ACS=$(grep -cE '^- \[(x| )\] \*\*AC-' "$SPEC_FILE" 2>/dev/null || echo 0)
|
|
133
|
+
TOTAL_ACS=$(echo "$TOTAL_ACS" | tr -d '\n\r ' || echo 0)
|
|
134
|
+
|
|
135
|
+
# Count completed ACs (checked)
|
|
136
|
+
# Pattern: - [x] **AC-
|
|
137
|
+
COMPLETED_ACS=$(grep -cE '^- \[x\] \*\*AC-' "$SPEC_FILE" 2>/dev/null || echo 0)
|
|
138
|
+
COMPLETED_ACS=$(echo "$COMPLETED_ACS" | tr -d '\n\r ' || echo 0)
|
|
139
|
+
|
|
140
|
+
# Count open ACs (unchecked)
|
|
141
|
+
# Pattern: - [ ] **AC-
|
|
142
|
+
OPEN_ACS=$(grep -cE '^- \[ \] \*\*AC-' "$SPEC_FILE" 2>/dev/null || echo 0)
|
|
143
|
+
OPEN_ACS=$(echo "$OPEN_ACS" | tr -d '\n\r ' || echo 0)
|
|
144
|
+
fi
|
|
145
|
+
|
|
119
146
|
# Step 5: Extract increment ID and name
|
|
120
147
|
# Format: XXXX-name where XXXX is 4-digit prefix (brackets added by manager)
|
|
121
148
|
INCREMENT_ID=$(echo "$CURRENT_INCREMENT" | grep -oE '^[0-9]{4}')
|
|
122
149
|
INCREMENT_NAME_ONLY=$(echo "$CURRENT_INCREMENT" | sed 's/^[0-9]\{4\}-//')
|
|
123
150
|
INCREMENT_NAME="$INCREMENT_ID-$INCREMENT_NAME_ONLY"
|
|
124
151
|
|
|
125
|
-
# Step 6: Write cache
|
|
152
|
+
# Step 6: Write cache (now includes AC metrics)
|
|
126
153
|
jq -n \
|
|
127
154
|
--arg id "$CURRENT_INCREMENT" \
|
|
128
155
|
--arg name "$INCREMENT_NAME" \
|
|
129
156
|
--argjson completed "$COMPLETED_TASKS" \
|
|
130
157
|
--argjson total "$TOTAL_TASKS" \
|
|
131
158
|
--argjson percentage "$PERCENTAGE" \
|
|
159
|
+
--argjson acsCompleted "$COMPLETED_ACS" \
|
|
160
|
+
--argjson acsTotal "$TOTAL_ACS" \
|
|
132
161
|
--argjson openCount "$OPEN_COUNT" \
|
|
133
162
|
'{
|
|
134
163
|
current: {
|
|
@@ -136,7 +165,9 @@ jq -n \
|
|
|
136
165
|
name: $name,
|
|
137
166
|
completed: $completed,
|
|
138
167
|
total: $total,
|
|
139
|
-
percentage: $percentage
|
|
168
|
+
percentage: $percentage,
|
|
169
|
+
acsCompleted: $acsCompleted,
|
|
170
|
+
acsTotal: $acsTotal
|
|
140
171
|
},
|
|
141
172
|
openCount: $openCount,
|
|
142
173
|
lastUpdate: (now | strftime("%Y-%m-%dT%H:%M:%SZ"))
|
|
@@ -342,6 +342,27 @@ if echo "$PROMPT" | grep -qiE "(add|create|implement|build|develop)" && ! echo "
|
|
|
342
342
|
fi
|
|
343
343
|
fi
|
|
344
344
|
|
|
345
|
+
# ==============================================================================
|
|
346
|
+
# STATUS LINE REFRESH: Ensure cache is fresh before showing context
|
|
347
|
+
# ==============================================================================
|
|
348
|
+
# Performance: ~50-100ms (acceptable for UX)
|
|
349
|
+
# Frequency: Every user prompt (high coverage)
|
|
350
|
+
# Benefit: Catches ALL edge cases (manual edits, resume, direct changes)
|
|
351
|
+
#
|
|
352
|
+
# Why here? This hook runs on EVERY user prompt, ensuring status line
|
|
353
|
+
# is ALWAYS up-to-date before showing context to the user.
|
|
354
|
+
#
|
|
355
|
+
# Prevents desync scenarios:
|
|
356
|
+
# - Manual spec.md edits (status: planning → active)
|
|
357
|
+
# - /specweave:resume (status: paused → active)
|
|
358
|
+
# - Direct metadata changes (without hook triggers)
|
|
359
|
+
# - File system operations bypassing hooks
|
|
360
|
+
#
|
|
361
|
+
# Background execution: Runs async, doesn't block user prompt
|
|
362
|
+
|
|
363
|
+
HOOK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
364
|
+
bash "$HOOK_DIR/lib/update-status-line.sh" 2>/dev/null || true
|
|
365
|
+
|
|
345
366
|
# ==============================================================================
|
|
346
367
|
# OUTPUT: Approve with context or no context
|
|
347
368
|
# ==============================================================================
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# Pre-commit hook: Validate Increment Completion
|
|
4
|
+
#
|
|
5
|
+
# Prevents commits where increment status="completed" but:
|
|
6
|
+
# - Acceptance criteria are still open (- [ ] **AC-...)
|
|
7
|
+
# - Tasks are still pending (**Status**: [ ] pending)
|
|
8
|
+
#
|
|
9
|
+
# This prevents false completion and data integrity violations.
|
|
10
|
+
#
|
|
11
|
+
# Exit code 0: All completed increments are valid (allow commit)
|
|
12
|
+
# Exit code 1: Invalid completion detected (block commit)
|
|
13
|
+
|
|
14
|
+
# ANSI colors
|
|
15
|
+
RED='\033[0;31m'
|
|
16
|
+
YELLOW='\033[1;33m'
|
|
17
|
+
GREEN='\033[0;32m'
|
|
18
|
+
NC='\033[0m' # No Color
|
|
19
|
+
|
|
20
|
+
# Check if in SpecWeave project
|
|
21
|
+
if [ ! -d ".specweave/increments" ]; then
|
|
22
|
+
# Not a SpecWeave project, skip validation
|
|
23
|
+
exit 0
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Track if any validation failures found
|
|
27
|
+
has_failures=false
|
|
28
|
+
|
|
29
|
+
# Check all increments
|
|
30
|
+
for increment_dir in .specweave/increments/*/; do
|
|
31
|
+
# Skip if not a directory
|
|
32
|
+
[ ! -d "$increment_dir" ] && continue
|
|
33
|
+
|
|
34
|
+
increment_id=$(basename "$increment_dir")
|
|
35
|
+
spec_file="$increment_dir/spec.md"
|
|
36
|
+
tasks_file="$increment_dir/tasks.md"
|
|
37
|
+
metadata_file="$increment_dir/metadata.json"
|
|
38
|
+
|
|
39
|
+
# Skip if required files don't exist
|
|
40
|
+
[ ! -f "$spec_file" ] && continue
|
|
41
|
+
[ ! -f "$tasks_file" ] && continue
|
|
42
|
+
|
|
43
|
+
# Get status from spec.md frontmatter
|
|
44
|
+
spec_status=$(grep -m1 "^status:" "$spec_file" 2>/dev/null | cut -d: -f2 | tr -d ' ')
|
|
45
|
+
|
|
46
|
+
# Get status from metadata.json (if exists)
|
|
47
|
+
metadata_status=""
|
|
48
|
+
if [ -f "$metadata_file" ]; then
|
|
49
|
+
metadata_status=$(grep -m1 '"status"' "$metadata_file" 2>/dev/null | cut -d'"' -f4)
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Only validate if status is "completed"
|
|
53
|
+
if [ "$spec_status" = "completed" ] || [ "$metadata_status" = "completed" ]; then
|
|
54
|
+
# Count open acceptance criteria (- [ ] **AC-)
|
|
55
|
+
open_acs=$(grep -c "^- \[ \] \*\*AC-" "$spec_file" 2>/dev/null || echo 0)
|
|
56
|
+
|
|
57
|
+
# Count pending tasks (**Status**: [ ] pending)
|
|
58
|
+
pending_tasks=$(grep -ic "\*\*Status\*\*:\s*\[\s*\]\s*pending" "$tasks_file" 2>/dev/null || echo 0)
|
|
59
|
+
|
|
60
|
+
# Validate
|
|
61
|
+
if [ "$open_acs" -gt 0 ] || [ "$pending_tasks" -gt 0 ]; then
|
|
62
|
+
has_failures=true
|
|
63
|
+
|
|
64
|
+
echo -e "${RED}❌ COMMIT BLOCKED: Invalid completion detected${NC}"
|
|
65
|
+
echo -e "${YELLOW}Increment: $increment_id${NC}"
|
|
66
|
+
echo -e "Status: $spec_status (spec.md) / $metadata_status (metadata.json)"
|
|
67
|
+
echo ""
|
|
68
|
+
|
|
69
|
+
if [ "$open_acs" -gt 0 ]; then
|
|
70
|
+
echo -e "${RED} • $open_acs acceptance criteria still open${NC}"
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
if [ "$pending_tasks" -gt 0 ]; then
|
|
74
|
+
echo -e "${RED} • $pending_tasks tasks still pending${NC}"
|
|
75
|
+
fi
|
|
76
|
+
|
|
77
|
+
echo ""
|
|
78
|
+
echo -e "${YELLOW}Fix options:${NC}"
|
|
79
|
+
echo " 1. Complete the open work before committing"
|
|
80
|
+
echo " 2. Change status to 'active' or 'paused' in both spec.md and metadata.json"
|
|
81
|
+
echo ""
|
|
82
|
+
echo -e "${YELLOW}To see details:${NC}"
|
|
83
|
+
echo " cat $spec_file | grep '- \[ \] \*\*AC-'"
|
|
84
|
+
echo " cat $tasks_file | grep -i 'Status.*pending'"
|
|
85
|
+
echo ""
|
|
86
|
+
fi
|
|
87
|
+
fi
|
|
88
|
+
done
|
|
89
|
+
|
|
90
|
+
# Exit with failure if any validation failures
|
|
91
|
+
if [ "$has_failures" = true ]; then
|
|
92
|
+
echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
93
|
+
echo -e "${RED}COMMIT BLOCKED: Cannot commit increments with invalid completion${NC}"
|
|
94
|
+
echo -e "${RED}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
95
|
+
echo ""
|
|
96
|
+
echo -e "${YELLOW}Why this matters:${NC}"
|
|
97
|
+
echo " • Prevents false completion (status='completed' with open work)"
|
|
98
|
+
echo " • Ensures data integrity (metadata matches reality)"
|
|
99
|
+
echo " • Stops misleading status line and GitHub sync"
|
|
100
|
+
echo ""
|
|
101
|
+
echo -e "${YELLOW}To fix:${NC}"
|
|
102
|
+
echo " 1. Complete all open ACs and pending tasks, OR"
|
|
103
|
+
echo " 2. Change status to 'active'/'paused' in spec.md and metadata.json"
|
|
104
|
+
echo ""
|
|
105
|
+
echo -e "${YELLOW}To bypass (NOT RECOMMENDED):${NC}"
|
|
106
|
+
echo " git commit --no-verify"
|
|
107
|
+
echo ""
|
|
108
|
+
exit 1
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
# All validations passed
|
|
112
|
+
echo -e "${GREEN}✅ Completion validation passed${NC}"
|
|
113
|
+
exit 0
|
|
@@ -20,9 +20,10 @@ description: Analyzes existing brownfield projects to map documentation structur
|
|
|
20
20
|
3. **Classify Documents** - Identify PRD, HLD, ADR, Spec, Runbook candidates
|
|
21
21
|
4. **Detect External Tools** - Find Jira, ADO, GitHub project references
|
|
22
22
|
5. **Analyze Diagrams** - Identify architecture diagrams (PNG, SVG, drawio)
|
|
23
|
-
6. **
|
|
24
|
-
7. **
|
|
25
|
-
8. **
|
|
23
|
+
6. **Discover Coding Standards** - Auto-detect naming conventions, patterns, linting rules 🆕
|
|
24
|
+
7. **Generate Migration Plan** - Create actionable migration plan with effort estimate
|
|
25
|
+
8. **Suggest Increment Mapping** - Map Jira Epics/ADO Features to SpecWeave Increments
|
|
26
|
+
9. **Support Two Paths** - Quick Start (incremental) OR Comprehensive (upfront) 🆕
|
|
26
27
|
|
|
27
28
|
---
|
|
28
29
|
|
|
@@ -336,6 +337,42 @@ build/**
|
|
|
336
337
|
- PNG/DrawIO → Suggest Mermaid conversion
|
|
337
338
|
- Estimate: 15-30 minutes per diagram
|
|
338
339
|
|
|
340
|
+
### Step 4.5: Coding Standards Discovery 🆕
|
|
341
|
+
|
|
342
|
+
**Auto-detect coding standards from codebase** using code-standards-detective agent.
|
|
343
|
+
|
|
344
|
+
**Execution**:
|
|
345
|
+
```bash
|
|
346
|
+
# Run during brownfield analysis (automatic)
|
|
347
|
+
# Or manually: /specweave:analyze-standards
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**What it discovers**:
|
|
351
|
+
1. **Explicit Standards** - Parse ESLint, Prettier, TypeScript, EditorConfig
|
|
352
|
+
2. **Implicit Standards** - Analyze naming conventions (98% camelCase?), import patterns, function styles
|
|
353
|
+
3. **Anti-Patterns** - Detect console.* usage, hardcoded secrets, large files (>500 lines)
|
|
354
|
+
4. **Type Safety** - Count `any` usage, interface vs type preference
|
|
355
|
+
5. **Error Handling** - Analyze try/catch patterns, custom error classes
|
|
356
|
+
|
|
357
|
+
**Statistical Analysis**:
|
|
358
|
+
- Confidence levels (HIGH 90%+, MEDIUM 70-89%, LOW 50-69%)
|
|
359
|
+
- Real code examples from codebase
|
|
360
|
+
- Inconsistency warnings
|
|
361
|
+
|
|
362
|
+
**Output**:
|
|
363
|
+
```
|
|
364
|
+
.specweave/docs/internal/governance/coding-standards-analysis.md
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
**Benefits**:
|
|
368
|
+
- ✅ New contributors understand project conventions immediately
|
|
369
|
+
- ✅ Documents "tribal knowledge" that only exists in code
|
|
370
|
+
- ✅ Detects security issues (hardcoded secrets, missing validation)
|
|
371
|
+
- ✅ Provides baseline for code quality improvements
|
|
372
|
+
- ✅ Identifies technical debt (large functions, missing error handling)
|
|
373
|
+
|
|
374
|
+
**Integration**: This step runs automatically during brownfield analysis, providing coding standards context alongside documentation structure.
|
|
375
|
+
|
|
339
376
|
### Step 5: Effort Estimation
|
|
340
377
|
|
|
341
378
|
**Calculate total effort**:
|