@lumenflow/cli 2.1.1 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/guard-main-branch.test.js +79 -0
- package/dist/agent-issues-query.d.ts +16 -0
- package/dist/agent-log-issue.d.ts +10 -0
- package/dist/agent-session-end.d.ts +10 -0
- package/dist/agent-session.d.ts +10 -0
- package/dist/backlog-prune.d.ts +84 -0
- package/dist/cli-entry-point.d.ts +8 -0
- package/dist/deps-add.d.ts +91 -0
- package/dist/deps-remove.d.ts +17 -0
- package/dist/docs-sync.d.ts +50 -0
- package/dist/file-delete.d.ts +84 -0
- package/dist/file-edit.d.ts +82 -0
- package/dist/file-read.d.ts +92 -0
- package/dist/file-write.d.ts +90 -0
- package/dist/flow-bottlenecks.d.ts +16 -0
- package/dist/flow-report.d.ts +16 -0
- package/dist/gates.d.ts +94 -0
- package/dist/git-branch.d.ts +65 -0
- package/dist/git-diff.d.ts +58 -0
- package/dist/git-log.d.ts +69 -0
- package/dist/git-status.d.ts +58 -0
- package/dist/guard-locked.d.ts +62 -0
- package/dist/guard-main-branch.d.ts +50 -0
- package/dist/guard-main-branch.js +11 -0
- package/dist/guard-worktree-commit.d.ts +59 -0
- package/dist/index.d.ts +10 -0
- package/dist/init-plan.d.ts +80 -0
- package/dist/init.d.ts +46 -0
- package/dist/initiative-add-wu.d.ts +22 -0
- package/dist/initiative-bulk-assign-wus.d.ts +16 -0
- package/dist/initiative-create.d.ts +28 -0
- package/dist/initiative-edit.d.ts +34 -0
- package/dist/initiative-list.d.ts +12 -0
- package/dist/initiative-status.d.ts +11 -0
- package/dist/lumenflow-upgrade.d.ts +103 -0
- package/dist/mem-checkpoint.d.ts +16 -0
- package/dist/mem-cleanup.d.ts +29 -0
- package/dist/mem-create.d.ts +17 -0
- package/dist/mem-export.d.ts +10 -0
- package/dist/mem-export.js +138 -0
- package/dist/mem-inbox.d.ts +35 -0
- package/dist/mem-init.d.ts +15 -0
- package/dist/mem-ready.d.ts +16 -0
- package/dist/mem-signal.d.ts +16 -0
- package/dist/mem-start.d.ts +16 -0
- package/dist/mem-summarize.d.ts +22 -0
- package/dist/mem-triage.d.ts +22 -0
- package/dist/metrics-cli.d.ts +90 -0
- package/dist/metrics-snapshot.d.ts +18 -0
- package/dist/orchestrate-init-status.d.ts +11 -0
- package/dist/orchestrate-initiative.d.ts +12 -0
- package/dist/orchestrate-monitor.d.ts +11 -0
- package/dist/release.d.ts +117 -0
- package/dist/rotate-progress.d.ts +48 -0
- package/dist/session-coordinator.d.ts +74 -0
- package/dist/spawn-list.d.ts +16 -0
- package/dist/state-bootstrap.d.ts +92 -0
- package/dist/sync-templates.d.ts +52 -0
- package/dist/trace-gen.d.ts +84 -0
- package/dist/validate-agent-skills.d.ts +50 -0
- package/dist/validate-agent-sync.d.ts +36 -0
- package/dist/validate-backlog-sync.d.ts +37 -0
- package/dist/validate-skills-spec.d.ts +40 -0
- package/dist/validate.d.ts +60 -0
- package/dist/wu-block.d.ts +16 -0
- package/dist/wu-claim.d.ts +74 -0
- package/dist/wu-cleanup.d.ts +35 -0
- package/dist/wu-cleanup.js +11 -2
- package/dist/wu-create.d.ts +69 -0
- package/dist/wu-delete.d.ts +21 -0
- package/dist/wu-deps.d.ts +13 -0
- package/dist/wu-done.d.ts +225 -0
- package/dist/wu-done.js +9 -3
- package/dist/wu-edit.d.ts +63 -0
- package/dist/wu-edit.js +76 -9
- package/dist/wu-infer-lane.d.ts +17 -0
- package/dist/wu-preflight.d.ts +47 -0
- package/dist/wu-prune.d.ts +16 -0
- package/dist/wu-recover.d.ts +37 -0
- package/dist/wu-release.d.ts +19 -0
- package/dist/wu-repair.d.ts +60 -0
- package/dist/wu-spawn-completion.d.ts +10 -0
- package/dist/wu-spawn.d.ts +192 -0
- package/dist/wu-spawn.js +176 -12
- package/dist/wu-status.d.ts +25 -0
- package/dist/wu-unblock.d.ts +16 -0
- package/dist/wu-unlock-lane.d.ts +19 -0
- package/dist/wu-validate.d.ts +16 -0
- package/package.json +7 -6
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Init Plan Command (WU-1105)
|
|
4
|
+
*
|
|
5
|
+
* Links plan files to initiatives by setting the `related_plan` field
|
|
6
|
+
* in the initiative YAML.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* pnpm init:plan --initiative INIT-001 --plan docs/04-operations/plans/my-plan.md
|
|
10
|
+
* pnpm init:plan --initiative INIT-001 --create # Create new plan template
|
|
11
|
+
*
|
|
12
|
+
* Features:
|
|
13
|
+
* - Validates initiative exists before modifying
|
|
14
|
+
* - Formats plan path as lumenflow:// URI
|
|
15
|
+
* - Idempotent: no error if same plan already linked
|
|
16
|
+
* - Warns if replacing existing plan link
|
|
17
|
+
* - Can create plan templates with --create
|
|
18
|
+
*
|
|
19
|
+
* Context: WU-1105 (INIT-003 Phase 3a: Migrate init:plan command)
|
|
20
|
+
*/
|
|
21
|
+
import { readInitiative } from '@lumenflow/initiatives/dist/initiative-yaml.js';
|
|
22
|
+
/** Log prefix for console output */
|
|
23
|
+
export declare const LOG_PREFIX: string;
|
|
24
|
+
/**
|
|
25
|
+
* Validate Initiative ID format
|
|
26
|
+
* @param id - Initiative ID to validate
|
|
27
|
+
* @throws Error if format is invalid
|
|
28
|
+
*/
|
|
29
|
+
export declare function validateInitIdFormat(id: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Validate plan file path
|
|
32
|
+
* @param planPath - Path to plan file
|
|
33
|
+
* @throws Error if path is invalid or file doesn't exist
|
|
34
|
+
*/
|
|
35
|
+
export declare function validatePlanPath(planPath: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Format plan path as lumenflow:// URI
|
|
38
|
+
*
|
|
39
|
+
* Extracts the filename (and any subdirectory within plans/) and creates
|
|
40
|
+
* a standardized URI for the plan reference.
|
|
41
|
+
*
|
|
42
|
+
* @param planPath - Path to plan file (can be relative or absolute)
|
|
43
|
+
* @returns lumenflow://plans/<filename> URI
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatPlanUri(planPath: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* Check if initiative exists and return the document
|
|
48
|
+
* @param initId - Initiative ID to check
|
|
49
|
+
* @returns Initiative document
|
|
50
|
+
* @throws Error if initiative not found
|
|
51
|
+
*/
|
|
52
|
+
export declare function checkInitiativeExists(initId: string): ReturnType<typeof readInitiative>;
|
|
53
|
+
/**
|
|
54
|
+
* Update initiative with plan reference in micro-worktree
|
|
55
|
+
*
|
|
56
|
+
* Uses raw YAML parsing to preserve unknown fields like related_plan
|
|
57
|
+
* that are not in the strict initiative schema.
|
|
58
|
+
*
|
|
59
|
+
* @param worktreePath - Path to micro-worktree
|
|
60
|
+
* @param initId - Initiative ID
|
|
61
|
+
* @param planUri - Plan URI to set
|
|
62
|
+
* @returns True if changes were made, false if already linked
|
|
63
|
+
*/
|
|
64
|
+
export declare function updateInitiativeWithPlan(worktreePath: string, initId: string, planUri: string): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Create a plan template file
|
|
67
|
+
*
|
|
68
|
+
* @param worktreePath - Path to repo root or worktree
|
|
69
|
+
* @param initId - Initiative ID
|
|
70
|
+
* @param title - Initiative title
|
|
71
|
+
* @returns Path to created file
|
|
72
|
+
* @throws Error if file already exists
|
|
73
|
+
*/
|
|
74
|
+
export declare function createPlanTemplate(worktreePath: string, initId: string, title: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Generate commit message for plan link operation
|
|
77
|
+
*/
|
|
78
|
+
export declare function getCommitMessage(initId: string, planUri: string): string;
|
|
79
|
+
declare function main(): Promise<void>;
|
|
80
|
+
export { main };
|
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
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>;
|
|
@@ -0,0 +1,22 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,28 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,34 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,12 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,103 @@
|
|
|
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>;
|
|
@@ -0,0 +1,16 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,29 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,17 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Memory Export CLI (WU-1137)
|
|
4
|
+
*
|
|
5
|
+
* Render memory.jsonl as markdown or JSON with basic filters.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* pnpm mem:export [--wu WU-1234] [--type <type>] [--lifecycle <lifecycle>] [--format <markdown|json>] [--quiet]
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Memory Export CLI (WU-1137)
|
|
4
|
+
*
|
|
5
|
+
* Render memory.jsonl as markdown or JSON with basic filters.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* pnpm mem:export [--wu WU-1234] [--type <type>] [--lifecycle <lifecycle>] [--format <markdown|json>] [--quiet]
|
|
9
|
+
*/
|
|
10
|
+
import fs from 'node:fs/promises';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { exportMemory } from '@lumenflow/memory/dist/mem-export-core.js';
|
|
13
|
+
import { MEMORY_NODE_TYPES } from '@lumenflow/memory/dist/memory-schema.js';
|
|
14
|
+
import { createWUParser, WU_OPTIONS } from '@lumenflow/core/dist/arg-parser.js';
|
|
15
|
+
import { EXIT_CODES, LUMENFLOW_PATHS } from '@lumenflow/core/dist/wu-constants.js';
|
|
16
|
+
const LOG_PREFIX = '[mem:export]';
|
|
17
|
+
const TOOL_NAME = 'mem:export';
|
|
18
|
+
const CLI_OPTIONS = {
|
|
19
|
+
type: {
|
|
20
|
+
name: 'type',
|
|
21
|
+
flags: '-t, --type <type>',
|
|
22
|
+
description: `Filter by node type (${MEMORY_NODE_TYPES.join(', ')})`,
|
|
23
|
+
},
|
|
24
|
+
lifecycle: {
|
|
25
|
+
name: 'lifecycle',
|
|
26
|
+
flags: '-l, --lifecycle <lifecycle>',
|
|
27
|
+
description: 'Filter by lifecycle (ephemeral, session, wu, project)',
|
|
28
|
+
},
|
|
29
|
+
format: {
|
|
30
|
+
name: 'format',
|
|
31
|
+
flags: '-f, --format <format>',
|
|
32
|
+
description: 'Output format (markdown, json). Default: markdown',
|
|
33
|
+
},
|
|
34
|
+
baseDir: {
|
|
35
|
+
name: 'baseDir',
|
|
36
|
+
flags: '-d, --base-dir <path>',
|
|
37
|
+
description: 'Base directory (defaults to current directory)',
|
|
38
|
+
},
|
|
39
|
+
quiet: {
|
|
40
|
+
name: 'quiet',
|
|
41
|
+
flags: '-q, --quiet',
|
|
42
|
+
description: 'Suppress header/footer output',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
async function writeAuditLog(baseDir, entry) {
|
|
46
|
+
try {
|
|
47
|
+
const logPath = path.join(baseDir, LUMENFLOW_PATHS.AUDIT_LOG);
|
|
48
|
+
const logDir = path.dirname(logPath);
|
|
49
|
+
await fs.mkdir(logDir, { recursive: true });
|
|
50
|
+
await fs.appendFile(logPath, `${JSON.stringify(entry)}\n`, 'utf-8');
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// Non-fatal
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function validateFormat(format) {
|
|
57
|
+
return format === 'markdown' || format === 'json';
|
|
58
|
+
}
|
|
59
|
+
function validateLifecycle(lifecycle) {
|
|
60
|
+
return ['ephemeral', 'session', 'wu', 'project'].includes(lifecycle);
|
|
61
|
+
}
|
|
62
|
+
async function main() {
|
|
63
|
+
const args = createWUParser({
|
|
64
|
+
name: 'mem-export',
|
|
65
|
+
description: 'Export memory nodes as markdown or JSON',
|
|
66
|
+
options: [
|
|
67
|
+
WU_OPTIONS.wu,
|
|
68
|
+
CLI_OPTIONS.type,
|
|
69
|
+
CLI_OPTIONS.lifecycle,
|
|
70
|
+
CLI_OPTIONS.format,
|
|
71
|
+
CLI_OPTIONS.baseDir,
|
|
72
|
+
CLI_OPTIONS.quiet,
|
|
73
|
+
],
|
|
74
|
+
required: [],
|
|
75
|
+
});
|
|
76
|
+
const baseDir = args.baseDir || process.cwd();
|
|
77
|
+
const format = args.format || 'markdown';
|
|
78
|
+
const startedAt = new Date().toISOString();
|
|
79
|
+
const startTime = Date.now();
|
|
80
|
+
if (!validateFormat(format)) {
|
|
81
|
+
console.error(`${LOG_PREFIX} Error: Invalid format "${format}". Use "markdown" or "json".`);
|
|
82
|
+
process.exit(EXIT_CODES.ERROR);
|
|
83
|
+
}
|
|
84
|
+
if (args.type && !MEMORY_NODE_TYPES.includes(args.type)) {
|
|
85
|
+
console.error(`${LOG_PREFIX} Error: Invalid type "${args.type}". Valid types: ${MEMORY_NODE_TYPES.join(', ')}`);
|
|
86
|
+
process.exit(EXIT_CODES.ERROR);
|
|
87
|
+
}
|
|
88
|
+
if (args.lifecycle && !validateLifecycle(args.lifecycle)) {
|
|
89
|
+
console.error(`${LOG_PREFIX} Error: Invalid lifecycle "${args.lifecycle}". Valid values: ephemeral, session, wu, project`);
|
|
90
|
+
process.exit(EXIT_CODES.ERROR);
|
|
91
|
+
}
|
|
92
|
+
let error = null;
|
|
93
|
+
let output = '';
|
|
94
|
+
try {
|
|
95
|
+
const result = await exportMemory(baseDir, {
|
|
96
|
+
wuId: args.wu,
|
|
97
|
+
type: args.type,
|
|
98
|
+
lifecycle: args.lifecycle,
|
|
99
|
+
format,
|
|
100
|
+
});
|
|
101
|
+
output = result.output;
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
error = err instanceof Error ? err.message : String(err);
|
|
105
|
+
}
|
|
106
|
+
const durationMs = Date.now() - startTime;
|
|
107
|
+
await writeAuditLog(baseDir, {
|
|
108
|
+
tool: TOOL_NAME,
|
|
109
|
+
status: error ? 'failed' : 'success',
|
|
110
|
+
startedAt,
|
|
111
|
+
completedAt: new Date().toISOString(),
|
|
112
|
+
durationMs,
|
|
113
|
+
input: {
|
|
114
|
+
baseDir,
|
|
115
|
+
wuId: args.wu ?? null,
|
|
116
|
+
type: args.type ?? null,
|
|
117
|
+
lifecycle: args.lifecycle ?? null,
|
|
118
|
+
format,
|
|
119
|
+
},
|
|
120
|
+
error,
|
|
121
|
+
});
|
|
122
|
+
if (error) {
|
|
123
|
+
console.error(`${LOG_PREFIX} Error: ${error}`);
|
|
124
|
+
process.exit(EXIT_CODES.ERROR);
|
|
125
|
+
}
|
|
126
|
+
if (!args.quiet) {
|
|
127
|
+
console.log(`${LOG_PREFIX} Export (${format})`);
|
|
128
|
+
console.log('');
|
|
129
|
+
}
|
|
130
|
+
process.stdout.write(output);
|
|
131
|
+
if (!output.endsWith('\n')) {
|
|
132
|
+
process.stdout.write('\n');
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
main().catch((err) => {
|
|
136
|
+
console.error(`${LOG_PREFIX} Unexpected error:`, err);
|
|
137
|
+
process.exit(EXIT_CODES.ERROR);
|
|
138
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Memory Inbox CLI (WU-1474)
|
|
4
|
+
*
|
|
5
|
+
* Read coordination signals from other agents for real-time awareness
|
|
6
|
+
* of parallel agent progress. Filter by lane, WU, or time range.
|
|
7
|
+
* Supports watch mode for continuous monitoring.
|
|
8
|
+
*
|
|
9
|
+
* Includes audit logging to .lumenflow/telemetry/tools.ndjson.
|
|
10
|
+
*
|
|
11
|
+
* WU-2202: Added dependency validation before operations to prevent silent
|
|
12
|
+
* failures when node_modules is corrupted or incomplete.
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* pnpm mem:inbox [--lane <name>] [--wu <id>] [--since <time>] [--watch]
|
|
16
|
+
*
|
|
17
|
+
* @see {@link tools/lib/mem-signal-core.mjs} - Core logic
|
|
18
|
+
* @see {@link tools/__tests__/mem-inbox.test.mjs} - Tests
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Format signal count for --count flag output
|
|
22
|
+
* WU-2401: Lightweight polling for orchestrators
|
|
23
|
+
*
|
|
24
|
+
* @param {number} count - Number of unread signals
|
|
25
|
+
* @returns {string} Formatted count string
|
|
26
|
+
*/
|
|
27
|
+
export declare function formatCount(count: any): string;
|
|
28
|
+
/**
|
|
29
|
+
* Parse relative time string to Date object
|
|
30
|
+
* WU-1849: Replaced custom regex with ms package
|
|
31
|
+
*
|
|
32
|
+
* @param {string} timeStr - Time string like "1h", "30m", "2d", or ISO date
|
|
33
|
+
* @returns {Date} Parsed date
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseTimeString(timeStr: any): Date;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Memory Init CLI (WU-1464)
|
|
4
|
+
*
|
|
5
|
+
* Initialize memory layer in the repository.
|
|
6
|
+
* Creates .lumenflow/memory/ directory with memory.jsonl and config.yaml.
|
|
7
|
+
*
|
|
8
|
+
* Includes audit logging to .lumenflow/telemetry/tools.ndjson.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* pnpm mem:init [--base-dir <path>] [--quiet]
|
|
12
|
+
*
|
|
13
|
+
* @see {@link tools/lib/mem-init-core.mjs} - Core logic
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Memory Ready CLI (WU-1468)
|
|
4
|
+
*
|
|
5
|
+
* Deterministic ready-work query for "what next?" oracle.
|
|
6
|
+
* Returns unblocked open nodes, ordered by priority then createdAt.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* pnpm mem:ready --wu WU-1234 [--type <type>] [--format <json|human>] [--quiet]
|
|
10
|
+
*
|
|
11
|
+
* Includes audit logging to .lumenflow/telemetry/tools.ndjson.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link tools/lib/mem-ready-core.mjs} - Core logic
|
|
14
|
+
* @see {@link tools/__tests__/mem-ready.test.mjs} - Tests
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Memory Signal CLI (WU-1473)
|
|
4
|
+
*
|
|
5
|
+
* Send coordination signals between parallel agents for sub-100ms
|
|
6
|
+
* multi-agent swarm coordination without git sync latency.
|
|
7
|
+
*
|
|
8
|
+
* Includes audit logging to .lumenflow/telemetry/tools.ndjson.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* pnpm mem:signal 'message' [--wu <id>] [--lane <name>] [--quiet]
|
|
12
|
+
*
|
|
13
|
+
* @see {@link tools/lib/mem-signal-core.mjs} - Core logic
|
|
14
|
+
* @see {@link tools/__tests__/mem-signal.test.mjs} - Tests
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Memory Start CLI (WU-1466)
|
|
4
|
+
*
|
|
5
|
+
* Create a session node linked to a WU.
|
|
6
|
+
* Called by wu:claim enhancement for context restoration after /clear.
|
|
7
|
+
*
|
|
8
|
+
* Includes audit logging to .lumenflow/telemetry/tools.ndjson.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* pnpm mem:start --wu WU-1234 [--agent-type <type>] [--context-tier <tier>] [--quiet]
|
|
12
|
+
*
|
|
13
|
+
* @see {@link tools/lib/mem-start-core.mjs} - Core logic
|
|
14
|
+
* @see {@link tools/__tests__/mem-start.test.mjs} - Tests
|
|
15
|
+
*/
|
|
16
|
+
export {};
|