telos-framework 0.9.2 → 0.10.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/.claude/commands/telos/init.md +111 -22
- package/lib/sdd/spec-templates.js +82 -46
- package/package.json +1 -1
|
@@ -151,9 +151,113 @@ title: [Project Name]
|
|
|
151
151
|
- **Method**: /telos:init
|
|
152
152
|
```
|
|
153
153
|
|
|
154
|
-
## Step 4:
|
|
154
|
+
## Step 4: Define L3 Experiences (User Journeys)
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
Now ask about key user experiences. These are the main things users DO with the
|
|
157
|
+
application.
|
|
158
|
+
|
|
159
|
+
Ask:
|
|
160
|
+
|
|
161
|
+
**What are the key user journeys in your application?**
|
|
162
|
+
|
|
163
|
+
Examples of user journeys:
|
|
164
|
+
|
|
165
|
+
- "User signs up and creates their first project"
|
|
166
|
+
- "User searches for products and completes checkout"
|
|
167
|
+
- "Admin reviews and approves pending submissions"
|
|
168
|
+
|
|
169
|
+
List 2-5 key journeys (or say "skip" if you want to define these later):
|
|
170
|
+
|
|
171
|
+
**STOP and WAIT for user response.**
|
|
172
|
+
|
|
173
|
+
### 4.1 Create L3 Experience Specs
|
|
174
|
+
|
|
175
|
+
For each journey the user provides, create a spec file in
|
|
176
|
+
`telos/specs/L3-experience/`:
|
|
177
|
+
|
|
178
|
+
**Filename**: Convert journey to kebab-case (e.g., `user-signup-flow.md`)
|
|
179
|
+
|
|
180
|
+
```markdown
|
|
181
|
+
<!-- telos-metadata
|
|
182
|
+
id: L3:experience:[filename-without-extension]
|
|
183
|
+
level: 3
|
|
184
|
+
title: [Journey Title]
|
|
185
|
+
parent: L4:purpose
|
|
186
|
+
-->
|
|
187
|
+
|
|
188
|
+
# L3: [Journey Title]
|
|
189
|
+
|
|
190
|
+
## Overview
|
|
191
|
+
|
|
192
|
+
[Brief description of this user journey]
|
|
193
|
+
|
|
194
|
+
## User Story
|
|
195
|
+
|
|
196
|
+
As a [user type], I want to [action] so that [benefit].
|
|
197
|
+
|
|
198
|
+
## Journey Steps
|
|
199
|
+
|
|
200
|
+
1. **[Step 1 name]**
|
|
201
|
+
- User action: [What the user does]
|
|
202
|
+
- System response: [What happens]
|
|
203
|
+
- Success criteria: [How we know it worked]
|
|
204
|
+
|
|
205
|
+
2. **[Step 2 name]**
|
|
206
|
+
- User action: [What the user does]
|
|
207
|
+
- System response: [What happens]
|
|
208
|
+
- Success criteria: [How we know it worked]
|
|
209
|
+
|
|
210
|
+
[Continue for each step...]
|
|
211
|
+
|
|
212
|
+
## Edge Cases
|
|
213
|
+
|
|
214
|
+
- [Edge case 1]: [How it's handled]
|
|
215
|
+
- [Edge case 2]: [How it's handled]
|
|
216
|
+
|
|
217
|
+
## Analytics Events
|
|
218
|
+
|
|
219
|
+
- `[event_name]`: [When it fires, what it tracks]
|
|
220
|
+
|
|
221
|
+
## Related Specs
|
|
222
|
+
|
|
223
|
+
- L2: [Related contracts - to be defined]
|
|
224
|
+
- L1: [Related functions - to be defined]
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### 4.2 Confirm Experiences
|
|
228
|
+
|
|
229
|
+
After creating the L3 specs, summarize:
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
233
|
+
L3 EXPERIENCES CREATED
|
|
234
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
235
|
+
|
|
236
|
+
Created [N] user journey specs:
|
|
237
|
+
|
|
238
|
+
1. telos/specs/L3-experience/[journey-1].md
|
|
239
|
+
"[Journey 1 title]"
|
|
240
|
+
|
|
241
|
+
2. telos/specs/L3-experience/[journey-2].md
|
|
242
|
+
"[Journey 2 title]"
|
|
243
|
+
|
|
244
|
+
[etc...]
|
|
245
|
+
|
|
246
|
+
These journeys will guide your L2 contracts and L1 functions.
|
|
247
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Step 5: Update TELOS.md
|
|
251
|
+
|
|
252
|
+
Update `telos/TELOS.md` to include the experiences. See the template in
|
|
253
|
+
`lib/sdd/spec-templates.js` for the full format. Key sections to update:
|
|
254
|
+
|
|
255
|
+
- **Experiences** section listing all L3 journeys
|
|
256
|
+
- **Spec Levels** table with correct counts
|
|
257
|
+
|
|
258
|
+
## Step 6: Explain the Workflow
|
|
259
|
+
|
|
260
|
+
After saving specs, explain the SDD workflow:
|
|
157
261
|
|
|
158
262
|
---
|
|
159
263
|
|
|
@@ -162,25 +266,10 @@ After saving the purpose spec, explain the SDD workflow:
|
|
|
162
266
|
**Your project now has:**
|
|
163
267
|
|
|
164
268
|
- `telos/specs/L4-purpose/purpose.md` - Your project purpose
|
|
165
|
-
- `telos/specs/L3-experience
|
|
269
|
+
- `telos/specs/L3-experience/*.md` - Your user journey specs
|
|
166
270
|
- `telos/specs/L2-contract/` - For API/component contracts
|
|
167
271
|
- `telos/specs/L1-function/` - For function specs with TDD scenarios
|
|
168
|
-
|
|
169
|
-
**How Spec-Driven Development works:**
|
|
170
|
-
|
|
171
|
-
1. **Before coding**: Create a spec at the appropriate level
|
|
172
|
-
2. **Write tests**: Generate tests from spec scenarios
|
|
173
|
-
3. **Implement**: Write code with `@telos` annotation linking to spec
|
|
174
|
-
4. **Validate**: Run `/telos:validate` before commits
|
|
175
|
-
|
|
176
|
-
**Code annotation example:**
|
|
177
|
-
|
|
178
|
-
```typescript
|
|
179
|
-
// @telos L1:function:src/auth/validation:validateToken
|
|
180
|
-
export function validateToken(token: string): TokenValidation {
|
|
181
|
-
// implementation
|
|
182
|
-
}
|
|
183
|
-
```
|
|
272
|
+
- `telos/TELOS.md` - Entry point with workflow guidance
|
|
184
273
|
|
|
185
274
|
**Available commands:**
|
|
186
275
|
|
|
@@ -192,8 +281,8 @@ export function validateToken(token: string): TokenValidation {
|
|
|
192
281
|
|
|
193
282
|
**Next steps:**
|
|
194
283
|
|
|
195
|
-
1. For existing code: Run `/telos:sdd-discover` to generate specs
|
|
196
|
-
2. For new features:
|
|
284
|
+
1. For existing code: Run `/telos:sdd-discover` to generate L2/L1 specs
|
|
285
|
+
2. For new features: Follow the workflow in `telos/TELOS.md`
|
|
197
286
|
3. Always add `@telos` annotations to link code to specs
|
|
198
287
|
|
|
199
288
|
---
|
|
@@ -201,6 +290,6 @@ export function validateToken(token: string): TokenValidation {
|
|
|
201
290
|
## Tips
|
|
202
291
|
|
|
203
292
|
- If README is missing or vague, ask user for clarification
|
|
204
|
-
- For empty/greenfield projects, focus on defining clear purpose
|
|
293
|
+
- For empty/greenfield projects, focus on defining clear purpose and journeys
|
|
205
294
|
- Be conversational - this is a dialogue, not a survey
|
|
206
295
|
- Remind users that specs come before code
|
|
@@ -244,43 +244,26 @@ function generateSpec(level, data = {}) {
|
|
|
244
244
|
* @returns {string} TELOS.md content
|
|
245
245
|
*/
|
|
246
246
|
function generateTelosEntry(data = {}) {
|
|
247
|
+
// Generate experiences list if provided
|
|
248
|
+
const experiencesList = data.experiences?.length > 0
|
|
249
|
+
? data.experiences.map(e => `- [${e.title}](specs/L3-experience/${e.file})`).join('\n')
|
|
250
|
+
: '_No experiences defined yet. Run `/telos:init` to add user journeys._';
|
|
251
|
+
|
|
247
252
|
return `# TELOS: ${data.projectName || 'Project Name'}
|
|
248
253
|
|
|
249
254
|
> Purpose-driven development with spec-code traceability
|
|
250
255
|
|
|
251
|
-
## Quick Start
|
|
252
|
-
|
|
253
|
-
\`\`\`bash
|
|
254
|
-
telos validate # Validate all specs and links
|
|
255
|
-
telos context <id> # Load recursive context for AI
|
|
256
|
-
telos coverage # Show spec-test coverage
|
|
257
|
-
telos orphans # Find unlinked code
|
|
258
|
-
\`\`\`
|
|
259
|
-
|
|
260
256
|
## Purpose
|
|
261
257
|
|
|
262
258
|
${data.purpose || '[Your project purpose - see L4:purpose spec]'}
|
|
263
259
|
|
|
264
260
|
See: [Full Purpose Spec](specs/L4-purpose/purpose.md)
|
|
265
261
|
|
|
266
|
-
##
|
|
262
|
+
## User Experiences (L3)
|
|
267
263
|
|
|
268
|
-
|
|
269
|
-
L4:purpose ─────────────────────────────────────────────────────┐
|
|
270
|
-
│ ${data.purposeTitle || 'Project Purpose'} │
|
|
271
|
-
│ │
|
|
272
|
-
├── L3:experience ──────────────────────────────────────────────┤
|
|
273
|
-
│ User journeys, UX requirements, analytics │
|
|
274
|
-
│ │
|
|
275
|
-
├── L2:contract ────────────────────────────────────────────────┤
|
|
276
|
-
│ API contracts, component interfaces │
|
|
277
|
-
│ │
|
|
278
|
-
└── L1:function ────────────────────────────────────────────────┤
|
|
279
|
-
Individual functions with TDD scenarios │
|
|
280
|
-
└────────────────────────────────────────────────────────────────┘
|
|
281
|
-
\`\`\`
|
|
264
|
+
${experiencesList}
|
|
282
265
|
|
|
283
|
-
## Spec
|
|
266
|
+
## Spec Hierarchy
|
|
284
267
|
|
|
285
268
|
| Level | Name | Description | Count |
|
|
286
269
|
|-------|------|-------------|-------|
|
|
@@ -289,43 +272,96 @@ L4:purpose ───────────────────────
|
|
|
289
272
|
| L2 | Contract | APIs + component interfaces | ${data.l2Count || 0} |
|
|
290
273
|
| L1 | Function | Functions with TDD | ${data.l1Count || 0} |
|
|
291
274
|
|
|
292
|
-
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## 🚨 IMPORTANT: Feature Request Workflow
|
|
278
|
+
|
|
279
|
+
**When the user requests a new feature, you MUST follow this workflow:**
|
|
280
|
+
|
|
281
|
+
### Step 1: Check Impact on Experiences (L3)
|
|
282
|
+
|
|
283
|
+
Ask: "Does this feature affect any existing user journeys, or create a new one?"
|
|
284
|
+
|
|
285
|
+
- If **new journey**: Create a new L3 spec in \`telos/specs/L3-experience/\`
|
|
286
|
+
- If **modifies journey**: Update the relevant L3 spec first
|
|
287
|
+
- If **no journey impact**: Proceed to Step 2
|
|
288
|
+
|
|
289
|
+
### Step 2: Define or Update Contracts (L2)
|
|
290
|
+
|
|
291
|
+
Before writing ANY code, create/update L2 contract specs:
|
|
292
|
+
|
|
293
|
+
- **New API endpoint?** → Create \`telos/specs/L2-contract/api-[name].md\`
|
|
294
|
+
- **New component?** → Create \`telos/specs/L2-contract/component-[name].md\`
|
|
295
|
+
- **Modifying existing?** → Update the relevant L2 spec
|
|
296
|
+
|
|
297
|
+
L2 specs must include:
|
|
298
|
+
- Interface/API signature
|
|
299
|
+
- Input/output contracts
|
|
300
|
+
- Error handling
|
|
301
|
+
- Parent L3 experience reference
|
|
302
|
+
|
|
303
|
+
### Step 3: Define Functions (L1)
|
|
293
304
|
|
|
294
|
-
|
|
295
|
-
${data.linters?.map(l => `- **${l.name}**: \`${l.config}\``).join('\n') || `- **ESLint**: \`.eslintrc.js\`
|
|
296
|
-
- **Prettier**: \`.prettierrc\`
|
|
297
|
-
- **TypeScript**: \`tsconfig.json\``}
|
|
305
|
+
For each function needed to implement the L2 contracts:
|
|
298
306
|
|
|
299
|
-
|
|
307
|
+
1. Create L1 spec in \`telos/specs/L1-function/\`
|
|
308
|
+
2. Include TDD scenarios (given/when/then)
|
|
309
|
+
3. Reference parent L2 contract
|
|
310
|
+
|
|
311
|
+
### Step 4: Generate Tests
|
|
312
|
+
|
|
313
|
+
\`\`\`bash
|
|
314
|
+
telos spec generate-tests L1:function:[spec-id]
|
|
315
|
+
\`\`\`
|
|
316
|
+
|
|
317
|
+
Or manually create tests with \`@telos-test\` annotations.
|
|
318
|
+
|
|
319
|
+
### Step 5: Implement with Annotations
|
|
300
320
|
|
|
301
321
|
\`\`\`${data.primaryLanguage || 'typescript'}
|
|
302
322
|
// @telos L1:function:src/module:functionName
|
|
303
323
|
export function functionName() {
|
|
304
324
|
// implementation
|
|
305
325
|
}
|
|
326
|
+
\`\`\`
|
|
327
|
+
|
|
328
|
+
### Step 6: Validate Before Commit
|
|
306
329
|
|
|
330
|
+
\`\`\`bash
|
|
331
|
+
telos validate
|
|
332
|
+
\`\`\`
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Quick Reference
|
|
337
|
+
|
|
338
|
+
**Commands:**
|
|
339
|
+
- \`/telos:validate\` - Validate specs, code links, and tests
|
|
340
|
+
- \`/telos:status\` - Show current spec counts and health
|
|
341
|
+
- \`/telos:sdd-discover\` - Generate specs from existing code
|
|
342
|
+
- \`/telos:sdd-context <spec-id>\` - Load context for a spec
|
|
343
|
+
- \`/telos:sdd-generate-tests <spec-id>\` - Generate tests from scenarios
|
|
344
|
+
|
|
345
|
+
**Annotation Format:**
|
|
346
|
+
\`\`\`${data.primaryLanguage || 'typescript'}
|
|
347
|
+
// @telos L1:function:src/module:functionName
|
|
307
348
|
// @telos-test L1:function:src/module:functionName
|
|
308
|
-
|
|
309
|
-
// @telos-scenario L1:function:src/module:functionName:success-case
|
|
310
|
-
it('should handle success case', () => {
|
|
311
|
-
// test
|
|
312
|
-
});
|
|
313
|
-
});
|
|
349
|
+
// @telos-scenario L1:function:src/module:functionName:scenario-name
|
|
314
350
|
\`\`\`
|
|
315
351
|
|
|
316
|
-
|
|
352
|
+
**Spec ID Format:** \`L[level]:[type]:[path]:[name]\`
|
|
317
353
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
354
|
+
Examples:
|
|
355
|
+
- \`L4:purpose\`
|
|
356
|
+
- \`L3:experience:user-signup-flow\`
|
|
357
|
+
- \`L2:contract:api-auth\`
|
|
358
|
+
- \`L1:function:src/auth/validation:validateToken\`
|
|
359
|
+
|
|
360
|
+
---
|
|
325
361
|
|
|
326
362
|
## Links
|
|
327
363
|
|
|
328
|
-
- [
|
|
364
|
+
- [Telos Documentation](https://github.com/telos-framework/init)
|
|
329
365
|
- [Spec-Driven Development Guide](https://telos-framework.dev/sdd)
|
|
330
366
|
`;
|
|
331
367
|
}
|
package/package.json
CHANGED