trinity-method-sdk 2.0.9 → 2.2.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.
- package/CHANGELOG.md +702 -267
- package/README.md +550 -540
- package/dist/cli/commands/deploy/agents.js +1 -1
- package/dist/cli/commands/deploy/ci-cd.d.ts +4 -3
- package/dist/cli/commands/deploy/ci-cd.js +10 -9
- package/dist/cli/commands/deploy/claude-setup.js +28 -35
- package/dist/cli/commands/deploy/configuration.js +10 -11
- package/dist/cli/commands/deploy/directories.js +13 -14
- package/dist/cli/commands/deploy/gitignore.js +3 -5
- package/dist/cli/commands/deploy/index.d.ts +1 -1
- package/dist/cli/commands/deploy/index.js +7 -3
- package/dist/cli/commands/deploy/knowledge-base.js +3 -3
- package/dist/cli/commands/deploy/pre-flight.js +1 -1
- package/dist/cli/commands/deploy/root-files.js +3 -18
- package/dist/cli/commands/deploy/sdk-install.js +1 -1
- package/dist/cli/commands/deploy/summary.js +3 -3
- package/dist/cli/commands/deploy/templates.js +33 -20
- package/dist/cli/commands/update/agents.js +1 -1
- package/dist/cli/commands/update/backup.js +6 -12
- package/dist/cli/commands/update/commands.d.ts +1 -0
- package/dist/cli/commands/update/commands.js +18 -45
- package/dist/cli/commands/update/knowledge-base.js +2 -2
- package/dist/cli/commands/update/pre-flight.js +11 -11
- package/dist/cli/commands/update/summary.js +5 -5
- package/dist/cli/commands/update/templates.js +35 -13
- package/dist/cli/commands/update/verification.js +5 -5
- package/dist/cli/commands/update/version.js +1 -1
- package/dist/cli/utils/deploy-ci.d.ts +3 -2
- package/dist/cli/utils/deploy-ci.js +24 -24
- package/dist/cli/utils/deploy-linting.js +101 -6
- package/dist/cli/utils/error-classes.d.ts +2 -2
- package/dist/cli/utils/linting-tools.js +14 -6
- package/dist/cli/utils/template-processor.js +2 -4
- package/dist/templates/{claude → .claude}/EMPLOYEE-DIRECTORY.md.template +16 -22
- package/dist/templates/{agents → .claude/agents}/aj-team/apo-documentation-specialist.md.template +10 -10
- package/dist/templates/{agents → .claude/agents}/aj-team/bas-quality-gate.md.template +13 -15
- package/dist/templates/{agents → .claude/agents}/aj-team/bon-dependency-manager.md.template +4 -4
- package/dist/templates/{agents → .claude/agents}/aj-team/cap-configuration-specialist.md.template +3 -3
- package/dist/templates/{agents → .claude/agents}/aj-team/dra-code-reviewer.md.template +8 -10
- package/dist/templates/{agents → .claude/agents}/aj-team/kil-task-executor.md.template +11 -13
- package/dist/templates/{agents → .claude/agents}/aj-team/uro-refactoring-specialist.md.template +3 -3
- package/dist/templates/{agents → .claude/agents}/audit/juno-auditor.md.template +46 -42
- package/dist/templates/{agents → .claude/agents}/deployment/ein-cicd.md.template +59 -164
- package/dist/templates/{agents → .claude/agents}/deployment/ino-context.md.template +25 -22
- package/dist/templates/{agents → .claude/agents}/deployment/tan-structure.md.template +32 -30
- package/dist/templates/{agents → .claude/agents}/deployment/zen-knowledge.md.template +28 -23
- package/dist/templates/{agents → .claude/agents}/leadership/aj-maestro.md.template +10 -6
- package/dist/templates/{agents → .claude/agents}/leadership/aly-cto.md.template +22 -19
- package/dist/templates/{agents → .claude/agents}/planning/eus-decomposer.md.template +8 -4
- package/dist/templates/{agents → .claude/agents}/planning/mon-requirements.md.template +8 -4
- package/dist/templates/{agents → .claude/agents}/planning/ror-design.md.template +8 -4
- package/dist/templates/{agents → .claude/agents}/planning/tra-planner.md.template +10 -4
- package/dist/templates/{shared/claude-commands → .claude/commands/execution}/trinity-audit.md.template +15 -15
- package/dist/templates/.claude/commands/execution/trinity-breakdown.md.template +535 -0
- package/dist/templates/{shared/claude-commands → .claude/commands/execution}/trinity-orchestrate.md.template +48 -48
- package/dist/templates/{shared/claude-commands → .claude/commands/infrastructure}/trinity-init.md.template +32 -54
- package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-create-investigation.md.template +13 -7
- package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-investigate-templates.md.template +19 -15
- package/dist/templates/{shared/claude-commands → .claude/commands/investigation}/trinity-plan-investigation.md.template +12 -6
- package/dist/templates/{shared/claude-commands → .claude/commands/maintenance}/trinity-changelog.md.template +9 -8
- package/dist/templates/.claude/commands/maintenance/trinity-docs-update.md.template +279 -0
- package/dist/templates/.claude/commands/maintenance/trinity-docs.md.template +2828 -0
- package/dist/templates/{shared/claude-commands → .claude/commands/maintenance}/trinity-readme.md.template +21 -20
- package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-decompose.md.template +6 -4
- package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-design.md.template +6 -4
- package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-plan.md.template +7 -5
- package/dist/templates/{shared/claude-commands → .claude/commands/planning}/trinity-requirements.md.template +6 -4
- package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-continue.md.template +30 -24
- package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-end.md.template +403 -397
- package/dist/templates/{shared/claude-commands → .claude/commands/session}/trinity-start.md.template +9 -4
- package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-agents.md.template +11 -8
- package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-verify.md.template +56 -57
- package/dist/templates/{shared/claude-commands → .claude/commands/utility}/trinity-workorder.md.template +13 -9
- package/dist/templates/ci/ci.yml.template +2 -2
- package/dist/templates/root/CLAUDE.md.template +9 -9
- package/dist/templates/root/linting/nodejs/.husky-pre-commit.template +5 -0
- package/dist/templates/source/base-CLAUDE.md.template +310 -310
- package/dist/templates/source/flutter-CLAUDE.md.template +593 -593
- package/dist/templates/source/nodejs-CLAUDE.md.template +531 -531
- package/dist/templates/source/python-CLAUDE.md.template +510 -510
- package/dist/templates/source/react-CLAUDE.md.template +513 -513
- package/dist/templates/source/rust-CLAUDE.md.template +653 -653
- package/dist/templates/trinity/CLAUDE.md.template +14 -14
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/AI-DEVELOPMENT-GUIDE.md.template +1 -1
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/ARCHITECTURE.md.template +5 -5
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/CODING-PRINCIPLES.md.template +1 -1
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/DOCUMENTATION-CRITERIA.md.template +1 -1
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/ISSUES.md.template +9 -9
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/TESTING-PRINCIPLES.md.template +1 -1
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/Technical-Debt.md.template +2 -4
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/To-do.md.template +2 -2
- package/dist/templates/{knowledge-base → trinity/knowledge-base}/Trinity.md.template +6 -6
- package/dist/templates/trinity/templates/documentation/api-docs/README.md.template +218 -0
- package/dist/templates/trinity/templates/documentation/configuration/documentation-structure.md.template +71 -0
- package/dist/templates/trinity/templates/documentation/configuration/env-example-generator.md.template +387 -0
- package/dist/templates/trinity/templates/documentation/discovery/api-endpoint-scanner.md.template +343 -0
- package/dist/templates/trinity/templates/documentation/discovery/component-discovery.md.template +254 -0
- package/dist/templates/trinity/templates/documentation/discovery/env-variable-extraction.md.template +316 -0
- package/dist/templates/trinity/templates/documentation/discovery/framework-detection.md.template +205 -0
- package/dist/templates/trinity/templates/documentation/guides/api-development.md.template +375 -0
- package/dist/templates/trinity/templates/documentation/guides/contributing.md.template +488 -0
- package/dist/templates/trinity/templates/documentation/guides/deployment.md.template +565 -0
- package/dist/templates/trinity/templates/documentation/guides/getting-started.md.template +118 -0
- package/dist/templates/trinity/templates/documentation/mermaid-diagrams/api-endpoint-map.md.template +56 -0
- package/dist/templates/trinity/templates/documentation/mermaid-diagrams/component-hierarchy.md.template +60 -0
- package/dist/templates/trinity/templates/documentation/mermaid-diagrams/database-er.md.template +49 -0
- package/dist/templates/trinity/templates/documentation/mermaid-diagrams/mvc-flow.md.template +41 -0
- package/dist/templates/trinity/templates/documentation/processes/error-handling-protocol.md.template +166 -0
- package/dist/templates/trinity/templates/documentation/processes/fallback-mechanism.md.template +88 -0
- package/dist/templates/trinity/templates/documentation/reports/apo-docs-update-checklist.md.template +343 -0
- package/dist/templates/trinity/templates/documentation/reports/juno-docs-update-checklist.md.template +1337 -0
- package/dist/templates/trinity/templates/documentation/reports/juno-final-report.md.template +237 -0
- package/dist/templates/trinity/templates/documentation/reports/juno-internal-report.md.template +461 -0
- package/dist/templates/trinity/templates/documentation/validation/documentation-verification-rules.md.template +379 -0
- package/dist/templates/trinity/templates/documentation/validation/juno-quality-gates.md.template +282 -0
- package/dist/templates/{investigations → trinity/templates/investigations}/bug.md.template +14 -14
- package/dist/templates/{investigations → trinity/templates/investigations}/feature.md.template +14 -14
- package/dist/templates/{investigations → trinity/templates/investigations}/performance.md.template +14 -14
- package/dist/templates/{investigations → trinity/templates/investigations}/security.md.template +14 -14
- package/dist/templates/{investigations → trinity/templates/investigations}/technical.md.template +14 -14
- package/dist/templates/{work-orders → trinity/templates/work-orders}/ANALYSIS-TEMPLATE.md.template +10 -13
- package/dist/templates/{work-orders → trinity/templates/work-orders}/AUDIT-TEMPLATE.md.template +10 -26
- package/dist/templates/{work-orders → trinity/templates/work-orders}/IMPLEMENTATION-TEMPLATE.md.template +10 -26
- package/dist/templates/{work-orders → trinity/templates/work-orders}/INVESTIGATION-TEMPLATE.md.template +10 -25
- package/dist/templates/{work-orders → trinity/templates/work-orders}/PATTERN-TEMPLATE.md.template +10 -26
- package/dist/templates/{work-orders → trinity/templates/work-orders}/VERIFICATION-TEMPLATE.md.template +10 -26
- package/package.json +99 -94
- package/dist/templates/agents/leadership/aj-cc.md.template +0 -462
- package/dist/templates/ci/cd.yml.template +0 -175
- package/dist/templates/ci/github-actions.yml +0 -86
- package/dist/templates/root/TRINITY.md.template +0 -52
- package/dist/templates/shared/claude-commands/trinity-docs.md.template +0 -2577
- /package/dist/templates/{linting → root/linting}/flutter/.pre-commit-config.yaml.template +0 -0
- /package/dist/templates/{linting → root/linting}/flutter/analysis_options.yaml.template +0 -0
- /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-commonjs.json.template +0 -0
- /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-esm.json.template +0 -0
- /package/dist/templates/{linting → root/linting}/nodejs/.eslintrc-typescript.json.template +0 -0
- /package/dist/templates/{linting → root/linting}/nodejs/.pre-commit-config.yaml.template +0 -0
- /package/dist/templates/{linting → root/linting}/nodejs/.prettierrc.json.template +0 -0
- /package/dist/templates/{linting → root/linting}/python/.flake8.template +0 -0
- /package/dist/templates/{linting → root/linting}/python/.pre-commit-config.yaml.template +0 -0
- /package/dist/templates/{linting → root/linting}/python/pyproject.toml.template +0 -0
- /package/dist/templates/{linting → root/linting}/rust/.pre-commit-config.yaml.template +0 -0
- /package/dist/templates/{linting → root/linting}/rust/clippy.toml.template +0 -0
- /package/dist/templates/{linting → root/linting}/rust/rustfmt.toml.template +0 -0
- /package/dist/templates/{documentation → trinity/templates/documentation}/ROOT-README.md.template +0 -0
- /package/dist/templates/{documentation → trinity/templates/documentation}/SUBDIRECTORY-README.md.template +0 -0
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
# Trinity Breakdown
|
|
2
|
+
|
|
3
|
+
**Command:** `/execution:trinity-breakdown`
|
|
4
|
+
**Purpose:** Guided step-by-step implementation where the user makes all edits, instructed by AJ MAESTRO
|
|
5
|
+
**Architecture:** ALY (CTO) → AJ MAESTRO analysis → Step-by-step user guidance → User verification
|
|
6
|
+
**Trinity Version:** 2.1.0
|
|
7
|
+
**Last Updated:** 2026-02-23
|
|
8
|
+
|
|
9
|
+
**Use throughout your session:** This command guides you through implementations step by step.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
`/trinity-breakdown` is the **guided implementation command** in Trinity Method development. Unlike `/trinity-orchestrate` where CC executes changes directly, this command has CC act as an **implementation instructor** — explaining what to change, where to change it, and why — so **you make the edits yourself**.
|
|
16
|
+
|
|
17
|
+
**Key Difference from Orchestrate:**
|
|
18
|
+
|
|
19
|
+
| Aspect | `/trinity-orchestrate` | `/trinity-breakdown` |
|
|
20
|
+
|--------|----------------------|---------------------|
|
|
21
|
+
| Who edits code | CC / KIL agents | **You** (the user) |
|
|
22
|
+
| CC's role | Execute changes | Explain what to change |
|
|
23
|
+
| Output | Commits and reports | Step-by-step instructions |
|
|
24
|
+
| Quality gates | BAS runs automatically | You run quality checks with guidance |
|
|
25
|
+
| Learning | Minimal | **Maximum** — you understand every change |
|
|
26
|
+
|
|
27
|
+
**When to use Breakdown vs Orchestrate:**
|
|
28
|
+
- **Breakdown:** You want to learn, understand the codebase, or make changes yourself
|
|
29
|
+
- **Orchestrate:** You want CC to handle implementation autonomously
|
|
30
|
+
|
|
31
|
+
**Development Session Flow:**
|
|
32
|
+
```
|
|
33
|
+
/trinity-start or /trinity-continue
|
|
34
|
+
|
|
|
35
|
+
/trinity-breakdown (GUIDED LOOP - user makes edits)
|
|
36
|
+
|
|
|
37
|
+
/trinity-end
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Usage Patterns
|
|
43
|
+
|
|
44
|
+
### 1. Break Down Work Orders (Formal Tasks)
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
/trinity-breakdown @WO-XXX-{task-name}.md
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**When to use:**
|
|
51
|
+
- Complex tasks where you want to understand every change
|
|
52
|
+
- Learning a new codebase through guided implementation
|
|
53
|
+
- Tasks requiring careful manual review at each step
|
|
54
|
+
- Work that benefits from human judgment at each edit
|
|
55
|
+
|
|
56
|
+
**Workflow:**
|
|
57
|
+
1. Create work order: `/trinity-workorder`
|
|
58
|
+
2. Work order saved to: `trinity/work-orders/WO-XXX-{task-name}.md`
|
|
59
|
+
3. Guide: `/trinity-breakdown @WO-042-jwt-refresh.md`
|
|
60
|
+
4. **AJ MAESTRO** analyzes the task and creates step-by-step instructions
|
|
61
|
+
5. **You implement each step** following CC's guidance
|
|
62
|
+
6. **You verify each step** (run tests, lint, build as instructed)
|
|
63
|
+
7. **After completion:** Move work order from `trinity/work-orders/` to `trinity/sessions/`
|
|
64
|
+
|
|
65
|
+
**Example:**
|
|
66
|
+
```bash
|
|
67
|
+
/trinity-breakdown @WO-042-jwt-refresh-implementation.md
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### 2. Break Down Investigations (READ-ONLY Analysis)
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
/trinity-breakdown @INV-XXX-{title}.md
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**When to use:**
|
|
79
|
+
- Guided investigation where you want to explore the codebase yourself
|
|
80
|
+
- Learning how systems work through structured exploration
|
|
81
|
+
- When you want to understand root causes firsthand
|
|
82
|
+
|
|
83
|
+
**Workflow:**
|
|
84
|
+
1. Create investigation: `/trinity-create-investigation`
|
|
85
|
+
2. Investigation saved to: `trinity/investigations/INV-XXX-{title}.md`
|
|
86
|
+
3. Guide: `/trinity-breakdown @INV-015-performance-analysis.md`
|
|
87
|
+
4. **AJ MAESTRO** provides exploration steps
|
|
88
|
+
5. **You explore** following CC's guidance (READ-ONLY — no code changes)
|
|
89
|
+
6. **Findings documented** based on your discoveries
|
|
90
|
+
7. **After completion:** Move investigation from `trinity/investigations/` to `trinity/sessions/`
|
|
91
|
+
|
|
92
|
+
**Example:**
|
|
93
|
+
```bash
|
|
94
|
+
/trinity-breakdown @INV-015-database-performance-analysis.md
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### 3. Break Down General Tasks (Quick Tasks)
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
/trinity-breakdown "Task description"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**When to use:**
|
|
106
|
+
- Quick changes where you want step-by-step guidance
|
|
107
|
+
- Learning how to implement a specific pattern
|
|
108
|
+
- Simple fixes with instructional walkthrough
|
|
109
|
+
|
|
110
|
+
**How it works:**
|
|
111
|
+
- AJ MAESTRO assesses task complexity
|
|
112
|
+
- Breaks it into individual steps with instructions
|
|
113
|
+
- Guides you through each step
|
|
114
|
+
- Helps you verify the result
|
|
115
|
+
|
|
116
|
+
**Example:**
|
|
117
|
+
```bash
|
|
118
|
+
/trinity-breakdown "Fix date validation bug in UserForm component"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## AJ MAESTRO's Breakdown Process
|
|
124
|
+
|
|
125
|
+
When you invoke `/trinity-breakdown`, here's what happens:
|
|
126
|
+
|
|
127
|
+
### Step 1: Task Analysis
|
|
128
|
+
|
|
129
|
+
**AJ MAESTRO reads and analyzes:**
|
|
130
|
+
- Work order file (if @WO-XXX provided)
|
|
131
|
+
- Investigation file (if @INV-XXX provided)
|
|
132
|
+
- Task description (if general task)
|
|
133
|
+
|
|
134
|
+
**Determines:**
|
|
135
|
+
- Task complexity and scope
|
|
136
|
+
- Required expertise areas
|
|
137
|
+
- Optimal step-by-step breakdown
|
|
138
|
+
- Verification checks for each step
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### Step 2: Agent Persona Selection
|
|
143
|
+
|
|
144
|
+
**AJ MAESTRO selects the best agent persona(s) for guidance:**
|
|
145
|
+
|
|
146
|
+
CC adopts the relevant agent's expertise to provide specialized instructions:
|
|
147
|
+
|
|
148
|
+
- **MON persona** — Requirements guidance
|
|
149
|
+
- **ROR persona** — Design and architecture guidance
|
|
150
|
+
- **KIL persona** — Implementation instructions (TDD guidance)
|
|
151
|
+
- **BAS persona** — Quality gate verification instructions
|
|
152
|
+
- **DRA persona** — Code review guidance
|
|
153
|
+
- **APO persona** — Documentation instructions
|
|
154
|
+
|
|
155
|
+
**Selection Criteria:**
|
|
156
|
+
- Small tasks (1-2 files): Direct KIL-style implementation guidance
|
|
157
|
+
- Medium tasks (3-5 files): Design overview, then step-by-step implementation
|
|
158
|
+
- Large tasks (6+ files): Full planning overview, then phased step-by-step guidance
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
### Step 3: Walk-Through Execution
|
|
163
|
+
|
|
164
|
+
**AJ MAESTRO presents each change as a structured instruction:**
|
|
165
|
+
|
|
166
|
+
For each step, CC provides:
|
|
167
|
+
|
|
168
|
+
1. **What file to open** — Exact file path
|
|
169
|
+
2. **Where to make the change** — Line numbers or code context
|
|
170
|
+
3. **What to change** — The specific edit (old code → new code)
|
|
171
|
+
4. **Why this change is needed** — Reasoning and context
|
|
172
|
+
5. **How to verify** — What to check after making the change
|
|
173
|
+
|
|
174
|
+
**Instruction Format:**
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
STEP X of Y: [Brief description]
|
|
178
|
+
|
|
179
|
+
FILE: path/to/file.ext
|
|
180
|
+
LOCATION: Line XX (after/before [context])
|
|
181
|
+
|
|
182
|
+
WHAT TO DO:
|
|
183
|
+
[Clear instruction — add, modify, or remove code]
|
|
184
|
+
|
|
185
|
+
CODE:
|
|
186
|
+
[Exact code to write or the change to make]
|
|
187
|
+
|
|
188
|
+
WHY:
|
|
189
|
+
[Brief explanation of why this change is needed]
|
|
190
|
+
|
|
191
|
+
VERIFY:
|
|
192
|
+
[How to check this step worked — e.g., "Save and run: npm test"]
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Important Rules for Instructions:**
|
|
196
|
+
- One change per step (atomic instructions)
|
|
197
|
+
- Always provide the exact file path
|
|
198
|
+
- Always explain WHY, not just WHAT
|
|
199
|
+
- Include verification after each meaningful change
|
|
200
|
+
- Never skip ahead — wait for user confirmation before next step
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### Step 4: User Verification
|
|
205
|
+
|
|
206
|
+
**After each significant phase, CC guides you to verify:**
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
VERIFICATION CHECKPOINT
|
|
210
|
+
|
|
211
|
+
Run these commands to verify your changes:
|
|
212
|
+
|
|
213
|
+
1. Build: npm run build
|
|
214
|
+
2. Lint: npm run lint
|
|
215
|
+
3. Test: npm test
|
|
216
|
+
|
|
217
|
+
Expected Results:
|
|
218
|
+
- Build: Should compile without errors
|
|
219
|
+
- Lint: No new warnings or errors
|
|
220
|
+
- Test: All tests should pass
|
|
221
|
+
|
|
222
|
+
If any check fails, let me know and I'll help you fix it.
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
### Step 5: Completion Summary
|
|
228
|
+
|
|
229
|
+
**After all steps are complete, CC provides:**
|
|
230
|
+
- Summary of all changes made
|
|
231
|
+
- Files modified
|
|
232
|
+
- Tests affected
|
|
233
|
+
- Next steps or follow-up recommendations
|
|
234
|
+
- Work order completion workflow (move to sessions/)
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## After Task Completion Workflow
|
|
239
|
+
|
|
240
|
+
### When You've Completed All Steps
|
|
241
|
+
|
|
242
|
+
**Step 1: Verify All Changes**
|
|
243
|
+
- [ ] All instructed changes have been made
|
|
244
|
+
- [ ] Build passes: `npm run build` (or equivalent)
|
|
245
|
+
- [ ] Lint passes: `npm run lint` (or equivalent)
|
|
246
|
+
- [ ] Tests pass: `npm test` (or equivalent)
|
|
247
|
+
|
|
248
|
+
**Step 2: Move Completed File to Sessions**
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
# Work Order
|
|
252
|
+
mv trinity/work-orders/WO-XXX-*.md trinity/sessions/
|
|
253
|
+
|
|
254
|
+
# Investigation
|
|
255
|
+
mv trinity/investigations/INV-XXX-*.md trinity/sessions/
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
**Step 3: Verify File Locations**
|
|
259
|
+
- [ ] Completed file NOW EXISTS in: `trinity/sessions/`
|
|
260
|
+
- [ ] Completed file NO LONGER EXISTS in: `trinity/work-orders/` or `trinity/investigations/`
|
|
261
|
+
|
|
262
|
+
**Step 4: Continue or End Session**
|
|
263
|
+
- Continue with next task, or
|
|
264
|
+
- Run `/trinity-end` to archive session
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Real-World Examples
|
|
269
|
+
|
|
270
|
+
### Example 1: Work Order Breakdown
|
|
271
|
+
|
|
272
|
+
```
|
|
273
|
+
User: /trinity-breakdown @WO-042-jwt-refresh-implementation.md
|
|
274
|
+
|
|
275
|
+
AJ MAESTRO: Reading work order WO-042...
|
|
276
|
+
|
|
277
|
+
I'll walk you through implementing JWT token refresh step by step.
|
|
278
|
+
You'll make all the edits — I'll tell you exactly what to change and why.
|
|
279
|
+
|
|
280
|
+
OVERVIEW:
|
|
281
|
+
- 4 files to create/modify
|
|
282
|
+
- 8 steps total
|
|
283
|
+
- Estimated time: 45-60 minutes
|
|
284
|
+
- You'll need: Your code editor and a terminal
|
|
285
|
+
|
|
286
|
+
Let's begin.
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
STEP 1 of 8: Create the token refresh service file
|
|
291
|
+
|
|
292
|
+
FILE: src/services/token-refresh.service.ts
|
|
293
|
+
LOCATION: New file
|
|
294
|
+
|
|
295
|
+
WHAT TO DO:
|
|
296
|
+
Create a new file with the following content:
|
|
297
|
+
|
|
298
|
+
CODE:
|
|
299
|
+
import { sign, verify } from 'jsonwebtoken';
|
|
300
|
+
|
|
301
|
+
export interface TokenPair {
|
|
302
|
+
accessToken: string;
|
|
303
|
+
refreshToken: string;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export class TokenRefreshService {
|
|
307
|
+
async refreshToken(userId: string): Promise<TokenPair> {
|
|
308
|
+
const accessToken = sign({ userId }, process.env.JWT_SECRET!, {
|
|
309
|
+
expiresIn: '15m',
|
|
310
|
+
});
|
|
311
|
+
const refreshToken = sign({ userId }, process.env.REFRESH_SECRET!, {
|
|
312
|
+
expiresIn: '7d',
|
|
313
|
+
});
|
|
314
|
+
return { accessToken, refreshToken };
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
WHY:
|
|
319
|
+
This service encapsulates token generation logic. We separate access tokens
|
|
320
|
+
(short-lived, 15 min) from refresh tokens (long-lived, 7 days) following
|
|
321
|
+
the OAuth 2.0 refresh token pattern. This prevents users from needing to
|
|
322
|
+
re-authenticate frequently while maintaining security.
|
|
323
|
+
|
|
324
|
+
VERIFY:
|
|
325
|
+
Save the file and run: npm run build
|
|
326
|
+
Expected: Should compile without errors (no tests yet — that's next)
|
|
327
|
+
|
|
328
|
+
Ready for Step 2? (Say "next" to continue)
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
---
|
|
332
|
+
|
|
333
|
+
### Example 2: Investigation Breakdown
|
|
334
|
+
|
|
335
|
+
```
|
|
336
|
+
User: /trinity-breakdown @INV-015-database-performance-analysis.md
|
|
337
|
+
|
|
338
|
+
AJ MAESTRO: Reading investigation INV-015...
|
|
339
|
+
|
|
340
|
+
I'll guide you through investigating the database performance issue.
|
|
341
|
+
You'll explore the codebase yourself — I'll point you where to look.
|
|
342
|
+
|
|
343
|
+
This is a READ-ONLY investigation. No code changes.
|
|
344
|
+
|
|
345
|
+
OVERVIEW:
|
|
346
|
+
- 5 exploration steps
|
|
347
|
+
- Estimated time: 30 minutes
|
|
348
|
+
- Goal: Identify root cause of 300% query time increase
|
|
349
|
+
|
|
350
|
+
Let's begin.
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
STEP 1 of 5: Check the slow query patterns
|
|
355
|
+
|
|
356
|
+
WHAT TO DO:
|
|
357
|
+
Open this file and look for the getUserOrders function:
|
|
358
|
+
|
|
359
|
+
FILE: src/services/order.service.ts
|
|
360
|
+
LOCATION: Search for "getUserOrders"
|
|
361
|
+
|
|
362
|
+
WHAT TO LOOK FOR:
|
|
363
|
+
- Is it loading related data (users, products) inside a loop?
|
|
364
|
+
- Does it use eager loading (include/join) or lazy loading (separate queries)?
|
|
365
|
+
- Count how many database calls happen per invocation
|
|
366
|
+
|
|
367
|
+
WHY:
|
|
368
|
+
N+1 query patterns are the most common cause of sudden performance
|
|
369
|
+
degradation. If orders are loaded first, then each order's user is
|
|
370
|
+
loaded individually, that's N+1 queries.
|
|
371
|
+
|
|
372
|
+
REPORT BACK:
|
|
373
|
+
Tell me what you find — specifically:
|
|
374
|
+
1. How many queries does this function make?
|
|
375
|
+
2. Is there a loop that makes individual DB calls?
|
|
376
|
+
3. Are there any JOIN or include statements?
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
### Example 3: Quick Task Breakdown
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
User: /trinity-breakdown "Fix date validation bug in UserForm component"
|
|
385
|
+
|
|
386
|
+
AJ MAESTRO: Analyzing task...
|
|
387
|
+
|
|
388
|
+
I'll walk you through fixing the date validation bug.
|
|
389
|
+
2 steps — should take about 10 minutes.
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
STEP 1 of 2: Add the validation function
|
|
394
|
+
|
|
395
|
+
FILE: src/components/UserForm.tsx
|
|
396
|
+
LOCATION: Find the validateDate function (around line 45)
|
|
397
|
+
|
|
398
|
+
WHAT TO DO:
|
|
399
|
+
Replace the current validation:
|
|
400
|
+
|
|
401
|
+
BEFORE:
|
|
402
|
+
const isValid = date !== '';
|
|
403
|
+
|
|
404
|
+
AFTER:
|
|
405
|
+
const isValid = (() => {
|
|
406
|
+
if (!date) return false;
|
|
407
|
+
const parsed = new Date(date);
|
|
408
|
+
return parsed instanceof Date && !isNaN(parsed.getTime());
|
|
409
|
+
})();
|
|
410
|
+
|
|
411
|
+
WHY:
|
|
412
|
+
The current validation only checks if the string is non-empty.
|
|
413
|
+
It doesn't validate the actual date format, so "13/32/2025" passes.
|
|
414
|
+
The new validation parses the date and checks if it's a real date.
|
|
415
|
+
|
|
416
|
+
VERIFY:
|
|
417
|
+
Save and run: npm test -- --testPathPattern="UserForm"
|
|
418
|
+
Expected: Tests should pass (existing tests still work)
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
STEP 2 of 2: Add test for the edge case
|
|
423
|
+
|
|
424
|
+
FILE: src/components/UserForm.test.tsx
|
|
425
|
+
LOCATION: After the last test in the "date validation" describe block
|
|
426
|
+
|
|
427
|
+
WHAT TO DO:
|
|
428
|
+
Add this test:
|
|
429
|
+
|
|
430
|
+
CODE:
|
|
431
|
+
it('should reject invalid date formats', () => {
|
|
432
|
+
render(<UserForm />);
|
|
433
|
+
const dateInput = screen.getByLabelText('Date');
|
|
434
|
+
fireEvent.change(dateInput, { target: { value: '13/32/2025' } });
|
|
435
|
+
expect(screen.getByText('Invalid date')).toBeInTheDocument();
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
WHY:
|
|
439
|
+
This test ensures the bug doesn't regress. It specifically tests the
|
|
440
|
+
invalid date format that was previously accepted.
|
|
441
|
+
|
|
442
|
+
VERIFY:
|
|
443
|
+
Run: npm test -- --testPathPattern="UserForm"
|
|
444
|
+
Expected: All tests pass, including the new one
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
VERIFICATION CHECKPOINT
|
|
449
|
+
|
|
450
|
+
All changes complete! Run final checks:
|
|
451
|
+
|
|
452
|
+
1. npm run build (should compile)
|
|
453
|
+
2. npm run lint (no new warnings)
|
|
454
|
+
3. npm test (all tests pass)
|
|
455
|
+
|
|
456
|
+
Summary:
|
|
457
|
+
- Fixed: Date validation now rejects invalid formats
|
|
458
|
+
- Added: 1 regression test
|
|
459
|
+
- Files changed: 2 (UserForm.tsx, UserForm.test.tsx)
|
|
460
|
+
|
|
461
|
+
Task complete!
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## When NOT to Use /trinity-breakdown
|
|
467
|
+
|
|
468
|
+
**Don't use for:**
|
|
469
|
+
|
|
470
|
+
- **Starting a session** → Use `/trinity-start` or `/trinity-continue`
|
|
471
|
+
- **Creating work orders** → Use `/trinity-workorder` to create, then break it down
|
|
472
|
+
- **Creating investigations** → Use `/trinity-create-investigation` to create, then break it down
|
|
473
|
+
- **Ending your session** → Use `/trinity-end` to archive work
|
|
474
|
+
- **When you want AI to do the work** → Use `/trinity-orchestrate` instead
|
|
475
|
+
|
|
476
|
+
**Use /trinity-breakdown for:**
|
|
477
|
+
|
|
478
|
+
- Learning how to implement a feature
|
|
479
|
+
- Understanding the codebase through guided changes
|
|
480
|
+
- Making changes yourself with expert guidance
|
|
481
|
+
- Training or onboarding through hands-on implementation
|
|
482
|
+
|
|
483
|
+
---
|
|
484
|
+
|
|
485
|
+
## Related Commands
|
|
486
|
+
|
|
487
|
+
### Session Management
|
|
488
|
+
- `/trinity-start` - Begin new development session
|
|
489
|
+
- `/trinity-continue` - Resume interrupted session
|
|
490
|
+
- `/trinity-end` - End session and archive work
|
|
491
|
+
|
|
492
|
+
### Task Creation
|
|
493
|
+
- `/trinity-workorder` - Create formal work order for complex tasks
|
|
494
|
+
- `/trinity-create-investigation` - Create investigation for analysis
|
|
495
|
+
|
|
496
|
+
### Execution Alternatives
|
|
497
|
+
- `/trinity-orchestrate` - AI-executed implementation (CC makes the changes)
|
|
498
|
+
- `/trinity-audit` - Comprehensive Trinity deployment audit
|
|
499
|
+
|
|
500
|
+
### Planning
|
|
501
|
+
- `/trinity-requirements` - Deep requirements analysis with MON
|
|
502
|
+
- `/trinity-design` - Technical design creation with ROR
|
|
503
|
+
- `/trinity-plan` - Implementation planning with TRA
|
|
504
|
+
- `/trinity-decompose` - Atomic task decomposition with EUS
|
|
505
|
+
|
|
506
|
+
---
|
|
507
|
+
|
|
508
|
+
## Summary
|
|
509
|
+
|
|
510
|
+
**Guided Implementation Command:** `/trinity-breakdown` walks you through changes step by step.
|
|
511
|
+
|
|
512
|
+
**Key Points:**
|
|
513
|
+
1. **You make all edits** — CC instructs, you implement
|
|
514
|
+
2. **Step-by-step instructions** — File path, line numbers, what to change, why
|
|
515
|
+
3. **Verification at each step** — Run tests, lint, build as guided
|
|
516
|
+
4. **Same usage patterns** — @WO-XXX (work orders), @INV-XXX (investigations), "description" (quick tasks)
|
|
517
|
+
5. **Maximum learning** — Understand every change you make
|
|
518
|
+
|
|
519
|
+
**When to choose Breakdown:**
|
|
520
|
+
- You want to learn and understand the changes
|
|
521
|
+
- You prefer hands-on implementation with expert guidance
|
|
522
|
+
- You want to review each change before it's applied
|
|
523
|
+
|
|
524
|
+
**When to choose Orchestrate instead:**
|
|
525
|
+
- You want CC to handle implementation autonomously
|
|
526
|
+
- Speed is more important than learning
|
|
527
|
+
- You trust the AI to make the right changes
|
|
528
|
+
|
|
529
|
+
**Typical Session Flow:**
|
|
530
|
+
```bash
|
|
531
|
+
/trinity-start # Begin session
|
|
532
|
+
/trinity-breakdown @WO-042-jwt-refresh.md # Guided implementation
|
|
533
|
+
/trinity-breakdown "Fix validation bug" # Quick guided fix
|
|
534
|
+
/trinity-end # End session
|
|
535
|
+
```
|