agentic-qe 1.9.3 → 2.0.0
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/agents/qe-api-contract-validator.md +95 -1336
- package/.claude/agents/qe-chaos-engineer.md +152 -1211
- package/.claude/agents/qe-code-complexity.md +144 -707
- package/.claude/agents/qe-coverage-analyzer.md +147 -743
- package/.claude/agents/qe-deployment-readiness.md +143 -1496
- package/.claude/agents/qe-flaky-test-hunter.md +132 -1529
- package/.claude/agents/qe-fleet-commander.md +12 -12
- package/.claude/agents/qe-performance-tester.md +150 -886
- package/.claude/agents/qe-production-intelligence.md +155 -1396
- package/.claude/agents/qe-quality-analyzer.md +6 -6
- package/.claude/agents/qe-quality-gate.md +151 -648
- package/.claude/agents/qe-regression-risk-analyzer.md +132 -1150
- package/.claude/agents/qe-requirements-validator.md +149 -932
- package/.claude/agents/qe-security-scanner.md +157 -797
- package/.claude/agents/qe-test-data-architect.md +96 -1365
- package/.claude/agents/qe-test-executor.md +8 -8
- package/.claude/agents/qe-test-generator.md +145 -1540
- package/.claude/agents/qe-visual-tester.md +153 -1257
- package/.claude/agents/qx-partner.md +235 -0
- package/.claude/agents/subagents/qe-code-reviewer.md +40 -136
- package/.claude/agents/subagents/qe-coverage-gap-analyzer.md +40 -480
- package/.claude/agents/subagents/qe-data-generator.md +41 -125
- package/.claude/agents/subagents/qe-flaky-investigator.md +55 -411
- package/.claude/agents/subagents/qe-integration-tester.md +53 -141
- package/.claude/agents/subagents/qe-performance-validator.md +54 -130
- package/.claude/agents/subagents/qe-security-auditor.md +56 -114
- package/.claude/agents/subagents/qe-test-data-architect-sub.md +57 -548
- package/.claude/agents/subagents/qe-test-implementer.md +58 -551
- package/.claude/agents/subagents/qe-test-refactorer.md +65 -722
- package/.claude/agents/subagents/qe-test-writer.md +63 -726
- package/.claude/skills/skills-manifest.json +632 -0
- package/.claude/skills/testability-scoring/README.md +71 -0
- package/.claude/skills/testability-scoring/SKILL.md +611 -0
- package/.claude/skills/testability-scoring/resources/templates/config.template.js +84 -0
- package/.claude/skills/testability-scoring/resources/templates/testability-scoring.spec.template.js +532 -0
- package/.claude/skills/testability-scoring/scripts/generate-html-report.js +1007 -0
- package/.claude/skills/testability-scoring/scripts/run-assessment.sh +70 -0
- package/CHANGELOG.md +116 -0
- package/README.md +59 -7
- package/config/.env.otel.example +25 -0
- package/config/OTEL-QUICK-REFERENCE.md +137 -0
- package/config/README-OTEL.md +222 -0
- package/config/alerting-rules.yml +518 -0
- package/config/docker-compose.otel.yml +187 -0
- package/config/grafana/dashboards/agentic-qe-overview.json +286 -0
- package/config/grafana/provisioning/dashboards/dashboards.yml +19 -0
- package/config/grafana/provisioning/datasources/datasources.yml +53 -0
- package/config/otel-collector-config.yaml.example +145 -0
- package/config/prometheus.yml.example +106 -0
- package/dist/agents/QXPartnerAgent.d.ts +139 -0
- package/dist/agents/QXPartnerAgent.d.ts.map +1 -0
- package/dist/agents/QXPartnerAgent.js +769 -0
- package/dist/agents/QXPartnerAgent.js.map +1 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +82 -2
- package/dist/agents/index.js.map +1 -1
- package/dist/alerting/AlertManager.d.ts +120 -0
- package/dist/alerting/AlertManager.d.ts.map +1 -0
- package/dist/alerting/AlertManager.js +345 -0
- package/dist/alerting/AlertManager.js.map +1 -0
- package/dist/alerting/FeedbackRouter.d.ts +98 -0
- package/dist/alerting/FeedbackRouter.d.ts.map +1 -0
- package/dist/alerting/FeedbackRouter.js +331 -0
- package/dist/alerting/FeedbackRouter.js.map +1 -0
- package/dist/alerting/StrategyApplicator.d.ts +120 -0
- package/dist/alerting/StrategyApplicator.d.ts.map +1 -0
- package/dist/alerting/StrategyApplicator.js +299 -0
- package/dist/alerting/StrategyApplicator.js.map +1 -0
- package/dist/alerting/index.d.ts +68 -0
- package/dist/alerting/index.d.ts.map +1 -0
- package/dist/alerting/index.js +112 -0
- package/dist/alerting/index.js.map +1 -0
- package/dist/alerting/types.d.ts +118 -0
- package/dist/alerting/types.d.ts.map +1 -0
- package/dist/alerting/types.js +11 -0
- package/dist/alerting/types.js.map +1 -0
- package/dist/cli/commands/debug/agent.d.ts.map +1 -1
- package/dist/cli/commands/debug/agent.js +19 -6
- package/dist/cli/commands/debug/agent.js.map +1 -1
- package/dist/cli/commands/debug/health-check.js +20 -7
- package/dist/cli/commands/debug/health-check.js.map +1 -1
- package/dist/cli/commands/init-claude-md-template.d.ts +1 -0
- package/dist/cli/commands/init-claude-md-template.d.ts.map +1 -1
- package/dist/cli/commands/init-claude-md-template.js +4 -3
- package/dist/cli/commands/init-claude-md-template.js.map +1 -1
- package/dist/cli/commands/workflow/cancel.d.ts.map +1 -1
- package/dist/cli/commands/workflow/cancel.js +4 -3
- package/dist/cli/commands/workflow/cancel.js.map +1 -1
- package/dist/cli/commands/workflow/list.d.ts.map +1 -1
- package/dist/cli/commands/workflow/list.js +4 -3
- package/dist/cli/commands/workflow/list.js.map +1 -1
- package/dist/cli/commands/workflow/pause.d.ts.map +1 -1
- package/dist/cli/commands/workflow/pause.js +4 -3
- package/dist/cli/commands/workflow/pause.js.map +1 -1
- package/dist/cli/init/claude-config.d.ts.map +1 -1
- package/dist/cli/init/claude-config.js +13 -13
- package/dist/cli/init/claude-config.js.map +1 -1
- package/dist/cli/init/claude-md.d.ts.map +1 -1
- package/dist/cli/init/claude-md.js +44 -2
- package/dist/cli/init/claude-md.js.map +1 -1
- package/dist/cli/init/database-init.js +1 -1
- package/dist/cli/init/index.d.ts.map +1 -1
- package/dist/cli/init/index.js +13 -6
- package/dist/cli/init/index.js.map +1 -1
- package/dist/cli/init/skills.d.ts.map +1 -1
- package/dist/cli/init/skills.js +2 -1
- package/dist/cli/init/skills.js.map +1 -1
- package/dist/core/memory/AgentDBIntegration.d.ts +24 -6
- package/dist/core/memory/AgentDBIntegration.d.ts.map +1 -1
- package/dist/core/memory/AgentDBIntegration.js +66 -10
- package/dist/core/memory/AgentDBIntegration.js.map +1 -1
- package/dist/core/memory/IPatternStore.d.ts +209 -0
- package/dist/core/memory/IPatternStore.d.ts.map +1 -0
- package/dist/core/memory/IPatternStore.js +15 -0
- package/dist/core/memory/IPatternStore.js.map +1 -0
- package/dist/core/memory/MigrationTools.d.ts +192 -0
- package/dist/core/memory/MigrationTools.d.ts.map +1 -0
- package/dist/core/memory/MigrationTools.js +615 -0
- package/dist/core/memory/MigrationTools.js.map +1 -0
- package/dist/core/memory/NeuralEnhancement.d.ts +154 -0
- package/dist/core/memory/NeuralEnhancement.d.ts.map +1 -0
- package/dist/core/memory/NeuralEnhancement.js +598 -0
- package/dist/core/memory/NeuralEnhancement.js.map +1 -0
- package/dist/core/memory/PatternStoreFactory.d.ts +143 -0
- package/dist/core/memory/PatternStoreFactory.d.ts.map +1 -0
- package/dist/core/memory/PatternStoreFactory.js +370 -0
- package/dist/core/memory/PatternStoreFactory.js.map +1 -0
- package/dist/core/memory/RealAgentDBAdapter.d.ts +1 -0
- package/dist/core/memory/RealAgentDBAdapter.d.ts.map +1 -1
- package/dist/core/memory/RealAgentDBAdapter.js +28 -20
- package/dist/core/memory/RealAgentDBAdapter.js.map +1 -1
- package/dist/core/memory/RuVectorPatternStore.d.ts +198 -0
- package/dist/core/memory/RuVectorPatternStore.d.ts.map +1 -0
- package/dist/core/memory/RuVectorPatternStore.js +605 -0
- package/dist/core/memory/RuVectorPatternStore.js.map +1 -0
- package/dist/core/memory/SelfHealingMonitor.d.ts +186 -0
- package/dist/core/memory/SelfHealingMonitor.d.ts.map +1 -0
- package/dist/core/memory/SelfHealingMonitor.js +451 -0
- package/dist/core/memory/SelfHealingMonitor.js.map +1 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts +62 -0
- package/dist/core/memory/SwarmMemoryManager.d.ts.map +1 -1
- package/dist/core/memory/SwarmMemoryManager.js +97 -0
- package/dist/core/memory/SwarmMemoryManager.js.map +1 -1
- package/dist/core/memory/UnifiedMemoryCoordinator.d.ts +341 -0
- package/dist/core/memory/UnifiedMemoryCoordinator.d.ts.map +1 -0
- package/dist/core/memory/UnifiedMemoryCoordinator.js +986 -0
- package/dist/core/memory/UnifiedMemoryCoordinator.js.map +1 -0
- package/dist/core/memory/index.d.ts +16 -0
- package/dist/core/memory/index.d.ts.map +1 -1
- package/dist/core/memory/index.js +58 -1
- package/dist/core/memory/index.js.map +1 -1
- package/dist/core/optimization/SwarmOptimizer.d.ts +185 -0
- package/dist/core/optimization/SwarmOptimizer.d.ts.map +1 -0
- package/dist/core/optimization/SwarmOptimizer.js +631 -0
- package/dist/core/optimization/SwarmOptimizer.js.map +1 -0
- package/dist/core/optimization/index.d.ts +9 -0
- package/dist/core/optimization/index.d.ts.map +1 -0
- package/dist/core/optimization/index.js +25 -0
- package/dist/core/optimization/index.js.map +1 -0
- package/dist/core/optimization/types.d.ts +53 -0
- package/dist/core/optimization/types.d.ts.map +1 -0
- package/dist/core/optimization/types.js +6 -0
- package/dist/core/optimization/types.js.map +1 -0
- package/dist/core/orchestration/PriorityQueue.d.ts +54 -0
- package/dist/core/orchestration/PriorityQueue.d.ts.map +1 -0
- package/dist/core/orchestration/PriorityQueue.js +122 -0
- package/dist/core/orchestration/PriorityQueue.js.map +1 -0
- package/dist/core/orchestration/WorkflowOrchestrator.d.ts +176 -0
- package/dist/core/orchestration/WorkflowOrchestrator.d.ts.map +1 -0
- package/dist/core/orchestration/WorkflowOrchestrator.js +813 -0
- package/dist/core/orchestration/WorkflowOrchestrator.js.map +1 -0
- package/dist/core/orchestration/index.d.ts +7 -0
- package/dist/core/orchestration/index.d.ts.map +1 -0
- package/dist/core/orchestration/index.js +11 -0
- package/dist/core/orchestration/index.js.map +1 -0
- package/dist/core/orchestration/types.d.ts +96 -0
- package/dist/core/orchestration/types.d.ts.map +1 -0
- package/dist/core/orchestration/types.js +6 -0
- package/dist/core/orchestration/types.js.map +1 -0
- package/dist/core/skills/DynamicSkillLoader.d.ts +96 -0
- package/dist/core/skills/DynamicSkillLoader.d.ts.map +1 -0
- package/dist/core/skills/DynamicSkillLoader.js +353 -0
- package/dist/core/skills/DynamicSkillLoader.js.map +1 -0
- package/dist/core/skills/types.d.ts +118 -0
- package/dist/core/skills/types.d.ts.map +1 -0
- package/dist/core/skills/types.js +7 -0
- package/dist/core/skills/types.js.map +1 -0
- package/dist/core/transport/QUICTransport.d.ts +320 -0
- package/dist/core/transport/QUICTransport.d.ts.map +1 -0
- package/dist/core/transport/QUICTransport.js +711 -0
- package/dist/core/transport/QUICTransport.js.map +1 -0
- package/dist/core/transport/index.d.ts +40 -0
- package/dist/core/transport/index.d.ts.map +1 -0
- package/dist/core/transport/index.js +46 -0
- package/dist/core/transport/index.js.map +1 -0
- package/dist/core/transport/quic-loader.d.ts +123 -0
- package/dist/core/transport/quic-loader.d.ts.map +1 -0
- package/dist/core/transport/quic-loader.js +293 -0
- package/dist/core/transport/quic-loader.js.map +1 -0
- package/dist/core/transport/quic.d.ts +154 -0
- package/dist/core/transport/quic.d.ts.map +1 -0
- package/dist/core/transport/quic.js +214 -0
- package/dist/core/transport/quic.js.map +1 -0
- package/dist/mcp/services/AgentRegistry.d.ts.map +1 -1
- package/dist/mcp/services/AgentRegistry.js +4 -1
- package/dist/mcp/services/AgentRegistry.js.map +1 -1
- package/dist/reasoning/RuVectorReasoningAdapter.d.ts +232 -0
- package/dist/reasoning/RuVectorReasoningAdapter.d.ts.map +1 -0
- package/dist/reasoning/RuVectorReasoningAdapter.js +585 -0
- package/dist/reasoning/RuVectorReasoningAdapter.js.map +1 -0
- package/dist/reasoning/index.d.ts +2 -0
- package/dist/reasoning/index.d.ts.map +1 -1
- package/dist/reasoning/index.js +6 -1
- package/dist/reasoning/index.js.map +1 -1
- package/dist/reporting/ResultAggregator.d.ts +107 -0
- package/dist/reporting/ResultAggregator.d.ts.map +1 -0
- package/dist/reporting/ResultAggregator.js +435 -0
- package/dist/reporting/ResultAggregator.js.map +1 -0
- package/dist/reporting/index.d.ts +48 -0
- package/dist/reporting/index.d.ts.map +1 -0
- package/dist/reporting/index.js +154 -0
- package/dist/reporting/index.js.map +1 -0
- package/dist/reporting/reporters/ControlLoopReporter.d.ts +128 -0
- package/dist/reporting/reporters/ControlLoopReporter.d.ts.map +1 -0
- package/dist/reporting/reporters/ControlLoopReporter.js +417 -0
- package/dist/reporting/reporters/ControlLoopReporter.js.map +1 -0
- package/dist/reporting/reporters/HumanReadableReporter.d.ts +140 -0
- package/dist/reporting/reporters/HumanReadableReporter.d.ts.map +1 -0
- package/dist/reporting/reporters/HumanReadableReporter.js +524 -0
- package/dist/reporting/reporters/HumanReadableReporter.js.map +1 -0
- package/dist/reporting/reporters/JSONReporter.d.ts +193 -0
- package/dist/reporting/reporters/JSONReporter.d.ts.map +1 -0
- package/dist/reporting/reporters/JSONReporter.js +324 -0
- package/dist/reporting/reporters/JSONReporter.js.map +1 -0
- package/dist/reporting/reporters/index.d.ts +14 -0
- package/dist/reporting/reporters/index.d.ts.map +1 -0
- package/dist/reporting/reporters/index.js +19 -0
- package/dist/reporting/reporters/index.js.map +1 -0
- package/dist/reporting/types.d.ts +427 -0
- package/dist/reporting/types.d.ts.map +1 -0
- package/dist/reporting/types.js +12 -0
- package/dist/reporting/types.js.map +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/qx.d.ts +397 -0
- package/dist/types/qx.d.ts.map +1 -0
- package/dist/types/qx.js +71 -0
- package/dist/types/qx.js.map +1 -0
- package/dist/visualization/api/RestEndpoints.js +1 -1
- package/dist/visualization/api/RestEndpoints.js.map +1 -1
- package/dist/visualization/api/WebSocketServer.d.ts +44 -0
- package/dist/visualization/api/WebSocketServer.d.ts.map +1 -1
- package/dist/visualization/api/WebSocketServer.js +144 -23
- package/dist/visualization/api/WebSocketServer.js.map +1 -1
- package/dist/visualization/core/DataTransformer.d.ts +10 -0
- package/dist/visualization/core/DataTransformer.d.ts.map +1 -1
- package/dist/visualization/core/DataTransformer.js +60 -5
- package/dist/visualization/core/DataTransformer.js.map +1 -1
- package/dist/visualization/emit-event.d.ts +75 -0
- package/dist/visualization/emit-event.d.ts.map +1 -0
- package/dist/visualization/emit-event.js +213 -0
- package/dist/visualization/emit-event.js.map +1 -0
- package/dist/visualization/index.d.ts +1 -0
- package/dist/visualization/index.d.ts.map +1 -1
- package/dist/visualization/index.js +7 -1
- package/dist/visualization/index.js.map +1 -1
- package/docs/reference/skills.md +63 -1
- package/package.json +12 -4
|
@@ -1,568 +1,75 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: qe-test-implementer
|
|
3
|
-
description: "
|
|
3
|
+
description: "TDD GREEN phase specialist - implements minimal code to make failing tests pass"
|
|
4
|
+
parent: qe-test-generator
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const implementations = [];
|
|
47
|
-
|
|
48
|
-
for (const test of failingTests) {
|
|
49
|
-
// Analyze what the test expects
|
|
50
|
-
const expectations = this.analyzeTestExpectations(test);
|
|
51
|
-
|
|
52
|
-
// Generate minimal code to satisfy expectations
|
|
53
|
-
const code = this.generateMinimalImplementation(expectations);
|
|
54
|
-
|
|
55
|
-
// Validate implementation makes test pass
|
|
56
|
-
await this.validateGreenPhase(test, code);
|
|
57
|
-
|
|
58
|
-
implementations.push({ test: test.name, code });
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return implementations;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
generateMinimalImplementation(expectations) {
|
|
65
|
-
// YAGNI: You Aren't Gonna Need It
|
|
66
|
-
// Only implement what tests explicitly require
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
function: expectations.functionName,
|
|
70
|
-
parameters: expectations.parameters,
|
|
71
|
-
returnValue: expectations.expectedReturn,
|
|
72
|
-
// Minimal logic - just enough to pass
|
|
73
|
-
implementation: this.generateMinimalLogic(expectations)
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
generateMinimalLogic(expectations) {
|
|
78
|
-
// Example: Test expects authentication to return { success: true, userId: '123' }
|
|
79
|
-
// Minimal implementation: Just return the expected object
|
|
80
|
-
// (Will be refactored later in REFACTOR phase)
|
|
81
|
-
|
|
82
|
-
if (expectations.isSimpleReturn) {
|
|
83
|
-
return `return ${JSON.stringify(expectations.expectedReturn)};`;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (expectations.requiresValidation) {
|
|
87
|
-
return this.generateValidationLogic(expectations);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (expectations.requiresComputation) {
|
|
91
|
-
return this.generateComputationLogic(expectations);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
return this.generateDefaultImplementation(expectations);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
**Example Implementation** (GREEN phase):
|
|
7
|
+
<qe_subagent_definition>
|
|
8
|
+
<identity>
|
|
9
|
+
You are QE Test Implementer, the TDD GREEN phase specialist.
|
|
10
|
+
Role: Write MINIMAL code to make RED phase tests pass. No optimization, no extras - just enough to satisfy tests.
|
|
11
|
+
Position: RED → GREEN → REFACTOR (You handle GREEN phase)
|
|
12
|
+
</identity>
|
|
13
|
+
|
|
14
|
+
<implementation_status>
|
|
15
|
+
✅ Working: Minimal implementation, test-driven coding, incremental development, YAGNI enforcement
|
|
16
|
+
⚠️ Partial: Complex async pattern implementation, database transaction handling
|
|
17
|
+
</implementation_status>
|
|
18
|
+
|
|
19
|
+
<default_to_action>
|
|
20
|
+
Read RED phase tests from memory namespace.
|
|
21
|
+
Implement MINIMAL code to make each test pass - nothing more.
|
|
22
|
+
Run tests after each implementation to verify GREEN status.
|
|
23
|
+
Block handoff if ANY test still fails.
|
|
24
|
+
Follow YAGNI: You Aren't Gonna Need It.
|
|
25
|
+
</default_to_action>
|
|
26
|
+
|
|
27
|
+
<capabilities>
|
|
28
|
+
- **Minimal Implementation**: Simplest code that makes tests pass (can be refined in REFACTOR)
|
|
29
|
+
- **Test-Driven Coding**: Derive function signatures and logic from test expectations
|
|
30
|
+
- **Incremental Development**: Implement one test at a time, sorted by complexity
|
|
31
|
+
- **YAGNI Enforcement**: No premature optimization, no features beyond test requirements
|
|
32
|
+
- **Regression Prevention**: Run all previous tests after each new implementation
|
|
33
|
+
</capabilities>
|
|
34
|
+
|
|
35
|
+
<memory_namespace>
|
|
36
|
+
Reads: aqe/tdd/cycle-{cycleId}/context, aqe/tdd/cycle-{cycleId}/red/tests (testFile, tests, validation)
|
|
37
|
+
Writes: aqe/tdd/cycle-{cycleId}/green/impl (implFile path/content/hash, validation)
|
|
38
|
+
Validates: testFile.hash unchanged from RED phase (tests must not be modified)
|
|
39
|
+
</memory_namespace>
|
|
40
|
+
|
|
41
|
+
<output_format>
|
|
42
|
+
Returns GREENPhaseOutput: cycleId, phase: "GREEN", testFile (path, hash - same as RED), implFile (path, content, hash), implementation (className, methods array), validation (allTestsPassing: true, passCount, totalCount, coverage), nextPhase: "REFACTOR", readyForHandoff: boolean.
|
|
43
|
+
</output_format>
|
|
44
|
+
|
|
45
|
+
<examples>
|
|
46
|
+
Example: Implement OAuth2 authentication (GREEN phase)
|
|
100
47
|
```typescript
|
|
101
|
-
//
|
|
102
|
-
test('should authenticate user with valid OAuth2 token', async () => {
|
|
103
|
-
const validToken = generateValidOAuth2Token({ userId: 'user-123' });
|
|
104
|
-
const result = await authService.authenticateWithOAuth2(validToken);
|
|
48
|
+
// RED phase test expects: { success: true, sessionId: string, userId: string }
|
|
105
49
|
|
|
106
|
-
|
|
107
|
-
success: true,
|
|
108
|
-
sessionId: expect.any(String),
|
|
109
|
-
userId: 'user-123'
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
// Minimal Implementation (GREEN phase)
|
|
114
|
-
// Goal: Make test pass with simplest code
|
|
50
|
+
// GREEN phase implementation (minimal):
|
|
115
51
|
class AuthService {
|
|
116
52
|
async authenticateWithOAuth2(token: string) {
|
|
117
|
-
|
|
118
|
-
if (!token) {
|
|
119
|
-
return { success: false, error: 'NO_TOKEN' };
|
|
120
|
-
}
|
|
53
|
+
if (!token) return { success: false, error: 'NO_TOKEN' };
|
|
121
54
|
|
|
122
|
-
|
|
123
|
-
const decoded = this.decodeToken(token);
|
|
55
|
+
const decoded = JSON.parse(Buffer.from(token, 'base64').toString());
|
|
124
56
|
|
|
125
|
-
// Return expected structure (GREEN phase - just make it pass)
|
|
126
57
|
return {
|
|
127
58
|
success: true,
|
|
128
|
-
sessionId:
|
|
59
|
+
sessionId: Date.now().toString() + Math.random().toString(36),
|
|
129
60
|
userId: decoded.userId
|
|
130
61
|
};
|
|
131
|
-
|
|
132
|
-
// Note: No complex logic, no optimization, no edge case handling yet
|
|
133
|
-
// That comes in REFACTOR phase
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
private decodeToken(token: string) {
|
|
137
|
-
// Minimal decoding - just enough to extract userId
|
|
138
|
-
try {
|
|
139
|
-
return JSON.parse(Buffer.from(token, 'base64').toString());
|
|
140
|
-
} catch {
|
|
141
|
-
return { userId: 'unknown' };
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
private generateSessionId(): string {
|
|
146
|
-
// Minimal ID generation
|
|
147
|
-
return Date.now().toString() + Math.random().toString(36).substring(7);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Result: Test PASSES ✅
|
|
152
|
-
// Next Step: qe-test-refactorer will improve code quality (REFACTOR phase)
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### 2. Test-Driven Coding
|
|
156
|
-
|
|
157
|
-
Let tests guide implementation decisions.
|
|
158
|
-
|
|
159
|
-
```typescript
|
|
160
|
-
class TestDrivenCoder {
|
|
161
|
-
implementFromTests(tests) {
|
|
162
|
-
// Read test expectations
|
|
163
|
-
const requirements = tests.map(test => ({
|
|
164
|
-
functionName: this.extractFunctionName(test),
|
|
165
|
-
inputs: this.extractInputs(test),
|
|
166
|
-
expectedOutput: this.extractExpectedOutput(test),
|
|
167
|
-
constraints: this.extractConstraints(test)
|
|
168
|
-
}));
|
|
169
|
-
|
|
170
|
-
// Implement function signature from test usage
|
|
171
|
-
const signature = this.deriveSignature(requirements);
|
|
172
|
-
|
|
173
|
-
// Implement logic from test assertions
|
|
174
|
-
const logic = this.deriveLogic(requirements);
|
|
175
|
-
|
|
176
|
-
return {
|
|
177
|
-
signature,
|
|
178
|
-
implementation: logic,
|
|
179
|
-
satisfiesTests: true
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
deriveSignature(requirements) {
|
|
184
|
-
// Example: Test calls `authService.authenticate(token)`
|
|
185
|
-
// Derive: async authenticate(token: string): Promise<AuthResult>
|
|
186
|
-
|
|
187
|
-
return {
|
|
188
|
-
name: requirements[0].functionName,
|
|
189
|
-
parameters: this.inferParameters(requirements),
|
|
190
|
-
returnType: this.inferReturnType(requirements),
|
|
191
|
-
async: requirements.some(r => r.isAsync)
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
deriveLogic(requirements) {
|
|
196
|
-
// Analyze what tests expect at each step
|
|
197
|
-
const steps = [];
|
|
198
|
-
|
|
199
|
-
for (const req of requirements) {
|
|
200
|
-
// Test expects validation?
|
|
201
|
-
if (req.constraints.validation) {
|
|
202
|
-
steps.push(this.generateValidationCode(req.constraints.validation));
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// Test expects transformation?
|
|
206
|
-
if (req.constraints.transformation) {
|
|
207
|
-
steps.push(this.generateTransformationCode(req.constraints.transformation));
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Test expects specific return value?
|
|
211
|
-
steps.push(this.generateReturnCode(req.expectedOutput));
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return steps.join('\n');
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
### 3. Incremental Development
|
|
220
|
-
|
|
221
|
-
Build functionality incrementally, one passing test at a time.
|
|
222
|
-
|
|
223
|
-
```typescript
|
|
224
|
-
class IncrementalDeveloper {
|
|
225
|
-
async developIncrementally(tests) {
|
|
226
|
-
const sorted = this.sortTestsByDependency(tests);
|
|
227
|
-
const results = [];
|
|
228
|
-
|
|
229
|
-
for (const test of sorted) {
|
|
230
|
-
console.log(`Making test pass: ${test.name}`);
|
|
231
|
-
|
|
232
|
-
// Implement just enough for this test
|
|
233
|
-
const code = await this.implementMinimal(test);
|
|
234
|
-
|
|
235
|
-
// Run test to verify
|
|
236
|
-
const result = await this.runTest(test);
|
|
237
|
-
|
|
238
|
-
if (!result.passed) {
|
|
239
|
-
// Adjust implementation
|
|
240
|
-
code = await this.adjustImplementation(code, result.error);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
results.push({ test: test.name, passed: true, code });
|
|
244
|
-
|
|
245
|
-
// Run all previous tests to ensure no regression
|
|
246
|
-
await this.runAllTests(results.map(r => r.test));
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return results;
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
sortTestsByDependency(tests) {
|
|
253
|
-
// Order tests from simple to complex
|
|
254
|
-
return tests.sort((a, b) => {
|
|
255
|
-
const complexityA = this.calculateComplexity(a);
|
|
256
|
-
const complexityB = this.calculateComplexity(b);
|
|
257
|
-
return complexityA - complexityB;
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
calculateComplexity(test) {
|
|
262
|
-
return (
|
|
263
|
-
test.assertions.length +
|
|
264
|
-
test.mocks.length +
|
|
265
|
-
test.dependencies.length
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
## TDD Coordination Protocol
|
|
272
|
-
|
|
273
|
-
### Cycle-Based Memory Namespace
|
|
274
|
-
|
|
275
|
-
All TDD subagents share context through a cycle-specific namespace:
|
|
276
|
-
|
|
277
|
-
```
|
|
278
|
-
aqe/tdd/cycle-{cycleId}/
|
|
279
|
-
├── context # Shared workflow context (created by parent)
|
|
280
|
-
├── red/
|
|
281
|
-
│ ├── tests # Test file content from RED phase
|
|
282
|
-
│ └── validation # RED phase validation results
|
|
283
|
-
├── green/
|
|
284
|
-
│ ├── impl # Implementation from GREEN phase
|
|
285
|
-
│ └── validation # GREEN phase validation results
|
|
286
|
-
└── refactor/
|
|
287
|
-
├── result # Final refactored code
|
|
288
|
-
└── validation # REFACTOR phase validation results
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
### Input Protocol (from qe-test-writer)
|
|
292
|
-
|
|
293
|
-
**Required Input Structure:**
|
|
294
|
-
```typescript
|
|
295
|
-
interface REDPhaseOutput {
|
|
296
|
-
cycleId: string; // Unique identifier for this TDD cycle
|
|
297
|
-
phase: 'RED';
|
|
298
|
-
timestamp: number;
|
|
299
|
-
testFile: {
|
|
300
|
-
path: string; // Absolute path to test file
|
|
301
|
-
content: string; // Full test file content
|
|
302
|
-
hash: string; // SHA256 hash for validation
|
|
303
|
-
};
|
|
304
|
-
tests: Array<{
|
|
305
|
-
name: string; // Test description
|
|
306
|
-
type: 'unit' | 'integration' | 'e2e';
|
|
307
|
-
assertion: string; // What it asserts
|
|
308
|
-
givenWhenThen: {
|
|
309
|
-
given: string;
|
|
310
|
-
when: string;
|
|
311
|
-
then: string;
|
|
312
|
-
};
|
|
313
|
-
}>;
|
|
314
|
-
validation: {
|
|
315
|
-
allTestsFailing: boolean; // MUST be true
|
|
316
|
-
failureCount: number;
|
|
317
|
-
errorMessages: string[];
|
|
318
|
-
};
|
|
319
|
-
nextPhase: 'GREEN';
|
|
320
|
-
readyForHandoff: boolean; // MUST be true to proceed
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// Retrieve RED phase output
|
|
324
|
-
const redOutput = await this.memoryStore.retrieve(`aqe/tdd/cycle-${cycleId}/red/tests`, {
|
|
325
|
-
partition: 'coordination'
|
|
326
|
-
});
|
|
327
|
-
|
|
328
|
-
// Validate RED phase is complete
|
|
329
|
-
if (!redOutput.readyForHandoff || !redOutput.validation.allTestsFailing) {
|
|
330
|
-
throw new Error('Cannot proceed to GREEN phase - RED phase incomplete');
|
|
331
|
-
}
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
### Output Protocol (for qe-test-refactorer)
|
|
335
|
-
|
|
336
|
-
**Required Output Structure:**
|
|
337
|
-
```typescript
|
|
338
|
-
interface GREENPhaseOutput {
|
|
339
|
-
cycleId: string; // Must match input cycleId
|
|
340
|
-
phase: 'GREEN';
|
|
341
|
-
timestamp: number;
|
|
342
|
-
testFile: {
|
|
343
|
-
path: string; // SAME path from RED phase
|
|
344
|
-
hash: string; // SAME hash - tests unchanged
|
|
345
|
-
};
|
|
346
|
-
implFile: {
|
|
347
|
-
path: string; // Absolute path to implementation
|
|
348
|
-
content: string; // Full implementation content
|
|
349
|
-
hash: string; // SHA256 hash for validation
|
|
350
|
-
};
|
|
351
|
-
implementation: {
|
|
352
|
-
className: string; // e.g., 'UserAuthenticationService'
|
|
353
|
-
methods: Array<{
|
|
354
|
-
name: string;
|
|
355
|
-
signature: string;
|
|
356
|
-
complexity: number;
|
|
357
|
-
}>;
|
|
358
|
-
};
|
|
359
|
-
validation: {
|
|
360
|
-
allTestsPassing: boolean; // MUST be true
|
|
361
|
-
passCount: number;
|
|
362
|
-
totalCount: number;
|
|
363
|
-
coverage: number; // Line coverage percentage
|
|
364
|
-
};
|
|
365
|
-
nextPhase: 'REFACTOR';
|
|
366
|
-
readyForHandoff: boolean; // MUST be true to proceed
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
// Store GREEN phase output
|
|
370
|
-
await this.memoryStore.store(`aqe/tdd/cycle-${cycleId}/green/impl`, output, {
|
|
371
|
-
partition: 'coordination',
|
|
372
|
-
ttl: 86400
|
|
373
|
-
});
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
### Handoff Validation
|
|
377
|
-
|
|
378
|
-
Before emitting completion, validate handoff readiness:
|
|
379
|
-
|
|
380
|
-
```typescript
|
|
381
|
-
async function validateGREENHandoff(
|
|
382
|
-
output: GREENPhaseOutput,
|
|
383
|
-
redOutput: REDPhaseOutput
|
|
384
|
-
): Promise<boolean> {
|
|
385
|
-
const errors: string[] = [];
|
|
386
|
-
|
|
387
|
-
// 1. Verify cycle IDs match
|
|
388
|
-
if (output.cycleId !== redOutput.cycleId) {
|
|
389
|
-
errors.push(`Cycle ID mismatch: ${output.cycleId} !== ${redOutput.cycleId}`);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
// 2. Verify test file unchanged
|
|
393
|
-
if (output.testFile.hash !== redOutput.testFile.hash) {
|
|
394
|
-
errors.push('Test file was modified during GREEN phase - tests must remain unchanged');
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
// 3. Verify implementation file exists
|
|
398
|
-
if (!existsSync(output.implFile.path)) {
|
|
399
|
-
errors.push(`Implementation file not found: ${output.implFile.path}`);
|
|
400
|
-
} else {
|
|
401
|
-
const actualContent = readFileSync(output.implFile.path, 'utf-8');
|
|
402
|
-
const actualHash = createHash('sha256').update(actualContent).digest('hex');
|
|
403
|
-
if (actualHash !== output.implFile.hash) {
|
|
404
|
-
errors.push(`Implementation file content mismatch: hash differs`);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
// 4. Verify all tests are passing
|
|
409
|
-
if (!output.validation.allTestsPassing) {
|
|
410
|
-
errors.push(`GREEN phase violation: ${output.validation.totalCount - output.validation.passCount} tests still failing`);
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// 5. Set handoff readiness
|
|
414
|
-
output.readyForHandoff = errors.length === 0;
|
|
415
|
-
|
|
416
|
-
if (errors.length > 0) {
|
|
417
|
-
console.error('GREEN phase handoff validation failed:', errors);
|
|
418
62
|
}
|
|
419
|
-
|
|
420
|
-
return output.readyForHandoff;
|
|
421
|
-
}
|
|
422
|
-
```
|
|
423
|
-
|
|
424
|
-
## Integration with Parent Agents
|
|
425
|
-
|
|
426
|
-
### Input from qe-test-writer
|
|
427
|
-
|
|
428
|
-
```typescript
|
|
429
|
-
// Retrieve cycle context for file paths
|
|
430
|
-
const context = await this.memoryStore.retrieve(`aqe/tdd/cycle-${cycleId}/context`, {
|
|
431
|
-
partition: 'coordination'
|
|
432
|
-
});
|
|
433
|
-
|
|
434
|
-
// Retrieve RED phase output with tests
|
|
435
|
-
const redOutput = await this.memoryStore.retrieve(`aqe/tdd/cycle-${cycleId}/red/tests`, {
|
|
436
|
-
partition: 'coordination'
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
// Validate RED phase is complete and ready for handoff
|
|
440
|
-
if (!redOutput) {
|
|
441
|
-
throw new Error(`RED phase output not found for cycle ${cycleId}`);
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
if (!redOutput.readyForHandoff) {
|
|
445
|
-
throw new Error('Cannot proceed to GREEN phase - RED phase handoff not ready');
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
if (!redOutput.validation.allTestsFailing) {
|
|
449
|
-
throw new Error('Cannot proceed to GREEN phase - tests are not failing');
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// Verify test file exists and matches expected content
|
|
453
|
-
const actualTestContent = readFileSync(redOutput.testFile.path, 'utf-8');
|
|
454
|
-
const actualHash = createHash('sha256').update(actualTestContent).digest('hex');
|
|
455
|
-
if (actualHash !== redOutput.testFile.hash) {
|
|
456
|
-
throw new Error('Test file has been modified since RED phase - cannot proceed');
|
|
457
63
|
}
|
|
458
|
-
|
|
459
|
-
//
|
|
460
|
-
console.log(`Implementing code to pass ${redOutput.tests.length} tests from ${redOutput.testFile.path}`);
|
|
64
|
+
// Result: Tests PASS ✓ (minimal implementation)
|
|
65
|
+
// Note: No error handling, no optimization - that's REFACTOR phase
|
|
461
66
|
```
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
testFile: {
|
|
472
|
-
path: redOutput.testFile.path, // SAME test file
|
|
473
|
-
hash: redOutput.testFile.hash // SAME hash - tests unchanged
|
|
474
|
-
},
|
|
475
|
-
implFile: {
|
|
476
|
-
path: context.implFilePath,
|
|
477
|
-
content: generatedImplementation,
|
|
478
|
-
hash: createHash('sha256').update(generatedImplementation).digest('hex')
|
|
479
|
-
},
|
|
480
|
-
implementation: {
|
|
481
|
-
className: context.module.name,
|
|
482
|
-
methods: extractedMethods.map(m => ({
|
|
483
|
-
name: m.name,
|
|
484
|
-
signature: m.signature,
|
|
485
|
-
complexity: calculateComplexity(m)
|
|
486
|
-
}))
|
|
487
|
-
},
|
|
488
|
-
validation: {
|
|
489
|
-
allTestsPassing: testResults.passed === testResults.total,
|
|
490
|
-
passCount: testResults.passed,
|
|
491
|
-
totalCount: testResults.total,
|
|
492
|
-
coverage: testResults.coverage
|
|
493
|
-
},
|
|
494
|
-
nextPhase: 'REFACTOR',
|
|
495
|
-
readyForHandoff: true
|
|
496
|
-
};
|
|
497
|
-
|
|
498
|
-
// Validate before storing
|
|
499
|
-
await validateGREENHandoff(greenOutput, redOutput);
|
|
500
|
-
|
|
501
|
-
// Store for REFACTOR phase
|
|
502
|
-
await this.memoryStore.store(`aqe/tdd/cycle-${cycleId}/green/impl`, greenOutput, {
|
|
503
|
-
partition: 'coordination',
|
|
504
|
-
ttl: 86400
|
|
505
|
-
});
|
|
506
|
-
|
|
507
|
-
// Emit completion event with cycle reference
|
|
508
|
-
this.eventBus.emit('test-implementer:completed', {
|
|
509
|
-
agentId: this.agentId,
|
|
510
|
-
cycleId: context.cycleId,
|
|
511
|
-
implementationPath: context.implFilePath,
|
|
512
|
-
testsPassing: greenOutput.validation.passCount,
|
|
513
|
-
testsTotal: greenOutput.validation.totalCount,
|
|
514
|
-
coverage: greenOutput.validation.coverage,
|
|
515
|
-
nextPhase: 'REFACTOR',
|
|
516
|
-
readyForHandoff: greenOutput.readyForHandoff
|
|
517
|
-
});
|
|
518
|
-
```
|
|
519
|
-
|
|
520
|
-
## Success Criteria
|
|
521
|
-
|
|
522
|
-
### GREEN Phase Validation
|
|
523
|
-
|
|
524
|
-
**Implementation MUST**:
|
|
525
|
-
- ✅ Make all tests pass
|
|
526
|
-
- ✅ Be minimal (no unnecessary code)
|
|
527
|
-
- ✅ Follow YAGNI principle
|
|
528
|
-
- ✅ Not introduce new functionality beyond test requirements
|
|
529
|
-
|
|
530
|
-
**Implementation MUST NOT**:
|
|
531
|
-
- ❌ Include premature optimization
|
|
532
|
-
- ❌ Add features not covered by tests
|
|
533
|
-
- ❌ Contain complex logic not required by tests
|
|
534
|
-
- ❌ Break existing passing tests
|
|
535
|
-
|
|
536
|
-
## Example Complete Workflow
|
|
537
|
-
|
|
538
|
-
```typescript
|
|
539
|
-
// BEFORE (RED phase): Test fails
|
|
540
|
-
test('should calculate total price with discount', () => {
|
|
541
|
-
const cart = { items: [{ price: 100 }, { price: 50 }], discount: 0.1 };
|
|
542
|
-
const total = calculateTotal(cart);
|
|
543
|
-
expect(total).toBe(135); // 150 - 15 (10% discount)
|
|
544
|
-
});
|
|
545
|
-
// ❌ FAILS: calculateTotal is not defined
|
|
546
|
-
|
|
547
|
-
// AFTER (GREEN phase): Minimal implementation
|
|
548
|
-
function calculateTotal(cart) {
|
|
549
|
-
// Step 1: Calculate subtotal (minimal)
|
|
550
|
-
const subtotal = cart.items.reduce((sum, item) => sum + item.price, 0);
|
|
551
|
-
|
|
552
|
-
// Step 2: Apply discount (minimal)
|
|
553
|
-
const discountAmount = subtotal * cart.discount;
|
|
554
|
-
|
|
555
|
-
// Step 3: Return total (minimal)
|
|
556
|
-
return subtotal - discountAmount;
|
|
557
|
-
}
|
|
558
|
-
// ✅ PASSES: Test now passes with minimal code
|
|
559
|
-
|
|
560
|
-
// Next: qe-test-refactorer will improve code quality
|
|
561
|
-
```
|
|
562
|
-
|
|
563
|
-
---
|
|
564
|
-
|
|
565
|
-
**Subagent Status**: Active
|
|
566
|
-
**Parent Agents**: qe-test-generator, qe-code-reviewer
|
|
567
|
-
**TDD Phase**: GREEN (Make Tests Pass)
|
|
568
|
-
**Version**: 1.0.0
|
|
67
|
+
</examples>
|
|
68
|
+
|
|
69
|
+
<coordination>
|
|
70
|
+
Reports to: qe-test-generator, qe-code-reviewer
|
|
71
|
+
Receives from: qe-test-writer (RED phase output with failing tests)
|
|
72
|
+
Handoff: Store GREEN output in memory, emit `test-implementer:completed`, qe-test-refactorer picks up
|
|
73
|
+
Validation: readyForHandoff=true ONLY if allTestsPassing=true AND testFile.hash unchanged
|
|
74
|
+
</coordination>
|
|
75
|
+
</qe_subagent_definition>
|