@lumenflow/cli 2.1.2 → 2.2.1
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/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-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,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @file validate.ts
|
|
4
|
+
* @description Main WU YAML validator CLI (WU-1111)
|
|
5
|
+
*
|
|
6
|
+
* Validates WU tasks and status consistency. This is the replacement for
|
|
7
|
+
* tools/validate.js that was previously a stub.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* validate # Validate all WUs
|
|
11
|
+
* validate --id WU-123 # Validate specific WU
|
|
12
|
+
* validate --strict # Fail on warnings too
|
|
13
|
+
* validate --done-only # Only validate done WUs
|
|
14
|
+
*
|
|
15
|
+
* Exit codes:
|
|
16
|
+
* 0 - All validations passed
|
|
17
|
+
* 1 - Validation errors found
|
|
18
|
+
*
|
|
19
|
+
* @see {@link wu-validate.ts} - Detailed WU validation with schema
|
|
20
|
+
* @see {@link docs/04-operations/_frameworks/lumenflow/lumenflow-complete.md} - WU lifecycle
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Validation result for a single WU
|
|
24
|
+
*/
|
|
25
|
+
export interface ValidationResult {
|
|
26
|
+
valid: boolean;
|
|
27
|
+
warnings: string[];
|
|
28
|
+
errors: string[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Validation summary for multiple WUs
|
|
32
|
+
*/
|
|
33
|
+
export interface ValidationSummary {
|
|
34
|
+
totalValid: number;
|
|
35
|
+
totalInvalid: number;
|
|
36
|
+
totalWarnings: number;
|
|
37
|
+
results: Array<{
|
|
38
|
+
wuId: string;
|
|
39
|
+
} & ValidationResult>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Validate a single WU file
|
|
43
|
+
*
|
|
44
|
+
* @param wuPath - Path to WU YAML file
|
|
45
|
+
* @param options - Validation options
|
|
46
|
+
* @returns Validation result
|
|
47
|
+
*/
|
|
48
|
+
export declare function validateSingleWU(wuPath: string, options?: {
|
|
49
|
+
strict?: boolean;
|
|
50
|
+
}): ValidationResult;
|
|
51
|
+
/**
|
|
52
|
+
* Validate all WU files in the WU directory
|
|
53
|
+
*
|
|
54
|
+
* @param options - Validation options
|
|
55
|
+
* @returns Summary of all validations
|
|
56
|
+
*/
|
|
57
|
+
export declare function validateAllWUs(options?: {
|
|
58
|
+
strict?: boolean;
|
|
59
|
+
doneOnly?: boolean;
|
|
60
|
+
}): ValidationSummary;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* WU Block Helper
|
|
4
|
+
*
|
|
5
|
+
* Sequence (micro-worktree pattern):
|
|
6
|
+
* 1) Create micro-worktree from main
|
|
7
|
+
* 2) Auto-update WU YAML/backlog/status to Blocked in micro-worktree
|
|
8
|
+
* 3) Commit in micro-worktree, push directly to origin/main
|
|
9
|
+
* 4) Optionally remove work worktree (default: keep)
|
|
10
|
+
*
|
|
11
|
+
* Uses micro-worktree pattern to avoid pre-commit hook blocking commits to main.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* pnpm wu:block --id WU-334 [--reason "Waiting on policy"] [--worktree ...] [--remove-worktree] [--no-auto]
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* WU Claim Helper
|
|
4
|
+
*
|
|
5
|
+
* Canonical sequence:
|
|
6
|
+
* 1) Auto-update backlog/status/WU YAML (safe parsing) unless `--no-auto`
|
|
7
|
+
* 2) Commit and push to `main`
|
|
8
|
+
* 3) Create a dedicated worktree+branch for the WU
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* node tools/wu-claim.mjs --id WU-334 --lane Intelligence \
|
|
12
|
+
* [--worktree worktrees/intelligence-wu-334] [--branch lane/intelligence/wu-334]
|
|
13
|
+
*
|
|
14
|
+
* WU-2542: This script imports utilities from @lumenflow/core package.
|
|
15
|
+
* Full migration to thin shim pending @lumenflow/core CLI export implementation.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* WU-1746: Get list of files to commit in worktree mode
|
|
19
|
+
* Excludes backlog.md and status.md to prevent merge conflicts.
|
|
20
|
+
* These generated files should only be updated on main during wu:done.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} wuId - WU ID (e.g., 'WU-1746')
|
|
23
|
+
* @returns {string[]} List of files to commit
|
|
24
|
+
*/
|
|
25
|
+
export declare function getWorktreeCommitFiles(wuId: any): string[];
|
|
26
|
+
/**
|
|
27
|
+
* WU-1047: Format Project Defaults section (agent-only).
|
|
28
|
+
*
|
|
29
|
+
* @param {object} methodology - Methodology defaults config
|
|
30
|
+
* @returns {string} Formatted output or empty string if disabled
|
|
31
|
+
*/
|
|
32
|
+
export declare function formatProjectDefaults(methodology: any): string;
|
|
33
|
+
/**
|
|
34
|
+
* WU-1047: Print Project Defaults section (agent-only).
|
|
35
|
+
*
|
|
36
|
+
* @param {object} methodology - Methodology defaults config
|
|
37
|
+
*/
|
|
38
|
+
export declare function printProjectDefaults(methodology: any): void;
|
|
39
|
+
/**
|
|
40
|
+
* WU-1763: Print a single concise tips line to improve tool adoption.
|
|
41
|
+
* Non-blocking, single-line output to avoid flooding the console.
|
|
42
|
+
*
|
|
43
|
+
* @param {string} _id - WU ID being claimed (unused, kept for future use)
|
|
44
|
+
*/
|
|
45
|
+
export declare function printLifecycleNudge(_id: any): void;
|
|
46
|
+
/**
|
|
47
|
+
* WU-1029: Apply symlink fallback (root + nested node_modules) after install failure.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} worktreePath - Worktree path
|
|
50
|
+
* @param {string} mainRepoPath - Main repo path
|
|
51
|
+
* @param {Console} logger - Logger (console-compatible)
|
|
52
|
+
*/
|
|
53
|
+
export declare function applyFallbackSymlinks(worktreePath: any, mainRepoPath: any, logger?: Console): {
|
|
54
|
+
symlinkResult: {
|
|
55
|
+
created: boolean;
|
|
56
|
+
skipped: boolean;
|
|
57
|
+
refused?: undefined;
|
|
58
|
+
reason?: undefined;
|
|
59
|
+
error?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
created: boolean;
|
|
62
|
+
skipped: boolean;
|
|
63
|
+
refused: boolean;
|
|
64
|
+
reason: string;
|
|
65
|
+
error?: undefined;
|
|
66
|
+
} | {
|
|
67
|
+
created: boolean;
|
|
68
|
+
skipped: boolean;
|
|
69
|
+
error: any;
|
|
70
|
+
refused?: undefined;
|
|
71
|
+
reason?: undefined;
|
|
72
|
+
};
|
|
73
|
+
nestedResult: any;
|
|
74
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* WU Cleanup Helper
|
|
4
|
+
*
|
|
5
|
+
* Cleans up worktree and branch after PR merge (PR-based completion workflow).
|
|
6
|
+
*
|
|
7
|
+
* Sequence:
|
|
8
|
+
* 1) Verify PR is merged (via gh API; no merge-base fallback)
|
|
9
|
+
* 2) Remove worktree (if exists)
|
|
10
|
+
* 3) Delete lane branch (local + remote)
|
|
11
|
+
*
|
|
12
|
+
* Idempotent: Safe no-op if already cleaned.
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* pnpm wu:cleanup --id WU-703
|
|
16
|
+
* pnpm wu:cleanup --artifacts
|
|
17
|
+
*/
|
|
18
|
+
export declare const CLEANUP_GUARD_REASONS: {
|
|
19
|
+
UNCOMMITTED_CHANGES: string;
|
|
20
|
+
UNPUSHED_COMMITS: string;
|
|
21
|
+
STATUS_NOT_DONE: string;
|
|
22
|
+
MISSING_STAMP: string;
|
|
23
|
+
PR_NOT_MERGED: string;
|
|
24
|
+
};
|
|
25
|
+
export declare function evaluateCleanupGuards({ hasUncommittedChanges, hasUnpushedCommits, hasStamp, yamlStatus, ghAvailable, prMerged, }: {
|
|
26
|
+
hasUncommittedChanges: any;
|
|
27
|
+
hasUnpushedCommits: any;
|
|
28
|
+
hasStamp: any;
|
|
29
|
+
yamlStatus: any;
|
|
30
|
+
ghAvailable: any;
|
|
31
|
+
prMerged: any;
|
|
32
|
+
}): {
|
|
33
|
+
allowed: boolean;
|
|
34
|
+
reason: string;
|
|
35
|
+
};
|
package/dist/wu-cleanup.js
CHANGED
|
@@ -57,13 +57,22 @@ export function evaluateCleanupGuards({ hasUncommittedChanges, hasUnpushedCommit
|
|
|
57
57
|
return { allowed: true, reason: null };
|
|
58
58
|
}
|
|
59
59
|
// Help text is now auto-generated by commander via createWUParser
|
|
60
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Verify if a PR for the given branch has been merged.
|
|
62
|
+
* WU-1141: Fixed to query closed/merged PRs by adding state=all parameter.
|
|
63
|
+
* The GitHub API /pulls endpoint returns only open PRs by default, so merged
|
|
64
|
+
* PRs were not being found, causing false "PR not merged" errors.
|
|
65
|
+
*/
|
|
66
|
+
export async function verifyPRMerged(laneBranch) {
|
|
61
67
|
if (!isGhCliAvailable()) {
|
|
62
68
|
return { merged: null, method: 'gh_unavailable' };
|
|
63
69
|
}
|
|
64
70
|
let ghResult;
|
|
65
71
|
try {
|
|
66
|
-
|
|
72
|
+
// WU-1141: Add state=all to include closed/merged PRs
|
|
73
|
+
// Without this parameter, the API only returns open PRs,
|
|
74
|
+
// causing merged PRs to not be found and verification to fail
|
|
75
|
+
ghResult = execSync(`gh api "repos/:owner/:repo/pulls?state=all" -q '.[] | select(.head.ref == "${laneBranch}") | .merged'`, { encoding: FILE_SYSTEM.UTF8 }).trim();
|
|
67
76
|
}
|
|
68
77
|
catch {
|
|
69
78
|
ghResult = STRING_LITERALS.EMPTY;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* WU Create Helper (WU-1262, WU-1439)
|
|
4
|
+
*
|
|
5
|
+
* Race-safe WU creation using shared micro-worktree isolation.
|
|
6
|
+
*
|
|
7
|
+
* Canonical sequence:
|
|
8
|
+
* 1) Validate inputs (id, lane, title)
|
|
9
|
+
* 2) Ensure on main branch
|
|
10
|
+
* 3) Use withMicroWorktree() to atomically:
|
|
11
|
+
* a) Create temp branch without switching main checkout
|
|
12
|
+
* b) Create WU-{id}.yaml and update backlog.md in micro-worktree
|
|
13
|
+
* c) Commit with "docs: create wu-{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 switches branches (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 wu:create --id WU-706 --lane Intelligence --title "Fix XYZ issue"
|
|
25
|
+
*
|
|
26
|
+
* Context: WU-705 (fix agent coordination failures), WU-1262 (micro-worktree isolation),
|
|
27
|
+
* WU-1439 (refactor to shared helper)
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* WU-2330: Check if a more specific sub-lane matches the provided inputs.
|
|
31
|
+
* Non-blocking - just logs a warning if a better lane is suggested.
|
|
32
|
+
*
|
|
33
|
+
* @param {string} providedLane - Lane provided by the user
|
|
34
|
+
* @param {string|undefined} codePathsRaw - Comma-separated code paths
|
|
35
|
+
* @param {string} title - WU title (used as fallback description)
|
|
36
|
+
* @param {string|undefined} description - WU description
|
|
37
|
+
*/
|
|
38
|
+
export declare function warnIfBetterLaneExists(providedLane: any, codePathsRaw: any, title: any, description: any): void;
|
|
39
|
+
/** Options for creating WU YAML */
|
|
40
|
+
interface CreateWUOptions {
|
|
41
|
+
initiative?: string;
|
|
42
|
+
phase?: string;
|
|
43
|
+
blockedBy?: string;
|
|
44
|
+
blocks?: string;
|
|
45
|
+
labels?: string;
|
|
46
|
+
assignedTo?: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
acceptance?: string[];
|
|
49
|
+
codePaths?: string;
|
|
50
|
+
testPathsManual?: string;
|
|
51
|
+
testPathsUnit?: string;
|
|
52
|
+
testPathsE2e?: string;
|
|
53
|
+
exposure?: string;
|
|
54
|
+
userJourney?: string;
|
|
55
|
+
uiPairingWus?: string;
|
|
56
|
+
specRefs?: string;
|
|
57
|
+
}
|
|
58
|
+
export declare function validateCreateSpec({ id, lane, title, priority, type, opts, }: {
|
|
59
|
+
id: string;
|
|
60
|
+
lane: string;
|
|
61
|
+
title: string;
|
|
62
|
+
priority: string;
|
|
63
|
+
type: string;
|
|
64
|
+
opts: CreateWUOptions;
|
|
65
|
+
}): {
|
|
66
|
+
valid: boolean;
|
|
67
|
+
errors: any[];
|
|
68
|
+
};
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* WU Delete Helper
|
|
4
|
+
*
|
|
5
|
+
* Race-safe WU deletion using micro-worktree isolation.
|
|
6
|
+
*
|
|
7
|
+
* Uses micro-worktree pattern:
|
|
8
|
+
* 1) Validate inputs (WU exists, status is not in_progress)
|
|
9
|
+
* 2) Ensure main is clean and up-to-date with origin
|
|
10
|
+
* 3) Create temp branch WITHOUT switching (main checkout stays on main)
|
|
11
|
+
* 4) Create micro-worktree in /tmp pointing to temp branch
|
|
12
|
+
* 5) Delete WU file and update backlog.md in micro-worktree
|
|
13
|
+
* 6) Commit, ff-only merge, push
|
|
14
|
+
* 7) Cleanup temp branch and micro-worktree
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* pnpm wu:delete --id WU-123 # Single WU deletion
|
|
18
|
+
* pnpm wu:delete --id WU-123 --dry-run # Dry run
|
|
19
|
+
* pnpm wu:delete --batch WU-1,WU-2,WU-3 # Batch deletion
|
|
20
|
+
*/
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* WU Dependency Visualization (WU-1247)
|
|
4
|
+
*
|
|
5
|
+
* Shows dependency graph for a WU in ASCII or Mermaid format.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* pnpm wu:deps WU-1247 # ASCII format
|
|
9
|
+
* pnpm wu:deps WU-1247 --format mermaid # Mermaid diagram
|
|
10
|
+
* pnpm wu:deps WU-1247 --depth 5 # Deeper traversal
|
|
11
|
+
* pnpm wu:deps WU-1247 --direction up # Only upstream deps
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* WU Done Helper
|
|
4
|
+
*
|
|
5
|
+
* Canonical sequence (Worktree mode - DEFAULT):
|
|
6
|
+
* 1) Run gates in lane worktree (validates the change, not just main)
|
|
7
|
+
* 2) Pre-flight validation: run ALL pre-commit hooks before merge (prevents partial completion)
|
|
8
|
+
* 3) cd into worktree
|
|
9
|
+
* 4) Auto-update WU YAML/backlog/status to Done in worktree (unless --no-auto)
|
|
10
|
+
* 5) Create `.lumenflow/stamps/WU-{id}.done` in worktree
|
|
11
|
+
* 6) Validate staged files against whitelist
|
|
12
|
+
* 7) Commit metadata changes in worktree (on lane branch)
|
|
13
|
+
* 8) cd back to main
|
|
14
|
+
* 9) Merge lane branch to main with --ff-only (metadata + code merged atomically)
|
|
15
|
+
* 10) Push to `main`
|
|
16
|
+
* 11) Remove the associated worktree (unless --no-remove)
|
|
17
|
+
* 12) Optionally delete the lane branch (with --delete-branch)
|
|
18
|
+
* 13) Emit telemetry to .lumenflow/flow.log
|
|
19
|
+
*
|
|
20
|
+
* Canonical sequence (Branch-Only mode - LEGACY):
|
|
21
|
+
* 1) Run gates on lane branch (in main checkout)
|
|
22
|
+
* 2) Pre-flight validation
|
|
23
|
+
* 3) Merge lane branch to main
|
|
24
|
+
* 4) Update metadata on main
|
|
25
|
+
* 5) Commit and push
|
|
26
|
+
* 6) Delete lane branch
|
|
27
|
+
*
|
|
28
|
+
* Usage:
|
|
29
|
+
* pnpm wu:done --id WU-334 [--worktree worktrees/intelligence-wu-334] [--no-auto] [--no-remove] [--no-merge] [--delete-branch]
|
|
30
|
+
*
|
|
31
|
+
* WU-2542: This script imports utilities from @lumenflow/core package.
|
|
32
|
+
* Full migration to thin shim pending @lumenflow/core CLI export implementation.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* WU-1999: Print exposure validation warnings.
|
|
36
|
+
*
|
|
37
|
+
* Validates exposure field and UI pairing for user-facing WUs.
|
|
38
|
+
* Non-blocking - logs warnings but doesn't prevent completion.
|
|
39
|
+
*
|
|
40
|
+
* Checks:
|
|
41
|
+
* - exposure field is present (warn if missing)
|
|
42
|
+
* - If exposure=api, warns if no ui_pairing_wus specified
|
|
43
|
+
* - If exposure=api, checks acceptance criteria for UI verification mention
|
|
44
|
+
* - If exposure=ui, recommends user_journey field if not present
|
|
45
|
+
*
|
|
46
|
+
* @param {object} wu - WU YAML document
|
|
47
|
+
* @param {object} options - Validation options
|
|
48
|
+
* @param {boolean} [options.skipExposureCheck=false] - Skip all exposure validation
|
|
49
|
+
* @returns {void}
|
|
50
|
+
*/
|
|
51
|
+
interface ExposureOptions {
|
|
52
|
+
skipExposureCheck?: boolean;
|
|
53
|
+
}
|
|
54
|
+
export declare function printExposureWarnings(wu: Record<string, unknown>, options?: ExposureOptions): void;
|
|
55
|
+
/**
|
|
56
|
+
* WU-2022: Validate feature accessibility for UI-exposed WUs.
|
|
57
|
+
*
|
|
58
|
+
* BLOCKING validation - prevents wu:done if exposure=ui but feature is not accessible.
|
|
59
|
+
* This prevents "orphaned code" where UI features exist but users cannot navigate to them.
|
|
60
|
+
*
|
|
61
|
+
* Accessibility is verified by ANY of:
|
|
62
|
+
* 1. navigation_path field is specified (explicit route)
|
|
63
|
+
* 2. code_paths includes a page.tsx file (Next.js page)
|
|
64
|
+
* 3. tests.manual includes navigation/accessibility verification
|
|
65
|
+
*
|
|
66
|
+
* @param {object} wu - WU YAML document
|
|
67
|
+
* @param {object} options - Validation options
|
|
68
|
+
* @param {boolean} [options.skipAccessibilityCheck=false] - Skip accessibility validation
|
|
69
|
+
* @returns {void} Calls die() if validation fails
|
|
70
|
+
*/
|
|
71
|
+
interface AccessibilityOptions {
|
|
72
|
+
skipAccessibilityCheck?: boolean;
|
|
73
|
+
}
|
|
74
|
+
export declare function validateAccessibilityOrDie(wu: Record<string, unknown>, options?: AccessibilityOptions): void;
|
|
75
|
+
/**
|
|
76
|
+
* WU-1012: Validate --docs-only flag usage.
|
|
77
|
+
*
|
|
78
|
+
* The --docs-only flag can only be used when the WU is documentation-focused:
|
|
79
|
+
* 1. exposure field is 'documentation'
|
|
80
|
+
* 2. OR all code_paths are documentation paths (docs/, ai/, .claude/, *.md)
|
|
81
|
+
* 3. OR type is 'documentation'
|
|
82
|
+
*
|
|
83
|
+
* @param {object} wu - WU YAML document
|
|
84
|
+
* @param {object} args - Parsed CLI arguments
|
|
85
|
+
* @param {boolean} args.docsOnly - Whether --docs-only flag was passed
|
|
86
|
+
* @returns {{ valid: boolean, errors: string[] }} Validation result
|
|
87
|
+
*/
|
|
88
|
+
interface DocsOnlyArgs {
|
|
89
|
+
docsOnly?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export declare function validateDocsOnlyFlag(wu: Record<string, unknown>, args: DocsOnlyArgs): {
|
|
92
|
+
valid: boolean;
|
|
93
|
+
errors: string[];
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* WU-1012: Build gates command with --docs-only flag support.
|
|
97
|
+
*
|
|
98
|
+
* Returns the appropriate gates command based on:
|
|
99
|
+
* - Explicit --docs-only flag from CLI
|
|
100
|
+
* - Auto-detected isDocsOnly from code_paths analysis
|
|
101
|
+
*
|
|
102
|
+
* @param {object} options - Build options
|
|
103
|
+
* @param {boolean} options.docsOnly - Explicit --docs-only flag from CLI
|
|
104
|
+
* @param {boolean} options.isDocsOnly - Auto-detected docs-only from code_paths
|
|
105
|
+
* @returns {string} Gates command string
|
|
106
|
+
*/
|
|
107
|
+
interface BuildGatesOptions {
|
|
108
|
+
docsOnly?: boolean;
|
|
109
|
+
isDocsOnly?: boolean;
|
|
110
|
+
}
|
|
111
|
+
export declare function buildGatesCommand(options: BuildGatesOptions): string;
|
|
112
|
+
/**
|
|
113
|
+
* WU-1946: Update spawn registry on WU completion.
|
|
114
|
+
* Non-blocking wrapper - failures logged as warnings.
|
|
115
|
+
*
|
|
116
|
+
* When a WU is completed via wu:done, this function updates the spawn registry
|
|
117
|
+
* to mark the spawned entry as completed (if one exists). This allows orchestrators
|
|
118
|
+
* to track sub-agent spawn completion status.
|
|
119
|
+
*
|
|
120
|
+
* Gracefully skips if:
|
|
121
|
+
* - No spawn entry found for this WU (legacy WU created before registry)
|
|
122
|
+
* - Registry file doesn't exist
|
|
123
|
+
* - Any error during update
|
|
124
|
+
*
|
|
125
|
+
* @param {string} id - WU ID being completed
|
|
126
|
+
* @param {string} baseDir - Base directory containing .lumenflow/state/
|
|
127
|
+
* @returns {Promise<void>}
|
|
128
|
+
*/
|
|
129
|
+
export declare function updateSpawnRegistryOnCompletion(id: any, baseDir?: string): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* WU-1234: Normalize username for ownership comparison
|
|
132
|
+
* Extracts username from email address for comparison.
|
|
133
|
+
* This allows tom@hellm.ai to match 'tom' assigned_to field.
|
|
134
|
+
*
|
|
135
|
+
* @param {string|null|undefined} value - Email address or username
|
|
136
|
+
* @returns {string} Normalized username (lowercase)
|
|
137
|
+
*/
|
|
138
|
+
export declare function normalizeUsername(value: any): string;
|
|
139
|
+
/**
|
|
140
|
+
* WU-1234: Detect if branch is already merged to main
|
|
141
|
+
* Checks if branch tip is an ancestor of main HEAD (i.e., already merged).
|
|
142
|
+
* This prevents merge loops when code was merged via emergency fix or manual merge.
|
|
143
|
+
*
|
|
144
|
+
* @param {string} branch - Lane branch name
|
|
145
|
+
* @returns {Promise<boolean>} True if branch is already merged to main
|
|
146
|
+
*/
|
|
147
|
+
export declare function isBranchAlreadyMerged(branch: any): Promise<boolean>;
|
|
148
|
+
export { shouldSkipWebTests as isDocsOnlyByPaths } from '@lumenflow/core/dist/path-classifiers.js';
|
|
149
|
+
/**
|
|
150
|
+
* WU-1234: Pre-flight check for backlog state consistency
|
|
151
|
+
* Fails fast if the WU appears in both Done and In Progress sections.
|
|
152
|
+
*
|
|
153
|
+
* @param {string} id - WU ID to check
|
|
154
|
+
* @param {string} backlogPath - Path to backlog.md
|
|
155
|
+
* @returns {{ valid: boolean, error: string|null }}
|
|
156
|
+
*/
|
|
157
|
+
export declare function checkBacklogConsistencyForWU(id: any, backlogPath: any): {
|
|
158
|
+
valid: boolean;
|
|
159
|
+
error: string;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* WU-1084: Check for uncommitted changes on main after merge completes.
|
|
163
|
+
*
|
|
164
|
+
* This catches cases where pnpm format (or other tooling) touched files
|
|
165
|
+
* outside the WU's code_paths during worktree work. These changes survive
|
|
166
|
+
* the merge and would be silently left behind when the worktree is removed.
|
|
167
|
+
*
|
|
168
|
+
* @param gitStatus - Output from git status (porcelain format)
|
|
169
|
+
* @param wuId - The WU ID for error messaging
|
|
170
|
+
* @returns Object with isDirty flag and optional error message
|
|
171
|
+
*/
|
|
172
|
+
export declare function checkPostMergeDirtyState(gitStatus: string, wuId: string): {
|
|
173
|
+
isDirty: boolean;
|
|
174
|
+
error?: string;
|
|
175
|
+
};
|
|
176
|
+
export declare function emitTelemetry(event: any): void;
|
|
177
|
+
/**
|
|
178
|
+
* Print State HUD for visibility
|
|
179
|
+
* Extracted from main() to reduce complexity (WU-1215 Phase 2 Extraction #4)
|
|
180
|
+
* @param {object} params - Parameters
|
|
181
|
+
* @param {string} params.id - WU ID
|
|
182
|
+
* @param {object} params.docMain - Main WU YAML document
|
|
183
|
+
* @param {boolean} params.isBranchOnly - Whether in branch-only mode
|
|
184
|
+
* @param {boolean} params.isDocsOnly - Whether this is a docs-only WU
|
|
185
|
+
* @param {string|null} params.derivedWorktree - Derived worktree path
|
|
186
|
+
* @param {string} params.STAMPS_DIR - Stamps directory path
|
|
187
|
+
*/
|
|
188
|
+
export declare function computeBranchOnlyFallback({ isBranchOnly, branchOnlyRequested, worktreeExists, derivedWorktree, }: {
|
|
189
|
+
isBranchOnly: boolean;
|
|
190
|
+
branchOnlyRequested: boolean | undefined;
|
|
191
|
+
worktreeExists: boolean;
|
|
192
|
+
derivedWorktree: string | null;
|
|
193
|
+
}): {
|
|
194
|
+
allowFallback: boolean;
|
|
195
|
+
effectiveBranchOnly: boolean;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* WU-1983: Print migration deployment nudge when WU includes supabase changes.
|
|
199
|
+
* Notifies agent to deploy new migrations to production via MCP tools.
|
|
200
|
+
* Conditional output - only prints when migrations are in scope and new migrations exist.
|
|
201
|
+
*
|
|
202
|
+
* @param {string[]} codePaths - WU code_paths array
|
|
203
|
+
* @param {string} baseDir - Base directory for migration discovery
|
|
204
|
+
* @returns {Promise<void>}
|
|
205
|
+
*/
|
|
206
|
+
export declare function printMigrationDeploymentNudge(codePaths: any, baseDir: any): Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* WU-1763: Print discovery summary nudge when discoveries exist for this WU.
|
|
209
|
+
* Conditional output - only prints when discoveryCount > 0.
|
|
210
|
+
* Non-blocking, single-line output to avoid flooding the console.
|
|
211
|
+
*
|
|
212
|
+
* @param {string} id - WU ID being completed
|
|
213
|
+
* @param {number} discoveryCount - Number of open discoveries for this WU
|
|
214
|
+
* @param {string[]} discoveryIds - List of discovery IDs (limited to 5 in output)
|
|
215
|
+
*/
|
|
216
|
+
export declare function printDiscoveryNudge(id: any, discoveryCount: any, discoveryIds: any): void;
|
|
217
|
+
/**
|
|
218
|
+
* WU-1763: Print documentation validation nudge when docs changed.
|
|
219
|
+
* Conditional output - only prints when changedDocPaths.length > 0.
|
|
220
|
+
* Non-blocking, single-line output to avoid flooding the console.
|
|
221
|
+
*
|
|
222
|
+
* @param {string} id - WU ID being completed
|
|
223
|
+
* @param {string[]} changedDocPaths - List of documentation paths that changed
|
|
224
|
+
*/
|
|
225
|
+
export declare function printDocValidationNudge(id: any, changedDocPaths: any): void;
|
package/dist/wu-done.js
CHANGED
|
@@ -1975,9 +1975,15 @@ async function main() {
|
|
|
1975
1975
|
// This prevents partial completion states where merge succeeds but commit fails
|
|
1976
1976
|
// Validates all 8 gates: secrets, file size, ESLint, Prettier, TypeScript, audit, architecture, tasks
|
|
1977
1977
|
// WU-2308: Pass worktreePath to run audit from worktree (checks fixed deps, not stale main deps)
|
|
1978
|
-
|
|
1979
|
-
if (!
|
|
1980
|
-
|
|
1978
|
+
// WU-1145: Skip pre-flight when skipGates is true (pre-flight runs gates which was already skipped)
|
|
1979
|
+
if (!args.skipGates) {
|
|
1980
|
+
const hookResult = validateAllPreCommitHooks(id, worktreePath);
|
|
1981
|
+
if (!hookResult.valid) {
|
|
1982
|
+
die('Pre-flight validation failed. Fix hook issues and try again.');
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
else {
|
|
1986
|
+
console.log(`${LOG_PREFIX.DONE} Skipping pre-flight hook validation (--skip-gates)`);
|
|
1981
1987
|
}
|
|
1982
1988
|
// Step 0.6: WU-1781 - Run tasks:validate preflight BEFORE any merge/push operations
|
|
1983
1989
|
// This prevents deadlocks where validation fails after merge, leaving local main ahead of origin
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* WU Edit Helper
|
|
4
|
+
*
|
|
5
|
+
* Race-safe WU spec editing using micro-worktree isolation (WU-1274).
|
|
6
|
+
*
|
|
7
|
+
* Enables editing WU YAML files without claiming the WU, perfect for:
|
|
8
|
+
* - Filling in placeholder content after wu:create
|
|
9
|
+
* - Updating description/acceptance criteria
|
|
10
|
+
* - Adding code_paths, notes, or other spec fields
|
|
11
|
+
*
|
|
12
|
+
* Uses the same micro-worktree pattern as wu:create (WU-1262):
|
|
13
|
+
* 1) Validate inputs (WU exists, status is ready)
|
|
14
|
+
* 2) Ensure main is clean and up-to-date with origin
|
|
15
|
+
* 3) Create temp branch WITHOUT switching (main checkout stays on main)
|
|
16
|
+
* 4) Create micro-worktree in /tmp pointing to temp branch
|
|
17
|
+
* 5) Apply edits in micro-worktree
|
|
18
|
+
* 6) Commit, ff-only merge, push
|
|
19
|
+
* 7) Cleanup temp branch and micro-worktree
|
|
20
|
+
*
|
|
21
|
+
* Usage:
|
|
22
|
+
* pnpm wu:edit --id WU-123 --spec-file /path/to/spec.yaml
|
|
23
|
+
* pnpm wu:edit --id WU-123 --description "New description text"
|
|
24
|
+
* pnpm wu:edit --id WU-123 --acceptance "Criterion 1" --acceptance "Criterion 2"
|
|
25
|
+
*
|
|
26
|
+
* Part of WU-1274: Add wu:edit command for spec-only changes
|
|
27
|
+
* @see {@link tools/lib/micro-worktree.mjs} - Shared micro-worktree logic
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* WU-1039: Validate which edits are allowed on done WUs
|
|
31
|
+
*
|
|
32
|
+
* Done WUs only allow metadata reassignment: initiative, phase, and exposure.
|
|
33
|
+
* All other edits are blocked to preserve WU immutability after completion.
|
|
34
|
+
*
|
|
35
|
+
* @param opts - Parsed CLI options
|
|
36
|
+
* @returns { valid: boolean, disallowedEdits: string[] }
|
|
37
|
+
*/
|
|
38
|
+
export declare function validateDoneWUEdits(opts: Record<string, unknown>): {
|
|
39
|
+
valid: boolean;
|
|
40
|
+
disallowedEdits: string[];
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* WU-1039: Validate exposure value against schema
|
|
44
|
+
*
|
|
45
|
+
* Uses WU_EXPOSURE_VALUES from core constants (Library-First, no magic strings).
|
|
46
|
+
*
|
|
47
|
+
* @param exposure - Exposure value to validate
|
|
48
|
+
* @returns { valid: boolean, error?: string }
|
|
49
|
+
*/
|
|
50
|
+
export declare function validateExposureValue(exposure: string): {
|
|
51
|
+
valid: boolean;
|
|
52
|
+
error?: string;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* WU-1039: Apply exposure edit to WU object
|
|
56
|
+
*
|
|
57
|
+
* Returns a new WU object with updated exposure (immutable pattern).
|
|
58
|
+
*
|
|
59
|
+
* @param wu - Original WU object
|
|
60
|
+
* @param exposure - New exposure value
|
|
61
|
+
* @returns Updated WU object (does not mutate original)
|
|
62
|
+
*/
|
|
63
|
+
export declare function applyExposureEdit(wu: Record<string, unknown>, exposure: string): Record<string, unknown>;
|