@lumenflow/cli 5.5.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 (213) 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 +37 -0
  7. package/dist/gate-defaults.js.map +1 -1
  8. package/dist/gates/monolithic-file-contention-guard.js +167 -0
  9. package/dist/gates/monolithic-file-contention-guard.js.map +1 -0
  10. package/dist/gates/prod-migration-drift.js +207 -0
  11. package/dist/gates/prod-migration-drift.js.map +1 -0
  12. package/dist/gates/test-over-deletion-guard.js +255 -0
  13. package/dist/gates/test-over-deletion-guard.js.map +1 -0
  14. package/dist/gates-runners.js +44 -3
  15. package/dist/gates-runners.js.map +1 -1
  16. package/dist/gates.js +3 -2
  17. package/dist/gates.js.map +1 -1
  18. package/dist/lumenflow-setup.js +144 -0
  19. package/dist/lumenflow-setup.js.map +1 -0
  20. package/dist/lumenflow-upgrade.js +2 -1
  21. package/dist/lumenflow-upgrade.js.map +1 -1
  22. package/dist/mem-create.js +10 -1
  23. package/dist/mem-create.js.map +1 -1
  24. package/dist/mem-signal.js +21 -4
  25. package/dist/mem-signal.js.map +1 -1
  26. package/dist/orchestrate-initiative.js +28 -3
  27. package/dist/orchestrate-initiative.js.map +1 -1
  28. package/dist/public-manifest.js +17 -0
  29. package/dist/public-manifest.js.map +1 -1
  30. package/dist/release.js +53 -18
  31. package/dist/release.js.map +1 -1
  32. package/dist/wu-done-gates.js +13 -9
  33. package/dist/wu-done-gates.js.map +1 -1
  34. package/dist/wu-edit-operations.js +74 -0
  35. package/dist/wu-edit-operations.js.map +1 -1
  36. package/dist/wu-edit-validators.js +58 -0
  37. package/dist/wu-edit-validators.js.map +1 -1
  38. package/dist/wu-edit.js +106 -4
  39. package/dist/wu-edit.js.map +1 -1
  40. package/dist/wu-prep.js +41 -7
  41. package/dist/wu-prep.js.map +1 -1
  42. package/dist/wu-recover.js +6 -0
  43. package/dist/wu-recover.js.map +1 -1
  44. package/dist/wu-release.js +120 -2
  45. package/dist/wu-release.js.map +1 -1
  46. package/dist/wu-sizing-validation.js +47 -17
  47. package/dist/wu-sizing-validation.js.map +1 -1
  48. package/dist/wu-status.js +33 -0
  49. package/dist/wu-status.js.map +1 -1
  50. package/package.json +13 -11
  51. package/packs/agent-runtime/package.json +1 -1
  52. package/packs/sidekick/package.json +1 -1
  53. package/packs/software-delivery/package.json +1 -1
  54. package/templates/core/AGENTS.md.template +67 -3
  55. package/templates/core/LUMENFLOW.md.template +197 -47
  56. package/packs/agent-runtime/agent-heartbeat.ts +0 -163
  57. package/packs/agent-runtime/auto-session-integration.ts +0 -888
  58. package/packs/agent-runtime/capability-factory.ts +0 -104
  59. package/packs/agent-runtime/constants.ts +0 -21
  60. package/packs/agent-runtime/delegation-registry-schema.ts +0 -220
  61. package/packs/agent-runtime/delegation-registry-store.ts +0 -269
  62. package/packs/agent-runtime/delegation-tree.ts +0 -328
  63. package/packs/agent-runtime/index.ts +0 -20
  64. package/packs/agent-runtime/manifest.ts +0 -348
  65. package/packs/agent-runtime/memory-coordination-contract.ts +0 -86
  66. package/packs/agent-runtime/orchestration.ts +0 -2027
  67. package/packs/agent-runtime/pack-registration.ts +0 -110
  68. package/packs/agent-runtime/policy-factory.ts +0 -165
  69. package/packs/agent-runtime/remote-controls/index.ts +0 -7
  70. package/packs/agent-runtime/remote-controls/operations.ts +0 -405
  71. package/packs/agent-runtime/remote-controls/port.ts +0 -48
  72. package/packs/agent-runtime/remote-controls/state-store.ts +0 -258
  73. package/packs/agent-runtime/remote-controls/types.ts +0 -105
  74. package/packs/agent-runtime/session-schema.ts +0 -467
  75. package/packs/agent-runtime/tool-impl/agent-turn-tools.ts +0 -793
  76. package/packs/agent-runtime/tool-impl/index.ts +0 -6
  77. package/packs/agent-runtime/tool-impl/provider-adapters.ts +0 -1245
  78. package/packs/agent-runtime/tool-impl/remote-controls.mock.ts +0 -256
  79. package/packs/agent-runtime/tool-impl/remote-controls.ts +0 -273
  80. package/packs/agent-runtime/tools/index.ts +0 -4
  81. package/packs/agent-runtime/tools/types.ts +0 -47
  82. package/packs/agent-runtime/turn-lifecycle-events.ts +0 -590
  83. package/packs/agent-runtime/types.ts +0 -128
  84. package/packs/agent-runtime/vitest.config.ts +0 -11
  85. package/packs/sidekick/channel-ingress.ts +0 -137
  86. package/packs/sidekick/constants.ts +0 -10
  87. package/packs/sidekick/index.ts +0 -8
  88. package/packs/sidekick/manifest-schema.ts +0 -49
  89. package/packs/sidekick/manifest.ts +0 -512
  90. package/packs/sidekick/pack-registration.ts +0 -110
  91. package/packs/sidekick/policy-factory.ts +0 -38
  92. package/packs/sidekick/sidekick-events.ts +0 -694
  93. package/packs/sidekick/src/adapters/cloud-queue.ts +0 -101
  94. package/packs/sidekick/src/adapters/control-plane-bridge.adapter.ts +0 -386
  95. package/packs/sidekick/src/adapters/filesystem-bridge.adapter.ts +0 -228
  96. package/packs/sidekick/src/domain/channel.types.ts +0 -64
  97. package/packs/sidekick/src/ports/channel-bridge.port.ts +0 -92
  98. package/packs/sidekick/src/routines/commit.ts +0 -74
  99. package/packs/sidekick/tool-impl/channel-tools.ts +0 -577
  100. package/packs/sidekick/tool-impl/channel-transports.ts +0 -75
  101. package/packs/sidekick/tool-impl/index.ts +0 -29
  102. package/packs/sidekick/tool-impl/memory-tools.ts +0 -290
  103. package/packs/sidekick/tool-impl/routine-commit.ts +0 -102
  104. package/packs/sidekick/tool-impl/routine-tools.ts +0 -440
  105. package/packs/sidekick/tool-impl/runtime-context.ts +0 -28
  106. package/packs/sidekick/tool-impl/shared.ts +0 -125
  107. package/packs/sidekick/tool-impl/storage.ts +0 -325
  108. package/packs/sidekick/tool-impl/system-tools.ts +0 -160
  109. package/packs/sidekick/tool-impl/task-tools.ts +0 -506
  110. package/packs/sidekick/tools/channel-tools.ts +0 -53
  111. package/packs/sidekick/tools/index.ts +0 -9
  112. package/packs/sidekick/tools/memory-tools.ts +0 -53
  113. package/packs/sidekick/tools/routine-tools.ts +0 -53
  114. package/packs/sidekick/tools/system-tools.ts +0 -47
  115. package/packs/sidekick/tools/task-tools.ts +0 -61
  116. package/packs/sidekick/tools/types.ts +0 -57
  117. package/packs/sidekick/vitest.config.ts +0 -11
  118. package/packs/software-delivery/constants.ts +0 -10
  119. package/packs/software-delivery/extensions.ts +0 -140
  120. package/packs/software-delivery/gate-policies.ts +0 -134
  121. package/packs/software-delivery/index.ts +0 -8
  122. package/packs/software-delivery/manifest-schema.ts +0 -268
  123. package/packs/software-delivery/manifest.ts +0 -657
  124. package/packs/software-delivery/pack-registration.ts +0 -113
  125. package/packs/software-delivery/src/commands/index.ts +0 -5
  126. package/packs/software-delivery/src/config/delivery-review-contract.ts +0 -256
  127. package/packs/software-delivery/src/config/env-accessors.ts +0 -66
  128. package/packs/software-delivery/src/config/index.ts +0 -8
  129. package/packs/software-delivery/src/config/normalize-config-keys.ts +0 -9
  130. package/packs/software-delivery/src/config/schemas/lumenflow-config-schema-types.ts +0 -460
  131. package/packs/software-delivery/src/config/workspace-reader.ts +0 -375
  132. package/packs/software-delivery/src/constants/backlog-patterns.ts +0 -31
  133. package/packs/software-delivery/src/constants/client-ids.ts +0 -19
  134. package/packs/software-delivery/src/constants/config-contract.ts +0 -7
  135. package/packs/software-delivery/src/constants/docs-layout-presets.ts +0 -50
  136. package/packs/software-delivery/src/constants/duration-constants.ts +0 -20
  137. package/packs/software-delivery/src/constants/gate-constants.ts +0 -32
  138. package/packs/software-delivery/src/constants/index.ts +0 -29
  139. package/packs/software-delivery/src/constants/lock-constants.ts +0 -35
  140. package/packs/software-delivery/src/constants/object-guards.ts +0 -12
  141. package/packs/software-delivery/src/constants/section-headings.ts +0 -107
  142. package/packs/software-delivery/src/constants/wu-cli-constants.ts +0 -500
  143. package/packs/software-delivery/src/constants/wu-domain-constants.ts +0 -466
  144. package/packs/software-delivery/src/constants/wu-git-constants.ts +0 -7
  145. package/packs/software-delivery/src/constants/wu-id-format.ts +0 -327
  146. package/packs/software-delivery/src/constants/wu-paths-constants.ts +0 -384
  147. package/packs/software-delivery/src/constants/wu-statuses.ts +0 -287
  148. package/packs/software-delivery/src/constants/wu-type-helpers.ts +0 -67
  149. package/packs/software-delivery/src/constants/wu-ui-constants.ts +0 -267
  150. package/packs/software-delivery/src/constants/wu-validation-constants.ts +0 -73
  151. package/packs/software-delivery/src/domain/index.ts +0 -5
  152. package/packs/software-delivery/src/domain/orchestration.constants.ts +0 -166
  153. package/packs/software-delivery/src/domain/orchestration.schemas.ts +0 -238
  154. package/packs/software-delivery/src/domain/orchestration.types.ts +0 -176
  155. package/packs/software-delivery/src/methodology/incremental-test.ts +0 -122
  156. package/packs/software-delivery/src/methodology/index.ts +0 -6
  157. package/packs/software-delivery/src/methodology/manual-test-validator.ts +0 -292
  158. package/packs/software-delivery/src/policy/coverage-gate.ts +0 -270
  159. package/packs/software-delivery/src/policy/gates-agent-mode.ts +0 -223
  160. package/packs/software-delivery/src/policy/gates-config-internal.ts +0 -121
  161. package/packs/software-delivery/src/policy/gates-config.ts +0 -300
  162. package/packs/software-delivery/src/policy/gates-coverage.ts +0 -356
  163. package/packs/software-delivery/src/policy/gates-presets.ts +0 -134
  164. package/packs/software-delivery/src/policy/gates-schemas.ts +0 -173
  165. package/packs/software-delivery/src/policy/index.ts +0 -22
  166. package/packs/software-delivery/src/policy/package-manager-resolver.ts +0 -319
  167. package/packs/software-delivery/src/policy/resolve-policy.ts +0 -601
  168. package/packs/software-delivery/src/ports/config.ports.ts +0 -90
  169. package/packs/software-delivery/src/ports/dashboard-renderer.port.ts +0 -125
  170. package/packs/software-delivery/src/ports/index.ts +0 -10
  171. package/packs/software-delivery/src/ports/sync-validator.ports.ts +0 -59
  172. package/packs/software-delivery/src/ports/wu-helpers.ports.ts +0 -168
  173. package/packs/software-delivery/src/ports/wu-state.ports.ts +0 -241
  174. package/packs/software-delivery/src/primitives/index.ts +0 -5
  175. package/packs/software-delivery/src/runtime/index.ts +0 -6
  176. package/packs/software-delivery/src/runtime/work-classifier.ts +0 -561
  177. package/packs/software-delivery/src/sandbox/index.ts +0 -10
  178. package/packs/software-delivery/src/sandbox/sandbox-allowlist.ts +0 -118
  179. package/packs/software-delivery/src/sandbox/sandbox-backend-linux.ts +0 -88
  180. package/packs/software-delivery/src/sandbox/sandbox-backend-macos.ts +0 -154
  181. package/packs/software-delivery/src/sandbox/sandbox-backend-windows.ts +0 -47
  182. package/packs/software-delivery/src/sandbox/sandbox-profile.ts +0 -153
  183. package/packs/software-delivery/src/schemas/index.ts +0 -5
  184. package/packs/software-delivery/src/state/date-utils.ts +0 -158
  185. package/packs/software-delivery/src/state/index.ts +0 -15
  186. package/packs/software-delivery/src/state/state-machine.ts +0 -119
  187. package/packs/software-delivery/src/state/wu-doc-types.ts +0 -51
  188. package/packs/software-delivery/src/state/wu-paths.ts +0 -381
  189. package/packs/software-delivery/src/state/wu-schema.ts +0 -1139
  190. package/packs/software-delivery/src/state/wu-state-schema.ts +0 -255
  191. package/packs/software-delivery/src/state/wu-yaml.ts +0 -338
  192. package/packs/software-delivery/tool-impl/agent-tools.ts +0 -263
  193. package/packs/software-delivery/tool-impl/delegation-tools.ts +0 -66
  194. package/packs/software-delivery/tool-impl/flow-metrics-tools.ts +0 -219
  195. package/packs/software-delivery/tool-impl/git-runner.ts +0 -113
  196. package/packs/software-delivery/tool-impl/git-tools.ts +0 -316
  197. package/packs/software-delivery/tool-impl/index.ts +0 -15
  198. package/packs/software-delivery/tool-impl/initiative-orchestration-tools.ts +0 -720
  199. package/packs/software-delivery/tool-impl/lane-lock.ts +0 -246
  200. package/packs/software-delivery/tool-impl/memory-tools.ts +0 -470
  201. package/packs/software-delivery/tool-impl/pending-runtime-tools.ts +0 -21
  202. package/packs/software-delivery/tool-impl/runtime-cli-adapter.ts +0 -329
  203. package/packs/software-delivery/tool-impl/runtime-native-tools.ts +0 -687
  204. package/packs/software-delivery/tool-impl/worker-loader.ts +0 -52
  205. package/packs/software-delivery/tool-impl/worktree-tools.ts +0 -46
  206. package/packs/software-delivery/tool-impl/wu-lifecycle-tools.ts +0 -807
  207. package/packs/software-delivery/tools/delegation-tools.ts +0 -23
  208. package/packs/software-delivery/tools/git-tools.ts +0 -55
  209. package/packs/software-delivery/tools/index.ts +0 -8
  210. package/packs/software-delivery/tools/lane-lock-tool.ts +0 -37
  211. package/packs/software-delivery/tools/types.ts +0 -71
  212. package/packs/software-delivery/tools/worktree-tools.ts +0 -49
  213. package/packs/software-delivery/vitest.config.ts +0 -11
@@ -1,375 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Pack-side workspace.yaml reader.
6
- *
7
- * Locates the project root (via kernel primitive) and returns the
8
- * `software_delivery` section of `workspace.yaml`. Loose typing on purpose —
9
- * the authoritative schema lives in `@lumenflow/core`; this helper exists to
10
- * keep the pack core-free for Option 1b prep work (INIT-058).
11
- */
12
-
13
- import { readFileSync } from 'node:fs';
14
- import { join } from 'node:path';
15
-
16
- import { findProjectRoot } from '@lumenflow/kernel/primitives/project-root';
17
- import { WORKSPACE_CONFIG_FILE_NAME } from '@lumenflow/kernel/primitives/workspace-constants';
18
- import { parse as parseYaml } from 'yaml';
19
-
20
- import {
21
- AGENTS_DEFAULTS,
22
- CLEANUP_DEFAULTS,
23
- CLOUD_DEFAULTS,
24
- DIRECTORIES_DEFAULTS,
25
- ESCALATION_DEFAULTS,
26
- EXPERIMENTAL_DEFAULTS,
27
- GATES_DEFAULTS,
28
- GIT_DEFAULTS,
29
- INITIATIVE_ID_DEFAULTS,
30
- LUMENFLOW_CONFIG_DEFAULTS,
31
- MEMORY_DEFAULTS,
32
- STATE_PATHS_DEFAULTS,
33
- TELEMETRY_DEFAULTS,
34
- UI_DEFAULTS,
35
- WU_DEFAULTS,
36
- WU_ID_DEFAULTS,
37
- YAML_DEFAULTS,
38
- type AgentsConfig,
39
- type CleanupConfig,
40
- type CloudConfig,
41
- type DirectoriesConfig,
42
- type EscalationConfig,
43
- type EventArchivalConfig,
44
- type ExperimentalConfig,
45
- type GatesConfig,
46
- type GitConfig,
47
- type IdFormatConfig,
48
- type LumenflowConfig,
49
- type MemoryConfig,
50
- type PackageManager,
51
- type PushRetryConfig,
52
- type StatePathsConfig,
53
- type TelemetryConfig,
54
- type TestRunner,
55
- type UiConfig,
56
- type WuConfig,
57
- type YamlConfig,
58
- } from './schemas/lumenflow-config-schema-types.js';
59
-
60
- export type SoftwareDeliveryConfig = Record<string, unknown>;
61
-
62
- /**
63
- * Read `workspace.yaml` relative to the given `cwd`'s project root and return
64
- * the `software_delivery` section (or an empty object if absent/empty).
65
- *
66
- * @throws If the project root cannot be located or the YAML is malformed.
67
- */
68
- export function readSoftwareDeliveryConfig(cwd: string): SoftwareDeliveryConfig {
69
- const root = findProjectRoot(cwd);
70
- const raw = readFileSync(join(root, WORKSPACE_CONFIG_FILE_NAME), 'utf8');
71
- const doc = parseYaml(raw) as Record<string, unknown> | null | undefined;
72
- const section = doc?.['software_delivery'];
73
- if (section && typeof section === 'object' && !Array.isArray(section)) {
74
- return section as SoftwareDeliveryConfig;
75
- }
76
- return {};
77
- }
78
-
79
- /**
80
- * Re-export pack-local directory/state-path type aliases. These mirror
81
- * `@lumenflow/core/schemas/directories-config`; drift is enforced by the
82
- * integration-tests parity tests.
83
- */
84
- export type WorkspaceDirectories = DirectoriesConfig;
85
- export type WorkspaceStatePaths = StatePathsConfig;
86
- export type WorkspaceEventArchivalConfig = EventArchivalConfig;
87
-
88
- function readObjectRecord(cwd: string, key: string): Record<string, unknown> {
89
- const section = readSoftwareDeliveryConfig(cwd);
90
- const value = section[key];
91
- if (value && typeof value === 'object' && !Array.isArray(value)) {
92
- return value as Record<string, unknown>;
93
- }
94
- return {};
95
- }
96
-
97
- /**
98
- * Return the typed directory map for the workspace rooted at `cwd`.
99
- *
100
- * User-provided values in `software_delivery.directories` are merged over the
101
- * built-in defaults. Unknown keys in the user's YAML are ignored by the return
102
- * type but pass through the spread — the authoritative schema validation still
103
- * lives in core's `getConfig()` pathway.
104
- */
105
- export function getDirectories(cwd: string): WorkspaceDirectories {
106
- const overrides = readObjectRecord(cwd, 'directories') as Partial<WorkspaceDirectories>;
107
- return { ...DIRECTORIES_DEFAULTS, ...overrides };
108
- }
109
-
110
- /**
111
- * Return the typed state-paths map for the workspace rooted at `cwd`.
112
- *
113
- * User-provided values in `software_delivery.state` are merged over the
114
- * built-in defaults. `eventArchival` is merged as a nested object so a partial
115
- * override (e.g. only `archiveAfter`) preserves the remaining defaults.
116
- */
117
- export function getStatePaths(cwd: string): WorkspaceStatePaths {
118
- const overrides = readObjectRecord(cwd, 'state') as Partial<WorkspaceStatePaths>;
119
- const { eventArchival: overrideArchival, ...flatOverrides } = overrides;
120
- const eventArchivalOverrides =
121
- overrideArchival && typeof overrideArchival === 'object' && !Array.isArray(overrideArchival)
122
- ? (overrideArchival as Partial<WorkspaceEventArchivalConfig>)
123
- : {};
124
- return {
125
- ...STATE_PATHS_DEFAULTS,
126
- ...flatOverrides,
127
- eventArchival: {
128
- ...STATE_PATHS_DEFAULTS.eventArchival,
129
- ...eventArchivalOverrides,
130
- },
131
- };
132
- }
133
-
134
- function mergeGit(overrides: Partial<GitConfig> | undefined): GitConfig {
135
- if (!overrides) return { ...GIT_DEFAULTS, push_retry: { ...GIT_DEFAULTS.push_retry } };
136
- const { push_retry: overridePushRetry, ...flatOverrides } = overrides;
137
- const pushRetryOverrides =
138
- overridePushRetry && typeof overridePushRetry === 'object' && !Array.isArray(overridePushRetry)
139
- ? (overridePushRetry as Partial<PushRetryConfig>)
140
- : {};
141
- return {
142
- ...GIT_DEFAULTS,
143
- ...flatOverrides,
144
- push_retry: {
145
- ...GIT_DEFAULTS.push_retry,
146
- ...pushRetryOverrides,
147
- },
148
- };
149
- }
150
-
151
- function mergeWu(overrides: Partial<WuConfig> | undefined): WuConfig {
152
- if (!overrides) return { ...WU_DEFAULTS, brief: { ...WU_DEFAULTS.brief } };
153
- const { brief: overrideBrief, ...flatOverrides } = overrides;
154
- const briefOverrides =
155
- overrideBrief && typeof overrideBrief === 'object' && !Array.isArray(overrideBrief)
156
- ? (overrideBrief as Partial<WuConfig['brief']>)
157
- : {};
158
- return {
159
- ...WU_DEFAULTS,
160
- ...flatOverrides,
161
- brief: {
162
- ...WU_DEFAULTS.brief,
163
- ...briefOverrides,
164
- },
165
- };
166
- }
167
-
168
- function mergeSimple<T>(defaults: T, overrides: unknown): T {
169
- if (overrides && typeof overrides === 'object' && !Array.isArray(overrides)) {
170
- return { ...defaults, ...(overrides as object) } as T;
171
- }
172
- return { ...defaults };
173
- }
174
-
175
- function isObjectRecord(value: unknown): value is Record<string, unknown> {
176
- return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
177
- }
178
-
179
- function isStringArray(value: unknown): value is string[] {
180
- return Array.isArray(value) && value.every((item) => typeof item === 'string');
181
- }
182
-
183
- function cloneStringArrayRecord(record: Record<string, string[]>): Record<string, string[]> {
184
- return Object.fromEntries(Object.entries(record).map(([key, values]) => [key, [...values]]));
185
- }
186
-
187
- function readStringArrayRecord(value: unknown): Record<string, string[]> {
188
- if (!isObjectRecord(value)) {
189
- return {};
190
- }
191
-
192
- return Object.fromEntries(
193
- Object.entries(value).flatMap(([key, entryValue]) =>
194
- isStringArray(entryValue) ? [[key, [...entryValue]]] : [],
195
- ),
196
- );
197
- }
198
-
199
- function mergeTelemetry(overrides: Partial<TelemetryConfig> | undefined): TelemetryConfig {
200
- if (!overrides) {
201
- return { methodology: { ...TELEMETRY_DEFAULTS.methodology } };
202
- }
203
- const methodology =
204
- overrides.methodology && typeof overrides.methodology === 'object'
205
- ? { ...TELEMETRY_DEFAULTS.methodology, ...overrides.methodology }
206
- : { ...TELEMETRY_DEFAULTS.methodology };
207
- return { methodology };
208
- }
209
-
210
- function pickEnum<T extends string>(value: unknown, allowed: readonly T[], fallback: T): T {
211
- return typeof value === 'string' && (allowed as readonly string[]).includes(value)
212
- ? (value as T)
213
- : fallback;
214
- }
215
-
216
- function cloneAgentsDefaults(): AgentsConfig {
217
- return {
218
- ...AGENTS_DEFAULTS,
219
- roster: [...AGENTS_DEFAULTS.roster],
220
- mandatory: {
221
- ...AGENTS_DEFAULTS.mandatory,
222
- names: [...AGENTS_DEFAULTS.mandatory.names],
223
- triggers: cloneStringArrayRecord(AGENTS_DEFAULTS.mandatory.triggers),
224
- },
225
- };
226
- }
227
-
228
- function mergeAgents(overrides: unknown): AgentsConfig {
229
- if (!isObjectRecord(overrides)) {
230
- return cloneAgentsDefaults();
231
- }
232
-
233
- const defaults = cloneAgentsDefaults();
234
- const { defaultClient, roster, mandatory: overrideMandatory, ...flatOverrides } = overrides;
235
- const mandatoryOverrides = isObjectRecord(overrideMandatory) ? overrideMandatory : {};
236
-
237
- return {
238
- ...defaults,
239
- ...flatOverrides,
240
- defaultClient:
241
- typeof defaultClient === 'string' ? defaultClient : AGENTS_DEFAULTS.defaultClient,
242
- roster: isStringArray(roster) ? [...roster] : [...AGENTS_DEFAULTS.roster],
243
- mandatory: {
244
- ...defaults.mandatory,
245
- ...mandatoryOverrides,
246
- names: isStringArray(mandatoryOverrides['names'])
247
- ? [...mandatoryOverrides['names']]
248
- : [...AGENTS_DEFAULTS.mandatory.names],
249
- triggers: {
250
- ...cloneStringArrayRecord(AGENTS_DEFAULTS.mandatory.triggers),
251
- ...readStringArrayRecord(mandatoryOverrides['triggers']),
252
- },
253
- },
254
- };
255
- }
256
-
257
- /**
258
- * Return the fully-typed pack-local `LumenflowConfig` for the workspace rooted
259
- * at `cwd`.
260
- *
261
- * Mirrors the shape produced by `@lumenflow/core`'s
262
- * `getConfig({ projectRoot: cwd }).parse({})` for every field exposed on
263
- * `LumenflowConfig`. Drift from core is enforced by
264
- * `integration-tests/tests/config-parity.test.ts`.
265
- *
266
- * Behaviour parity with core:
267
- * - Reads `workspace.yaml` relative to `cwd`'s project root via the kernel
268
- * `findProjectRoot` primitive.
269
- * - Returns defaults when `workspace.yaml` is absent or lacks a
270
- * `software_delivery` block (graceful fallback, matches core's
271
- * non-`strictWorkspace` mode).
272
- * - User-provided values are spread over defaults at the section level, with
273
- * nested merges for sections that have nested objects (state.eventArchival,
274
- * git.push_retry, wu.brief, telemetry.methodology).
275
- */
276
- export function getConfig(cwd: string): LumenflowConfig {
277
- let section: SoftwareDeliveryConfig;
278
- try {
279
- section = readSoftwareDeliveryConfig(cwd);
280
- } catch {
281
- // Graceful fallback — matches core's non-strictWorkspace behaviour when
282
- // workspace.yaml is absent or unreadable.
283
- return cloneDefaults();
284
- }
285
-
286
- return {
287
- version: typeof section['version'] === 'string' ? section['version'] : '1.0.0',
288
- directories: getDirectories(cwd),
289
- state: getStatePaths(cwd),
290
- git: mergeGit(section['git'] as Partial<GitConfig> | undefined),
291
- wu: mergeWu(section['wu'] as Partial<WuConfig> | undefined),
292
- wuId: mergeSimple<IdFormatConfig>(WU_ID_DEFAULTS, section['wuId']),
293
- initiativeId: mergeSimple<IdFormatConfig>(INITIATIVE_ID_DEFAULTS, section['initiativeId']),
294
- gates: mergeSimple<GatesConfig>(GATES_DEFAULTS, section['gates']),
295
- memory: mergeSimple<MemoryConfig>(MEMORY_DEFAULTS, section['memory']),
296
- ui: mergeSimple<UiConfig>(UI_DEFAULTS, section['ui']),
297
- yaml: mergeSimple<YamlConfig>(YAML_DEFAULTS, section['yaml']),
298
- agents: mergeAgents(section['agents']),
299
- experimental: mergeSimple<ExperimentalConfig>(EXPERIMENTAL_DEFAULTS, section['experimental']),
300
- cleanup: mergeSimple<CleanupConfig>(CLEANUP_DEFAULTS, section['cleanup']),
301
- telemetry: mergeTelemetry(section['telemetry'] as Partial<TelemetryConfig> | undefined),
302
- methodology:
303
- section['methodology'] && typeof section['methodology'] === 'object'
304
- ? (section['methodology'] as Record<string, unknown>)
305
- : undefined,
306
- cloud: mergeSimple<CloudConfig>(CLOUD_DEFAULTS, section['cloud']),
307
- lanes:
308
- section['lanes'] && typeof section['lanes'] === 'object'
309
- ? (section['lanes'] as Record<string, unknown>)
310
- : undefined,
311
- escalation: mergeSimple<EscalationConfig>(ESCALATION_DEFAULTS, section['escalation']),
312
- package_manager: pickEnum<PackageManager>(
313
- section['package_manager'],
314
- ['pnpm', 'npm', 'yarn', 'bun'] as const,
315
- 'pnpm',
316
- ),
317
- test_runner: pickEnum<TestRunner>(
318
- section['test_runner'],
319
- ['vitest', 'jest', 'mocha'] as const,
320
- 'vitest',
321
- ),
322
- build_command:
323
- typeof section['build_command'] === 'string' ? section['build_command'] : 'pnpm build',
324
- };
325
- }
326
-
327
- function cloneDefaults(): LumenflowConfig {
328
- return {
329
- ...LUMENFLOW_CONFIG_DEFAULTS,
330
- directories: { ...DIRECTORIES_DEFAULTS },
331
- state: {
332
- ...STATE_PATHS_DEFAULTS,
333
- eventArchival: { ...STATE_PATHS_DEFAULTS.eventArchival },
334
- },
335
- git: { ...GIT_DEFAULTS, push_retry: { ...GIT_DEFAULTS.push_retry } },
336
- wu: { ...WU_DEFAULTS, brief: { ...WU_DEFAULTS.brief } },
337
- wuId: { ...WU_ID_DEFAULTS },
338
- initiativeId: { ...INITIATIVE_ID_DEFAULTS },
339
- gates: { ...GATES_DEFAULTS },
340
- memory: { ...MEMORY_DEFAULTS },
341
- ui: { ...UI_DEFAULTS },
342
- yaml: { ...YAML_DEFAULTS },
343
- agents: cloneAgentsDefaults(),
344
- experimental: { ...EXPERIMENTAL_DEFAULTS },
345
- cleanup: { ...CLEANUP_DEFAULTS },
346
- telemetry: { methodology: { ...TELEMETRY_DEFAULTS.methodology } },
347
- cloud: { ...CLOUD_DEFAULTS, env_signals: [...CLOUD_DEFAULTS.env_signals] },
348
- escalation: { ...ESCALATION_DEFAULTS },
349
- };
350
- }
351
-
352
- // Re-export pack-local schema types for downstream consumers migrating off
353
- // `@lumenflow/core/lumenflow-config-schema`.
354
- export type {
355
- AgentsConfig,
356
- CleanupConfig,
357
- CloudConfig,
358
- DirectoriesConfig,
359
- EscalationConfig,
360
- EventArchivalConfig,
361
- ExperimentalConfig,
362
- GatesConfig,
363
- GitConfig,
364
- IdFormatConfig,
365
- LumenflowConfig,
366
- MemoryConfig,
367
- PackageManager,
368
- PushRetryConfig,
369
- StatePathsConfig,
370
- TelemetryConfig,
371
- TestRunner,
372
- UiConfig,
373
- WuConfig,
374
- YamlConfig,
375
- } from './schemas/lumenflow-config-schema-types.js';
@@ -1,31 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Backlog Parsing Patterns
6
- *
7
- * Centralizes patterns for parsing status.md and backlog.md files.
8
- * Used by lane-checker.ts and related backlog utilities.
9
- */
10
-
11
- /** Markdown section header patterns for In Progress section */
12
- export const IN_PROGRESS_HEADERS = ['## in progress', '## 🔧 in progress'];
13
-
14
- /**
15
- * Pattern for extracting WU ID from backlog links.
16
- * Matches: [WU-123 — Title text](path/to/file.yaml)
17
- * Captures: WU ID (e.g., "WU-123")
18
- */
19
- export const WU_LINK_PATTERN = /\[([A-Z]+-\d+)\s*—\s*[^\]]+\]\([^)]+\)/gi;
20
-
21
- /**
22
- * Check if a line matches an In Progress section header.
23
- * @param {string} line - Line to check (will be trimmed and lowercased)
24
- * @returns {boolean} True if line is an In Progress header
25
- */
26
- export function isInProgressHeader(line: string) {
27
- const normalized = line.trim().toLowerCase();
28
- return IN_PROGRESS_HEADERS.some(
29
- (header) => normalized === header || normalized.startsWith(header),
30
- );
31
- }
@@ -1,19 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Canonical client IDs for client-specific integrations and config keys.
6
- *
7
- * Kept in a standalone module so config schema can depend on these
8
- * constants without importing context/hook modules.
9
- */
10
- export const LUMENFLOW_CLIENT_IDS = {
11
- CLAUDE_CODE: 'claude-code',
12
- CODEX_CLI: 'codex-cli',
13
- CURSOR: 'cursor',
14
- GEMINI_CLI: 'gemini-cli',
15
- WINDSURF: 'windsurf',
16
- } as const;
17
-
18
- /** Type for supported client IDs with integration support */
19
- export type LumenflowClientId = (typeof LUMENFLOW_CLIENT_IDS)[keyof typeof LUMENFLOW_CLIENT_IDS];
@@ -1,7 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- // WU-2681 (INIT-058 L2e): Shim — real module lives in @lumenflow/kernel/primitives/workspace-constants.
5
- // Re-export preserves the `@lumenflow/packs-software-delivery/constants/config-contract` subpath
6
- // for existing consumers (including core shims) until Layer 7 removes the shim.
7
- export * from '@lumenflow/kernel/primitives/workspace-constants';
@@ -1,50 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Canonical docs layout presets used across scaffolding and defaults.
6
- *
7
- * Keeping presets in one place avoids path-literal drift between:
8
- * - schema defaults
9
- * - init docs-structure mapping
10
- * - runtime prompt/path helpers
11
- */
12
-
13
- function buildDocsLayout(operations: string, tasks: string, adrDir: string) {
14
- const frameworkRoot = `${operations}/_frameworks/lumenflow`;
15
- const onboarding = `${frameworkRoot}/agent/onboarding`;
16
-
17
- return {
18
- operations,
19
- tasks,
20
- adrDir,
21
- onboarding,
22
- quickRefLink: `${onboarding}/quick-ref-commands.md`,
23
- completeGuidePath: `${frameworkRoot}/lumenflow-complete.md`,
24
- quickRefPath: `${onboarding}/quick-ref-commands.md`,
25
- startingPromptPath: `${onboarding}/starting-prompt.md`,
26
- sizingGuidePath: `${frameworkRoot}/wu-sizing-guide.md`,
27
- governancePath: `${operations}/governance/project-governance.md`,
28
- } as const;
29
- }
30
-
31
- const DOCS_ROOT = 'docs';
32
- const SIMPLE_TASKS_PATH = `${DOCS_ROOT}/tasks`;
33
- const SIMPLE_ADR_PATH = `${DOCS_ROOT}/architecture-decisions`;
34
- const ARC42_OPERATIONS_PATH = [DOCS_ROOT, 'operations'].join('/');
35
- const ARC42_TASKS_PATH = [ARC42_OPERATIONS_PATH, 'tasks'].join('/');
36
- const ARC42_ADR_PATH = [DOCS_ROOT, '09-architecture-decisions'].join('/');
37
-
38
- export const DOCS_LAYOUT_PRESETS = {
39
- simple: buildDocsLayout(DOCS_ROOT, SIMPLE_TASKS_PATH, SIMPLE_ADR_PATH),
40
- arc42: buildDocsLayout(ARC42_OPERATIONS_PATH, ARC42_TASKS_PATH, ARC42_ADR_PATH),
41
- } as const;
42
-
43
- export type DocsLayoutType = keyof typeof DOCS_LAYOUT_PRESETS;
44
- export type DocsLayoutPreset = (typeof DOCS_LAYOUT_PRESETS)[DocsLayoutType];
45
-
46
- export const DEFAULT_DOCS_LAYOUT: DocsLayoutType = 'simple';
47
-
48
- export function getDocsLayoutPreset(layout: DocsLayoutType): DocsLayoutPreset {
49
- return DOCS_LAYOUT_PRESETS[layout];
50
- }
@@ -1,20 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Duration Constants — Re-export shim (ADR-012, INIT-058 Layer 1, WU-2664).
6
- *
7
- * Moved to `@lumenflow/kernel/primitives/duration-utils`. This shim preserves
8
- * the legacy import path for in-repo consumers until the barrel slim in
9
- * Layer 7.
10
- *
11
- * @module constants/duration-constants
12
- */
13
-
14
- export {
15
- MS_PER_SECOND,
16
- MS_PER_MINUTE,
17
- MS_PER_HOUR,
18
- MS_PER_DAY,
19
- DURATION_MS,
20
- } from '@lumenflow/kernel/primitives/duration-utils';
@@ -1,32 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Gate Configuration Constants
6
- *
7
- * WU-2010: Centralizes magic numbers for gates, including
8
- * pre-commit/local gates AND config-driven gate thresholds.
9
- * Used by gates-pre-commit.ts, gates-local.ts, gates-config.ts,
10
- * and lumenflow-config-schema.ts.
11
- */
12
-
13
- /** Gate execution configuration */
14
- export const GATE_CONFIG = {
15
- /** Maximum execution time per gate step (ms) */
16
- TIMEOUT_MS: 180000,
17
-
18
- /** Maximum file size allowed in commits (bytes) - 5MB */
19
- MAX_FILE_SIZE_BYTES: 5 * 1024 * 1024,
20
-
21
- /** Total number of gates (for progress display) */
22
- TOTAL_GATES: 14,
23
- };
24
-
25
- /** Default minimum code coverage percentage (used by TDD methodology) */
26
- export const DEFAULT_MIN_COVERAGE = 90;
27
-
28
- /** Default maximum allowed ESLint warnings before gate failure */
29
- export const DEFAULT_MAX_ESLINT_WARNINGS = 100;
30
-
31
- /** Default timeout for individual gate commands in gates-config (ms) */
32
- export const DEFAULT_GATE_TIMEOUT_MS = 120_000; // 2 minutes
@@ -1,29 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- // Barrel for pack-local constants. Populated by Layer 2 of INIT-058.
5
- // WU-2677: moved wu-statuses, object-guards, config-contract, gate-constants from @lumenflow/core.
6
- // WU-2674: added wu-ui-constants (leaf supplying EMOJI/STRING_LITERALS to policy/coverage-gate).
7
- // WU-2678: added wu-paths-constants, docs-layout-presets from @lumenflow/core (L4 sandbox cohort deps).
8
- // WU-2679: added wu-git-constants, wu-cli-constants, client-ids, wu-domain-constants, wu-type-helpers
9
- // (L2c finish — eliminates wu-constants barrel as cross-cohort coupling point).
10
- // WU-2680: added wu-validation-constants (L2d single leaf — unblocks lane-inference.ts migration).
11
- // WU-2698: added backlog-patterns, duration-constants, section-headings, wu-id-format
12
- // (L4-prep narrow — pure leaves + rewrites from @lumenflow/core).
13
- export * from './wu-statuses.js';
14
- export * from './object-guards.js';
15
- export * from './config-contract.js';
16
- export * from './gate-constants.js';
17
- export * from './wu-ui-constants.js';
18
- export * from './docs-layout-presets.js';
19
- export * from './wu-paths-constants.js';
20
- export * from './wu-git-constants.js';
21
- export * from './wu-cli-constants.js';
22
- export * from './client-ids.js';
23
- export * from './wu-domain-constants.js';
24
- export * from './wu-type-helpers.js';
25
- export * from './wu-validation-constants.js';
26
- export * from './backlog-patterns.js';
27
- export * from './duration-constants.js';
28
- export * from './section-headings.js';
29
- export * from './wu-id-format.js';
@@ -1,35 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Shared Lock Constants
6
- *
7
- * WU-2010: Consolidated lock-related constants used by both
8
- * merge-lock.ts and cleanup-lock.ts to eliminate duplication.
9
- *
10
- * @module constants/lock-constants
11
- */
12
-
13
- /**
14
- * Default timeout for waiting to acquire a lock (ms).
15
- * After this time, acquisition fails if the lock is held.
16
- */
17
- export const LOCK_TIMEOUT_MS = 30_000; // 30 seconds
18
-
19
- /**
20
- * Time after which a merge lock is considered stale (ms).
21
- * Should be greater than expected merge operation duration.
22
- */
23
- export const MERGE_LOCK_STALE_MS = 60_000; // 60 seconds
24
-
25
- /**
26
- * Time after which a cleanup lock is considered stale (ms).
27
- * Cleanup is slower than merge, so a longer timeout is used.
28
- */
29
- export const CLEANUP_LOCK_STALE_MS = 5 * 60 * 1_000; // 5 minutes
30
-
31
- /**
32
- * Polling interval for lock acquisition retries (ms).
33
- * Used by both merge and cleanup lock loops.
34
- */
35
- export const LOCK_POLL_INTERVAL_MS = 500;
@@ -1,12 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Object Guards — Re-export shim (ADR-012, INIT-058 Layer 2f, WU-2685).
6
- *
7
- * Relocated to `@lumenflow/kernel/primitives/object-guards` because the
8
- * utilities are pack-agnostic type predicates. Shim preserves the legacy
9
- * pack import path for in-repo consumers until Layer 7 barrel slim.
10
- */
11
-
12
- export * from '@lumenflow/kernel/primitives/object-guards';