specweave 0.23.2 → 0.23.5

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 (106) hide show
  1. package/CLAUDE.md +367 -0
  2. package/dist/plugins/specweave/lib/utils/fs-native.d.ts +133 -0
  3. package/dist/plugins/specweave/lib/utils/fs-native.d.ts.map +1 -0
  4. package/dist/plugins/specweave/lib/utils/fs-native.js +224 -0
  5. package/dist/plugins/specweave/lib/utils/fs-native.js.map +1 -0
  6. package/dist/plugins/specweave-github/lib/github-client-v2.js +1 -1
  7. package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
  8. package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -1
  9. package/dist/plugins/specweave-github/lib/github-feature-sync.js +52 -20
  10. package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -1
  11. package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts.map +1 -1
  12. package/dist/plugins/specweave-github/lib/user-story-issue-builder.js +24 -0
  13. package/dist/plugins/specweave-github/lib/user-story-issue-builder.js.map +1 -1
  14. package/dist/src/cli/helpers/init/initial-increment-generator.d.ts.map +1 -1
  15. package/dist/src/cli/helpers/init/initial-increment-generator.js +2 -1
  16. package/dist/src/cli/helpers/init/initial-increment-generator.js.map +1 -1
  17. package/dist/src/core/ac-test-validator-cli.d.ts +16 -0
  18. package/dist/src/core/ac-test-validator-cli.d.ts.map +1 -0
  19. package/dist/src/core/ac-test-validator-cli.js +118 -0
  20. package/dist/src/core/ac-test-validator-cli.js.map +1 -0
  21. package/dist/src/core/ac-test-validator.d.ts +111 -0
  22. package/dist/src/core/ac-test-validator.d.ts.map +1 -0
  23. package/dist/src/core/ac-test-validator.js +292 -0
  24. package/dist/src/core/ac-test-validator.js.map +1 -0
  25. package/dist/src/core/increment/desync-detector.d.ts +142 -0
  26. package/dist/src/core/increment/desync-detector.d.ts.map +1 -0
  27. package/dist/src/core/increment/desync-detector.js +270 -0
  28. package/dist/src/core/increment/desync-detector.js.map +1 -0
  29. package/dist/src/core/increment/metadata-manager.d.ts +8 -4
  30. package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
  31. package/dist/src/core/increment/metadata-manager.js +45 -21
  32. package/dist/src/core/increment/metadata-manager.js.map +1 -1
  33. package/dist/src/core/qa/qa-runner.js +9 -2
  34. package/dist/src/core/qa/qa-runner.js.map +1 -1
  35. package/dist/src/sync/sync-coordinator.d.ts +1 -1
  36. package/dist/src/sync/sync-coordinator.d.ts.map +1 -1
  37. package/dist/src/sync/sync-coordinator.js +40 -2
  38. package/dist/src/sync/sync-coordinator.js.map +1 -1
  39. package/dist/src/utils/fs-native.d.ts +133 -0
  40. package/dist/src/utils/fs-native.d.ts.map +1 -0
  41. package/dist/src/utils/fs-native.js +224 -0
  42. package/dist/src/utils/fs-native.js.map +1 -0
  43. package/package.json +1 -1
  44. package/plugins/specweave/.claude-plugin/plugin.json +12 -0
  45. package/plugins/specweave/agents/AGENTS-INDEX.md +216 -0
  46. package/plugins/specweave/agents/architect/AGENT.md +17 -0
  47. package/plugins/specweave/agents/code-standards-detective/AGENT.md +16 -0
  48. package/plugins/specweave/agents/docs-writer/AGENT.md +16 -0
  49. package/plugins/specweave/agents/increment-quality-judge-v2/AGENT.md +704 -0
  50. package/plugins/specweave/agents/infrastructure/AGENT.md +16 -0
  51. package/plugins/specweave/agents/performance/AGENT.md +16 -0
  52. package/plugins/specweave/agents/pm/AGENT.md +17 -0
  53. package/plugins/specweave/agents/qa-lead/AGENT.md +15 -0
  54. package/plugins/specweave/agents/reflective-reviewer/AGENT.md +16 -0
  55. package/plugins/specweave/agents/security/AGENT.md +16 -0
  56. package/plugins/specweave/agents/tdd-orchestrator/AGENT.md +16 -0
  57. package/plugins/specweave/agents/tech-lead/AGENT.md +16 -0
  58. package/plugins/specweave/agents/test-aware-planner/AGENT.md +16 -0
  59. package/plugins/specweave/agents/translator/AGENT.md +13 -0
  60. package/plugins/specweave/commands/specweave-done.md +14 -0
  61. package/plugins/specweave/commands/specweave-qa.md +11 -1
  62. package/plugins/specweave/commands/specweave-sync-status.md +356 -0
  63. package/plugins/specweave/commands/specweave-validate.md +10 -1
  64. package/plugins/specweave/hooks/pre-task-completion.sh +196 -0
  65. package/plugins/specweave/lib/hooks/git-diff-analyzer.js +3 -3
  66. package/plugins/specweave/lib/hooks/git-diff-analyzer.ts +3 -3
  67. package/plugins/specweave/lib/hooks/invoke-translator-skill.js +3 -2
  68. package/plugins/specweave/lib/hooks/invoke-translator-skill.ts +3 -2
  69. package/plugins/specweave/lib/hooks/prepare-reflection-context.js +3 -3
  70. package/plugins/specweave/lib/hooks/prepare-reflection-context.ts +3 -3
  71. package/plugins/specweave/lib/hooks/reflection-config-loader.js +4 -4
  72. package/plugins/specweave/lib/hooks/reflection-config-loader.ts +4 -4
  73. package/plugins/specweave/lib/hooks/reflection-storage.js +9 -9
  74. package/plugins/specweave/lib/hooks/reflection-storage.ts +9 -9
  75. package/plugins/specweave/lib/hooks/sync-cache.js +9 -8
  76. package/plugins/specweave/lib/hooks/sync-living-docs.js +57 -6
  77. package/plugins/specweave/lib/hooks/sync-us-tasks.js +6 -6
  78. package/plugins/specweave/lib/hooks/translate-file.js +3 -2
  79. package/plugins/specweave/lib/hooks/translate-file.ts +3 -2
  80. package/plugins/specweave/lib/hooks/translate-living-docs.js +4 -3
  81. package/plugins/specweave/lib/hooks/translate-living-docs.ts +4 -3
  82. package/plugins/specweave/lib/hooks/update-tasks-md.js +3 -3
  83. package/plugins/specweave/lib/hooks/update-tasks-md.ts +3 -3
  84. package/plugins/specweave/lib/utils/fs-native.js +182 -0
  85. package/plugins/specweave/lib/utils/fs-native.ts +283 -0
  86. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.d.ts +8 -4
  87. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +45 -21
  88. package/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -1
  89. package/plugins/specweave/skills/SKILLS-INDEX.md +26 -2
  90. package/plugins/specweave/skills/increment-planner/SKILL.md +2 -2
  91. package/plugins/specweave-ado/commands/specweave-ado-close-workitem.md +1 -1
  92. package/plugins/specweave-ado/commands/specweave-ado-create-workitem.md +1 -1
  93. package/plugins/specweave-ado/commands/specweave-ado-status.md +1 -1
  94. package/plugins/specweave-ado/commands/specweave-ado-sync.md +1 -1
  95. package/plugins/specweave-diagrams/agents/diagrams-architect/AGENT.md +1 -1
  96. package/plugins/specweave-diagrams/skills/diagrams-generator/SKILL.md +4 -4
  97. package/plugins/specweave-github/lib/github-client-v2.js +2 -1
  98. package/plugins/specweave-github/lib/github-client-v2.ts +1 -1
  99. package/plugins/specweave-github/lib/github-feature-sync.js +30 -17
  100. package/plugins/specweave-github/lib/github-feature-sync.ts +54 -24
  101. package/plugins/specweave-github/lib/user-story-issue-builder.js +24 -0
  102. package/plugins/specweave-github/lib/user-story-issue-builder.ts +33 -0
  103. package/plugins/specweave-mobile/README.md +1 -1
  104. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +72 -0
  105. package/src/templates/CLAUDE.md.template +13 -0
  106. package/plugins/specweave/skills/task-builder/README.md +0 -84
@@ -0,0 +1,118 @@
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 fs from 'fs-extra';
17
+ import { createACTestValidator } from './ac-test-validator.js';
18
+ import { parseTasksWithUSLinks, getAllTasks } from '../generators/spec/task-parser.js';
19
+ import chalk from 'chalk';
20
+ async function main() {
21
+ // Parse arguments
22
+ const incrementId = process.argv[2];
23
+ if (!incrementId) {
24
+ console.error(chalk.red('Error: Missing increment ID'));
25
+ console.error(chalk.gray('Usage: node ac-test-validator-cli.js <increment-id>'));
26
+ process.exit(2);
27
+ }
28
+ // Find project root
29
+ const projectRoot = process.cwd();
30
+ // Validate increment exists
31
+ const incrementPath = path.join(projectRoot, '.specweave/increments', incrementId);
32
+ if (!await fs.pathExists(incrementPath)) {
33
+ console.error(chalk.red(`Error: Increment not found: ${incrementId}`));
34
+ process.exit(2);
35
+ }
36
+ const tasksPath = path.join(incrementPath, 'tasks.md');
37
+ if (!await fs.pathExists(tasksPath)) {
38
+ console.error(chalk.red(`Error: tasks.md not found in ${incrementId}`));
39
+ process.exit(2);
40
+ }
41
+ try {
42
+ // Parse tasks
43
+ console.log(chalk.blue('\n[AC Test Validator]') + ' Parsing tasks...');
44
+ const tasksByUS = parseTasksWithUSLinks(tasksPath);
45
+ const tasks = getAllTasks(tasksByUS);
46
+ // Filter tasks being marked complete (looking for recently modified tasks)
47
+ // For now, validate ALL tasks with ACs
48
+ const tasksToValidate = tasks.filter(t => {
49
+ return t.satisfiesACs && t.satisfiesACs.length > 0 && t.status === 'completed';
50
+ });
51
+ if (tasksToValidate.length === 0) {
52
+ console.log(chalk.yellow('No completed tasks with Acceptance Criteria to validate.'));
53
+ process.exit(0);
54
+ }
55
+ console.log(chalk.blue(`Found ${tasksToValidate.length} completed task(s) with ACs to validate\n`));
56
+ // Create validator
57
+ const validator = await createACTestValidator(projectRoot);
58
+ // Validate each task
59
+ const results = [];
60
+ let allPassed = true;
61
+ for (const task of tasksToValidate) {
62
+ console.log(chalk.bold(`\nValidating ${task.id}: ${task.title}`));
63
+ const result = await validator.validateTask(task, projectRoot);
64
+ results.push(result);
65
+ // Display formatted result
66
+ console.log(validator.formatResult(result));
67
+ if (!result.passed) {
68
+ allPassed = false;
69
+ }
70
+ }
71
+ // Overall summary
72
+ console.log(chalk.bold('\n' + '='.repeat(60)));
73
+ console.log(chalk.bold('OVERALL VALIDATION SUMMARY'));
74
+ console.log('='.repeat(60));
75
+ const totalTasks = results.length;
76
+ const passedTasks = results.filter(r => r.passed).length;
77
+ const failedTasks = totalTasks - passedTasks;
78
+ console.log(`Tasks Validated: ${totalTasks}`);
79
+ console.log(`Passed: ${chalk.green(passedTasks)}`);
80
+ console.log(`Failed: ${chalk.red(failedTasks)}`);
81
+ const totalACs = results.reduce((sum, r) => sum + r.summary.totalACs, 0);
82
+ const acsPassed = results.reduce((sum, r) => sum + r.summary.acsTested, 0);
83
+ const acsFailed = totalACs - acsPassed;
84
+ console.log(`\nTotal ACs: ${totalACs}`);
85
+ console.log(`ACs with Passing Tests: ${chalk.green(acsPassed)}`);
86
+ console.log(`ACs with Failing Tests: ${chalk.red(acsFailed)}`);
87
+ console.log('='.repeat(60));
88
+ if (allPassed) {
89
+ console.log(chalk.green.bold('\n✓ ALL VALIDATIONS PASSED\n'));
90
+ console.log(chalk.green('All Acceptance Criteria have passing tests.'));
91
+ console.log(chalk.green('Task completion allowed.\n'));
92
+ process.exit(0);
93
+ }
94
+ else {
95
+ console.log(chalk.red.bold('\n✗ VALIDATION FAILED\n'));
96
+ console.log(chalk.red('Some Acceptance Criteria have failing or missing tests.'));
97
+ console.log(chalk.red('Task completion blocked until all tests pass.\n'));
98
+ console.log(chalk.yellow('Fix the failing tests and try again.'));
99
+ console.log(chalk.gray('Run tests manually: npm test\n'));
100
+ process.exit(1);
101
+ }
102
+ }
103
+ catch (error) {
104
+ console.error(chalk.red('\nValidation Error:'));
105
+ console.error(chalk.red(error.message));
106
+ if (error.stack) {
107
+ console.error(chalk.gray('\nStack trace:'));
108
+ console.error(chalk.gray(error.stack));
109
+ }
110
+ process.exit(2);
111
+ }
112
+ }
113
+ // Run CLI
114
+ main().catch(error => {
115
+ console.error(chalk.red('Fatal error:'), error);
116
+ process.exit(2);
117
+ });
118
+ //# 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;;;;;;;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K,CAAC,IAAI,CAAC,gCAAgC,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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ac-test-validator.d.ts","sourceRoot":"","sources":["../../../src/core/ac-test-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AASzD;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,+BAA+B;IAC/B,MAAM,EAAE,OAAO,CAAC;IAEhB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IAEf,iCAAiC;IACjC,KAAK,EAAE,MAAM,EAAE,CAAC;IAEhB,4BAA4B;IAC5B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IAEvC,sBAAsB;IACtB,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IAEF,qDAAqD;IACrD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAEhB,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;IAEhB,2CAA2C;IAC3C,GAAG,EAAE,MAAM,CAAC;IAEZ,+CAA+C;IAC/C,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE7B,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAmB;gBAErB,MAAM,EAAE,gBAAgB;IAOpC;;;;;;OAMG;IACG,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAiEpF;;OAEG;YACW,UAAU;IA2DxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAmBxB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAkBxB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAiB7B;;OAEG;IACH,OAAO,CAAC,eAAe;IAYvB;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM;CA0DrD;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAwBzF"}
@@ -0,0 +1,292 @@
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 { exec } from 'child_process';
19
+ import { promisify } from 'util';
20
+ import path from 'path';
21
+ import fs from 'fs-extra';
22
+ import chalk from 'chalk';
23
+ const execAsync = promisify(exec);
24
+ /**
25
+ * AC Test Validator - Core validation engine
26
+ */
27
+ export class ACTestValidator {
28
+ constructor(config) {
29
+ this.config = {
30
+ timeout: 30000, // 30 second default timeout
31
+ ...config
32
+ };
33
+ }
34
+ /**
35
+ * Validate all ACs for a task have passing tests
36
+ *
37
+ * @param task - Task to validate (must have satisfiesACs field)
38
+ * @param projectRoot - Project root directory
39
+ * @returns Validation result
40
+ */
41
+ async validateTask(task, projectRoot) {
42
+ const startTime = Date.now();
43
+ // Initialize result
44
+ const result = {
45
+ passed: false,
46
+ taskId: task.id,
47
+ acIds: task.satisfiesACs || [],
48
+ testResults: new Map(),
49
+ summary: {
50
+ totalACs: 0,
51
+ acsTested: 0,
52
+ acsUntested: 0,
53
+ testsPassed: 0,
54
+ testsFailed: 0
55
+ },
56
+ errors: []
57
+ };
58
+ // Check if task has ACs to validate
59
+ if (!task.satisfiesACs || task.satisfiesACs.length === 0) {
60
+ result.errors.push(`Task ${task.id} has no Acceptance Criteria linked (satisfiesACs field missing or empty)`);
61
+ return result;
62
+ }
63
+ result.summary.totalACs = task.satisfiesACs.length;
64
+ // Extract test file from task's Test Plan section
65
+ const testFile = this.extractTestFile(task);
66
+ if (!testFile) {
67
+ result.errors.push(`Task ${task.id} has no Test Plan section or test file specified`);
68
+ return result;
69
+ }
70
+ // Check test file exists
71
+ const testFilePath = path.join(projectRoot, testFile);
72
+ if (!await fs.pathExists(testFilePath)) {
73
+ result.errors.push(`Test file not found: ${testFile}`);
74
+ return result;
75
+ }
76
+ // Run tests for each AC
77
+ for (const acId of task.satisfiesACs) {
78
+ const acTestResult = await this.validateAC(acId, testFile, projectRoot);
79
+ result.testResults.set(acId, acTestResult);
80
+ if (acTestResult.passed) {
81
+ result.summary.acsTested++;
82
+ result.summary.testsPassed++;
83
+ }
84
+ else {
85
+ result.summary.acsUntested++;
86
+ result.summary.testsFailed++;
87
+ result.errors.push(`AC ${acId} tests failed: ${acTestResult.error || 'Unknown error'}`);
88
+ }
89
+ }
90
+ // Overall pass/fail
91
+ result.passed = result.summary.testsFailed === 0 && result.summary.acsTested === result.summary.totalACs;
92
+ const duration = Date.now() - startTime;
93
+ console.log(`\n${chalk.blue('[AC Test Validator]')} Validated task ${task.id} in ${duration}ms`);
94
+ return result;
95
+ }
96
+ /**
97
+ * Validate a single AC has passing tests
98
+ */
99
+ async validateAC(acId, testFile, projectRoot) {
100
+ const startTime = Date.now();
101
+ const result = {
102
+ acId,
103
+ testFile,
104
+ testCases: [],
105
+ passed: false,
106
+ duration: 0
107
+ };
108
+ try {
109
+ // Run test file with filter for AC-ID
110
+ // Most test runners support filtering: vitest -t "AC-US1-01", jest --testNamePattern="AC-US1-01"
111
+ const command = this.buildTestCommand(testFile, acId);
112
+ console.log(` ${chalk.gray('Running:')} ${command}`);
113
+ const { stdout, stderr } = await execAsync(command, {
114
+ cwd: this.config.cwd,
115
+ env: { ...process.env, ...this.config.env },
116
+ timeout: this.config.timeout
117
+ });
118
+ // Parse test output (basic implementation - can be enhanced)
119
+ const output = stdout + stderr;
120
+ result.testCases = this.extractTestCases(output, acId);
121
+ // Check for test failures
122
+ const hasFailures = output.includes('FAIL') ||
123
+ output.includes('failed') ||
124
+ output.includes('✗') ||
125
+ output.includes('0 passed');
126
+ result.passed = !hasFailures && result.testCases.length > 0;
127
+ if (!result.passed) {
128
+ result.error = this.extractFailureMessage(output);
129
+ }
130
+ }
131
+ catch (error) {
132
+ result.passed = false;
133
+ result.error = error.message || 'Test execution failed';
134
+ // Check if it's a timeout
135
+ if (error.killed && error.signal === 'SIGTERM') {
136
+ result.error = `Test timeout (exceeded ${this.config.timeout}ms)`;
137
+ }
138
+ }
139
+ result.duration = Date.now() - startTime;
140
+ return result;
141
+ }
142
+ /**
143
+ * Build test command with AC-ID filter
144
+ */
145
+ buildTestCommand(testFile, acId) {
146
+ // Detect test runner from config command
147
+ const command = this.config.command.toLowerCase();
148
+ if (command.includes('vitest')) {
149
+ // Vitest: vitest run <file> -t "AC-US1-01"
150
+ return `${this.config.command} ${testFile} -t "${acId}"`;
151
+ }
152
+ else if (command.includes('jest')) {
153
+ // Jest: jest <file> --testNamePattern="AC-US1-01"
154
+ return `${this.config.command} ${testFile} --testNamePattern="${acId}"`;
155
+ }
156
+ else if (command.includes('npm test')) {
157
+ // NPM script - try to pass args
158
+ return `${this.config.command} -- ${testFile} -t "${acId}"`;
159
+ }
160
+ else {
161
+ // Default: assume vitest-style
162
+ return `${this.config.command} ${testFile} -t "${acId}"`;
163
+ }
164
+ }
165
+ /**
166
+ * Extract test case names from test output
167
+ */
168
+ extractTestCases(output, acId) {
169
+ const testCases = [];
170
+ // Look for lines containing the AC-ID and test indicators
171
+ const lines = output.split('\n');
172
+ for (const line of lines) {
173
+ if (line.includes(acId) && (line.includes('✓') || line.includes('PASS') || line.includes('√'))) {
174
+ // Extract test name (basic heuristic)
175
+ const match = line.match(/✓\s+(.+)/) || line.match(/PASS\s+(.+)/);
176
+ if (match) {
177
+ testCases.push(match[1].trim());
178
+ }
179
+ }
180
+ }
181
+ return testCases;
182
+ }
183
+ /**
184
+ * Extract failure message from test output
185
+ */
186
+ extractFailureMessage(output) {
187
+ const lines = output.split('\n');
188
+ // Find first error/failure message
189
+ for (let i = 0; i < lines.length; i++) {
190
+ const line = lines[i];
191
+ if (line.includes('FAIL') || line.includes('✗') || line.includes('Error:')) {
192
+ // Collect next few lines for context
193
+ const errorLines = lines.slice(i, i + 5).join('\n');
194
+ return errorLines.substring(0, 200); // Truncate long messages
195
+ }
196
+ }
197
+ // Fallback: return last few lines
198
+ return lines.slice(-5).join('\n');
199
+ }
200
+ /**
201
+ * Extract test file path from task description (Test Plan section)
202
+ */
203
+ extractTestFile(task) {
204
+ if (!task.description)
205
+ return null;
206
+ // Look for Test Plan section with file path
207
+ // Format: **Test Plan**:
208
+ // - **File**: `tests/unit/component.test.ts`
209
+ const testFileRegex = /\*\*File\*\*:\s*`([^`]+)`/;
210
+ const match = task.description.match(testFileRegex);
211
+ return match ? match[1] : null;
212
+ }
213
+ /**
214
+ * Format validation result for display
215
+ */
216
+ formatResult(result) {
217
+ const lines = [];
218
+ lines.push(chalk.bold(`\nAC Test Validation: ${result.taskId}`));
219
+ lines.push(chalk.gray('─'.repeat(60)));
220
+ // Summary
221
+ lines.push(chalk.bold('Summary:'));
222
+ lines.push(` Total ACs: ${result.summary.totalACs}`);
223
+ lines.push(` ACs Tested: ${chalk.green(result.summary.acsTested)}`);
224
+ lines.push(` ACs Untested: ${chalk.red(result.summary.acsUntested)}`);
225
+ lines.push(` Tests Passed: ${chalk.green(result.summary.testsPassed)}`);
226
+ lines.push(` Tests Failed: ${chalk.red(result.summary.testsFailed)}`);
227
+ // Overall status
228
+ lines.push('');
229
+ if (result.passed) {
230
+ lines.push(chalk.green.bold('✓ VALIDATION PASSED'));
231
+ lines.push(chalk.green('All Acceptance Criteria have passing tests. Task can be marked complete.'));
232
+ }
233
+ else {
234
+ lines.push(chalk.red.bold('✗ VALIDATION FAILED'));
235
+ lines.push(chalk.red('Task cannot be marked complete until all AC tests pass.'));
236
+ }
237
+ // Errors
238
+ if (result.errors.length > 0) {
239
+ lines.push('');
240
+ lines.push(chalk.bold('Errors:'));
241
+ result.errors.forEach(error => {
242
+ lines.push(chalk.red(` • ${error}`));
243
+ });
244
+ }
245
+ // Test details
246
+ if (result.testResults.size > 0) {
247
+ lines.push('');
248
+ lines.push(chalk.bold('Test Results:'));
249
+ result.testResults.forEach((acResult, acId) => {
250
+ const icon = acResult.passed ? chalk.green('✓') : chalk.red('✗');
251
+ const status = acResult.passed ? chalk.green('PASSED') : chalk.red('FAILED');
252
+ lines.push(` ${icon} ${acId}: ${status} (${acResult.duration}ms)`);
253
+ if (acResult.testCases.length > 0) {
254
+ acResult.testCases.forEach(testCase => {
255
+ lines.push(chalk.gray(` - ${testCase}`));
256
+ });
257
+ }
258
+ if (acResult.error) {
259
+ lines.push(chalk.red(` Error: ${acResult.error}`));
260
+ }
261
+ });
262
+ }
263
+ lines.push(chalk.gray('─'.repeat(60)));
264
+ return lines.join('\n');
265
+ }
266
+ }
267
+ /**
268
+ * Create AC test validator from project config
269
+ */
270
+ export async function createACTestValidator(projectRoot) {
271
+ // Read test configuration from package.json or specweave config
272
+ const packageJsonPath = path.join(projectRoot, 'package.json');
273
+ let testCommand = 'npm test';
274
+ if (await fs.pathExists(packageJsonPath)) {
275
+ const packageJson = await fs.readJson(packageJsonPath);
276
+ // Detect test runner
277
+ if (packageJson.devDependencies?.vitest || packageJson.dependencies?.vitest) {
278
+ testCommand = 'npx vitest run';
279
+ }
280
+ else if (packageJson.devDependencies?.jest || packageJson.dependencies?.jest) {
281
+ testCommand = 'npx jest';
282
+ }
283
+ }
284
+ const config = {
285
+ command: testCommand,
286
+ pattern: 'tests/**/*.test.ts',
287
+ cwd: projectRoot,
288
+ timeout: 30000
289
+ };
290
+ return new ACTestValidator(config);
291
+ }
292
+ //# sourceMappingURL=ac-test-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ac-test-validator.js","sourceRoot":"","sources":["../../../src/core/ac-test-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AA+DlC;;GAEG;AACH,MAAM,OAAO,eAAe;IAG1B,YAAY,MAAwB;QAClC,IAAI,CAAC,MAAM,GAAG;YACZ,OAAO,EAAE,K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