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,424 @@
1
+ ---
2
+ id: brownfield-wu-risk-assess
3
+ agent: brownfield-wu
4
+ trigger: brownfield-wu-architecture-map
5
+ phase: clarity
6
+ requires_input: false
7
+ parallelizable: false
8
+ outputs: [risk-assessment.yaml]
9
+ handoff_to: brownfield-wu-migration-plan
10
+ autonomous_gate: true
11
+ criteria:
12
+ - All technical risks identified and categorized
13
+ - Technical debt quantified
14
+ - Risk severity and likelihood assessed
15
+ - Mitigation strategies provided
16
+ ---
17
+ # Assess Technical Risks and Debt
18
+
19
+ ## Purpose
20
+ Identify and assess technical risks, technical debt, performance bottlenecks, security vulnerabilities, and maintainability issues in the existing codebase.
21
+
22
+ ## Prerequisites
23
+ - `discovery.yaml` with code quality indicators
24
+ - `dependencies.yaml` with vulnerability assessment
25
+ - `architecture-map.yaml` with architectural issues
26
+
27
+ ## Steps
28
+
29
+ ### 1. Load All Analysis Data
30
+ - Read `discovery.yaml` for quality indicators and technical debt markers
31
+ - Read `dependencies.yaml` for dependency vulnerabilities and outdated packages
32
+ - Read `architecture-map.yaml` for architectural issues and circular dependencies
33
+
34
+ ### 2. Identify Security Risks
35
+ - **Dependency Vulnerabilities**: From `dependencies.yaml`
36
+ - Critical and high-severity CVEs
37
+ - Exploitable vulnerabilities with known PoCs
38
+ - Unpatched vulnerabilities
39
+ - **Code Security Issues**:
40
+ - Hardcoded secrets (API keys, passwords, tokens)
41
+ - SQL injection vectors (raw queries, string concatenation)
42
+ - XSS vulnerabilities (unescaped user input, dangerouslySetInnerHTML)
43
+ - CSRF protection missing
44
+ - Insecure authentication (weak hashing, no MFA)
45
+ - Insecure data transmission (HTTP instead of HTTPS)
46
+ - Missing input validation
47
+ - Insufficient authorization checks
48
+ - **Configuration Issues**:
49
+ - Exposed .env files in repository
50
+ - Debug mode enabled in production
51
+ - Overly permissive CORS settings
52
+ - Missing security headers (CSP, HSTS, X-Frame-Options)
53
+
54
+ ### 3. Identify Performance Risks
55
+ - **Frontend Performance**:
56
+ - Large bundle sizes (>500KB initial load)
57
+ - No code splitting or lazy loading
58
+ - Inefficient rendering (unnecessary re-renders)
59
+ - Missing performance optimizations (memoization, virtualization)
60
+ - Large images without optimization
61
+ - No CDN usage
62
+ - **Backend Performance**:
63
+ - N+1 query problems
64
+ - Missing database indexes
65
+ - Inefficient algorithms (O(n²) or worse)
66
+ - Synchronous blocking operations
67
+ - Memory leaks
68
+ - No caching strategy
69
+ - **Database Performance**:
70
+ - Missing indexes on frequently queried columns
71
+ - Inefficient queries (SELECT *, large JOINs)
72
+ - No query optimization
73
+ - Database size growing without archival strategy
74
+
75
+ ### 4. Assess Technical Debt
76
+ Quantify technical debt from `discovery.yaml`:
77
+ - **Code Debt**:
78
+ - God files (>1000 lines): Count × 4 hours each to refactor
79
+ - High cyclomatic complexity: Count × 2 hours each
80
+ - Code duplication: DRY violations, copy-pasted code
81
+ - Commented-out code: Count lines
82
+ - TODO/FIXME count: Priority by age and context
83
+ - **Test Debt**:
84
+ - Low test coverage (<60%): Hours to reach 80% = (lines of code × 0.5 hours per 100 lines)
85
+ - Missing integration tests
86
+ - Missing E2E tests
87
+ - Flaky tests
88
+ - **Documentation Debt**:
89
+ - Missing README sections
90
+ - No API documentation
91
+ - No architecture docs
92
+ - Outdated documentation
93
+ - Missing inline comments in complex logic
94
+ - **Dependency Debt**:
95
+ - Outdated dependencies: From `dependencies.yaml`
96
+ - Deprecated packages
97
+ - Unused dependencies
98
+
99
+ ### 5. Identify Scalability Risks
100
+ - **Architectural Bottlenecks**:
101
+ - Monolithic architecture constraining scale
102
+ - Single points of failure
103
+ - No horizontal scaling capability
104
+ - Stateful services preventing scale-out
105
+ - **Data Scalability**:
106
+ - Database without sharding strategy
107
+ - No read replicas
108
+ - Growing tables without partitioning
109
+ - Hot spots in data distribution
110
+ - **Traffic Scalability**:
111
+ - No load balancing
112
+ - Missing rate limiting
113
+ - No auto-scaling configuration
114
+ - Synchronous request chains
115
+
116
+ ### 6. Assess Maintainability Risks
117
+ - **Code Maintainability**:
118
+ - Low cohesion modules
119
+ - High coupling (from architecture-map.yaml)
120
+ - Circular dependencies
121
+ - Inconsistent coding styles
122
+ - Mixed languages/frameworks without clear boundaries
123
+ - **Team Knowledge Risks**:
124
+ - Bus factor (key person dependencies)
125
+ - Undocumented complex logic
126
+ - Legacy code that no one understands
127
+ - Tech stack unfamiliar to current team
128
+ - **Process Risks**:
129
+ - No CI/CD pipeline
130
+ - Manual deployment process
131
+ - No code review process
132
+ - Missing automated testing
133
+
134
+ ### 7. Identify Compliance and Legal Risks
135
+ - **License Compliance**: From `dependencies.yaml`
136
+ - GPL/AGPL dependencies in proprietary code
137
+ - Unknown licenses
138
+ - License incompatibilities
139
+ - **Data Privacy**:
140
+ - GDPR compliance (data retention, right to deletion)
141
+ - PII handling without encryption
142
+ - No privacy policy
143
+ - Missing data protection measures
144
+ - **Accessibility**:
145
+ - WCAG compliance issues
146
+ - Missing ARIA labels
147
+ - Keyboard navigation issues
148
+
149
+ ### 8. Calculate Risk Scores
150
+ For each identified risk:
151
+ - **Severity**: Critical (9-10), High (7-8), Medium (4-6), Low (1-3)
152
+ - **Likelihood**: High (7-10), Medium (4-6), Low (1-3)
153
+ - **Risk Score**: Severity × Likelihood (1-100)
154
+ - **Impact**: What happens if risk materializes
155
+ - Business impact: Revenue loss, legal liability, reputation damage
156
+ - Technical impact: Downtime, data loss, security breach
157
+ - User impact: Poor UX, data privacy violation
158
+
159
+ ### 9. Prioritize Risks
160
+ Sort risks by risk score descending:
161
+ - **Critical Priority (Score 70-100)**: Address immediately
162
+ - **High Priority (Score 40-69)**: Address in next sprint
163
+ - **Medium Priority (Score 20-39)**: Address within 3 months
164
+ - **Low Priority (Score 1-19)**: Monitor, address when convenient
165
+
166
+ ### 10. Estimate Remediation Effort
167
+ For each high and critical risk:
168
+ - Estimated hours to fix
169
+ - Resources required (developers, DevOps, security experts)
170
+ - Dependencies (what must be fixed first)
171
+ - Complexity (easy, moderate, hard, very hard)
172
+ - Provide remediation strategy outline
173
+
174
+ ## Decision Points
175
+ - **Critical Security Risk**: If critical vulnerability or exposed secret found, alert immediately and ask if development should pause to fix
176
+ - **High Technical Debt**: If debt exceeds estimated project duration, ask if rewrite should be considered instead of maintenance
177
+ - **Compliance Issues**: If legal/compliance risks found, flag for legal review before proceeding
178
+
179
+ ## Error Handling
180
+ - **Incomplete Data**: If prerequisites are missing data, note limitations and continue with available information
181
+ - **False Positives**: If automated security scans show false positives, document and exclude from risk count
182
+ - **Unable to Quantify**: If some debt cannot be quantified, provide qualitative assessment
183
+
184
+ ## Output Format
185
+ ```yaml
186
+ # risk-assessment.yaml
187
+ timestamp: 2026-02-13T11:45:00Z
188
+ project_path: /Users/user/projects/legacy-app
189
+
190
+ executive_summary: |
191
+ Identified 47 risks across security, performance, technical debt, and maintainability.
192
+ 3 critical risks require immediate attention: 1 critical CVE, 1 exposed API key, 1 missing
193
+ authentication on admin endpoint. Total technical debt estimated at 287 hours.
194
+ High coupling and circular dependencies pose significant maintainability risk.
195
+
196
+ risk_summary:
197
+ total_risks: 47
198
+ by_severity:
199
+ critical: 3
200
+ high: 12
201
+ medium: 21
202
+ low: 11
203
+ by_category:
204
+ security: 8
205
+ performance: 11
206
+ technical_debt: 15
207
+ scalability: 6
208
+ maintainability: 7
209
+
210
+ critical_risks:
211
+ - id: SEC-001
212
+ category: security
213
+ description: Critical CVE in lodash (prototype pollution)
214
+ severity: 10
215
+ likelihood: 9
216
+ risk_score: 90
217
+ impact: |
218
+ Exploitable vulnerability allowing arbitrary code execution.
219
+ Could lead to full system compromise.
220
+ affected_components: [authentication, user-management, api-routes]
221
+ remediation:
222
+ action: Update lodash 4.17.20 → 4.17.21
223
+ complexity: easy
224
+ estimated_hours: 0.5
225
+ priority: immediate
226
+ - id: SEC-002
227
+ category: security
228
+ description: Exposed API key in src/config/api.ts
229
+ severity: 9
230
+ likelihood: 10
231
+ risk_score: 90
232
+ impact: |
233
+ Hardcoded third-party API key in source code, visible in git history.
234
+ Unauthorized access to paid API service, potential billing fraud.
235
+ affected_components: [payment-integration]
236
+ remediation:
237
+ action: |
238
+ 1. Rotate API key immediately
239
+ 2. Move to environment variable
240
+ 3. Add .env to .gitignore
241
+ 4. Use git-filter-branch to remove from history
242
+ complexity: moderate
243
+ estimated_hours: 2
244
+ priority: immediate
245
+ - id: SEC-003
246
+ category: security
247
+ description: Missing authentication on /api/admin/* endpoints
248
+ severity: 10
249
+ likelihood: 8
250
+ risk_score: 80
251
+ impact: |
252
+ Admin endpoints accessible without authentication.
253
+ Unauthorized users can access sensitive data and perform admin operations.
254
+ affected_components: [admin-api]
255
+ remediation:
256
+ action: Add authentication middleware to all /api/admin routes
257
+ complexity: easy
258
+ estimated_hours: 1
259
+ priority: immediate
260
+
261
+ high_risks:
262
+ - id: PERF-001
263
+ category: performance
264
+ description: N+1 query problem in user dashboard
265
+ severity: 7
266
+ likelihood: 10
267
+ risk_score: 70
268
+ impact: Database overload under load, slow page rendering
269
+ affected_components: [dashboard-service]
270
+ remediation:
271
+ action: Use Prisma include/select to fetch related data in single query
272
+ complexity: easy
273
+ estimated_hours: 2
274
+ - id: DEBT-001
275
+ category: technical_debt
276
+ description: God module src/utils with low cohesion
277
+ severity: 6
278
+ likelihood: 10
279
+ risk_score: 60
280
+ impact: Difficult to maintain, 34 modules depend on it
281
+ affected_components: [utils]
282
+ remediation:
283
+ action: Split into focused modules (date-utils, validation-utils, etc)
284
+ complexity: moderate
285
+ estimated_hours: 16
286
+ - id: MAINT-001
287
+ category: maintainability
288
+ description: Circular dependency between api-routes, services, models
289
+ severity: 7
290
+ likelihood: 8
291
+ risk_score: 56
292
+ impact: Difficult to reason about code flow, hard to refactor
293
+ affected_components: [api-routes, services, models]
294
+ remediation:
295
+ action: Extract shared types to separate module, remove backward imports
296
+ complexity: moderate
297
+ estimated_hours: 8
298
+
299
+ medium_risks:
300
+ - id: SCALE-001
301
+ category: scalability
302
+ description: No caching layer for expensive database queries
303
+ severity: 6
304
+ likelihood: 6
305
+ risk_score: 36
306
+ impact: Database bottleneck under high traffic
307
+ affected_components: [database-layer]
308
+ remediation:
309
+ action: Implement Redis caching for frequently accessed data
310
+ complexity: moderate
311
+ estimated_hours: 12
312
+ - id: DEBT-002
313
+ category: technical_debt
314
+ description: Test coverage at 11% (target 80%)
315
+ severity: 5
316
+ likelihood: 7
317
+ risk_score: 35
318
+ impact: Difficult to refactor safely, bugs slip through
319
+ affected_components: [all]
320
+ remediation:
321
+ action: Add unit tests for critical paths, integration tests for API
322
+ complexity: hard
323
+ estimated_hours: 120
324
+
325
+ low_risks:
326
+ - id: DEBT-003
327
+ category: technical_debt
328
+ description: 156 TODO comments in codebase
329
+ severity: 3
330
+ likelihood: 5
331
+ risk_score: 15
332
+ impact: Future work not being tracked, potential forgotten tasks
333
+ affected_components: [various]
334
+ remediation:
335
+ action: Review TODOs, create issues for valid ones, remove stale ones
336
+ complexity: easy
337
+ estimated_hours: 4
338
+
339
+ technical_debt_breakdown:
340
+ code_debt:
341
+ god_files: 12
342
+ estimated_hours: 48
343
+ test_debt:
344
+ coverage_gap: 69%
345
+ estimated_hours: 120
346
+ documentation_debt:
347
+ missing_sections: [API docs, architecture docs, ADRs]
348
+ estimated_hours: 24
349
+ dependency_debt:
350
+ outdated_packages: 28
351
+ estimated_hours: 23.5
352
+ total_estimated_hours: 287
353
+
354
+ security_summary:
355
+ vulnerabilities:
356
+ critical: 1
357
+ high: 4
358
+ moderate: 2
359
+ low: 1
360
+ exposed_secrets: 1
361
+ missing_security_controls: 3
362
+ compliance_issues: 1
363
+
364
+ performance_bottlenecks:
365
+ - N+1 queries in dashboard (SEC-001)
366
+ - Large bundle size (2.8 MB uncompressed)
367
+ - No code splitting
368
+ - Missing database indexes on user_id columns
369
+ - Synchronous image processing blocking requests
370
+
371
+ scalability_limits:
372
+ - Single PostgreSQL instance (no replicas)
373
+ - Stateful session storage preventing horizontal scale
374
+ - No load balancer configuration
375
+ - Hard-coded limits (max 1000 users per query)
376
+
377
+ maintainability_issues:
378
+ - High coupling (34 modules depend on utils)
379
+ - Circular dependencies
380
+ - Inconsistent error handling patterns
381
+ - Mixed TypeScript/JavaScript (41% TS adoption)
382
+ - No code style enforcement (Prettier not in pre-commit)
383
+
384
+ bus_factor: 2
385
+ bus_factor_risks:
386
+ - Authentication system only understood by 1 developer
387
+ - Legacy payment integration undocumented
388
+ - Deployment process manual and undocumented
389
+
390
+ recommendations_by_priority:
391
+ immediate:
392
+ - Fix critical lodash CVE (0.5 hours)
393
+ - Rotate and secure exposed API key (2 hours)
394
+ - Add authentication to admin endpoints (1 hour)
395
+ short_term:
396
+ - Fix N+1 queries (2 hours)
397
+ - Add database indexes (4 hours)
398
+ - Implement caching layer (12 hours)
399
+ - Break up god module (16 hours)
400
+ - Resolve circular dependencies (8 hours)
401
+ medium_term:
402
+ - Increase test coverage to 60% (60 hours)
403
+ - Update all outdated dependencies (23.5 hours)
404
+ - Complete TypeScript migration (40 hours)
405
+ - Add comprehensive documentation (24 hours)
406
+ long_term:
407
+ - Achieve 80% test coverage (120 hours)
408
+ - Implement monitoring and alerting
409
+ - Set up read replicas for database
410
+ - Migrate to stateless sessions for horizontal scale
411
+
412
+ total_remediation_effort:
413
+ critical: 3.5 hours
414
+ high: 26 hours
415
+ medium: 132 hours
416
+ low: 4 hours
417
+ total: 165.5 hours (not including full test coverage)
418
+
419
+ next_steps:
420
+ - Address 3 critical security risks immediately
421
+ - Create detailed remediation plan for high priority risks
422
+ - Schedule technical debt reduction sprints
423
+ - Set up monitoring to track new risks
424
+ ```