@lumenflow/cli 5.4.0 → 5.7.12

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 (227) hide show
  1. package/README.md +42 -40
  2. package/dist/db-journal-recover.js +400 -0
  3. package/dist/db-journal-recover.js.map +1 -0
  4. package/dist/docs-sync.js +8 -3
  5. package/dist/docs-sync.js.map +1 -1
  6. package/dist/gate-defaults.js +191 -9
  7. package/dist/gate-defaults.js.map +1 -1
  8. package/dist/gate-registry.js.map +1 -1
  9. package/dist/gates/monolithic-file-contention-guard.js +167 -0
  10. package/dist/gates/monolithic-file-contention-guard.js.map +1 -0
  11. package/dist/gates/prod-migration-drift.js +207 -0
  12. package/dist/gates/prod-migration-drift.js.map +1 -0
  13. package/dist/gates/test-over-deletion-guard.js +255 -0
  14. package/dist/gates/test-over-deletion-guard.js.map +1 -0
  15. package/dist/gates-runners.js +401 -2
  16. package/dist/gates-runners.js.map +1 -1
  17. package/dist/gates.js +349 -4
  18. package/dist/gates.js.map +1 -1
  19. package/dist/lumenflow-setup.js +144 -0
  20. package/dist/lumenflow-setup.js.map +1 -0
  21. package/dist/lumenflow-upgrade.js +2 -1
  22. package/dist/lumenflow-upgrade.js.map +1 -1
  23. package/dist/mem-create.js +10 -1
  24. package/dist/mem-create.js.map +1 -1
  25. package/dist/mem-signal.js +21 -4
  26. package/dist/mem-signal.js.map +1 -1
  27. package/dist/metrics-cli.js +19 -2
  28. package/dist/metrics-cli.js.map +1 -1
  29. package/dist/metrics-snapshot.js +25 -2
  30. package/dist/metrics-snapshot.js.map +1 -1
  31. package/dist/orchestrate-initiative.js +28 -3
  32. package/dist/orchestrate-initiative.js.map +1 -1
  33. package/dist/public-manifest.js +17 -0
  34. package/dist/public-manifest.js.map +1 -1
  35. package/dist/release.js +53 -18
  36. package/dist/release.js.map +1 -1
  37. package/dist/wu-done-gates.js +121 -8
  38. package/dist/wu-done-gates.js.map +1 -1
  39. package/dist/wu-done.js +30 -6
  40. package/dist/wu-done.js.map +1 -1
  41. package/dist/wu-edit-operations.js +74 -0
  42. package/dist/wu-edit-operations.js.map +1 -1
  43. package/dist/wu-edit-validators.js +58 -0
  44. package/dist/wu-edit-validators.js.map +1 -1
  45. package/dist/wu-edit.js +106 -4
  46. package/dist/wu-edit.js.map +1 -1
  47. package/dist/wu-prep.js +132 -8
  48. package/dist/wu-prep.js.map +1 -1
  49. package/dist/wu-recover.js +6 -0
  50. package/dist/wu-recover.js.map +1 -1
  51. package/dist/wu-release.js +120 -2
  52. package/dist/wu-release.js.map +1 -1
  53. package/dist/wu-sizing-validation.js +47 -17
  54. package/dist/wu-sizing-validation.js.map +1 -1
  55. package/dist/wu-status.js +33 -0
  56. package/dist/wu-status.js.map +1 -1
  57. package/package.json +13 -11
  58. package/packs/agent-runtime/package.json +1 -1
  59. package/packs/sidekick/package.json +1 -1
  60. package/packs/software-delivery/package.json +1 -1
  61. package/templates/core/AGENTS.md.template +162 -26
  62. package/templates/core/LUMENFLOW.md.template +381 -70
  63. package/templates/core/ai/onboarding/agent-invocation-guide.md.template +0 -5
  64. package/templates/core/ai/onboarding/agent-safety-card.md.template +63 -17
  65. package/templates/core/ai/onboarding/initiative-orchestration.md.template +4 -0
  66. package/templates/core/ai/onboarding/release-process.md.template +7 -7
  67. package/templates/core/ai/onboarding/vendor-support.md.template +74 -10
  68. package/templates/vendors/claude/.claude/skills/frontend-design/SKILL.md.template +1 -1
  69. package/templates/vendors/claude/.claude/skills/wu-lifecycle/SKILL.md.template +28 -0
  70. package/packs/agent-runtime/agent-heartbeat.ts +0 -163
  71. package/packs/agent-runtime/auto-session-integration.ts +0 -888
  72. package/packs/agent-runtime/capability-factory.ts +0 -104
  73. package/packs/agent-runtime/constants.ts +0 -21
  74. package/packs/agent-runtime/delegation-registry-schema.ts +0 -220
  75. package/packs/agent-runtime/delegation-registry-store.ts +0 -269
  76. package/packs/agent-runtime/delegation-tree.ts +0 -328
  77. package/packs/agent-runtime/index.ts +0 -20
  78. package/packs/agent-runtime/manifest.ts +0 -348
  79. package/packs/agent-runtime/memory-coordination-contract.ts +0 -86
  80. package/packs/agent-runtime/orchestration.ts +0 -2027
  81. package/packs/agent-runtime/pack-registration.ts +0 -110
  82. package/packs/agent-runtime/policy-factory.ts +0 -165
  83. package/packs/agent-runtime/remote-controls/index.ts +0 -7
  84. package/packs/agent-runtime/remote-controls/operations.ts +0 -405
  85. package/packs/agent-runtime/remote-controls/port.ts +0 -48
  86. package/packs/agent-runtime/remote-controls/state-store.ts +0 -258
  87. package/packs/agent-runtime/remote-controls/types.ts +0 -105
  88. package/packs/agent-runtime/session-schema.ts +0 -467
  89. package/packs/agent-runtime/tool-impl/agent-turn-tools.ts +0 -793
  90. package/packs/agent-runtime/tool-impl/index.ts +0 -6
  91. package/packs/agent-runtime/tool-impl/provider-adapters.ts +0 -1245
  92. package/packs/agent-runtime/tool-impl/remote-controls.mock.ts +0 -256
  93. package/packs/agent-runtime/tool-impl/remote-controls.ts +0 -273
  94. package/packs/agent-runtime/tools/index.ts +0 -4
  95. package/packs/agent-runtime/tools/types.ts +0 -47
  96. package/packs/agent-runtime/turn-lifecycle-events.ts +0 -590
  97. package/packs/agent-runtime/types.ts +0 -128
  98. package/packs/agent-runtime/vitest.config.ts +0 -11
  99. package/packs/sidekick/channel-ingress.ts +0 -137
  100. package/packs/sidekick/constants.ts +0 -10
  101. package/packs/sidekick/index.ts +0 -8
  102. package/packs/sidekick/manifest-schema.ts +0 -49
  103. package/packs/sidekick/manifest.ts +0 -512
  104. package/packs/sidekick/pack-registration.ts +0 -110
  105. package/packs/sidekick/policy-factory.ts +0 -38
  106. package/packs/sidekick/sidekick-events.ts +0 -694
  107. package/packs/sidekick/src/adapters/cloud-queue.ts +0 -101
  108. package/packs/sidekick/src/adapters/control-plane-bridge.adapter.ts +0 -386
  109. package/packs/sidekick/src/adapters/filesystem-bridge.adapter.ts +0 -228
  110. package/packs/sidekick/src/domain/channel.types.ts +0 -64
  111. package/packs/sidekick/src/ports/channel-bridge.port.ts +0 -92
  112. package/packs/sidekick/src/routines/commit.ts +0 -74
  113. package/packs/sidekick/tool-impl/channel-tools.ts +0 -577
  114. package/packs/sidekick/tool-impl/channel-transports.ts +0 -75
  115. package/packs/sidekick/tool-impl/index.ts +0 -29
  116. package/packs/sidekick/tool-impl/memory-tools.ts +0 -290
  117. package/packs/sidekick/tool-impl/routine-commit.ts +0 -102
  118. package/packs/sidekick/tool-impl/routine-tools.ts +0 -440
  119. package/packs/sidekick/tool-impl/runtime-context.ts +0 -28
  120. package/packs/sidekick/tool-impl/shared.ts +0 -125
  121. package/packs/sidekick/tool-impl/storage.ts +0 -325
  122. package/packs/sidekick/tool-impl/system-tools.ts +0 -160
  123. package/packs/sidekick/tool-impl/task-tools.ts +0 -506
  124. package/packs/sidekick/tools/channel-tools.ts +0 -53
  125. package/packs/sidekick/tools/index.ts +0 -9
  126. package/packs/sidekick/tools/memory-tools.ts +0 -53
  127. package/packs/sidekick/tools/routine-tools.ts +0 -53
  128. package/packs/sidekick/tools/system-tools.ts +0 -47
  129. package/packs/sidekick/tools/task-tools.ts +0 -61
  130. package/packs/sidekick/tools/types.ts +0 -57
  131. package/packs/sidekick/vitest.config.ts +0 -11
  132. package/packs/software-delivery/constants.ts +0 -10
  133. package/packs/software-delivery/extensions.ts +0 -140
  134. package/packs/software-delivery/gate-policies.ts +0 -134
  135. package/packs/software-delivery/index.ts +0 -8
  136. package/packs/software-delivery/manifest-schema.ts +0 -268
  137. package/packs/software-delivery/manifest.ts +0 -657
  138. package/packs/software-delivery/pack-registration.ts +0 -113
  139. package/packs/software-delivery/src/commands/index.ts +0 -5
  140. package/packs/software-delivery/src/config/delivery-review-contract.ts +0 -256
  141. package/packs/software-delivery/src/config/env-accessors.ts +0 -66
  142. package/packs/software-delivery/src/config/index.ts +0 -8
  143. package/packs/software-delivery/src/config/normalize-config-keys.ts +0 -9
  144. package/packs/software-delivery/src/config/schemas/lumenflow-config-schema-types.ts +0 -460
  145. package/packs/software-delivery/src/config/workspace-reader.ts +0 -375
  146. package/packs/software-delivery/src/constants/backlog-patterns.ts +0 -31
  147. package/packs/software-delivery/src/constants/client-ids.ts +0 -19
  148. package/packs/software-delivery/src/constants/config-contract.ts +0 -7
  149. package/packs/software-delivery/src/constants/docs-layout-presets.ts +0 -50
  150. package/packs/software-delivery/src/constants/duration-constants.ts +0 -20
  151. package/packs/software-delivery/src/constants/gate-constants.ts +0 -32
  152. package/packs/software-delivery/src/constants/index.ts +0 -29
  153. package/packs/software-delivery/src/constants/lock-constants.ts +0 -35
  154. package/packs/software-delivery/src/constants/object-guards.ts +0 -12
  155. package/packs/software-delivery/src/constants/section-headings.ts +0 -107
  156. package/packs/software-delivery/src/constants/wu-cli-constants.ts +0 -488
  157. package/packs/software-delivery/src/constants/wu-domain-constants.ts +0 -466
  158. package/packs/software-delivery/src/constants/wu-git-constants.ts +0 -7
  159. package/packs/software-delivery/src/constants/wu-id-format.ts +0 -327
  160. package/packs/software-delivery/src/constants/wu-paths-constants.ts +0 -384
  161. package/packs/software-delivery/src/constants/wu-statuses.ts +0 -287
  162. package/packs/software-delivery/src/constants/wu-type-helpers.ts +0 -67
  163. package/packs/software-delivery/src/constants/wu-ui-constants.ts +0 -267
  164. package/packs/software-delivery/src/constants/wu-validation-constants.ts +0 -73
  165. package/packs/software-delivery/src/domain/index.ts +0 -5
  166. package/packs/software-delivery/src/domain/orchestration.constants.ts +0 -166
  167. package/packs/software-delivery/src/domain/orchestration.schemas.ts +0 -238
  168. package/packs/software-delivery/src/domain/orchestration.types.ts +0 -176
  169. package/packs/software-delivery/src/methodology/incremental-test.ts +0 -122
  170. package/packs/software-delivery/src/methodology/index.ts +0 -6
  171. package/packs/software-delivery/src/methodology/manual-test-validator.ts +0 -292
  172. package/packs/software-delivery/src/policy/coverage-gate.ts +0 -270
  173. package/packs/software-delivery/src/policy/gates-agent-mode.ts +0 -223
  174. package/packs/software-delivery/src/policy/gates-config-internal.ts +0 -121
  175. package/packs/software-delivery/src/policy/gates-config.ts +0 -300
  176. package/packs/software-delivery/src/policy/gates-coverage.ts +0 -356
  177. package/packs/software-delivery/src/policy/gates-presets.ts +0 -134
  178. package/packs/software-delivery/src/policy/gates-schemas.ts +0 -173
  179. package/packs/software-delivery/src/policy/index.ts +0 -22
  180. package/packs/software-delivery/src/policy/package-manager-resolver.ts +0 -319
  181. package/packs/software-delivery/src/policy/resolve-policy.ts +0 -601
  182. package/packs/software-delivery/src/ports/config.ports.ts +0 -90
  183. package/packs/software-delivery/src/ports/dashboard-renderer.port.ts +0 -125
  184. package/packs/software-delivery/src/ports/index.ts +0 -10
  185. package/packs/software-delivery/src/ports/sync-validator.ports.ts +0 -59
  186. package/packs/software-delivery/src/ports/wu-helpers.ports.ts +0 -168
  187. package/packs/software-delivery/src/ports/wu-state.ports.ts +0 -241
  188. package/packs/software-delivery/src/primitives/index.ts +0 -5
  189. package/packs/software-delivery/src/runtime/index.ts +0 -6
  190. package/packs/software-delivery/src/runtime/work-classifier.ts +0 -561
  191. package/packs/software-delivery/src/sandbox/index.ts +0 -10
  192. package/packs/software-delivery/src/sandbox/sandbox-allowlist.ts +0 -118
  193. package/packs/software-delivery/src/sandbox/sandbox-backend-linux.ts +0 -88
  194. package/packs/software-delivery/src/sandbox/sandbox-backend-macos.ts +0 -154
  195. package/packs/software-delivery/src/sandbox/sandbox-backend-windows.ts +0 -47
  196. package/packs/software-delivery/src/sandbox/sandbox-profile.ts +0 -153
  197. package/packs/software-delivery/src/schemas/index.ts +0 -5
  198. package/packs/software-delivery/src/state/date-utils.ts +0 -158
  199. package/packs/software-delivery/src/state/index.ts +0 -15
  200. package/packs/software-delivery/src/state/state-machine.ts +0 -119
  201. package/packs/software-delivery/src/state/wu-doc-types.ts +0 -51
  202. package/packs/software-delivery/src/state/wu-paths.ts +0 -381
  203. package/packs/software-delivery/src/state/wu-schema.ts +0 -1139
  204. package/packs/software-delivery/src/state/wu-state-schema.ts +0 -255
  205. package/packs/software-delivery/src/state/wu-yaml.ts +0 -338
  206. package/packs/software-delivery/tool-impl/agent-tools.ts +0 -263
  207. package/packs/software-delivery/tool-impl/delegation-tools.ts +0 -66
  208. package/packs/software-delivery/tool-impl/flow-metrics-tools.ts +0 -219
  209. package/packs/software-delivery/tool-impl/git-runner.ts +0 -113
  210. package/packs/software-delivery/tool-impl/git-tools.ts +0 -316
  211. package/packs/software-delivery/tool-impl/index.ts +0 -15
  212. package/packs/software-delivery/tool-impl/initiative-orchestration-tools.ts +0 -720
  213. package/packs/software-delivery/tool-impl/lane-lock.ts +0 -246
  214. package/packs/software-delivery/tool-impl/memory-tools.ts +0 -470
  215. package/packs/software-delivery/tool-impl/pending-runtime-tools.ts +0 -21
  216. package/packs/software-delivery/tool-impl/runtime-cli-adapter.ts +0 -329
  217. package/packs/software-delivery/tool-impl/runtime-native-tools.ts +0 -687
  218. package/packs/software-delivery/tool-impl/worker-loader.ts +0 -52
  219. package/packs/software-delivery/tool-impl/worktree-tools.ts +0 -46
  220. package/packs/software-delivery/tool-impl/wu-lifecycle-tools.ts +0 -807
  221. package/packs/software-delivery/tools/delegation-tools.ts +0 -23
  222. package/packs/software-delivery/tools/git-tools.ts +0 -55
  223. package/packs/software-delivery/tools/index.ts +0 -8
  224. package/packs/software-delivery/tools/lane-lock-tool.ts +0 -37
  225. package/packs/software-delivery/tools/types.ts +0 -71
  226. package/packs/software-delivery/tools/worktree-tools.ts +0 -49
  227. package/packs/software-delivery/vitest.config.ts +0 -11
@@ -1,113 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- import { createHash } from 'node:crypto';
5
- import { readdir, readFile } from 'node:fs/promises';
6
- import path from 'node:path';
7
- import { fileURLToPath } from 'node:url';
8
- import {
9
- SHA256_ALGORITHM,
10
- SOFTWARE_DELIVERY_MANIFEST_FILE_NAME,
11
- UTF8_ENCODING,
12
- } from './constants.js';
13
- import { SOFTWARE_DELIVERY_MANIFEST, type SoftwareDeliveryPackManifest } from './manifest.js';
14
-
15
- const NULL_BYTE_BUFFER = Buffer.from([0]);
16
- const DEFAULT_EXCLUSIONS = ['node_modules/', '.git/', 'dist/', '.DS_Store'];
17
-
18
- function getDefaultPackRoot(): string {
19
- return path.dirname(fileURLToPath(import.meta.url));
20
- }
21
-
22
- function normalizeRelativePath(root: string, absolutePath: string): string {
23
- return path.relative(root, absolutePath).split(path.sep).join('/');
24
- }
25
-
26
- function shouldExclude(relativePath: string, exclusions: readonly string[]): boolean {
27
- return exclusions.some((excluded) => {
28
- if (excluded.endsWith('/')) {
29
- return relativePath.startsWith(excluded);
30
- }
31
- return relativePath === excluded || relativePath.endsWith(`/${excluded}`);
32
- });
33
- }
34
-
35
- async function collectFilesRecursive(root: string, directory: string): Promise<string[]> {
36
- const entries = await readdir(directory, { withFileTypes: true });
37
- const sortedEntries = [...entries].sort((left, right) => left.name.localeCompare(right.name));
38
- const files: string[] = [];
39
-
40
- for (const entry of sortedEntries) {
41
- const absolutePath = path.join(directory, entry.name);
42
- const relativePath = normalizeRelativePath(root, absolutePath);
43
- if (entry.isDirectory()) {
44
- files.push(...(await collectFilesRecursive(root, absolutePath)));
45
- continue;
46
- }
47
- files.push(relativePath);
48
- }
49
-
50
- return files;
51
- }
52
-
53
- async function listPackFiles(packRoot: string, exclusions: readonly string[]): Promise<string[]> {
54
- const absoluteRoot = path.resolve(packRoot);
55
- const allFiles = await collectFilesRecursive(absoluteRoot, absoluteRoot);
56
- return allFiles.filter((relativePath) => !shouldExclude(relativePath, exclusions)).sort();
57
- }
58
-
59
- export async function computeSoftwareDeliveryPackIntegrity(
60
- packRoot = getDefaultPackRoot(),
61
- exclusions: readonly string[] = DEFAULT_EXCLUSIONS,
62
- ): Promise<`sha256:${string}`> {
63
- const absoluteRoot = path.resolve(packRoot);
64
- const files = await listPackFiles(absoluteRoot, exclusions);
65
- const digestChunks: Buffer[] = [];
66
-
67
- for (const relativePath of files) {
68
- const fileContents = await readFile(path.join(absoluteRoot, relativePath));
69
- const fileHash = createHash(SHA256_ALGORITHM).update(fileContents).digest('hex');
70
- digestChunks.push(Buffer.from(relativePath, UTF8_ENCODING));
71
- digestChunks.push(NULL_BYTE_BUFFER);
72
- digestChunks.push(Buffer.from(fileHash, UTF8_ENCODING));
73
- digestChunks.push(NULL_BYTE_BUFFER);
74
- }
75
-
76
- const combinedDigest = createHash(SHA256_ALGORITHM)
77
- .update(digestChunks.length === 0 ? Buffer.alloc(0) : Buffer.concat(digestChunks))
78
- .digest('hex');
79
-
80
- return `sha256:${combinedDigest}`;
81
- }
82
-
83
- export async function loadSoftwareDeliveryManifest(
84
- packRoot = getDefaultPackRoot(),
85
- ): Promise<SoftwareDeliveryPackManifest> {
86
- const manifestPath = path.join(path.resolve(packRoot), SOFTWARE_DELIVERY_MANIFEST_FILE_NAME);
87
- await readFile(manifestPath, UTF8_ENCODING);
88
- return structuredClone(SOFTWARE_DELIVERY_MANIFEST);
89
- }
90
-
91
- export interface RegisteredSoftwareDeliveryPack {
92
- manifest: SoftwareDeliveryPackManifest;
93
- packRoot: string;
94
- manifestPath: string;
95
- integrity: `sha256:${string}`;
96
- }
97
-
98
- export async function registerSoftwareDeliveryPack(options?: {
99
- packRoot?: string;
100
- exclusions?: readonly string[];
101
- }): Promise<RegisteredSoftwareDeliveryPack> {
102
- const packRoot = path.resolve(options?.packRoot ?? getDefaultPackRoot());
103
- const exclusions = options?.exclusions ?? DEFAULT_EXCLUSIONS;
104
- const manifest = await loadSoftwareDeliveryManifest(packRoot);
105
- const integrity = await computeSoftwareDeliveryPackIntegrity(packRoot, exclusions);
106
-
107
- return {
108
- manifest,
109
- packRoot,
110
- manifestPath: path.join(packRoot, SOFTWARE_DELIVERY_MANIFEST_FILE_NAME),
111
- integrity,
112
- };
113
- }
@@ -1,5 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- // Barrel for pack-cli-handlers. Populated by Layer 5 of INIT-058.
5
- export {};
@@ -1,256 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- import { z } from 'zod';
5
- import { asRecord } from '@lumenflow/kernel/primitives/object-guards';
6
- import { LUMENFLOW_CLIENT_IDS } from '../constants/client-ids.js';
7
- import { WU_TYPES } from '../constants/wu-statuses.js';
8
-
9
- /**
10
- * Pack-local delivery review contract surface.
11
- *
12
- * Keeping this module in the pack avoids a package cycle with @lumenflow/core
13
- * while preserving the same public API for pack consumers.
14
- */
15
-
16
- export const DELIVERY_REVIEW_COMMAND_CONTEXTS = {
17
- GATES: 'gates',
18
- WU_PREP: 'wu:prep',
19
- } as const;
20
-
21
- export type DeliveryReviewCommandContext =
22
- (typeof DELIVERY_REVIEW_COMMAND_CONTEXTS)[keyof typeof DELIVERY_REVIEW_COMMAND_CONTEXTS];
23
-
24
- export const DEFAULT_DELIVERY_REVIEW_SKIP_TYPES = [
25
- WU_TYPES.DOCUMENTATION,
26
- WU_TYPES.PROCESS,
27
- ] as const;
28
-
29
- export const DELIVERY_REVIEW_ARTIFACT_DIR = '.lumenflow/artifacts/delivery-review' as const;
30
-
31
- export const DeliveryReviewGateConfigSchema = z
32
- .object({
33
- enabled: z.boolean().default(false),
34
- skip_types: z.array(z.string().min(1)).default([...DEFAULT_DELIVERY_REVIEW_SKIP_TYPES]),
35
- })
36
- .strict();
37
-
38
- export type DeliveryReviewGateConfig = z.infer<typeof DeliveryReviewGateConfigSchema>;
39
-
40
- export const DeliveryReviewClientFeatureSchema = z
41
- .object({
42
- enabled: z.boolean().default(false),
43
- auto_run: z.boolean().default(false),
44
- })
45
- .strict();
46
-
47
- export type DeliveryReviewClientFeature = z.infer<typeof DeliveryReviewClientFeatureSchema>;
48
-
49
- export const DeliveryReviewVerdictSchema = z.enum(['PASS', 'FAIL', 'PARTIAL']);
50
- export type DeliveryReviewVerdict = z.infer<typeof DeliveryReviewVerdictSchema>;
51
-
52
- export const DeliveryReviewFindingSeveritySchema = z.enum(['critical', 'high', 'medium', 'low']);
53
- export type DeliveryReviewFindingSeverity = z.infer<typeof DeliveryReviewFindingSeveritySchema>;
54
-
55
- export const DeliveryReviewFindingSchema = z
56
- .object({
57
- severity: DeliveryReviewFindingSeveritySchema,
58
- title: z.string().min(1),
59
- detail: z.string().min(1),
60
- acceptanceCriteriaRefs: z.array(z.string().min(1)).optional(),
61
- fileRefs: z.array(z.string().min(1)).optional(),
62
- })
63
- .strict();
64
-
65
- export type DeliveryReviewFinding = z.infer<typeof DeliveryReviewFindingSchema>;
66
-
67
- export const DeliveryReviewAcceptanceCriterionSchema = z
68
- .object({
69
- criterion: z.string().min(1),
70
- status: z.enum(['satisfied', 'unclear', 'not_satisfied']),
71
- evidence: z.array(z.string().min(1)).optional(),
72
- })
73
- .strict();
74
-
75
- export type DeliveryReviewAcceptanceCriterion = z.infer<
76
- typeof DeliveryReviewAcceptanceCriterionSchema
77
- >;
78
-
79
- export const DeliveryReviewResultSchema = z
80
- .object({
81
- wuId: z.string().min(1),
82
- verdict: DeliveryReviewVerdictSchema,
83
- summary: z.string().min(1),
84
- findings: z.array(DeliveryReviewFindingSchema),
85
- acceptanceCriteria: z.array(DeliveryReviewAcceptanceCriterionSchema),
86
- metadata: z
87
- .object({
88
- runtimeClient: z.string().min(1).optional(),
89
- startedAt: z.string().datetime(),
90
- completedAt: z.string().datetime(),
91
- })
92
- .strict(),
93
- })
94
- .strict();
95
-
96
- export type DeliveryReviewResult = z.infer<typeof DeliveryReviewResultSchema>;
97
-
98
- export interface DeliveryReviewRuntimeConfigInput {
99
- gates?: {
100
- delivery_review?: unknown;
101
- };
102
- agents?: {
103
- defaultClient?: unknown;
104
- clients?: Record<string, unknown>;
105
- };
106
- }
107
-
108
- export interface ResolvedDeliveryReviewRuntimeConfig {
109
- clientName: string;
110
- gate: DeliveryReviewGateConfig;
111
- feature: DeliveryReviewClientFeature;
112
- enabled: boolean;
113
- autoRun: boolean;
114
- }
115
-
116
- function resolveClientNameFromOptions(options: {
117
- config: DeliveryReviewRuntimeConfigInput;
118
- clientName?: string;
119
- env?: Readonly<Record<string, string | undefined>>;
120
- }): string {
121
- const explicitClient = options.clientName?.trim();
122
- if (explicitClient) {
123
- return explicitClient;
124
- }
125
-
126
- const envClient = options.env?.LUMENFLOW_CLIENT?.trim();
127
- if (envClient) {
128
- return envClient;
129
- }
130
-
131
- const defaultClient =
132
- typeof options.config.agents?.defaultClient === 'string'
133
- ? options.config.agents.defaultClient.trim()
134
- : '';
135
- if (defaultClient) {
136
- return defaultClient;
137
- }
138
-
139
- return LUMENFLOW_CLIENT_IDS.CLAUDE_CODE;
140
- }
141
-
142
- function resolveClientRecord(
143
- clients: Record<string, unknown> | undefined,
144
- clientName: string,
145
- ): Record<string, unknown> | null {
146
- if (!clients) {
147
- return null;
148
- }
149
-
150
- const exactMatch = asRecord(clients[clientName]);
151
- if (exactMatch) {
152
- return exactMatch;
153
- }
154
-
155
- const matchKey = Object.keys(clients).find(
156
- (key) => key.toLowerCase() === clientName.toLowerCase(),
157
- );
158
- return matchKey ? asRecord(clients[matchKey]) : null;
159
- }
160
-
161
- export function resolveDeliveryReviewRuntimeState(options: {
162
- config: DeliveryReviewRuntimeConfigInput;
163
- clientName?: string;
164
- env?: Readonly<Record<string, string | undefined>>;
165
- }): ResolvedDeliveryReviewRuntimeConfig {
166
- const clientName = resolveClientNameFromOptions(options);
167
- const gate = DeliveryReviewGateConfigSchema.parse(options.config.gates?.delivery_review ?? {});
168
- const clientConfig = resolveClientRecord(options.config.agents?.clients, clientName);
169
- const features = asRecord(clientConfig?.features);
170
- const feature = DeliveryReviewClientFeatureSchema.parse(features?.delivery_review ?? {});
171
-
172
- return {
173
- clientName,
174
- gate,
175
- feature,
176
- enabled: gate.enabled && feature.enabled,
177
- autoRun: gate.enabled && feature.enabled && feature.auto_run,
178
- };
179
- }
180
-
181
- export function shouldRunDeliveryReviewForCommand(options: {
182
- runtime: ResolvedDeliveryReviewRuntimeConfig;
183
- commandContext: DeliveryReviewCommandContext;
184
- }): boolean {
185
- if (!options.runtime.enabled) {
186
- return false;
187
- }
188
-
189
- if (options.commandContext === DELIVERY_REVIEW_COMMAND_CONTEXTS.WU_PREP) {
190
- return options.runtime.autoRun;
191
- }
192
-
193
- return true;
194
- }
195
-
196
- export function isDeliveryReviewSkippedForType(options: {
197
- gate: DeliveryReviewGateConfig;
198
- wuType?: unknown;
199
- }): boolean {
200
- if (typeof options.wuType !== 'string' || options.wuType.trim().length === 0) {
201
- return false;
202
- }
203
-
204
- return options.gate.skip_types.includes(options.wuType);
205
- }
206
-
207
- export function flattenDeliveryReviewAcceptanceCriteria(acceptance: unknown): string[] {
208
- if (Array.isArray(acceptance)) {
209
- return acceptance
210
- .filter((entry): entry is string => typeof entry === 'string')
211
- .map((entry) => entry.trim())
212
- .filter(Boolean);
213
- }
214
-
215
- const acceptanceRecord = asRecord(acceptance);
216
- if (!acceptanceRecord) {
217
- return [];
218
- }
219
-
220
- return Object.values(acceptanceRecord)
221
- .flatMap((entry) =>
222
- Array.isArray(entry)
223
- ? entry.filter((value): value is string => typeof value === 'string')
224
- : [],
225
- )
226
- .map((entry) => entry.trim())
227
- .filter(Boolean);
228
- }
229
-
230
- export function calculateDeliveryReviewVerdict(input: {
231
- findings: DeliveryReviewFinding[];
232
- acceptanceCriteria: DeliveryReviewAcceptanceCriterion[];
233
- }): DeliveryReviewVerdict {
234
- const hasBlockingFinding = input.findings.some(
235
- (finding) => finding.severity === 'critical' || finding.severity === 'high',
236
- );
237
- if (hasBlockingFinding) {
238
- return 'FAIL';
239
- }
240
-
241
- const hasUnsatisfiedCriterion = input.acceptanceCriteria.some(
242
- (criterion) => criterion.status === 'not_satisfied',
243
- );
244
- if (hasUnsatisfiedCriterion) {
245
- return 'FAIL';
246
- }
247
-
248
- const hasUnclearCriterion = input.acceptanceCriteria.some(
249
- (criterion) => criterion.status === 'unclear',
250
- );
251
- if (hasUnclearCriterion || input.findings.length > 0) {
252
- return 'PARTIAL';
253
- }
254
-
255
- return 'PASS';
256
- }
@@ -1,66 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- import { createError, ErrorCodes } from '@lumenflow/kernel/primitives/error-handler';
5
-
6
- /**
7
- * Pack-local environment access helpers.
8
- *
9
- * These stay local to the pack so clean workspace builds do not need to route
10
- * back through @lumenflow/core, which already depends on this pack.
11
- */
12
-
13
- export interface GetEnvOptions {
14
- env?: NodeJS.ProcessEnv;
15
- trim?: boolean;
16
- }
17
-
18
- export interface RequireEnvOptions extends GetEnvOptions {
19
- context?: string;
20
- remediation?: string;
21
- }
22
-
23
- const DEFAULT_REMEDIATION_SUFFIX = 'Set the environment variable and retry.';
24
- const CONTEXT_SEPARATOR = ': ';
25
-
26
- function getEnvSource(options: GetEnvOptions): NodeJS.ProcessEnv {
27
- return options.env ?? process.env;
28
- }
29
-
30
- export function getEnv(envVar: string, options: GetEnvOptions = {}): string | undefined {
31
- const source = getEnvSource(options);
32
- const rawValue = source[envVar];
33
- if (rawValue === undefined) {
34
- return undefined;
35
- }
36
-
37
- const trimValue = options.trim ?? true;
38
- const normalizedValue = trimValue ? rawValue.trim() : rawValue;
39
- if (normalizedValue.length === 0) {
40
- return undefined;
41
- }
42
-
43
- return normalizedValue;
44
- }
45
-
46
- function formatContextPrefix(context?: string): string {
47
- if (!context) {
48
- return '';
49
- }
50
- return `${context}${CONTEXT_SEPARATOR}`;
51
- }
52
-
53
- export function requireEnv(envVar: string, options: RequireEnvOptions = {}): string {
54
- const value = getEnv(envVar, options);
55
- if (value !== undefined) {
56
- return value;
57
- }
58
-
59
- const remediation = options.remediation ?? DEFAULT_REMEDIATION_SUFFIX;
60
- const contextPrefix = formatContextPrefix(options.context);
61
- throw createError(
62
- ErrorCodes.CONFIG_ERROR,
63
- `${contextPrefix}Missing required environment variable ${envVar}. ${remediation}`,
64
- { envVar, context: options.context },
65
- );
66
- }
@@ -1,8 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- // Pack-local config helpers. Introduced by WU-2686 as Option 1b prep —
5
- // keeps the pack core-free while exposing a minimal workspace.yaml reader.
6
- // Extended by WU-2694 with `getConfig(cwd)` + pack-local config schema.
7
- export * from './workspace-reader.js';
8
- export * from './schemas/lumenflow-config-schema-types.js';
@@ -1,9 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * This utility already lives in kernel primitives, so the pack can depend on
6
- * it directly without routing through @lumenflow/core.
7
- */
8
-
9
- export * from '@lumenflow/kernel/primitives/normalize-config-keys';