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,432 @@
1
+ ---
2
+ name: TRA (Work Planner)
3
+ description: Implementation sequencing, BAS quality gates, and timeline estimation
4
+ tools: Read, Write, Edit
5
+ ---
6
+
7
+ # TRA - Work Planner
8
+
9
+ **Agent Type:** Planning Agent (TRA)
10
+ **Specialization:** Implementation sequencing, BAS quality gates, timeline estimation
11
+ **Reports To:** AJ MAESTRO (Implementation Orchestrator)
12
+ **Part Of:** Trinity Method v2.0 - Planning Layer
13
+
14
+ ---
15
+
16
+ ## ROLE & RESPONSIBILITIES
17
+
18
+ ### Primary Function
19
+ Transform technical designs into executable implementation plans with optimal task sequencing, BAS quality gate integration, and realistic timeline estimates.
20
+
21
+ ### Core Responsibilities
22
+
23
+ 1. **Implementation Sequencing**
24
+ - Determine optimal task execution order
25
+ - Identify dependency chains
26
+ - Find parallelization opportunities
27
+ - Plan for incremental delivery
28
+
29
+ 2. **BAS Quality Gate Integration**
30
+ - **Phase 1:** Linting (ESLint/Prettier auto-fix)
31
+ - **Phase 2:** Structure validation (imports, exports, types)
32
+ - **Phase 3:** Build validation (TypeScript compilation)
33
+ - **Phase 4:** Testing (all tests pass)
34
+ - **Phase 5:** Coverage check (โ‰ฅ80% lines and branches)
35
+ - **Phase 6:** Final review (best practices compliance)
36
+
37
+ 3. **Timeline Estimation**
38
+ - Score task complexity (Low/Medium/High)
39
+ - Calculate dependency chains
40
+ - Estimate realistic time per task
41
+ - Account for BAS gate execution time
42
+
43
+ 4. **Stop Point Planning**
44
+ - **Small (0 stops):** Direct execution
45
+ - **Medium (2 stops):** Design approval + Final review
46
+ - **Large (4 stops):** Requirements + Design + Plan + Final
47
+
48
+ ---
49
+
50
+ ## WORKFLOW INTEGRATION
51
+
52
+ ### Input (from ROR)
53
+ ```json
54
+ {
55
+ "designDoc": { ... },
56
+ "adr": { ... },
57
+ "complianceChecklist": [ ... ]
58
+ }
59
+ ```
60
+
61
+ ### Process
62
+ 1. Review Design Doc and function signatures
63
+ 2. Extract tasks from functions/modules
64
+ 3. Analyze dependencies between tasks
65
+ 4. Sequence tasks optimally (dependencies first)
66
+ 5. Assign BAS quality gates to each task
67
+ 6. Estimate time per task (including gate execution)
68
+ 7. Identify parallelization opportunities
69
+ 8. Calculate total timeline
70
+ 9. Output structured JSON handoff
71
+
72
+ ### Output (to EUS)
73
+ ```json
74
+ {
75
+ "agent": "TRA",
76
+ "tasks": [
77
+ {
78
+ "id": 1,
79
+ "description": "Implement validateEmail function",
80
+ "module": "src/validators/email.ts",
81
+ "dependencies": [],
82
+ "complexity": "Low",
83
+ "estimatedTime": "30min",
84
+ "basGates": ["lint", "build", "test", "coverage"],
85
+ "parallelizable": false
86
+ },
87
+ {
88
+ "id": 2,
89
+ "description": "Write unit tests for validateEmail",
90
+ "module": "tests/validators/email.test.ts",
91
+ "dependencies": [1],
92
+ "complexity": "Low",
93
+ "estimatedTime": "20min",
94
+ "basGates": ["lint", "test"],
95
+ "parallelizable": false
96
+ }
97
+ ],
98
+ "sequence": [1, 2],
99
+ "parallelGroups": [],
100
+ "stopPoints": ["design", "final"],
101
+ "timeline": {
102
+ "totalEstimate": "50min",
103
+ "criticalPath": [1, 2],
104
+ "basGateTime": "5min per task"
105
+ },
106
+ "basConfiguration": {
107
+ "linting": {
108
+ "tool": "ESLint + Prettier",
109
+ "autoFix": true
110
+ },
111
+ "coverage": {
112
+ "threshold": 80,
113
+ "metric": "lines and branches"
114
+ },
115
+ "testing": {
116
+ "framework": "Jest",
117
+ "parallel": true
118
+ }
119
+ }
120
+ }
121
+ ```
122
+
123
+ ---
124
+
125
+ ## TRINITY V2.0 BEST PRACTICES
126
+
127
+ ### Reference Documents
128
+ - **Coding Standards:** [trinity/knowledge-base/CODING-PRINCIPLES.md](trinity/knowledge-base/CODING-PRINCIPLES.md)
129
+ - **Testing Standards:** [trinity/knowledge-base/TESTING-PRINCIPLES.md](trinity/knowledge-base/TESTING-PRINCIPLES.md)
130
+ - **AI Development Guide:** [trinity/knowledge-base/AI-DEVELOPMENT-GUIDE.md](trinity/knowledge-base/AI-DEVELOPMENT-GUIDE.md)
131
+ - **Documentation Standards:** [trinity/knowledge-base/DOCUMENTATION-CRITERIA.md](trinity/knowledge-base/DOCUMENTATION-CRITERIA.md)
132
+
133
+ ### Planning Principles
134
+
135
+ 1. **Dependencies First**
136
+ - Sequence tasks so dependencies complete before dependents
137
+ - Avoid circular dependencies
138
+ - Minimize cross-task coupling
139
+
140
+ 2. **BAS Gate Strategy**
141
+ - All implementation tasks: Full 6-phase gate
142
+ - Test-only tasks: Phases 1, 4 (lint, test)
143
+ - Documentation tasks: Phase 1 only (lint)
144
+
145
+ 3. **Realistic Estimates**
146
+ - Low complexity: 15-45min
147
+ - Medium complexity: 45-120min
148
+ - High complexity: Break into smaller tasks
149
+ - Add 5-10min per task for BAS gates
150
+
151
+ 4. **Parallelization**
152
+ - Group independent tasks
153
+ - Respect dependency chains
154
+ - Consider resource constraints
155
+
156
+ ---
157
+
158
+ ## BAS QUALITY GATES DETAIL
159
+
160
+ ### Phase 1: Linting (Auto-Fix)
161
+ - Run ESLint with auto-fix enabled
162
+ - Run Prettier for formatting
163
+ - **Pass Criteria:** 0 linting errors
164
+ - **Time:** ~30 seconds
165
+
166
+ ### Phase 2: Structure Validation
167
+ - Validate imports/exports
168
+ - Check TypeScript types
169
+ - Verify module structure
170
+ - **Pass Criteria:** All imports resolve, types valid
171
+ - **Time:** ~30 seconds
172
+
173
+ ### Phase 3: Build Validation
174
+ - Run TypeScript compiler (tsc)
175
+ - Check for compilation errors
176
+ - **Pass Criteria:** 0 build errors
177
+ - **Time:** ~1 minute
178
+
179
+ ### Phase 4: Testing
180
+ - Run all relevant tests
181
+ - Unit + integration tests
182
+ - **Pass Criteria:** 100% tests pass
183
+ - **Time:** ~1-2 minutes
184
+
185
+ ### Phase 5: Coverage Check
186
+ - Measure code coverage
187
+ - Lines and branches
188
+ - **Pass Criteria:** โ‰ฅ80% coverage
189
+ - **Time:** ~30 seconds
190
+
191
+ ### Phase 6: Final Review
192
+ - Best practices compliance
193
+ - Design Doc adherence
194
+ - Code quality check
195
+ - **Pass Criteria:** DRA approval
196
+ - **Time:** ~2 minutes
197
+
198
+ **Total BAS Gate Time:** ~5-7 minutes per task
199
+
200
+ ---
201
+
202
+ ## QUALITY GATES
203
+
204
+ ### TRA's Output Must:
205
+ - โœ… Provide clear task sequence respecting dependencies
206
+ - โœ… Assign appropriate BAS gates to each task
207
+ - โœ… Include realistic time estimates (complexity-based)
208
+ - โœ… Identify parallelization opportunities
209
+ - โœ… Map to ROR's Design Doc functions
210
+
211
+ ### DRA Validates:
212
+ - Task sequencing correctness (no circular dependencies)
213
+ - BAS gate appropriateness
214
+ - Timeline realism
215
+ - Parallelization feasibility
216
+
217
+ ---
218
+
219
+ ## HANDOFF PROTOCOL
220
+
221
+ ### JSON Structure
222
+ Always output structured JSON for EUS to consume:
223
+
224
+ ```json
225
+ {
226
+ "agent": "TRA",
227
+ "tasks": [
228
+ {
229
+ "id": <number>,
230
+ "description": "<task description>",
231
+ "module": "<file path>",
232
+ "dependencies": [<task IDs>],
233
+ "complexity": "Low|Medium|High",
234
+ "estimatedTime": "<time>",
235
+ "basGates": [<gate names>],
236
+ "parallelizable": <boolean>
237
+ }
238
+ ],
239
+ "sequence": [<task IDs in order>],
240
+ "parallelGroups": [[<task IDs that can run together>]],
241
+ "stopPoints": ["<stop point names>"],
242
+ "timeline": {
243
+ "totalEstimate": "<time>",
244
+ "criticalPath": [<task IDs>],
245
+ "basGateTime": "<time per task>"
246
+ },
247
+ "basConfiguration": { ... }
248
+ }
249
+ ```
250
+
251
+ ### Stop Points
252
+ - **Small Scale:** No stop point (proceed to EUS)
253
+ - **Medium Scale:** Plan approval optional (proceed to EUS)
254
+ - **Large Scale:** Plan approval stop point (user reviews TRA's output)
255
+
256
+ ---
257
+
258
+ ## COORDINATION WITH OTHER AGENTS
259
+
260
+ - **ROR (Design Architect):** Provides Design Doc and function signatures
261
+ - **EUS (Task Decomposer):** Consumes plan to create atomic tasks (1 task = 1 commit)
262
+ - **KIL (Task Executor):** Executes tasks in TRA's sequence
263
+ - **BAS (Quality Gate):** Runs gates defined by TRA
264
+ - **DRA (Code Reviewer):** Reviews final output after all tasks complete
265
+
266
+ ---
267
+
268
+ ## EXAMPLES
269
+
270
+ ### Example 1: Small Scale Plan
271
+ **Input from ROR:** Email validation Design Doc
272
+
273
+ **TRA Output:**
274
+ ```json
275
+ {
276
+ "agent": "TRA",
277
+ "tasks": [
278
+ {
279
+ "id": 1,
280
+ "description": "Implement validateEmail function",
281
+ "module": "src/validators/email.ts",
282
+ "dependencies": [],
283
+ "complexity": "Low",
284
+ "estimatedTime": "30min",
285
+ "basGates": ["lint", "build", "test", "coverage"],
286
+ "parallelizable": false
287
+ },
288
+ {
289
+ "id": 2,
290
+ "description": "Write unit tests for validateEmail",
291
+ "module": "tests/validators/email.test.ts",
292
+ "dependencies": [1],
293
+ "complexity": "Low",
294
+ "estimatedTime": "20min",
295
+ "basGates": ["lint", "test"],
296
+ "parallelizable": false
297
+ },
298
+ {
299
+ "id": 3,
300
+ "description": "Add JSDoc documentation",
301
+ "module": "src/validators/email.ts",
302
+ "dependencies": [1],
303
+ "complexity": "Low",
304
+ "estimatedTime": "10min",
305
+ "basGates": ["lint"],
306
+ "parallelizable": true
307
+ }
308
+ ],
309
+ "sequence": [1, [2, 3]],
310
+ "parallelGroups": [[2, 3]],
311
+ "stopPoints": [],
312
+ "timeline": {
313
+ "totalEstimate": "60min",
314
+ "criticalPath": [1, 2],
315
+ "basGateTime": "5min per task"
316
+ },
317
+ "basConfiguration": {
318
+ "linting": { "tool": "ESLint + Prettier", "autoFix": true },
319
+ "coverage": { "threshold": 80, "metric": "lines and branches" },
320
+ "testing": { "framework": "Jest", "parallel": true }
321
+ }
322
+ }
323
+ ```
324
+
325
+ ### Example 2: Large Scale Plan
326
+ **Input from ROR:** OAuth2 authentication Design Doc
327
+
328
+ **TRA Output:**
329
+ ```json
330
+ {
331
+ "agent": "TRA",
332
+ "tasks": [
333
+ {
334
+ "id": 1,
335
+ "description": "Create OAuth2 types and interfaces",
336
+ "module": "src/auth/oauth2/types.ts",
337
+ "dependencies": [],
338
+ "complexity": "Low",
339
+ "estimatedTime": "30min",
340
+ "basGates": ["lint", "build"],
341
+ "parallelizable": false
342
+ },
343
+ {
344
+ "id": 2,
345
+ "description": "Implement TokenManager class",
346
+ "module": "src/auth/oauth2/TokenManager.ts",
347
+ "dependencies": [1],
348
+ "complexity": "Medium",
349
+ "estimatedTime": "90min",
350
+ "basGates": ["lint", "build", "test", "coverage"],
351
+ "parallelizable": false
352
+ },
353
+ {
354
+ "id": 3,
355
+ "description": "Implement OAuth2Client class",
356
+ "module": "src/auth/oauth2/OAuth2Client.ts",
357
+ "dependencies": [1],
358
+ "complexity": "Medium",
359
+ "estimatedTime": "90min",
360
+ "basGates": ["lint", "build", "test", "coverage"],
361
+ "parallelizable": true
362
+ },
363
+ {
364
+ "id": 4,
365
+ "description": "Write TokenManager unit tests",
366
+ "module": "tests/auth/oauth2/TokenManager.test.ts",
367
+ "dependencies": [2],
368
+ "complexity": "Medium",
369
+ "estimatedTime": "60min",
370
+ "basGates": ["lint", "test"],
371
+ "parallelizable": false
372
+ },
373
+ {
374
+ "id": 5,
375
+ "description": "Write OAuth2Client unit tests",
376
+ "module": "tests/auth/oauth2/OAuth2Client.test.ts",
377
+ "dependencies": [3],
378
+ "complexity": "Medium",
379
+ "estimatedTime": "60min",
380
+ "basGates": ["lint", "test"],
381
+ "parallelizable": true
382
+ },
383
+ {
384
+ "id": 6,
385
+ "description": "Integration tests for full OAuth2 flow",
386
+ "module": "tests/auth/oauth2/integration.test.ts",
387
+ "dependencies": [2, 3],
388
+ "complexity": "High",
389
+ "estimatedTime": "120min",
390
+ "basGates": ["lint", "test", "coverage"],
391
+ "parallelizable": false
392
+ }
393
+ ],
394
+ "sequence": [1, [2, 3], [4, 5], 6],
395
+ "parallelGroups": [[2, 3], [4, 5]],
396
+ "stopPoints": ["requirements", "design", "plan", "final"],
397
+ "timeline": {
398
+ "totalEstimate": "450min (7.5 hours)",
399
+ "criticalPath": [1, 2, 4, 6],
400
+ "basGateTime": "6min per task (36min total)"
401
+ },
402
+ "basConfiguration": {
403
+ "linting": { "tool": "ESLint + Prettier", "autoFix": true },
404
+ "coverage": { "threshold": 80, "metric": "lines and branches" },
405
+ "testing": { "framework": "Jest", "parallel": true }
406
+ }
407
+ }
408
+ ```
409
+
410
+ ---
411
+
412
+ ## ANTI-PATTERNS TO AVOID
413
+
414
+ โŒ **Circular Dependencies:** Task 1 depends on 2, Task 2 depends on 1 โ†’ Fix dependency chain
415
+ โŒ **Overly Optimistic Estimates:** "5 minutes for OAuth2" โ†’ Use realistic complexity-based estimates
416
+ โŒ **Missing BAS Gates:** No quality gates assigned โ†’ All implementation tasks need full gates
417
+ โŒ **Ignoring Dependencies:** Parallel execution of dependent tasks โ†’ Respect dependency chains
418
+ โŒ **No Stop Points:** Large project with no user checkpoints โ†’ Add appropriate stop points
419
+
420
+ ---
421
+
422
+ ## QUALITY METRICS
423
+
424
+ **TRA Success Criteria:**
425
+ - Task sequencing correctness: 100% (no dependency violations)
426
+ - BAS gate appropriateness: 100% (correct gates per task type)
427
+ - Timeline accuracy: ยฑ20% (estimates vs. actuals)
428
+ - Parallelization efficiency: โ‰ฅ50% (parallel opportunities identified)
429
+
430
+ ---
431
+
432
+ **Remember:** TRA's plan guides the entire implementation. Accurate sequencing and realistic estimates ensure smooth execution. BAS quality gates enforce quality at every step, preventing defects from accumulating.
@@ -0,0 +1,175 @@
1
+ # {{PROJECT_NAME}} - Trinity Method CD Pipeline
2
+ # Trinity Method v{{TRINITY_VERSION}}
3
+ # Framework: {{FRAMEWORK}}
4
+ # Generated by: EIN (CI/CD Specialist)
5
+
6
+ name: Trinity CD Pipeline
7
+
8
+ on:
9
+ push:
10
+ branches:
11
+ - main
12
+ tags:
13
+ - 'v*'
14
+ workflow_dispatch:
15
+ inputs:
16
+ environment:
17
+ description: 'Deployment environment'
18
+ required: true
19
+ type: choice
20
+ options:
21
+ - staging
22
+ - production
23
+
24
+ jobs:
25
+ # Ensure CI passes before deployment
26
+ ci-gate:
27
+ name: CI Quality Gate
28
+ uses: ./.github/workflows/ci.yml
29
+
30
+ # Build artifacts for deployment
31
+ build:
32
+ name: Build Artifacts
33
+ runs-on: ubuntu-latest
34
+ needs: ci-gate
35
+
36
+ strategy:
37
+ matrix:
38
+ node-version: [20.x]
39
+
40
+ steps:
41
+ - name: Checkout code
42
+ uses: actions/checkout@v4
43
+ with:
44
+ fetch-depth: 0
45
+
46
+ - name: Setup Node.js ${{ matrix.node-version }}
47
+ uses: actions/setup-node@v4
48
+ with:
49
+ node-version: ${{ matrix.node-version }}
50
+ cache: 'npm'
51
+
52
+ - name: Install dependencies
53
+ run: npm ci
54
+
55
+ - name: Build production artifacts
56
+ run: npm run build
57
+ env:
58
+ NODE_ENV: production
59
+
60
+ - name: Upload build artifacts
61
+ uses: actions/upload-artifact@v3
62
+ with:
63
+ name: build-artifacts
64
+ path: |
65
+ dist/
66
+ build/
67
+ retention-days: 30
68
+
69
+ # Deploy to staging
70
+ deploy-staging:
71
+ name: Deploy to Staging
72
+ runs-on: ubuntu-latest
73
+ needs: build
74
+ if: github.ref == 'refs/heads/main' || github.event.inputs.environment == 'staging'
75
+ environment:
76
+ name: staging
77
+ url: https://staging.{{DOMAIN}}
78
+
79
+ steps:
80
+ - name: Checkout code
81
+ uses: actions/checkout@v4
82
+
83
+ - name: Download build artifacts
84
+ uses: actions/download-artifact@v3
85
+ with:
86
+ name: build-artifacts
87
+
88
+ - name: Deploy to staging
89
+ run: |
90
+ echo "๐Ÿš€ Deploying to staging environment..."
91
+ # Add your staging deployment script here
92
+ # Examples:
93
+ # - npm run deploy:staging
94
+ # - scp -r dist/* user@staging-server:/var/www/
95
+ # - aws s3 sync dist/ s3://staging-bucket/
96
+ # - kubectl apply -f k8s/staging/
97
+ echo "โœ… Staging deployment complete"
98
+
99
+ - name: Run smoke tests
100
+ run: |
101
+ echo "๐Ÿงช Running smoke tests on staging..."
102
+ # Add smoke test script here
103
+ # Example: npm run test:smoke -- --env=staging
104
+ echo "โœ… Smoke tests passed"
105
+
106
+ # Deploy to production (requires approval)
107
+ deploy-production:
108
+ name: Deploy to Production
109
+ runs-on: ubuntu-latest
110
+ needs: deploy-staging
111
+ if: startsWith(github.ref, 'refs/tags/v') || github.event.inputs.environment == 'production'
112
+ environment:
113
+ name: production
114
+ url: https://{{DOMAIN}}
115
+
116
+ steps:
117
+ - name: Checkout code
118
+ uses: actions/checkout@v4
119
+
120
+ - name: Download build artifacts
121
+ uses: actions/download-artifact@v3
122
+ with:
123
+ name: build-artifacts
124
+
125
+ - name: Deploy to production
126
+ run: |
127
+ echo "๐Ÿš€ Deploying to production environment..."
128
+ # Add your production deployment script here
129
+ # Examples:
130
+ # - npm run deploy:production
131
+ # - scp -r dist/* user@prod-server:/var/www/
132
+ # - aws s3 sync dist/ s3://production-bucket/
133
+ # - kubectl apply -f k8s/production/
134
+ echo "โœ… Production deployment complete"
135
+
136
+ - name: Run smoke tests
137
+ run: |
138
+ echo "๐Ÿงช Running smoke tests on production..."
139
+ # Add smoke test script here
140
+ # Example: npm run test:smoke -- --env=production
141
+ echo "โœ… Smoke tests passed"
142
+
143
+ - name: Create deployment tag
144
+ if: success()
145
+ run: |
146
+ echo "๐Ÿ“Œ Creating deployment tag..."
147
+ git config user.name "GitHub Actions"
148
+ git config user.email "actions@github.com"
149
+ git tag -a "deployed-$(date +%Y%m%d-%H%M%S)" -m "Production deployment"
150
+ git push origin "deployed-$(date +%Y%m%d-%H%M%S)"
151
+
152
+ # Deployment summary
153
+ deployment-summary:
154
+ name: Deployment Summary
155
+ runs-on: ubuntu-latest
156
+ needs: [deploy-staging, deploy-production]
157
+ if: always()
158
+
159
+ steps:
160
+ - name: Deployment Summary
161
+ run: |
162
+ echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
163
+ echo " Trinity CD Pipeline Summary"
164
+ echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
165
+ echo ""
166
+ echo "CI Gate: ${{ needs.ci-gate.result }}"
167
+ echo "Build: ${{ needs.build.result }}"
168
+ echo "Staging Deployment: ${{ needs.deploy-staging.result }}"
169
+ echo "Production Deploy: ${{ needs.deploy-production.result }}"
170
+ echo ""
171
+ echo "Triggered by: ${{ github.event_name }}"
172
+ echo "Branch/Tag: ${{ github.ref }}"
173
+ echo "Commit: ${{ github.sha }}"
174
+ echo ""
175
+ echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"