@lumenflow/cli 4.20.2 → 4.22.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 (131) hide show
  1. package/README.md +30 -27
  2. package/dist/config-set.js +54 -36
  3. package/dist/config-set.js.map +1 -1
  4. package/dist/delegation-list.js +86 -53
  5. package/dist/delegation-list.js.map +1 -1
  6. package/dist/gate-conditional.js +476 -0
  7. package/dist/gate-conditional.js.map +1 -0
  8. package/dist/gates-plan-resolvers.js +24 -1
  9. package/dist/gates-plan-resolvers.js.map +1 -1
  10. package/dist/init-templates.js +13 -0
  11. package/dist/init-templates.js.map +1 -1
  12. package/dist/initiative-create.js +1 -1
  13. package/dist/orchestrate-init-status.js +24 -31
  14. package/dist/orchestrate-init-status.js.map +1 -1
  15. package/dist/orchestrate-initiative.js +31 -2
  16. package/dist/orchestrate-initiative.js.map +1 -1
  17. package/dist/orchestrate-monitor.js +433 -1
  18. package/dist/orchestrate-monitor.js.map +1 -1
  19. package/dist/public-manifest.js +11 -4
  20. package/dist/public-manifest.js.map +1 -1
  21. package/package.json +9 -8
  22. package/packs/agent-runtime/.turbo/turbo-build.log +1 -1
  23. package/packs/agent-runtime/package.json +1 -1
  24. package/packs/sidekick/.turbo/turbo-build.log +1 -1
  25. package/packs/sidekick/package.json +1 -1
  26. package/packs/software-delivery/.turbo/turbo-build.log +1 -1
  27. package/packs/software-delivery/package.json +1 -1
  28. package/templates/core/LUMENFLOW.md.template +6 -3
  29. package/templates/core/ai/onboarding/first-wu-mistakes.md.template +2 -2
  30. package/templates/core/ai/onboarding/initiative-orchestration.md.template +83 -27
  31. package/templates/core/ai/onboarding/quick-ref-commands.md.template +9 -5
  32. package/templates/core/ai/onboarding/starting-prompt.md.template +1 -1
  33. package/templates/core/ai/onboarding/vendor-support.md.template +13 -0
  34. package/dist/chunk-2D2VOCA4.js +0 -37
  35. package/dist/chunk-2D5KFYGX.js +0 -284
  36. package/dist/chunk-2GXVIN57.js +0 -14072
  37. package/dist/chunk-2MQ7HZWZ.js +0 -26
  38. package/dist/chunk-2UFQ3A3C.js +0 -643
  39. package/dist/chunk-3RG5ZIWI.js +0 -10
  40. package/dist/chunk-4N74J3UT.js +0 -15
  41. package/dist/chunk-5GTOXFYR.js +0 -392
  42. package/dist/chunk-5VY6MQMC.js +0 -240
  43. package/dist/chunk-67XVPMRY.js +0 -1297
  44. package/dist/chunk-6HO4GWJE.js +0 -164
  45. package/dist/chunk-6W5XHWYV.js +0 -1890
  46. package/dist/chunk-6X4EMYJQ.js +0 -64
  47. package/dist/chunk-6XYXI2NQ.js +0 -772
  48. package/dist/chunk-7ANSOV6Q.js +0 -285
  49. package/dist/chunk-A624LFLB.js +0 -1380
  50. package/dist/chunk-ADN5NHG4.js +0 -126
  51. package/dist/chunk-B7YJYJKG.js +0 -33
  52. package/dist/chunk-CCLHCPKG.js +0 -210
  53. package/dist/chunk-CK36VROC.js +0 -1584
  54. package/dist/chunk-D3UOFRSB.js +0 -81
  55. package/dist/chunk-DFR4DJBM.js +0 -230
  56. package/dist/chunk-DSYBDHYH.js +0 -79
  57. package/dist/chunk-DWMLTXKQ.js +0 -1176
  58. package/dist/chunk-E3REJTAJ.js +0 -28
  59. package/dist/chunk-EA3IVO64.js +0 -633
  60. package/dist/chunk-EK2AKZKD.js +0 -55
  61. package/dist/chunk-ELD7JTTT.js +0 -343
  62. package/dist/chunk-EX6TT2XI.js +0 -195
  63. package/dist/chunk-EXINSFZE.js +0 -82
  64. package/dist/chunk-EZ6ZBYBM.js +0 -510
  65. package/dist/chunk-FBKAPTJ2.js +0 -16
  66. package/dist/chunk-FVLV5RYH.js +0 -1118
  67. package/dist/chunk-GDNSBQVK.js +0 -2485
  68. package/dist/chunk-GPQHMBNN.js +0 -278
  69. package/dist/chunk-GTFJB67L.js +0 -68
  70. package/dist/chunk-HANJXVKW.js +0 -1127
  71. package/dist/chunk-HEVS5YLD.js +0 -269
  72. package/dist/chunk-HMEVZKPQ.js +0 -9
  73. package/dist/chunk-HRGSYNLM.js +0 -3511
  74. package/dist/chunk-ISZR5N4K.js +0 -60
  75. package/dist/chunk-J6SUPR2C.js +0 -226
  76. package/dist/chunk-JERYVEIZ.js +0 -244
  77. package/dist/chunk-JHHWGL2N.js +0 -87
  78. package/dist/chunk-JONWQUB5.js +0 -775
  79. package/dist/chunk-K2DIWWDM.js +0 -1766
  80. package/dist/chunk-KY4PGL5V.js +0 -969
  81. package/dist/chunk-L737LQ4C.js +0 -1285
  82. package/dist/chunk-LFTWYIB2.js +0 -497
  83. package/dist/chunk-LV47RFNJ.js +0 -41
  84. package/dist/chunk-MKSAITI7.js +0 -15
  85. package/dist/chunk-MZ7RKIX4.js +0 -212
  86. package/dist/chunk-NAP6CFSO.js +0 -84
  87. package/dist/chunk-ND6MY37M.js +0 -16
  88. package/dist/chunk-NMG736UR.js +0 -683
  89. package/dist/chunk-NRAXROED.js +0 -32
  90. package/dist/chunk-NRIZR3A7.js +0 -690
  91. package/dist/chunk-NX43BG3M.js +0 -233
  92. package/dist/chunk-O645XLSI.js +0 -297
  93. package/dist/chunk-OMJD6A3S.js +0 -235
  94. package/dist/chunk-QB6SJD4T.js +0 -430
  95. package/dist/chunk-QFSTL4J3.js +0 -276
  96. package/dist/chunk-QLGDFMFX.js +0 -212
  97. package/dist/chunk-RIAAGL2E.js +0 -13
  98. package/dist/chunk-RWO5XMZ6.js +0 -86
  99. package/dist/chunk-RXRKBBSM.js +0 -149
  100. package/dist/chunk-RZOZMML6.js +0 -363
  101. package/dist/chunk-U7I7FS7T.js +0 -113
  102. package/dist/chunk-UI42RODY.js +0 -717
  103. package/dist/chunk-UTVMVSCO.js +0 -519
  104. package/dist/chunk-V6OJGLBA.js +0 -1746
  105. package/dist/chunk-W2JHVH7D.js +0 -152
  106. package/dist/chunk-WD3Y7VQN.js +0 -280
  107. package/dist/chunk-WOCTQ5MS.js +0 -303
  108. package/dist/chunk-WZR3ZUNN.js +0 -696
  109. package/dist/chunk-XGI665H7.js +0 -150
  110. package/dist/chunk-XKY65P2T.js +0 -304
  111. package/dist/chunk-Y4CQZY65.js +0 -57
  112. package/dist/chunk-YFEXKLVE.js +0 -194
  113. package/dist/chunk-YHO3HS5X.js +0 -287
  114. package/dist/chunk-YLS7AZSX.js +0 -738
  115. package/dist/chunk-ZE473AO6.js +0 -49
  116. package/dist/chunk-ZF747T3O.js +0 -644
  117. package/dist/chunk-ZHCZHZH3.js +0 -43
  118. package/dist/chunk-ZZNZX2XY.js +0 -87
  119. package/dist/constants-7QAP3VQ4.js +0 -23
  120. package/dist/dist-IY3UUMWK.js +0 -33
  121. package/dist/invariants-runner-W5RGHCSU.js +0 -27
  122. package/dist/lane-lock-6J36HD5O.js +0 -35
  123. package/dist/mem-checkpoint-core-EANG2GVN.js +0 -14
  124. package/dist/mem-signal-core-2LZ2WYHW.js +0 -19
  125. package/dist/memory-store-OLB5FO7K.js +0 -18
  126. package/dist/service-6BYCOCO5.js +0 -13
  127. package/dist/spawn-policy-resolver-NTSZYQ6R.js +0 -17
  128. package/dist/spawn-task-builder-R4E2BHSW.js +0 -22
  129. package/dist/wu-done-pr-WLFFFEPJ.js +0 -25
  130. package/dist/wu-done-validation-3J5E36FE.js +0 -30
  131. package/dist/wu-duplicate-id-detector-5S7JHELK.js +0 -232
@@ -1,126 +0,0 @@
1
- import {
2
- MEMORY_PATTERNS,
3
- loadMemory
4
- } from "./chunk-DFR4DJBM.js";
5
- import {
6
- LUMENFLOW_MEMORY_PATHS
7
- } from "./chunk-4N74J3UT.js";
8
- import {
9
- ErrorCodes,
10
- createError
11
- } from "./chunk-RXRKBBSM.js";
12
-
13
- // ../memory/dist/mem-ready-core.js
14
- import fs from "fs/promises";
15
- import path from "path";
16
- var RELATIONSHIPS_FILE_NAME = "relationships.jsonl";
17
- var PRIORITY_RANK = {
18
- P0: 0,
19
- P1: 1,
20
- P2: 2,
21
- P3: 3
22
- };
23
- var DEFAULT_PRIORITY_RANK = 999;
24
- function getPriorityRank(node) {
25
- const priority = node.metadata?.priority;
26
- if (!priority) {
27
- return DEFAULT_PRIORITY_RANK;
28
- }
29
- return PRIORITY_RANK[priority] ?? DEFAULT_PRIORITY_RANK;
30
- }
31
- function compareNodes(a, b) {
32
- const priorityDiff = getPriorityRank(a) - getPriorityRank(b);
33
- if (priorityDiff !== 0) {
34
- return priorityDiff;
35
- }
36
- const aTime = new Date(a.created_at).getTime();
37
- const bTime = new Date(b.created_at).getTime();
38
- if (aTime !== bTime) {
39
- return aTime - bTime;
40
- }
41
- return a.id.localeCompare(b.id);
42
- }
43
- async function loadRelationships(memoryDir) {
44
- const filePath = path.join(memoryDir, RELATIONSHIPS_FILE_NAME);
45
- try {
46
- const content = await fs.readFile(filePath, { encoding: "utf-8" });
47
- const lines = content.split("\n");
48
- const relationships = [];
49
- for (const line of lines) {
50
- const trimmed = line.trim();
51
- if (!trimmed)
52
- continue;
53
- try {
54
- relationships.push(JSON.parse(trimmed));
55
- } catch {
56
- continue;
57
- }
58
- }
59
- return relationships;
60
- } catch (err) {
61
- const error = err;
62
- if (error.code === "ENOENT") {
63
- return [];
64
- }
65
- throw error;
66
- }
67
- }
68
- function buildBlockedSet(relationships) {
69
- const blocked = /* @__PURE__ */ new Set();
70
- for (const rel of relationships) {
71
- if (rel.type === "blocks") {
72
- blocked.add(rel.to_id);
73
- }
74
- }
75
- return blocked;
76
- }
77
- function isBlocked(node, blockedByRelationships) {
78
- if (blockedByRelationships.has(node.id)) {
79
- return true;
80
- }
81
- const blockedBy = node.metadata?.blocked_by;
82
- if (Array.isArray(blockedBy) && blockedBy.length > 0) {
83
- return true;
84
- }
85
- return false;
86
- }
87
- function isClosed(node) {
88
- if (node.lifecycle === "ephemeral") {
89
- return true;
90
- }
91
- if (node.metadata?.status === "closed") {
92
- return true;
93
- }
94
- return false;
95
- }
96
- function validateWuId(wuId) {
97
- if (!MEMORY_PATTERNS.WU_ID.test(wuId)) {
98
- throw createError(ErrorCodes.INVALID_WU_ID, `Invalid WU ID format: ${wuId}. Expected format: WU-XXX (e.g., WU-1234)`);
99
- }
100
- }
101
- async function queryReadyNodes(baseDir, options) {
102
- const { wuId, type } = options;
103
- validateWuId(wuId);
104
- const memoryDir = path.join(baseDir, LUMENFLOW_MEMORY_PATHS.MEMORY_DIR);
105
- const memory = await loadMemory(memoryDir);
106
- const relationships = await loadRelationships(memoryDir);
107
- const blockedByRelationships = buildBlockedSet(relationships);
108
- const wuNodes = memory.byWu.get(wuId) ?? [];
109
- const readyNodes = wuNodes.filter((node) => {
110
- if (isBlocked(node, blockedByRelationships)) {
111
- return false;
112
- }
113
- if (isClosed(node)) {
114
- return false;
115
- }
116
- if (type && node.type !== type) {
117
- return false;
118
- }
119
- return true;
120
- });
121
- return readyNodes.sort(compareNodes);
122
- }
123
-
124
- export {
125
- queryReadyNodes
126
- };
@@ -1,33 +0,0 @@
1
- import {
2
- CLAIMED_MODES
3
- } from "./chunk-V6OJGLBA.js";
4
-
5
- // src/wu-state-cloud.ts
6
- var BRANCH_PR_MODE = CLAIMED_MODES.BRANCH_PR;
7
- var BRANCH_ONLY_MODE = CLAIMED_MODES.BRANCH_ONLY;
8
- var WORKTREE_EDIT_MODE = "worktree";
9
- var BRANCH_PR_EDIT_MODE = "branch-pr";
10
- var BLOCKED_EDIT_MODE = "blocked";
11
- function shouldUseBranchPrStatePath(doc) {
12
- return doc.claimed_mode === BRANCH_PR_MODE;
13
- }
14
- function resolveInProgressEditMode(claimedMode) {
15
- if (claimedMode === BRANCH_PR_MODE) {
16
- return BRANCH_PR_EDIT_MODE;
17
- }
18
- if (claimedMode === BRANCH_ONLY_MODE) {
19
- return BLOCKED_EDIT_MODE;
20
- }
21
- return WORKTREE_EDIT_MODE;
22
- }
23
- function shouldUseBranchPrDeletePath(docs) {
24
- return docs.some((doc) => shouldUseBranchPrStatePath(doc));
25
- }
26
-
27
- export {
28
- BRANCH_PR_EDIT_MODE,
29
- BLOCKED_EDIT_MODE,
30
- shouldUseBranchPrStatePath,
31
- resolveInProgressEditMode,
32
- shouldUseBranchPrDeletePath
33
- };
@@ -1,210 +0,0 @@
1
- import {
2
- ensureMemoryDir
3
- } from "./chunk-ND6MY37M.js";
4
- import {
5
- generateMemId
6
- } from "./chunk-RIAAGL2E.js";
7
- import {
8
- MEMORY_NODE_TYPES,
9
- MEMORY_PATTERNS,
10
- appendNode,
11
- validateMemoryNode,
12
- validateRelationship
13
- } from "./chunk-DFR4DJBM.js";
14
- import {
15
- LUMENFLOW_MEMORY_PATHS
16
- } from "./chunk-4N74J3UT.js";
17
- import {
18
- GIT_DIRECTORY_NAME,
19
- GIT_WORKTREES_SENTINEL
20
- } from "./chunk-V6OJGLBA.js";
21
- import {
22
- ErrorCodes,
23
- createError
24
- } from "./chunk-RXRKBBSM.js";
25
-
26
- // ../memory/dist/mem-create-core.js
27
- import fs from "fs/promises";
28
- import path from "path";
29
- var RELATIONSHIPS_FILE_NAME = "relationships.jsonl";
30
- var DEFAULT_NODE_TYPE = "discovery";
31
- var TYPE_ALIASES = {
32
- bug: { type: "discovery", tag: "bug" },
33
- idea: { type: "discovery", tag: "idea" },
34
- question: { type: "discovery", tag: "question" },
35
- dependency: { type: "discovery", tag: "dependency" }
36
- };
37
- var LIFECYCLE_BY_TYPE = {
38
- session: "wu",
39
- discovery: "wu",
40
- checkpoint: "session",
41
- note: "session",
42
- summary: "project"
43
- };
44
- var ERROR_MESSAGES = {
45
- TITLE_REQUIRED: "title is required",
46
- TITLE_EMPTY: "title cannot be empty",
47
- INVALID_TYPE: `Invalid node type. Must be one of: ${MEMORY_NODE_TYPES.join(", ")}`,
48
- WU_ID_INVALID: "Invalid WU ID format. Expected pattern: WU-XXX (e.g., WU-123)",
49
- MEMORY_ID_INVALID: "Invalid memory ID format. Expected pattern: mem-XXXX (e.g., mem-a1b2)"
50
- };
51
- function normalizeType(inputType) {
52
- const alias = TYPE_ALIASES[inputType];
53
- if (alias) {
54
- return { type: alias.type, aliasTag: alias.tag };
55
- }
56
- return { type: inputType, aliasTag: null };
57
- }
58
- async function getMainCheckoutFromWorktree(dir) {
59
- const gitPath = path.join(dir, GIT_DIRECTORY_NAME);
60
- try {
61
- const stat = await fs.stat(gitPath);
62
- if (stat.isFile()) {
63
- const gitContent = await fs.readFile(gitPath, { encoding: "utf-8" });
64
- const match = gitContent.match(/^gitdir:\s*(.+)/);
65
- if (match && match[1]) {
66
- const gitDir = match[1].trim();
67
- const worktreesIndex = gitDir.indexOf(GIT_WORKTREES_SENTINEL);
68
- if (worktreesIndex !== -1) {
69
- return gitDir.substring(0, worktreesIndex);
70
- }
71
- }
72
- }
73
- } catch {
74
- }
75
- return null;
76
- }
77
- async function readCurrentSession(baseDir) {
78
- const sessionPath = path.join(baseDir, LUMENFLOW_MEMORY_PATHS.SESSION_CURRENT);
79
- try {
80
- const content = await fs.readFile(sessionPath, { encoding: "utf-8" });
81
- return JSON.parse(content);
82
- } catch {
83
- return null;
84
- }
85
- }
86
- async function inferSessionFromSessionFile(baseDir) {
87
- let session = await readCurrentSession(baseDir);
88
- if (session) {
89
- return session;
90
- }
91
- const mainCheckout = await getMainCheckoutFromWorktree(baseDir);
92
- if (mainCheckout) {
93
- session = await readCurrentSession(mainCheckout);
94
- if (session) {
95
- return session;
96
- }
97
- }
98
- return null;
99
- }
100
- function isValidSessionId(value) {
101
- if (!value)
102
- return false;
103
- if (typeof value !== "string")
104
- return false;
105
- return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
106
- }
107
- function isValidWuId(wuId) {
108
- if (!wuId)
109
- return true;
110
- return MEMORY_PATTERNS.WU_ID.test(wuId);
111
- }
112
- function isValidMemoryId(memId) {
113
- return MEMORY_PATTERNS.MEMORY_ID.test(memId);
114
- }
115
- async function appendRelationship(memoryDir, relationship) {
116
- const validation = validateRelationship(relationship);
117
- if (!validation.success) {
118
- const issues = validation.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join(", ");
119
- throw createError(ErrorCodes.VALIDATION_ERROR, `Relationship validation error: ${issues}`);
120
- }
121
- const filePath = path.join(memoryDir, RELATIONSHIPS_FILE_NAME);
122
- const line = `${JSON.stringify(relationship)}
123
- `;
124
- await fs.appendFile(filePath, line, { encoding: "utf-8" });
125
- return relationship;
126
- }
127
- function getLifecycleForType(type) {
128
- return LIFECYCLE_BY_TYPE[type];
129
- }
130
- async function createMemoryNode(baseDir, options) {
131
- const { title, type: inputType = DEFAULT_NODE_TYPE, wuId: explicitWuId, sessionId: explicitSessionId, discoveredFrom, tags: inputTags, priority } = options;
132
- if (title == null) {
133
- throw createError(ErrorCodes.VALIDATION_ERROR, ERROR_MESSAGES.TITLE_REQUIRED);
134
- }
135
- if (title === "") {
136
- throw createError(ErrorCodes.VALIDATION_ERROR, ERROR_MESSAGES.TITLE_EMPTY);
137
- }
138
- const { type: normalizedType, aliasTag } = normalizeType(inputType);
139
- if (!MEMORY_NODE_TYPES.includes(normalizedType)) {
140
- throw createError(ErrorCodes.VALIDATION_ERROR, ERROR_MESSAGES.INVALID_TYPE);
141
- }
142
- const type = normalizedType;
143
- let tags = inputTags ? [...inputTags] : [];
144
- if (aliasTag && !tags.includes(aliasTag)) {
145
- tags = [aliasTag, ...tags];
146
- }
147
- tags = [...new Set(tags)];
148
- const inferredSession = explicitWuId && explicitSessionId ? null : await inferSessionFromSessionFile(baseDir);
149
- const wuId = explicitWuId || inferredSession?.wu_id;
150
- const sessionId = explicitSessionId || (isValidSessionId(inferredSession?.session_id) ? inferredSession.session_id : void 0);
151
- if (wuId && !isValidWuId(wuId)) {
152
- throw createError(ErrorCodes.INVALID_WU_ID, ERROR_MESSAGES.WU_ID_INVALID);
153
- }
154
- if (discoveredFrom && !isValidMemoryId(discoveredFrom)) {
155
- throw createError(ErrorCodes.VALIDATION_ERROR, ERROR_MESSAGES.MEMORY_ID_INVALID);
156
- }
157
- const memoryDir = await ensureMemoryDir(baseDir);
158
- const timestamp = (/* @__PURE__ */ new Date()).toISOString();
159
- const idContent = `${title}-${timestamp}`;
160
- const id = generateMemId(idContent);
161
- const lifecycle = getLifecycleForType(type);
162
- const metadata = {};
163
- if (priority) {
164
- metadata.priority = priority;
165
- }
166
- const node = {
167
- id,
168
- type,
169
- lifecycle,
170
- content: title,
171
- created_at: timestamp
172
- };
173
- if (wuId) {
174
- node.wu_id = wuId;
175
- }
176
- if (sessionId) {
177
- node.session_id = sessionId;
178
- }
179
- if (Object.keys(metadata).length > 0) {
180
- node.metadata = metadata;
181
- }
182
- if (tags && tags.length > 0) {
183
- node.tags = tags;
184
- }
185
- const nodeValidation = validateMemoryNode(node);
186
- if (!nodeValidation.success) {
187
- const issues = nodeValidation.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join(", ");
188
- throw createError(ErrorCodes.VALIDATION_ERROR, `Node validation error: ${issues}`);
189
- }
190
- await appendNode(memoryDir, node);
191
- const result = {
192
- success: true,
193
- node
194
- };
195
- if (discoveredFrom) {
196
- const relationship = {
197
- from_id: node.id,
198
- to_id: discoveredFrom,
199
- type: "discovered_from",
200
- created_at: timestamp
201
- };
202
- await appendRelationship(memoryDir, relationship);
203
- result.relationship = relationship;
204
- }
205
- return result;
206
- }
207
-
208
- export {
209
- createMemoryNode
210
- };