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,606 @@
1
+ ---
2
+ description: Complete Trinity integration with TAN → ZEN → INO → EIN → JUNO workflow
3
+ ---
4
+ # Quick Start - TL;DR
5
+
6
+ **Install Trinity in 3 steps**:
7
+
8
+ 1. **Run Init**: `/trinity-init`
9
+ 2. **Wait**: ~30 seconds (deploys 19 agents + knowledge base)
10
+ 3. **Verify**: `/trinity-verify` (confirm 100% deployment)
11
+
12
+ **What You Get**:
13
+ - 19 specialized agents in `.claude/agents/`
14
+ - 20 slash commands in `.claude/commands/` (6 categories)
15
+ - Knowledge base in `trinity/knowledge-base/`
16
+ - Work order system in `trinity/work-orders/`
17
+ - Documentation templates in `trinity/templates/documentation/`
18
+
19
+ **Next Steps**: Run `/trinity-start` to begin your first workflow
20
+
21
+ ---
22
+
23
+ # Trinity Initialization
24
+
25
+ **Purpose:** Complete Trinity Method integration with comprehensive setup and quality validation.
26
+
27
+ ## Overview
28
+
29
+ Trinity initialization populates the Trinity Method infrastructure with:
30
+ - 📁 **Structure Verification:** TAN validates Trinity directory structure
31
+ - 📚 **Knowledge Base Population:** ZEN creates comprehensive documentation
32
+ - 🧠 **Context Hierarchy:** INO establishes CLAUDE.md and ISSUES.md databases
33
+ - ⚙️ **CI/CD Review:** EIN reviews and customizes deployed CI/CD workflows (if present)
34
+ - ✅ **Quality Audit:** JUNO performs comprehensive compliance audit
35
+
36
+ **Context:** User has run `trinity deploy` and basic Trinity structure exists. Deployment team will now populate and verify all Trinity documents.
37
+
38
+ **IMPORTANT:** All folders and basic files already exist from deployment. DO NOT attempt to create folders that already exist (trinity/, .claude/, etc.). Focus on POPULATING and VERIFYING content.
39
+
40
+ ## Trinity Method Capabilities
41
+
42
+ ### Investigation Templates
43
+ 5 comprehensive templates for guided investigations:
44
+ - **Bug** - Reproduction, debugging, Five Whys, testing
45
+ - **Performance** - Profiling, optimization, benchmarks
46
+ - **Security** - CVSS scoring, PoC, remediation
47
+ - **Technical** - Architecture decisions, ADRs
48
+ - **Feature** - User stories, acceptance criteria, epic breakdown
49
+
50
+ **Explore:** `/trinity-investigate-templates`
51
+
52
+ **Benefits:**
53
+ - Consistent investigation quality
54
+ - Comprehensive documentation
55
+ - Knowledge preservation
56
+ - Integration with orchestration
57
+
58
+ ## Intelligent CLAUDE.md Placement
59
+
60
+ Trinity requires CLAUDE.md files for context, but intelligently adapts to your repository structure rather than forcing a rigid setup.
61
+
62
+ ### Standard 3-File Setup
63
+
64
+ Trinity creates 3 CLAUDE.md files minimum:
65
+
66
+ 1. **Root CLAUDE.md** (required) - Project-level context and overview
67
+ 2. **Tests CLAUDE.md** (required) - Testing standards, patterns, and conventions
68
+ 3. **Source CLAUDE.md** (adaptive) - Source code context and architecture
69
+
70
+ ### Adaptive Source Placement
71
+
72
+ Trinity automatically detects your source directory and places CLAUDE.md appropriately:
73
+
74
+ **Common Source Directory Patterns:**
75
+ - `src/` - Most common (Node.js, TypeScript, React, Vue, Angular)
76
+ - `lib/` - Library projects (npm packages, Ruby gems)
77
+ - `app/` - Rails, Laravel, Django, some web frameworks
78
+ - `source/` - Some documentation projects, Sphinx docs
79
+ - `code/` - Legacy projects or specific naming conventions
80
+ - Root level - Small projects without dedicated source folder
81
+
82
+ **Detection Logic:**
83
+ 1. Check for `src/` directory → Place CLAUDE.md in `src/`
84
+ 2. If not found, check for `lib/` → Place CLAUDE.md in `lib/`
85
+ 3. If not found, check for `app/` → Place CLAUDE.md in `app/`
86
+ 4. If none found → Place `SOURCE.CLAUDE.md` in root directory
87
+
88
+ ### Multi-Directory Repositories
89
+
90
+ For complex repositories with multiple distinct source directories, Trinity detects and creates additional CLAUDE.md files automatically:
91
+
92
+ #### Pattern 1: Frontend + Backend
93
+
94
+ **Detection Triggers:**
95
+ - Directories named: `frontend/`, `backend/`, `client/`, `server/`
96
+ - Multiple `package.json` files in separate directories
97
+ - Framework markers: React/Vue/Angular + Express/NestJS/Fastify
98
+
99
+ **Result:**
100
+ ```
101
+ project/
102
+ ├── CLAUDE.md # Root context (project overview)
103
+ ├── frontend/
104
+ │ ├── CLAUDE.md # Frontend-specific context
105
+ │ └── src/...
106
+ ├── backend/
107
+ │ ├── CLAUDE.md # Backend-specific context
108
+ │ └── src/...
109
+ └── tests/
110
+ └── CLAUDE.md # Testing context
111
+ ```
112
+
113
+ **Frontend CLAUDE.md should include:**
114
+ - UI component architecture (component tree, state flow)
115
+ - State management patterns (Redux, Zustand, Context API)
116
+ - Routing structure and navigation
117
+ - API integration approach and data fetching
118
+ - Styling conventions (CSS-in-JS, Tailwind, modules)
119
+
120
+ **Backend CLAUDE.md should include:**
121
+ - API design and endpoint structure
122
+ - Database schema and migrations approach
123
+ - Authentication/authorization patterns
124
+ - Business logic organization
125
+ - External service integrations
126
+
127
+ #### Pattern 2: Monorepo
128
+
129
+ **Detection Triggers:**
130
+ - Presence of `packages/`, `apps/`, or `services/` directory
131
+ - Multiple `package.json` files across subdirectories
132
+ - Monorepo tool markers: `lerna.json`, `nx.json`, `turbo.json`, `pnpm-workspace.yaml`
133
+
134
+ **Result:**
135
+ ```
136
+ monorepo/
137
+ ├── CLAUDE.md # Monorepo root context
138
+ ├── packages/
139
+ │ ├── api/
140
+ │ │ ├── CLAUDE.md # API package context
141
+ │ │ └── src/...
142
+ │ ├── web/
143
+ │ │ ├── CLAUDE.md # Web app context
144
+ │ │ └── src/...
145
+ │ └── mobile/
146
+ │ ├── CLAUDE.md # Mobile app context
147
+ │ └── src/...
148
+ └── tests/
149
+ └── CLAUDE.md # Shared tests context
150
+ ```
151
+
152
+ **Each package CLAUDE.md should include:**
153
+ - Package purpose and responsibilities
154
+ - Internal dependencies (other packages)
155
+ - External dependencies (npm packages)
156
+ - Package-specific conventions
157
+ - Build and test scripts
158
+
159
+ #### Pattern 3: Microservices Architecture
160
+
161
+ **Detection Triggers:**
162
+ - Multiple service directories with independent codebases
163
+ - `docker-compose.yml` file with multiple services
164
+ - Kubernetes manifests with multiple deployments
165
+ - Service directories: `*-service/`, `services/*/`
166
+
167
+ **Result:**
168
+ ```
169
+ services/
170
+ ├── CLAUDE.md # Services root context
171
+ ├── auth-service/
172
+ │ ├── CLAUDE.md # Auth microservice context
173
+ │ └── src/...
174
+ ├── payment-service/
175
+ │ ├── CLAUDE.md # Payment microservice context
176
+ │ └── src/...
177
+ └── user-service/
178
+ ├── CLAUDE.md # User microservice context
179
+ └── src/...
180
+ ```
181
+
182
+ **Each service CLAUDE.md should include:**
183
+ - Service boundaries and responsibilities
184
+ - Inter-service communication (gRPC, REST, message queue)
185
+ - Service-specific data stores
186
+ - Deployment configuration
187
+ - Health checks and monitoring
188
+
189
+ #### Pattern 4: Mobile + Web Application
190
+
191
+ **Detection Triggers:**
192
+ - `ios/`, `android/` directories
193
+ - React Native, Flutter, or native mobile project markers
194
+ - Paired with web application directory
195
+
196
+ **Result:**
197
+ ```
198
+ app/
199
+ ├── CLAUDE.md # Application root
200
+ ├── web/
201
+ │ ├── CLAUDE.md # Web app context
202
+ │ └── src/...
203
+ ├── ios/
204
+ │ ├── CLAUDE.md # iOS-specific context
205
+ │ └── ...
206
+ └── android/
207
+ ├── CLAUDE.md # Android-specific context
208
+ └── ...
209
+ ```
210
+
211
+ **Platform CLAUDE.md files should include:**
212
+ - Platform-specific conventions
213
+ - Native module integration
214
+ - Platform navigation patterns
215
+ - Build and deployment processes
216
+
217
+ #### Pattern 5: Documentation Projects
218
+
219
+ **Detection Triggers:**
220
+ - `docs/`, `documentation/`, `sphinx/` directories
221
+ - Documentation framework files: `conf.py`, `mkdocs.yml`, `_config.yml`
222
+
223
+ **Result:**
224
+ ```
225
+ project/
226
+ ├── CLAUDE.md # Project root
227
+ ├── docs/
228
+ │ ├── CLAUDE.md # Documentation context
229
+ │ └── ...
230
+ └── src/
231
+ ├── CLAUDE.md # Source context
232
+ └── ...
233
+ ```
234
+
235
+ ### Detection Rules Summary
236
+
237
+ Trinity creates additional CLAUDE.md files when it detects:
238
+
239
+ **1. Frontend + Backend Split:**
240
+ - **Triggers:** `frontend/`, `backend/`, `client/`, `server/` directories
241
+ - **Files:** Multiple `package.json` in subdirectories
242
+ - **Frameworks:** React/Vue/Angular + Express/NestJS markers
243
+ - **Result:** 2 additional CLAUDE.md files (frontend + backend)
244
+
245
+ **2. Monorepo Structure:**
246
+ - **Triggers:** `packages/`, `apps/`, `services/` directories
247
+ - **Files:** Multiple `package.json` files
248
+ - **Config:** `lerna.json`, `nx.json`, `turbo.json`, `pnpm-workspace.yaml`
249
+ - **Result:** 1 CLAUDE.md per package/app
250
+
251
+ **3. Microservices Architecture:**
252
+ - **Triggers:** Multiple `*-service/` or `services/*/` directories
253
+ - **Files:** `docker-compose.yml` with multiple services
254
+ - **Config:** Kubernetes manifests for multiple deployments
255
+ - **Result:** 1 CLAUDE.md per service
256
+
257
+ **4. Mobile + Web Application:**
258
+ - **Triggers:** `ios/`, `android/` directories + web directory
259
+ - **Files:** `package.json`, `build.gradle`, `Podfile`
260
+ - **Frameworks:** React Native, Flutter markers
261
+ - **Result:** 1 CLAUDE.md per platform (3 total: web, ios, android)
262
+
263
+ **5. Documentation Projects:**
264
+ - **Triggers:** `docs/`, `documentation/`, `sphinx/` directories
265
+ - **Files:** `conf.py`, `mkdocs.yml`, `_config.yml`
266
+ - **Result:** 1 CLAUDE.md in docs directory
267
+
268
+ ### Configuration Override
269
+
270
+ You can manually specify CLAUDE.md locations in `trinity/config.json`:
271
+
272
+ ```json
273
+ {
274
+ "claudeFiles": {
275
+ "auto": true,
276
+ "locations": [
277
+ "CLAUDE.md",
278
+ "src/CLAUDE.md",
279
+ "tests/CLAUDE.md",
280
+ "frontend/CLAUDE.md",
281
+ "backend/CLAUDE.md",
282
+ "docs/CLAUDE.md"
283
+ ],
284
+ "detection": {
285
+ "enableFrontendBackend": true,
286
+ "enableMonorepo": true,
287
+ "enableMicroservices": true,
288
+ "enableMobile": true,
289
+ "customPatterns": [
290
+ "custom-dir/CLAUDE.md"
291
+ ]
292
+ }
293
+ }
294
+ }
295
+ ```
296
+
297
+ **Configuration Options:**
298
+ - `auto`: Enable/disable automatic detection (default: `true`)
299
+ - `locations`: Explicit CLAUDE.md locations (overrides detection when `auto: false`)
300
+ - `detection.enable*`: Toggle specific detection patterns
301
+ - `customPatterns`: Additional directories to include
302
+
303
+ **When to use manual configuration:**
304
+ - Non-standard repository structure
305
+ - Custom directory naming that doesn't match patterns
306
+ - Specific CLAUDE.md placement requirements
307
+ - Disabling automatic detection for control
308
+
309
+ ### Verification
310
+
311
+ After `trinity init`, verify CLAUDE.md placement:
312
+
313
+ ```bash
314
+ trinity verify
315
+ ```
316
+
317
+ **Verification shows:**
318
+ - **Detected Structure:** Repository type (standard, frontend+backend, monorepo, etc.)
319
+ - **CLAUDE.md Locations:** All detected CLAUDE.md files
320
+ - **Coverage Analysis:** Percentage of codebase covered by nearest CLAUDE.md
321
+ - **Suggestions:** Recommendations for additional CLAUDE.md files
322
+ - **Validation:** Confirms all required CLAUDE.md files present
323
+
324
+ **Example output:**
325
+ ```
326
+ ✅ Trinity Verification Report
327
+
328
+ Repository Structure: Frontend + Backend
329
+ CLAUDE.md Files: 4 detected
330
+ ✓ CLAUDE.md (root)
331
+ ✓ frontend/CLAUDE.md
332
+ ✓ backend/CLAUDE.md
333
+ ✓ tests/CLAUDE.md
334
+
335
+ Coverage Analysis:
336
+ Frontend: 98% (242/247 files within 2 directory levels)
337
+ Backend: 100% (189/189 files within 2 directory levels)
338
+ Tests: 100% (67/67 files within 2 directory levels)
339
+ Overall: 99% (498/503 files)
340
+
341
+ Suggestions:
342
+ • Consider adding CLAUDE.md to docs/ directory (15 files, 2% uncovered)
343
+
344
+ ✨ Verification complete!
345
+ ```
346
+
347
+ ### Why Adaptive Placement Matters
348
+
349
+ **Context Density:**
350
+ - **Without adaptive placement:** Single massive root CLAUDE.md (1000+ lines, hard to maintain)
351
+ - **With adaptive placement:** Distributed context across directories (100-200 lines each, focused and relevant)
352
+ - **Agent efficiency:** Agents read nearest CLAUDE.md first for focused context
353
+
354
+ **Maintainability:**
355
+ - Team members update only relevant CLAUDE.md files
356
+ - Reduces context drift and outdated information
357
+ - Clear ownership per directory/subsystem
358
+
359
+ **Scalability:**
360
+ - Monorepos can have 50+ packages
361
+ - One CLAUDE.md per package = manageable
362
+ - Single root CLAUDE.md = unmaintainable at scale
363
+
364
+ **Example:** Frontend changes don't need backend context. Adaptive placement ensures agents get only relevant context.
365
+
366
+ ## Initialization Process
367
+
368
+ ### Phase 1: TAN (Structure Specialist) - Verify Trinity structure
369
+ - Check that all folders exist (they should from deploy)
370
+ - Verify folder permissions
371
+ - Report any structural issues (don't create folders - they already exist)
372
+
373
+ ### Phase 2: ZEN (Knowledge Base Specialist) - Populate Trinity documentation
374
+ - Analyze existing codebase
375
+ - POPULATE trinity/knowledge-base/ARCHITECTURE.md with detailed architecture analysis
376
+ - POPULATE trinity/knowledge-base/ISSUES.md with discovered issues
377
+ - POPULATE trinity/knowledge-base/To-do.md with identified tasks
378
+ - POPULATE trinity/knowledge-base/Technical-Debt.md with technical debt assessment
379
+ - Update existing Trinity.md if needed
380
+
381
+ ### Phase 3: INO (Context Specialist) - Establish context hierarchy
382
+ - Analyze codebase context and complexity
383
+ - UPDATE existing CLAUDE.md files with project-specific instructions
384
+ - POPULATE trinity/knowledge-base/ISSUES.md database structure
385
+ - Verify CLAUDE.md hierarchy is complete
386
+
387
+ ### Phase 4: JUNO (Quality Auditor) - Perform comprehensive audit
388
+ - Verify all folders exist and are writable
389
+ - Verify all documentation files are populated (not empty)
390
+ - Validate CLAUDE.md hierarchy completeness
391
+ - Check that knowledge base documents have real content
392
+ - Generate audit report in trinity/reports/
393
+ - Report findings to user with compliance score
394
+
395
+ ### Phase 5: EIN (CI/CD Specialist) - Review CI/CD and Pre-commit Configuration
396
+
397
+ **MANDATORY STEP:** Check for CI/CD files and invoke EIN if present.
398
+
399
+ **File Detection (Use Bash tool to check):**
400
+
401
+ 1. **Check for GitHub Actions workflows:**
402
+ ```bash
403
+ ls .github/workflows/ci.yml 2>/dev/null && echo "CI FOUND" || echo "CI NOT_FOUND"
404
+ ls .github/workflows/cd.yml 2>/dev/null && echo "CD FOUND" || echo "CD NOT_FOUND"
405
+ ```
406
+
407
+ 2. **Check for pre-commit configuration:**
408
+ ```bash
409
+ ls .pre-commit-config.yaml 2>/dev/null && echo "FOUND" || echo "NOT_FOUND"
410
+ ```
411
+
412
+ **Decision Tree:**
413
+
414
+ - **IF any CI/CD files exist (ci.yml, cd.yml, OR pre-commit config):**
415
+ - ✅ **Invoke EIN** - Adopt EIN (CI/CD Specialist) persona
416
+ - Continue with "EIN's Responsibilities" below
417
+ - Include EIN's work in JUNO's audit report
418
+
419
+ - **IF no CI/CD files exist:**
420
+ - ⏭️ **Skip EIN phase** - No CI/CD templates to review
421
+ - Add to JUNO report: "EIN Phase: Skipped (no CI/CD templates deployed)"
422
+ - Inform user they can set up CI/CD later with `/trinity-cicd`
423
+ - Continue to "Post-Init Next Steps"
424
+
425
+ **EIN's Responsibilities (Review & Customize Deployed Templates):**
426
+
427
+ **IMPORTANT:** Templates were already deployed by `trinity deploy`. EIN's job is to:
428
+ 1. **Review** the deployed files
429
+ 2. **Customize** them for the detected framework/runtime
430
+ 3. **Validate** configuration is correct
431
+ 4. **Provide** activation instructions
432
+
433
+ **1. GitHub Actions CI Workflow** (if `.github/workflows/ci.yml` exists):
434
+ - **Read** the deployed ci.yml file
435
+ - **Verify** all 6 BAS quality gate phases are present:
436
+ - Phase 1: Linting with auto-fix
437
+ - Phase 2: Structure validation
438
+ - Phase 3: Build validation
439
+ - Phase 4: Testing (all tests pass)
440
+ - Phase 5: Coverage check (≥80%)
441
+ - Phase 6: Best practices validation
442
+ - **Customize** for detected runtime (Node.js, Flutter, Python, etc.)
443
+ - **Validate** triggers are correct (push to main/dev, pull requests)
444
+ - **Confirm** coverage threshold enforcement is configured
445
+
446
+ **2. GitHub Actions CD Workflow** (if `.github/workflows/cd.yml` exists):
447
+ - **Read** the deployed cd.yml file
448
+ - **Verify** deployment stages (CI gate → build → staging → production)
449
+ - **Validate** CI workflow is called as prerequisite
450
+ - **Customize** deployment commands for project type
451
+ - **Confirm** environment protection is documented
452
+ - **Validate** artifact management (upload/download between jobs)
453
+
454
+ **3. Pre-commit Hooks** (if `.pre-commit-config.yaml` exists):
455
+ - **Read** the deployed .pre-commit-config.yaml file
456
+ - **Verify** all hooks are configured:
457
+ - Standard hooks (trailing whitespace, YAML/JSON validation, etc.)
458
+ - ESLint with auto-fix
459
+ - TypeScript type checking (if applicable)
460
+ - Jest for changed files
461
+ - **Customize** for project framework (remove TypeScript hooks if not TypeScript project)
462
+ - **Provide** installation instructions
463
+
464
+ **EIN Output Format:**
465
+
466
+ After reviewing and customizing CI/CD files, EIN should report:
467
+
468
+ ```
469
+ ### Phase 5: EIN (CI/CD Specialist) - CI/CD Configuration ✅
470
+
471
+ **Files Reviewed & Customized:**
472
+ - .github/workflows/ci.yml ✅
473
+ - Status: Ready (customized for {{FRAMEWORK}})
474
+ - BAS 6-phase quality gates configured
475
+ - Runtime: {{DETECTED_RUNTIME}}
476
+ - Coverage: ≥80% enforced
477
+
478
+ - .github/workflows/cd.yml ✅
479
+ - Status: Ready (deployment commands customized)
480
+ - Staging: Auto-deploy on main branch
481
+ - Production: Deploy via version tags (v*)
482
+ - Environments: Require setup (see instructions below)
483
+
484
+ - .pre-commit-config.yaml ✅ (if deployed)
485
+ - Status: Ready (customized for {{FRAMEWORK}})
486
+ - Hooks: Linting, type checking, tests
487
+ - Activation: Requires local install (see instructions below)
488
+
489
+ **Customizations Applied:**
490
+ - ✅ Detected framework: {{FRAMEWORK}}
491
+ - ✅ Configured runtime: {{DETECTED_RUNTIME}}
492
+ - ✅ Adjusted build commands for framework
493
+ - ✅ Configured test commands
494
+ - ✅ Set coverage threshold to 80%
495
+
496
+ **Activation Instructions:**
497
+
498
+ 📋 **Step 1: Activate GitHub Actions Workflows**
499
+ ```bash
500
+ # Workflows are already in place, just commit and push
501
+ git add .github/workflows/ci.yml .github/workflows/cd.yml
502
+ git commit -m "Activate Trinity CI/CD pipelines"
503
+ git push
504
+ ```
505
+
506
+ 📋 **Step 2: Set Up GitHub Environments** (Required for CD)
507
+ 1. Go to: Repository Settings → Environments
508
+ 2. Create "staging" environment:
509
+ - No protection rules needed
510
+ 3. Create "production" environment:
511
+ - ✅ Enable "Required reviewers" (add team members)
512
+ - ⏱️ Optional: "Wait timer" (e.g., 5 minutes before deploy)
513
+
514
+ 📋 **Step 3: Activate Pre-commit Hooks** (Optional but Recommended)
515
+ ```bash
516
+ # Install pre-commit framework
517
+ pip install pre-commit
518
+
519
+ # Activate hooks in repository
520
+ pre-commit install
521
+
522
+ # Test hooks (optional)
523
+ pre-commit run --all-files
524
+ ```
525
+
526
+ 📋 **Step 4: Monitor First Run**
527
+ - CI will run automatically on next push
528
+ - Check: https://github.com/{{USER}}/{{REPO}}/actions
529
+ - All 6 BAS phases should pass
530
+
531
+ 💡 **What happens now:**
532
+ - Every commit/PR runs through CI quality gates
533
+ - Push to main → Auto-deploy to staging
534
+ - Create version tag (v2.0.0) → Deploy to production (with approval)
535
+ - Pre-commit hooks validate locally before push
536
+
537
+ **Ready to activate!** Follow the steps above to enable Trinity quality automation.
538
+ ```
539
+
540
+ **Include in JUNO Report:**
541
+ - Add "EIN Phase: Complete" to audit summary
542
+ - Document which CI/CD files were reviewed
543
+ - Include activation instructions
544
+
545
+ **Outcome:** Trinity Method fully integrated, audited, and CI/CD templates reviewed (if deployed).
546
+
547
+ **Note:** This command should be run once after initial deployment. The deployment created the structure; this command populates it with project-specific content.
548
+
549
+ ## Post-Init Next Steps
550
+
551
+ After Trinity initialization, explore Trinity Method workflows:
552
+
553
+ ### 1. Plan Your First Workflow
554
+ ```
555
+ /trinity-orchestrate
556
+ ```
557
+
558
+ Plan your implementation approach. Claude will guide you through workflow selection based on task scale.
559
+
560
+ ### 2. Explore Investigation Templates
561
+ ```
562
+ /trinity-investigate-templates
563
+ ```
564
+
565
+ Learn about 5 investigation template types. Choose the right template for your first investigation.
566
+
567
+ ### 3. Verify Installation
568
+ ```
569
+ /trinity-verify
570
+ ```
571
+
572
+ Confirm Trinity structure completeness. Ensure all agents and directories are properly deployed.
573
+
574
+ ### 4. Create Your First Investigation
575
+ ```
576
+ /trinity-create-investigation
577
+ ```
578
+
579
+ Use investigation wizard to create structured investigation from template.
580
+
581
+ ### 5. Start Development
582
+ Use Trinity workflow commands based on task scale:
583
+ - Small tasks: `/trinity-start` for direct implementation
584
+ - Medium tasks: `/trinity-requirements` → `/trinity-design` → `/trinity-plan`
585
+ - Large tasks: Full workflow with `/trinity-orchestrate` guidance
586
+
587
+ ## Related Commands
588
+
589
+ - `/trinity-orchestrate` - Workflow orchestration guide
590
+ - `/trinity-investigate-templates` - Investigation template guide
591
+ - `/trinity-verify` - Verification command documentation
592
+ - `/trinity-start` - Start your first Trinity workflow
593
+ - `/trinity-requirements` - Requirements analysis (MON)
594
+ - `/trinity-design` - Technical design (ROR)
595
+ - `/trinity-plan` - Implementation planning (TRA)
596
+
597
+ ## What's Next?
598
+
599
+ Trinity is now fully integrated. Your next steps:
600
+
601
+ 1. **Verify Setup:** Use `/trinity-verify` to confirm structure completeness
602
+ 2. **First Investigation:** Create investigation with `/trinity-create-investigation`
603
+ 3. **First Workflow:** Use `/trinity-orchestrate` to plan your implementation approach
604
+ 4. **Start Building:** Choose workflow based on task scale (Small/Medium/Large)
605
+
606
+ Trinity Method will help you maintain high quality standards throughout your development process.