tlc-claude-code 2.4.1 → 2.4.3

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.
Files changed (34) hide show
  1. package/.claude/commands/tlc/autofix.md +70 -6
  2. package/.claude/commands/tlc/build.md +138 -6
  3. package/.claude/commands/tlc/coverage.md +70 -6
  4. package/.claude/commands/tlc/discuss.md +244 -129
  5. package/.claude/commands/tlc/docs.md +70 -6
  6. package/.claude/commands/tlc/e2e-verify.md +1 -1
  7. package/.claude/commands/tlc/edge-cases.md +70 -6
  8. package/.claude/commands/tlc/plan.md +147 -8
  9. package/.claude/commands/tlc/quick.md +70 -6
  10. package/.claude/commands/tlc/review.md +70 -6
  11. package/.claude/commands/tlc/tlc.md +204 -473
  12. package/CLAUDE.md +6 -5
  13. package/package.json +4 -1
  14. package/scripts/dev-link.sh +29 -0
  15. package/scripts/test-package.sh +54 -0
  16. package/scripts/version-sync.js +42 -0
  17. package/scripts/version-sync.test.js +100 -0
  18. package/server/lib/model-router.js +11 -2
  19. package/server/lib/model-router.test.js +27 -1
  20. package/server/lib/orchestration/codex-orchestrator.js +185 -0
  21. package/server/lib/orchestration/codex-orchestrator.test.js +221 -0
  22. package/server/lib/orchestration/dep-linker.js +61 -0
  23. package/server/lib/orchestration/dep-linker.test.js +174 -0
  24. package/server/lib/router-config.js +18 -3
  25. package/server/lib/router-config.test.js +57 -1
  26. package/server/lib/routing/index.js +34 -0
  27. package/server/lib/routing/index.test.js +33 -0
  28. package/server/lib/routing-command.js +11 -2
  29. package/server/lib/routing-command.test.js +39 -1
  30. package/server/lib/routing-preamble.integration.test.js +319 -0
  31. package/server/lib/routing-preamble.js +116 -0
  32. package/server/lib/routing-preamble.test.js +266 -0
  33. package/server/lib/task-router-config.js +35 -14
  34. package/server/lib/task-router-config.test.js +77 -13
@@ -1,473 +1,204 @@
1
- # /tlc - Smart Entry Point
2
-
3
- One command. Context-aware. Visual dashboard.
4
-
5
- ## Engineering Mindset
6
-
7
- **All TLC code generation follows senior engineer standards:**
8
- - Clean architecture with separated concerns
9
- - SOLID principles strictly applied
10
- - Defensive programming with validation at boundaries
11
- - Performance-aware (O(n) thinking, no N+1 queries)
12
- - Security-first (no secrets in code, sanitize all input)
13
- - Fully testable (dependency injection, pure functions)
14
-
15
- See `/tlc:build` for the complete engineering standards checklist.
16
-
17
- ## What This Does
18
-
19
- Detects project state, checks for TLC version upgrades, and launches the dashboard. If a newer TLC version is installed than the project has configured, it automatically upgrades config and commands before proceeding.
20
-
21
- ## Process
22
-
23
- ### Step 0: Check TLC Version (Upgrade Detection)
24
-
25
- **Run this BEFORE anything else.** Compare installed TLC version against the project's `.tlc.json` version.
26
-
27
- ```bash
28
- # Get installed TLC version
29
- installedVersion=$(node -e "
30
- try {
31
- const p = require('tlc-claude-code/package.json');
32
- console.log(p.version);
33
- } catch(e) {
34
- // Try global
35
- const { execSync } = require('child_process');
36
- try {
37
- const v = execSync('npm list -g tlc-claude-code --json 2>/dev/null', { encoding: 'utf-8' });
38
- console.log(JSON.parse(v).dependencies['tlc-claude-code'].version);
39
- } catch(e2) { console.log('unknown'); }
40
- }
41
- " 2>/dev/null)
42
-
43
- # Get project TLC version from .tlc.json
44
- projectVersion=$(node -e "
45
- try {
46
- const c = require('./.tlc.json');
47
- console.log(c.tlcVersion || '0.0.0');
48
- } catch(e) { console.log('0.0.0'); }
49
- " 2>/dev/null)
50
- ```
51
-
52
- **If `installedVersion` > `projectVersion`:**
53
-
54
- Show upgrade notice and apply automatically:
55
-
56
- ```
57
- ─────────────────────────────────────────────────────
58
- TLC UPGRADE DETECTED
59
- ─────────────────────────────────────────────────────
60
-
61
- Installed: v{installedVersion}
62
- Project: v{projectVersion}
63
-
64
- New in this version:
65
- {list new features see Version Features Map below}
66
-
67
- Applying upgrade...
68
- ```
69
-
70
- Then execute the upgrade steps:
71
-
72
- #### Step 0.1: Merge New Config Sections into .tlc.json
73
-
74
- Read the project's `.tlc.json`. For each new config section introduced since `projectVersion`, **add it ONLY if it doesn't already exist**. Never overwrite existing user settings.
75
-
76
- ```javascript
77
- // Pseudo-code for config merge
78
- const config = JSON.parse(fs.readFileSync('.tlc.json'));
79
-
80
- // Add new sections only if missing
81
- if (!config.router) {
82
- config.router = {
83
- providers: {},
84
- capabilities: {}
85
- };
86
- console.log(' + Added: router (LLM provider routing)');
87
- }
88
-
89
- if (!config.dashboard) {
90
- config.dashboard = {
91
- port: 3147,
92
- auth: false
93
- };
94
- console.log(' + Added: dashboard config');
95
- }
96
-
97
- if (!config.docs) {
98
- config.docs = {
99
- autoSync: false,
100
- screenshots: []
101
- };
102
- console.log(' + Added: docs automation config');
103
- }
104
-
105
- // Update version stamp
106
- config.tlcVersion = installedVersion;
107
-
108
- fs.writeFileSync('.tlc.json', JSON.stringify(config, null, 2));
109
- ```
110
-
111
- #### Step 0.2: Update CLAUDE.md Command Dispatch
112
-
113
- Read the project's `CLAUDE.md`. Check if the command dispatch table exists. If new commands were added since `projectVersion`, append them to the table.
114
-
115
- **How to detect:** Read `.claude/commands/tlc/*.md` directory listing from the installed TLC package. Compare against the dispatch table entries in the project's `CLAUDE.md`. Add any missing rows.
116
-
117
- **Never remove or reorder existing entries.** Only append new ones.
118
-
119
- #### Step 0.3: Sync Command Files
120
-
121
- The `.claude/commands/tlc/` directory should already be up-to-date if the user ran `tlc` (the CLI installer). But verify:
122
-
123
- ```bash
124
- # Check if commands are current
125
- installedCommandCount=$(ls node_modules/tlc-claude-code/.claude/commands/tlc/*.md 2>/dev/null | wc -l)
126
- projectCommandCount=$(ls .claude/commands/tlc/*.md 2>/dev/null | wc -l)
127
-
128
- if [ "$installedCommandCount" -gt "$projectCommandCount" ]; then
129
- echo " + Syncing new commands to .claude/commands/tlc/"
130
- cp node_modules/tlc-claude-code/.claude/commands/tlc/*.md .claude/commands/tlc/
131
- fi
132
- ```
133
-
134
- #### Step 0.4: Detect New LLM Providers
135
-
136
- If the `router` section was just added (or is empty), scan for available CLI tools:
137
-
138
- ```bash
139
- which claude >/dev/null 2>&1 && echo "claude detected"
140
- which codex >/dev/null 2>&1 && echo "codex detected"
141
- which gemini >/dev/null 2>&1 && echo "gemini detected"
142
- ```
143
-
144
- If providers are detected but `router.providers` is empty, offer to configure:
145
-
146
- ```
147
- LLM providers detected: claude, codex
148
-
149
- Configure multi-model routing? (Y/n)
150
- ```
151
-
152
- If yes, populate `router.providers` with detected CLIs and default capability mappings.
153
-
154
- If no, skip — user can run `/tlc:llm config` later.
155
-
156
- #### Step 0.5: Report and Continue
157
-
158
- ```
159
- ─────────────────────────────────────────────────────
160
- UPGRADE COMPLETE
161
- ─────────────────────────────────────────────────────
162
-
163
- Updated .tlc.json:
164
- + router (LLM provider routing)
165
- + dashboard config
166
- + docs automation config
167
- ~ tlcVersion: 0.0.0 → 1.8.2
168
-
169
- Synced:
170
- + 3 new commands added
171
- + CLAUDE.md dispatch table updated
172
-
173
- Configure LLM routing now? → /tlc:llm config
174
- Configure dashboard? → /tlc:dashboard
175
-
176
- Continuing to dashboard...
177
- ─────────────────────────────────────────────────────
178
- ```
179
-
180
- Then continue to Step 1 (launch dashboard) as normal.
181
-
182
- **If versions match:** Skip this step silently. No output.
183
-
184
- #### Version Features Map
185
-
186
- This map tells the upgrade which config sections to add based on version ranges. Update this when new features ship.
187
-
188
- | Since Version | Config Section | Default Value | Description |
189
- |---|---|---|---|
190
- | 1.5.0 | `router` | `{ providers: {}, capabilities: {} }` | LLM multi-model routing |
191
- | 1.5.0 | `enterprise` | `{ enabled: false }` | Enterprise features toggle |
192
- | 1.7.0 | `docs` | `{ autoSync: false, screenshots: [] }` | Documentation automation |
193
- | 1.8.0 | `dashboard` | `{ port: 3147, auth: false }` | Dashboard configuration |
194
- | 1.8.2 | `dashboard.compose` | `"docker-compose.tlc.yml"` | Standalone dashboard compose file |
195
-
196
- ---
197
-
198
- ### Step 1: Launch Dashboard
199
-
200
- Run the TLC dashboard:
201
-
202
- ```bash
203
- # If in TLC repo (development)
204
- cd dashboard && npm run dev
205
-
206
- # If installed globally
207
- tlc-dashboard
208
- ```
209
-
210
- The dashboard shows:
211
- - Project overview (from PROJECT.md)
212
- - Phase progress (from ROADMAP.md)
213
- - Test status (pass/fail counts)
214
- - Available actions
215
-
216
- ### Step 2: Fallback to Text Mode
217
-
218
- If the dashboard cannot be launched (not installed, dependencies missing), fall back to text-based status:
219
-
220
- Check what exists:
221
-
222
- ```
223
- □ PROJECT.md exists?
224
- □ .planning/ directory exists?
225
- □ .planning/ROADMAP.md exists?
226
- □ Test framework configured? (vitest.config.*, pytest.ini, etc.)
227
- □ Test files exist?
228
- □ Source files exist?
229
- ```
230
-
231
- ### Step 3: Route Based on State (Text Fallback)
232
-
233
- **No PROJECT.md → New or Init**
234
- ```
235
- No project detected.
236
-
237
- 1) Start new project (/tlc:new-project)
238
- 2) Add TLC to existing code (/tlc:init)
239
- ```
240
-
241
- **PROJECT.md exists, no roadmap → Need Planning**
242
- ```
243
- Project exists but no roadmap.
244
-
245
- Let's break your project into phases.
246
-
247
- What's the first feature to build?
248
- ```
249
- Then create ROADMAP.md with phases based on discussion.
250
-
251
- **Roadmap exists → Check Phase Status**
252
-
253
- Parse ROADMAP.md to find:
254
- - Completed phases: `[x]` or `[completed]`
255
- - Current phase: `[>]` or `[in progress]` or `[current]`
256
- - Next pending phase: first without marker
257
-
258
- ### Step 4: Determine Current Phase Action
259
-
260
- For the current/next phase, check what exists:
261
-
262
- ```
263
- Phase {N}: {Name}
264
- □ DISCUSSION.md exists? (.planning/phases/{N}-DISCUSSION.md)
265
- □ PLAN.md exists? (.planning/phases/{N}-*-PLAN.md)
266
- □ Tests written? (.planning/phases/{N}-TESTS.md or test files)
267
- □ Implementation done? (check if tests pass)
268
- □ Verified? (.planning/phases/{N}-VERIFIED.md)
269
- ```
270
-
271
- ### Step 5: Present Contextual Action
272
-
273
- Based on phase state, show ONE clear action:
274
-
275
- **Phase not discussed:**
276
- ```
277
- Phase 2: User Dashboard
278
-
279
- Ready to discuss implementation approach.
280
-
281
- → Continue? (Y/n)
282
- ```
283
- Then run discuss flow.
284
-
285
- **Discussed but not planned:**
286
- ```
287
- Phase 2: User Dashboard
288
-
289
- Discussion complete. Ready to create task plan.
290
-
291
- → Continue? (Y/n)
292
- ```
293
- Then run plan flow.
294
-
295
- **Planned but no tests:**
296
- ```
297
- Phase 2: User Dashboard
298
-
299
- Plan ready. 4 tasks to implement.
300
-
301
- Next: Write tests, then build.
302
-
303
- → Continue? (Y/n)
304
- ```
305
- Then run build flow (tests first).
306
-
307
- **Tests written, not implemented:**
308
- ```
309
- Phase 2: User Dashboard
310
-
311
- Tests ready (12 tests, all failing - expected).
312
-
313
- Next: Implement to make tests pass.
314
-
315
- → Continue? (Y/n)
316
- ```
317
- Then run implementation.
318
-
319
- **Implemented, not verified:**
320
- ```
321
- Phase 2: User Dashboard
322
-
323
- Tests passing (12/12)
324
-
325
- Next: Human verification.
326
-
327
- → Continue? (Y/n)
328
- ```
329
- Then run verify flow.
330
-
331
- **Phase complete:**
332
- ```
333
- Phase 2: User Dashboard - Complete
334
-
335
- Moving to Phase 3: Reports
336
-
337
- → Continue? (Y/n)
338
- ```
339
-
340
- ### Step 6: Set Claude Permissions (Automatic)
341
-
342
- **Always ensure `.claude/settings.json` exists with TLC permissions.** Do not ask — just create it if missing, or merge if it exists. TLC cannot function with constant permission prompts.
343
-
344
- ```bash
345
- if [ ! -f ".claude/settings.json" ]; then
346
- # Create with full TLC permissions
347
- fi
348
- ```
349
-
350
- Create or merge into `.claude/settings.json`:
351
- ```json
352
- {
353
- "permissions": {
354
- "allow": [
355
- "Bash(npm *)",
356
- "Bash(npx *)",
357
- "Bash(node *)",
358
- "Bash(git *)",
359
- "Bash(gh *)",
360
- "Bash(ssh *)",
361
- "Bash(scp *)",
362
- "Bash(rsync *)",
363
- "Bash(curl *)",
364
- "Bash(wget *)",
365
- "Bash(docker *)",
366
- "Bash(docker-compose *)",
367
- "Bash(pytest*)",
368
- "Bash(python *)",
369
- "Bash(pip *)",
370
- "Bash(go *)",
371
- "Bash(cargo *)",
372
- "Bash(make *)",
373
- "Bash(cat *)",
374
- "Bash(ls *)",
375
- "Bash(pwd*)",
376
- "Bash(cd *)",
377
- "Bash(mkdir *)",
378
- "Bash(cp *)",
379
- "Bash(mv *)",
380
- "Bash(which *)",
381
- "Bash(echo *)",
382
- "Bash(jq *)",
383
- "Bash(wc *)",
384
- "Bash(head *)",
385
- "Bash(tail *)",
386
- "Bash(sort *)",
387
- "Bash(uniq *)",
388
- "Bash(xargs *)"
389
- ]
390
- }
391
- }
392
- ```
393
-
394
- **This runs on EVERY `/tlc` invocation**, not just first time. If `.claude/settings.json` exists but is missing TLC permissions, merge them in. This ensures permissions stay up to date after TLC updates.
395
-
396
- ### Step 6b: Check Docs Setup (One-Time)
397
-
398
- Check if documentation automation is configured:
399
-
400
- ```bash
401
- if [ ! -f ".github/workflows/docs-sync.yml" ] && [ -d ".git" ]; then
402
- # First time - offer docs setup
403
- fi
404
- ```
405
-
406
- **Skip if already configured or no git repo.** Only ask once per project.
407
-
408
- If missing, offer to set up:
409
-
410
- ```
411
- Documentation Automation
412
-
413
- TLC can automatically maintain your docs:
414
- • Update version references on push
415
- • Sync to GitHub Wiki
416
- • Generate API documentation
417
- • Capture app screenshots
418
-
419
- Set up documentation automation? (Y/n)
420
- ```
421
-
422
- If yes, run `/tlc:docs setup`:
423
- - Creates `docs/` directory
424
- - Adds `.github/workflows/docs-sync.yml`
425
- - Adds npm scripts for docs
426
- - Creates starter documentation
427
-
428
- ### Step 7: Check for Untested Code
429
-
430
- If project has source files without tests:
431
-
432
- ```
433
- Found 5 files without tests:
434
- - src/utils/helpers.ts
435
- - src/api/users.ts
436
- - src/services/email.ts
437
- ...
438
-
439
- Add tests for existing code? (Y/n)
440
- ```
441
-
442
- If yes, run `/tlc:coverage` flow.
443
-
444
- ### Step 8: All Phases Complete
445
-
446
- ```
447
- All phases complete!
448
-
449
- Milestone ready for release.
450
-
451
- 1) Tag release (/tlc:complete)
452
- 2) Start next milestone (/tlc:new-milestone)
453
- 3) Check test coverage (/tlc:coverage)
454
- 4) Update documentation (/tlc:docs)
455
- ```
456
-
457
- ## Usage
458
-
459
- ```
460
- /tlc
461
- ```
462
-
463
- No arguments. Auto-detects everything. Launches dashboard when available.
464
-
465
- ## Why This Exists
466
-
467
- Instead of remembering:
468
- - `/tlc:discuss 2`
469
- - `/tlc:plan 2`
470
- - `/tlc:build 2`
471
- - `/tlc:verify 2`
472
-
473
- Just run `/tlc`. It knows where you are.
1
+ # /tlc - Smart Auto-Runner
2
+
3
+ Detect the current TLC state in one pass, print a minimal status, and run the next safe action automatically.
4
+
5
+ ## What This Does
6
+
7
+ `/tlc` is the default entry point. It should:
8
+
9
+ 1. Read the roadmap once
10
+ 2. Detect the active phase and artifact state
11
+ 3. Print a compact status
12
+ 4. Run the next non-destructive TLC command immediately
13
+
14
+ It should not show menus for normal flow.
15
+
16
+ ## Usage
17
+
18
+ ```text
19
+ /tlc
20
+ /tlc --verbose
21
+ ```
22
+
23
+ - Default mode: minimal output, 3-5 lines max
24
+ - `--verbose`: show the detection details, file checks, and routing reasoning
25
+
26
+ ## Rules
27
+
28
+ - Do the entire state check in one pass
29
+ - Prefer `ROADMAP.md`; if absent, fall back to `.planning/ROADMAP.md` for compatibility
30
+ - Skip dashboard launch
31
+ - Skip docs setup
32
+ - Skip untested code scans
33
+ - Skip permission checks
34
+ - Never auto-run destructive actions like push, tag, deploy, or release
35
+ - If a TLC version upgrade is needed, do it silently and continue without ceremony
36
+
37
+ ## Silent Version Upgrade
38
+
39
+ Before normal routing, compare installed TLC version with the project version in `.tlc.json`.
40
+
41
+ - If installed version is newer, update the project version/config silently
42
+ - Do not print an upgrade banner
43
+ - Do not run a multi-step upgrade ceremony
44
+ - Do not block the normal `/tlc` flow unless the upgrade fails
45
+
46
+ Only mention upgrade details in `--verbose` mode.
47
+
48
+ ## One-Pass Detection
49
+
50
+ ### Step 1: Load Core Context
51
+
52
+ Read, in this order:
53
+
54
+ 1. `ROADMAP.md`
55
+ 2. `.planning/ROADMAP.md` if `ROADMAP.md` does not exist
56
+ 3. `.planning/phases/` for phase artifacts
57
+ 4. `.tlc.json` only if needed for silent version sync
58
+
59
+ If no roadmap exists:
60
+
61
+ - Print a short status saying no roadmap was found
62
+ - Suggest `/tlc:new-project` or `/tlc:init`
63
+ - Stop
64
+
65
+ ### Step 2: Find The Active Phase
66
+
67
+ From the roadmap, identify:
68
+
69
+ - The current phase marked as in progress, current, or active
70
+ - Otherwise the first incomplete phase
71
+ - Otherwise treat all phases as complete
72
+
73
+ Extract:
74
+
75
+ - Phase number
76
+ - Phase name
77
+ - Task count if the roadmap or plan exposes it
78
+ - Completed task count if available
79
+
80
+ ### Step 3: Check Artifacts In The Same Pass
81
+
82
+ For the active phase `N`, check:
83
+
84
+ - Discussion: `.planning/phases/{N}-DISCUSSION.md`
85
+ - Plan: `.planning/phases/{N}-PLAN.md`
86
+ - Verification: `.planning/phases/{N}-VERIFIED.md`
87
+
88
+ If the plan exists, inspect it to determine build state:
89
+
90
+ - Count total tasks from `### Task`
91
+ - Count completed tasks from task headings or checklist markers
92
+ - Identify the next incomplete task title
93
+
94
+ Use these state rules:
95
+
96
+ 1. No discussion file:
97
+ Run `/tlc:discuss {N}`
98
+ 2. Discussion exists, no plan:
99
+ Run `/tlc:plan {N}`
100
+ 3. Plan exists and phase is not fully built:
101
+ Run `/tlc:build {N}`
102
+ 4. Build complete, no verification file:
103
+ Run `/tlc:verify {N}`
104
+ 5. Verification exists or all phases are complete:
105
+ Suggest release, but do not auto-run it
106
+
107
+ ## Output Format
108
+
109
+ Normal output must stay within 3-5 lines.
110
+
111
+ Use this pattern:
112
+
113
+ ```text
114
+ TLC v{version} | Phase {N}: {Name} | {done}/{total} tasks done
115
+ Next: {action summary}
116
+ Running /tlc:{command} {N}...
117
+ ```
118
+
119
+ If there is nothing safe to auto-run:
120
+
121
+ ```text
122
+ TLC v{version} | All phases complete
123
+ Next: release or start the next milestone
124
+ Run /tlc:complete or /tlc:new-milestone
125
+ ```
126
+
127
+ If task counts are unavailable, omit them instead of adding extra explanation.
128
+
129
+ ## Verbose Mode
130
+
131
+ `--verbose` may include:
132
+
133
+ - Which roadmap file was chosen
134
+ - Why a phase was selected
135
+ - Which files were found or missing
136
+ - How task counts were derived
137
+ - Whether a silent version sync happened
138
+ - Why a specific command was selected
139
+
140
+ Verbose mode is for debugging only. Default mode stays compact.
141
+
142
+ ## Routing Logic
143
+
144
+ ### No Discussion
145
+
146
+ Auto-run:
147
+
148
+ ```text
149
+ /tlc:discuss {N}
150
+ ```
151
+
152
+ ### Discussed, No Plan
153
+
154
+ Auto-run:
155
+
156
+ ```text
157
+ /tlc:plan {N}
158
+ ```
159
+
160
+ ### Planned, Not Built
161
+
162
+ Auto-run:
163
+
164
+ ```text
165
+ /tlc:build {N}
166
+ ```
167
+
168
+ Use the next incomplete task from the plan in the status line when available.
169
+
170
+ ### Built, Not Verified
171
+
172
+ Auto-run:
173
+
174
+ ```text
175
+ /tlc:verify {N}
176
+ ```
177
+
178
+ ### All Complete
179
+
180
+ Do not auto-run release actions. Prompt with a safe suggestion only:
181
+
182
+ ```text
183
+ TLC v{version} | All phases complete
184
+ Next: release or start the next milestone
185
+ Run /tlc:complete or /tlc:new-milestone
186
+ ```
187
+
188
+ ## Example
189
+
190
+ ```text
191
+ TLC v2.4.2 | Phase 8: Auth System | 3/5 tasks done
192
+ Next: build task 4 (JWT middleware)
193
+ Running /tlc:build 8...
194
+ ```
195
+
196
+ ## Summary
197
+
198
+ The command behavior is:
199
+
200
+ - detect
201
+ - show status
202
+ - run the next safe step
203
+
204
+ No menu. No dashboard. No recurring setup checks. No destructive auto-actions.