@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.
Files changed (89) hide show
  1. package/dist/__tests__/guard-main-branch.test.js +79 -0
  2. package/dist/agent-issues-query.d.ts +16 -0
  3. package/dist/agent-log-issue.d.ts +10 -0
  4. package/dist/agent-session-end.d.ts +10 -0
  5. package/dist/agent-session.d.ts +10 -0
  6. package/dist/backlog-prune.d.ts +84 -0
  7. package/dist/cli-entry-point.d.ts +8 -0
  8. package/dist/deps-add.d.ts +91 -0
  9. package/dist/deps-remove.d.ts +17 -0
  10. package/dist/docs-sync.d.ts +50 -0
  11. package/dist/file-delete.d.ts +84 -0
  12. package/dist/file-edit.d.ts +82 -0
  13. package/dist/file-read.d.ts +92 -0
  14. package/dist/file-write.d.ts +90 -0
  15. package/dist/flow-bottlenecks.d.ts +16 -0
  16. package/dist/flow-report.d.ts +16 -0
  17. package/dist/gates.d.ts +94 -0
  18. package/dist/git-branch.d.ts +65 -0
  19. package/dist/git-diff.d.ts +58 -0
  20. package/dist/git-log.d.ts +69 -0
  21. package/dist/git-status.d.ts +58 -0
  22. package/dist/guard-locked.d.ts +62 -0
  23. package/dist/guard-main-branch.d.ts +50 -0
  24. package/dist/guard-main-branch.js +11 -0
  25. package/dist/guard-worktree-commit.d.ts +59 -0
  26. package/dist/index.d.ts +10 -0
  27. package/dist/init-plan.d.ts +80 -0
  28. package/dist/init.d.ts +46 -0
  29. package/dist/initiative-add-wu.d.ts +22 -0
  30. package/dist/initiative-bulk-assign-wus.d.ts +16 -0
  31. package/dist/initiative-create.d.ts +28 -0
  32. package/dist/initiative-edit.d.ts +34 -0
  33. package/dist/initiative-list.d.ts +12 -0
  34. package/dist/initiative-status.d.ts +11 -0
  35. package/dist/lumenflow-upgrade.d.ts +103 -0
  36. package/dist/mem-checkpoint.d.ts +16 -0
  37. package/dist/mem-cleanup.d.ts +29 -0
  38. package/dist/mem-create.d.ts +17 -0
  39. package/dist/mem-export.d.ts +10 -0
  40. package/dist/mem-export.js +138 -0
  41. package/dist/mem-inbox.d.ts +35 -0
  42. package/dist/mem-init.d.ts +15 -0
  43. package/dist/mem-ready.d.ts +16 -0
  44. package/dist/mem-signal.d.ts +16 -0
  45. package/dist/mem-start.d.ts +16 -0
  46. package/dist/mem-summarize.d.ts +22 -0
  47. package/dist/mem-triage.d.ts +22 -0
  48. package/dist/metrics-cli.d.ts +90 -0
  49. package/dist/metrics-snapshot.d.ts +18 -0
  50. package/dist/orchestrate-init-status.d.ts +11 -0
  51. package/dist/orchestrate-initiative.d.ts +12 -0
  52. package/dist/orchestrate-monitor.d.ts +11 -0
  53. package/dist/release.d.ts +117 -0
  54. package/dist/rotate-progress.d.ts +48 -0
  55. package/dist/session-coordinator.d.ts +74 -0
  56. package/dist/spawn-list.d.ts +16 -0
  57. package/dist/state-bootstrap.d.ts +92 -0
  58. package/dist/sync-templates.d.ts +52 -0
  59. package/dist/trace-gen.d.ts +84 -0
  60. package/dist/validate-agent-skills.d.ts +50 -0
  61. package/dist/validate-agent-sync.d.ts +36 -0
  62. package/dist/validate-backlog-sync.d.ts +37 -0
  63. package/dist/validate-skills-spec.d.ts +40 -0
  64. package/dist/validate.d.ts +60 -0
  65. package/dist/wu-block.d.ts +16 -0
  66. package/dist/wu-claim.d.ts +74 -0
  67. package/dist/wu-cleanup.d.ts +35 -0
  68. package/dist/wu-cleanup.js +11 -2
  69. package/dist/wu-create.d.ts +69 -0
  70. package/dist/wu-delete.d.ts +21 -0
  71. package/dist/wu-deps.d.ts +13 -0
  72. package/dist/wu-done.d.ts +225 -0
  73. package/dist/wu-done.js +9 -3
  74. package/dist/wu-edit.d.ts +63 -0
  75. package/dist/wu-edit.js +76 -9
  76. package/dist/wu-infer-lane.d.ts +17 -0
  77. package/dist/wu-preflight.d.ts +47 -0
  78. package/dist/wu-prune.d.ts +16 -0
  79. package/dist/wu-recover.d.ts +37 -0
  80. package/dist/wu-release.d.ts +19 -0
  81. package/dist/wu-repair.d.ts +60 -0
  82. package/dist/wu-spawn-completion.d.ts +10 -0
  83. package/dist/wu-spawn.d.ts +192 -0
  84. package/dist/wu-spawn.js +176 -12
  85. package/dist/wu-status.d.ts +25 -0
  86. package/dist/wu-unblock.d.ts +16 -0
  87. package/dist/wu-unlock-lane.d.ts +19 -0
  88. package/dist/wu-validate.d.ts +16 -0
  89. package/package.json +7 -6
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * File Write CLI Tool
4
+ *
5
+ * Provides audited file write operations with:
6
+ * - Scope checking against WU code_paths
7
+ * - PHI scanning (optional)
8
+ * - Directory creation
9
+ * - Audit logging
10
+ *
11
+ * Usage:
12
+ * node file-write.js <path> --content <content> [--encoding utf-8]
13
+ *
14
+ * WU-1108: INIT-003 Phase 4a - Migrate file operations
15
+ */
16
+ /**
17
+ * Default configuration for file write operations
18
+ */
19
+ export declare const FILE_WRITE_DEFAULTS: {
20
+ /** Default encoding */
21
+ encoding: BufferEncoding;
22
+ /** Create parent directories if they don't exist */
23
+ createDirectories: boolean;
24
+ };
25
+ /**
26
+ * Arguments for file write operation
27
+ */
28
+ export interface FileWriteArgs {
29
+ /** Path to file to write */
30
+ path?: string;
31
+ /** Content to write */
32
+ content?: string;
33
+ /** File encoding */
34
+ encoding?: BufferEncoding;
35
+ /** Create parent directories */
36
+ createDirectories?: boolean;
37
+ /** Scan content for PHI */
38
+ scanPHI?: boolean;
39
+ /** Show help */
40
+ help?: boolean;
41
+ }
42
+ /**
43
+ * Metadata returned with file write
44
+ */
45
+ export interface FileWriteMetadata {
46
+ /** Bytes written */
47
+ bytesWritten: number;
48
+ /** Whether directories were created */
49
+ directoriesCreated?: boolean;
50
+ }
51
+ /**
52
+ * Audit log entry for file operations
53
+ */
54
+ export interface AuditLogEntry {
55
+ /** Operation type */
56
+ operation: 'read' | 'write' | 'edit' | 'delete';
57
+ /** File path */
58
+ path: string;
59
+ /** Timestamp */
60
+ timestamp: string;
61
+ /** Duration in ms */
62
+ durationMs?: number;
63
+ /** Success status */
64
+ success: boolean;
65
+ /** Error message if failed */
66
+ error?: string;
67
+ }
68
+ /**
69
+ * Result of file write operation
70
+ */
71
+ export interface FileWriteResult {
72
+ /** Whether operation succeeded */
73
+ success: boolean;
74
+ /** Error message (if failed) */
75
+ error?: string;
76
+ /** Warnings (e.g., PHI detected) */
77
+ warnings?: string[];
78
+ /** File metadata */
79
+ metadata?: FileWriteMetadata;
80
+ /** Audit log entry */
81
+ auditLog?: AuditLogEntry;
82
+ }
83
+ /**
84
+ * Parse command line arguments for file-write
85
+ */
86
+ export declare function parseFileWriteArgs(argv: string[]): FileWriteArgs;
87
+ /**
88
+ * Write a file with audit logging and safety checks
89
+ */
90
+ export declare function writeFileWithAudit(args: FileWriteArgs): Promise<FileWriteResult>;
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Flow Bottlenecks Analysis CLI (WU-1018)
4
+ *
5
+ * Analyzes WU dependency graph to identify bottlenecks and critical paths.
6
+ *
7
+ * Usage:
8
+ * pnpm flow:bottlenecks # Default: top 10 bottlenecks, JSON output
9
+ * pnpm flow:bottlenecks --limit 5 # Top 5 bottlenecks
10
+ * pnpm flow:bottlenecks --format table # Table output
11
+ * pnpm flow:bottlenecks --format mermaid # Mermaid diagram of critical path
12
+ *
13
+ * @module flow-bottlenecks
14
+ * @see {@link @lumenflow/metrics/flow/analyze-bottlenecks}
15
+ */
16
+ export {};
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Flow Report Generator CLI (WU-1018)
4
+ *
5
+ * Generates DORA/SPACE flow reports from telemetry and WU data.
6
+ *
7
+ * Usage:
8
+ * pnpm flow:report # Default: last 7 days, JSON output
9
+ * pnpm flow:report --days 30 # Last 30 days
10
+ * pnpm flow:report --format table # Table output
11
+ * pnpm flow:report --start 2026-01-01 --end 2026-01-15
12
+ *
13
+ * @module flow-report
14
+ * @see {@link @lumenflow/metrics/flow/generate-flow-report}
15
+ */
16
+ export {};
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Quality Gates Runner
4
+ *
5
+ * Runs quality gates with support for docs-only mode and incremental linting.
6
+ *
7
+ * WU-1304: Optimise ESLint gates performance
8
+ * - Uses incremental linting (only files changed since branching from main)
9
+ * - Full lint coverage maintained via CI workflow
10
+ *
11
+ * WU-1433: Coverage gate with mode flag
12
+ * - Checks coverage thresholds for hex core files (≥90% for application layer)
13
+ * - Mode: block (default) fails the gate, warn logs warnings only
14
+ * WU-2334: Changed default from warn to block for TDD enforcement
15
+ *
16
+ * WU-1610: Supabase docs linter
17
+ * - Verifies every table in migrations is documented in schema.md
18
+ * - Fails if any table is missing documentation
19
+ *
20
+ * For type:documentation WUs:
21
+ * - ✅ Run: format:check, spec:linter, prompts:lint, backlog-sync
22
+ * - ❌ Skip: lint, typecheck, supabase-docs:linter, tests, coverage (no code changed)
23
+ *
24
+ * WU-1920: Incremental test execution
25
+ * - Uses Vitest's --changed flag to run only tests for changed files
26
+ * - Full test suite maintained via CI workflow and --full-tests flag
27
+ *
28
+ * WU-2062: Tiered test execution for faster wu:done
29
+ * - Safety-critical tests (PHI, escalation, red-flag) ALWAYS run
30
+ * - Docs-only WUs: lint/typecheck only (auto-detected or --docs-only flag)
31
+ * - High-risk WUs (auth, PHI, RLS, migrations): run integration tests
32
+ * - Standard WUs: changed tests + safety-critical tests
33
+ *
34
+ * Usage:
35
+ * node tools/gates.mjs # Tiered gates (default)
36
+ * node tools/gates.mjs --docs-only # Docs-only gates
37
+ * node tools/gates.mjs --full-lint # Full lint (bypass incremental)
38
+ * node tools/gates.mjs --full-tests # Full tests (bypass incremental)
39
+ * node tools/gates.mjs --coverage-mode=block # Coverage gate in block mode
40
+ */
41
+ /**
42
+ * WU-1087: Gates-specific option definitions for createWUParser.
43
+ * Exported for testing and consistency with other CLI commands.
44
+ */
45
+ export declare const GATES_OPTIONS: {
46
+ docsOnly: {
47
+ name: string;
48
+ flags: string;
49
+ description: string;
50
+ };
51
+ fullLint: {
52
+ name: string;
53
+ flags: string;
54
+ description: string;
55
+ };
56
+ fullTests: {
57
+ name: string;
58
+ flags: string;
59
+ description: string;
60
+ };
61
+ fullCoverage: {
62
+ name: string;
63
+ flags: string;
64
+ description: string;
65
+ };
66
+ coverageMode: {
67
+ name: string;
68
+ flags: string;
69
+ description: string;
70
+ default: string;
71
+ };
72
+ verbose: {
73
+ name: string;
74
+ flags: string;
75
+ description: string;
76
+ };
77
+ };
78
+ /**
79
+ * WU-1087: Parse gates options using createWUParser for consistency.
80
+ * Handles pnpm's `--` separator and provides automatic --help support.
81
+ *
82
+ * @returns Parsed options object
83
+ */
84
+ export declare function parseGatesOptions(): {
85
+ docsOnly?: boolean;
86
+ fullLint?: boolean;
87
+ fullTests?: boolean;
88
+ fullCoverage?: boolean;
89
+ coverageMode: string;
90
+ verbose?: boolean;
91
+ };
92
+ export declare function parsePrettierListOutput(output: string): string[];
93
+ export declare function buildPrettierWriteCommand(files: string[]): string;
94
+ export declare function formatFormatCheckGuidance(files: string[]): string[];
@@ -0,0 +1,65 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Git Branch CLI Tool
4
+ *
5
+ * Provides WU-aware git branch with:
6
+ * - Branch listing (local, remote, all)
7
+ * - Current branch detection
8
+ * - Contains filtering
9
+ *
10
+ * Usage:
11
+ * node git-branch.js [--list] [-a] [-r] [--show-current]
12
+ *
13
+ * WU-1109: INIT-003 Phase 4b - Migrate git operations
14
+ */
15
+ /**
16
+ * Arguments for git branch operation
17
+ */
18
+ export interface GitBranchArgs {
19
+ /** Base directory for git operations */
20
+ baseDir?: string;
21
+ /** List branches */
22
+ list?: boolean;
23
+ /** Show all branches (local and remote) */
24
+ all?: boolean;
25
+ /** Show only remote branches */
26
+ remotes?: boolean;
27
+ /** Show current branch only */
28
+ showCurrent?: boolean;
29
+ /** Filter branches containing commit */
30
+ contains?: string;
31
+ /** Show help */
32
+ help?: boolean;
33
+ }
34
+ /**
35
+ * Branch information
36
+ */
37
+ export interface BranchInfo {
38
+ /** Branch name */
39
+ name: string;
40
+ /** Whether this is the current branch */
41
+ isCurrent: boolean;
42
+ /** Whether this is a remote branch */
43
+ isRemote: boolean;
44
+ }
45
+ /**
46
+ * Result of git branch operation
47
+ */
48
+ export interface GitBranchResult {
49
+ /** Whether operation succeeded */
50
+ success: boolean;
51
+ /** Error message (if failed) */
52
+ error?: string;
53
+ /** Current branch name */
54
+ current?: string;
55
+ /** List of branches */
56
+ branches?: BranchInfo[];
57
+ }
58
+ /**
59
+ * Parse command line arguments for git-branch
60
+ */
61
+ export declare function parseGitBranchArgs(argv: string[]): GitBranchArgs;
62
+ /**
63
+ * Get git branch information
64
+ */
65
+ export declare function getGitBranch(args: GitBranchArgs): Promise<GitBranchResult>;
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Git Diff CLI Tool
4
+ *
5
+ * Provides WU-aware git diff with:
6
+ * - Staged/cached diff support
7
+ * - Name-only and stat output modes
8
+ * - File filtering
9
+ *
10
+ * Usage:
11
+ * node git-diff.js [ref] [--staged] [--name-only] [--stat]
12
+ *
13
+ * WU-1109: INIT-003 Phase 4b - Migrate git operations
14
+ */
15
+ /**
16
+ * Arguments for git diff operation
17
+ */
18
+ export interface GitDiffArgs {
19
+ /** Base directory for git operations */
20
+ baseDir?: string;
21
+ /** Reference to diff against */
22
+ ref?: string;
23
+ /** Show staged changes */
24
+ staged?: boolean;
25
+ /** Show only file names */
26
+ nameOnly?: boolean;
27
+ /** Show diffstat */
28
+ stat?: boolean;
29
+ /** Path to filter diff */
30
+ path?: string;
31
+ /** Show help */
32
+ help?: boolean;
33
+ }
34
+ /**
35
+ * Result of git diff operation
36
+ */
37
+ export interface GitDiffResult {
38
+ /** Whether operation succeeded */
39
+ success: boolean;
40
+ /** Error message (if failed) */
41
+ error?: string;
42
+ /** Whether there are any differences */
43
+ hasDiff?: boolean;
44
+ /** Diff output */
45
+ diff?: string;
46
+ /** List of files (for name-only mode) */
47
+ files?: string[];
48
+ /** Diffstat output (for stat mode) */
49
+ stat?: string;
50
+ }
51
+ /**
52
+ * Parse command line arguments for git-diff
53
+ */
54
+ export declare function parseGitDiffArgs(argv: string[]): GitDiffArgs;
55
+ /**
56
+ * Get git diff with audit logging
57
+ */
58
+ export declare function getGitDiff(args: GitDiffArgs): Promise<GitDiffResult>;
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Git Log CLI Tool
4
+ *
5
+ * Provides WU-aware git log with:
6
+ * - Oneline and custom format output
7
+ * - Max count limiting
8
+ * - Date and author filtering
9
+ *
10
+ * Usage:
11
+ * node git-log.js [ref] [--oneline] [-n <count>] [--format <format>]
12
+ *
13
+ * WU-1109: INIT-003 Phase 4b - Migrate git operations
14
+ */
15
+ /**
16
+ * Arguments for git log operation
17
+ */
18
+ export interface GitLogArgs {
19
+ /** Base directory for git operations */
20
+ baseDir?: string;
21
+ /** Reference or range (e.g., main..feature) */
22
+ ref?: string;
23
+ /** Use oneline format */
24
+ oneline?: boolean;
25
+ /** Maximum number of commits */
26
+ maxCount?: number;
27
+ /** Custom format string */
28
+ format?: string;
29
+ /** Show commits since date */
30
+ since?: string;
31
+ /** Filter by author */
32
+ author?: string;
33
+ /** Show help */
34
+ help?: boolean;
35
+ }
36
+ /**
37
+ * Commit information
38
+ */
39
+ export interface CommitInfo {
40
+ /** Commit hash */
41
+ hash: string;
42
+ /** Commit message */
43
+ message: string;
44
+ /** Author name */
45
+ author?: string;
46
+ /** Author date */
47
+ date?: string;
48
+ }
49
+ /**
50
+ * Result of git log operation
51
+ */
52
+ export interface GitLogResult {
53
+ /** Whether operation succeeded */
54
+ success: boolean;
55
+ /** Error message (if failed) */
56
+ error?: string;
57
+ /** Parsed commits */
58
+ commits: CommitInfo[];
59
+ /** Raw output (for oneline/custom format) */
60
+ output?: string;
61
+ }
62
+ /**
63
+ * Parse command line arguments for git-log
64
+ */
65
+ export declare function parseGitLogArgs(argv: string[]): GitLogArgs;
66
+ /**
67
+ * Get git log with audit logging
68
+ */
69
+ export declare function getGitLog(args: GitLogArgs): Promise<GitLogResult>;
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Git Status CLI Tool
4
+ *
5
+ * Provides WU-aware git status with:
6
+ * - Porcelain and short output formats
7
+ * - Parsed file status (staged, modified, untracked)
8
+ * - Clean/dirty state detection
9
+ *
10
+ * Usage:
11
+ * node git-status.js [path] [--porcelain] [--short]
12
+ *
13
+ * WU-1109: INIT-003 Phase 4b - Migrate git operations
14
+ */
15
+ /**
16
+ * Arguments for git status operation
17
+ */
18
+ export interface GitStatusArgs {
19
+ /** Base directory for git operations */
20
+ baseDir?: string;
21
+ /** Path to filter status */
22
+ path?: string;
23
+ /** Use porcelain output format */
24
+ porcelain?: boolean;
25
+ /** Use short output format */
26
+ short?: boolean;
27
+ /** Show help */
28
+ help?: boolean;
29
+ }
30
+ /**
31
+ * Result of git status operation
32
+ */
33
+ export interface GitStatusResult {
34
+ /** Whether operation succeeded */
35
+ success: boolean;
36
+ /** Error message (if failed) */
37
+ error?: string;
38
+ /** Whether working tree is clean */
39
+ isClean?: boolean;
40
+ /** List of staged files */
41
+ staged?: string[];
42
+ /** List of modified files (unstaged) */
43
+ modified?: string[];
44
+ /** List of untracked files */
45
+ untracked?: string[];
46
+ /** List of deleted files */
47
+ deleted?: string[];
48
+ /** Raw output (for porcelain mode) */
49
+ output?: string;
50
+ }
51
+ /**
52
+ * Parse command line arguments for git-status
53
+ */
54
+ export declare function parseGitStatusArgs(argv: string[]): GitStatusArgs;
55
+ /**
56
+ * Get git status with audit logging
57
+ */
58
+ export declare function getGitStatus(args: GitStatusArgs): Promise<GitStatusResult>;
@@ -0,0 +1,62 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @file guard-locked.ts
4
+ * @description Guard that prevents changes to locked WUs (WU-1111)
5
+ *
6
+ * Validates that a WU is not locked before allowing modifications.
7
+ * Used by git hooks and wu: commands to enforce workflow discipline.
8
+ *
9
+ * Usage:
10
+ * guard-locked WU-123 # Check if WU-123 is locked
11
+ * guard-locked --wu WU-123 # Same with explicit flag
12
+ *
13
+ * Exit codes:
14
+ * 0 - WU is not locked (safe to proceed)
15
+ * 1 - WU is locked (block operation)
16
+ *
17
+ * @see {@link docs/04-operations/_frameworks/lumenflow/lumenflow-complete.md} - WU lifecycle
18
+ */
19
+ /**
20
+ * Check if a WU is locked
21
+ *
22
+ * @param wuPath - Path to WU YAML file
23
+ * @returns true if WU has locked: true, false otherwise
24
+ * @throws Error if WU file does not exist or cannot be parsed
25
+ *
26
+ * @example
27
+ * if (isWULocked('/path/to/WU-123.yaml')) {
28
+ * console.log('WU is locked, cannot modify');
29
+ * }
30
+ */
31
+ export declare function isWULocked(wuPath: string): boolean;
32
+ /**
33
+ * Assert that a WU is not locked
34
+ *
35
+ * @param wuPath - Path to WU YAML file
36
+ * @throws Error if WU is locked, with actionable fix instructions
37
+ *
38
+ * @example
39
+ * try {
40
+ * assertWUNotLocked('/path/to/WU-123.yaml');
41
+ * // Safe to modify
42
+ * } catch (error) {
43
+ * console.error(error.message);
44
+ * process.exit(1);
45
+ * }
46
+ */
47
+ export declare function assertWUNotLocked(wuPath: string): void;
48
+ /**
49
+ * Check if a WU ID is locked by looking up the YAML file
50
+ *
51
+ * @param wuId - WU ID (e.g., "WU-123")
52
+ * @returns true if WU has locked: true, false otherwise
53
+ * @throws Error if WU file does not exist
54
+ */
55
+ export declare function isWUIdLocked(wuId: string): boolean;
56
+ /**
57
+ * Assert that a WU ID is not locked
58
+ *
59
+ * @param wuId - WU ID (e.g., "WU-123")
60
+ * @throws Error if WU is locked
61
+ */
62
+ export declare function assertWUIdNotLocked(wuId: string): void;
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Guard Main Branch CLI Tool
4
+ *
5
+ * Provides branch protection checks for WU workflow:
6
+ * - Blocks operations on main/master branches
7
+ * - Blocks operations on lane branches (require worktree)
8
+ * - Optionally allows agent branches
9
+ *
10
+ * Usage:
11
+ * node guard-main-branch.js [--allow-agent-branch] [--strict]
12
+ *
13
+ * WU-1109: INIT-003 Phase 4b - Migrate git operations
14
+ */
15
+ /**
16
+ * Arguments for guard-main-branch operation
17
+ */
18
+ export interface GuardMainBranchArgs {
19
+ /** Base directory for git operations */
20
+ baseDir?: string;
21
+ /** Allow agent branches (e.g., claude/session-123) */
22
+ allowAgentBranch?: boolean;
23
+ /** Strict mode - fail on any protected branch */
24
+ strict?: boolean;
25
+ /** Show help */
26
+ help?: boolean;
27
+ }
28
+ /**
29
+ * Result of guard-main-branch operation
30
+ */
31
+ export interface GuardMainBranchResult {
32
+ /** Whether operation succeeded */
33
+ success: boolean;
34
+ /** Error message (if failed) */
35
+ error?: string;
36
+ /** Whether current branch is protected */
37
+ isProtected: boolean;
38
+ /** Current branch name */
39
+ currentBranch?: string;
40
+ /** Reason for protection */
41
+ reason?: string;
42
+ }
43
+ /**
44
+ * Parse command line arguments for guard-main-branch
45
+ */
46
+ export declare function parseGuardMainBranchArgs(argv: string[]): GuardMainBranchArgs;
47
+ /**
48
+ * Guard against operations on protected branches
49
+ */
50
+ export declare function guardMainBranch(args: GuardMainBranchArgs): Promise<GuardMainBranchResult>;
@@ -13,6 +13,7 @@
13
13
  * WU-1109: INIT-003 Phase 4b - Migrate git operations
14
14
  */
15
15
  import { createGitForPath, getGitForCwd, isAgentBranch, getConfig } from '@lumenflow/core';
16
+ import { isInWorktree } from '@lumenflow/core/dist/core/worktree-guard.js';
16
17
  /**
17
18
  * Parse command line arguments for guard-main-branch
18
19
  */
@@ -90,6 +91,16 @@ export async function guardMainBranch(args) {
90
91
  }
91
92
  // Check if on a lane branch (requires worktree discipline)
92
93
  if (isLaneBranch(currentBranch)) {
94
+ // If we're actually in a worktree, allow the operation (WU-1130)
95
+ const cwd = args.baseDir ?? process.cwd();
96
+ if (isInWorktree({ cwd })) {
97
+ return {
98
+ success: true,
99
+ isProtected: false,
100
+ currentBranch,
101
+ };
102
+ }
103
+ // On lane branch but not in worktree - block
93
104
  return {
94
105
  success: true,
95
106
  isProtected: true,
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @file guard-worktree-commit.ts
4
+ * @description Guard that prevents WU commits from main checkout (WU-1111)
5
+ *
6
+ * Validates that WU-related commits are only made from worktrees, not main.
7
+ * Used by git commit-msg hooks to enforce worktree discipline.
8
+ *
9
+ * Usage:
10
+ * guard-worktree-commit "commit message"
11
+ * guard-worktree-commit --message "commit message"
12
+ *
13
+ * Exit codes:
14
+ * 0 - Commit allowed
15
+ * 1 - Commit blocked (WU commit from main)
16
+ *
17
+ * @see {@link docs/04-operations/_frameworks/lumenflow/lumenflow-complete.md} - Worktree discipline
18
+ */
19
+ /**
20
+ * Result of commit block check
21
+ */
22
+ export interface CommitBlockResult {
23
+ /** Whether the commit should be blocked */
24
+ blocked: boolean;
25
+ /** Reason for blocking (if blocked) */
26
+ reason?: string;
27
+ }
28
+ /**
29
+ * Check if a commit should be blocked
30
+ *
31
+ * @param options - Check options
32
+ * @param options.commitMessage - The commit message
33
+ * @param options.isMainCheckout - Whether in main checkout
34
+ * @param options.isInWorktree - Whether in a worktree
35
+ * @returns Whether commit should be blocked and why
36
+ *
37
+ * @example
38
+ * const result = shouldBlockCommit({
39
+ * commitMessage: 'wu(WU-123): add feature',
40
+ * isMainCheckout: true,
41
+ * isInWorktree: false,
42
+ * });
43
+ * if (result.blocked) {
44
+ * console.error(result.reason);
45
+ * process.exit(1);
46
+ * }
47
+ */
48
+ export declare function shouldBlockCommit(options: {
49
+ commitMessage: string;
50
+ isMainCheckout: boolean;
51
+ isInWorktree: boolean;
52
+ }): CommitBlockResult;
53
+ /**
54
+ * Check if a commit message is WU-related
55
+ *
56
+ * @param message - Commit message to check
57
+ * @returns true if message indicates WU work
58
+ */
59
+ export declare function isWUCommitMessage(message: string): boolean;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @lumenflow/cli - Command-line interface for LumenFlow workflow framework
3
+ *
4
+ * This package provides CLI commands for the LumenFlow workflow framework.
5
+ * Most functionality is exposed via bin commands, but the cli-entry-point
6
+ * helper is exported for use in custom CLI wrappers.
7
+ *
8
+ * @see https://lumenflow.dev/reference/cli
9
+ */
10
+ export { runCLI } from './cli-entry-point.js';