specweave 0.28.17 → 0.28.20
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/dist/plugins/specweave-ado/lib/ado-board-resolver.d.ts +94 -0
- package/dist/plugins/specweave-ado/lib/ado-board-resolver.d.ts.map +1 -0
- package/dist/plugins/specweave-ado/lib/ado-board-resolver.js +219 -0
- package/dist/plugins/specweave-ado/lib/ado-board-resolver.js.map +1 -0
- package/dist/plugins/specweave-ado/lib/ado-spec-sync.d.ts +16 -0
- package/dist/plugins/specweave-ado/lib/ado-spec-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-sync.js +63 -3
- package/dist/plugins/specweave-ado/lib/ado-spec-sync.js.map +1 -1
- package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts +12 -3
- package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-ado/lib/ado-status-sync.js +37 -3
- package/dist/plugins/specweave-ado/lib/ado-status-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts +6 -11
- package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-feature-sync.js +6 -11
- package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.d.ts +21 -0
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js +445 -0
- package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-status-sync.d.ts +10 -0
- package/dist/plugins/specweave-github/lib/github-status-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-status-sync.js +40 -2
- package/dist/plugins/specweave-github/lib/github-status-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/increment-issue-builder.d.ts +94 -0
- package/dist/plugins/specweave-github/lib/increment-issue-builder.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/increment-issue-builder.js +369 -0
- package/dist/plugins/specweave-github/lib/increment-issue-builder.js.map +1 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.d.ts +50 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.d.ts.map +1 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.js +84 -0
- package/dist/plugins/specweave-jira/lib/jira-board-resolver.js.map +1 -0
- package/dist/plugins/specweave-jira/lib/jira-spec-sync.d.ts +12 -0
- package/dist/plugins/specweave-jira/lib/jira-spec-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-jira/lib/jira-spec-sync.js +57 -5
- package/dist/plugins/specweave-jira/lib/jira-spec-sync.js.map +1 -1
- package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts +5 -1
- package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-jira/lib/jira-status-sync.js +12 -4
- package/dist/plugins/specweave-jira/lib/jira-status-sync.js.map +1 -1
- package/dist/src/cli/commands/import-external.d.ts.map +1 -1
- package/dist/src/cli/commands/import-external.js +12 -7
- package/dist/src/cli/commands/import-external.js.map +1 -1
- package/dist/src/cli/helpers/init/external-import.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/external-import.js +308 -36
- package/dist/src/cli/helpers/init/external-import.js.map +1 -1
- package/dist/src/cli/helpers/init/jira-ado-auto-detect.d.ts +115 -0
- package/dist/src/cli/helpers/init/jira-ado-auto-detect.d.ts.map +1 -0
- package/dist/src/cli/helpers/init/jira-ado-auto-detect.js +590 -0
- package/dist/src/cli/helpers/init/jira-ado-auto-detect.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts +65 -0
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js +278 -0
- package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.d.ts +64 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.d.ts.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.js +251 -0
- package/dist/src/cli/helpers/issue-tracker/jira-board-selection.js.map +1 -0
- package/dist/src/config/types.d.ts +6 -6
- package/dist/src/core/ac-test-validator-cli.js +4 -1
- package/dist/src/core/ac-test-validator-cli.js.map +1 -1
- package/dist/src/core/ac-test-validator.d.ts.map +1 -1
- package/dist/src/core/ac-test-validator.js +4 -1
- package/dist/src/core/ac-test-validator.js.map +1 -1
- package/dist/src/core/background/index.d.ts +11 -0
- package/dist/src/core/background/index.d.ts.map +1 -0
- package/dist/src/core/background/index.js +11 -0
- package/dist/src/core/background/index.js.map +1 -0
- package/dist/src/core/background/job-manager.d.ts +65 -0
- package/dist/src/core/background/job-manager.d.ts.map +1 -0
- package/dist/src/core/background/job-manager.js +192 -0
- package/dist/src/core/background/job-manager.js.map +1 -0
- package/dist/src/core/background/types.d.ts +59 -0
- package/dist/src/core/background/types.d.ts.map +1 -0
- package/dist/src/core/background/types.js +8 -0
- package/dist/src/core/background/types.js.map +1 -0
- package/dist/src/core/repo-structure/multi-repo-configurator.d.ts +25 -0
- package/dist/src/core/repo-structure/multi-repo-configurator.d.ts.map +1 -0
- package/dist/src/core/repo-structure/multi-repo-configurator.js +614 -0
- package/dist/src/core/repo-structure/multi-repo-configurator.js.map +1 -0
- package/dist/src/core/repo-structure/repo-initializer.d.ts +40 -0
- package/dist/src/core/repo-structure/repo-initializer.d.ts.map +1 -0
- package/dist/src/core/repo-structure/repo-initializer.js +252 -0
- package/dist/src/core/repo-structure/repo-initializer.js.map +1 -0
- package/dist/src/core/repo-structure/repo-structure-manager.d.ts +3 -37
- package/dist/src/core/repo-structure/repo-structure-manager.d.ts.map +1 -1
- package/dist/src/core/repo-structure/repo-structure-manager.js +23 -803
- package/dist/src/core/repo-structure/repo-structure-manager.js.map +1 -1
- package/dist/src/core/types/increment-metadata.d.ts +75 -0
- package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
- package/dist/src/core/types/spec-metadata.d.ts +2 -0
- package/dist/src/core/types/spec-metadata.d.ts.map +1 -1
- package/dist/src/core/types/sync-profile.d.ts +137 -5
- package/dist/src/core/types/sync-profile.d.ts.map +1 -1
- package/dist/src/core/types/sync-profile.js +63 -0
- package/dist/src/core/types/sync-profile.js.map +1 -1
- package/dist/src/importers/external-importer.d.ts +25 -0
- package/dist/src/importers/external-importer.d.ts.map +1 -1
- package/dist/src/importers/github-importer.d.ts.map +1 -1
- package/dist/src/importers/github-importer.js +5 -3
- package/dist/src/importers/github-importer.js.map +1 -1
- package/dist/src/importers/import-coordinator.d.ts +20 -0
- package/dist/src/importers/import-coordinator.d.ts.map +1 -1
- package/dist/src/importers/import-coordinator.js.map +1 -1
- package/dist/src/importers/item-converter.d.ts +51 -0
- package/dist/src/importers/item-converter.d.ts.map +1 -1
- package/dist/src/importers/item-converter.js +39 -12
- package/dist/src/importers/item-converter.js.map +1 -1
- package/dist/src/init/architecture/types.d.ts +2 -2
- package/dist/src/init/compliance/types.d.ts +1 -1
- package/dist/src/init/repo/types.d.ts +1 -1
- package/dist/src/living-docs/fs-id-allocator.d.ts +72 -3
- package/dist/src/living-docs/fs-id-allocator.d.ts.map +1 -1
- package/dist/src/living-docs/fs-id-allocator.js +142 -16
- package/dist/src/living-docs/fs-id-allocator.js.map +1 -1
- package/dist/src/locales/de/cli.json +14 -0
- package/dist/src/locales/es/cli.json +14 -0
- package/dist/src/locales/fr/cli.json +14 -0
- package/dist/src/locales/ja/cli.json +14 -0
- package/dist/src/locales/ko/cli.json +14 -0
- package/dist/src/locales/pt/cli.json +14 -0
- package/dist/src/locales/ru/cli.json +14 -0
- package/dist/src/locales/zh/cli.json +14 -0
- package/dist/src/utils/chalk-fallback.d.ts +38 -0
- package/dist/src/utils/chalk-fallback.d.ts.map +1 -0
- package/dist/src/utils/chalk-fallback.js +118 -0
- package/dist/src/utils/chalk-fallback.js.map +1 -0
- package/dist/src/utils/project-id-generator.d.ts +127 -0
- package/dist/src/utils/project-id-generator.d.ts.map +1 -0
- package/dist/src/utils/project-id-generator.js +228 -0
- package/dist/src/utils/project-id-generator.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/agents/pm/AGENT.md +202 -0
- package/plugins/specweave/commands/specweave-import-external.md +5 -3
- package/plugins/specweave/commands/specweave-jobs.md +160 -0
- package/plugins/specweave/commands/specweave-sync-docs.md +6 -2
- package/plugins/specweave/hooks/pre-task-completion.sh +35 -17
- package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.d.ts +16 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js +121 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js.map +1 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator.d.ts +111 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator.js +295 -0
- package/plugins/specweave/lib/vendor/core/ac-test-validator.js.map +1 -0
- package/plugins/specweave/lib/vendor/core/types/increment-metadata.d.ts +75 -0
- package/plugins/specweave/lib/vendor/utils/chalk-fallback.d.ts +38 -0
- package/plugins/specweave/lib/vendor/utils/chalk-fallback.js +118 -0
- package/plugins/specweave/lib/vendor/utils/chalk-fallback.js.map +1 -0
- package/plugins/specweave/lib/vendor/utils/fs-native.d.ts +179 -0
- package/plugins/specweave/lib/vendor/utils/fs-native.js +319 -0
- package/plugins/specweave/lib/vendor/utils/fs-native.js.map +1 -0
- package/plugins/specweave/skills/code-reviewer/SKILL.md +1 -1
- package/plugins/specweave/skills/docs-updater/SKILL.md +61 -0
- package/plugins/specweave/skills/increment-planner/SKILL.md +10 -335
- package/plugins/specweave/skills/increment-planner/templates/metadata.json +13 -0
- package/plugins/specweave/skills/increment-planner/templates/plan.md +50 -0
- package/plugins/specweave/skills/increment-planner/templates/spec-multi-project.md +86 -0
- package/plugins/specweave/skills/increment-planner/templates/spec-single-project.md +50 -0
- package/plugins/specweave/skills/increment-planner/templates/tasks-multi-project.md +86 -0
- package/plugins/specweave/skills/increment-planner/templates/tasks-single-project.md +48 -0
- package/plugins/specweave-ado/commands/specweave-ado-import-areas.md +358 -0
- package/plugins/specweave-ado/lib/ado-spec-sync.js +59 -3
- package/plugins/specweave-ado/lib/ado-spec-sync.ts +72 -3
- package/plugins/specweave-ado/lib/ado-status-sync.js +35 -3
- package/plugins/specweave-ado/lib/ado-status-sync.ts +48 -4
- package/plugins/specweave-alternatives/skills/architecture-alternatives/SKILL.md +1 -0
- package/plugins/specweave-alternatives/skills/bmad-method/SKILL.md +1 -0
- package/plugins/specweave-core/skills/code-quality/SKILL.md +1 -0
- package/plugins/specweave-core/skills/design-patterns/SKILL.md +1 -0
- package/plugins/specweave-core/skills/software-architecture/SKILL.md +1 -0
- package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +14 -10
- package/plugins/specweave-github/commands/specweave-github-sync.md +57 -0
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +74 -0
- package/plugins/specweave-github/lib/github-feature-sync.ts +6 -11
- package/plugins/specweave-github/lib/github-increment-sync-cli.js +456 -0
- package/plugins/specweave-github/lib/github-increment-sync-cli.ts +588 -0
- package/plugins/specweave-github/lib/github-status-sync.js +37 -1
- package/plugins/specweave-github/lib/github-status-sync.ts +60 -4
- package/plugins/specweave-github/lib/increment-issue-builder.js +389 -0
- package/plugins/specweave-github/lib/increment-issue-builder.ts +502 -0
- package/plugins/specweave-github/skills/github-issue-standard/SKILL.md +19 -24
- package/plugins/specweave-infrastructure/agents/observability-engineer/AGENT.md +15 -23
- package/plugins/specweave-jira/commands/specweave-jira-import-boards.md +331 -0
- package/plugins/specweave-jira/lib/jira-spec-sync.js +53 -5
- package/plugins/specweave-jira/lib/jira-spec-sync.ts +87 -7
- package/plugins/specweave-jira/lib/jira-status-sync.js +9 -3
- package/plugins/specweave-jira/lib/jira-status-sync.ts +15 -6
- package/plugins/specweave-ml/agents/data-scientist/AGENT.md +16 -20
- package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +18 -19
- package/plugins/specweave-ml/skills/{ml-pipeline-workflow → mlops-dag-builder}/SKILL.md +18 -14
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +111 -0
- package/plugins/specweave-ui/skills/browser-automation/SKILL.md +1 -1
- package/plugins/specweave-ui/skills/ui-testing/SKILL.md +10 -122
- package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts +0 -70
- package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/epic-content-builder.js +0 -258
- package/dist/plugins/specweave-github/lib/epic-content-builder.js.map +0 -1
- package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts +0 -83
- package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts.map +0 -1
- package/dist/plugins/specweave-github/lib/github-epic-sync.js +0 -466
- package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +0 -1
- package/plugins/specweave-github/lib/epic-content-builder.js +0 -265
- package/plugins/specweave-github/lib/epic-content-builder.ts +0 -376
- package/plugins/specweave-github/lib/github-epic-sync.js +0 -488
- package/plugins/specweave-github/lib/github-epic-sync.ts +0 -715
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specweave:jobs
|
|
3
|
+
description: Monitor background jobs (repo cloning, issue import). Shows progress, allows pause/resume.
|
|
4
|
+
usage: /specweave:jobs [--active|--all|--id <job-id>] [--resume <job-id>]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Background Jobs Monitor
|
|
8
|
+
|
|
9
|
+
**Usage**: `/specweave:jobs [options]`
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Purpose
|
|
14
|
+
|
|
15
|
+
Monitor and manage long-running background operations:
|
|
16
|
+
- **Repository cloning** (multi-repo/umbrella setup)
|
|
17
|
+
- **Issue import** (10K+ items from GitHub/JIRA/ADO)
|
|
18
|
+
- **External sync** operations
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Check Job Status
|
|
23
|
+
|
|
24
|
+
Read the background jobs state file and display status:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Find and read the state file
|
|
28
|
+
STATE_FILE=".specweave/state/background-jobs.json"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Display Format
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
📋 Background Jobs
|
|
35
|
+
|
|
36
|
+
🔄 Running (1):
|
|
37
|
+
[abc12345] clone-repos
|
|
38
|
+
Progress: 2/4 (50%) → sw-meeting-cost-be
|
|
39
|
+
Rate: 0.5/s | ETA: ~4s
|
|
40
|
+
Started: 2 mins ago
|
|
41
|
+
|
|
42
|
+
⏸️ Paused (1):
|
|
43
|
+
[def67890] import-issues (GitHub)
|
|
44
|
+
Progress: 1,234/10,000 (12%)
|
|
45
|
+
Reason: Rate limited
|
|
46
|
+
Resume: /specweave:jobs --resume def67890
|
|
47
|
+
|
|
48
|
+
✅ Completed (2):
|
|
49
|
+
[ghi11111] clone-repos - 4/4 repos - 5 mins ago
|
|
50
|
+
[jkl22222] import-issues - 500 items - 1 hour ago
|
|
51
|
+
|
|
52
|
+
💡 Commands:
|
|
53
|
+
/specweave:jobs --id abc12345 → Details for specific job
|
|
54
|
+
/specweave:jobs --resume def67890 → Resume paused job
|
|
55
|
+
/specweave:jobs --all → Show all jobs (including old)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Actions
|
|
61
|
+
|
|
62
|
+
### View Specific Job Details
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
/specweave:jobs --id abc12345
|
|
66
|
+
|
|
67
|
+
📦 Job Details: abc12345
|
|
68
|
+
|
|
69
|
+
Type: clone-repos
|
|
70
|
+
Status: running
|
|
71
|
+
Started: 2024-01-15 10:30:00
|
|
72
|
+
Updated: 2024-01-15 10:32:15
|
|
73
|
+
|
|
74
|
+
Progress: 2/4 (50%)
|
|
75
|
+
Current: sw-meeting-cost-be
|
|
76
|
+
Rate: 0.5 repos/sec
|
|
77
|
+
ETA: ~4 seconds
|
|
78
|
+
|
|
79
|
+
Completed:
|
|
80
|
+
✅ sw-meeting-cost-fe
|
|
81
|
+
✅ sw-meeting-cost-shared
|
|
82
|
+
|
|
83
|
+
Remaining:
|
|
84
|
+
⏳ sw-meeting-cost-be
|
|
85
|
+
⏳ sw-meeting-cost
|
|
86
|
+
|
|
87
|
+
Config:
|
|
88
|
+
Project: /path/to/project
|
|
89
|
+
Repos: 4 total
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Resume Paused Job
|
|
93
|
+
|
|
94
|
+
When a job is paused (rate limited, user requested), resume it:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
/specweave:jobs --resume def67890
|
|
98
|
+
|
|
99
|
+
🔄 Resuming job def67890...
|
|
100
|
+
Type: import-issues
|
|
101
|
+
Provider: GitHub
|
|
102
|
+
Resuming from: item 1,234 of 10,000
|
|
103
|
+
|
|
104
|
+
⏳ Import in progress...
|
|
105
|
+
[1,234/10,000] 12% → PROJ-1234
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Implementation
|
|
111
|
+
|
|
112
|
+
1. Read `.specweave/state/background-jobs.json`
|
|
113
|
+
2. Parse job entries
|
|
114
|
+
3. Display formatted status
|
|
115
|
+
4. For --resume, update job status and continue operation
|
|
116
|
+
|
|
117
|
+
### State File Location
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
.specweave/state/background-jobs.json
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Job Types
|
|
124
|
+
|
|
125
|
+
| Type | Description | Typical Duration |
|
|
126
|
+
|------|-------------|------------------|
|
|
127
|
+
| `clone-repos` | Multi-repo cloning | 1-5 mins |
|
|
128
|
+
| `import-issues` | Issue import from external | 5-60 mins |
|
|
129
|
+
| `sync-external` | Bidirectional sync | 1-10 mins |
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Integration Points
|
|
134
|
+
|
|
135
|
+
- Called after `specweave init` with background clone
|
|
136
|
+
- Called after `/specweave:import-external` starts background import
|
|
137
|
+
- Called after `/specweave-github:sync` for large syncs
|
|
138
|
+
- Called after `/specweave-jira:sync` for large syncs
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Error Handling
|
|
143
|
+
|
|
144
|
+
If job failed:
|
|
145
|
+
```
|
|
146
|
+
❌ Failed (1):
|
|
147
|
+
[xyz99999] import-issues
|
|
148
|
+
Error: Rate limit exceeded (retry after 60s)
|
|
149
|
+
Failed at: item 5,000 of 10,000
|
|
150
|
+
Resume: /specweave:jobs --resume xyz99999
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## Notes
|
|
156
|
+
|
|
157
|
+
- Jobs persist across Claude sessions
|
|
158
|
+
- Paused jobs can be resumed later
|
|
159
|
+
- Completed jobs cleaned up after 10 entries
|
|
160
|
+
- Rate limiting auto-pauses and notifies
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specweave:sync-docs
|
|
3
|
-
description:
|
|
3
|
+
description: Strategic documentation sync - review docs before implementation (pull context) OR export learnings after implementation (push to living docs). NOT bidirectional - two separate one-way operations at different phases.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Sync Documentation
|
|
7
7
|
|
|
8
|
-
You are executing the SpecWeave documentation sync command. This handles
|
|
8
|
+
You are executing the SpecWeave strategic documentation sync command. This handles phase-based documentation synchronization:
|
|
9
|
+
- **Review mode**: Pull strategic docs for pre-implementation context
|
|
10
|
+
- **Update mode**: Push implementation learnings to living docs
|
|
11
|
+
|
|
12
|
+
**Note**: This is NOT bidirectional sync (simultaneous two-way). It's two separate one-way operations at different project phases.
|
|
9
13
|
|
|
10
14
|
---
|
|
11
15
|
|
|
@@ -38,20 +38,31 @@ if [[ "${SPECWEAVE_DISABLE_HOOKS:-0}" == "1" ]]; then
|
|
|
38
38
|
exit 0
|
|
39
39
|
fi
|
|
40
40
|
|
|
41
|
-
#
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
# Capture stdin FIRST to extract cwd from Claude's JSON input
|
|
42
|
+
_EARLY_STDIN=$(mktemp)
|
|
43
|
+
cat > "$_EARLY_STDIN"
|
|
44
|
+
|
|
45
|
+
# Extract cwd from JSON (Claude always provides this)
|
|
46
|
+
if command -v jq >/dev/null 2>&1; then
|
|
47
|
+
PROJECT_ROOT=$(jq -r '.cwd // empty' "$_EARLY_STDIN" 2>/dev/null)
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
# Fallback: find project root by walking up from script location
|
|
51
|
+
if [ -z "$PROJECT_ROOT" ] || [ ! -d "$PROJECT_ROOT/.specweave" ]; then
|
|
52
|
+
find_project_root() {
|
|
53
|
+
local dir="$1"
|
|
54
|
+
while [ "$dir" != "/" ]; do
|
|
55
|
+
if [ -d "$dir/.specweave" ]; then
|
|
56
|
+
echo "$dir"
|
|
57
|
+
return 0
|
|
58
|
+
fi
|
|
59
|
+
dir="$(dirname "$dir")"
|
|
60
|
+
done
|
|
61
|
+
pwd
|
|
62
|
+
}
|
|
63
|
+
PROJECT_ROOT="$(find_project_root "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
|
|
64
|
+
fi
|
|
53
65
|
|
|
54
|
-
PROJECT_ROOT="$(find_project_root "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)")"
|
|
55
66
|
cd "$PROJECT_ROOT" 2>/dev/null || true
|
|
56
67
|
|
|
57
68
|
# ============================================================================
|
|
@@ -129,8 +140,8 @@ echo "[$(date)] 🔒 Pre-task-completion hook fired" >> "$DEBUG_LOG" 2>/dev/null
|
|
|
129
140
|
# CAPTURE INPUT
|
|
130
141
|
# ============================================================================
|
|
131
142
|
|
|
132
|
-
|
|
133
|
-
|
|
143
|
+
# Reuse the early stdin capture
|
|
144
|
+
STDIN_DATA="$_EARLY_STDIN"
|
|
134
145
|
|
|
135
146
|
echo "[$(date)] Input JSON:" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
136
147
|
cat "$STDIN_DATA" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
@@ -201,13 +212,20 @@ fi
|
|
|
201
212
|
echo "[$(date)] 🧪 Running AC test validation for $CURRENT_INCREMENT" >> "$DEBUG_LOG" 2>/dev/null || true
|
|
202
213
|
|
|
203
214
|
# Determine which validation script to use
|
|
215
|
+
# Priority order:
|
|
216
|
+
# 1. SpecWeave development (dist/src/core/) - for contributors
|
|
217
|
+
# 2. npm package installation (node_modules/specweave/dist/)
|
|
218
|
+
# 3. Marketplace plugin (lib/vendor/core/) - for end users
|
|
204
219
|
VALIDATOR_SCRIPT=""
|
|
205
220
|
if [ -f "$PROJECT_ROOT/dist/src/core/ac-test-validator-cli.js" ]; then
|
|
221
|
+
# SpecWeave development repo
|
|
206
222
|
VALIDATOR_SCRIPT="$PROJECT_ROOT/dist/src/core/ac-test-validator-cli.js"
|
|
207
223
|
elif [ -f "$PROJECT_ROOT/node_modules/specweave/dist/src/core/ac-test-validator-cli.js" ]; then
|
|
224
|
+
# npm package installation
|
|
208
225
|
VALIDATOR_SCRIPT="$PROJECT_ROOT/node_modules/specweave/dist/src/core/ac-test-validator-cli.js"
|
|
209
|
-
elif [ -n "${CLAUDE_PLUGIN_ROOT}" ] && [ -f "${CLAUDE_PLUGIN_ROOT}/
|
|
210
|
-
|
|
226
|
+
elif [ -n "${CLAUDE_PLUGIN_ROOT}" ] && [ -f "${CLAUDE_PLUGIN_ROOT}/lib/vendor/core/ac-test-validator-cli.js" ]; then
|
|
227
|
+
# Marketplace plugin (bundled in lib/vendor/)
|
|
228
|
+
VALIDATOR_SCRIPT="${CLAUDE_PLUGIN_ROOT}/lib/vendor/core/ac-test-validator-cli.js"
|
|
211
229
|
fi
|
|
212
230
|
|
|
213
231
|
if [ -z "$VALIDATOR_SCRIPT" ] || ! command -v node &> /dev/null; then
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AC Test Validator CLI
|
|
4
|
+
*
|
|
5
|
+
* Command-line interface for validating Acceptance Criteria tests before task completion.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* node ac-test-validator-cli.js <increment-id>
|
|
9
|
+
*
|
|
10
|
+
* Exit codes:
|
|
11
|
+
* 0 - All AC tests passed
|
|
12
|
+
* 1 - Validation failed (tests failed or missing)
|
|
13
|
+
* 2 - Configuration error (missing files, invalid setup)
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=ac-test-validator-cli.d.ts.map
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* AC Test Validator CLI
|
|
4
|
+
*
|
|
5
|
+
* Command-line interface for validating Acceptance Criteria tests before task completion.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* node ac-test-validator-cli.js <increment-id>
|
|
9
|
+
*
|
|
10
|
+
* Exit codes:
|
|
11
|
+
* 0 - All AC tests passed
|
|
12
|
+
* 1 - Validation failed (tests failed or missing)
|
|
13
|
+
* 2 - Configuration error (missing files, invalid setup)
|
|
14
|
+
*/
|
|
15
|
+
import path from 'path';
|
|
16
|
+
import * as fs from '../utils/fs-native.js';
|
|
17
|
+
import { createACTestValidator } from './ac-test-validator.js';
|
|
18
|
+
import { parseTasksWithUSLinks, getAllTasks } from '../generators/spec/task-parser.js';
|
|
19
|
+
import chalkFallback, { getChalk } from '../utils/chalk-fallback.js';
|
|
20
|
+
// Use chalk if available, otherwise fallback to ANSI codes
|
|
21
|
+
let chalk = chalkFallback;
|
|
22
|
+
getChalk().then(c => { chalk = c; }).catch(() => { });
|
|
23
|
+
async function main() {
|
|
24
|
+
// Parse arguments
|
|
25
|
+
const incrementId = process.argv[2];
|
|
26
|
+
if (!incrementId) {
|
|
27
|
+
console.error(chalk.red('Error: Missing increment ID'));
|
|
28
|
+
console.error(chalk.gray('Usage: node ac-test-validator-cli.js <increment-id>'));
|
|
29
|
+
process.exit(2);
|
|
30
|
+
}
|
|
31
|
+
// Find project root
|
|
32
|
+
const projectRoot = process.cwd();
|
|
33
|
+
// Validate increment exists
|
|
34
|
+
const incrementPath = path.join(projectRoot, '.specweave/increments', incrementId);
|
|
35
|
+
if (!await fs.pathExists(incrementPath)) {
|
|
36
|
+
console.error(chalk.red(`Error: Increment not found: ${incrementId}`));
|
|
37
|
+
process.exit(2);
|
|
38
|
+
}
|
|
39
|
+
const tasksPath = path.join(incrementPath, 'tasks.md');
|
|
40
|
+
if (!await fs.pathExists(tasksPath)) {
|
|
41
|
+
console.error(chalk.red(`Error: tasks.md not found in ${incrementId}`));
|
|
42
|
+
process.exit(2);
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
// Parse tasks
|
|
46
|
+
console.log(chalk.blue('\n[AC Test Validator]') + ' Parsing tasks...');
|
|
47
|
+
const tasksByUS = parseTasksWithUSLinks(tasksPath);
|
|
48
|
+
const tasks = getAllTasks(tasksByUS);
|
|
49
|
+
// Filter tasks being marked complete (looking for recently modified tasks)
|
|
50
|
+
// For now, validate ALL tasks with ACs
|
|
51
|
+
const tasksToValidate = tasks.filter(t => {
|
|
52
|
+
return t.satisfiesACs && t.satisfiesACs.length > 0 && t.status === 'completed';
|
|
53
|
+
});
|
|
54
|
+
if (tasksToValidate.length === 0) {
|
|
55
|
+
console.log(chalk.yellow('No completed tasks with Acceptance Criteria to validate.'));
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
console.log(chalk.blue(`Found ${tasksToValidate.length} completed task(s) with ACs to validate\n`));
|
|
59
|
+
// Create validator
|
|
60
|
+
const validator = await createACTestValidator(projectRoot);
|
|
61
|
+
// Validate each task
|
|
62
|
+
const results = [];
|
|
63
|
+
let allPassed = true;
|
|
64
|
+
for (const task of tasksToValidate) {
|
|
65
|
+
console.log(chalk.bold(`\nValidating ${task.id}: ${task.title}`));
|
|
66
|
+
const result = await validator.validateTask(task, projectRoot);
|
|
67
|
+
results.push(result);
|
|
68
|
+
// Display formatted result
|
|
69
|
+
console.log(validator.formatResult(result));
|
|
70
|
+
if (!result.passed) {
|
|
71
|
+
allPassed = false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Overall summary
|
|
75
|
+
console.log(chalk.bold('\n' + '='.repeat(60)));
|
|
76
|
+
console.log(chalk.bold('OVERALL VALIDATION SUMMARY'));
|
|
77
|
+
console.log('='.repeat(60));
|
|
78
|
+
const totalTasks = results.length;
|
|
79
|
+
const passedTasks = results.filter(r => r.passed).length;
|
|
80
|
+
const failedTasks = totalTasks - passedTasks;
|
|
81
|
+
console.log(`Tasks Validated: ${totalTasks}`);
|
|
82
|
+
console.log(`Passed: ${chalk.green(passedTasks)}`);
|
|
83
|
+
console.log(`Failed: ${chalk.red(failedTasks)}`);
|
|
84
|
+
const totalACs = results.reduce((sum, r) => sum + r.summary.totalACs, 0);
|
|
85
|
+
const acsPassed = results.reduce((sum, r) => sum + r.summary.acsTested, 0);
|
|
86
|
+
const acsFailed = totalACs - acsPassed;
|
|
87
|
+
console.log(`\nTotal ACs: ${totalACs}`);
|
|
88
|
+
console.log(`ACs with Passing Tests: ${chalk.green(acsPassed)}`);
|
|
89
|
+
console.log(`ACs with Failing Tests: ${chalk.red(acsFailed)}`);
|
|
90
|
+
console.log('='.repeat(60));
|
|
91
|
+
if (allPassed) {
|
|
92
|
+
console.log(chalk.green.bold('\n✓ ALL VALIDATIONS PASSED\n'));
|
|
93
|
+
console.log(chalk.green('All Acceptance Criteria have passing tests.'));
|
|
94
|
+
console.log(chalk.green('Task completion allowed.\n'));
|
|
95
|
+
process.exit(0);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
console.log(chalk.red.bold('\n✗ VALIDATION FAILED\n'));
|
|
99
|
+
console.log(chalk.red('Some Acceptance Criteria have failing or missing tests.'));
|
|
100
|
+
console.log(chalk.red('Task completion blocked until all tests pass.\n'));
|
|
101
|
+
console.log(chalk.yellow('Fix the failing tests and try again.'));
|
|
102
|
+
console.log(chalk.gray('Run tests manually: npm test\n'));
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
console.error(chalk.red('\nValidation Error:'));
|
|
108
|
+
console.error(chalk.red(error.message));
|
|
109
|
+
if (error.stack) {
|
|
110
|
+
console.error(chalk.gray('\nStack trace:'));
|
|
111
|
+
console.error(chalk.gray(error.stack));
|
|
112
|
+
}
|
|
113
|
+
process.exit(2);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// Run CLI
|
|
117
|
+
main().catch(error => {
|
|
118
|
+
console.error(chalk.red('Fatal error:'), error);
|
|
119
|
+
process.exit(2);
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=ac-test-validator-cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ac-test-validator-cli.js","sourceRoot":"","sources":["../../../src/core/ac-test-validator-cli.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,qBAAqB,EAA0B,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,aAAa,EAAE,EAAE,QAAQ,EAAE,MAAM,4BAA4B,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gC,CAAC,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IAEH,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC;QAChD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAExC,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;YAC5C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACzC,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,UAAU;AACV,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,KAAK,CAAC,CAAC;IAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AC Test Validator
|
|
3
|
+
*
|
|
4
|
+
* Validates that all Acceptance Criteria linked to a task have passing tests
|
|
5
|
+
* before allowing the task to be marked complete.
|
|
6
|
+
*
|
|
7
|
+
* **CRITICAL QUALITY GATE**: This is the enforcement point that prevents
|
|
8
|
+
* tasks from being marked complete without validated ACs.
|
|
9
|
+
*
|
|
10
|
+
* Workflow:
|
|
11
|
+
* 1. Task completion requested via TodoWrite
|
|
12
|
+
* 2. Validator extracts task's satisfiesACs field
|
|
13
|
+
* 3. Validator finds corresponding test files from Test Plan section
|
|
14
|
+
* 4. Validator runs tests using configured test runner (vitest/jest)
|
|
15
|
+
* 5. If ALL tests pass → Allow completion, auto-check ACs in spec.md
|
|
16
|
+
* 6. If ANY test fails → Block completion, show detailed error
|
|
17
|
+
*/
|
|
18
|
+
import { Task } from '../generators/spec/task-parser.js';
|
|
19
|
+
/**
|
|
20
|
+
* Test validation result
|
|
21
|
+
*/
|
|
22
|
+
export interface ACTestValidationResult {
|
|
23
|
+
/** Whether all tests passed */
|
|
24
|
+
passed: boolean;
|
|
25
|
+
/** Task ID being validated */
|
|
26
|
+
taskId: string;
|
|
27
|
+
/** AC-IDs this task satisfies */
|
|
28
|
+
acIds: string[];
|
|
29
|
+
/** Test results by AC-ID */
|
|
30
|
+
testResults: Map<string, ACTestResult>;
|
|
31
|
+
/** Overall summary */
|
|
32
|
+
summary: {
|
|
33
|
+
totalACs: number;
|
|
34
|
+
acsTested: number;
|
|
35
|
+
acsUntested: number;
|
|
36
|
+
testsPassed: number;
|
|
37
|
+
testsFailed: number;
|
|
38
|
+
};
|
|
39
|
+
/** Detailed error messages (if validation failed) */
|
|
40
|
+
errors: string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Test result for a single AC
|
|
44
|
+
*/
|
|
45
|
+
export interface ACTestResult {
|
|
46
|
+
acId: string;
|
|
47
|
+
testFile?: string;
|
|
48
|
+
testCases: string[];
|
|
49
|
+
passed: boolean;
|
|
50
|
+
duration: number;
|
|
51
|
+
error?: string;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Test runner configuration
|
|
55
|
+
*/
|
|
56
|
+
export interface TestRunnerConfig {
|
|
57
|
+
/** Test runner command (e.g., "npm test", "vitest run") */
|
|
58
|
+
command: string;
|
|
59
|
+
/** Test file pattern (glob pattern for test files) */
|
|
60
|
+
pattern: string;
|
|
61
|
+
/** Working directory for test execution */
|
|
62
|
+
cwd: string;
|
|
63
|
+
/** Environment variables for test execution */
|
|
64
|
+
env?: Record<string, string>;
|
|
65
|
+
/** Timeout in milliseconds (default: 30000) */
|
|
66
|
+
timeout?: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* AC Test Validator - Core validation engine
|
|
70
|
+
*/
|
|
71
|
+
export declare class ACTestValidator {
|
|
72
|
+
private config;
|
|
73
|
+
constructor(config: TestRunnerConfig);
|
|
74
|
+
/**
|
|
75
|
+
* Validate all ACs for a task have passing tests
|
|
76
|
+
*
|
|
77
|
+
* @param task - Task to validate (must have satisfiesACs field)
|
|
78
|
+
* @param projectRoot - Project root directory
|
|
79
|
+
* @returns Validation result
|
|
80
|
+
*/
|
|
81
|
+
validateTask(task: Task, projectRoot: string): Promise<ACTestValidationResult>;
|
|
82
|
+
/**
|
|
83
|
+
* Validate a single AC has passing tests
|
|
84
|
+
*/
|
|
85
|
+
private validateAC;
|
|
86
|
+
/**
|
|
87
|
+
* Build test command with AC-ID filter
|
|
88
|
+
*/
|
|
89
|
+
private buildTestCommand;
|
|
90
|
+
/**
|
|
91
|
+
* Extract test case names from test output
|
|
92
|
+
*/
|
|
93
|
+
private extractTestCases;
|
|
94
|
+
/**
|
|
95
|
+
* Extract failure message from test output
|
|
96
|
+
*/
|
|
97
|
+
private extractFailureMessage;
|
|
98
|
+
/**
|
|
99
|
+
* Extract test file path from task description (Test Plan section)
|
|
100
|
+
*/
|
|
101
|
+
private extractTestFile;
|
|
102
|
+
/**
|
|
103
|
+
* Format validation result for display
|
|
104
|
+
*/
|
|
105
|
+
formatResult(result: ACTestValidationResult): string;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create AC test validator from project config
|
|
109
|
+
*/
|
|
110
|
+
export declare function createACTestValidator(projectRoot: string): Promise<ACTestValidator>;
|
|
111
|
+
//# sourceMappingURL=ac-test-validator.d.ts.map
|