@lumenflow/cli 3.12.6 → 3.12.7

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 (109) hide show
  1. package/dist/wu-claim.js +2 -1
  2. package/dist/wu-claim.js.map +1 -1
  3. package/dist/wu-done-policies.js +9 -9
  4. package/dist/wu-done-policies.js.map +1 -1
  5. package/dist/wu-spawn-strategy-resolver.js +14 -6
  6. package/dist/wu-spawn-strategy-resolver.js.map +1 -1
  7. package/package.json +8 -8
  8. package/packs/sidekick/.turbo/turbo-build.log +1 -1
  9. package/packs/sidekick/package.json +1 -1
  10. package/packs/software-delivery/.turbo/turbo-build.log +1 -1
  11. package/packs/software-delivery/package.json +1 -1
  12. package/dist/chunk-2D2VOCA4.js +0 -37
  13. package/dist/chunk-2D5KFYGX.js +0 -284
  14. package/dist/chunk-2GXVIN57.js +0 -14072
  15. package/dist/chunk-2MQ7HZWZ.js +0 -26
  16. package/dist/chunk-2UFQ3A3C.js +0 -643
  17. package/dist/chunk-3RG5ZIWI.js +0 -10
  18. package/dist/chunk-4N74J3UT.js +0 -15
  19. package/dist/chunk-5GTOXFYR.js +0 -392
  20. package/dist/chunk-5VY6MQMC.js +0 -240
  21. package/dist/chunk-67XVPMRY.js +0 -1297
  22. package/dist/chunk-6HO4GWJE.js +0 -164
  23. package/dist/chunk-6W5XHWYV.js +0 -1890
  24. package/dist/chunk-6X4EMYJQ.js +0 -64
  25. package/dist/chunk-6XYXI2NQ.js +0 -772
  26. package/dist/chunk-7ANSOV6Q.js +0 -285
  27. package/dist/chunk-A624LFLB.js +0 -1380
  28. package/dist/chunk-ADN5NHG4.js +0 -126
  29. package/dist/chunk-B7YJYJKG.js +0 -33
  30. package/dist/chunk-CCLHCPKG.js +0 -210
  31. package/dist/chunk-CK36VROC.js +0 -1584
  32. package/dist/chunk-D3UOFRSB.js +0 -81
  33. package/dist/chunk-DFR4DJBM.js +0 -230
  34. package/dist/chunk-DSYBDHYH.js +0 -79
  35. package/dist/chunk-DWMLTXKQ.js +0 -1176
  36. package/dist/chunk-E3REJTAJ.js +0 -28
  37. package/dist/chunk-EA3IVO64.js +0 -633
  38. package/dist/chunk-EK2AKZKD.js +0 -55
  39. package/dist/chunk-ELD7JTTT.js +0 -343
  40. package/dist/chunk-EX6TT2XI.js +0 -195
  41. package/dist/chunk-EXINSFZE.js +0 -82
  42. package/dist/chunk-EZ6ZBYBM.js +0 -510
  43. package/dist/chunk-FBKAPTJ2.js +0 -16
  44. package/dist/chunk-FVLV5RYH.js +0 -1118
  45. package/dist/chunk-GDNSBQVK.js +0 -2485
  46. package/dist/chunk-GPQHMBNN.js +0 -278
  47. package/dist/chunk-GTFJB67L.js +0 -68
  48. package/dist/chunk-HANJXVKW.js +0 -1127
  49. package/dist/chunk-HEVS5YLD.js +0 -269
  50. package/dist/chunk-HMEVZKPQ.js +0 -9
  51. package/dist/chunk-HRGSYNLM.js +0 -3511
  52. package/dist/chunk-ISZR5N4K.js +0 -60
  53. package/dist/chunk-J6SUPR2C.js +0 -226
  54. package/dist/chunk-JERYVEIZ.js +0 -244
  55. package/dist/chunk-JHHWGL2N.js +0 -87
  56. package/dist/chunk-JONWQUB5.js +0 -775
  57. package/dist/chunk-K2DIWWDM.js +0 -1766
  58. package/dist/chunk-KY4PGL5V.js +0 -969
  59. package/dist/chunk-L737LQ4C.js +0 -1285
  60. package/dist/chunk-LFTWYIB2.js +0 -497
  61. package/dist/chunk-LV47RFNJ.js +0 -41
  62. package/dist/chunk-MKSAITI7.js +0 -15
  63. package/dist/chunk-MZ7RKIX4.js +0 -212
  64. package/dist/chunk-NAP6CFSO.js +0 -84
  65. package/dist/chunk-ND6MY37M.js +0 -16
  66. package/dist/chunk-NMG736UR.js +0 -683
  67. package/dist/chunk-NRAXROED.js +0 -32
  68. package/dist/chunk-NRIZR3A7.js +0 -690
  69. package/dist/chunk-NX43BG3M.js +0 -233
  70. package/dist/chunk-O645XLSI.js +0 -297
  71. package/dist/chunk-OMJD6A3S.js +0 -235
  72. package/dist/chunk-QB6SJD4T.js +0 -430
  73. package/dist/chunk-QFSTL4J3.js +0 -276
  74. package/dist/chunk-QLGDFMFX.js +0 -212
  75. package/dist/chunk-RIAAGL2E.js +0 -13
  76. package/dist/chunk-RWO5XMZ6.js +0 -86
  77. package/dist/chunk-RXRKBBSM.js +0 -149
  78. package/dist/chunk-RZOZMML6.js +0 -363
  79. package/dist/chunk-U7I7FS7T.js +0 -113
  80. package/dist/chunk-UI42RODY.js +0 -717
  81. package/dist/chunk-UTVMVSCO.js +0 -519
  82. package/dist/chunk-V6OJGLBA.js +0 -1746
  83. package/dist/chunk-W2JHVH7D.js +0 -152
  84. package/dist/chunk-WD3Y7VQN.js +0 -280
  85. package/dist/chunk-WOCTQ5MS.js +0 -303
  86. package/dist/chunk-WZR3ZUNN.js +0 -696
  87. package/dist/chunk-XGI665H7.js +0 -150
  88. package/dist/chunk-XKY65P2T.js +0 -304
  89. package/dist/chunk-Y4CQZY65.js +0 -57
  90. package/dist/chunk-YFEXKLVE.js +0 -194
  91. package/dist/chunk-YHO3HS5X.js +0 -287
  92. package/dist/chunk-YLS7AZSX.js +0 -738
  93. package/dist/chunk-ZE473AO6.js +0 -49
  94. package/dist/chunk-ZF747T3O.js +0 -644
  95. package/dist/chunk-ZHCZHZH3.js +0 -43
  96. package/dist/chunk-ZZNZX2XY.js +0 -87
  97. package/dist/constants-7QAP3VQ4.js +0 -23
  98. package/dist/dist-IY3UUMWK.js +0 -33
  99. package/dist/invariants-runner-W5RGHCSU.js +0 -27
  100. package/dist/lane-lock-6J36HD5O.js +0 -35
  101. package/dist/mem-checkpoint-core-EANG2GVN.js +0 -14
  102. package/dist/mem-signal-core-2LZ2WYHW.js +0 -19
  103. package/dist/memory-store-OLB5FO7K.js +0 -18
  104. package/dist/service-6BYCOCO5.js +0 -13
  105. package/dist/spawn-policy-resolver-NTSZYQ6R.js +0 -17
  106. package/dist/spawn-task-builder-R4E2BHSW.js +0 -22
  107. package/dist/wu-done-pr-WLFFFEPJ.js +0 -25
  108. package/dist/wu-done-validation-3J5E36FE.js +0 -30
  109. package/dist/wu-duplicate-id-detector-5S7JHELK.js +0 -232
@@ -1,149 +0,0 @@
1
- // ../core/dist/error-handler.js
2
- import path from "path";
3
- var UNKNOWN_ERROR_MESSAGE = "Unknown error";
4
- function hasMessage(value) {
5
- return typeof value === "object" && value !== null && "message" in value && typeof value.message === "string";
6
- }
7
- var ProcessExitError = class _ProcessExitError extends Error {
8
- /** Process exit code to use when caught at CLI boundary */
9
- exitCode;
10
- /**
11
- * Create a process exit error
12
- * @param {string} message - Error message (already formatted by die() or caller)
13
- * @param {number} [exitCode=1] - Process exit code
14
- */
15
- constructor(message, exitCode = 1) {
16
- super(message);
17
- this.name = "ProcessExitError";
18
- this.exitCode = exitCode;
19
- if (Error.captureStackTrace) {
20
- Error.captureStackTrace(this, _ProcessExitError);
21
- }
22
- }
23
- };
24
- var WUError = class _WUError extends Error {
25
- /** Error code (e.g., 'WU_NOT_FOUND') */
26
- code;
27
- /** Additional error context */
28
- details;
29
- /** Suggested commands or actions to try (optional) */
30
- tryNext;
31
- /** Alias for details for agent-friendly access */
32
- context;
33
- /**
34
- * Create a WU error
35
- * @param {string} code - Error code (e.g., 'WU_NOT_FOUND')
36
- * @param {string} message - Human-readable error message
37
- * @param {object} [details={}] - Additional error context
38
- */
39
- constructor(code, message, details = {}) {
40
- super(message);
41
- this.name = "WUError";
42
- this.code = code;
43
- this.details = details;
44
- if (Error.captureStackTrace) {
45
- Error.captureStackTrace(this, _WUError);
46
- }
47
- }
48
- };
49
- function toError(error, fallbackMessage = UNKNOWN_ERROR_MESSAGE) {
50
- if (error instanceof Error) {
51
- return error;
52
- }
53
- if (typeof error === "string" && error.length > 0) {
54
- return new Error(error);
55
- }
56
- if (hasMessage(error)) {
57
- return new Error(error.message);
58
- }
59
- return new Error(fallbackMessage);
60
- }
61
- function getErrorMessage(error, fallbackMessage = UNKNOWN_ERROR_MESSAGE) {
62
- return toError(error, fallbackMessage).message;
63
- }
64
- function die(message, exitCode = 1) {
65
- const scriptPath = process.argv[1] || "unknown";
66
- const scriptName = path.basename(scriptPath, ".js");
67
- const formattedMessage = `[${scriptName}] ${message}`;
68
- console.error(formattedMessage);
69
- throw new ProcessExitError(formattedMessage, exitCode);
70
- }
71
- function createError(code, message, details = {}) {
72
- return new WUError(code, message, details);
73
- }
74
- var ErrorCodes = {
75
- PROCESS_EXIT: "PROCESS_EXIT",
76
- // WU-1538: Typed exit signal from library code
77
- WU_NOT_FOUND: "WU_NOT_FOUND",
78
- WU_ALREADY_CLAIMED: "WU_ALREADY_CLAIMED",
79
- WU_NOT_CLAIMED: "WU_NOT_CLAIMED",
80
- INVALID_WU_ID: "INVALID_WU_ID",
81
- INVALID_LANE: "INVALID_LANE",
82
- GATES_FAILED: "GATES_FAILED",
83
- GIT_ERROR: "GIT_ERROR",
84
- VALIDATION_ERROR: "VALIDATION_ERROR",
85
- FILE_NOT_FOUND: "FILE_NOT_FOUND",
86
- YAML_PARSE_ERROR: "YAML_PARSE_ERROR",
87
- PARSE_ERROR: "PARSE_ERROR",
88
- WORKTREE_ERROR: "WORKTREE_ERROR",
89
- BRANCH_ERROR: "BRANCH_ERROR",
90
- STATE_ERROR: "STATE_ERROR",
91
- SECTION_NOT_FOUND: "SECTION_NOT_FOUND",
92
- INTERNAL_ERROR: "INTERNAL_ERROR",
93
- RECOVERY_ERROR: "RECOVERY_ERROR",
94
- TRANSACTION_ERROR: "TRANSACTION_ERROR",
95
- // WU-1369: Atomic transaction errors
96
- LOCK_ERROR: "LOCK_ERROR",
97
- // WU-1747: Merge lock errors
98
- // Initiative system error codes (WU-1247)
99
- INIT_NOT_FOUND: "INIT_NOT_FOUND",
100
- INIT_ALREADY_EXISTS: "INIT_ALREADY_EXISTS",
101
- INVALID_INIT_ID: "INVALID_INIT_ID",
102
- INVALID_SLUG: "INVALID_SLUG",
103
- INVALID_PHASE: "INVALID_PHASE",
104
- DEPENDENCY_CYCLE: "DEPENDENCY_CYCLE",
105
- // WU-2116: Structured error codes for migrated throw new Error() sites
106
- MERGE_EXHAUSTION: "MERGE_EXHAUSTION",
107
- REBASE_CONFLICT: "REBASE_CONFLICT",
108
- DELEGATION_NOT_FOUND: "DELEGATION_NOT_FOUND",
109
- DELEGATION_ALREADY_ESCALATED: "DELEGATION_ALREADY_ESCALATED",
110
- SIGNAL_UNAVAILABLE: "SIGNAL_UNAVAILABLE",
111
- ID_GENERATION_FAILED: "ID_GENERATION_FAILED",
112
- SCOPE_VIOLATION: "SCOPE_VIOLATION",
113
- TOOL_ALREADY_REGISTERED: "TOOL_ALREADY_REGISTERED",
114
- INVALID_ARGUMENT: "INVALID_ARGUMENT",
115
- DEPRECATED_API: "DEPRECATED_API",
116
- CONFIG_ERROR: "CONFIG_ERROR",
117
- TEMPLATE_VALIDATION_ERROR: "TEMPLATE_VALIDATION_ERROR",
118
- INVARIANT_ERROR: "INVARIANT_ERROR",
119
- RETRY_EXHAUSTION: "RETRY_EXHAUSTION",
120
- PREFLIGHT_ERROR: "PREFLIGHT_ERROR",
121
- INVALID_DURATION: "INVALID_DURATION",
122
- // WU-2118: Structured error codes for memory/agent/mcp package migrations
123
- NODE_NOT_FOUND: "NODE_NOT_FOUND",
124
- SESSION_ERROR: "SESSION_ERROR",
125
- ALREADY_EXISTS: "ALREADY_EXISTS",
126
- // WU-2117: Structured error codes for CLI throw new Error() migration
127
- COMMAND_EXECUTION_FAILED: "COMMAND_EXECUTION_FAILED",
128
- PACK_ALREADY_EXISTS: "PACK_ALREADY_EXISTS",
129
- CANCELLED_BY_USER: "CANCELLED_BY_USER",
130
- REGISTRY_UPLOAD_FAILED: "REGISTRY_UPLOAD_FAILED",
131
- WORKSPACE_NOT_FOUND: "WORKSPACE_NOT_FOUND",
132
- WORKSPACE_MALFORMED: "WORKSPACE_MALFORMED",
133
- ORPHAN_WU_ERROR: "ORPHAN_WU_ERROR",
134
- REPAIR_FAILED: "REPAIR_FAILED",
135
- ONBOARD_FAILED: "ONBOARD_FAILED",
136
- DIRECTORY_NOT_EMPTY: "DIRECTORY_NOT_EMPTY",
137
- AMBIGUOUS_MATCH: "AMBIGUOUS_MATCH",
138
- STRING_NOT_FOUND: "STRING_NOT_FOUND",
139
- FILE_SIZE_EXCEEDED: "FILE_SIZE_EXCEEDED",
140
- PARENT_DIR_NOT_FOUND: "PARENT_DIR_NOT_FOUND"
141
- };
142
-
143
- export {
144
- ProcessExitError,
145
- getErrorMessage,
146
- die,
147
- createError,
148
- ErrorCodes
149
- };
@@ -1,363 +0,0 @@
1
- import {
2
- VALIDATION_LIMITS
3
- } from "./chunk-2GXVIN57.js";
4
- import {
5
- createWuPaths
6
- } from "./chunk-6HO4GWJE.js";
7
- import {
8
- BRANCHES,
9
- EXIT_CODES,
10
- FILE_EXTENSIONS,
11
- LUMENFLOW_PATHS,
12
- PATTERNS,
13
- STRING_LITERALS
14
- } from "./chunk-DWMLTXKQ.js";
15
- import {
16
- INCIDENT_SEVERITY,
17
- MS_PER_DAY,
18
- MS_PER_HOUR,
19
- MS_PER_MINUTE
20
- } from "./chunk-V6OJGLBA.js";
21
- import {
22
- ErrorCodes,
23
- createError
24
- } from "./chunk-RXRKBBSM.js";
25
-
26
- // ../agent/dist/agent-session.js
27
- import { randomUUID } from "crypto";
28
- import { readFile, writeFile, mkdir, unlink, access } from "fs/promises";
29
- import { join as join2 } from "path";
30
- import { simpleGit } from "simple-git";
31
-
32
- // ../agent/dist/agent-incidents.js
33
- import { z } from "zod";
34
- import { appendFileSync, existsSync, mkdirSync, readFileSync } from "fs";
35
- import { join } from "path";
36
- var SEVERITY_VALUES = ["blocker", "major", "minor", "info"];
37
- var CATEGORY_VALUES = ["workflow", "tooling", "confusion", "violation", "error"];
38
- var IncidentLogSchema = z.object({
39
- timestamp: z.string().datetime(),
40
- // ISO 8601 with timezone
41
- session_id: z.string().uuid(),
42
- wu_id: z.string().regex(/^WU-\d+$/, "Must match WU-XXX format"),
43
- lane: z.string().min(1),
44
- category: z.enum(CATEGORY_VALUES),
45
- severity: z.enum(SEVERITY_VALUES),
46
- title: z.string().min(VALIDATION_LIMITS.TITLE_MIN).max(VALIDATION_LIMITS.TITLE_MAX),
47
- description: z.string().min(VALIDATION_LIMITS.DESCRIPTION_MIN).max(VALIDATION_LIMITS.DESCRIPTION_MAX),
48
- resolution: z.string().optional(),
49
- tags: z.array(z.string()).default([]),
50
- context: z.object({
51
- git_branch: z.string().optional(),
52
- current_step: z.string().optional(),
53
- related_files: z.array(z.string()).optional()
54
- }).optional().default(() => ({}))
55
- });
56
- function appendIncident(incident, incidentsDir = LUMENFLOW_PATHS.INCIDENTS) {
57
- const validated = IncidentLogSchema.parse(incident);
58
- if (!existsSync(incidentsDir)) {
59
- mkdirSync(incidentsDir, { recursive: true });
60
- }
61
- const logFile = join(incidentsDir, `${validated.category}${FILE_EXTENSIONS.NDJSON}`);
62
- appendFileSync(logFile, `${JSON.stringify(validated)}
63
- `, { encoding: "utf-8" });
64
- }
65
-
66
- // ../agent/dist/agent-session.js
67
- var SESSION_DIR = LUMENFLOW_PATHS.SESSIONS;
68
- var SESSION_FILE = join2(SESSION_DIR, "current.json");
69
- var DEFAULT_AGENT_VERSION = "unknown";
70
- var DEFAULT_HOST_ID = "unknown";
71
- var DEFAULT_AGENT_CAPABILITIES = ["session_lifecycle", "incident_logging"];
72
- var AGENT_CAPABILITIES_ENV = "LUMENFLOW_AGENT_CAPABILITIES";
73
- var AGENT_VERSION_ENV = "LUMENFLOW_AGENT_VERSION";
74
- function asNonEmptyString(value) {
75
- return typeof value === "string" && value.trim().length > 0 ? value.trim() : void 0;
76
- }
77
- function parseCapabilities(rawValue) {
78
- if (!rawValue) {
79
- return [...DEFAULT_AGENT_CAPABILITIES];
80
- }
81
- const parsed = rawValue.split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
82
- return parsed.length > 0 ? parsed : [...DEFAULT_AGENT_CAPABILITIES];
83
- }
84
- function normalizeSessionData(session) {
85
- return {
86
- ...session,
87
- client_type: session.client_type ?? session.agent_type,
88
- capabilities: Array.isArray(session.capabilities) ? session.capabilities.filter((entry) => typeof entry === "string") : [...DEFAULT_AGENT_CAPABILITIES],
89
- agent_version: session.agent_version ?? DEFAULT_AGENT_VERSION,
90
- host_id: session.host_id ?? DEFAULT_HOST_ID
91
- };
92
- }
93
- async function startSession(wuId, tier, agentType = "claude-code") {
94
- const sessionExists = await access(SESSION_FILE).then(() => true).catch(() => false);
95
- if (sessionExists) {
96
- const content = await readFile(SESSION_FILE, { encoding: "utf-8" });
97
- const existing = JSON.parse(content);
98
- throw createError(ErrorCodes.SESSION_ERROR, `Session ${existing.session_id} already active for ${existing.wu_id}. Run 'pnpm agent:session:end' first.`);
99
- }
100
- if (!PATTERNS.WU_ID.test(wuId)) {
101
- throw createError(ErrorCodes.INVALID_WU_ID, `Invalid WU ID format: ${wuId}. Must match WU-XXX.`);
102
- }
103
- if (![1, 2, 3].includes(tier)) {
104
- throw createError(ErrorCodes.VALIDATION_ERROR, `Invalid context tier: ${tier}. Must be 1, 2, or 3.`);
105
- }
106
- const git = simpleGit();
107
- let lane = "Unknown";
108
- try {
109
- const branch = await git.revparse(["--abbrev-ref", "HEAD"]);
110
- const match = branch.match(/^lane\/([^/]+)\//);
111
- if (match && match[1]) {
112
- lane = match[1].split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(": ");
113
- }
114
- } catch {
115
- }
116
- const sessionId = randomUUID();
117
- const capabilities = parseCapabilities(asNonEmptyString(process.env[AGENT_CAPABILITIES_ENV]));
118
- const agentVersion = asNonEmptyString(process.env[AGENT_VERSION_ENV]) ?? DEFAULT_AGENT_VERSION;
119
- const hostId = asNonEmptyString(process.env.HOSTNAME) ?? asNonEmptyString(process.env.COMPUTERNAME) ?? DEFAULT_HOST_ID;
120
- const session = {
121
- session_id: sessionId,
122
- wu_id: wuId,
123
- lane,
124
- started: (/* @__PURE__ */ new Date()).toISOString(),
125
- agent_type: agentType,
126
- client_type: agentType,
127
- capabilities,
128
- agent_version: agentVersion,
129
- host_id: hostId,
130
- context_tier: tier,
131
- incidents_logged: 0,
132
- incidents_major: 0
133
- };
134
- const dirExists = await access(SESSION_DIR).then(() => true).catch(() => false);
135
- if (!dirExists) {
136
- await mkdir(SESSION_DIR, { recursive: true });
137
- }
138
- await writeFile(SESSION_FILE, JSON.stringify(session, null, 2));
139
- return sessionId;
140
- }
141
- async function getCurrentSession() {
142
- const sessionExists = await access(SESSION_FILE).then(() => true).catch(() => false);
143
- if (!sessionExists)
144
- return null;
145
- const content = await readFile(SESSION_FILE, { encoding: "utf-8" });
146
- return normalizeSessionData(JSON.parse(content));
147
- }
148
- async function logIncident(incidentData) {
149
- const session = await getCurrentSession();
150
- if (!session) {
151
- throw createError(ErrorCodes.SESSION_ERROR, "No active session. Run: pnpm agent:session start --wu WU-XXX --tier N");
152
- }
153
- const git = simpleGit();
154
- let gitBranch = "unknown";
155
- try {
156
- gitBranch = await git.revparse(["--abbrev-ref", "HEAD"]);
157
- } catch {
158
- }
159
- const incident = {
160
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
161
- session_id: session.session_id,
162
- wu_id: session.wu_id,
163
- lane: session.lane,
164
- ...incidentData,
165
- context: {
166
- git_branch: gitBranch,
167
- ...incidentData.context ?? {}
168
- }
169
- };
170
- appendIncident(incident);
171
- session.incidents_logged++;
172
- if (incident.severity === INCIDENT_SEVERITY.MAJOR || incident.severity === INCIDENT_SEVERITY.BLOCKER) {
173
- session.incidents_major++;
174
- }
175
- await writeFile(SESSION_FILE, JSON.stringify(session, null, 2));
176
- }
177
- async function endSession() {
178
- const session = await getCurrentSession();
179
- if (!session) {
180
- throw createError(ErrorCodes.SESSION_ERROR, "No active session to end.");
181
- }
182
- session.completed = (/* @__PURE__ */ new Date()).toISOString();
183
- await unlink(SESSION_FILE);
184
- return {
185
- wu_id: session.wu_id,
186
- lane: session.lane,
187
- session_id: session.session_id,
188
- started: session.started,
189
- completed: session.completed,
190
- agent_type: session.agent_type,
191
- client_type: session.client_type,
192
- capabilities: [...session.capabilities],
193
- agent_version: session.agent_version,
194
- host_id: session.host_id,
195
- context_tier: session.context_tier,
196
- incidents_logged: session.incidents_logged,
197
- incidents_major: session.incidents_major
198
- // artifacts can be added manually later
199
- };
200
- }
201
-
202
- // ../agent/dist/agent-verification.js
203
- import { execSync } from "child_process";
204
- import { existsSync as existsSync2 } from "fs";
205
- import { fileURLToPath } from "url";
206
- function run(cmd) {
207
- try {
208
- return execSync(cmd, { stdio: "pipe", encoding: "utf-8" }).trim();
209
- } catch {
210
- return "";
211
- }
212
- }
213
- function formatWUId(wuId) {
214
- if (!wuId || typeof wuId !== "string") {
215
- throw createError(ErrorCodes.VALIDATION_ERROR, "verifyWUComplete requires a WU id (e.g., WU-123)", { wuId, type: typeof wuId });
216
- }
217
- const normalized = wuId.trim().toUpperCase();
218
- if (!PATTERNS.WU_ID.test(normalized)) {
219
- throw createError(ErrorCodes.INVALID_WU_ID, `Invalid WU id "${wuId}". Expected format: WU-123`, { wuId, normalized });
220
- }
221
- return normalized;
222
- }
223
- function checkGitStatus(runFn = run) {
224
- const status = runFn("git status --porcelain");
225
- if (!status)
226
- return null;
227
- const lines = status.split(STRING_LITERALS.NEWLINE).filter(Boolean).slice(0, 10);
228
- return `Working tree dirty (stage or discard changes): ${lines.join("; ")}`;
229
- }
230
- function stampPath(wuId, paths) {
231
- return paths.STAMP(wuId);
232
- }
233
- function checkStamp(wuId, paths, existsFn = existsSync2) {
234
- if (existsFn(stampPath(wuId, paths)))
235
- return null;
236
- return `Missing stamp ${paths.STAMPS_DIR()}/${wuId}.done`;
237
- }
238
- function checkCommit(wuId, paths, runFn = run) {
239
- const history = runFn(`git log --oneline ${BRANCHES.MAIN} -- ${paths.WU(wuId)} | head -n 1`);
240
- if (history)
241
- return null;
242
- return `No commit on ${BRANCHES.MAIN} touching ${paths.WU(wuId)}`;
243
- }
244
- function verifyWUComplete(wuId, overrides = {}) {
245
- const normalized = formatWUId(wuId);
246
- const failures = [];
247
- const runFn = typeof overrides.run === "function" ? overrides.run : run;
248
- const existsFn = typeof overrides.exists === "function" ? overrides.exists : (filePath) => existsSync2(filePath);
249
- const paths = createWuPaths({ projectRoot: overrides.projectRoot });
250
- const gitStatusFailure = checkGitStatus(runFn);
251
- if (gitStatusFailure)
252
- failures.push(gitStatusFailure);
253
- const stampFailure = checkStamp(normalized, paths, existsFn);
254
- if (stampFailure)
255
- failures.push(stampFailure);
256
- const commitFailure = checkCommit(normalized, paths, runFn);
257
- if (commitFailure)
258
- failures.push(commitFailure);
259
- return {
260
- complete: failures.length === 0,
261
- failures
262
- };
263
- }
264
- function debugSummary(result) {
265
- if (!result || typeof result !== "object") {
266
- return "No verification result";
267
- }
268
- if (result.complete) {
269
- return "Verification passed: WU complete.";
270
- }
271
- const failures = Array.isArray(result.failures) ? result.failures : [];
272
- if (!failures.length) {
273
- return "Verification failed: unknown reason.";
274
- }
275
- return `Verification failed:${STRING_LITERALS.NEWLINE}- ${failures.join(`${STRING_LITERALS.NEWLINE}- `)}`;
276
- }
277
- var isDirectExecution = (() => {
278
- if (typeof process === "undefined")
279
- return false;
280
- if (!Array.isArray(process.argv))
281
- return false;
282
- if (!process.argv[1])
283
- return false;
284
- try {
285
- return fileURLToPath(import.meta.url) === process.argv[1];
286
- } catch {
287
- return false;
288
- }
289
- })();
290
- if (isDirectExecution) {
291
- const wuId = process.argv[2] ?? "";
292
- try {
293
- const result = verifyWUComplete(wuId);
294
- const message = debugSummary(result);
295
- console.log(message);
296
- process.exit(result.complete ? EXIT_CODES.SUCCESS : EXIT_CODES.ERROR);
297
- } catch (error) {
298
- console.error(`Verification error: ${error instanceof Error ? error.message : String(error)}`);
299
- process.exit(EXIT_CODES.ERROR);
300
- }
301
- }
302
-
303
- // ../agent/dist/feedback-promote-core.js
304
- import fs from "fs/promises";
305
- import path from "path";
306
- var DRAFT_DIRECTORY = LUMENFLOW_PATHS.FEEDBACK_DRAFTS;
307
- var FEEDBACK_INDEX_PATH = LUMENFLOW_PATHS.FEEDBACK_INDEX;
308
- var LANES = {
309
- OPERATIONS_TOOLING: "Operations: Tooling",
310
- OPERATIONS_DOCUMENTATION: "Operations: Documentation",
311
- OPERATIONS_SECURITY: "Operations: Security",
312
- OPERATIONS_COMPLIANCE: "Operations: Compliance",
313
- OPERATIONS: "Operations",
314
- CORE_SYSTEMS: "Core Systems",
315
- EXPERIENCE: "Experience",
316
- INTELLIGENCE: "Intelligence"
317
- };
318
- var CATEGORY_TO_LANE = {
319
- test: LANES.OPERATIONS_TOOLING,
320
- tooling: LANES.OPERATIONS_TOOLING,
321
- docs: LANES.OPERATIONS_DOCUMENTATION,
322
- documentation: LANES.OPERATIONS_DOCUMENTATION,
323
- infrastructure: LANES.CORE_SYSTEMS,
324
- database: LANES.CORE_SYSTEMS,
325
- api: LANES.CORE_SYSTEMS,
326
- ui: LANES.EXPERIENCE,
327
- frontend: LANES.EXPERIENCE,
328
- ux: LANES.EXPERIENCE,
329
- llm: LANES.INTELLIGENCE,
330
- prompt: LANES.INTELLIGENCE,
331
- ai: LANES.INTELLIGENCE,
332
- security: LANES.OPERATIONS_SECURITY,
333
- compliance: LANES.OPERATIONS_COMPLIANCE,
334
- uncategorized: LANES.OPERATIONS
335
- };
336
-
337
- // ../agent/dist/feedback-review-core.js
338
- import fs2 from "fs/promises";
339
- import path2 from "path";
340
- var SEVERITY_WEIGHTS = {
341
- [INCIDENT_SEVERITY.BLOCKER]: 4,
342
- [INCIDENT_SEVERITY.MAJOR]: 3,
343
- [INCIDENT_SEVERITY.MINOR]: 2,
344
- [INCIDENT_SEVERITY.INFO]: 1
345
- };
346
- var RECENCY_DECAY_MS = 30 * MS_PER_DAY;
347
- var DURATION_MULTIPLIERS = {
348
- m: MS_PER_MINUTE,
349
- // minutes
350
- h: MS_PER_HOUR,
351
- // hours
352
- d: MS_PER_DAY,
353
- // days
354
- w: 7 * MS_PER_DAY
355
- // weeks
356
- };
357
-
358
- export {
359
- startSession,
360
- getCurrentSession,
361
- logIncident,
362
- endSession
363
- };
@@ -1,113 +0,0 @@
1
- import {
2
- TEST_TYPES,
3
- WU_TYPES
4
- } from "./chunk-V6OJGLBA.js";
5
-
6
- // ../core/dist/manual-test-validator.js
7
- import path from "path";
8
- var CODE_EXTENSIONS = Object.freeze([".js", ".ts", ".tsx", ".ts"]);
9
- var NON_CODE_EXTENSIONS = Object.freeze([".md", ".yaml", ".yml", ".json"]);
10
- var CONFIG_PATTERNS = Object.freeze([
11
- /config\./i,
12
- // vitest.config.ts, eslint.config.js
13
- /\.config\./i,
14
- // *.config.ts, *.config.js
15
- /rc\.[jt]s$/i,
16
- // .eslintrc.js, .prettierrc.ts
17
- /^\.[a-z]+rc\./i
18
- // .eslintrc.*, .prettierrc.*
19
- ]);
20
- var HEX_CORE_CODE_PATTERNS = Object.freeze([
21
- "packages/@lumenflow/core/",
22
- "packages/@lumenflow/cli/",
23
- "packages/@lumenflow/agent/"
24
- ]);
25
- var EXEMPT_LANES = Object.freeze([]);
26
- var EXEMPT_TYPES = Object.freeze([WU_TYPES.DOCUMENTATION]);
27
- var TDD_EXCEPTION_MARKER = "tdd-exception:";
28
- function isCodeFile(filePath) {
29
- if (!filePath || typeof filePath !== "string") {
30
- return false;
31
- }
32
- const fileName = path.basename(filePath);
33
- const ext = path.extname(filePath).toLowerCase();
34
- if (NON_CODE_EXTENSIONS.includes(ext)) {
35
- return false;
36
- }
37
- if (!CODE_EXTENSIONS.includes(ext)) {
38
- return false;
39
- }
40
- const isConfig = CONFIG_PATTERNS.some((pattern) => pattern.test(fileName));
41
- if (isConfig) {
42
- return false;
43
- }
44
- return true;
45
- }
46
- function hasDocumentedTddException(notes) {
47
- if (typeof notes === "string") {
48
- return notes.toLowerCase().includes(TDD_EXCEPTION_MARKER);
49
- }
50
- if (Array.isArray(notes)) {
51
- return notes.some((entry) => typeof entry === "string" && hasDocumentedTddException(entry));
52
- }
53
- return false;
54
- }
55
- function isExemptFromAutomatedTests(doc) {
56
- if (!doc)
57
- return false;
58
- const type = doc.type || "";
59
- if (typeof type === "string" && EXEMPT_TYPES.includes(type)) {
60
- return true;
61
- }
62
- if (hasDocumentedTddException(doc.notes)) {
63
- return true;
64
- }
65
- return false;
66
- }
67
- function hasAutomatedTest(tests) {
68
- if (!tests || typeof tests !== "object")
69
- return false;
70
- const hasItems = (arr) => Array.isArray(arr) && arr.length > 0;
71
- const t = tests;
72
- return hasItems(t[TEST_TYPES.UNIT]) || hasItems(t[TEST_TYPES.E2E]) || hasItems(t[TEST_TYPES.INTEGRATION]);
73
- }
74
- function analyzeCodePaths(codePaths) {
75
- if (!codePaths || !Array.isArray(codePaths) || codePaths.length === 0) {
76
- return { hasCodeFiles: false, codeFiles: [] };
77
- }
78
- const codeFiles = codePaths.filter((p) => isCodeFile(p));
79
- return {
80
- hasCodeFiles: codeFiles.length > 0,
81
- codeFiles
82
- };
83
- }
84
- function validateAutomatedTestRequirement(doc) {
85
- const errors = [];
86
- if (!doc) {
87
- return { valid: true, errors: [] };
88
- }
89
- if (isExemptFromAutomatedTests(doc)) {
90
- return { valid: true, errors: [] };
91
- }
92
- const codePaths = doc.code_paths || [];
93
- const { hasCodeFiles, codeFiles } = analyzeCodePaths(codePaths);
94
- if (!hasCodeFiles) {
95
- return { valid: true, errors: [] };
96
- }
97
- const tests = doc.tests || doc.test_paths || {};
98
- if (!hasAutomatedTest(tests)) {
99
- errors.push(`WU modifies code files but has no automated tests.
100
- Code files: ${codeFiles.join(", ")}
101
- Required: At least one automated test (unit, e2e, or integration)
102
- Manual-only tests are not allowed for code changes.
103
-
104
- Fix: Add tests to tests.unit, tests.e2e, or tests.integration in WU YAML.`);
105
- return { valid: false, errors };
106
- }
107
- return { valid: true, errors: [] };
108
- }
109
-
110
- export {
111
- isCodeFile,
112
- validateAutomatedTestRequirement
113
- };