spets 0.1.10 → 0.1.11

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/dist/index.js CHANGED
@@ -121,19 +121,19 @@ function createDefaultSteps(spetsDir) {
121
121
  writeFileSync(join(implementDir, "template.md"), getImplementTemplate());
122
122
  }
123
123
  function getPlanInstruction() {
124
- const fullTemplate = readFileSync(join(__dirname, "..", ".spets", "steps", "01-plan", "instruction.md"), "utf-8");
124
+ const fullTemplate = readFileSync(join(__dirname, "..", "templates", "steps", "01-plan", "instruction.md"), "utf-8");
125
125
  return fullTemplate;
126
126
  }
127
127
  function getPlanTemplate() {
128
- const fullTemplate = readFileSync(join(__dirname, "..", ".spets", "steps", "01-plan", "template.md"), "utf-8");
128
+ const fullTemplate = readFileSync(join(__dirname, "..", "templates", "steps", "01-plan", "template.md"), "utf-8");
129
129
  return fullTemplate;
130
130
  }
131
131
  function getImplementInstruction() {
132
- const fullTemplate = readFileSync(join(__dirname, "..", ".spets", "steps", "02-implement", "instruction.md"), "utf-8");
132
+ const fullTemplate = readFileSync(join(__dirname, "..", "templates", "steps", "02-implement", "instruction.md"), "utf-8");
133
133
  return fullTemplate;
134
134
  }
135
135
  function getImplementTemplate() {
136
- const fullTemplate = readFileSync(join(__dirname, "..", ".spets", "steps", "02-implement", "template.md"), "utf-8");
136
+ const fullTemplate = readFileSync(join(__dirname, "..", "templates", "steps", "02-implement", "template.md"), "utf-8");
137
137
  return fullTemplate;
138
138
  }
139
139
  function createClaudeCommand(cwd) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spets",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "Spec Driven Development Execution Framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -8,7 +8,8 @@
8
8
  "spets": "./dist/index.js"
9
9
  },
10
10
  "files": [
11
- "dist"
11
+ "dist",
12
+ "templates"
12
13
  ],
13
14
  "scripts": {
14
15
  "dev": "tsx src/index.ts",
@@ -0,0 +1,327 @@
1
+ # Plan Step
2
+
3
+ You are creating a technical implementation plan for the given task. This is a **read-only exploration phase** - do not modify any files except the plan document itself.
4
+
5
+ ## Your Goal
6
+
7
+ Thoroughly explore the codebase, understand existing patterns, and create a detailed, actionable implementation plan that can be executed with confidence by someone with zero context about the codebase.
8
+
9
+ ## Planning Principles
10
+
11
+ ### Systematic Over Ad-Hoc
12
+ - Be methodical and thorough in exploration
13
+ - Document your findings with evidence (file:line references)
14
+ - Create repeatable patterns
15
+
16
+ ### Test-Driven Development
17
+ - Plan tests BEFORE implementation
18
+ - Every task must have concrete verification criteria
19
+ - Follow existing testing patterns exactly
20
+
21
+ ### Complexity Reduction (YAGNI)
22
+ - Keep tasks small and focused (2-5 minutes each)
23
+ - Avoid premature abstraction
24
+ - Only add what's explicitly needed
25
+ - Ruthlessly remove unnecessary features
26
+
27
+ ### Evidence Over Assumptions
28
+ - Base ALL decisions on actual codebase patterns
29
+ - Quote specific files and lines when referencing patterns
30
+ - NEVER assume - always verify by reading code
31
+
32
+ ## Process
33
+
34
+ ### 1. Understand the Request (2-3 minutes / 5%)
35
+
36
+ **Identify:**
37
+ - Core requirements and constraints
38
+ - Whether this is a new feature, bug fix, refactor, or enhancement
39
+ - Scope and boundaries of the change
40
+ - Success criteria
41
+
42
+ **Detect Intent:**
43
+ - Trivial/Simple: Fast turnaround needed
44
+ - Refactoring: Safety and behavior preservation critical
45
+ - Build from Scratch: Need to discover patterns first
46
+ - Architecture: Long-term impact requires careful consideration
47
+
48
+ **If requirements are unclear:**
49
+ - List specific questions in the YAML frontmatter `open_questions` section
50
+ - Questions should be actionable (not "Should I do X?", but "Which approach: A or B?")
51
+ - Present 2-3 approaches with trade-offs, lead with recommended option
52
+
53
+ **Clearance Check (Run Before Moving to Phase 2):**
54
+ - [ ] Core objective clearly defined?
55
+ - [ ] Scope boundaries established (what's IN, what's OUT)?
56
+ - [ ] No critical ambiguities blocking design?
57
+ - [ ] Technical constraints identified?
58
+
59
+ **If ANY checkbox is unchecked:** List questions in frontmatter and wait for user response.
60
+ **If ALL checked:** Proceed to exploration.
61
+
62
+ ### 2. Explore the Codebase (10-20 minutes / 50%)
63
+
64
+ **CRITICAL: This is the MOST IMPORTANT phase. Spend 50% of planning time here.**
65
+
66
+ **Before exploring, launch background research if needed:**
67
+ - For architecture decisions: Research best practices, existing implementations
68
+ - For new patterns: Find similar implementations in the codebase first
69
+
70
+ **Systematic Exploration Process:**
71
+
72
+ #### A. Find Relevant Files (Use Glob)
73
+ ```bash
74
+ # Examples:
75
+ - Auth-related: **/*auth*.ts, **/*login*.ts
76
+ - Tests: **/*.test.ts, **/*.spec.ts
77
+ - Config: **/*config*.ts, **/config/**
78
+ - Components: src/components/**/*.tsx
79
+ ```
80
+
81
+ #### B. Search for Patterns (Use Grep)
82
+ ```bash
83
+ # Examples:
84
+ - How are API endpoints structured?
85
+ - How are errors handled?
86
+ - How are configs loaded?
87
+ - What testing patterns exist?
88
+ - How are similar features implemented?
89
+ ```
90
+
91
+ #### C. Read Key Files
92
+ - Files that will be modified
93
+ - Similar implementations to use as examples
94
+ - Type definitions and interfaces
95
+ - Test files to understand testing patterns
96
+
97
+ #### D. Document Findings with Evidence
98
+
99
+ **Pattern References (existing code to follow):**
100
+ - `src/services/auth.ts:45-78` - Authentication flow pattern (JWT creation, refresh handling)
101
+ - WHY this matters: Shows how to structure token generation
102
+
103
+ **API/Type References (contracts to implement):**
104
+ - `src/types/user.ts:UserDTO` - Response shape for user endpoints
105
+ - WHY this matters: Ensures type consistency
106
+
107
+ **Test References (testing patterns):**
108
+ - `src/__tests__/auth.test.ts:describe("login")` - Test structure and mocking patterns
109
+ - WHY this matters: Follow same test organization
110
+
111
+ **DON'T just list files - explain WHAT PATTERN to extract and WHY it matters.**
112
+
113
+ **Exploration Checklist (ALL must be checked):**
114
+ - [ ] Found all files that need modification (with exact paths)
115
+ - [ ] Identified similar existing features with file:line references
116
+ - [ ] Understood testing approach (library, location, patterns with examples)
117
+ - [ ] Reviewed type definitions and interfaces (list relevant ones)
118
+ - [ ] Identified integration points and dependencies
119
+ - [ ] Understood error handling patterns (with example reference)
120
+ - [ ] Noted existing utilities to reuse (with references)
121
+ - [ ] Checked for existing TODO/FIXME comments in related code
122
+
123
+ ### 3. Design the Approach (5-10 minutes / 15%)
124
+
125
+ **Consider Multiple Approaches:**
126
+ Present 2-3 approaches if applicable:
127
+
128
+ **Approach 1: [Name]** (Recommended)
129
+ - Description: [How it works]
130
+ - Pros: [Advantages]
131
+ - Cons: [Disadvantages]
132
+ - Why recommended: [Reasoning with evidence from codebase]
133
+
134
+ **Approach 2: [Name]**
135
+ - Description: [How it works]
136
+ - Pros: [Advantages]
137
+ - Cons: [Disadvantages]
138
+ - Why not chosen: [Reasoning]
139
+
140
+ **Architectural Principles:**
141
+ - Follow existing patterns in the codebase (quote specific examples)
142
+ - Avoid over-engineering - only add what's necessary (YAGNI)
143
+ - Prefer simple solutions over complex abstractions
144
+ - Don't create new patterns unless existing ones don't fit
145
+ - Reuse existing utilities and helpers
146
+
147
+ **Test Strategy Decision (MUST decide now):**
148
+ - [ ] TDD (tests first, red-green-refactor) ← Preferred for new functionality
149
+ - [ ] Tests after implementation ← Only if TDD not practical
150
+ - [ ] Manual QA only ← Only if no test infrastructure exists
151
+
152
+ This decision affects ALL task acceptance criteria.
153
+
154
+ ### 4. Break Down Into Tasks (5-10 minutes / 20%)
155
+
156
+ **CRITICAL RULES:**
157
+ - Each task: 2-5 minutes MAXIMUM
158
+ - One discrete action per task
159
+ - Frequent commits after each task
160
+ - Zero-context assumption: Write as if implementer knows nothing
161
+
162
+ **Task Structure (MANDATORY):**
163
+
164
+ ```markdown
165
+ #### Task N: [Verb] [What] in [Specific File]
166
+
167
+ **File:** `src/exact/path/file.ts`
168
+
169
+ **Changes:**
170
+ - Add/Modify: [Specific function, interface, or logic]
171
+ - Code location: [Function name or line reference]
172
+ - Code sample: [If helpful, show expected structure]
173
+
174
+ **Steps:**
175
+ 1. [Granular step 1 with exact details]
176
+ 2. [Granular step 2 with exact details]
177
+ 3. [Granular step 3 with exact details]
178
+
179
+ **Verification:**
180
+ - [ ] Run: `[exact command]`
181
+ - [ ] Expected: [Specific expected output]
182
+ - [ ] Verify: [Specific outcome to check]
183
+
184
+ **Dependencies:** [None / Requires Task X to be completed first]
185
+
186
+ **Parallelizable:** [YES (with Task Y, Z) / NO]
187
+
188
+ **Commit:** `[Descriptive commit message]`
189
+ ```
190
+
191
+ **Good Task Examples:**
192
+ - "Add `GitHubConfig` interface to `src/core/types.ts` with owner/repo/token fields"
193
+ - "Create `getGitHubConfig()` helper in `src/core/config.ts` to read from env vars"
194
+ - "Write unit test for `getGitHubConfig()` in `src/core/config.test.ts`"
195
+
196
+ **Bad Task Examples:**
197
+ - "Implement the feature" (too vague)
198
+ - "Update all files" (too broad, no verification)
199
+ - "Add auth and tests" (multiple discrete actions)
200
+ - "Make it work" (no verification criteria)
201
+
202
+ **Phase Organization:**
203
+ Group tasks into logical phases:
204
+ - Phase 1: Shared infrastructure / type definitions
205
+ - Phase 2: Core implementation
206
+ - Phase 3: Tests
207
+ - Phase 4: Integration
208
+ - Phase 5: Documentation and final verification
209
+
210
+ ### 5. Plan Testing & Verification (3-5 minutes / 10%)
211
+
212
+ **For EVERY task, specify verification:**
213
+
214
+ **Verification Pattern:**
215
+ ```markdown
216
+ **Verification:**
217
+ - [ ] Command: `npm test src/path/test.ts`
218
+ - [ ] Expected: All tests pass (not "should work")
219
+ - [ ] Check: No console errors
220
+ - [ ] Evidence: [How to prove it works]
221
+ ```
222
+
223
+ **Testing Strategy:**
224
+
225
+ **Unit Tests:**
226
+ - Test file: `src/**/*.test.ts` (follow existing naming)
227
+ - Testing library: [Jest/Vitest based on existing patterns]
228
+ - Test cases:
229
+ - [ ] Happy path: [Specific case]
230
+ - [ ] Edge case 1: [Specific case]
231
+ - [ ] Edge case 2: [Specific case]
232
+ - [ ] Error case 1: [Specific case]
233
+
234
+ **Integration Tests:**
235
+ - [ ] [Specific integration test 1]
236
+ - [ ] [Specific integration test 2]
237
+
238
+ **Manual Verification:**
239
+ - [ ] [Specific manual check 1]
240
+ - [ ] [Specific manual check 2]
241
+
242
+ **Anti-Patterns to Avoid:**
243
+ - ❌ Testing mock behavior instead of actual functionality
244
+ - ❌ Adding test-only methods to production code
245
+ - ❌ Mocking without understanding dependencies
246
+ - ❌ Partial mock responses with only known fields
247
+ - ❌ Treating tests as optional
248
+
249
+ ## Anti-Patterns to Avoid
250
+
251
+ ❌ **Don't plan without exploring** - Never create a plan based on assumptions
252
+ ❌ **Don't over-engineer** - Don't add features, abstractions, or "improvements" not requested
253
+ ❌ **Don't ignore existing patterns** - Always follow established conventions
254
+ ❌ **Don't create large tasks** - Break work into 2-5 minute chunks with verification
255
+ ❌ **Don't skip test planning** - Every task needs concrete verification criteria with exact commands
256
+ ❌ **Don't guess file paths** - Use Glob/Grep to find actual files
257
+ ❌ **Don't split into multiple plans** - One plan for entire feature (can have 50+ tasks)
258
+ ❌ **Don't list files without context** - Explain WHAT pattern and WHY it matters
259
+
260
+ ## Pre-Finalization Review (Metis Check)
261
+
262
+ Before finalizing your plan, ask yourself:
263
+
264
+ **Questions Not Asked:**
265
+ - What questions should I have asked but didn't?
266
+ - What user intentions might not be explicitly stated?
267
+ - What ambiguities could derail implementation?
268
+
269
+ **Scope Creep Check:**
270
+ - Am I adding "nice-to-have" features not requested?
271
+ - Am I over-engineering the solution?
272
+ - Are all planned tasks essential?
273
+
274
+ **Completeness Check:**
275
+ - Do ALL tasks have concrete acceptance criteria?
276
+ - Are ≥80% of tasks backed by specific file:line references?
277
+ - Do I have zero assumptions about business logic?
278
+ - Are all edge cases addressed?
279
+
280
+ **If ANY concerns found:** Revise plan before finalizing.
281
+
282
+ ## Output Format
283
+
284
+ Follow the template provided. Your plan should include:
285
+
286
+ 1. **Summary**: 2-3 sentences describing what will be built
287
+ 2. **Codebase Analysis**:
288
+ - Current State: What exists now (with file:line references)
289
+ - Key Findings: Important discoveries from exploration
290
+ 3. **Architecture Decisions**:
291
+ - Chosen Approach with justification
292
+ - Alternatives Considered and why not chosen
293
+ - Pattern References (file:line with WHY each matters)
294
+ 4. **Task Breakdown**:
295
+ - Grouped by phases
296
+ - Each task 2-5 minutes with complete details
297
+ - Verification criteria with exact commands
298
+ - Dependencies and parallelization marked
299
+ 5. **Testing Strategy**:
300
+ - Unit tests (specific test cases)
301
+ - Integration tests
302
+ - Manual verification checklist
303
+ 6. **Acceptance Criteria**: Concrete, verifiable checklist
304
+ 7. **Risks & Considerations**: Edge cases, dependencies, gotchas
305
+ 8. **Implementation Notes**: Code patterns, gotchas, performance considerations
306
+
307
+ ## Time Allocation
308
+
309
+ - Understanding request: 5%
310
+ - **Codebase exploration: 50%** ← This is the most critical phase
311
+ - Approach design: 15%
312
+ - Task breakdown: 20%
313
+ - Testing planning: 10%
314
+
315
+ ## Success Criteria for Your Plan
316
+
317
+ A great plan has:
318
+ - ✅ ALL tasks are 2-5 minutes with exact file paths
319
+ - ✅ ≥80% of tasks reference specific existing code patterns
320
+ - ✅ EVERY task has concrete verification (command + expected output)
321
+ - ✅ Zero assumptions about business logic or patterns
322
+ - ✅ Test strategy decided (TDD / after / manual QA)
323
+ - ✅ Phase-based organization with dependencies marked
324
+ - ✅ Parallelization opportunities identified
325
+ - ✅ One complete plan (not "Phase 1, we'll plan Phase 2 later")
326
+
327
+ **Remember: A great plan is based on deep codebase understanding, not assumptions. The implementer should be able to execute it without any codebase knowledge.**