@lumenflow/cli 1.6.0 → 2.1.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.
Files changed (42) hide show
  1. package/README.md +19 -0
  2. package/dist/__tests__/backlog-prune.test.js +478 -0
  3. package/dist/__tests__/deps-operations.test.js +206 -0
  4. package/dist/__tests__/file-operations.test.js +906 -0
  5. package/dist/__tests__/git-operations.test.js +668 -0
  6. package/dist/__tests__/guards-validation.test.js +416 -0
  7. package/dist/__tests__/init-plan.test.js +340 -0
  8. package/dist/__tests__/lumenflow-upgrade.test.js +107 -0
  9. package/dist/__tests__/metrics-cli.test.js +619 -0
  10. package/dist/__tests__/rotate-progress.test.js +127 -0
  11. package/dist/__tests__/session-coordinator.test.js +109 -0
  12. package/dist/__tests__/state-bootstrap.test.js +432 -0
  13. package/dist/__tests__/trace-gen.test.js +115 -0
  14. package/dist/backlog-prune.js +299 -0
  15. package/dist/deps-add.js +215 -0
  16. package/dist/deps-remove.js +94 -0
  17. package/dist/docs-sync.js +72 -326
  18. package/dist/file-delete.js +236 -0
  19. package/dist/file-edit.js +247 -0
  20. package/dist/file-read.js +197 -0
  21. package/dist/file-write.js +220 -0
  22. package/dist/git-branch.js +187 -0
  23. package/dist/git-diff.js +177 -0
  24. package/dist/git-log.js +230 -0
  25. package/dist/git-status.js +208 -0
  26. package/dist/guard-locked.js +169 -0
  27. package/dist/guard-main-branch.js +202 -0
  28. package/dist/guard-worktree-commit.js +160 -0
  29. package/dist/init-plan.js +337 -0
  30. package/dist/lumenflow-upgrade.js +178 -0
  31. package/dist/metrics-cli.js +433 -0
  32. package/dist/rotate-progress.js +247 -0
  33. package/dist/session-coordinator.js +300 -0
  34. package/dist/state-bootstrap.js +307 -0
  35. package/dist/sync-templates.js +212 -0
  36. package/dist/trace-gen.js +331 -0
  37. package/dist/validate-agent-skills.js +218 -0
  38. package/dist/validate-agent-sync.js +148 -0
  39. package/dist/validate-backlog-sync.js +152 -0
  40. package/dist/validate-skills-spec.js +206 -0
  41. package/dist/validate.js +230 -0
  42. package/package.json +37 -7
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Deps Remove CLI Command
4
+ *
5
+ * Safe wrapper for `pnpm remove` that enforces worktree discipline.
6
+ * Dependencies can only be removed from within a worktree, not from main checkout.
7
+ *
8
+ * WU-1112: INIT-003 Phase 6 - Migrate remaining Tier 1 tools
9
+ *
10
+ * Usage:
11
+ * pnpm deps:remove lodash
12
+ * pnpm deps:remove --filter @lumenflow/cli chalk
13
+ *
14
+ * @see dependency-guard.ts for blocking logic
15
+ */
16
+ import { execSync } from 'node:child_process';
17
+ import { STDIO_MODES, EXIT_CODES } from '@lumenflow/core/dist/wu-constants.js';
18
+ import { runCLI } from './cli-entry-point.js';
19
+ import { parseDepsRemoveArgs, validateWorktreeContext, buildPnpmRemoveCommand, } from './deps-add.js';
20
+ /** Log prefix for console output */
21
+ const LOG_PREFIX = '[deps:remove]';
22
+ /**
23
+ * Print help message for deps-remove
24
+ */
25
+ /* istanbul ignore next -- CLI entry point */
26
+ function printHelp() {
27
+ console.log(`
28
+ Usage: deps-remove <packages...> [options]
29
+
30
+ Remove dependencies with worktree discipline enforcement.
31
+ Must be run from inside a worktree (not main checkout).
32
+
33
+ Arguments:
34
+ packages Package names to remove (e.g., lodash moment)
35
+
36
+ Options:
37
+ -F, --filter <pkg> Filter to specific workspace package
38
+ -h, --help Show this help message
39
+
40
+ Examples:
41
+ deps-remove lodash # Remove lodash from root
42
+ deps-remove -F @lumenflow/cli chalk # Remove chalk from @lumenflow/cli
43
+ deps-remove lodash moment # Remove multiple packages
44
+
45
+ Worktree Discipline:
46
+ This command only works inside a worktree to prevent lockfile
47
+ conflicts on main checkout. Claim a WU first:
48
+
49
+ pnpm wu:claim --id WU-XXXX --lane "Your Lane"
50
+ cd worktrees/<lane>-wu-<id>/
51
+ deps-remove <package>
52
+ `);
53
+ }
54
+ /**
55
+ * Main entry point for deps-remove command
56
+ */
57
+ /* istanbul ignore next -- CLI entry point */
58
+ async function main() {
59
+ const args = parseDepsRemoveArgs(process.argv);
60
+ if (args.help) {
61
+ printHelp();
62
+ process.exit(EXIT_CODES.SUCCESS);
63
+ }
64
+ if (!args.packages || args.packages.length === 0) {
65
+ console.error(`${LOG_PREFIX} Error: No packages specified`);
66
+ printHelp();
67
+ process.exit(EXIT_CODES.ERROR);
68
+ }
69
+ // Validate worktree context
70
+ const validation = validateWorktreeContext(process.cwd());
71
+ if (!validation.valid) {
72
+ console.error(`${LOG_PREFIX} ${validation.error}`);
73
+ console.error(`\nTo fix:\n${validation.fixCommand}`);
74
+ process.exit(EXIT_CODES.ERROR);
75
+ }
76
+ // Build and execute pnpm remove command
77
+ const command = buildPnpmRemoveCommand(args);
78
+ console.log(`${LOG_PREFIX} Running: ${command}`);
79
+ try {
80
+ execSync(command, {
81
+ stdio: STDIO_MODES.INHERIT,
82
+ cwd: process.cwd(),
83
+ });
84
+ console.log(`${LOG_PREFIX} ✅ Dependencies removed successfully`);
85
+ }
86
+ catch (error) {
87
+ console.error(`${LOG_PREFIX} ❌ Failed to remove dependencies`);
88
+ process.exit(EXIT_CODES.ERROR);
89
+ }
90
+ }
91
+ // Run main if executed directly
92
+ if (import.meta.main) {
93
+ runCLI(main);
94
+ }
package/dist/docs-sync.js CHANGED
@@ -2,9 +2,11 @@
2
2
  * @file docs-sync.ts
3
3
  * LumenFlow docs:sync command for syncing agent docs to existing projects (WU-1083)
4
4
  * WU-1085: Added createWUParser for proper --help support
5
+ * WU-1124: Refactored to read templates from bundled files (INIT-004 Phase 2)
5
6
  */
6
7
  import * as fs from 'node:fs';
7
8
  import * as path from 'node:path';
9
+ import { fileURLToPath } from 'node:url';
8
10
  import { createWUParser, WU_OPTIONS } from '@lumenflow/core';
9
11
  /**
10
12
  * WU-1085: CLI option definitions for docs-sync command
@@ -33,6 +35,40 @@ export function parseDocsSyncOptions() {
33
35
  vendor: opts.vendor ?? 'claude',
34
36
  };
35
37
  }
38
+ /**
39
+ * WU-1124: Get the templates directory path
40
+ * Templates are bundled with the CLI package at dist/templates/
41
+ * Falls back to src/templates/ for development
42
+ */
43
+ export function getTemplatesDir() {
44
+ const __filename = fileURLToPath(import.meta.url);
45
+ const __dirname = path.dirname(__filename);
46
+ // In production: dist/docs-sync.js -> templates/
47
+ // In development: src/docs-sync.ts -> ../templates/
48
+ const distTemplates = path.join(__dirname, '..', 'templates');
49
+ if (fs.existsSync(distTemplates)) {
50
+ return distTemplates;
51
+ }
52
+ // Fallback for tests running from src
53
+ const srcTemplates = path.join(__dirname, '..', 'templates');
54
+ if (fs.existsSync(srcTemplates)) {
55
+ return srcTemplates;
56
+ }
57
+ throw new Error(`Templates directory not found at ${distTemplates}`);
58
+ }
59
+ /**
60
+ * WU-1124: Load a template file from the bundled templates directory
61
+ * @param templatePath - Relative path from templates directory (e.g., 'core/ai/onboarding/quick-ref-commands.md.template')
62
+ * @returns Template content as string
63
+ */
64
+ export function loadTemplate(templatePath) {
65
+ const templatesDir = getTemplatesDir();
66
+ const fullPath = path.join(templatesDir, templatePath);
67
+ if (!fs.existsSync(fullPath)) {
68
+ throw new Error(`Template not found: ${templatePath} (looked at ${fullPath})`);
69
+ }
70
+ return fs.readFileSync(fullPath, 'utf-8');
71
+ }
36
72
  /**
37
73
  * Get current date in YYYY-MM-DD format
38
74
  */
@@ -77,317 +113,29 @@ async function createFile(filePath, content, force, result, targetDir) {
77
113
  fs.writeFileSync(filePath, content);
78
114
  result.created.push(relativePath);
79
115
  }
80
- // Agent onboarding docs templates (duplicated from init.ts for modularity)
81
- const QUICK_REF_COMMANDS_TEMPLATE = `# Quick Reference: LumenFlow Commands
82
-
83
- **Last updated:** {{DATE}}
84
-
85
- ---
86
-
87
- ## Project Setup
88
-
89
- | Command | Description |
90
- | --------------------------------------------- | --------------------------------------- |
91
- | \`pnpm exec lumenflow init\` | Scaffold minimal LumenFlow core |
92
- | \`pnpm exec lumenflow init --full\` | Add docs/04-operations task scaffolding |
93
- | \`pnpm exec lumenflow init --framework <name>\` | Add framework hint + overlay docs |
94
- | \`pnpm exec lumenflow init --force\` | Overwrite existing files |
95
-
96
- ---
97
-
98
- ## WU Management
99
-
100
- | Command | Description |
101
- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
102
- | \`pnpm wu:create --id WU-XXX --lane <Lane> --title "Title" --description "..." --acceptance "..." --code-paths "path" --test-paths-unit "path" --exposure backend-only --spec-refs "~/.lumenflow/plans/WU-XXX.md"\` | Create new WU |
103
- | \`pnpm wu:claim --id WU-XXX --lane <Lane>\` | Claim WU (creates worktree) |
104
- | \`pnpm wu:done --id WU-XXX\` | Complete WU (merge, stamp, cleanup) |
105
- | \`pnpm wu:block --id WU-XXX --reason "Reason"\` | Block a WU |
106
- | \`pnpm wu:unblock --id WU-XXX\` | Unblock a WU |
107
-
108
- ---
109
-
110
- ## Gates
111
-
112
- | Command | Description |
113
- | ------------------------ | -------------------------- |
114
- | \`pnpm gates\` | Run all quality gates |
115
- | \`pnpm gates --docs-only\` | Run gates for docs changes |
116
- | \`pnpm format\` | Format all files |
117
- | \`pnpm lint\` | Run linter |
118
- | \`pnpm typecheck\` | Run TypeScript check |
119
-
120
- ---
121
-
122
- ## File Paths
123
-
124
- | Path | Description |
125
- | ----------------------------------------- | -------------------- |
126
- | \`docs/04-operations/tasks/wu/WU-XXX.yaml\` | WU specification |
127
- | \`docs/04-operations/tasks/status.md\` | Current status board |
128
- | \`.lumenflow/stamps/WU-XXX.done\` | Completion stamp |
129
- | \`worktrees/<lane>-wu-xxx/\` | Worktree directory |
130
- `;
131
- const FIRST_WU_MISTAKES_TEMPLATE = `# First WU Mistakes
132
-
133
- **Last updated:** {{DATE}}
134
-
135
- Common mistakes agents make on their first WU, and how to avoid them.
136
-
137
- ---
138
-
139
- ## Mistake 1: Not Using Worktrees
140
-
141
- ### Wrong
142
-
143
- \`\`\`bash
144
- # Working directly in main
145
- vim src/feature.ts
146
- git commit -m "feat: add feature"
147
- git push origin main
148
- \`\`\`
149
-
150
- ### Right
151
-
152
- \`\`\`bash
153
- # Claim first, then work in worktree
154
- pnpm wu:claim --id WU-123 --lane Core
155
- cd worktrees/core-wu-123
156
- vim src/feature.ts
157
- git commit -m "feat: add feature"
158
- git push origin lane/core/wu-123
159
- cd /path/to/main
160
- pnpm wu:done --id WU-123
161
- \`\`\`
162
-
163
- ---
164
-
165
- ## Mistake 2: Forgetting to Run wu:done
166
-
167
- **TL;DR:** After gates pass, ALWAYS run \`pnpm wu:done --id WU-XXX\`.
168
-
169
- ---
170
-
171
- ## Mistake 3: Working Outside code_paths
172
-
173
- Only edit files within the specified \`code_paths\`.
174
-
175
- ---
176
-
177
- ## Quick Checklist
178
-
179
- - [ ] Claim the WU with \`pnpm wu:claim\`
180
- - [ ] cd to the worktree IMMEDIATELY
181
- - [ ] Work only in the worktree
182
- - [ ] Run gates before wu:done
183
- - [ ] ALWAYS run wu:done
184
- `;
185
- const TROUBLESHOOTING_WU_DONE_TEMPLATE = `# Troubleshooting: wu:done Not Run
186
-
187
- **Last updated:** {{DATE}}
188
-
189
- This is the most common mistake agents make.
190
-
191
- ---
192
-
193
- ## The Fix
194
-
195
- ### Rule: ALWAYS Run wu:done
196
-
197
- After gates pass, you MUST run:
198
-
199
- \`\`\`bash
200
- cd /path/to/main
201
- pnpm wu:done --id WU-XXX
202
- \`\`\`
203
-
204
- Do NOT:
205
-
206
- - Ask "Should I run wu:done?"
207
- - Write "To Complete: pnpm wu:done"
208
- - Wait for permission
209
-
210
- ---
211
-
212
- ## What wu:done Does
213
-
214
- 1. Validates the worktree exists and has commits
215
- 2. Runs gates in the worktree (not main)
216
- 3. Fast-forward merges to main
217
- 4. Creates the done stamp
218
- 5. Updates status and backlog docs
219
- 6. Removes the worktree
220
- 7. Pushes to origin
221
- `;
222
- const AGENT_SAFETY_CARD_TEMPLATE = `# Agent Safety Card
223
-
224
- **Last updated:** {{DATE}}
225
-
226
- Quick reference for AI agents working in LumenFlow projects.
227
-
228
- ---
229
-
230
- ## Stop and Ask When
231
-
232
- - Same error repeats 3 times
233
- - Auth or permissions changes needed
234
- - PII/PHI/secrets involved
235
- - Cloud spend decisions
236
-
237
- ---
238
-
239
- ## Never Do
240
-
241
- | Action | Why |
242
- | ------------------------ | ---------------- |
243
- | \`git reset --hard\` | Data loss |
244
- | \`git push --force\` | History rewrite |
245
- | \`--no-verify\` | Bypasses safety |
246
- | Work in main after claim | Breaks isolation |
247
- | Skip wu:done | Incomplete WU |
248
-
249
- ---
250
-
251
- ## Always Do
252
-
253
- | Action | Why |
254
- | -------------------------- | ---------------- |
255
- | Read WU spec first | Understand scope |
256
- | cd to worktree after claim | Isolation |
257
- | Write tests before code | TDD |
258
- | Run gates before wu:done | Quality |
259
- | Run wu:done | Complete WU |
260
- `;
261
- const WU_CREATE_CHECKLIST_TEMPLATE = `# WU Creation Checklist
262
-
263
- **Last updated:** {{DATE}}
264
-
265
- Before running \`pnpm wu:create\`, verify these items.
266
-
267
- ---
268
-
269
- ## Step 1: Check Valid Lanes
270
-
271
- \`\`\`bash
272
- grep -A 30 "lanes:" .lumenflow.config.yaml
273
- \`\`\`
274
-
275
- **Format:** \`"Parent: Sublane"\` (colon + single space)
276
-
277
- ---
278
-
279
- ## Step 2: Required Fields
280
-
281
- | Field | Required For | Example |
282
- |-------|--------------|---------|
283
- | \`--id\` | All | \`WU-1234\` |
284
- | \`--lane\` | All | \`"Experience: Chat"\` |
285
- | \`--title\` | All | \`"Add feature"\` |
286
- | \`--description\` | All | \`"Context: ... Problem: ... Solution: ..."\` |
287
- | \`--acceptance\` | All | \`--acceptance "Works"\` (repeatable) |
288
- | \`--exposure\` | All | \`ui\`, \`api\`, \`backend-only\`, \`documentation\` |
289
- | \`--code-paths\` | Code WUs | \`"src/a.ts,src/b.ts"\` |
290
- | \`--test-paths-unit\` | Code WUs | \`"src/__tests__/a.test.ts"\` |
291
- | \`--spec-refs\` | Feature WUs | \`"~/.lumenflow/plans/WU-XXX.md"\` |
292
-
293
- ---
294
-
295
- ## Step 3: Plan Storage
296
-
297
- Plans go in \`~/.lumenflow/plans/\` (NOT in project):
298
-
299
- \`\`\`bash
300
- mkdir -p ~/.lumenflow/plans
301
- vim ~/.lumenflow/plans/WU-XXX-plan.md
302
- \`\`\`
303
-
304
- Reference in wu:create:
305
- \`\`\`bash
306
- --spec-refs "~/.lumenflow/plans/WU-XXX-plan.md"
307
- \`\`\`
308
-
309
- ---
310
-
311
- ## Step 4: Validate First
312
-
313
- \`\`\`bash
314
- pnpm wu:create --id WU-XXX ... --validate
315
- \`\`\`
316
-
317
- Fix errors, then remove \`--validate\` to create.
318
- `;
319
- // Claude skills templates
320
- const WU_LIFECYCLE_SKILL_TEMPLATE = `---
321
- name: wu-lifecycle
322
- description: Work Unit claim/block/done workflow automation.
323
- version: 1.0.0
324
- ---
325
-
326
- # WU Lifecycle Skill
327
-
328
- ## State Machine
329
-
330
- \`\`\`
331
- ready -> in_progress -> waiting/blocked -> done
332
- \`\`\`
333
-
334
- ## Core Commands
335
-
336
- \`\`\`bash
337
- # Claim WU
338
- pnpm wu:claim --id WU-XXX --lane <lane>
339
- cd worktrees/<lane>-wu-xxx # IMMEDIATELY
340
-
341
- # Complete WU (from main)
342
- cd ../..
343
- pnpm wu:done --id WU-XXX
344
- \`\`\`
345
- `;
346
- const WORKTREE_DISCIPLINE_SKILL_TEMPLATE = `---
347
- name: worktree-discipline
348
- description: Prevents the "absolute path trap" in Write/Edit/Read tools.
349
- version: 1.0.0
350
- ---
351
-
352
- # Worktree Discipline: Absolute Path Trap Prevention
353
-
354
- **Purpose**: Prevent AI agents from bypassing worktree isolation via absolute file paths.
355
-
356
- ## The Absolute Path Trap
357
-
358
- **Problem**: AI agents using Write/Edit/Read tools can bypass worktree isolation by passing absolute paths.
359
-
360
- ## Golden Rules
361
-
362
- 1. **Always verify pwd** before file operations
363
- 2. **Never use absolute paths** in Write/Edit/Read tools
364
- 3. **When in doubt, use relative paths**
365
- `;
366
- const LUMENFLOW_GATES_SKILL_TEMPLATE = `---
367
- name: lumenflow-gates
368
- description: Quality gates troubleshooting (format, lint, typecheck, tests).
369
- version: 1.0.0
370
- ---
371
-
372
- # LumenFlow Gates Skill
373
-
374
- ## Gate Sequence
375
-
376
- \`\`\`
377
- pnpm gates = format:check -> lint -> typecheck -> spec:linter -> tests
378
- \`\`\`
379
-
380
- ## Fix Patterns
381
-
382
- | Gate | Auto-fix | Manual |
383
- | --------- | --------------- | ----------------------------------- |
384
- | Format | \`pnpm format\` | - |
385
- | Lint | \`pnpm lint:fix\` | Fix reported issues |
386
- | Typecheck | - | Fix type errors (first error first) |
387
- | Tests | - | Debug, fix mocks, update snapshots |
388
- `;
116
+ /**
117
+ * WU-1124: Template paths for agent onboarding docs
118
+ * Maps output file names to template paths
119
+ */
120
+ const ONBOARDING_TEMPLATE_PATHS = {
121
+ 'quick-ref-commands.md': 'core/ai/onboarding/quick-ref-commands.md.template',
122
+ 'first-wu-mistakes.md': 'core/ai/onboarding/first-wu-mistakes.md.template',
123
+ 'troubleshooting-wu-done.md': 'core/ai/onboarding/troubleshooting-wu-done.md.template',
124
+ 'agent-safety-card.md': 'core/ai/onboarding/agent-safety-card.md.template',
125
+ 'wu-create-checklist.md': 'core/ai/onboarding/wu-create-checklist.md.template',
126
+ };
127
+ /**
128
+ * WU-1124: Template paths for Claude skills
129
+ * Maps skill names to template paths
130
+ */
131
+ const SKILL_TEMPLATE_PATHS = {
132
+ 'wu-lifecycle': 'vendors/claude/.claude/skills/wu-lifecycle/SKILL.md.template',
133
+ 'worktree-discipline': 'vendors/claude/.claude/skills/worktree-discipline/SKILL.md.template',
134
+ 'lumenflow-gates': 'vendors/claude/.claude/skills/lumenflow-gates/SKILL.md.template',
135
+ };
389
136
  /**
390
137
  * Sync agent onboarding docs to an existing project
138
+ * WU-1124: Now reads templates from bundled files instead of hardcoded strings
391
139
  */
392
140
  export async function syncAgentDocs(targetDir, options) {
393
141
  const result = {
@@ -399,15 +147,17 @@ export async function syncAgentDocs(targetDir, options) {
399
147
  };
400
148
  const onboardingDir = path.join(targetDir, 'docs', '04-operations', '_frameworks', 'lumenflow', 'agent', 'onboarding');
401
149
  await createDirectory(onboardingDir, result, targetDir);
402
- await createFile(path.join(onboardingDir, 'quick-ref-commands.md'), processTemplate(QUICK_REF_COMMANDS_TEMPLATE, tokens), options.force, result, targetDir);
403
- await createFile(path.join(onboardingDir, 'first-wu-mistakes.md'), processTemplate(FIRST_WU_MISTAKES_TEMPLATE, tokens), options.force, result, targetDir);
404
- await createFile(path.join(onboardingDir, 'troubleshooting-wu-done.md'), processTemplate(TROUBLESHOOTING_WU_DONE_TEMPLATE, tokens), options.force, result, targetDir);
405
- await createFile(path.join(onboardingDir, 'agent-safety-card.md'), processTemplate(AGENT_SAFETY_CARD_TEMPLATE, tokens), options.force, result, targetDir);
406
- await createFile(path.join(onboardingDir, 'wu-create-checklist.md'), processTemplate(WU_CREATE_CHECKLIST_TEMPLATE, tokens), options.force, result, targetDir);
150
+ // WU-1124: Load and process templates from bundled files
151
+ for (const [outputFile, templatePath] of Object.entries(ONBOARDING_TEMPLATE_PATHS)) {
152
+ const templateContent = loadTemplate(templatePath);
153
+ const processedContent = processTemplate(templateContent, tokens);
154
+ await createFile(path.join(onboardingDir, outputFile), processedContent, options.force, result, targetDir);
155
+ }
407
156
  return result;
408
157
  }
409
158
  /**
410
159
  * Sync Claude skills to an existing project
160
+ * WU-1124: Now reads templates from bundled files instead of hardcoded strings
411
161
  */
412
162
  export async function syncSkills(targetDir, options) {
413
163
  const result = {
@@ -422,18 +172,14 @@ export async function syncSkills(targetDir, options) {
422
172
  DATE: getCurrentDate(),
423
173
  };
424
174
  const skillsDir = path.join(targetDir, '.claude', 'skills');
425
- // wu-lifecycle skill
426
- const wuLifecycleDir = path.join(skillsDir, 'wu-lifecycle');
427
- await createDirectory(wuLifecycleDir, result, targetDir);
428
- await createFile(path.join(wuLifecycleDir, 'SKILL.md'), processTemplate(WU_LIFECYCLE_SKILL_TEMPLATE, tokens), options.force, result, targetDir);
429
- // worktree-discipline skill
430
- const worktreeDir = path.join(skillsDir, 'worktree-discipline');
431
- await createDirectory(worktreeDir, result, targetDir);
432
- await createFile(path.join(worktreeDir, 'SKILL.md'), processTemplate(WORKTREE_DISCIPLINE_SKILL_TEMPLATE, tokens), options.force, result, targetDir);
433
- // lumenflow-gates skill
434
- const gatesDir = path.join(skillsDir, 'lumenflow-gates');
435
- await createDirectory(gatesDir, result, targetDir);
436
- await createFile(path.join(gatesDir, 'SKILL.md'), processTemplate(LUMENFLOW_GATES_SKILL_TEMPLATE, tokens), options.force, result, targetDir);
175
+ // WU-1124: Load and process skill templates from bundled files
176
+ for (const [skillName, templatePath] of Object.entries(SKILL_TEMPLATE_PATHS)) {
177
+ const skillDir = path.join(skillsDir, skillName);
178
+ await createDirectory(skillDir, result, targetDir);
179
+ const templateContent = loadTemplate(templatePath);
180
+ const processedContent = processTemplate(templateContent, tokens);
181
+ await createFile(path.join(skillDir, 'SKILL.md'), processedContent, options.force, result, targetDir);
182
+ }
437
183
  return result;
438
184
  }
439
185
  /**