@lumenflow/cli 2.3.2 → 2.5.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 (135) hide show
  1. package/dist/__tests__/init-config-lanes.test.js +131 -0
  2. package/dist/__tests__/init-docs-structure.test.js +119 -0
  3. package/dist/__tests__/init-lane-inference.test.js +125 -0
  4. package/dist/__tests__/init-onboarding-docs.test.js +132 -0
  5. package/dist/__tests__/init-quick-ref.test.js +145 -0
  6. package/dist/__tests__/init-scripts.test.js +96 -0
  7. package/dist/__tests__/init-template-portability.test.js +97 -0
  8. package/dist/__tests__/init.test.js +199 -3
  9. package/dist/__tests__/initiative-add-wu.test.js +420 -0
  10. package/dist/__tests__/initiative-plan-replacement.test.js +162 -0
  11. package/dist/__tests__/initiative-remove-wu.test.js +458 -0
  12. package/dist/__tests__/onboarding-smoke-test.test.js +211 -0
  13. package/dist/__tests__/path-centralization-cli.test.js +234 -0
  14. package/dist/__tests__/plan-create.test.js +126 -0
  15. package/dist/__tests__/plan-edit.test.js +157 -0
  16. package/dist/__tests__/plan-link.test.js +239 -0
  17. package/dist/__tests__/plan-promote.test.js +181 -0
  18. package/dist/__tests__/wu-create-strict.test.js +118 -0
  19. package/dist/__tests__/wu-edit-strict.test.js +109 -0
  20. package/dist/__tests__/wu-validate-strict.test.js +113 -0
  21. package/dist/flow-bottlenecks.js +4 -2
  22. package/dist/flow-report.js +3 -2
  23. package/dist/gates.js +202 -2
  24. package/dist/init.js +720 -40
  25. package/dist/initiative-add-wu.js +112 -16
  26. package/dist/initiative-plan.js +3 -2
  27. package/dist/initiative-remove-wu.js +248 -0
  28. package/dist/mem-context.js +0 -0
  29. package/dist/metrics-snapshot.js +3 -2
  30. package/dist/onboarding-smoke-test.js +400 -0
  31. package/dist/plan-create.js +199 -0
  32. package/dist/plan-edit.js +235 -0
  33. package/dist/plan-link.js +233 -0
  34. package/dist/plan-promote.js +231 -0
  35. package/dist/rotate-progress.js +8 -5
  36. package/dist/spawn-list.js +4 -3
  37. package/dist/state-bootstrap.js +6 -4
  38. package/dist/state-doctor-fix.js +5 -4
  39. package/dist/state-doctor.js +32 -2
  40. package/dist/trace-gen.js +6 -3
  41. package/dist/wu-block.js +16 -5
  42. package/dist/wu-claim.js +15 -9
  43. package/dist/wu-create.js +50 -2
  44. package/dist/wu-deps.js +3 -1
  45. package/dist/wu-done.js +14 -5
  46. package/dist/wu-edit.js +35 -0
  47. package/dist/wu-infer-lane.js +3 -1
  48. package/dist/wu-spawn.js +8 -0
  49. package/dist/wu-unblock.js +34 -2
  50. package/dist/wu-validate.js +25 -17
  51. package/package.json +12 -6
  52. package/templates/core/AGENTS.md.template +2 -2
  53. package/dist/__tests__/init-plan.test.js +0 -340
  54. package/dist/agent-issues-query.d.ts +0 -16
  55. package/dist/agent-log-issue.d.ts +0 -10
  56. package/dist/agent-session-end.d.ts +0 -10
  57. package/dist/agent-session.d.ts +0 -10
  58. package/dist/backlog-prune.d.ts +0 -84
  59. package/dist/cli-entry-point.d.ts +0 -8
  60. package/dist/deps-add.d.ts +0 -91
  61. package/dist/deps-remove.d.ts +0 -17
  62. package/dist/docs-sync.d.ts +0 -50
  63. package/dist/file-delete.d.ts +0 -84
  64. package/dist/file-edit.d.ts +0 -82
  65. package/dist/file-read.d.ts +0 -92
  66. package/dist/file-write.d.ts +0 -90
  67. package/dist/flow-bottlenecks.d.ts +0 -16
  68. package/dist/flow-report.d.ts +0 -16
  69. package/dist/gates.d.ts +0 -94
  70. package/dist/git-branch.d.ts +0 -65
  71. package/dist/git-diff.d.ts +0 -58
  72. package/dist/git-log.d.ts +0 -69
  73. package/dist/git-status.d.ts +0 -58
  74. package/dist/guard-locked.d.ts +0 -62
  75. package/dist/guard-main-branch.d.ts +0 -50
  76. package/dist/guard-worktree-commit.d.ts +0 -59
  77. package/dist/index.d.ts +0 -10
  78. package/dist/init-plan.d.ts +0 -80
  79. package/dist/init-plan.js +0 -337
  80. package/dist/init.d.ts +0 -46
  81. package/dist/initiative-add-wu.d.ts +0 -22
  82. package/dist/initiative-bulk-assign-wus.d.ts +0 -16
  83. package/dist/initiative-create.d.ts +0 -28
  84. package/dist/initiative-edit.d.ts +0 -34
  85. package/dist/initiative-list.d.ts +0 -12
  86. package/dist/initiative-status.d.ts +0 -11
  87. package/dist/lumenflow-upgrade.d.ts +0 -103
  88. package/dist/mem-checkpoint.d.ts +0 -16
  89. package/dist/mem-cleanup.d.ts +0 -29
  90. package/dist/mem-create.d.ts +0 -17
  91. package/dist/mem-export.d.ts +0 -10
  92. package/dist/mem-inbox.d.ts +0 -35
  93. package/dist/mem-init.d.ts +0 -15
  94. package/dist/mem-ready.d.ts +0 -16
  95. package/dist/mem-signal.d.ts +0 -16
  96. package/dist/mem-start.d.ts +0 -16
  97. package/dist/mem-summarize.d.ts +0 -22
  98. package/dist/mem-triage.d.ts +0 -22
  99. package/dist/metrics-cli.d.ts +0 -90
  100. package/dist/metrics-snapshot.d.ts +0 -18
  101. package/dist/orchestrate-init-status.d.ts +0 -11
  102. package/dist/orchestrate-initiative.d.ts +0 -12
  103. package/dist/orchestrate-monitor.d.ts +0 -11
  104. package/dist/release.d.ts +0 -117
  105. package/dist/rotate-progress.d.ts +0 -48
  106. package/dist/session-coordinator.d.ts +0 -74
  107. package/dist/spawn-list.d.ts +0 -16
  108. package/dist/state-bootstrap.d.ts +0 -92
  109. package/dist/sync-templates.d.ts +0 -52
  110. package/dist/trace-gen.d.ts +0 -84
  111. package/dist/validate-agent-skills.d.ts +0 -50
  112. package/dist/validate-agent-sync.d.ts +0 -36
  113. package/dist/validate-backlog-sync.d.ts +0 -37
  114. package/dist/validate-skills-spec.d.ts +0 -40
  115. package/dist/validate.d.ts +0 -60
  116. package/dist/wu-block.d.ts +0 -16
  117. package/dist/wu-claim.d.ts +0 -74
  118. package/dist/wu-cleanup.d.ts +0 -35
  119. package/dist/wu-create.d.ts +0 -69
  120. package/dist/wu-delete.d.ts +0 -21
  121. package/dist/wu-deps.d.ts +0 -13
  122. package/dist/wu-done.d.ts +0 -225
  123. package/dist/wu-edit.d.ts +0 -63
  124. package/dist/wu-infer-lane.d.ts +0 -17
  125. package/dist/wu-preflight.d.ts +0 -47
  126. package/dist/wu-prune.d.ts +0 -16
  127. package/dist/wu-recover.d.ts +0 -37
  128. package/dist/wu-release.d.ts +0 -19
  129. package/dist/wu-repair.d.ts +0 -60
  130. package/dist/wu-spawn-completion.d.ts +0 -10
  131. package/dist/wu-spawn.d.ts +0 -192
  132. package/dist/wu-status.d.ts +0 -25
  133. package/dist/wu-unblock.d.ts +0 -16
  134. package/dist/wu-unlock-lane.d.ts +0 -19
  135. package/dist/wu-validate.d.ts +0 -16
package/dist/init-plan.js DELETED
@@ -1,337 +0,0 @@
1
- #!/usr/bin/env node
2
- /* eslint-disable security/detect-non-literal-fs-filename */
3
- /**
4
- * Init Plan Command (WU-1105)
5
- *
6
- * Links plan files to initiatives by setting the `related_plan` field
7
- * in the initiative YAML.
8
- *
9
- * Usage:
10
- * pnpm init:plan --initiative INIT-001 --plan docs/04-operations/plans/my-plan.md
11
- * pnpm init:plan --initiative INIT-001 --create # Create new plan template
12
- *
13
- * Features:
14
- * - Validates initiative exists before modifying
15
- * - Formats plan path as lumenflow:// URI
16
- * - Idempotent: no error if same plan already linked
17
- * - Warns if replacing existing plan link
18
- * - Can create plan templates with --create
19
- *
20
- * Context: WU-1105 (INIT-003 Phase 3a: Migrate init:plan command)
21
- */
22
- import { getGitForCwd } from '@lumenflow/core/dist/git-adapter.js';
23
- import { die } from '@lumenflow/core/dist/error-handler.js';
24
- import { existsSync, writeFileSync, mkdirSync, readFileSync } from 'node:fs';
25
- import { join, basename } from 'node:path';
26
- import { createWUParser, WU_OPTIONS } from '@lumenflow/core/dist/arg-parser.js';
27
- import { INIT_PATHS } from '@lumenflow/initiatives/dist/initiative-paths.js';
28
- import { INIT_PATTERNS } from '@lumenflow/initiatives/dist/initiative-constants.js';
29
- import { ensureOnMain } from '@lumenflow/core/dist/wu-helpers.js';
30
- import { withMicroWorktree } from '@lumenflow/core/dist/micro-worktree.js';
31
- import { readInitiative } from '@lumenflow/initiatives/dist/initiative-yaml.js';
32
- import { parseYAML, stringifyYAML } from '@lumenflow/core/dist/wu-yaml.js';
33
- import { LOG_PREFIX as CORE_LOG_PREFIX } from '@lumenflow/core/dist/wu-constants.js';
34
- /** Log prefix for console output */
35
- export const LOG_PREFIX = CORE_LOG_PREFIX.INIT_PLAN;
36
- /** Micro-worktree operation name */
37
- const OPERATION_NAME = 'init-plan';
38
- /** Standard plans directory relative to repo root */
39
- const PLANS_DIR = 'docs/04-operations/plans';
40
- /** LumenFlow URI scheme for plan references */
41
- const PLAN_URI_SCHEME = 'lumenflow://plans/';
42
- /**
43
- * Custom option for plan file path
44
- */
45
- const PLAN_OPTION = {
46
- name: 'plan',
47
- flags: '--plan <path>',
48
- description: 'Path to plan file (markdown)',
49
- };
50
- /**
51
- * Custom option for creating new plan template
52
- */
53
- const CREATE_OPTION = {
54
- name: 'create',
55
- flags: '--create',
56
- description: 'Create a new plan template instead of linking existing file',
57
- };
58
- /**
59
- * Validate Initiative ID format
60
- * @param id - Initiative ID to validate
61
- * @throws Error if format is invalid
62
- */
63
- export function validateInitIdFormat(id) {
64
- if (!INIT_PATTERNS.INIT_ID.test(id)) {
65
- die(`Invalid Initiative ID format: "${id}"\n\n` +
66
- `Expected format: INIT-<number> or INIT-NAME (e.g., INIT-001, INIT-TOOLING)`);
67
- }
68
- }
69
- /**
70
- * Validate plan file path
71
- * @param planPath - Path to plan file
72
- * @throws Error if path is invalid or file doesn't exist
73
- */
74
- export function validatePlanPath(planPath) {
75
- if (!planPath.endsWith('.md')) {
76
- die(`Invalid plan file format: "${planPath}"\n\nPlan files must be markdown (.md)`);
77
- }
78
- if (!existsSync(planPath)) {
79
- die(`Plan file not found: "${planPath}"\n\nUse --create to create a new plan template`);
80
- }
81
- }
82
- /**
83
- * Format plan path as lumenflow:// URI
84
- *
85
- * Extracts the filename (and any subdirectory within plans/) and creates
86
- * a standardized URI for the plan reference.
87
- *
88
- * @param planPath - Path to plan file (can be relative or absolute)
89
- * @returns lumenflow://plans/<filename> URI
90
- */
91
- export function formatPlanUri(planPath) {
92
- // Try to extract path relative to plans directory
93
- const plansMarker = '/plans/';
94
- const plansIndex = planPath.indexOf(plansMarker);
95
- if (plansIndex !== -1) {
96
- // Extract everything after /plans/
97
- const relativePath = planPath.substring(plansIndex + plansMarker.length);
98
- return `${PLAN_URI_SCHEME}${relativePath}`;
99
- }
100
- // Fallback: just use the filename
101
- const filename = basename(planPath);
102
- return `${PLAN_URI_SCHEME}${filename}`;
103
- }
104
- /**
105
- * Check if initiative exists and return the document
106
- * @param initId - Initiative ID to check
107
- * @returns Initiative document
108
- * @throws Error if initiative not found
109
- */
110
- export function checkInitiativeExists(initId) {
111
- const initPath = INIT_PATHS.INITIATIVE(initId);
112
- if (!existsSync(initPath)) {
113
- die(`Initiative not found: ${initId}\n\nFile does not exist: ${initPath}`);
114
- }
115
- return readInitiative(initPath, initId);
116
- }
117
- /**
118
- * Update initiative with plan reference in micro-worktree
119
- *
120
- * Uses raw YAML parsing to preserve unknown fields like related_plan
121
- * that are not in the strict initiative schema.
122
- *
123
- * @param worktreePath - Path to micro-worktree
124
- * @param initId - Initiative ID
125
- * @param planUri - Plan URI to set
126
- * @returns True if changes were made, false if already linked
127
- */
128
- export function updateInitiativeWithPlan(worktreePath, initId, planUri) {
129
- const initRelPath = INIT_PATHS.INITIATIVE(initId);
130
- const initAbsPath = join(worktreePath, initRelPath);
131
- // Read raw YAML to preserve unknown fields like related_plan
132
- // (readInitiative strips them via zod schema validation)
133
- const rawText = readFileSync(initAbsPath, { encoding: 'utf-8' });
134
- const doc = parseYAML(rawText);
135
- // Validate ID matches
136
- if (doc.id !== initId) {
137
- die(`Initiative YAML id mismatch. Expected ${initId}, found ${doc.id}`);
138
- }
139
- // Check for existing plan link
140
- const existingPlan = doc.related_plan;
141
- if (existingPlan === planUri) {
142
- // Already linked to same plan - idempotent
143
- return false;
144
- }
145
- if (existingPlan && existingPlan !== planUri) {
146
- // Different plan already linked - warn but proceed
147
- console.warn(`${LOG_PREFIX} Replacing existing related_plan: ${existingPlan} -> ${planUri}`);
148
- }
149
- // Update related_plan field
150
- doc.related_plan = planUri;
151
- const out = stringifyYAML(doc);
152
- writeFileSync(initAbsPath, out, { encoding: 'utf-8' });
153
- console.log(`${LOG_PREFIX} Updated ${initId} with related_plan: ${planUri}`);
154
- return true;
155
- }
156
- /**
157
- * Create a plan template file
158
- *
159
- * @param worktreePath - Path to repo root or worktree
160
- * @param initId - Initiative ID
161
- * @param title - Initiative title
162
- * @returns Path to created file
163
- * @throws Error if file already exists
164
- */
165
- export function createPlanTemplate(worktreePath, initId, title) {
166
- const slug = title
167
- .toLowerCase()
168
- .replace(/[^a-z0-9]+/g, '-')
169
- .replace(/^-|-$/g, '')
170
- .substring(0, 30);
171
- const filename = `${initId}-${slug}.md`;
172
- const plansDir = join(worktreePath, PLANS_DIR);
173
- const planPath = join(plansDir, filename);
174
- if (existsSync(planPath)) {
175
- die(`Plan file already exists: ${planPath}\n\nUse --plan to link an existing file`);
176
- }
177
- // Ensure plans directory exists
178
- if (!existsSync(plansDir)) {
179
- mkdirSync(plansDir, { recursive: true });
180
- }
181
- const template = `# ${initId} Plan - ${title}
182
-
183
- ## Goal
184
-
185
- <!-- What is the primary objective of this initiative? -->
186
-
187
- ## Scope
188
-
189
- <!-- What is in scope and out of scope? -->
190
-
191
- ## Approach
192
-
193
- <!-- How will you achieve the goal? Key phases or milestones? -->
194
-
195
- ## Success Criteria
196
-
197
- <!-- How will you know when this is complete? Measurable outcomes? -->
198
-
199
- ## Risks
200
-
201
- <!-- What could go wrong? How will you mitigate? -->
202
-
203
- ## References
204
-
205
- - Initiative: ${initId}
206
- - Created: ${new Date().toISOString().split('T')[0]}
207
- `;
208
- writeFileSync(planPath, template, { encoding: 'utf-8' });
209
- console.log(`${LOG_PREFIX} Created plan template: ${planPath}`);
210
- return planPath;
211
- }
212
- /**
213
- * Generate commit message for plan link operation
214
- */
215
- export function getCommitMessage(initId, planUri) {
216
- const filename = planUri.replace(PLAN_URI_SCHEME, '');
217
- return `docs: link plan ${filename} to ${initId.toLowerCase()}`;
218
- }
219
- async function main() {
220
- const args = createWUParser({
221
- name: 'init-plan',
222
- description: 'Link a plan file to an initiative',
223
- options: [WU_OPTIONS.initiative, PLAN_OPTION, CREATE_OPTION],
224
- required: ['initiative'],
225
- allowPositionalId: false,
226
- });
227
- const initId = args.initiative;
228
- const planPath = args.plan;
229
- const shouldCreate = args.create;
230
- // Validate inputs
231
- validateInitIdFormat(initId);
232
- // Check initiative exists first (before any mutations)
233
- const initDoc = checkInitiativeExists(initId);
234
- const initTitle = initDoc.title;
235
- // Determine plan path and URI
236
- let targetPlanPath;
237
- let planUri;
238
- if (shouldCreate) {
239
- // Create mode - will create template and link it
240
- console.log(`${LOG_PREFIX} Creating plan template for ${initId}...`);
241
- // Ensure on main for micro-worktree operations
242
- await ensureOnMain(getGitForCwd());
243
- try {
244
- await withMicroWorktree({
245
- operation: OPERATION_NAME,
246
- id: initId,
247
- logPrefix: LOG_PREFIX,
248
- pushOnly: true,
249
- execute: async ({ worktreePath }) => {
250
- // Create plan template
251
- targetPlanPath = createPlanTemplate(worktreePath, initId, initTitle);
252
- planUri = formatPlanUri(targetPlanPath);
253
- // Update initiative with plan link
254
- updateInitiativeWithPlan(worktreePath, initId, planUri);
255
- // Return files to commit
256
- const planRelPath = targetPlanPath.replace(worktreePath + '/', '');
257
- return {
258
- commitMessage: getCommitMessage(initId, planUri),
259
- files: [planRelPath, INIT_PATHS.INITIATIVE(initId)],
260
- };
261
- },
262
- });
263
- console.log(`\n${LOG_PREFIX} Transaction complete!`);
264
- console.log(`\nPlan Linked:`);
265
- console.log(` Initiative: ${initId}`);
266
- console.log(` Plan URI: ${planUri}`);
267
- console.log(` File: ${targetPlanPath}`);
268
- console.log(`\nNext steps:`);
269
- console.log(` 1. Edit the plan file with your goals and approach`);
270
- console.log(` 2. View initiative: pnpm initiative:status ${initId}`);
271
- }
272
- catch (error) {
273
- die(`Transaction failed: ${error.message}\n\n` +
274
- `Micro-worktree cleanup was attempted automatically.\n` +
275
- `If issue persists, check for orphaned branches: git branch | grep tmp/${OPERATION_NAME}`);
276
- }
277
- }
278
- else if (planPath) {
279
- // Link existing file mode
280
- validatePlanPath(planPath);
281
- planUri = formatPlanUri(planPath);
282
- console.log(`${LOG_PREFIX} Linking plan to ${initId}...`);
283
- // Check for idempotent case before micro-worktree
284
- const existingPlan = initDoc.related_plan;
285
- if (existingPlan === planUri) {
286
- console.log(`${LOG_PREFIX} Plan already linked (idempotent - no changes needed)`);
287
- console.log(`\n${LOG_PREFIX} ${initId} already has related_plan: ${planUri}`);
288
- return;
289
- }
290
- // Ensure on main for micro-worktree operations
291
- await ensureOnMain(getGitForCwd());
292
- try {
293
- await withMicroWorktree({
294
- operation: OPERATION_NAME,
295
- id: initId,
296
- logPrefix: LOG_PREFIX,
297
- pushOnly: true,
298
- execute: async ({ worktreePath }) => {
299
- // Update initiative with plan link
300
- const changed = updateInitiativeWithPlan(worktreePath, initId, planUri);
301
- if (!changed) {
302
- console.log(`${LOG_PREFIX} No changes detected (concurrent link operation)`);
303
- }
304
- return {
305
- commitMessage: getCommitMessage(initId, planUri),
306
- files: [INIT_PATHS.INITIATIVE(initId)],
307
- };
308
- },
309
- });
310
- console.log(`\n${LOG_PREFIX} Transaction complete!`);
311
- console.log(`\nPlan Linked:`);
312
- console.log(` Initiative: ${initId}`);
313
- console.log(` Plan URI: ${planUri}`);
314
- console.log(` File: ${planPath}`);
315
- console.log(`\nNext steps:`);
316
- console.log(` - View initiative: pnpm initiative:status ${initId}`);
317
- }
318
- catch (error) {
319
- die(`Transaction failed: ${error.message}\n\n` +
320
- `Micro-worktree cleanup was attempted automatically.\n` +
321
- `If issue persists, check for orphaned branches: git branch | grep tmp/${OPERATION_NAME}`);
322
- }
323
- }
324
- else {
325
- die('Either --plan or --create is required\n\n' +
326
- 'Usage:\n' +
327
- ' pnpm init:plan --initiative INIT-001 --plan docs/04-operations/plans/my-plan.md\n' +
328
- ' pnpm init:plan --initiative INIT-001 --create');
329
- }
330
- }
331
- // Guard main() for testability - use import.meta.main (WU-1071)
332
- import { runCLI } from './cli-entry-point.js';
333
- if (import.meta.main) {
334
- runCLI(main);
335
- }
336
- // Export for testing
337
- export { main };
package/dist/init.d.ts DELETED
@@ -1,46 +0,0 @@
1
- /**
2
- * @file init.ts
3
- * LumenFlow project scaffolding command (WU-1045)
4
- * WU-1006: Library-First - use core defaults for config generation
5
- * WU-1028: Vendor-agnostic core + vendor overlays
6
- * WU-1085: Added createWUParser for proper --help support
7
- */
8
- /**
9
- * WU-1085: Parse init command options using createWUParser
10
- * Provides proper --help, --version, and option parsing
11
- */
12
- export declare function parseInitOptions(): {
13
- force: boolean;
14
- full: boolean;
15
- framework?: string;
16
- vendor?: VendorType;
17
- preset?: GatePresetType;
18
- };
19
- /**
20
- * Supported vendor integrations
21
- */
22
- export type VendorType = 'claude' | 'cursor' | 'aider' | 'all' | 'none';
23
- export type DefaultClient = 'claude-code' | 'none';
24
- export type GatePresetType = 'node' | 'python' | 'go' | 'rust' | 'dotnet';
25
- export interface ScaffoldOptions {
26
- force: boolean;
27
- full: boolean;
28
- framework?: string;
29
- vendor?: VendorType;
30
- defaultClient?: DefaultClient;
31
- /** WU-1067: Gate preset to populate in gates.execution */
32
- gatePreset?: GatePresetType;
33
- }
34
- export interface ScaffoldResult {
35
- created: string[];
36
- skipped: string[];
37
- }
38
- /**
39
- * Scaffold a new LumenFlow project
40
- */
41
- export declare function scaffoldProject(targetDir: string, options: ScaffoldOptions): Promise<ScaffoldResult>;
42
- /**
43
- * CLI entry point
44
- * WU-1085: Updated to use parseInitOptions for proper --help support
45
- */
46
- export declare function main(): Promise<void>;
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Initiative Add WU Command (WU-1389)
4
- *
5
- * Links an existing WU to an initiative bidirectionally:
6
- * 1. Adds `initiative: INIT-NNN` field to WU YAML
7
- * 2. Adds WU ID to initiative `wus: []` array
8
- *
9
- * Uses micro-worktree isolation for atomic operations.
10
- *
11
- * Usage:
12
- * pnpm initiative:add-wu --initiative INIT-001 --wu WU-123
13
- *
14
- * Features:
15
- * - Validates both WU and initiative exist before modifying
16
- * - Idempotent: no error if link already exists
17
- * - Errors if WU is already linked to a different initiative
18
- * - Atomic: both files updated in single commit
19
- *
20
- * Context: WU-1389 (initial implementation)
21
- */
22
- export {};
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Initiative Bulk Assign WUs CLI (WU-1018)
4
- *
5
- * Bulk-assigns orphaned WUs to initiatives based on lane prefix rules.
6
- * Uses micro-worktree isolation for race-safe commits.
7
- *
8
- * Usage:
9
- * pnpm initiative:bulk-assign # Dry-run (default)
10
- * LUMENFLOW_ADMIN=1 pnpm initiative:bulk-assign --apply # Apply changes
11
- * pnpm initiative:bulk-assign --config custom-config.yaml # Custom config
12
- * pnpm initiative:bulk-assign --reconcile-initiative INIT-001
13
- *
14
- * @module initiative-bulk-assign-wus
15
- */
16
- export {};
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Initiative Create Helper (WU-1247, WU-1439)
4
- *
5
- * Race-safe Initiative creation using micro-worktree isolation.
6
- *
7
- * Canonical sequence:
8
- * 1) Validate inputs (id, slug, title)
9
- * 2) Ensure on main branch
10
- * 3) Use micro-worktree to atomically:
11
- * a) Create temp branch without switching main checkout
12
- * b) Create INIT-{id}.yaml in micro-worktree
13
- * c) Commit with "docs: create init-{id} for <title>" message
14
- * d) Merge to main with ff-only (retry with rebase if needed)
15
- * e) Push to origin/main
16
- * f) Cleanup temp branch and micro-worktree
17
- *
18
- * Benefits:
19
- * - Main checkout never modified (no impact on other agents)
20
- * - Race conditions handled via rebase+retry (up to 3 attempts)
21
- * - Cleanup guaranteed even on failure
22
- *
23
- * Usage:
24
- * pnpm initiative:create --id INIT-001 --slug shock-protocol --title "Shock Protocol Implementation"
25
- *
26
- * Context: WU-1247 (original implementation), WU-1439 (micro-worktree migration)
27
- */
28
- export {};
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Initiative Edit Helper
4
- *
5
- * Race-safe Initiative editing using micro-worktree isolation (WU-1451).
6
- *
7
- * Enables editing Initiative YAML files with atomic commits, perfect for:
8
- * - Updating initiative status
9
- * - Setting blocked_by and blocked_reason
10
- * - Unblocking initiatives
11
- * - Adding lanes
12
- * - Appending notes
13
- * - Fixing malformed created dates (WU-2547)
14
- *
15
- * Uses the micro-worktree pattern with pushOnly mode (WU-1435):
16
- * 1) Validate inputs (Initiative exists, status is valid enum)
17
- * 2) Ensure main is clean and up-to-date with origin
18
- * 3) Create temp branch WITHOUT switching (main checkout stays on main)
19
- * 4) Create micro-worktree in /tmp pointing to temp branch
20
- * 5) Apply edits in micro-worktree
21
- * 6) Commit, push directly to origin/main
22
- * 7) Cleanup temp branch and micro-worktree
23
- *
24
- * Usage:
25
- * pnpm initiative:edit --id INIT-001 --status in_progress
26
- * pnpm initiative:edit --id INIT-001 --blocked-by INIT-002 --blocked-reason "Waiting for Phase 1"
27
- * pnpm initiative:edit --id INIT-001 --unblock
28
- * pnpm initiative:edit --id INIT-001 --add-lane "Operations: Tooling"
29
- * pnpm initiative:edit --id INIT-001 --notes "Phase 2 started"
30
- *
31
- * Part of WU-1451: Add initiative:edit command for updating initiative status and blockers
32
- * @see {@link tools/lib/micro-worktree.mjs} - Shared micro-worktree logic
33
- */
34
- export {};
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Initiative List Helper (WU-1247)
4
- *
5
- * Lists all initiatives with progress percentages.
6
- *
7
- * Usage:
8
- * pnpm initiative:list # Table format
9
- * pnpm initiative:list --format json # JSON format
10
- * pnpm initiative:list --status open # Filter by status
11
- */
12
- export {};
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Initiative Status Helper (WU-1247)
4
- *
5
- * Shows detailed initiative view with phases and WUs.
6
- *
7
- * Usage:
8
- * pnpm initiative:status INIT-001
9
- * pnpm initiative:status --id INIT-001 --format json
10
- */
11
- export {};
@@ -1,103 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * LumenFlow Upgrade CLI Command
4
- *
5
- * Updates all @lumenflow/* packages to a specified version or latest.
6
- * Uses micro-worktree pattern for atomic changes to main without requiring
7
- * users to be in a worktree.
8
- *
9
- * WU-1112: INIT-003 Phase 6 - Migrate remaining Tier 1 tools
10
- * WU-1127: Use micro-worktree isolation pattern (fixes user blocking issue)
11
- *
12
- * Key requirements:
13
- * - Uses micro-worktree pattern (atomic changes, no user worktree needed)
14
- * - Runs from main checkout (not inside a worktree)
15
- * - Checks all 7 @lumenflow/* packages
16
- *
17
- * Usage:
18
- * pnpm lumenflow:upgrade --version 1.5.0
19
- * pnpm lumenflow:upgrade --latest
20
- * pnpm lumenflow:upgrade --latest --dry-run
21
- */
22
- /**
23
- * All @lumenflow/* packages that should be upgraded together
24
- *
25
- * WU-1112: Must include all 7 packages (not just 4 as before)
26
- * Kept in alphabetical order for consistency
27
- */
28
- export declare const LUMENFLOW_PACKAGES: readonly ["@lumenflow/agent", "@lumenflow/cli", "@lumenflow/core", "@lumenflow/initiatives", "@lumenflow/memory", "@lumenflow/metrics", "@lumenflow/shims"];
29
- /**
30
- * Arguments for lumenflow-upgrade command
31
- */
32
- export interface UpgradeArgs {
33
- /** Specific version to upgrade to (e.g., '1.5.0') */
34
- version?: string;
35
- /** Upgrade to latest version */
36
- latest?: boolean;
37
- /** Dry run - show commands without executing */
38
- dryRun?: boolean;
39
- /** Show help */
40
- help?: boolean;
41
- }
42
- /**
43
- * Result of building upgrade commands
44
- */
45
- export interface UpgradeResult {
46
- /** The pnpm add command to run */
47
- addCommand: string;
48
- /** Version specifier used */
49
- versionSpec: string;
50
- }
51
- /**
52
- * Result of main checkout validation
53
- */
54
- export interface MainCheckoutValidationResult {
55
- /** Whether validation passed */
56
- valid: boolean;
57
- /** Error message if validation failed */
58
- error?: string;
59
- /** Suggested fix command */
60
- fixCommand?: string;
61
- }
62
- /**
63
- * Parse command line arguments for lumenflow-upgrade
64
- *
65
- * @param argv - Process argv array
66
- * @returns Parsed arguments
67
- */
68
- export declare function parseUpgradeArgs(argv: string[]): UpgradeArgs;
69
- /**
70
- * Build the upgrade commands based on arguments
71
- *
72
- * Creates pnpm add command for all @lumenflow/* packages.
73
- * Uses --save-dev since these are development dependencies.
74
- *
75
- * @param args - Parsed upgrade arguments
76
- * @returns Object containing the commands to run
77
- */
78
- export declare function buildUpgradeCommands(args: UpgradeArgs): UpgradeResult;
79
- /**
80
- * WU-1127: Validate that the command is run from main checkout
81
- *
82
- * The micro-worktree pattern requires the command to be run from the main
83
- * checkout (not inside a worktree). This is the inverse of the old behavior
84
- * which required users to be IN a worktree.
85
- *
86
- * @returns Validation result with error and fix command if invalid
87
- */
88
- export declare function validateMainCheckout(): Promise<MainCheckoutValidationResult>;
89
- /**
90
- * WU-1127: Execute the upgrade in a micro-worktree
91
- *
92
- * Uses the shared micro-worktree pattern (like wu:create, wu:edit) to:
93
- * 1. Create a temporary worktree without switching main checkout
94
- * 2. Run pnpm add in the temporary worktree
95
- * 3. Commit the changes
96
- * 4. FF-only merge to main
97
- * 5. Push to origin
98
- * 6. Cleanup
99
- *
100
- * @param args - Parsed upgrade arguments
101
- * @returns Promise resolving when upgrade is complete
102
- */
103
- export declare function executeUpgradeInMicroWorktree(args: UpgradeArgs): Promise<void>;
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Memory Checkpoint CLI (WU-1467)
4
- *
5
- * Create a checkpoint node for context snapshots.
6
- * Used before /clear or session handoff to preserve progress state.
7
- *
8
- * Includes audit logging to .lumenflow/telemetry/tools.ndjson.
9
- *
10
- * Usage:
11
- * pnpm mem:checkpoint 'note' [--session <id>] [--wu <id>] [--progress <text>] [--next-steps <text>] [--trigger <type>] [--quiet]
12
- *
13
- * @see {@link tools/lib/mem-checkpoint-core.mjs} - Core logic
14
- * @see {@link tools/__tests__/mem-checkpoint.test.mjs} - Tests
15
- */
16
- export {};
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Memory Cleanup CLI (WU-1472, WU-1554)
4
- *
5
- * Prune closed memory nodes based on lifecycle policy and TTL.
6
- * Implements compaction to prevent memory bloat.
7
- *
8
- * Features:
9
- * - Remove ephemeral nodes (always discarded)
10
- * - Remove session nodes when session is closed
11
- * - Archive summarized nodes (marked with summarized_into)
12
- * - Respect sensitive:true flag for stricter retention
13
- * - Support dry-run mode for preview
14
- * - Report compaction metrics (ratio, bytes freed)
15
- * - WU-1554: TTL-based expiration (e.g., --ttl 30d)
16
- * - WU-1554: Active session protection (never removed)
17
- *
18
- * Usage:
19
- * pnpm mem:cleanup # Cleanup based on lifecycle policy
20
- * pnpm mem:cleanup --dry-run # Preview without changes
21
- * pnpm mem:cleanup --ttl 30d # Remove nodes older than 30 days
22
- * pnpm mem:cleanup --ttl 7d --dry-run # Preview TTL cleanup
23
- * pnpm mem:cleanup --session-id <uuid> # Close specific session
24
- * pnpm mem:cleanup --json # Output as JSON
25
- *
26
- * @see {@link tools/lib/mem-cleanup-core.mjs} - Core logic
27
- * @see {@link tools/__tests__/mem-cleanup.test.mjs} - Tests
28
- */
29
- export {};
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Memory Create CLI (WU-1469)
4
- *
5
- * Create memory nodes with discovered-from provenance.
6
- * KEY DIFFERENTIATOR: supports discovered-from relationship for scope-creep
7
- * forensics. Creates audit trail of WHY work expanded, not just WHAT changed.
8
- *
9
- * Includes audit logging to .lumenflow/telemetry/tools.ndjson.
10
- *
11
- * Usage:
12
- * pnpm mem:create 'title' [--type <type>] [--discovered-from <id>] [--wu <id>] [--quiet]
13
- *
14
- * @see {@link tools/lib/mem-create-core.mjs} - Core logic
15
- * @see {@link tools/__tests__/mem-create.test.mjs} - Tests
16
- */
17
- export {};