chati-dev 1.4.0 → 2.0.2

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 (208) hide show
  1. package/README.md +40 -24
  2. package/framework/agents/build/dev.md +343 -0
  3. package/framework/agents/clarity/architect.md +112 -0
  4. package/framework/agents/clarity/brief.md +182 -0
  5. package/framework/agents/clarity/brownfield-wu.md +181 -0
  6. package/framework/agents/clarity/detail.md +110 -0
  7. package/framework/agents/clarity/greenfield-wu.md +153 -0
  8. package/framework/agents/clarity/ux.md +112 -0
  9. package/framework/config.yaml +3 -3
  10. package/framework/constitution.md +31 -1
  11. package/framework/context/governance.md +37 -0
  12. package/framework/context/protocols.md +34 -0
  13. package/framework/context/quality.md +27 -0
  14. package/framework/context/root.md +24 -0
  15. package/framework/data/entity-registry.yaml +1 -1
  16. package/framework/domains/agents/architect.yaml +51 -0
  17. package/framework/domains/agents/brief.yaml +47 -0
  18. package/framework/domains/agents/brownfield-wu.yaml +49 -0
  19. package/framework/domains/agents/detail.yaml +47 -0
  20. package/framework/domains/agents/dev.yaml +49 -0
  21. package/framework/domains/agents/devops.yaml +43 -0
  22. package/framework/domains/agents/greenfield-wu.yaml +47 -0
  23. package/framework/domains/agents/orchestrator.yaml +49 -0
  24. package/framework/domains/agents/phases.yaml +47 -0
  25. package/framework/domains/agents/qa-implementation.yaml +43 -0
  26. package/framework/domains/agents/qa-planning.yaml +44 -0
  27. package/framework/domains/agents/tasks.yaml +48 -0
  28. package/framework/domains/agents/ux.yaml +50 -0
  29. package/framework/domains/constitution.yaml +77 -0
  30. package/framework/domains/global.yaml +64 -0
  31. package/framework/domains/workflows/brownfield-discovery.yaml +16 -0
  32. package/framework/domains/workflows/brownfield-fullstack.yaml +26 -0
  33. package/framework/domains/workflows/brownfield-service.yaml +22 -0
  34. package/framework/domains/workflows/brownfield-ui.yaml +22 -0
  35. package/framework/domains/workflows/greenfield-fullstack.yaml +26 -0
  36. package/framework/hooks/constitution-guard.js +101 -0
  37. package/framework/hooks/mode-governance.js +92 -0
  38. package/framework/hooks/model-governance.js +76 -0
  39. package/framework/hooks/prism-engine.js +89 -0
  40. package/framework/hooks/session-digest.js +60 -0
  41. package/framework/hooks/settings.json +44 -0
  42. package/framework/i18n/en.yaml +3 -3
  43. package/framework/i18n/es.yaml +3 -3
  44. package/framework/i18n/fr.yaml +3 -3
  45. package/framework/i18n/pt.yaml +3 -3
  46. package/framework/intelligence/decision-engine.md +1 -1
  47. package/framework/migrations/v1.4-to-v2.0.yaml +167 -0
  48. package/framework/migrations/v2.0-to-v2.0.1.yaml +132 -0
  49. package/framework/orchestrator/chati.md +284 -6
  50. package/framework/tasks/architect-api-design.md +63 -0
  51. package/framework/tasks/architect-consolidate.md +47 -0
  52. package/framework/tasks/architect-db-design.md +73 -0
  53. package/framework/tasks/architect-design.md +95 -0
  54. package/framework/tasks/architect-security-review.md +62 -0
  55. package/framework/tasks/architect-stack-selection.md +53 -0
  56. package/framework/tasks/brief-consolidate.md +249 -0
  57. package/framework/tasks/brief-constraint-identify.md +277 -0
  58. package/framework/tasks/brief-extract-requirements.md +339 -0
  59. package/framework/tasks/brief-stakeholder-map.md +176 -0
  60. package/framework/tasks/brief-validate-completeness.md +121 -0
  61. package/framework/tasks/brownfield-wu-architecture-map.md +394 -0
  62. package/framework/tasks/brownfield-wu-deep-discovery.md +312 -0
  63. package/framework/tasks/brownfield-wu-dependency-scan.md +359 -0
  64. package/framework/tasks/brownfield-wu-migration-plan.md +483 -0
  65. package/framework/tasks/brownfield-wu-report.md +325 -0
  66. package/framework/tasks/brownfield-wu-risk-assess.md +424 -0
  67. package/framework/tasks/detail-acceptance-criteria.md +372 -0
  68. package/framework/tasks/detail-consolidate.md +138 -0
  69. package/framework/tasks/detail-edge-case-analysis.md +300 -0
  70. package/framework/tasks/detail-expand-prd.md +389 -0
  71. package/framework/tasks/detail-nfr-extraction.md +223 -0
  72. package/framework/tasks/dev-code-review.md +404 -0
  73. package/framework/tasks/dev-consolidate.md +543 -0
  74. package/framework/tasks/dev-debug.md +322 -0
  75. package/framework/tasks/dev-implement.md +252 -0
  76. package/framework/tasks/dev-iterate.md +411 -0
  77. package/framework/tasks/dev-pr-prepare.md +497 -0
  78. package/framework/tasks/dev-refactor.md +342 -0
  79. package/framework/tasks/dev-test-write.md +306 -0
  80. package/framework/tasks/devops-ci-setup.md +412 -0
  81. package/framework/tasks/devops-consolidate.md +712 -0
  82. package/framework/tasks/devops-deploy-config.md +598 -0
  83. package/framework/tasks/devops-monitoring-setup.md +658 -0
  84. package/framework/tasks/devops-release-prepare.md +673 -0
  85. package/framework/tasks/greenfield-wu-analyze-empty.md +169 -0
  86. package/framework/tasks/greenfield-wu-report.md +266 -0
  87. package/framework/tasks/greenfield-wu-scaffold-detection.md +203 -0
  88. package/framework/tasks/greenfield-wu-tech-stack-assess.md +255 -0
  89. package/framework/tasks/orchestrator-deviation.md +260 -0
  90. package/framework/tasks/orchestrator-escalate.md +276 -0
  91. package/framework/tasks/orchestrator-handoff.md +243 -0
  92. package/framework/tasks/orchestrator-health.md +372 -0
  93. package/framework/tasks/orchestrator-mode-switch.md +262 -0
  94. package/framework/tasks/orchestrator-resume.md +189 -0
  95. package/framework/tasks/orchestrator-route.md +169 -0
  96. package/framework/tasks/orchestrator-spawn-terminal.md +358 -0
  97. package/framework/tasks/orchestrator-status.md +260 -0
  98. package/framework/tasks/orchestrator-suggest-mode.md +372 -0
  99. package/framework/tasks/phases-breakdown.md +91 -0
  100. package/framework/tasks/phases-dependency-mapping.md +67 -0
  101. package/framework/tasks/phases-mvp-scoping.md +94 -0
  102. package/framework/tasks/qa-impl-consolidate.md +522 -0
  103. package/framework/tasks/qa-impl-performance-test.md +487 -0
  104. package/framework/tasks/qa-impl-regression-check.md +413 -0
  105. package/framework/tasks/qa-impl-sast-scan.md +402 -0
  106. package/framework/tasks/qa-impl-test-execute.md +344 -0
  107. package/framework/tasks/qa-impl-verdict.md +339 -0
  108. package/framework/tasks/qa-planning-consolidate.md +309 -0
  109. package/framework/tasks/qa-planning-coverage-plan.md +338 -0
  110. package/framework/tasks/qa-planning-gate-define.md +339 -0
  111. package/framework/tasks/qa-planning-risk-matrix.md +631 -0
  112. package/framework/tasks/qa-planning-test-strategy.md +217 -0
  113. package/framework/tasks/tasks-acceptance-write.md +75 -0
  114. package/framework/tasks/tasks-consolidate.md +57 -0
  115. package/framework/tasks/tasks-decompose.md +80 -0
  116. package/framework/tasks/tasks-estimate.md +66 -0
  117. package/framework/tasks/ux-a11y-check.md +49 -0
  118. package/framework/tasks/ux-component-map.md +55 -0
  119. package/framework/tasks/ux-consolidate.md +46 -0
  120. package/framework/tasks/ux-user-flow.md +46 -0
  121. package/framework/tasks/ux-wireframe.md +76 -0
  122. package/package.json +2 -2
  123. package/scripts/bundle-framework.js +2 -0
  124. package/scripts/changelog-generator.js +222 -0
  125. package/scripts/codebase-mapper.js +728 -0
  126. package/scripts/commit-message-generator.js +167 -0
  127. package/scripts/coverage-analyzer.js +260 -0
  128. package/scripts/dependency-analyzer.js +280 -0
  129. package/scripts/framework-analyzer.js +308 -0
  130. package/scripts/generate-constitution-domain.js +253 -0
  131. package/scripts/health-check.js +481 -0
  132. package/scripts/ide-sync.js +327 -0
  133. package/scripts/performance-analyzer.js +325 -0
  134. package/scripts/plan-tracker.js +278 -0
  135. package/scripts/populate-entity-registry.js +481 -0
  136. package/scripts/pr-review.js +317 -0
  137. package/scripts/rollback-manager.js +310 -0
  138. package/scripts/stuck-detector.js +343 -0
  139. package/scripts/test-quality-assessment.js +257 -0
  140. package/scripts/validate-agents.js +367 -0
  141. package/scripts/validate-tasks.js +465 -0
  142. package/src/autonomy/autonomous-gate.js +293 -0
  143. package/src/autonomy/index.js +51 -0
  144. package/src/autonomy/mode-manager.js +225 -0
  145. package/src/autonomy/mode-suggester.js +283 -0
  146. package/src/autonomy/progress-reporter.js +268 -0
  147. package/src/autonomy/safety-net.js +320 -0
  148. package/src/context/bracket-tracker.js +79 -0
  149. package/src/context/domain-loader.js +107 -0
  150. package/src/context/engine.js +144 -0
  151. package/src/context/formatter.js +184 -0
  152. package/src/context/index.js +4 -0
  153. package/src/context/layers/l0-constitution.js +28 -0
  154. package/src/context/layers/l1-global.js +37 -0
  155. package/src/context/layers/l2-agent.js +39 -0
  156. package/src/context/layers/l3-workflow.js +42 -0
  157. package/src/context/layers/l4-task.js +24 -0
  158. package/src/decision/analyzer.js +167 -0
  159. package/src/decision/engine.js +270 -0
  160. package/src/decision/index.js +38 -0
  161. package/src/decision/registry-healer.js +450 -0
  162. package/src/decision/registry-updater.js +330 -0
  163. package/src/gates/circuit-breaker.js +119 -0
  164. package/src/gates/g1-planning-complete.js +153 -0
  165. package/src/gates/g2-qa-planning.js +153 -0
  166. package/src/gates/g3-implementation.js +188 -0
  167. package/src/gates/g4-qa-implementation.js +207 -0
  168. package/src/gates/g5-deploy-ready.js +180 -0
  169. package/src/gates/gate-base.js +144 -0
  170. package/src/gates/index.js +46 -0
  171. package/src/installer/brownfield-upgrader.js +249 -0
  172. package/src/installer/core.js +82 -11
  173. package/src/installer/file-hasher.js +51 -0
  174. package/src/installer/manifest.js +117 -0
  175. package/src/installer/templates.js +17 -15
  176. package/src/installer/transaction.js +229 -0
  177. package/src/installer/validator.js +18 -1
  178. package/src/intelligence/registry-manager.js +2 -2
  179. package/src/memory/agent-memory.js +255 -0
  180. package/src/memory/gotchas-injector.js +72 -0
  181. package/src/memory/gotchas.js +361 -0
  182. package/src/memory/index.js +35 -0
  183. package/src/memory/search.js +233 -0
  184. package/src/memory/session-digest.js +239 -0
  185. package/src/merger/env-merger.js +112 -0
  186. package/src/merger/index.js +56 -0
  187. package/src/merger/replace-merger.js +51 -0
  188. package/src/merger/yaml-merger.js +127 -0
  189. package/src/orchestrator/agent-selector.js +285 -0
  190. package/src/orchestrator/deviation-handler.js +350 -0
  191. package/src/orchestrator/handoff-engine.js +271 -0
  192. package/src/orchestrator/index.js +67 -0
  193. package/src/orchestrator/intent-classifier.js +264 -0
  194. package/src/orchestrator/pipeline-manager.js +492 -0
  195. package/src/orchestrator/pipeline-state.js +223 -0
  196. package/src/orchestrator/session-manager.js +409 -0
  197. package/src/tasks/executor.js +195 -0
  198. package/src/tasks/handoff.js +226 -0
  199. package/src/tasks/index.js +4 -0
  200. package/src/tasks/loader.js +210 -0
  201. package/src/tasks/router.js +182 -0
  202. package/src/terminal/collector.js +216 -0
  203. package/src/terminal/index.js +30 -0
  204. package/src/terminal/isolation.js +129 -0
  205. package/src/terminal/monitor.js +277 -0
  206. package/src/terminal/spawner.js +269 -0
  207. package/src/upgrade/checker.js +1 -1
  208. package/src/wizard/i18n.js +3 -3
@@ -0,0 +1,309 @@
1
+ ---
2
+ id: qa-planning-consolidate
3
+ agent: qa-planning
4
+ trigger: qa-planning-risk-matrix
5
+ phase: clarity
6
+ requires_input: false
7
+ parallelizable: false
8
+ outputs: [qa-plan.yaml]
9
+ handoff_to: dev
10
+ autonomous_gate: true
11
+ criteria:
12
+ - Overall QA plan score >= 95%
13
+ - All quality gates defined
14
+ - Coverage targets set for all modules
15
+ - Risk matrix complete
16
+ - Test strategy documented
17
+ ---
18
+
19
+ # QA Planning Consolidation
20
+
21
+ ## Purpose
22
+ Compile all QA planning outputs into a final qa-plan.yaml document, calculate an overall quality score, and determine readiness for autonomous transition to the build phase.
23
+
24
+ ## Prerequisites
25
+ - test-strategy.yaml (testing approach and tools)
26
+ - quality-gates.yaml (gates and thresholds)
27
+ - coverage-plan.yaml (module coverage targets)
28
+ - risk-matrix.yaml (feature risk mapping)
29
+
30
+ ## Steps
31
+
32
+ 1. **Validate Input Documents**
33
+ - Verify all four prerequisite files exist and are valid YAML
34
+ - Check schema compliance for each document
35
+ - Ensure cross-references are consistent (e.g., risk levels in coverage-plan match risk-matrix)
36
+ - Flag any missing or incomplete sections
37
+
38
+ 2. **Calculate Test Strategy Score (25 points)**
39
+ - **Testing pyramid defined** (5 points): Unit, integration, e2e, manual scopes clear
40
+ - **Risk areas identified** (5 points): Critical, high, medium, low risks documented
41
+ - **Tools selected** (5 points): Test framework, SAST, performance, coverage tools specified
42
+ - **Test environments planned** (5 points): Local, CI, isolation, matrix defined
43
+ - **Execution order established** (5 points): Pre-commit, pre-push, CI, release order set
44
+
45
+ 3. **Calculate Quality Gates Score (25 points)**
46
+ - **Gates for all stages** (7 points): Pre-commit, clarity, build, validate, deploy gates defined
47
+ - **Thresholds with pass/fail** (6 points): Clear numeric or boolean thresholds for each gate
48
+ - **Enforcement mechanisms** (6 points): Automated, agent-enforced, manual processes specified
49
+ - **Bypass procedures** (3 points): Deviation protocol, manual approval, exceptions documented
50
+ - **Severity levels** (3 points): BLOCKER, CRITICAL, MAJOR, MINOR defined
51
+
52
+ 4. **Calculate Coverage Plan Score (25 points)**
53
+ - **All modules have targets** (8 points): Every module/component has specific coverage percentage
54
+ - **Target justifications** (5 points): Rationale provided for each target
55
+ - **Measurement approach** (5 points): Tool, metrics, enforcement, reporting defined
56
+ - **Hard-to-test strategies** (4 points): Mocking, isolation, alternative validation approaches
57
+ - **Exceptions documented** (3 points): Uncovered areas with justifications
58
+
59
+ 5. **Calculate Risk Matrix Score (25 points)**
60
+ - **All features mapped** (8 points): Every feature has impact, likelihood, risk level
61
+ - **Risk scoring methodology** (5 points): Clear formula for calculating risk
62
+ - **Mitigation strategies** (5 points): Technical, process, monitoring mitigations per risk
63
+ - **Testing priorities** (4 points): Priority 1-4 with corresponding test approaches
64
+ - **Risk acceptances** (3 points): Known accepted risks with residual risk documentation
65
+
66
+ 6. **Calculate Overall Score**
67
+ - Sum all four category scores (max 100 points)
68
+ - Apply penalties for inconsistencies:
69
+ - Cross-reference mismatch: -5 points per issue (e.g., coverage-plan risk level ≠ risk-matrix)
70
+ - Missing critical sections: -10 points per section
71
+ - Unrealistic targets: -5 points (e.g., 100% coverage on hard-to-test code)
72
+ - Final score = raw score - penalties
73
+
74
+ 7. **Assess Autonomous Transition Readiness**
75
+ - **Score >= 95%**: Autonomous transition to build phase approved
76
+ - **Score 90-94%**: Manual approval required, flag for user review
77
+ - **Score < 90%**: Insufficient quality, identify gaps and remediation
78
+
79
+ 8. **Identify Gaps and Recommendations**
80
+ - List specific missing or weak sections
81
+ - Provide concrete recommendations for improvement
82
+ - Prioritize gaps by impact (critical gaps block transition)
83
+ - Include estimated effort to close gaps
84
+
85
+ 9. **Cross-Validate with Constitution**
86
+ - Verify mode governance rules are respected (autonomous transition at 95%)
87
+ - Ensure quality gates align with mode constraints (clarity = read all, write chati.dev/ only)
88
+ - Check that agent handoff logic is valid (qa-planning → dev)
89
+ - Validate autonomous_gate: true is correctly set
90
+
91
+ 10. **Compile Consolidated QA Plan**
92
+ - Create qa-plan.yaml with summary of all planning documents
93
+ - Include overall score and subscores
94
+ - Document autonomous transition decision
95
+ - Add executive summary for stakeholders
96
+
97
+ 11. **Generate Handoff Artifacts**
98
+ - If score >= 95%, prepare handoff to dev agent
99
+ - Include prioritized test implementation roadmap
100
+ - Provide quick-start guide for dev agent
101
+ - Document any open questions or assumptions
102
+
103
+ 12. **Log Completion and Next Steps**
104
+ - Update session.yaml with qa-planning completion status
105
+ - Log overall score and autonomous transition decision
106
+ - If autonomous transition approved, trigger dev agent
107
+ - If manual approval needed, prompt orchestrator for user input
108
+
109
+ ## Decision Points
110
+
111
+ - **Score in 90-94% Range**: This is the gray zone. Assess whether gaps are minor (documentation completeness) or substantive (missing risk areas). For minor gaps, recommend manual approval. For substantive gaps, require remediation.
112
+
113
+ - **Conflicting Cross-References**: If coverage-plan.yaml and risk-matrix.yaml disagree on risk levels, trust risk-matrix as the source of truth (it's more comprehensive). Update coverage-plan mentally or flag for correction.
114
+
115
+ - **Unrealistic Targets**: If coverage targets are excessively high (e.g., 100% on integration tests with external dependencies), apply realism penalty. Suggest adjusted targets in recommendations.
116
+
117
+ ## Error Handling
118
+
119
+ **Missing Input Document**
120
+ - Cannot proceed without all four planning documents
121
+ - Log error with specific missing file
122
+ - Return to orchestrator with dependency resolution request
123
+ - Do not calculate partial score
124
+
125
+ **Schema Validation Failure**
126
+ - If a document fails schema validation, attempt to identify specific issue
127
+ - Log detailed error (line number, field name, expected format)
128
+ - Escalate to orchestrator for manual correction
129
+ - Do not proceed with invalid data
130
+
131
+ **Cross-Reference Inconsistencies**
132
+ - If inconsistencies are minor (e.g., slight wording differences), document and proceed with penalty
133
+ - If inconsistencies are major (e.g., module in coverage-plan not in risk-matrix), flag as critical gap
134
+ - Provide specific remediation steps in recommendations
135
+
136
+ **Score Below Threshold**
137
+ - If overall score < 90%, compilation succeeds but transition fails
138
+ - Generate detailed gap analysis with prioritized action items
139
+ - Escalate to orchestrator for user decision (remediate or override via deviation protocol)
140
+ - Log decision and rationale in session.yaml
141
+
142
+ ## Output Format
143
+
144
+ ```yaml
145
+ # qa-plan.yaml
146
+ version: 1.0.0
147
+ created: YYYY-MM-DD
148
+ agent: qa-planning
149
+
150
+ overall_score: 96
151
+ autonomous_transition: approved
152
+ transition_to: dev
153
+
154
+ subscores:
155
+ test_strategy: 24 / 25
156
+ quality_gates: 25 / 25
157
+ coverage_plan: 24 / 25
158
+ risk_matrix: 23 / 25
159
+
160
+ scoring_breakdown:
161
+ test_strategy:
162
+ testing_pyramid_defined: 5 / 5
163
+ risk_areas_identified: 5 / 5
164
+ tools_selected: 5 / 5
165
+ environments_planned: 4 / 5 # CI matrix incomplete
166
+ execution_order: 5 / 5
167
+
168
+ quality_gates:
169
+ gates_all_stages: 7 / 7
170
+ thresholds_clear: 6 / 6
171
+ enforcement_mechanisms: 6 / 6
172
+ bypass_procedures: 3 / 3
173
+ severity_levels: 3 / 3
174
+
175
+ coverage_plan:
176
+ modules_have_targets: 8 / 8
177
+ target_justifications: 5 / 5
178
+ measurement_approach: 5 / 5
179
+ hard_to_test_strategies: 3 / 4 # IDE integration strategy weak
180
+ exceptions_documented: 3 / 3
181
+
182
+ risk_matrix:
183
+ features_mapped: 8 / 8
184
+ risk_scoring: 5 / 5
185
+ mitigation_strategies: 5 / 5
186
+ testing_priorities: 2 / 4 # Priority 4 features under-specified
187
+ risk_acceptances: 3 / 3
188
+
189
+ penalties:
190
+ - issue: CI matrix incomplete (only 2 OSes specified, need 3)
191
+ penalty: -1
192
+ - issue: IDE integration testing strategy needs more detail
193
+ penalty: -1
194
+ - issue: Priority 4 features lack test case examples
195
+ penalty: -2
196
+
197
+ gaps:
198
+ minor:
199
+ - CI matrix incomplete: Add Windows to existing Ubuntu + macOS
200
+ - IDE integration strategy: Add headless IDE API approach for automated testing
201
+ - Priority 4 test cases: Provide 2-3 example test cases for low-risk features
202
+
203
+ major: []
204
+
205
+ recommendations:
206
+ - Close minor gaps in next iteration (estimated 2 hours)
207
+ - Current score 96% exceeds autonomous transition threshold
208
+ - Proceed to build phase with dev agent
209
+ - Revisit IDE testing strategy in Phase 1 (after installer complete)
210
+
211
+ constitution_compliance:
212
+ mode_governance: compliant
213
+ autonomous_threshold: met (96% >= 95%)
214
+ agent_handoff: valid (qa-planning -> dev)
215
+ autonomous_gate: set correctly
216
+
217
+ executive_summary:
218
+ status: APPROVED
219
+ confidence: high
220
+ readiness: 96%
221
+ key_strengths:
222
+ - Comprehensive risk matrix covering all features
223
+ - Clear quality gates with enforcement mechanisms
224
+ - Realistic coverage targets with justifications
225
+ - Thorough test strategy with tools and environments
226
+
227
+ areas_for_improvement:
228
+ - CI matrix should include Windows testing
229
+ - IDE integration testing needs automation approach
230
+ - Low-priority features need example test cases
231
+
232
+ recommendation: Proceed to build phase with dev agent. Address minor gaps during Phase 1 implementation.
233
+
234
+ handoff_to_dev:
235
+ priority_1_tests:
236
+ - Mode transition validation (state management, orchestrator)
237
+ - session.yaml write operations (state management)
238
+ - Version migration execution (upgrade system)
239
+
240
+ priority_2_tests:
241
+ - Agent routing logic (orchestrator)
242
+ - Task definition loading (agents)
243
+ - config.yaml parsing (configuration)
244
+
245
+ test_implementation_order:
246
+ 1. Set up test framework (Vitest) and coverage tool (c8)
247
+ 2. Implement Priority 1 tests (critical risk)
248
+ 3. Set up CI pipeline with quality gates
249
+ 4. Implement Priority 2 tests (high risk)
250
+ 5. Add integration tests for agent workflows
251
+ 6. Implement Priority 3 tests (medium risk)
252
+
253
+ quick_start:
254
+ - Review test-strategy.yaml for testing approach
255
+ - Reference coverage-plan.yaml for module-specific targets
256
+ - Use risk-matrix.yaml to prioritize test implementation
257
+ - Enforce quality-gates.yaml thresholds in CI
258
+
259
+ open_questions: []
260
+
261
+ assumptions:
262
+ - Vitest is compatible with project Node.js version (22.x)
263
+ - CI environment (GitHub Actions assumed) supports matrix builds
264
+ - MCP tool responses can be mocked with fixture data
265
+
266
+ input_documents:
267
+ - file: test-strategy.yaml
268
+ status: valid
269
+ score_contribution: 24 / 25
270
+
271
+ - file: quality-gates.yaml
272
+ status: valid
273
+ score_contribution: 25 / 25
274
+
275
+ - file: coverage-plan.yaml
276
+ status: valid
277
+ score_contribution: 24 / 25
278
+
279
+ - file: risk-matrix.yaml
280
+ status: valid
281
+ score_contribution: 23 / 25
282
+
283
+ cross_validation:
284
+ coverage_vs_risk:
285
+ status: consistent
286
+ issues: []
287
+
288
+ gates_vs_risk:
289
+ status: consistent
290
+ issues: []
291
+
292
+ strategy_vs_coverage:
293
+ status: consistent
294
+ issues: []
295
+
296
+ session_update:
297
+ agent: qa-planning
298
+ status: completed
299
+ score: 96
300
+ autonomous_transition: approved
301
+ next_agent: dev
302
+ timestamp: YYYY-MM-DDTHH:MM:SSZ
303
+
304
+ next_steps:
305
+ - Orchestrator triggers dev agent (autonomous transition)
306
+ - Dev agent begins Phase 0 (Installer) implementation
307
+ - QA-Implementation agent on standby for build phase
308
+ - Revisit minor gaps during Phase 1 review
309
+ ```
@@ -0,0 +1,338 @@
1
+ ---
2
+ id: qa-planning-coverage-plan
3
+ agent: qa-planning
4
+ trigger: qa-planning-gate-define
5
+ phase: clarity
6
+ requires_input: false
7
+ parallelizable: false
8
+ outputs: [coverage-plan.yaml]
9
+ handoff_to: qa-planning-risk-matrix
10
+ autonomous_gate: false
11
+ criteria:
12
+ - Coverage targets set for all modules
13
+ - Target justifications documented
14
+ - Measurement approach defined
15
+ ---
16
+
17
+ # Test Coverage Planning
18
+
19
+ ## Purpose
20
+ Create a detailed test coverage plan with specific targets for each module, component, and layer of the chati.dev system, aligned with risk levels and quality gates.
21
+
22
+ ## Prerequisites
23
+ - test-strategy.yaml defining overall testing approach
24
+ - quality-gates.yaml with coverage thresholds
25
+ - Architecture document showing system structure
26
+ - Task breakdown identifying all components
27
+
28
+ ## Steps
29
+
30
+ 1. **Map System Architecture to Testable Units**
31
+ - Identify all modules: orchestrator, agents (13), state management, file operations, CLI, validators, parsers
32
+ - List core utilities: YAML handlers, i18n, error handling, logging
33
+ - Note external interfaces: MCP tools, IDE integration, package managers
34
+ - Document data structures: session.yaml schema, config.yaml, task definitions
35
+
36
+ 2. **Categorize Components by Testability**
37
+ - **High Testability**: Pure functions (validators, parsers, formatters, calculators)
38
+ - **Medium Testability**: Stateful components (agent task execution, state management)
39
+ - **Low Testability**: External dependencies (MCP calls, file system operations, IDE interactions)
40
+ - **Manual Only**: UI/UX (TUI dashboard, color rendering, i18n display)
41
+
42
+ 3. **Define Coverage Targets by Layer**
43
+ - **Core Logic Layer**: 80-90% (business rules, validation, state transitions)
44
+ - **Service Layer**: 70-80% (agent orchestration, task execution, file operations)
45
+ - **Integration Layer**: 60-70% (MCP interfaces, CLI commands, external tools)
46
+ - **Presentation Layer**: 40-50% (formatting, rendering, i18n output)
47
+
48
+ 4. **Set Module-Specific Targets**
49
+ - **Orchestrator**: 85% (critical routing and mode governance logic)
50
+ - **State Management**: 90% (session.yaml read/write, consistency checks)
51
+ - **Agent Task Execution**: 75% (task loading, validation, execution)
52
+ - **File Operations**: 80% (read/write/create, permission handling, error recovery)
53
+ - **Validators**: 90% (schema validation, input sanitization)
54
+ - **Parsers**: 85% (YAML parsing, frontmatter extraction, template rendering)
55
+ - **CLI**: 70% (argument parsing, command routing, help generation)
56
+ - **i18n**: 60% (translation loading, locale handling; manual testing for display)
57
+ - **Error Handling**: 75% (error construction, formatting, recovery)
58
+
59
+ 5. **Identify Coverage Measurement Approach**
60
+ - **Line Coverage**: Primary metric, tracks executed lines
61
+ - **Branch Coverage**: Secondary metric for conditional logic
62
+ - **Function Coverage**: Ensures all exported functions tested
63
+ - **Statement Coverage**: Granular metric for complex expressions
64
+ - **Tool**: c8 (Istanbul-based coverage for Node.js)
65
+
66
+ 6. **Plan for Hard-to-Test Areas**
67
+ - **File System Operations**: Use temporary directories and mock fs module
68
+ - **MCP Tool Calls**: Mock tool responses with fixture data
69
+ - **IDE Integration**: Test CLI contract, manual verification of IDE behavior
70
+ - **Process Exit/Signals**: Mock process object, test exit code logic
71
+ - **Async Operations**: Use async/await test patterns, avoid timing dependencies
72
+
73
+ 7. **Define Uncovered Areas (Explicitly Excluded)**
74
+ - **Third-Party Dependencies**: Coverage tracked in dependencies' own tests
75
+ - **Generated Code**: Auto-generated files excluded from coverage
76
+ - **Prototype/Experimental**: Features flagged as experimental excluded until stable
77
+ - **Deprecated Code**: Legacy code marked for removal excluded
78
+
79
+ 8. **Establish Coverage Baselines**
80
+ - **Initial Baseline**: Measure current coverage (if brownfield) or set 0% (if greenfield)
81
+ - **Sprint Targets**: Define incremental improvement goals (e.g., +5% per sprint)
82
+ - **Release Targets**: Set minimum coverage for each release milestone
83
+ - **Maintenance Target**: Steady-state coverage after initial development (e.g., 75%)
84
+
85
+ 9. **Plan Coverage Enforcement**
86
+ - **Pre-Commit**: Prevent commits that reduce coverage below threshold
87
+ - **CI Pipeline**: Fail build if coverage drops below gate threshold
88
+ - **PR Checks**: Require new code to meet higher coverage bar (80%)
89
+ - **Reporting**: Generate coverage reports in CI, publish to artifact storage
90
+
91
+ 10. **Define Coverage Exceptions Process**
92
+ - **Justification Required**: Why coverage target cannot be met
93
+ - **Alternative Validation**: How quality is ensured without coverage (e.g., manual testing)
94
+ - **Approval**: Who approves exception (tech lead, QA lead)
95
+ - **Review Cadence**: When exception is revisited (quarterly)
96
+
97
+ 11. **Create Coverage Improvement Roadmap**
98
+ - **Phase 0 (Installer)**: 70% target (focus on CLI and validation logic)
99
+ - **Phase 1-3 (Core Agents)**: 75% target (add agent task execution tests)
100
+ - **Phase 4-5 (Quality/Build)**: 80% target (comprehensive integration tests)
101
+ - **Phase 6-7 (Deploy/Validate)**: 85% target (full pipeline coverage)
102
+
103
+ 12. **Compile Coverage Plan Document**
104
+ - List all modules with specific targets
105
+ - Document measurement approach and tooling
106
+ - Include exceptions and justifications
107
+ - Map to quality gates and risk levels
108
+
109
+ ## Decision Points
110
+
111
+ - **Target Adjustment for Legacy Code**: If brownfield project has existing low coverage, set realistic incremental targets rather than immediate 80% requirement. Example: 40% current → 50% sprint 1 → 60% sprint 2 → 70% sprint 3.
112
+
113
+ - **Integration Test Coverage**: For external dependencies (MCPs, file system), decide between mocking (higher coverage, less realistic) vs real integration (lower coverage, more realistic). Recommend hybrid: unit tests with mocks, separate integration tests with real dependencies.
114
+
115
+ - **Coverage vs Quality Trade-off**: High coverage doesn't guarantee quality. If team debates target strictness, emphasize meaningful tests over coverage percentage. Document agreement in coverage-plan.yaml.
116
+
117
+ ## Error Handling
118
+
119
+ **Missing Architecture Details**
120
+ - If architecture document lacks module boundaries, use best judgment based on file structure
121
+ - Document assumptions and flag for architect review
122
+ - Propose default targets (75% for unclear modules)
123
+
124
+ **Conflicting Quality Gate Thresholds**
125
+ - If quality-gates.yaml specifies 70% global but risk areas need 90%, document per-module targets
126
+ - Ensure weighted average meets global threshold
127
+ - Escalate if unresolvable conflict
128
+
129
+ **Tool Limitations**
130
+ - If coverage tool cannot measure certain code patterns (e.g., dynamic imports), document limitation
131
+ - Propose alternative validation (manual code review, runtime monitoring)
132
+ - Exclude unmeasurable code from coverage calculation with justification
133
+
134
+ ## Output Format
135
+
136
+ ```yaml
137
+ # coverage-plan.yaml
138
+ version: 1.0.0
139
+ created: YYYY-MM-DD
140
+ agent: qa-planning
141
+
142
+ global_targets:
143
+ overall: 75%
144
+ new_code: 80%
145
+ core_logic: 85%
146
+ baseline: 0% # greenfield project
147
+
148
+ measurement:
149
+ tool: c8
150
+ metrics:
151
+ primary: line_coverage
152
+ secondary: [branch_coverage, function_coverage]
153
+ enforcement:
154
+ pre_commit: true
155
+ ci_pipeline: true
156
+ pr_check: true
157
+ reporting:
158
+ format: [html, json, lcov]
159
+ artifact_storage: .coverage/
160
+
161
+ modules:
162
+ orchestrator:
163
+ target: 85%
164
+ justification: Critical routing and mode governance logic
165
+ risk_level: critical
166
+ files:
167
+ - chati.dev/orchestrator.js
168
+ - chati.dev/mode-governance.js
169
+ - chati.dev/deviation-handler.js
170
+ hard_to_test:
171
+ - IDE detection: mock process.env and fs
172
+ - User prompts: mock readline interface
173
+
174
+ state_management:
175
+ target: 90%
176
+ justification: State corruption is critical risk
177
+ risk_level: critical
178
+ files:
179
+ - chati.dev/state/session-manager.js
180
+ - chati.dev/state/validators.js
181
+ - chati.dev/state/consistency-checker.js
182
+ hard_to_test:
183
+ - File system race conditions: use temporary directories
184
+ - Concurrent access: test with multiple async operations
185
+
186
+ agents:
187
+ target: 75%
188
+ justification: Task execution logic with external dependencies
189
+ risk_level: high
190
+ files:
191
+ - chati.dev/agents/*.js
192
+ - chati.dev/tasks/*.md (loaded dynamically)
193
+ hard_to_test:
194
+ - MCP tool calls: mock tool responses
195
+ - File writes: use temporary directories
196
+ - User input: mock readline
197
+
198
+ file_operations:
199
+ target: 80%
200
+ justification: File I/O errors are high risk
201
+ risk_level: high
202
+ files:
203
+ - chati.dev/utils/file-ops.js
204
+ - chati.dev/utils/yaml-handler.js
205
+ hard_to_test:
206
+ - Permission errors: mock fs with error injection
207
+ - Path traversal: test with malicious paths
208
+
209
+ validators:
210
+ target: 90%
211
+ justification: Pure functions, highly testable
212
+ risk_level: high
213
+ files:
214
+ - chati.dev/validators/*.js
215
+ hard_to_test: []
216
+
217
+ parsers:
218
+ target: 85%
219
+ justification: Parsing errors can corrupt workflow
220
+ risk_level: high
221
+ files:
222
+ - chati.dev/parsers/yaml-parser.js
223
+ - chati.dev/parsers/frontmatter.js
224
+ - chati.dev/parsers/template-renderer.js
225
+ hard_to_test:
226
+ - Malformed YAML: test with edge cases
227
+
228
+ cli:
229
+ target: 70%
230
+ justification: Argument parsing with many edge cases
231
+ risk_level: medium
232
+ files:
233
+ - chati.dev/cli/index.js
234
+ - chati.dev/cli/commands/*.js
235
+ hard_to_test:
236
+ - Process exit: mock process.exit
237
+ - Signal handling: mock process signals
238
+
239
+ i18n:
240
+ target: 60%
241
+ justification: Translation loading testable, display manual
242
+ risk_level: medium
243
+ files:
244
+ - chati.dev/i18n/loader.js
245
+ - chati.dev/i18n/translations/*.json
246
+ hard_to_test:
247
+ - Terminal rendering: manual verification
248
+ - Locale detection: mock process.env.LANG
249
+
250
+ error_handling:
251
+ target: 75%
252
+ justification: Error construction and formatting logic
253
+ risk_level: medium
254
+ files:
255
+ - chati.dev/errors/*.js
256
+ hard_to_test:
257
+ - Stack trace formatting: test with real errors
258
+
259
+ utilities:
260
+ target: 80%
261
+ justification: Shared utilities with broad usage
262
+ risk_level: medium
263
+ files:
264
+ - chati.dev/utils/*.js (excluding file-ops.js)
265
+ hard_to_test: []
266
+
267
+ excluded:
268
+ - "node_modules/**"
269
+ - "**/*.test.js"
270
+ - "**/*.spec.js"
271
+ - "**/fixtures/**"
272
+ - "**/mocks/**"
273
+ - "build/**"
274
+ - "dist/**"
275
+
276
+ exceptions:
277
+ - module: IDE integration
278
+ reason: Requires live IDE environment
279
+ alternative: Manual testing with 7 IDE compatibility matrix
280
+ approved_by: QA Lead
281
+ review_date: quarterly
282
+
283
+ - module: TUI dashboard
284
+ reason: Visual rendering difficult to test
285
+ alternative: Snapshot tests for text output, manual visual verification
286
+ approved_by: Tech Lead
287
+ review_date: quarterly
288
+
289
+ baselines:
290
+ sprint_1: 70%
291
+ sprint_2: 75%
292
+ sprint_3: 80%
293
+ release_1.0: 75%
294
+ maintenance: 75%
295
+
296
+ improvement_roadmap:
297
+ phase_0_installer:
298
+ target: 70%
299
+ focus: [cli, validators, file_operations]
300
+
301
+ phase_1_3_agents:
302
+ target: 75%
303
+ focus: [orchestrator, agents, state_management]
304
+
305
+ phase_4_5_quality:
306
+ target: 80%
307
+ focus: [integration tests, error_handling]
308
+
309
+ phase_6_7_deploy:
310
+ target: 85%
311
+ focus: [full pipeline coverage, edge cases]
312
+
313
+ hard_to_test_strategies:
314
+ file_system:
315
+ approach: Temporary directories + mock fs
316
+ example: "Use tmp package for isolated test directories"
317
+
318
+ mcp_tools:
319
+ approach: Mock tool responses with fixtures
320
+ example: "Create fixtures/mcp-responses/*.json for each tool"
321
+
322
+ ide_integration:
323
+ approach: Test CLI contract, manual IDE verification
324
+ example: "Test npx chati-dev command output, verify in 7 IDEs"
325
+
326
+ async_operations:
327
+ approach: async/await test patterns
328
+ example: "Use async test functions, avoid setTimeout"
329
+
330
+ process_lifecycle:
331
+ approach: Mock process object
332
+ example: "Mock process.exit, process.on('SIGINT')"
333
+
334
+ next_steps:
335
+ - Build risk matrix mapping features to coverage targets
336
+ - Validate coverage targets against timeline
337
+ - Begin test implementation in high-risk modules
338
+ ```