specweave 0.28.15 → 0.28.19

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 (146) hide show
  1. package/bin/specweave.js +1 -1
  2. package/dist/plugins/specweave-ado/lib/ado-board-resolver.d.ts +94 -0
  3. package/dist/plugins/specweave-ado/lib/ado-board-resolver.d.ts.map +1 -0
  4. package/dist/plugins/specweave-ado/lib/ado-board-resolver.js +219 -0
  5. package/dist/plugins/specweave-ado/lib/ado-board-resolver.js.map +1 -0
  6. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts +6 -11
  7. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -1
  8. package/dist/plugins/specweave-github/lib/github-feature-sync.js +6 -11
  9. package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -1
  10. package/dist/plugins/specweave-github/lib/github-increment-sync-cli.d.ts +19 -0
  11. package/dist/plugins/specweave-github/lib/github-increment-sync-cli.d.ts.map +1 -0
  12. package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js +380 -0
  13. package/dist/plugins/specweave-github/lib/github-increment-sync-cli.js.map +1 -0
  14. package/dist/plugins/specweave-github/lib/increment-issue-builder.d.ts +92 -0
  15. package/dist/plugins/specweave-github/lib/increment-issue-builder.d.ts.map +1 -0
  16. package/dist/plugins/specweave-github/lib/increment-issue-builder.js +349 -0
  17. package/dist/plugins/specweave-github/lib/increment-issue-builder.js.map +1 -0
  18. package/dist/plugins/specweave-jira/lib/jira-board-resolver.d.ts +50 -0
  19. package/dist/plugins/specweave-jira/lib/jira-board-resolver.d.ts.map +1 -0
  20. package/dist/plugins/specweave-jira/lib/jira-board-resolver.js +84 -0
  21. package/dist/plugins/specweave-jira/lib/jira-board-resolver.js.map +1 -0
  22. package/dist/src/cli/commands/import-external.d.ts.map +1 -1
  23. package/dist/src/cli/commands/import-external.js +12 -7
  24. package/dist/src/cli/commands/import-external.js.map +1 -1
  25. package/dist/src/cli/helpers/init/external-import.d.ts.map +1 -1
  26. package/dist/src/cli/helpers/init/external-import.js +138 -23
  27. package/dist/src/cli/helpers/init/external-import.js.map +1 -1
  28. package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts +65 -0
  29. package/dist/src/cli/helpers/issue-tracker/ado-area-selection.d.ts.map +1 -0
  30. package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js +278 -0
  31. package/dist/src/cli/helpers/issue-tracker/ado-area-selection.js.map +1 -0
  32. package/dist/src/cli/helpers/issue-tracker/jira-board-selection.d.ts +64 -0
  33. package/dist/src/cli/helpers/issue-tracker/jira-board-selection.d.ts.map +1 -0
  34. package/dist/src/cli/helpers/issue-tracker/jira-board-selection.js +251 -0
  35. package/dist/src/cli/helpers/issue-tracker/jira-board-selection.js.map +1 -0
  36. package/dist/src/core/ac-test-validator-cli.js +4 -1
  37. package/dist/src/core/ac-test-validator-cli.js.map +1 -1
  38. package/dist/src/core/ac-test-validator.d.ts.map +1 -1
  39. package/dist/src/core/ac-test-validator.js +4 -1
  40. package/dist/src/core/ac-test-validator.js.map +1 -1
  41. package/dist/src/core/qa/qa-runner.js +7 -10
  42. package/dist/src/core/qa/qa-runner.js.map +1 -1
  43. package/dist/src/core/types/increment-metadata.d.ts +75 -0
  44. package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
  45. package/dist/src/core/types/sync-profile.d.ts +137 -5
  46. package/dist/src/core/types/sync-profile.d.ts.map +1 -1
  47. package/dist/src/core/types/sync-profile.js +63 -0
  48. package/dist/src/core/types/sync-profile.js.map +1 -1
  49. package/dist/src/importers/external-importer.d.ts +25 -0
  50. package/dist/src/importers/external-importer.d.ts.map +1 -1
  51. package/dist/src/importers/github-importer.d.ts.map +1 -1
  52. package/dist/src/importers/github-importer.js +5 -3
  53. package/dist/src/importers/github-importer.js.map +1 -1
  54. package/dist/src/importers/item-converter.d.ts +51 -0
  55. package/dist/src/importers/item-converter.d.ts.map +1 -1
  56. package/dist/src/importers/item-converter.js +39 -12
  57. package/dist/src/importers/item-converter.js.map +1 -1
  58. package/dist/src/init/repo/types.d.ts +1 -1
  59. package/dist/src/living-docs/fs-id-allocator.d.ts +72 -3
  60. package/dist/src/living-docs/fs-id-allocator.d.ts.map +1 -1
  61. package/dist/src/living-docs/fs-id-allocator.js +142 -16
  62. package/dist/src/living-docs/fs-id-allocator.js.map +1 -1
  63. package/dist/src/locales/de/cli.json +14 -0
  64. package/dist/src/locales/es/cli.json +14 -0
  65. package/dist/src/locales/fr/cli.json +14 -0
  66. package/dist/src/locales/ja/cli.json +14 -0
  67. package/dist/src/locales/ko/cli.json +14 -0
  68. package/dist/src/locales/pt/cli.json +14 -0
  69. package/dist/src/locales/ru/cli.json +14 -0
  70. package/dist/src/locales/zh/cli.json +14 -0
  71. package/dist/src/utils/chalk-fallback.d.ts +38 -0
  72. package/dist/src/utils/chalk-fallback.d.ts.map +1 -0
  73. package/dist/src/utils/chalk-fallback.js +118 -0
  74. package/dist/src/utils/chalk-fallback.js.map +1 -0
  75. package/dist/src/utils/project-id-generator.d.ts +127 -0
  76. package/dist/src/utils/project-id-generator.d.ts.map +1 -0
  77. package/dist/src/utils/project-id-generator.js +228 -0
  78. package/dist/src/utils/project-id-generator.js.map +1 -0
  79. package/package.json +1 -1
  80. package/plugins/specweave/agents/AGENTS-INDEX.md +9 -7
  81. package/plugins/specweave/agents/pm/AGENT.md +202 -0
  82. package/plugins/specweave/commands/specweave-import-external.md +5 -3
  83. package/plugins/specweave/commands/specweave-qa.md +9 -9
  84. package/plugins/specweave/commands/specweave-save.md +531 -193
  85. package/plugins/specweave/commands/specweave-sync-docs.md +6 -2
  86. package/plugins/specweave/commands/specweave-validate.md +8 -7
  87. package/plugins/specweave/hooks/pre-task-completion.sh +35 -17
  88. package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.d.ts +16 -0
  89. package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js +121 -0
  90. package/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js.map +1 -0
  91. package/plugins/specweave/lib/vendor/core/ac-test-validator.d.ts +111 -0
  92. package/plugins/specweave/lib/vendor/core/ac-test-validator.js +295 -0
  93. package/plugins/specweave/lib/vendor/core/ac-test-validator.js.map +1 -0
  94. package/plugins/specweave/lib/vendor/core/types/increment-metadata.d.ts +75 -0
  95. package/plugins/specweave/lib/vendor/utils/chalk-fallback.d.ts +38 -0
  96. package/plugins/specweave/lib/vendor/utils/chalk-fallback.js +118 -0
  97. package/plugins/specweave/lib/vendor/utils/chalk-fallback.js.map +1 -0
  98. package/plugins/specweave/lib/vendor/utils/fs-native.d.ts +179 -0
  99. package/plugins/specweave/lib/vendor/utils/fs-native.js +319 -0
  100. package/plugins/specweave/lib/vendor/utils/fs-native.js.map +1 -0
  101. package/plugins/specweave/skills/code-reviewer/SKILL.md +1 -1
  102. package/plugins/specweave/skills/docs-updater/SKILL.md +61 -0
  103. package/plugins/specweave/skills/increment-planner/SKILL.md +10 -335
  104. package/plugins/specweave/skills/increment-planner/templates/metadata.json +13 -0
  105. package/plugins/specweave/skills/increment-planner/templates/plan.md +50 -0
  106. package/plugins/specweave/skills/increment-planner/templates/spec-multi-project.md +86 -0
  107. package/plugins/specweave/skills/increment-planner/templates/spec-single-project.md +50 -0
  108. package/plugins/specweave/skills/increment-planner/templates/tasks-multi-project.md +86 -0
  109. package/plugins/specweave/skills/increment-planner/templates/tasks-single-project.md +48 -0
  110. package/plugins/specweave/skills/increment-quality-judge-v2/SKILL.md +18 -0
  111. package/plugins/specweave-ado/commands/specweave-ado-import-areas.md +358 -0
  112. package/plugins/specweave-alternatives/skills/architecture-alternatives/SKILL.md +1 -0
  113. package/plugins/specweave-alternatives/skills/bmad-method/SKILL.md +1 -0
  114. package/plugins/specweave-core/skills/code-quality/SKILL.md +1 -0
  115. package/plugins/specweave-core/skills/design-patterns/SKILL.md +1 -0
  116. package/plugins/specweave-core/skills/software-architecture/SKILL.md +1 -0
  117. package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +14 -10
  118. package/plugins/specweave-github/commands/specweave-github-sync.md +57 -0
  119. package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +86 -0
  120. package/plugins/specweave-github/lib/github-feature-sync.ts +6 -11
  121. package/plugins/specweave-github/lib/github-increment-sync-cli.js +343 -0
  122. package/plugins/specweave-github/lib/github-increment-sync-cli.ts +484 -0
  123. package/plugins/specweave-github/lib/increment-issue-builder.js +368 -0
  124. package/plugins/specweave-github/lib/increment-issue-builder.ts +471 -0
  125. package/plugins/specweave-github/skills/github-issue-standard/SKILL.md +19 -24
  126. package/plugins/specweave-infrastructure/agents/observability-engineer/AGENT.md +15 -23
  127. package/plugins/specweave-jira/commands/specweave-jira-import-boards.md +331 -0
  128. package/plugins/specweave-ml/agents/data-scientist/AGENT.md +16 -20
  129. package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +18 -19
  130. package/plugins/specweave-ml/skills/{ml-pipeline-workflow → mlops-dag-builder}/SKILL.md +18 -14
  131. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +129 -0
  132. package/plugins/specweave-ui/skills/browser-automation/SKILL.md +1 -1
  133. package/plugins/specweave-ui/skills/ui-testing/SKILL.md +10 -122
  134. package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts +0 -70
  135. package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts.map +0 -1
  136. package/dist/plugins/specweave-github/lib/epic-content-builder.js +0 -258
  137. package/dist/plugins/specweave-github/lib/epic-content-builder.js.map +0 -1
  138. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts +0 -83
  139. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts.map +0 -1
  140. package/dist/plugins/specweave-github/lib/github-epic-sync.js +0 -466
  141. package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +0 -1
  142. package/plugins/specweave/agents/increment-quality-judge-v2/AGENT.md +0 -705
  143. package/plugins/specweave-github/lib/epic-content-builder.js +0 -265
  144. package/plugins/specweave-github/lib/epic-content-builder.ts +0 -376
  145. package/plugins/specweave-github/lib/github-epic-sync.js +0 -488
  146. package/plugins/specweave-github/lib/github-epic-sync.ts +0 -715
@@ -1,11 +1,15 @@
1
1
  ---
2
2
  name: specweave:sync-docs
3
- description: Bidirectional documentation sync - review strategic docs before implementation OR update living docs from completed increments with conflict resolution
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 bidirectional documentation synchronization between increments and living docs.
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
 
@@ -232,16 +232,17 @@ Choice: _
232
232
 
233
233
  ### Step 4: Run AI Quality Assessment (If Approved)
234
234
 
235
- **IMPORTANT**: Invoke `increment-quality-judge-v2` **agent** (not skill) via Task tool:
235
+ **IMPORTANT**: Use the `increment-quality-judge-v2` **skill** (auto-activated) or CLI command:
236
236
 
237
- ```typescript
238
- Task({
239
- subagent_type: "specweave:increment-quality-judge-v2:increment-quality-judge-v2",
240
- prompt: `Assess quality of increment ${incrementId}`
241
- });
237
+ ```bash
238
+ # Preferred: Use CLI command directly
239
+ specweave qa 0001 --pre
240
+
241
+ # The skill auto-activates when assessing quality
242
+ # DO NOT spawn agents - use CLI instead
242
243
  ```
243
244
 
244
- Pass these parameters:
245
+ Assessment parameters:
245
246
  - increment_id: "0001"
246
247
  - files: ["spec.md", "plan.md", "tests.md"]
247
248
  - dimensions: ["clarity", "testability", "completeness", "feasibility", "maintainability", "edge_cases"]
@@ -38,20 +38,31 @@ if [[ "${SPECWEAVE_DISABLE_HOOKS:-0}" == "1" ]]; then
38
38
  exit 0
39
39
  fi
40
40
 
41
- # Find project root
42
- find_project_root() {
43
- local dir="$1"
44
- while [ "$dir" != "/" ]; do
45
- if [ -d "$dir/.specweave" ]; then
46
- echo "$dir"
47
- return 0
48
- fi
49
- dir="$(dirname "$dir")"
50
- done
51
- pwd
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
- STDIN_DATA=$(mktemp)
133
- cat > "$STDIN_DATA"
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}/dist/src/core/ac-test-validator-cli.js" ]; then
210
- VALIDATOR_SCRIPT="${CLAUDE_PLUGIN_ROOT}/dist/src/core/ac-test-validator-cli.js"
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,CAAC;AAErE,2DAA2D;AAC3D,IAAI,KAAK,GAAG,aAAa,CAAC;AAC1B,QAAQ,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;AAErD,KAAK,UAAU,IAA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AK,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