telos-framework 0.9.2 → 0.10.1
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 +386 -30
- package/lib/installers/platform-adapters.js +216 -0
- package/lib/installers/slash-commands.js +136 -55
- package/lib/sdd/spec-templates.js +82 -46
- package/package.json +1 -1
- package/templates/TELOS_CORE.md +9 -0
- package/templates/commands/init.md +609 -0
- package/templates/commands/quick.md +143 -0
- package/templates/commands/reset.md +96 -0
- package/templates/commands/sdd-context.md +64 -0
- package/templates/commands/sdd-discover.md +59 -0
- package/templates/commands/sdd-generate-tests.md +85 -0
- package/templates/commands/sdd-init.md +46 -0
- package/templates/commands/sdd-validate.md +78 -0
- package/templates/commands/status.md +181 -0
- package/templates/commands/validate.md +190 -0
|
@@ -151,56 +151,412 @@ 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.
|
|
157
158
|
|
|
158
|
-
|
|
159
|
+
Ask:
|
|
159
160
|
|
|
160
|
-
|
|
161
|
+
**What are the key user journeys in your application?**
|
|
161
162
|
|
|
162
|
-
|
|
163
|
+
Examples of user journeys:
|
|
163
164
|
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
|
|
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: Define L2 Contracts (APIs & Components)
|
|
251
|
+
|
|
252
|
+
Now analyze the codebase for existing contracts OR ask the user about them.
|
|
253
|
+
|
|
254
|
+
### 5.1 Check for Existing Code
|
|
255
|
+
|
|
256
|
+
Scan for:
|
|
257
|
+
|
|
258
|
+
- API routes/endpoints (Express, FastAPI, Next.js API routes, etc.)
|
|
259
|
+
- React/Vue/Svelte components
|
|
260
|
+
- Service classes
|
|
261
|
+
- Database models/schemas
|
|
262
|
+
|
|
263
|
+
### 5.2 If Code Exists → Propose Contracts
|
|
264
|
+
|
|
265
|
+
If you found existing APIs/components, propose L2 specs:
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
269
|
+
DETECTED L2 CONTRACTS
|
|
270
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
271
|
+
|
|
272
|
+
Based on your codebase, I found these contracts:
|
|
273
|
+
|
|
274
|
+
APIs:
|
|
275
|
+
- POST /api/auth/login → api-auth-login
|
|
276
|
+
- GET /api/users/:id → api-users-get
|
|
277
|
+
[etc...]
|
|
278
|
+
|
|
279
|
+
Components:
|
|
280
|
+
- LoginForm → component-login-form
|
|
281
|
+
- UserProfile → component-user-profile
|
|
282
|
+
[etc...]
|
|
283
|
+
|
|
284
|
+
Should I create L2 specs for these? (yes/no/select specific ones)
|
|
285
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**STOP and WAIT for user response.**
|
|
289
|
+
|
|
290
|
+
### 5.3 If No Code OR Greenfield → Ask User
|
|
291
|
+
|
|
292
|
+
If no existing code found, ask:
|
|
293
|
+
|
|
294
|
+
**What are the main APIs or components you plan to build?**
|
|
295
|
+
|
|
296
|
+
Examples:
|
|
297
|
+
|
|
298
|
+
- "Authentication API (login, logout, register)"
|
|
299
|
+
- "Product listing component"
|
|
300
|
+
- "Payment processing service"
|
|
301
|
+
|
|
302
|
+
List your key contracts (or say "skip" to define later):
|
|
303
|
+
|
|
304
|
+
**STOP and WAIT for user response.**
|
|
305
|
+
|
|
306
|
+
### 5.4 Create L2 Contract Specs
|
|
307
|
+
|
|
308
|
+
For each contract, create a spec file in `telos/specs/L2-contract/`:
|
|
309
|
+
|
|
310
|
+
**Filename**: `api-[name].md` or `component-[name].md`
|
|
311
|
+
|
|
312
|
+
```markdown
|
|
313
|
+
<!-- telos-metadata
|
|
314
|
+
id: L2:contract:[filename-without-extension]
|
|
315
|
+
level: 2
|
|
316
|
+
title: [Contract Title]
|
|
317
|
+
parent: L3:experience:[related-journey]
|
|
318
|
+
-->
|
|
319
|
+
|
|
320
|
+
# L2: [Contract Title]
|
|
321
|
+
|
|
322
|
+
## Overview
|
|
323
|
+
|
|
324
|
+
[What this API/component does]
|
|
325
|
+
|
|
326
|
+
## Interface
|
|
327
|
+
|
|
328
|
+
### [For APIs]
|
|
329
|
+
|
|
330
|
+
**Endpoint:** `[METHOD] /api/[path]`
|
|
331
|
+
|
|
332
|
+
**Request:** \`\`\`json { "field": "type" } \`\`\`
|
|
333
|
+
|
|
334
|
+
**Response:** \`\`\`json { "field": "type" } \`\`\`
|
|
335
|
+
|
|
336
|
+
**Errors:**
|
|
337
|
+
|
|
338
|
+
- 400: [When/why]
|
|
339
|
+
- 401: [When/why]
|
|
340
|
+
- 404: [When/why]
|
|
341
|
+
|
|
342
|
+
### [For Components]
|
|
343
|
+
|
|
344
|
+
**Props:** \`\`\`typescript interface [ComponentName]Props { prop1: type; prop2:
|
|
345
|
+
type; onEvent?: (data: type) => void; } \`\`\`
|
|
346
|
+
|
|
347
|
+
## Behavior
|
|
168
348
|
|
|
169
|
-
|
|
349
|
+
- [Behavior 1]
|
|
350
|
+
- [Behavior 2]
|
|
170
351
|
|
|
171
|
-
|
|
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
|
|
352
|
+
## Related Specs
|
|
175
353
|
|
|
176
|
-
|
|
354
|
+
- L3: [Parent experience]
|
|
355
|
+
- L1: [Functions needed - to be defined]
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
### 5.5 Confirm Contracts
|
|
359
|
+
|
|
360
|
+
After creating the L2 specs, summarize:
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
364
|
+
L2 CONTRACTS CREATED
|
|
365
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
366
|
+
|
|
367
|
+
Created [N] contract specs:
|
|
368
|
+
|
|
369
|
+
1. telos/specs/L2-contract/[contract-1].md
|
|
370
|
+
"[Contract 1 title]"
|
|
371
|
+
|
|
372
|
+
2. telos/specs/L2-contract/[contract-2].md
|
|
373
|
+
"[Contract 2 title]"
|
|
374
|
+
|
|
375
|
+
[etc...]
|
|
376
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
## Step 6: Define L1 Functions
|
|
380
|
+
|
|
381
|
+
Now identify the key functions needed to implement the L2 contracts.
|
|
382
|
+
|
|
383
|
+
### 6.1 Check for Existing Functions
|
|
384
|
+
|
|
385
|
+
Scan for functions/methods in:
|
|
386
|
+
|
|
387
|
+
- `src/`, `lib/`, `app/` directories
|
|
388
|
+
- Look for exported functions, class methods
|
|
389
|
+
- Focus on business logic, not utility functions
|
|
390
|
+
|
|
391
|
+
### 6.2 If Functions Exist → Propose L1 Specs
|
|
392
|
+
|
|
393
|
+
```
|
|
394
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
395
|
+
DETECTED L1 FUNCTIONS
|
|
396
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
397
|
+
|
|
398
|
+
Found key functions that need specs:
|
|
399
|
+
|
|
400
|
+
From src/auth/:
|
|
401
|
+
- validateToken() → L1:function:src/auth:validateToken
|
|
402
|
+
- hashPassword() → L1:function:src/auth:hashPassword
|
|
403
|
+
|
|
404
|
+
From src/users/:
|
|
405
|
+
- createUser() → L1:function:src/users:createUser
|
|
406
|
+
- getUserById() → L1:function:src/users:getUserById
|
|
407
|
+
|
|
408
|
+
[etc...]
|
|
409
|
+
|
|
410
|
+
Should I create L1 specs for these? (yes/no/select specific ones)
|
|
411
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
**STOP and WAIT for user response.**
|
|
415
|
+
|
|
416
|
+
### 6.3 If No Functions OR Greenfield → Ask User
|
|
417
|
+
|
|
418
|
+
If no existing functions found, ask:
|
|
419
|
+
|
|
420
|
+
**What are the core functions your application needs?**
|
|
421
|
+
|
|
422
|
+
Think about the L2 contracts you defined. What functions implement them?
|
|
423
|
+
|
|
424
|
+
Examples:
|
|
425
|
+
|
|
426
|
+
- "validateToken - checks if JWT is valid"
|
|
427
|
+
- "processPayment - handles Stripe charges"
|
|
428
|
+
- "sendNotification - sends push/email notifications"
|
|
429
|
+
|
|
430
|
+
List key functions (or say "skip" to define later):
|
|
431
|
+
|
|
432
|
+
**STOP and WAIT for user response.**
|
|
433
|
+
|
|
434
|
+
### 6.4 Create L1 Function Specs
|
|
435
|
+
|
|
436
|
+
For each function, create a spec file in `telos/specs/L1-function/`:
|
|
437
|
+
|
|
438
|
+
**Filename**: `[module]-[function-name].md`
|
|
439
|
+
|
|
440
|
+
```markdown
|
|
441
|
+
<!-- telos-metadata
|
|
442
|
+
id: L1:function:[path]:[functionName]
|
|
443
|
+
level: 1
|
|
444
|
+
title: [functionName]
|
|
445
|
+
parent: L2:contract:[related-contract]
|
|
446
|
+
-->
|
|
447
|
+
|
|
448
|
+
# L1: [functionName]
|
|
449
|
+
|
|
450
|
+
## Purpose
|
|
451
|
+
|
|
452
|
+
[What this function does and why]
|
|
453
|
+
|
|
454
|
+
## Signature
|
|
455
|
+
|
|
456
|
+
\`\`\`typescript function [functionName]( param1: Type, param2: Type ):
|
|
457
|
+
ReturnType \`\`\`
|
|
458
|
+
|
|
459
|
+
## Parameters
|
|
460
|
+
|
|
461
|
+
| Name | Type | Description |
|
|
462
|
+
| ------ | ---- | ----------- |
|
|
463
|
+
| param1 | Type | Description |
|
|
464
|
+
| param2 | Type | Description |
|
|
465
|
+
|
|
466
|
+
## Returns
|
|
467
|
+
|
|
468
|
+
| Type | Description |
|
|
469
|
+
| ---------- | --------------- |
|
|
470
|
+
| ReturnType | What it returns |
|
|
177
471
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
472
|
+
## TDD Scenarios
|
|
473
|
+
|
|
474
|
+
### Scenario: [Happy path name]
|
|
475
|
+
|
|
476
|
+
\`\`\`gherkin Given [precondition] When [action] Then [expected result] \`\`\`
|
|
477
|
+
|
|
478
|
+
### Scenario: [Error case name]
|
|
479
|
+
|
|
480
|
+
\`\`\`gherkin Given [precondition] When [action] Then [expected error] \`\`\`
|
|
481
|
+
|
|
482
|
+
### Scenario: [Edge case name]
|
|
483
|
+
|
|
484
|
+
\`\`\`gherkin Given [edge condition] When [action] Then [expected behavior]
|
|
485
|
+
\`\`\`
|
|
486
|
+
|
|
487
|
+
## Related Specs
|
|
488
|
+
|
|
489
|
+
- L2: [Parent contract]
|
|
183
490
|
```
|
|
184
491
|
|
|
185
|
-
|
|
492
|
+
### 6.5 Confirm Functions
|
|
493
|
+
|
|
494
|
+
After creating the L1 specs, summarize:
|
|
495
|
+
|
|
496
|
+
```
|
|
497
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
498
|
+
L1 FUNCTIONS CREATED
|
|
499
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
500
|
+
|
|
501
|
+
Created [N] function specs:
|
|
502
|
+
|
|
503
|
+
1. telos/specs/L1-function/[function-1].md
|
|
504
|
+
"[function1Name]" - [brief description]
|
|
505
|
+
|
|
506
|
+
2. telos/specs/L1-function/[function-2].md
|
|
507
|
+
"[function2Name]" - [brief description]
|
|
508
|
+
|
|
509
|
+
[etc...]
|
|
510
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
## Step 7: Update TELOS.md
|
|
514
|
+
|
|
515
|
+
Update `telos/TELOS.md` with all the specs created:
|
|
516
|
+
|
|
517
|
+
- **User Experiences** section listing all L3 journeys
|
|
518
|
+
- **Spec Levels** table with correct counts for all levels
|
|
519
|
+
- Verify all parent-child relationships are correct
|
|
520
|
+
|
|
521
|
+
## Step 8: Final Summary
|
|
522
|
+
|
|
523
|
+
After saving all specs, provide the final summary:
|
|
524
|
+
|
|
525
|
+
---
|
|
526
|
+
|
|
527
|
+
✅ **Telos initialization complete!**
|
|
528
|
+
|
|
529
|
+
**Your project now has:**
|
|
530
|
+
|
|
531
|
+
- `telos/specs/L4-purpose/purpose.md` - Your project purpose
|
|
532
|
+
- `telos/specs/L3-experience/*.md` - [N] user journey specs
|
|
533
|
+
- `telos/specs/L2-contract/*.md` - [N] API/component contracts
|
|
534
|
+
- `telos/specs/L1-function/*.md` - [N] function specs with TDD scenarios
|
|
535
|
+
- `telos/TELOS.md` - Entry point with workflow guidance
|
|
536
|
+
|
|
537
|
+
**Spec Summary:**
|
|
186
538
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
539
|
+
| Level | Count | Description |
|
|
540
|
+
| ----- | ----- | ----------- |
|
|
541
|
+
| L4 | 1 | Purpose |
|
|
542
|
+
| L3 | [N] | Experiences |
|
|
543
|
+
| L2 | [N] | Contracts |
|
|
544
|
+
| L1 | [N] | Functions |
|
|
192
545
|
|
|
193
546
|
**Next steps:**
|
|
194
547
|
|
|
195
|
-
1.
|
|
196
|
-
2.
|
|
197
|
-
3.
|
|
548
|
+
1. Generate tests: `/telos:sdd-generate-tests` for any L1 spec
|
|
549
|
+
2. Implement code with `@telos` annotations
|
|
550
|
+
3. Validate before commits: `/telos:validate`
|
|
551
|
+
4. For new features: Follow the workflow in `telos/TELOS.md`
|
|
198
552
|
|
|
199
553
|
---
|
|
200
554
|
|
|
201
555
|
## Tips
|
|
202
556
|
|
|
203
557
|
- If README is missing or vague, ask user for clarification
|
|
204
|
-
- For empty/greenfield projects, focus on defining clear
|
|
558
|
+
- For empty/greenfield projects, focus on defining clear specs before coding
|
|
559
|
+
- For brownfield projects, propose specs based on detected code
|
|
205
560
|
- Be conversational - this is a dialogue, not a survey
|
|
561
|
+
- Users can say "skip" at any level to define specs later
|
|
206
562
|
- Remind users that specs come before code
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform Adapters for Telos Commands
|
|
3
|
+
*
|
|
4
|
+
* Transforms centralized command definitions into platform-specific formats.
|
|
5
|
+
*
|
|
6
|
+
* Supported platforms:
|
|
7
|
+
* - claude: .claude/commands/telos/*.md (with frontmatter)
|
|
8
|
+
* - opencode: .opencode/command/telos-*.md (with frontmatter)
|
|
9
|
+
* - cursor: Embedded in .cursorrules (no native slash commands)
|
|
10
|
+
* - cline: Embedded in .clinerules (no native slash commands)
|
|
11
|
+
* - windsurf: Embedded in .windsurfrules (no native slash commands)
|
|
12
|
+
* - roo: Embedded in .roocode (no native slash commands)
|
|
13
|
+
* - gemini: Embedded in GEMINI.md or uses native commands if supported
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const COMMAND_METADATA = {
|
|
17
|
+
// Core commands
|
|
18
|
+
init: {
|
|
19
|
+
description: 'Initialize Telos spec-driven development for this project',
|
|
20
|
+
aliases: ['telos-init', 'telos:init', 'initialize telos', 'setup telos']
|
|
21
|
+
},
|
|
22
|
+
validate: {
|
|
23
|
+
description: 'Validate specs, code links, and tests',
|
|
24
|
+
aliases: ['telos-validate', 'telos:validate', 'check telos', 'validate specs']
|
|
25
|
+
},
|
|
26
|
+
status: {
|
|
27
|
+
description: 'Show current Telos configuration and spec status',
|
|
28
|
+
aliases: ['telos-status', 'telos:status', 'telos info', 'show telos']
|
|
29
|
+
},
|
|
30
|
+
quick: {
|
|
31
|
+
description: 'Quick Telos initialization with auto-accepted AI proposals',
|
|
32
|
+
aliases: ['telos-quick', 'telos:quick', 'quick init', 'fast setup']
|
|
33
|
+
},
|
|
34
|
+
reset: {
|
|
35
|
+
description: 'Clear existing Telos installation and reinitialize',
|
|
36
|
+
aliases: ['telos-reset', 'telos:reset', 'clear telos', 'remove telos']
|
|
37
|
+
},
|
|
38
|
+
// SDD commands
|
|
39
|
+
'sdd-init': {
|
|
40
|
+
description: 'Initialize SDD structure (alternative to init)',
|
|
41
|
+
aliases: ['telos-sdd-init', 'telos:sdd-init', 'sdd init']
|
|
42
|
+
},
|
|
43
|
+
'sdd-discover': {
|
|
44
|
+
description: 'Generate specs from existing code',
|
|
45
|
+
aliases: ['telos-sdd-discover', 'telos:sdd-discover', 'discover specs', 'scan code']
|
|
46
|
+
},
|
|
47
|
+
'sdd-context': {
|
|
48
|
+
description: 'Load spec context for AI work',
|
|
49
|
+
aliases: ['telos-sdd-context', 'telos:sdd-context', 'load context', 'spec context']
|
|
50
|
+
},
|
|
51
|
+
'sdd-validate': {
|
|
52
|
+
description: 'Validate SDD structure and links',
|
|
53
|
+
aliases: ['telos-sdd-validate', 'telos:sdd-validate', 'validate sdd']
|
|
54
|
+
},
|
|
55
|
+
'sdd-generate-tests': {
|
|
56
|
+
description: 'Generate tests from spec scenarios',
|
|
57
|
+
aliases: ['telos-sdd-generate-tests', 'telos:sdd-generate-tests', 'generate tests']
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Platform configurations
|
|
63
|
+
*/
|
|
64
|
+
const PLATFORM_CONFIG = {
|
|
65
|
+
claude: {
|
|
66
|
+
hasNativeCommands: true,
|
|
67
|
+
commandDir: '.claude/commands/telos',
|
|
68
|
+
fileNaming: (name) => `${name}.md`,
|
|
69
|
+
transform: transformForClaude
|
|
70
|
+
},
|
|
71
|
+
opencode: {
|
|
72
|
+
hasNativeCommands: true,
|
|
73
|
+
commandDir: '.opencode/command',
|
|
74
|
+
fileNaming: (name) => `telos-${name}.md`,
|
|
75
|
+
transform: transformForOpencode
|
|
76
|
+
},
|
|
77
|
+
cursor: {
|
|
78
|
+
hasNativeCommands: false,
|
|
79
|
+
configFile: '.cursorrules',
|
|
80
|
+
transform: transformForRulesFile
|
|
81
|
+
},
|
|
82
|
+
cline: {
|
|
83
|
+
hasNativeCommands: false,
|
|
84
|
+
configFile: '.clinerules',
|
|
85
|
+
transform: transformForRulesFile
|
|
86
|
+
},
|
|
87
|
+
windsurf: {
|
|
88
|
+
hasNativeCommands: false,
|
|
89
|
+
configFile: '.windsurfrules',
|
|
90
|
+
transform: transformForRulesFile
|
|
91
|
+
},
|
|
92
|
+
roo: {
|
|
93
|
+
hasNativeCommands: false,
|
|
94
|
+
configFile: '.roocode',
|
|
95
|
+
transform: transformForRulesFile
|
|
96
|
+
},
|
|
97
|
+
gemini: {
|
|
98
|
+
hasNativeCommands: false,
|
|
99
|
+
configFile: 'GEMINI.md',
|
|
100
|
+
transform: transformForRulesFile
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Transform command for Claude Code
|
|
106
|
+
* Adds frontmatter with description
|
|
107
|
+
*/
|
|
108
|
+
function transformForClaude(content, commandName) {
|
|
109
|
+
const meta = COMMAND_METADATA[commandName];
|
|
110
|
+
return `---
|
|
111
|
+
description: ${meta.description}
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
${content}`;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Transform command for OpenCode
|
|
119
|
+
* Adds frontmatter with description
|
|
120
|
+
*/
|
|
121
|
+
function transformForOpencode(content, commandName) {
|
|
122
|
+
const meta = COMMAND_METADATA[commandName];
|
|
123
|
+
return `---
|
|
124
|
+
description: ${meta.description}
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
${content}`;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Transform commands for platforms without native slash commands
|
|
132
|
+
* Embeds command triggers and full instructions in config file
|
|
133
|
+
*/
|
|
134
|
+
function transformForRulesFile(commands) {
|
|
135
|
+
let output = `
|
|
136
|
+
## Telos Commands
|
|
137
|
+
|
|
138
|
+
When the user asks to run any of these commands, follow the instructions below:
|
|
139
|
+
|
|
140
|
+
`;
|
|
141
|
+
|
|
142
|
+
for (const [name, content] of Object.entries(commands)) {
|
|
143
|
+
const meta = COMMAND_METADATA[name];
|
|
144
|
+
output += `### Command: ${name}
|
|
145
|
+
|
|
146
|
+
**Triggers**: ${meta.aliases.map(a => `"${a}"`).join(', ')}
|
|
147
|
+
|
|
148
|
+
**Description**: ${meta.description}
|
|
149
|
+
|
|
150
|
+
<details>
|
|
151
|
+
<summary>Full Instructions (click to expand)</summary>
|
|
152
|
+
|
|
153
|
+
${content}
|
|
154
|
+
|
|
155
|
+
</details>
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return output;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Get platform configuration
|
|
167
|
+
*/
|
|
168
|
+
function getPlatformConfig(platform) {
|
|
169
|
+
return PLATFORM_CONFIG[platform] || null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Check if platform supports native slash commands
|
|
174
|
+
*/
|
|
175
|
+
function hasNativeCommands(platform) {
|
|
176
|
+
const config = PLATFORM_CONFIG[platform];
|
|
177
|
+
return config ? config.hasNativeCommands : false;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Get all supported platforms
|
|
182
|
+
*/
|
|
183
|
+
function getSupportedPlatforms() {
|
|
184
|
+
return Object.keys(PLATFORM_CONFIG);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Get platforms with native command support
|
|
189
|
+
*/
|
|
190
|
+
function getPlatformsWithNativeCommands() {
|
|
191
|
+
return Object.entries(PLATFORM_CONFIG)
|
|
192
|
+
.filter(([_, config]) => config.hasNativeCommands)
|
|
193
|
+
.map(([name, _]) => name);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Get platforms without native command support (need embedding)
|
|
198
|
+
*/
|
|
199
|
+
function getPlatformsWithoutNativeCommands() {
|
|
200
|
+
return Object.entries(PLATFORM_CONFIG)
|
|
201
|
+
.filter(([_, config]) => !config.hasNativeCommands)
|
|
202
|
+
.map(([name, _]) => name);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
module.exports = {
|
|
206
|
+
COMMAND_METADATA,
|
|
207
|
+
PLATFORM_CONFIG,
|
|
208
|
+
transformForClaude,
|
|
209
|
+
transformForOpencode,
|
|
210
|
+
transformForRulesFile,
|
|
211
|
+
getPlatformConfig,
|
|
212
|
+
hasNativeCommands,
|
|
213
|
+
getSupportedPlatforms,
|
|
214
|
+
getPlatformsWithNativeCommands,
|
|
215
|
+
getPlatformsWithoutNativeCommands
|
|
216
|
+
};
|