trinity-method-sdk 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.
Files changed (191) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/LICENSE +21 -0
  3. package/README.md +555 -0
  4. package/dist/cli/commands/deploy/agents.d.ts +14 -0
  5. package/dist/cli/commands/deploy/agents.js +59 -0
  6. package/dist/cli/commands/deploy/ci-cd.d.ts +13 -0
  7. package/dist/cli/commands/deploy/ci-cd.js +50 -0
  8. package/dist/cli/commands/deploy/claude-setup.d.ts +17 -0
  9. package/dist/cli/commands/deploy/claude-setup.js +91 -0
  10. package/dist/cli/commands/deploy/configuration.d.ts +13 -0
  11. package/dist/cli/commands/deploy/configuration.js +215 -0
  12. package/dist/cli/commands/deploy/directories.d.ts +12 -0
  13. package/dist/cli/commands/deploy/directories.js +38 -0
  14. package/dist/cli/commands/deploy/gitignore.d.ts +12 -0
  15. package/dist/cli/commands/deploy/gitignore.js +53 -0
  16. package/dist/cli/commands/deploy/index.d.ts +38 -0
  17. package/dist/cli/commands/deploy/index.js +156 -0
  18. package/dist/cli/commands/deploy/knowledge-base.d.ts +16 -0
  19. package/dist/cli/commands/deploy/knowledge-base.js +75 -0
  20. package/dist/cli/commands/deploy/linting.d.ts +18 -0
  21. package/dist/cli/commands/deploy/linting.js +51 -0
  22. package/dist/cli/commands/deploy/metrics.d.ts +13 -0
  23. package/dist/cli/commands/deploy/metrics.js +34 -0
  24. package/dist/cli/commands/deploy/pre-flight.d.ts +13 -0
  25. package/dist/cli/commands/deploy/pre-flight.js +29 -0
  26. package/dist/cli/commands/deploy/root-files.d.ts +16 -0
  27. package/dist/cli/commands/deploy/root-files.js +178 -0
  28. package/dist/cli/commands/deploy/sdk-install.d.ts +12 -0
  29. package/dist/cli/commands/deploy/sdk-install.js +57 -0
  30. package/dist/cli/commands/deploy/summary.d.ts +14 -0
  31. package/dist/cli/commands/deploy/summary.js +130 -0
  32. package/dist/cli/commands/deploy/templates.d.ts +14 -0
  33. package/dist/cli/commands/deploy/templates.js +84 -0
  34. package/dist/cli/commands/deploy/types.d.ts +39 -0
  35. package/dist/cli/commands/deploy/types.js +5 -0
  36. package/dist/cli/commands/update/agents.d.ts +14 -0
  37. package/dist/cli/commands/update/agents.js +31 -0
  38. package/dist/cli/commands/update/backup.d.ts +31 -0
  39. package/dist/cli/commands/update/backup.js +97 -0
  40. package/dist/cli/commands/update/commands.d.ts +14 -0
  41. package/dist/cli/commands/update/commands.js +75 -0
  42. package/dist/cli/commands/update/index.d.ts +15 -0
  43. package/dist/cli/commands/update/index.js +118 -0
  44. package/dist/cli/commands/update/knowledge-base.d.ts +14 -0
  45. package/dist/cli/commands/update/knowledge-base.js +38 -0
  46. package/dist/cli/commands/update/pre-flight.d.ts +13 -0
  47. package/dist/cli/commands/update/pre-flight.js +37 -0
  48. package/dist/cli/commands/update/summary.d.ts +20 -0
  49. package/dist/cli/commands/update/summary.js +47 -0
  50. package/dist/cli/commands/update/templates.d.ts +14 -0
  51. package/dist/cli/commands/update/templates.js +25 -0
  52. package/dist/cli/commands/update/types.d.ts +13 -0
  53. package/dist/cli/commands/update/types.js +7 -0
  54. package/dist/cli/commands/update/utils.d.ts +11 -0
  55. package/dist/cli/commands/update/utils.js +19 -0
  56. package/dist/cli/commands/update/verification.d.ts +20 -0
  57. package/dist/cli/commands/update/verification.js +54 -0
  58. package/dist/cli/commands/update/version.d.ts +18 -0
  59. package/dist/cli/commands/update/version.js +36 -0
  60. package/dist/cli/commands/update.d.ts +7 -0
  61. package/dist/cli/commands/update.js +7 -0
  62. package/dist/cli/index.d.ts +3 -0
  63. package/dist/cli/index.js +36 -0
  64. package/dist/cli/types.d.ts +77 -0
  65. package/dist/cli/types.js +5 -0
  66. package/dist/cli/utils/deploy-ci.d.ts +22 -0
  67. package/dist/cli/utils/deploy-ci.js +138 -0
  68. package/dist/cli/utils/deploy-linting.d.ts +3 -0
  69. package/dist/cli/utils/deploy-linting.js +136 -0
  70. package/dist/cli/utils/detect-stack.d.ts +3 -0
  71. package/dist/cli/utils/detect-stack.js +270 -0
  72. package/dist/cli/utils/error-classes.d.ts +63 -0
  73. package/dist/cli/utils/error-classes.js +84 -0
  74. package/dist/cli/utils/error-handler.d.ts +59 -0
  75. package/dist/cli/utils/error-handler.js +127 -0
  76. package/dist/cli/utils/errors.d.ts +52 -0
  77. package/dist/cli/utils/errors.js +102 -0
  78. package/dist/cli/utils/get-sdk-path.d.ts +18 -0
  79. package/dist/cli/utils/get-sdk-path.js +31 -0
  80. package/dist/cli/utils/inject-dependencies.d.ts +2 -0
  81. package/dist/cli/utils/inject-dependencies.js +55 -0
  82. package/dist/cli/utils/linting-tools.d.ts +8 -0
  83. package/dist/cli/utils/linting-tools.js +206 -0
  84. package/dist/cli/utils/metrics/code-quality.d.ts +32 -0
  85. package/dist/cli/utils/metrics/code-quality.js +122 -0
  86. package/dist/cli/utils/metrics/dependency-parser.d.ts +21 -0
  87. package/dist/cli/utils/metrics/dependency-parser.js +153 -0
  88. package/dist/cli/utils/metrics/file-complexity.d.ts +26 -0
  89. package/dist/cli/utils/metrics/file-complexity.js +77 -0
  90. package/dist/cli/utils/metrics/framework-detector.d.ts +17 -0
  91. package/dist/cli/utils/metrics/framework-detector.js +120 -0
  92. package/dist/cli/utils/metrics/git-metrics.d.ts +30 -0
  93. package/dist/cli/utils/metrics/git-metrics.js +83 -0
  94. package/dist/cli/utils/metrics/index.d.ts +28 -0
  95. package/dist/cli/utils/metrics/index.js +100 -0
  96. package/dist/cli/utils/template-processor.d.ts +10 -0
  97. package/dist/cli/utils/template-processor.js +188 -0
  98. package/dist/cli/utils/validate-path.d.ts +80 -0
  99. package/dist/cli/utils/validate-path.js +180 -0
  100. package/dist/index.d.ts +6 -0
  101. package/dist/index.js +8 -0
  102. package/dist/templates/agents/aj-team/apo-documentation-specialist.md.template +572 -0
  103. package/dist/templates/agents/aj-team/bas-quality-gate.md.template +906 -0
  104. package/dist/templates/agents/aj-team/bon-dependency-manager.md.template +636 -0
  105. package/dist/templates/agents/aj-team/cap-configuration-specialist.md.template +670 -0
  106. package/dist/templates/agents/aj-team/dra-code-reviewer.md.template +768 -0
  107. package/dist/templates/agents/aj-team/kil-task-executor.md.template +764 -0
  108. package/dist/templates/agents/aj-team/uro-refactoring-specialist.md.template +759 -0
  109. package/dist/templates/agents/audit/juno-auditor.md.template +447 -0
  110. package/dist/templates/agents/deployment/ein-cicd.md.template +694 -0
  111. package/dist/templates/agents/deployment/ino-context.md.template +733 -0
  112. package/dist/templates/agents/deployment/tan-structure.md.template +661 -0
  113. package/dist/templates/agents/deployment/zen-knowledge.md.template +451 -0
  114. package/dist/templates/agents/leadership/aj-cc.md.template +462 -0
  115. package/dist/templates/agents/leadership/aj-maestro.md.template +943 -0
  116. package/dist/templates/agents/leadership/aly-cto.md.template +407 -0
  117. package/dist/templates/agents/planning/eus-decomposer.md.template +496 -0
  118. package/dist/templates/agents/planning/mon-requirements.md.template +323 -0
  119. package/dist/templates/agents/planning/ror-design.md.template +465 -0
  120. package/dist/templates/agents/planning/tra-planner.md.template +432 -0
  121. package/dist/templates/ci/cd.yml.template +175 -0
  122. package/dist/templates/ci/ci.yml.template +196 -0
  123. package/dist/templates/ci/generic-ci.yml +115 -0
  124. package/dist/templates/ci/github-actions.yml +86 -0
  125. package/dist/templates/ci/gitlab-ci.yml +103 -0
  126. package/dist/templates/claude/EMPLOYEE-DIRECTORY.md.template +545 -0
  127. package/dist/templates/documentation/ROOT-README.md.template +307 -0
  128. package/dist/templates/documentation/SUBDIRECTORY-README.md.template +261 -0
  129. package/dist/templates/investigations/bug.md.template +484 -0
  130. package/dist/templates/investigations/feature.md.template +564 -0
  131. package/dist/templates/investigations/performance.md.template +625 -0
  132. package/dist/templates/investigations/security.md.template +714 -0
  133. package/dist/templates/investigations/technical.md.template +433 -0
  134. package/dist/templates/knowledge-base/AI-DEVELOPMENT-GUIDE.md.template +957 -0
  135. package/dist/templates/knowledge-base/ARCHITECTURE.md.template +452 -0
  136. package/dist/templates/knowledge-base/CODING-PRINCIPLES.md.template +750 -0
  137. package/dist/templates/knowledge-base/DOCUMENTATION-CRITERIA.md.template +1118 -0
  138. package/dist/templates/knowledge-base/ISSUES.md.template +539 -0
  139. package/dist/templates/knowledge-base/TESTING-PRINCIPLES.md.template +894 -0
  140. package/dist/templates/knowledge-base/Technical-Debt.md.template +640 -0
  141. package/dist/templates/knowledge-base/To-do.md.template +407 -0
  142. package/dist/templates/knowledge-base/Trinity.md.template +464 -0
  143. package/dist/templates/linting/flutter/.pre-commit-config.yaml.template +27 -0
  144. package/dist/templates/linting/flutter/analysis_options.yaml.template +26 -0
  145. package/dist/templates/linting/nodejs/.eslintrc-commonjs.json.template +19 -0
  146. package/dist/templates/linting/nodejs/.eslintrc-esm.json.template +19 -0
  147. package/dist/templates/linting/nodejs/.eslintrc-typescript.json.template +22 -0
  148. package/dist/templates/linting/nodejs/.pre-commit-config.yaml.template +51 -0
  149. package/dist/templates/linting/nodejs/.prettierrc.json.template +10 -0
  150. package/dist/templates/linting/python/.flake8.template +16 -0
  151. package/dist/templates/linting/python/.pre-commit-config.yaml.template +30 -0
  152. package/dist/templates/linting/python/pyproject.toml.template +38 -0
  153. package/dist/templates/linting/rust/.pre-commit-config.yaml.template +28 -0
  154. package/dist/templates/linting/rust/clippy.toml.template +14 -0
  155. package/dist/templates/linting/rust/rustfmt.toml.template +12 -0
  156. package/dist/templates/root/CLAUDE.md.template +65 -0
  157. package/dist/templates/root/TRINITY.md.template +52 -0
  158. package/dist/templates/shared/claude-commands/trinity-agents.md.template +168 -0
  159. package/dist/templates/shared/claude-commands/trinity-audit.md.template +646 -0
  160. package/dist/templates/shared/claude-commands/trinity-changelog.md.template +624 -0
  161. package/dist/templates/shared/claude-commands/trinity-continue.md.template +549 -0
  162. package/dist/templates/shared/claude-commands/trinity-create-investigation.md.template +232 -0
  163. package/dist/templates/shared/claude-commands/trinity-decompose.md.template +181 -0
  164. package/dist/templates/shared/claude-commands/trinity-design.md.template +347 -0
  165. package/dist/templates/shared/claude-commands/trinity-docs.md.template +2093 -0
  166. package/dist/templates/shared/claude-commands/trinity-end.md.template +397 -0
  167. package/dist/templates/shared/claude-commands/trinity-init.md.template +606 -0
  168. package/dist/templates/shared/claude-commands/trinity-investigate-templates.md.template +725 -0
  169. package/dist/templates/shared/claude-commands/trinity-orchestrate.md.template +1061 -0
  170. package/dist/templates/shared/claude-commands/trinity-plan-investigation.md.template +135 -0
  171. package/dist/templates/shared/claude-commands/trinity-plan.md.template +201 -0
  172. package/dist/templates/shared/claude-commands/trinity-readme.md.template +1971 -0
  173. package/dist/templates/shared/claude-commands/trinity-requirements.md.template +148 -0
  174. package/dist/templates/shared/claude-commands/trinity-start.md.template +268 -0
  175. package/dist/templates/shared/claude-commands/trinity-verify.md.template +453 -0
  176. package/dist/templates/shared/claude-commands/trinity-workorder.md.template +249 -0
  177. package/dist/templates/source/base-CLAUDE.md.template +310 -0
  178. package/dist/templates/source/flutter-CLAUDE.md.template +593 -0
  179. package/dist/templates/source/nodejs-CLAUDE.md.template +531 -0
  180. package/dist/templates/source/python-CLAUDE.md.template +510 -0
  181. package/dist/templates/source/react-CLAUDE.md.template +513 -0
  182. package/dist/templates/source/rust-CLAUDE.md.template +653 -0
  183. package/dist/templates/source/tests-CLAUDE.md.template +432 -0
  184. package/dist/templates/trinity/CLAUDE.md.template +372 -0
  185. package/dist/templates/work-orders/ANALYSIS-TEMPLATE.md.template +276 -0
  186. package/dist/templates/work-orders/AUDIT-TEMPLATE.md.template +262 -0
  187. package/dist/templates/work-orders/IMPLEMENTATION-TEMPLATE.md.template +260 -0
  188. package/dist/templates/work-orders/INVESTIGATION-TEMPLATE.md.template +206 -0
  189. package/dist/templates/work-orders/PATTERN-TEMPLATE.md.template +320 -0
  190. package/dist/templates/work-orders/VERIFICATION-TEMPLATE.md.template +273 -0
  191. package/package.json +94 -0
@@ -0,0 +1,640 @@
1
+ # Technical Debt Tracking - {{PROJECT_NAME}}
2
+ **Trinity Method v2.0**
3
+ **Technology Stack**: {{TECHNOLOGY_STACK}}
4
+ **Framework**: {{PRIMARY_FRAMEWORK}}
5
+ **Last Updated**: {{CURRENT_DATE}}
6
+
7
+ ---
8
+
9
+ ## 📊 DEBT METRICS DASHBOARD
10
+
11
+ ### Current Baseline Metrics
12
+ ```yaml
13
+ Technical_Debt_Metrics:
14
+ Code_Quality:
15
+ TODO_Comments: {{TODO_COUNT}}
16
+ FIXME_Comments: {{FIXME_COUNT}}
17
+ HACK_Comments: {{HACK_COUNT}}
18
+ Console_Statements: {{CONSOLE_COUNT}}
19
+ Commented_Code_Blocks: {{COMMENTED_BLOCKS}}
20
+
21
+ File_Complexity:
22
+ Files_Over_500_Lines: {{FILES_500}}
23
+ Files_Over_1000_Lines: {{FILES_1000}}
24
+ Files_Over_3000_Lines: {{FILES_3000}}
25
+ Average_File_Length: {{AVG_LENGTH}}
26
+
27
+ Test_Coverage:
28
+ Overall_Coverage: {{OVERALL_COVERAGE}}%
29
+ Unit_Test_Coverage: {{UNIT_COVERAGE}}%
30
+ Integration_Coverage: {{INTEGRATION_COVERAGE}}%
31
+ Untested_Components: {{UNTESTED_COUNT}}
32
+
33
+ {{FRAMEWORK}}_Specific:
34
+ Deprecated_APIs: {{DEPRECATED_COUNT}}
35
+ Anti_Patterns: {{ANTIPATTERN_COUNT}}
36
+ Performance_Issues: {{PERF_ISSUE_COUNT}}
37
+ Security_Warnings: {{SECURITY_COUNT}}
38
+ ```
39
+
40
+ ### Trend Analysis
41
+ ```yaml
42
+ Session_Comparison:
43
+ Previous_Session:
44
+ Date: {{PREV_DATE}}
45
+ Total_Debt_Score: {{PREV_SCORE}}
46
+ Critical_Items: {{PREV_CRITICAL}}
47
+
48
+ Current_Session:
49
+ Date: {{CURR_DATE}}
50
+ Total_Debt_Score: {{CURR_SCORE}}
51
+ Critical_Items: {{CURR_CRITICAL}}
52
+
53
+ Delta:
54
+ Score_Change: {{SCORE_DELTA}}
55
+ Trend: {{IMPROVING/DEGRADING/STABLE}}
56
+ Velocity: {{ITEMS_RESOLVED}}/session
57
+ ```
58
+
59
+ ---
60
+
61
+ ## 🔍 PATTERN LIBRARY
62
+
63
+ ### Recurring Technical Debt Patterns
64
+
65
+ #### Pattern: {{PATTERN_NAME_1}}
66
+ **Frequency**: Found in {{COUNT}} files
67
+ **Category**: {{CATEGORY}}
68
+ **Impact**: {{HIGH/MEDIUM/LOW}}
69
+ **Debt Score**: {{SCORE}}/10
70
+
71
+ **Files Affected**:
72
+ ```
73
+ {{FILE_1}}:{{LINE_NUMBERS}}
74
+ {{FILE_2}}:{{LINE_NUMBERS}}
75
+ {{FILE_3}}:{{LINE_NUMBERS}}
76
+ ```
77
+
78
+ **Pattern Description**:
79
+ {{PATTERN_DESCRIPTION}}
80
+
81
+ **Root Cause**:
82
+ {{ROOT_CAUSE}}
83
+
84
+ **Refactoring Template**:
85
+ ```{{LANGUAGE}}
86
+ // Current (problematic) pattern
87
+ {{CURRENT_CODE}}
88
+
89
+ // Refactored solution
90
+ {{REFACTORED_CODE}}
91
+ ```
92
+
93
+ **Impact Analysis**:
94
+ - **If Fixed**: Resolves {{COUNT}} issues across {{FILE_COUNT}} files
95
+ - **If Ignored**: Technical debt compounds by {{PERCENTAGE}}% per month
96
+ - **Effort Required**: {{HOURS}} hours
97
+ - **ROI**: {{HIGH/MEDIUM/LOW}}
98
+
99
+ ---
100
+
101
+ ## 📈 ROOT CAUSE ANALYSIS
102
+
103
+ ### High-Impact Root Causes
104
+
105
+ #### Root Cause: {{ROOT_CAUSE_1}}
106
+ **Impact Multiplier**: 1:{{MULTIPLIER}} (1 fix resolves {{MULTIPLIER}} symptoms)
107
+ **Debt Category**: {{CATEGORY}}
108
+ **Priority**: {{CRITICAL/HIGH/MEDIUM/LOW}}
109
+
110
+ **Affected Areas**:
111
+ 1. **{{COMPONENT_1}}**: {{ISSUE_COUNT}} issues
112
+ 2. **{{COMPONENT_2}}**: {{ISSUE_COUNT}} issues
113
+ 3. **{{COMPONENT_3}}**: {{ISSUE_COUNT}} issues
114
+
115
+ **Symptoms Caused**:
116
+ - {{SYMPTOM_1}}
117
+ - {{SYMPTOM_2}}
118
+ - {{SYMPTOM_3}}
119
+
120
+ **Resolution Strategy**:
121
+ ```yaml
122
+ Phase_1_Quick_Wins:
123
+ - {{QUICK_FIX_1}}
124
+ - {{QUICK_FIX_2}}
125
+ Time: {{HOURS}} hours
126
+
127
+ Phase_2_Refactoring:
128
+ - {{REFACTOR_1}}
129
+ - {{REFACTOR_2}}
130
+ Time: {{DAYS}} days
131
+
132
+ Phase_3_Prevention:
133
+ - {{PREVENTION_1}}
134
+ - {{PREVENTION_2}}
135
+ Time: Ongoing
136
+ ```
137
+
138
+ ---
139
+
140
+ ## 📝 TODO/FIXME/HACK INVENTORY
141
+
142
+ ### Critical (Security/Stability) - P0
143
+ ```yaml
144
+ - File: {{FILE_PATH}}
145
+ Line: {{LINE}}
146
+ Type: {{TODO/FIXME/HACK}}
147
+ Content: "{{COMMENT_TEXT}}"
148
+ Impact: {{IMPACT_DESCRIPTION}}
149
+ Risk: CRITICAL
150
+ Resolution: {{RESOLUTION_PLAN}}
151
+ ```
152
+
153
+ ### High Priority (Performance/Quality) - P1
154
+ [High priority technical debt items]
155
+
156
+ ### Medium Priority (Maintainability) - P2
157
+ [Medium priority improvements]
158
+
159
+ ### Low Priority (Nice to Have) - P3
160
+ [Low priority enhancements]
161
+
162
+ ---
163
+
164
+ ## 📏 COMPLEXITY ANALYSIS
165
+
166
+ ### Files Exceeding Complexity Thresholds
167
+
168
+ #### Critical - Files Over 3000 Lines
169
+ ```yaml
170
+ {{LARGE_FILE_1}}:
171
+ Lines: {{LINE_COUNT}}
172
+ Complexity_Score: {{COMPLEXITY}}
173
+ Components: {{COMPONENT_COUNT}}
174
+ Refactor_Strategy:
175
+ - Split into {{SUGGESTED_FILES}}
176
+ - Extract {{EXTRACTABLE_COMPONENTS}}
177
+ - Estimated_Effort: {{HOURS}} hours
178
+ ```
179
+
180
+ #### Warning - Files Over 1000 Lines
181
+ [Files that should be monitored and potentially refactored]
182
+
183
+ #### Watch - Files Over 500 Lines
184
+ [Files to watch for growing complexity]
185
+
186
+ ### Cyclomatic Complexity
187
+ | File | Function | Complexity | Risk Level |
188
+ |------|----------|------------|------------|
189
+ | {{FILE}} | {{FUNCTION}} | {{SCORE}} | {{RISK}} |
190
+
191
+ ---
192
+
193
+ ## 🧪 TEST COVERAGE GAPS
194
+
195
+ ### Components Without Tests
196
+ ```yaml
197
+ Critical_Untested:
198
+ {{COMPONENT_1}}:
199
+ Type: {{TYPE}}
200
+ Risk: CRITICAL
201
+ Functions: {{COUNT}}
202
+ Test_Effort: {{HOURS}} hours
203
+ Scope: COMPREHENSIVE
204
+ ```
205
+
206
+ ### Components With Insufficient Tests
207
+ ```yaml
208
+ {{COMPONENT_NAME}}:
209
+ Current_Coverage: {{PERCENTAGE}}%
210
+ Target_Coverage: {{TARGET}}%
211
+ Gap: {{GAP}}%
212
+ Critical_Paths_Untested: [{{PATH_LIST}}]
213
+ Missing_Test_Types: [unit/integration/e2e]
214
+ ```
215
+
216
+ ### Test Debt Score
217
+ ```javascript
218
+ const testDebtScore = {
219
+ untested_components: {{COUNT}},
220
+ insufficient_coverage: {{COUNT}},
221
+ missing_edge_cases: {{COUNT}},
222
+ no_integration_tests: {{COUNT}},
223
+ total_debt_score: {{SCORE}}/100
224
+ };
225
+ ```
226
+
227
+ ---
228
+
229
+ ## 🔒 SECURITY DEBT
230
+
231
+ ### Security Warnings and Suppressions
232
+ ```yaml
233
+ Security_Debt:
234
+ Suppressed_Warnings: {{COUNT}}
235
+ Vulnerable_Dependencies: {{COUNT}}
236
+ Unvalidated_Inputs: {{COUNT}}
237
+ Exposed_Secrets_Risk: {{COUNT}}
238
+ Missing_Security_Headers: {{COUNT}}
239
+ ```
240
+
241
+ ### Security Debt Items
242
+ ```yaml
243
+ - Type: {{SECURITY_ISSUE_TYPE}}
244
+ Location: {{FILE}}:{{LINE}}
245
+ Severity: {{CRITICAL/HIGH/MEDIUM/LOW}}
246
+ Description: {{DESCRIPTION}}
247
+ Fix: {{FIX_DESCRIPTION}}
248
+ Effort: {{HOURS}} hours
249
+ ```
250
+
251
+ ---
252
+
253
+ ## ⚡ PERFORMANCE DEBT
254
+
255
+ ### Performance Bottlenecks
256
+ ```yaml
257
+ {{BOTTLENECK_1}}:
258
+ Type: {{TYPE}}
259
+ Impact: {{MILLISECONDS}}ms delay
260
+ Frequency: {{CALLS_PER_MINUTE}}
261
+ Total_Impact: {{TOTAL_MS}}ms/min
262
+ Fix_Strategy: {{STRATEGY}}
263
+ Effort: {{HOURS}} hours
264
+ ```
265
+
266
+ ### Optimization Opportunities
267
+ 1. **{{OPTIMIZATION_1}}**: Save {{MS}}ms per operation
268
+ 2. **{{OPTIMIZATION_2}}**: Reduce memory by {{MB}}MB
269
+ 3. **{{OPTIMIZATION_3}}**: Decrease bundle by {{KB}}KB
270
+
271
+ ---
272
+
273
+ ## 🔄 DEBT REDUCTION PLAN
274
+
275
+ ### Sprint Planning - Next Session Priorities
276
+ ```yaml
277
+ Priority_1_Quick_Wins:
278
+ - Task: {{TASK}}
279
+ Impact: Fixes {{COUNT}} issues
280
+ Effort: {{HOURS}} hours
281
+ ROI: {{HIGH/MEDIUM/LOW}}
282
+ ```
283
+
284
+ ### Quarter Planning - Strategic Improvements
285
+ ```yaml
286
+ Q1_Goals:
287
+ - Reduce_TODO_Count: {{PERCENTAGE}}%
288
+ - Increase_Coverage: {{PERCENTAGE}}%
289
+ - Refactor_Large_Files: {{COUNT}} files
290
+ - Fix_Security_Issues: ALL critical
291
+ ```
292
+
293
+ ### Automation Opportunities
294
+ ```yaml
295
+ Automatable_Fixes:
296
+ - Pattern: {{PATTERN}}
297
+ Files_Affected: {{COUNT}}
298
+ Automation_Method: {{METHOD}}
299
+ Time_Saved: {{HOURS}} hours
300
+ ```
301
+
302
+ ---
303
+
304
+ ## 📋 SESSION DEBT TRACKING
305
+
306
+ ### Added This Session
307
+ ```yaml
308
+ New_Debt:
309
+ TODOs_Added: {{COUNT}}
310
+ FIXMEs_Added: {{COUNT}}
311
+ Coverage_Decreased: {{PERCENTAGE}}%
312
+ Files_Grew_Large: {{COUNT}}
313
+ New_Suppressions: {{COUNT}}
314
+ ```
315
+
316
+ ### Resolved This Session
317
+ ```yaml
318
+ Debt_Resolved:
319
+ TODOs_Fixed: {{COUNT}}
320
+ FIXMEs_Resolved: {{COUNT}}
321
+ Coverage_Increased: {{PERCENTAGE}}%
322
+ Files_Refactored: {{COUNT}}
323
+ Suppressions_Removed: {{COUNT}}
324
+ ```
325
+
326
+ ### Net Change
327
+ ```yaml
328
+ Session_Summary:
329
+ Overall_Debt_Score: {{IMPROVED/DEGRADED}} by {{POINTS}}
330
+ Trend: {{POSITIVE/NEGATIVE/NEUTRAL}}
331
+ Velocity: {{ITEMS_PER_SESSION}} items/session
332
+ Projected_Sessions_To_Target: {{COUNT}}
333
+ ```
334
+
335
+ ---
336
+
337
+ ## 🎯 SUCCESS METRICS & GOALS
338
+
339
+ ### Short-term Goals (Next 3 Sessions)
340
+ ```yaml
341
+ Immediate_Targets:
342
+ TODO_Reduction: <{{TARGET}} (from {{CURRENT}})
343
+ Test_Coverage: >{{TARGET}}% (from {{CURRENT}}%)
344
+ Large_Files: <{{TARGET}} (from {{CURRENT}})
345
+ Critical_Security: 0 (from {{CURRENT}})
346
+ ```
347
+
348
+ ### Long-term Goals (Next Quarter)
349
+ ```yaml
350
+ Strategic_Targets:
351
+ Overall_Debt_Score: <{{TARGET}}/100
352
+ Test_Coverage: >{{TARGET}}%
353
+ Code_Quality_Score: >{{TARGET}}/10
354
+ Performance_Score: >{{TARGET}}/10
355
+ Security_Score: {{TARGET}}/10
356
+ ```
357
+
358
+ ### Progress Tracking
359
+ ```javascript
360
+ const debtReductionVelocity = {
361
+ current_velocity: {{ITEMS_PER_SESSION}},
362
+ required_velocity: {{REQUIRED_ITEMS}},
363
+ acceleration_needed: {{PERCENTAGE}}%,
364
+ sessions_to_goal: {{COUNT}},
365
+ on_track: {{true/false}}
366
+ };
367
+ ```
368
+
369
+ ---
370
+
371
+ ## 📈 DEBT SCORING ALGORITHM
372
+
373
+ ### Debt Score Calculation
374
+ ```javascript
375
+ const calculateDebtScore = () => {
376
+ const weights = {
377
+ todos: 1,
378
+ fixmes: 2,
379
+ hacks: 3,
380
+ untested: 5,
381
+ large_files: 3,
382
+ security: 10,
383
+ performance: 4
384
+ };
385
+
386
+ return {
387
+ code_quality_score: {{SCORE}},
388
+ test_coverage_score: {{SCORE}},
389
+ security_score: {{SCORE}},
390
+ performance_score: {{SCORE}},
391
+ maintainability_score: {{SCORE}},
392
+ total_debt_score: {{TOTAL_SCORE}}
393
+ };
394
+ };
395
+ ```
396
+
397
+ ---
398
+
399
+ ## 🔗 RELATED DOCUMENTS
400
+
401
+ - **ISSUES.md**: Active issues and patterns
402
+ - **ARCHITECTURE.md**: System design decisions
403
+ - **Trinity.md**: Methodology implementation
404
+ - **To-do.md**: Actionable task list
405
+ - **Pattern Library**: trinity/patterns/
406
+
407
+ ---
408
+
409
+ ## 📝 WHEN TO UPDATE THIS DOCUMENT
410
+
411
+ This is a **living debt tracking system** that should be updated continuously to monitor and reduce technical debt.
412
+
413
+ ### Immediate Updates Required ⚠️
414
+
415
+ Update **during development** (real-time):
416
+
417
+ - ✅ **TODO/FIXME/HACK Added**: Increment debt counts immediately when adding code markers
418
+ - ✅ **TODO/FIXME Resolved**: Decrement counts when removing debt markers
419
+ - ✅ **Large File Created**: Update file complexity metrics when file >500 lines
420
+ - ✅ **File Refactored**: Update complexity metrics when splitting/refactoring files
421
+ - ✅ **Coverage Changes**: Update test coverage metrics after test additions/removals
422
+ - ✅ **Security Issue Found**: Add to Security Debt section immediately
423
+ - ✅ **Performance Bottleneck Identified**: Add to Performance Debt section
424
+ - ✅ **Pattern Discovered**: Add to Pattern Library when recurring debt pattern found
425
+
426
+ ### Session Updates (Via `/trinity-end`) 🔄
427
+
428
+ Update at end of each development session:
429
+
430
+ - Recalculate all metrics (TODO count, file complexity, coverage)
431
+ - Update Session Comparison (previous vs current metrics)
432
+ - Add new debt from session work
433
+ - Mark resolved debt from session work
434
+ - Update trend analysis (improving/degrading/stable)
435
+ - Calculate debt reduction velocity
436
+ - Update ROI analysis for debt items
437
+
438
+ ### Weekly Reviews ⏰
439
+
440
+ Track debt trends and prioritization:
441
+
442
+ - Review debt metrics trend (week-over-week)
443
+ - Identify highest-impact debt items (ROI analysis)
444
+ - Update debt reduction plan priorities
445
+ - Calculate velocity (debt items resolved per week)
446
+ - Update Quick Wins section (easy, high-value items)
447
+
448
+ ### Monthly Audits 📅
449
+
450
+ Deep debt analysis and strategic planning:
451
+
452
+ - Full debt score recalculation
453
+ - Pattern consolidation (merge similar debt patterns)
454
+ - Quarterly goals assessment
455
+ - Debt reduction strategy refinement
456
+ - Automation opportunity identification
457
+
458
+ ### Cross-Document Update Triggers 🔗
459
+
460
+ **When updating Technical-Debt.md, also check:**
461
+
462
+ - **[ISSUES.md](./ISSUES.md)**: Link debt items to issues if debt causes recurring problems
463
+ - **[To-do.md](./To-do.md)**: Create tasks to pay down critical/high-priority debt
464
+ - **[ARCHITECTURE.md](./ARCHITECTURE.md)**: Update if architectural debt revealed design problems
465
+ - **[CODING-PRINCIPLES.md](./CODING-PRINCIPLES.md)**: Add principle if debt pattern reveals standard violation
466
+ - **[TESTING-PRINCIPLES.md](./TESTING-PRINCIPLES.md)**: Update coverage targets if coverage debt significant
467
+
468
+ ### Update Scenarios - What to Change
469
+
470
+ **Scenario: Added TODO/FIXME Comment**
471
+ ```yaml
472
+ Updates_Required:
473
+ - TODO_FIXME_HACK_Inventory: Add new entry with file, line, description
474
+ - Debt_Metrics_Dashboard: Increment TODO_Comments count
475
+ - Priority_Assignment: Assign P0/P1/P2/P3 based on impact
476
+ - Session_Debt_Tracking: Add to "Added This Session" section
477
+ - Cross_References:
478
+ - To-do.md: Add task to resolve the TODO/FIXME
479
+ ```
480
+
481
+ **Scenario: Refactored Large File (>500 lines → <300 lines)**
482
+ ```yaml
483
+ Updates_Required:
484
+ - File_Complexity: Update file count metrics (Files_Over_500_Lines decrement)
485
+ - Complexity_Analysis: Update Average_File_Length
486
+ - Session_Debt_Tracking: Add to "Debt Resolved" section
487
+ - Trend_Analysis: Mark as IMPROVING
488
+ - Cross_References:
489
+ - ISSUES.md: Close related file complexity issues
490
+ - ARCHITECTURE.md: Update if component structure changed
491
+ ```
492
+
493
+ **Scenario: Test Coverage Improved (75% → 85%)**
494
+ ```yaml
495
+ Updates_Required:
496
+ - Test_Coverage: Update Overall_Coverage percentage
497
+ - Test_Coverage_Gaps: Remove components now covered
498
+ - Debt_Metrics_Dashboard: Update coverage metrics
499
+ - Session_Debt_Tracking: Document coverage increase
500
+ - Trend_Analysis: Mark Test_Coverage as IMPROVING
501
+ - Cross_References:
502
+ - TESTING-PRINCIPLES.md: Verify new coverage meets standards
503
+ ```
504
+
505
+ **Scenario: Pattern Discovered (Code Duplication in 5 files)**
506
+ ```yaml
507
+ Updates_Required:
508
+ - Pattern_Library: Create new pattern entry
509
+ - Root_Cause_Analysis: Document why duplication occurred
510
+ - Refactoring_Template: Provide solution for similar cases
511
+ - Impact_Analysis: Calculate ROI of fixing pattern
512
+ - Debt_Reduction_Plan: Add to Quick Wins or Strategic Improvements
513
+ - Cross_References:
514
+ - ISSUES.md: Link to duplication pattern if causes issues
515
+ - trinity/patterns/: Create pattern file
516
+ ```
517
+
518
+ **Scenario: Security Vulnerability Fixed**
519
+ ```yaml
520
+ Updates_Required:
521
+ - Security_Debt: Remove resolved vulnerability
522
+ - Debt_Metrics_Dashboard: Decrement Security_Warnings count
523
+ - Session_Debt_Tracking: Add to "Debt Resolved" section
524
+ - Prevention_Automation: Document how to prevent in future
525
+ - Cross_References:
526
+ - ISSUES.md: Close security issue
527
+ - CODING-PRINCIPLES.md: Add security principle if gap revealed
528
+ ```
529
+
530
+ **Scenario: Performance Bottleneck Resolved**
531
+ ```yaml
532
+ Updates_Required:
533
+ - Performance_Debt: Remove resolved bottleneck
534
+ - Optimization_Opportunities: Mark as completed
535
+ - Debt_Metrics_Dashboard: Update Performance_Issues count
536
+ - Impact_Analysis: Document performance improvement (ms saved)
537
+ - Cross_References:
538
+ - ARCHITECTURE.md: Update Performance Baselines
539
+ - ISSUES.md: Close performance issues
540
+ ```
541
+
542
+ ### How to Update
543
+
544
+ **Step-by-step process:**
545
+
546
+ 1. **Run Metrics**: Execute debt metric calculations (grep TODO, count files, run coverage)
547
+ 2. **Compare Baseline**: Compare new metrics to previous session metrics
548
+ 3. **Update Sections**: Update relevant sections (metrics, patterns, priorities)
549
+ 4. **Calculate Trends**: Determine if debt is improving/degrading/stable
550
+ 5. **Update Cross-Refs**: Link related debt items to issues/todos
551
+ 6. **Prioritize**: Update debt reduction plan based on new ROI analysis
552
+ 7. **Update Timestamp**: Set `Last Updated: {{CURRENT_DATE}}` to actual date
553
+
554
+ **Metric Calculation Commands** (for reference):
555
+ ```bash
556
+ # Count TODO comments
557
+ grep -r "TODO" src/ | wc -l
558
+
559
+ # Count FIXME comments
560
+ grep -r "FIXME" src/ | wc -l
561
+
562
+ # Files over 500 lines
563
+ find src/ -name "*.js" -exec wc -l {} \; | awk '$1 > 500' | wc -l
564
+
565
+ # Test coverage
566
+ npm run test:coverage -- --json | jq '.total.lines.pct'
567
+ ```
568
+
569
+ **Quality Checklist:**
570
+ - [ ] All metrics calculated with actual commands (not guessed)
571
+ - [ ] Trend direction accurate (improving/degrading/stable)
572
+ - [ ] ROI calculations realistic (effort vs impact)
573
+ - [ ] Patterns have refactoring templates (actionable)
574
+ - [ ] Cross-references to ISSUES/To-do updated
575
+ - [ ] Debt reduction plan prioritized by ROI
576
+
577
+ ### When NOT to Update ❌
578
+
579
+ **Don't update if:**
580
+ - Metrics haven't changed (no new TODOs, files, coverage changes)
581
+ - Only documentation updated (no code debt)
582
+ - Third-party library issues (not project debt)
583
+ - Debt is external dependency problem (out of team control)
584
+
585
+ **Stale metrics are okay** if debt genuinely hasn't changed. Don't recalculate just to update timestamp.
586
+
587
+ ### Debt vs. Issue vs. Todo 🤔
588
+
589
+ **Add to Technical-Debt.md when:**
590
+ - Code quality problem (TODOs, complexity, coverage)
591
+ - Known shortcut needing refactoring
592
+ - Accumulating burden (technical interest)
593
+ - Measurable metric (can track numerically)
594
+
595
+ **Add to ISSUES.md when:**
596
+ - Debt causes bugs or issues
597
+ - Debt pattern causes recurring problems
598
+ - Framework-specific debt pattern
599
+
600
+ **Add to To-do.md when:**
601
+ - Task to pay down specific debt item
602
+ - Refactoring work planned
603
+ - Debt resolution action item
604
+
605
+ **Debt often triggers todos** (debt identified → todo created to fix it).
606
+
607
+ ### Metrics Update Frequency 📊
608
+
609
+ **Real-time** (as code changes):
610
+ - TODO/FIXME/HACK counts
611
+ - File line counts
612
+
613
+ **Per Session** (via `/trinity-end`):
614
+ - Test coverage percentages
615
+ - Debt score calculations
616
+ - Trend analysis
617
+
618
+ **Weekly**:
619
+ - Velocity calculations
620
+ - ROI analysis
621
+ - Priority reassessment
622
+
623
+ **Monthly**:
624
+ - Full debt audit
625
+ - Pattern consolidation
626
+ - Strategic planning
627
+
628
+ ---
629
+
630
+ **Document Status**: Living Debt Tracking System
631
+ **Update Frequency**: Real-time (code changes) + session-based
632
+ **Maintained By**: Development team using Trinity Method
633
+ **Referenced By**: `/trinity-end` command for session updates
634
+ **Metrics**: Automated via grep/find/coverage commands
635
+ **Last Updated**: {{CURRENT_DATE}}
636
+
637
+ ---
638
+
639
+ *Technical Debt tracking powered by Trinity Method v2.0*
640
+ *Continuous monitoring and reduction system*