@lumenflow/cli 3.12.6 → 3.12.8

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 (111) hide show
  1. package/dist/config-set.js +82 -32
  2. package/dist/config-set.js.map +1 -1
  3. package/dist/wu-claim.js +2 -1
  4. package/dist/wu-claim.js.map +1 -1
  5. package/dist/wu-done-policies.js +9 -9
  6. package/dist/wu-done-policies.js.map +1 -1
  7. package/dist/wu-spawn-strategy-resolver.js +14 -6
  8. package/dist/wu-spawn-strategy-resolver.js.map +1 -1
  9. package/package.json +8 -8
  10. package/packs/sidekick/.turbo/turbo-build.log +1 -1
  11. package/packs/sidekick/package.json +1 -1
  12. package/packs/software-delivery/.turbo/turbo-build.log +1 -1
  13. package/packs/software-delivery/package.json +1 -1
  14. package/dist/chunk-2D2VOCA4.js +0 -37
  15. package/dist/chunk-2D5KFYGX.js +0 -284
  16. package/dist/chunk-2GXVIN57.js +0 -14072
  17. package/dist/chunk-2MQ7HZWZ.js +0 -26
  18. package/dist/chunk-2UFQ3A3C.js +0 -643
  19. package/dist/chunk-3RG5ZIWI.js +0 -10
  20. package/dist/chunk-4N74J3UT.js +0 -15
  21. package/dist/chunk-5GTOXFYR.js +0 -392
  22. package/dist/chunk-5VY6MQMC.js +0 -240
  23. package/dist/chunk-67XVPMRY.js +0 -1297
  24. package/dist/chunk-6HO4GWJE.js +0 -164
  25. package/dist/chunk-6W5XHWYV.js +0 -1890
  26. package/dist/chunk-6X4EMYJQ.js +0 -64
  27. package/dist/chunk-6XYXI2NQ.js +0 -772
  28. package/dist/chunk-7ANSOV6Q.js +0 -285
  29. package/dist/chunk-A624LFLB.js +0 -1380
  30. package/dist/chunk-ADN5NHG4.js +0 -126
  31. package/dist/chunk-B7YJYJKG.js +0 -33
  32. package/dist/chunk-CCLHCPKG.js +0 -210
  33. package/dist/chunk-CK36VROC.js +0 -1584
  34. package/dist/chunk-D3UOFRSB.js +0 -81
  35. package/dist/chunk-DFR4DJBM.js +0 -230
  36. package/dist/chunk-DSYBDHYH.js +0 -79
  37. package/dist/chunk-DWMLTXKQ.js +0 -1176
  38. package/dist/chunk-E3REJTAJ.js +0 -28
  39. package/dist/chunk-EA3IVO64.js +0 -633
  40. package/dist/chunk-EK2AKZKD.js +0 -55
  41. package/dist/chunk-ELD7JTTT.js +0 -343
  42. package/dist/chunk-EX6TT2XI.js +0 -195
  43. package/dist/chunk-EXINSFZE.js +0 -82
  44. package/dist/chunk-EZ6ZBYBM.js +0 -510
  45. package/dist/chunk-FBKAPTJ2.js +0 -16
  46. package/dist/chunk-FVLV5RYH.js +0 -1118
  47. package/dist/chunk-GDNSBQVK.js +0 -2485
  48. package/dist/chunk-GPQHMBNN.js +0 -278
  49. package/dist/chunk-GTFJB67L.js +0 -68
  50. package/dist/chunk-HANJXVKW.js +0 -1127
  51. package/dist/chunk-HEVS5YLD.js +0 -269
  52. package/dist/chunk-HMEVZKPQ.js +0 -9
  53. package/dist/chunk-HRGSYNLM.js +0 -3511
  54. package/dist/chunk-ISZR5N4K.js +0 -60
  55. package/dist/chunk-J6SUPR2C.js +0 -226
  56. package/dist/chunk-JERYVEIZ.js +0 -244
  57. package/dist/chunk-JHHWGL2N.js +0 -87
  58. package/dist/chunk-JONWQUB5.js +0 -775
  59. package/dist/chunk-K2DIWWDM.js +0 -1766
  60. package/dist/chunk-KY4PGL5V.js +0 -969
  61. package/dist/chunk-L737LQ4C.js +0 -1285
  62. package/dist/chunk-LFTWYIB2.js +0 -497
  63. package/dist/chunk-LV47RFNJ.js +0 -41
  64. package/dist/chunk-MKSAITI7.js +0 -15
  65. package/dist/chunk-MZ7RKIX4.js +0 -212
  66. package/dist/chunk-NAP6CFSO.js +0 -84
  67. package/dist/chunk-ND6MY37M.js +0 -16
  68. package/dist/chunk-NMG736UR.js +0 -683
  69. package/dist/chunk-NRAXROED.js +0 -32
  70. package/dist/chunk-NRIZR3A7.js +0 -690
  71. package/dist/chunk-NX43BG3M.js +0 -233
  72. package/dist/chunk-O645XLSI.js +0 -297
  73. package/dist/chunk-OMJD6A3S.js +0 -235
  74. package/dist/chunk-QB6SJD4T.js +0 -430
  75. package/dist/chunk-QFSTL4J3.js +0 -276
  76. package/dist/chunk-QLGDFMFX.js +0 -212
  77. package/dist/chunk-RIAAGL2E.js +0 -13
  78. package/dist/chunk-RWO5XMZ6.js +0 -86
  79. package/dist/chunk-RXRKBBSM.js +0 -149
  80. package/dist/chunk-RZOZMML6.js +0 -363
  81. package/dist/chunk-U7I7FS7T.js +0 -113
  82. package/dist/chunk-UI42RODY.js +0 -717
  83. package/dist/chunk-UTVMVSCO.js +0 -519
  84. package/dist/chunk-V6OJGLBA.js +0 -1746
  85. package/dist/chunk-W2JHVH7D.js +0 -152
  86. package/dist/chunk-WD3Y7VQN.js +0 -280
  87. package/dist/chunk-WOCTQ5MS.js +0 -303
  88. package/dist/chunk-WZR3ZUNN.js +0 -696
  89. package/dist/chunk-XGI665H7.js +0 -150
  90. package/dist/chunk-XKY65P2T.js +0 -304
  91. package/dist/chunk-Y4CQZY65.js +0 -57
  92. package/dist/chunk-YFEXKLVE.js +0 -194
  93. package/dist/chunk-YHO3HS5X.js +0 -287
  94. package/dist/chunk-YLS7AZSX.js +0 -738
  95. package/dist/chunk-ZE473AO6.js +0 -49
  96. package/dist/chunk-ZF747T3O.js +0 -644
  97. package/dist/chunk-ZHCZHZH3.js +0 -43
  98. package/dist/chunk-ZZNZX2XY.js +0 -87
  99. package/dist/constants-7QAP3VQ4.js +0 -23
  100. package/dist/dist-IY3UUMWK.js +0 -33
  101. package/dist/invariants-runner-W5RGHCSU.js +0 -27
  102. package/dist/lane-lock-6J36HD5O.js +0 -35
  103. package/dist/mem-checkpoint-core-EANG2GVN.js +0 -14
  104. package/dist/mem-signal-core-2LZ2WYHW.js +0 -19
  105. package/dist/memory-store-OLB5FO7K.js +0 -18
  106. package/dist/service-6BYCOCO5.js +0 -13
  107. package/dist/spawn-policy-resolver-NTSZYQ6R.js +0 -17
  108. package/dist/spawn-task-builder-R4E2BHSW.js +0 -22
  109. package/dist/wu-done-pr-WLFFFEPJ.js +0 -25
  110. package/dist/wu-done-validation-3J5E36FE.js +0 -30
  111. package/dist/wu-duplicate-id-detector-5S7JHELK.js +0 -232
@@ -1,150 +0,0 @@
1
- import {
2
- getGitForCwd
3
- } from "./chunk-2UFQ3A3C.js";
4
- import {
5
- createWuPaths
6
- } from "./chunk-6HO4GWJE.js";
7
- import {
8
- EMOJI,
9
- LOG_PREFIX,
10
- REMOTES,
11
- STDIO
12
- } from "./chunk-DWMLTXKQ.js";
13
- import {
14
- ErrorCodes,
15
- createError
16
- } from "./chunk-RXRKBBSM.js";
17
-
18
- // ../core/dist/wu-done-pr.js
19
- import { execSync } from "child_process";
20
- var WU_DONE_COMPLETION_MODES = Object.freeze({
21
- WORKTREE: "worktree",
22
- BRANCH_ONLY: "branch-only",
23
- BRANCH_PR: "branch-pr"
24
- });
25
- function isPRModeEnabled(doc, args) {
26
- const claimedMode = doc.claimed_mode || "worktree";
27
- const requiresReview = doc.requires_review === true;
28
- return claimedMode === "worktree-pr" || args.createPR || requiresReview;
29
- }
30
- function isGhCliAvailable() {
31
- try {
32
- execSync("gh --version", { encoding: "utf-8", stdio: STDIO.IGNORE });
33
- return true;
34
- } catch {
35
- return false;
36
- }
37
- }
38
- async function createPR(context) {
39
- const { branch, id, title, doc, draft = false } = context;
40
- console.log(`
41
- ${LOG_PREFIX.DONE} Creating PR for ${branch}...`);
42
- if (!isGhCliAvailable()) {
43
- printGhCliMissingMessage(branch, id);
44
- return { success: false, prUrl: null, ghAvailable: false };
45
- }
46
- try {
47
- await getGitForCwd().push(REMOTES.ORIGIN, branch);
48
- } catch (e) {
49
- throw createError(ErrorCodes.GIT_ERROR, `Failed to push branch ${branch}: ${e.message}`, {
50
- branch,
51
- operation: "push",
52
- originalError: e.message
53
- });
54
- }
55
- const body = buildPRBody(doc, id);
56
- const prTitle = `${id}: ${title}`;
57
- const draftFlag = draft ? "--draft" : "";
58
- try {
59
- const prUrl = execSync(`gh pr create --title ${JSON.stringify(prTitle)} --body ${JSON.stringify(body)} ${draftFlag} --head ${JSON.stringify(branch)} --base main`, { encoding: "utf-8" }).trim();
60
- console.log(`${LOG_PREFIX.DONE} ${EMOJI.SUCCESS} PR created: ${prUrl}`);
61
- return { success: true, prUrl, ghAvailable: true };
62
- } catch (e) {
63
- throw createError(ErrorCodes.GIT_ERROR, `Failed to create PR: ${e.message}`, {
64
- branch,
65
- id,
66
- operation: "pr-create",
67
- originalError: e.message
68
- });
69
- }
70
- }
71
- function buildPRBody(doc, id) {
72
- const paths = createWuPaths();
73
- const wuPath = paths.WU(id);
74
- const description = doc.description || doc.problem || "";
75
- const acceptance = doc.acceptance_criteria || doc.acceptance || {};
76
- let body = `## Summary
77
-
78
- ${description}
79
-
80
- `;
81
- if (Object.keys(acceptance).length > 0) {
82
- body += `## Acceptance Criteria
83
-
84
- `;
85
- for (const [key, criteria] of Object.entries(acceptance)) {
86
- body += `**${key}:**
87
- `;
88
- if (Array.isArray(criteria)) {
89
- for (const item of criteria) {
90
- body += `- ${item}
91
- `;
92
- }
93
- } else if (criteria && typeof criteria === "object") {
94
- for (const [subkey, items] of Object.entries(criteria)) {
95
- body += `- ${subkey}:
96
- `;
97
- if (Array.isArray(items)) {
98
- for (const item of items) {
99
- body += ` - ${item}
100
- `;
101
- }
102
- }
103
- }
104
- }
105
- body += `
106
- `;
107
- }
108
- }
109
- body += `
110
- \u{1F916} Generated with [Claude Code](https://claude.com/claude-code)
111
-
112
- `;
113
- body += `WU YAML: ${wuPath}`;
114
- return body;
115
- }
116
- function printGhCliMissingMessage(branch, id) {
117
- console.error();
118
- console.error("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
119
- console.error("\u2551 GH CLI NOT AVAILABLE");
120
- console.error("\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563");
121
- console.error("\u2551 The gh CLI tool is required to create PRs.");
122
- console.error("\u2551");
123
- console.error("\u2551 Manual PR creation steps:");
124
- console.error(`\u2551 1. Push branch: git push origin ${branch}`);
125
- console.error("\u2551 2. Create PR in GitHub UI");
126
- console.error(`\u2551 3. After merge, run: pnpm wu:cleanup --id ${id}`);
127
- console.error("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
128
- }
129
- function printPRCreatedMessage(prUrl, id) {
130
- console.log("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
131
- console.log("\u2551 PR CREATED - NEXT STEPS");
132
- console.log("\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563");
133
- console.log(`\u2551 PR URL: ${prUrl}`);
134
- console.log("\u2551");
135
- console.log("\u2551 Next steps:");
136
- console.log("\u2551 1. Review the PR in GitHub UI");
137
- console.log("\u2551 2. Merge the PR when ready");
138
- console.log(`\u2551 3. Run cleanup: pnpm wu:cleanup --id ${id}`);
139
- console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D");
140
- }
141
-
142
- export {
143
- WU_DONE_COMPLETION_MODES,
144
- isPRModeEnabled,
145
- isGhCliAvailable,
146
- createPR,
147
- buildPRBody,
148
- printGhCliMissingMessage,
149
- printPRCreatedMessage
150
- };
@@ -1,304 +0,0 @@
1
- import {
2
- asRecord
3
- } from "./chunk-HMEVZKPQ.js";
4
- import {
5
- createWUParser,
6
- runCLI
7
- } from "./chunk-2GXVIN57.js";
8
- import {
9
- GIT_DIRECTORY_NAME,
10
- WORKSPACE_CONFIG_FILE_NAME,
11
- findProjectRoot,
12
- getConfig
13
- } from "./chunk-V6OJGLBA.js";
14
-
15
- // src/lane-health.ts
16
- import fg from "fast-glob";
17
- import { minimatch } from "minimatch";
18
- import chalk from "chalk";
19
- var LOG_PREFIX = "[lane:health]";
20
- var CONFIG_FILE_NAME = WORKSPACE_CONFIG_FILE_NAME;
21
- var MAX_DISPLAY_FILES = 5;
22
- var MAX_DISPLAY_GAPS = 10;
23
- var GIT_DIR_GLOB = `${GIT_DIRECTORY_NAME}/**`;
24
- var RECURSIVE_GIT_DIR_GLOB = `**/${GIT_DIRECTORY_NAME}/**`;
25
- var DEFAULT_EXCLUDE_PATTERNS = [
26
- "node_modules/**",
27
- GIT_DIR_GLOB,
28
- "dist/**",
29
- "build/**",
30
- "coverage/**",
31
- ".turbo/**",
32
- "*.lock",
33
- "pnpm-lock.yaml",
34
- "package-lock.json",
35
- "yarn.lock",
36
- ".lumenflow/**",
37
- "worktrees/**"
38
- ];
39
- var CODE_FILE_EXTENSIONS = [
40
- ".ts",
41
- ".tsx",
42
- ".js",
43
- ".jsx",
44
- ".mjs",
45
- ".cjs",
46
- ".vue",
47
- ".svelte",
48
- ".py",
49
- ".go",
50
- ".rs",
51
- ".java",
52
- ".kt",
53
- ".swift",
54
- ".c",
55
- ".cpp",
56
- ".h",
57
- ".hpp",
58
- ".cs",
59
- ".rb",
60
- ".php"
61
- ];
62
- function parseLaneDefinition(lane) {
63
- const laneObj = asRecord(lane);
64
- if (!laneObj) {
65
- return null;
66
- }
67
- if (typeof laneObj.name !== "string" || !Array.isArray(laneObj.code_paths)) {
68
- return null;
69
- }
70
- return {
71
- name: laneObj.name,
72
- code_paths: laneObj.code_paths.filter((p) => typeof p === "string"),
73
- wip_limit: typeof laneObj.wip_limit === "number" ? laneObj.wip_limit : void 0
74
- };
75
- }
76
- function loadLaneDefinitions(projectRoot) {
77
- try {
78
- const config = getConfig({
79
- projectRoot,
80
- reload: true,
81
- strictWorkspace: true
82
- });
83
- return (config.lanes?.definitions ?? []).map(parseLaneDefinition).filter((lane) => lane !== null);
84
- } catch {
85
- return [];
86
- }
87
- }
88
- function patternsCanOverlap(patternA, patternB) {
89
- const testPathA = patternA.replace(/\*\*/g, "test/nested").replace(/\*/g, "testfile");
90
- const testPathB = patternB.replace(/\*\*/g, "test/nested").replace(/\*/g, "testfile");
91
- return minimatch(testPathB, patternA) || minimatch(testPathA, patternB);
92
- }
93
- function findOverlappingFiles(patternA, patternB) {
94
- const globOptions = {
95
- dot: true,
96
- ignore: ["**/node_modules/**", RECURSIVE_GIT_DIR_GLOB, "**/worktrees/**"],
97
- followSymbolicLinks: false,
98
- suppressErrors: true
99
- };
100
- const filesA = new Set(fg.sync(patternA, globOptions));
101
- const filesB = new Set(fg.sync(patternB, globOptions));
102
- return [...filesA].filter((file) => filesB.has(file));
103
- }
104
- function checkLanePairOverlap(laneA, laneB) {
105
- const overlaps = [];
106
- for (const pathA of laneA.code_paths) {
107
- for (const pathB of laneB.code_paths) {
108
- if (patternsCanOverlap(pathA, pathB)) {
109
- let files = [];
110
- try {
111
- files = findOverlappingFiles(pathA, pathB);
112
- } catch {
113
- }
114
- overlaps.push({
115
- lanes: [laneA.name, laneB.name],
116
- pattern: `${pathA} <-> ${pathB}`,
117
- files
118
- });
119
- }
120
- }
121
- }
122
- return overlaps;
123
- }
124
- function detectLaneOverlaps(lanes) {
125
- const overlaps = [];
126
- for (let i = 0; i < lanes.length; i++) {
127
- for (let j = i + 1; j < lanes.length; j++) {
128
- const pairOverlaps = checkLanePairOverlap(lanes[i], lanes[j]);
129
- overlaps.push(...pairOverlaps);
130
- }
131
- }
132
- return {
133
- hasOverlaps: overlaps.length > 0,
134
- overlaps
135
- };
136
- }
137
- function buildCodeFilesPattern() {
138
- const extensions = CODE_FILE_EXTENSIONS.map((ext) => ext.replace(".", "")).join(",");
139
- return `**/*.{${extensions}}`;
140
- }
141
- function detectCoverageGaps(lanes, options) {
142
- const { projectRoot, excludePatterns = DEFAULT_EXCLUDE_PATTERNS, codeOnly = true } = options;
143
- const allFilesPattern = codeOnly ? buildCodeFilesPattern() : "**/*";
144
- const globOptions = {
145
- cwd: projectRoot,
146
- dot: true,
147
- ignore: excludePatterns,
148
- onlyFiles: true,
149
- followSymbolicLinks: false,
150
- suppressErrors: true
151
- };
152
- const allFiles = fg.sync(allFilesPattern, globOptions);
153
- const coveredFiles = /* @__PURE__ */ new Set();
154
- for (const lane of lanes) {
155
- for (const pattern of lane.code_paths) {
156
- const matchedFiles = fg.sync(pattern, {
157
- ...globOptions,
158
- ignore: ["**/node_modules/**", RECURSIVE_GIT_DIR_GLOB, "**/worktrees/**"]
159
- });
160
- matchedFiles.forEach((file) => coveredFiles.add(file));
161
- }
162
- }
163
- const uncoveredFiles = allFiles.filter((file) => !coveredFiles.has(file));
164
- return {
165
- hasGaps: uncoveredFiles.length > 0,
166
- uncoveredFiles
167
- };
168
- }
169
- function getExitCode(report) {
170
- return report.healthy ? 0 : 1;
171
- }
172
- function formatOverlapSection(overlap) {
173
- const lines = [];
174
- lines.push(` ${chalk.cyan(overlap.lanes[0])} <-> ${chalk.cyan(overlap.lanes[1])}`);
175
- lines.push(` Pattern: ${overlap.pattern}`);
176
- lines.push(` Files (${overlap.files.length}):`);
177
- const displayFiles = overlap.files.slice(0, MAX_DISPLAY_FILES);
178
- displayFiles.forEach((file) => lines.push(` - ${file}`));
179
- if (overlap.files.length > MAX_DISPLAY_FILES) {
180
- lines.push(` ... and ${overlap.files.length - MAX_DISPLAY_FILES} more`);
181
- }
182
- lines.push("");
183
- return lines;
184
- }
185
- function formatLaneHealthReport(report) {
186
- const lines = [];
187
- lines.push("");
188
- lines.push(chalk.bold("=".repeat(60)));
189
- lines.push(chalk.bold.cyan(" Lane Health Report"));
190
- lines.push(chalk.bold("=".repeat(60)));
191
- lines.push("");
192
- if (report.healthy) {
193
- lines.push(chalk.green.bold(" Status: healthy"));
194
- lines.push("");
195
- lines.push(" All lane configurations are valid:");
196
- lines.push(" - No overlapping code_paths detected");
197
- lines.push(" - All code files covered by lanes");
198
- } else {
199
- lines.push(chalk.red.bold(" Status: Issues detected"));
200
- }
201
- lines.push("");
202
- if (report.overlaps.hasOverlaps) {
203
- lines.push(chalk.yellow.bold(" Overlapping Code Paths"));
204
- lines.push(" " + "-".repeat(40));
205
- lines.push("");
206
- report.overlaps.overlaps.forEach((overlap) => {
207
- lines.push(...formatOverlapSection(overlap));
208
- });
209
- }
210
- if (report.gaps.hasGaps) {
211
- lines.push(chalk.yellow.bold(" Coverage Gaps"));
212
- lines.push(" " + "-".repeat(40));
213
- lines.push("");
214
- lines.push(` ${report.gaps.uncoveredFiles.length} files not covered by UnsafeAny lane:`);
215
- lines.push("");
216
- const displayFiles = report.gaps.uncoveredFiles.slice(0, MAX_DISPLAY_GAPS);
217
- displayFiles.forEach((file) => lines.push(` - ${file}`));
218
- if (report.gaps.uncoveredFiles.length > MAX_DISPLAY_GAPS) {
219
- lines.push(` ... and ${report.gaps.uncoveredFiles.length - MAX_DISPLAY_GAPS} more`);
220
- }
221
- lines.push("");
222
- }
223
- lines.push(chalk.bold("=".repeat(60)));
224
- lines.push("");
225
- return lines.join("\n");
226
- }
227
- var log = console.log.bind(console);
228
- var warn = console.warn.bind(console);
229
- function runLaneHealthCheck(options) {
230
- const { projectRoot = findProjectRoot(), checkCoverage = true, excludePatterns } = options;
231
- const lanes = loadLaneDefinitions(projectRoot);
232
- if (lanes.length === 0) {
233
- warn(`${LOG_PREFIX} No lane definitions found in ${CONFIG_FILE_NAME}`);
234
- return {
235
- overlaps: { hasOverlaps: false, overlaps: [] },
236
- gaps: { hasGaps: false, uncoveredFiles: [] },
237
- healthy: true
238
- };
239
- }
240
- const overlaps = detectLaneOverlaps(lanes);
241
- let gaps = { hasGaps: false, uncoveredFiles: [] };
242
- if (checkCoverage) {
243
- gaps = detectCoverageGaps(lanes, { projectRoot, excludePatterns });
244
- }
245
- return {
246
- overlaps,
247
- gaps,
248
- healthy: !overlaps.hasOverlaps && !gaps.hasGaps
249
- };
250
- }
251
- async function main() {
252
- const args = createWUParser({
253
- name: "lane-health",
254
- description: "Check lane configuration health (WU-1188)",
255
- options: [
256
- { name: "json", flags: "-j, --json", type: "boolean", description: "Output as JSON" },
257
- {
258
- name: "verbose",
259
- flags: "-v, --verbose",
260
- type: "boolean",
261
- description: "Show verbose output"
262
- },
263
- {
264
- name: "no-coverage",
265
- flags: "--no-coverage",
266
- type: "boolean",
267
- description: "Skip coverage gap detection"
268
- }
269
- ],
270
- required: []
271
- });
272
- const {
273
- json,
274
- verbose,
275
- "no-coverage": noCoverage
276
- } = args;
277
- const projectRoot = findProjectRoot();
278
- if (verbose) {
279
- log(`${LOG_PREFIX} Checking lane health in: ${projectRoot}`);
280
- }
281
- const report = runLaneHealthCheck({
282
- projectRoot,
283
- checkCoverage: !noCoverage
284
- });
285
- if (json) {
286
- log(JSON.stringify(report, null, 2));
287
- } else {
288
- log(formatLaneHealthReport(report));
289
- }
290
- process.exit(getExitCode(report));
291
- }
292
- if (import.meta.main) {
293
- void runCLI(main);
294
- }
295
-
296
- export {
297
- loadLaneDefinitions,
298
- detectLaneOverlaps,
299
- detectCoverageGaps,
300
- getExitCode,
301
- formatLaneHealthReport,
302
- runLaneHealthCheck,
303
- main
304
- };
@@ -1,57 +0,0 @@
1
- // src/constants.ts
2
- var GIT_SUMMARY_PREVIEW_LENGTH = 500;
3
- var SYSTEM_PROMPT_PREVIEW_LENGTH = 500;
4
- var USER_PROMPT_PREVIEW_LENGTH = 1e3;
5
- var CONTENT_PREVIEW_LENGTH = 200;
6
- var DISCOVERY_CONTENT_TRUNCATION_LENGTH = 60;
7
- var ISSUE_TITLE_TRUNCATION_LENGTH = 40;
8
- var ISSUE_TITLE_TRUNCATED_TEXT_LENGTH = 37;
9
- var FLOW_REPORT_TITLE_COLUMN_WIDTH = 25;
10
- var WU_ID_COLUMN_WIDTH = 8;
11
- var LANE_COLUMN_WIDTH = 15;
12
- var CLEANUP_LIST_DISPLAY_LIMIT = 10;
13
- var FLOW_REPORT_WU_DISPLAY_LIMIT = 10;
14
- var TOP_ISSUES_DISPLAY_LIMIT = 5;
15
- var RECENT_ISSUES_DISPLAY_LIMIT = 5;
16
- var GATE_NAME_COLUMN_WIDTH = 20;
17
- var SEVERITY_PADDING_WIDTH = 10;
18
- var CATEGORY_PADDING_WIDTH = 20;
19
- var GIT_CONTEXT_MAX_TOKENS = 500;
20
- var LOG_TAIL_MAX_LINES = 40;
21
- var LOG_TAIL_MAX_BYTES = 64 * 1024;
22
- var ONE_DECIMAL_ROUNDING_FACTOR = 10;
23
- var JSON_INDENT = 2;
24
- var BYTES_PER_KB = 1024;
25
- function formatBytes(bytes) {
26
- if (bytes < BYTES_PER_KB) {
27
- return `${bytes} B`;
28
- }
29
- const kb = (bytes / BYTES_PER_KB).toFixed(1);
30
- return `${kb} KB`;
31
- }
32
-
33
- export {
34
- GIT_SUMMARY_PREVIEW_LENGTH,
35
- SYSTEM_PROMPT_PREVIEW_LENGTH,
36
- USER_PROMPT_PREVIEW_LENGTH,
37
- CONTENT_PREVIEW_LENGTH,
38
- DISCOVERY_CONTENT_TRUNCATION_LENGTH,
39
- ISSUE_TITLE_TRUNCATION_LENGTH,
40
- ISSUE_TITLE_TRUNCATED_TEXT_LENGTH,
41
- FLOW_REPORT_TITLE_COLUMN_WIDTH,
42
- WU_ID_COLUMN_WIDTH,
43
- LANE_COLUMN_WIDTH,
44
- CLEANUP_LIST_DISPLAY_LIMIT,
45
- FLOW_REPORT_WU_DISPLAY_LIMIT,
46
- TOP_ISSUES_DISPLAY_LIMIT,
47
- RECENT_ISSUES_DISPLAY_LIMIT,
48
- GATE_NAME_COLUMN_WIDTH,
49
- SEVERITY_PADDING_WIDTH,
50
- CATEGORY_PADDING_WIDTH,
51
- GIT_CONTEXT_MAX_TOKENS,
52
- LOG_TAIL_MAX_LINES,
53
- LOG_TAIL_MAX_BYTES,
54
- ONE_DECIMAL_ROUNDING_FACTOR,
55
- JSON_INDENT,
56
- formatBytes
57
- };
@@ -1,194 +0,0 @@
1
- import {
2
- MEMORY_FILE_NAME,
3
- loadMemory
4
- } from "./chunk-DFR4DJBM.js";
5
- import {
6
- LUMENFLOW_MEMORY_PATHS
7
- } from "./chunk-4N74J3UT.js";
8
- import {
9
- MS_PER_DAY,
10
- MS_PER_HOUR
11
- } from "./chunk-V6OJGLBA.js";
12
- import {
13
- ErrorCodes,
14
- createError
15
- } from "./chunk-RXRKBBSM.js";
16
-
17
- // ../memory/dist/mem-delete-core.js
18
- import fs from "fs/promises";
19
- import path from "path";
20
- var DURATION_MULTIPLIERS = {
21
- h: MS_PER_HOUR,
22
- d: MS_PER_DAY,
23
- w: 7 * MS_PER_DAY
24
- };
25
- function parseDuration(duration) {
26
- const durationRegex = /^(\d+)([hdw])$/;
27
- const match = durationRegex.exec(duration);
28
- if (!match || match.length < 3) {
29
- throw createError(ErrorCodes.INVALID_DURATION, `Invalid duration format: ${duration}. Use format like '7d', '24h', '2w'`);
30
- }
31
- const valueStr = match[1];
32
- const unit = match[2];
33
- if (!valueStr || !unit) {
34
- throw createError(ErrorCodes.INVALID_DURATION, `Invalid duration format: ${duration}. Use format like '7d', '24h', '2w'`);
35
- }
36
- const value = parseInt(valueStr, 10);
37
- const multiplier = DURATION_MULTIPLIERS[unit];
38
- if (!multiplier) {
39
- throw createError(ErrorCodes.INVALID_DURATION, `Unknown duration unit: ${unit}`);
40
- }
41
- return value * multiplier;
42
- }
43
- function matchesTag(node, tag) {
44
- return Array.isArray(node.tags) && node.tags.includes(tag);
45
- }
46
- function isOlderThan(node, durationMs, referenceDate) {
47
- const nodeDate = new Date(node.created_at);
48
- const cutoffDate = new Date(referenceDate.getTime() - durationMs);
49
- return nodeDate < cutoffDate;
50
- }
51
- function isAlreadyDeleted(node) {
52
- return node.metadata?.status === "deleted";
53
- }
54
- function markAsDeleted(node) {
55
- return {
56
- ...node,
57
- metadata: {
58
- ...node.metadata,
59
- status: "deleted",
60
- deleted_at: (/* @__PURE__ */ new Date()).toISOString()
61
- }
62
- };
63
- }
64
- function processNodeIdsFilter(nodeIds, nodeMap, toDeleteSet, errors) {
65
- for (const nodeId of nodeIds) {
66
- const node = nodeMap.get(nodeId);
67
- if (node) {
68
- toDeleteSet.add(nodeId);
69
- } else {
70
- errors.push(`Node not found: ${nodeId}`);
71
- }
72
- }
73
- }
74
- function processTagFilter(nodes, tag, toDeleteSet) {
75
- for (const node of nodes) {
76
- if (matchesTag(node, tag)) {
77
- toDeleteSet.add(node.id);
78
- }
79
- }
80
- }
81
- function processOlderThanFilter(nodes, olderThan, referenceDate, tag, hasNodeIds, toDeleteSet) {
82
- const durationMs = parseDuration(olderThan);
83
- for (const node of nodes) {
84
- const nodeIsOld = isOlderThan(node, durationMs, referenceDate);
85
- if (tag) {
86
- const shouldInclude = nodeIsOld && matchesTag(node, tag);
87
- if (shouldInclude) {
88
- toDeleteSet.add(node.id);
89
- } else {
90
- toDeleteSet.delete(node.id);
91
- }
92
- } else if (!hasNodeIds && nodeIsOld) {
93
- toDeleteSet.add(node.id);
94
- }
95
- }
96
- }
97
- function findNodesToDelete(nodes, options) {
98
- const { nodeIds, tag, olderThan, referenceDate = /* @__PURE__ */ new Date() } = options;
99
- const errors = [];
100
- const toDeleteSet = /* @__PURE__ */ new Set();
101
- const nodeMap = /* @__PURE__ */ new Map();
102
- for (const node of nodes) {
103
- nodeMap.set(node.id, node);
104
- }
105
- if (nodeIds && nodeIds.length > 0) {
106
- processNodeIdsFilter(nodeIds, nodeMap, toDeleteSet, errors);
107
- }
108
- if (tag) {
109
- processTagFilter(nodes, tag, toDeleteSet);
110
- }
111
- if (olderThan) {
112
- const hasNodeIds = Boolean(nodeIds && nodeIds.length > 0);
113
- processOlderThanFilter(nodes, olderThan, referenceDate, tag, hasNodeIds, toDeleteSet);
114
- }
115
- const toDelete = [];
116
- for (const nodeId of toDeleteSet) {
117
- const node = nodeMap.get(nodeId);
118
- if (node) {
119
- toDelete.push(node);
120
- }
121
- }
122
- return { toDelete, errors };
123
- }
124
- async function writeUpdatedNodes(baseDir, nodes) {
125
- const filePath = path.join(baseDir, MEMORY_FILE_NAME);
126
- const content = nodes.map((node) => JSON.stringify(node)).join("\n") + "\n";
127
- await fs.writeFile(filePath, content, "utf-8");
128
- }
129
- async function deleteMemoryNodes(baseDir, options) {
130
- const { nodeIds, tag, olderThan, dryRun = false } = options;
131
- if ((!nodeIds || nodeIds.length === 0) && !tag && !olderThan) {
132
- return {
133
- success: false,
134
- deletedCount: 0,
135
- deletedIds: [],
136
- skippedIds: [],
137
- dryRun,
138
- errors: ["At least one filter (nodeIds, tag, or olderThan) is required"]
139
- };
140
- }
141
- const memoryDir = path.join(baseDir, LUMENFLOW_MEMORY_PATHS.MEMORY_DIR);
142
- let memory;
143
- try {
144
- memory = await loadMemory(memoryDir, { includeArchived: true });
145
- } catch (err) {
146
- const errMsg = err instanceof Error ? err.message : String(err);
147
- return {
148
- success: false,
149
- deletedCount: 0,
150
- deletedIds: [],
151
- skippedIds: [],
152
- dryRun,
153
- errors: [`Failed to load memory: ${errMsg}`]
154
- };
155
- }
156
- const { toDelete, errors } = findNodesToDelete(memory.nodes, options);
157
- const deletedIds = [];
158
- const skippedIds = [];
159
- const nodesToUpdate = [];
160
- for (const node of toDelete) {
161
- if (isAlreadyDeleted(node)) {
162
- skippedIds.push(node.id);
163
- errors.push(`Node already deleted: ${node.id}`);
164
- } else {
165
- deletedIds.push(node.id);
166
- nodesToUpdate.push(node);
167
- }
168
- }
169
- if (!dryRun && nodesToUpdate.length > 0) {
170
- const deletedIdSet = new Set(deletedIds);
171
- const updatedNodes = memory.nodes.map((node) => {
172
- if (deletedIdSet.has(node.id)) {
173
- return markAsDeleted(node);
174
- }
175
- return node;
176
- });
177
- await writeUpdatedNodes(memoryDir, updatedNodes);
178
- }
179
- const hasNotFoundErrors = errors.some((e) => e.startsWith("Node not found:"));
180
- const allNodesHandled = deletedIds.length > 0 || skippedIds.length > 0;
181
- const success = !hasNotFoundErrors || allNodesHandled;
182
- return {
183
- success,
184
- deletedCount: deletedIds.length,
185
- deletedIds,
186
- skippedIds,
187
- dryRun,
188
- errors
189
- };
190
- }
191
-
192
- export {
193
- deleteMemoryNodes
194
- };