octocode-cli 1.1.1 → 1.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.
@@ -0,0 +1,317 @@
1
+ # Execution Phases - Detailed Reference
2
+
3
+ Detailed step-by-step instructions for each implementation phase.
4
+
5
+ ---
6
+
7
+ ## Phase 1: SPEC (Spec Parsing)
8
+
9
+ **Goal**: Extract and structure all implementation requirements.
10
+
11
+ **Subagent Pattern**:
12
+ ```
13
+ Task: "Parse specification and extract implementation tasks"
14
+ Scope: Read spec file, identify tasks, classify complexity
15
+ ```
16
+
17
+ **Steps**:
18
+ 1. **Read Specification**: Read the provided MD file
19
+ 2. **Extract Tasks**: Identify discrete implementation tasks
20
+ 3. **Classify Complexity**: Simple | Medium | Complex | Epic
21
+ 4. **Identify Dependencies**: What depends on what?
22
+ 5. **Create Master Todo**: Add all tasks via `TodoWrite`
23
+
24
+ **Deliverable**: Structured task list with dependencies.
25
+
26
+ ---
27
+
28
+ ## Phase 2: SPEC_VALIDATE (Spec Validation)
29
+
30
+ **Goal**: Ensure specification is complete and actionable before proceeding.
31
+
32
+ **Subagent Pattern**:
33
+ ```
34
+ Task: "Validate specification completeness and clarity"
35
+ Scope: Check for ambiguities, missing details, contradictions
36
+ ```
37
+
38
+ **Validation Checklist**:
39
+ | Check | Status | Action if Fails |
40
+ |-------|--------|-----------------|
41
+ | All requirements clearly defined | ❓ | Ask user for clarification |
42
+ | Acceptance criteria specified | ❓ | Request criteria from user |
43
+ | No contradicting requirements | ❓ | Flag conflicts to user |
44
+ | Technical constraints clear | ❓ | Ask for constraints |
45
+ | Dependencies identified | ❓ | Map dependencies |
46
+ | Out-of-scope items listed | ❓ | Confirm scope with user |
47
+
48
+ **Validation Questions**:
49
+ - Are there ambiguous terms that need definition?
50
+ - Are there implicit requirements not stated?
51
+ - Are there edge cases not covered?
52
+ - Is the scope well-bounded?
53
+
54
+ **Outcomes**:
55
+ | Result | Action |
56
+ |--------|--------|
57
+ | ✅ All Clear | Proceed to CONTEXT |
58
+ | ⚠️ Minor Gaps | Document assumptions, proceed with checkpoint |
59
+ | ❌ Major Gaps | STOP. Present gaps to user. Wait for clarification. |
60
+
61
+ ---
62
+
63
+ ## Phase 3: CONTEXT (Context Discovery)
64
+
65
+ **Goal**: Build mental model of codebase architecture.
66
+
67
+ **Subagent Pattern**:
68
+ ```
69
+ Task: "Map codebase architecture for [feature area]"
70
+ Scope: Directory structure, entry points, testing setup
71
+ ```
72
+
73
+ **Parallel Subagents** (spawn via `Task`):
74
+ | Subagent | Focus | Tool |
75
+ |----------|-------|------|
76
+ | Structure Agent | Map directory tree | `localViewStructure` |
77
+ | Pattern Agent | Find similar features | `localSearchCode` |
78
+ | Test Agent | Understand test setup | `localSearchCode` in tests/ |
79
+
80
+ **Steps**:
81
+ 1. **Map Codebase**: `localViewStructure` at root (depth=1)
82
+ 2. **Identify Relevant Areas**: Which directories matter for this task?
83
+ 3. **Locate Entry Points**: Where does the feature start?
84
+ 4. **Find Similar Features**: What analogous implementations exist?
85
+ 5. **Understand Testing Setup**: How are tests organized?
86
+
87
+ **Deliverable**: Mental model of the codebase architecture.
88
+
89
+ ---
90
+
91
+ ## Phase 4: PLAN (Implementation Planning)
92
+
93
+ **Goal**: Create detailed, actionable implementation plan.
94
+
95
+ **Subagent Pattern**:
96
+ ```
97
+ Task: "Create implementation plan for [task]"
98
+ Scope: Break down into atomic changes, identify files, risks
99
+ ```
100
+
101
+ **Plan Structure**:
102
+ Write implementation plan with:
103
+ - Task breakdown (atomic changes)
104
+ - File changes required
105
+ - Research questions to resolve
106
+ - Testing strategy
107
+ - Risk areas
108
+
109
+ **Parallel Planning** (for Complex/Epic tasks):
110
+ ```
111
+ Task 1: "Plan types and interfaces changes"
112
+ Task 2: "Plan core logic implementation"
113
+ Task 3: "Plan integration points"
114
+ Task 4: "Plan test coverage"
115
+ ```
116
+
117
+ **User Checkpoint**: Present plan → Wait for approval.
118
+
119
+ ---
120
+
121
+ ## Phase 5: RESEARCH (Deep Research)
122
+
123
+ **Goal**: Understand exactly what to change and how.
124
+
125
+ **Subagent Pattern**:
126
+ ```
127
+ Task: "Research [specific area] for implementation"
128
+ Scope: Locate code, trace flow, find patterns
129
+ ```
130
+
131
+ **Parallel Research Subagents** (spawn via `Task`):
132
+ | Subagent | Focus | Output |
133
+ |----------|-------|--------|
134
+ | Flow Tracer | Trace data flow with LSP | Call hierarchy map |
135
+ | Pattern Finder | Find existing patterns | Pattern examples |
136
+ | Impact Analyzer | Find all affected code | Reference list |
137
+ | Test Researcher | Find test patterns | Test templates |
138
+
139
+ **Research Steps Per Task**:
140
+
141
+ 1. **Locate Target Area**:
142
+ ```
143
+ localSearchCode(pattern="FeatureName", filesOnly=true)
144
+ ```
145
+
146
+ 2. **Read Implementation Context**:
147
+ ```
148
+ localGetFileContent(path="target.ts", matchString="class Feature")
149
+ ```
150
+
151
+ 3. **Trace Data Flow**:
152
+ ```
153
+ lspCallHierarchy(symbolName="handleData", direction="incoming")
154
+ lspCallHierarchy(symbolName="handleData", direction="outgoing")
155
+ ```
156
+
157
+ 4. **Find All References** (Impact Analysis):
158
+ ```
159
+ lspFindReferences(symbolName="affectedFunction", includeDeclaration=false)
160
+ ```
161
+
162
+ 5. **Find Existing Patterns**:
163
+ ```
164
+ localSearchCode(pattern="similar implementation pattern")
165
+ ```
166
+
167
+ 6. **Check Test Patterns**:
168
+ ```
169
+ localSearchCode(pattern="describe.*SimilarFeature", path="tests")
170
+ ```
171
+
172
+ **Deliverable**: Clear understanding of what to change and how.
173
+
174
+ ---
175
+
176
+ ## Phase 6: IMPLEMENT (Code Implementation)
177
+
178
+ **Goal**: Execute changes following patterns and plan.
179
+
180
+ **Subagent Pattern**:
181
+ ```
182
+ Task: "Implement [specific component/feature]"
183
+ Scope: Types, logic, integration for one atomic task
184
+ ```
185
+
186
+ **Parallel Implementation** (for independent tasks):
187
+ ```
188
+ Task 1: "Implement types and interfaces" → Types Agent
189
+ Task 2: "Implement core logic" → Logic Agent
190
+ Task 3: "Implement tests" → Test Agent
191
+ ```
192
+
193
+ **Sequential Implementation** (for dependent tasks):
194
+ Execute changes in order:
195
+ 1. **Types First**: Add/modify interfaces and types
196
+ 2. **Core Logic**: Implement the feature
197
+ 3. **Integration**: Wire into existing code
198
+ 4. **Tests**: Add tests following existing patterns
199
+ 5. **Documentation**: Update docs if needed
200
+
201
+ **Implementation Guidelines**:
202
+ - Match existing code style exactly
203
+ - Use existing abstractions, don't create new ones
204
+ - Follow naming conventions found in codebase
205
+ - Add minimal comments (code should be self-documenting)
206
+ - Keep functions focused (Single Responsibility)
207
+
208
+ ---
209
+
210
+ ## Phase 7: VALIDATE (Spec Verification)
211
+
212
+ **Goal**: Verify ALL spec requirements are correctly implemented.
213
+
214
+ **Subagent Pattern**:
215
+ ```
216
+ Task: "Validate [requirement] implementation"
217
+ Scope: Check specific requirement against code
218
+ ```
219
+
220
+ **Parallel Validation Subagents** (spawn via `Task`):
221
+ | Subagent | Focus | Checks |
222
+ |----------|-------|--------|
223
+ | Tech Validator | Technical checks | Compile, lint, tests |
224
+ | Spec Validator | Requirement coverage | Each spec item |
225
+ | Regression Validator | Side effects | Affected areas |
226
+ | Quality Validator | Code quality | Patterns, style |
227
+
228
+ **Technical Validation Gates (ALL MANDATORY)**:
229
+ - [ ] TypeScript compiles (`tsc --noEmit`)
230
+ - [ ] Linter passes (`lint`)
231
+ - [ ] Tests pass (`test`)
232
+ - [ ] New code has tests
233
+ - [ ] No regressions in affected areas
234
+
235
+ **Spec Compliance Validation**:
236
+ | Requirement | Status | Evidence |
237
+ |-------------|--------|----------|
238
+ | [Req 1 from spec] | ✅/❌ | [File:line or test name] |
239
+ | [Req 2 from spec] | ✅/❌ | [File:line or test name] |
240
+
241
+ **Cross-Reference Check**:
242
+ 1. Re-read original spec
243
+ 2. For EACH requirement, find corresponding:
244
+ - Implementation code
245
+ - Test coverage
246
+ - Documentation (if needed)
247
+ 3. Flag any gaps
248
+
249
+ **Outcomes**:
250
+ | Result | Action |
251
+ |--------|--------|
252
+ | ✅ All requirements verified | Complete. Generate changes.md |
253
+ | ⚠️ Minor gaps | Document, ask user if acceptable |
254
+ | ❌ Missing requirements | Loop back to IMPLEMENT |
255
+
256
+ ---
257
+
258
+ ## Multi-Agent Parallelization
259
+
260
+ ### Phase-Level Parallelization
261
+
262
+ | Phase | Parallelizable? | Subagent Strategy |
263
+ |-------|-----------------|-------------------|
264
+ | SPEC | No | Single agent parses spec |
265
+ | SPEC_VALIDATE | Yes | Spawn validators per requirement category |
266
+ | CONTEXT | Yes | Parallel: Structure, Pattern, Test agents |
267
+ | PLAN | Partial | Parallel for independent task areas |
268
+ | RESEARCH | Yes | Parallel: Flow, Pattern, Impact, Test agents |
269
+ | IMPLEMENT | Partial | Parallel for independent components |
270
+ | VALIDATE | Yes | Parallel: Tech, Spec, Regression validators |
271
+
272
+ ### TodoWrite Integration
273
+
274
+ **Master Task Flow**:
275
+ ```
276
+ TodoWrite([
277
+ { id: "spec", content: "Parse specification", status: "completed" },
278
+ { id: "spec-validate", content: "Validate spec completeness", status: "in_progress" },
279
+ { id: "context", content: "Discover codebase context", status: "pending" },
280
+ { id: "plan", content: "Create implementation plan", status: "pending" },
281
+ { id: "research", content: "Deep research per task", status: "pending" },
282
+ { id: "implement", content: "Implement changes", status: "pending" },
283
+ { id: "validate", content: "Validate against spec", status: "pending" }
284
+ ])
285
+ ```
286
+
287
+ ### Spawning Subagents with Task Tool
288
+
289
+ **Pattern for Phase Subagent**:
290
+ ```
291
+ Task: "[Phase]: [Specific Goal]"
292
+ Context: [Relevant files, findings so far]
293
+ Scope: [Bounded deliverable]
294
+ Report: [What to return to main agent]
295
+ ```
296
+
297
+ **Example - CONTEXT Phase**:
298
+ ```
299
+ // Spawn in parallel:
300
+ Task("CONTEXT: Map directory structure", { depth: 2, focus: "src/" })
301
+ Task("CONTEXT: Find similar features", { pattern: "auth", type: "ts" })
302
+ Task("CONTEXT: Analyze test setup", { path: "tests/" })
303
+ ```
304
+
305
+ ### When to Spawn vs Sequential
306
+
307
+ **Spawn Subagents When**:
308
+ - 2+ independent tasks in same phase
309
+ - Research across different code areas
310
+ - Validation of independent requirements
311
+ - Implementation of unrelated components
312
+
313
+ **Stay Sequential When**:
314
+ - Tasks have dependencies
315
+ - Small tasks (overhead > benefit)
316
+ - Need to maintain context flow
317
+ - User interaction required