@lumenflow/cli 5.5.0 → 5.7.14

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 (229) hide show
  1. package/README.md +41 -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/doctor.js +11 -0
  7. package/dist/doctor.js.map +1 -1
  8. package/dist/gate-defaults.js +37 -0
  9. package/dist/gate-defaults.js.map +1 -1
  10. package/dist/gates/monolithic-file-contention-guard.js +167 -0
  11. package/dist/gates/monolithic-file-contention-guard.js.map +1 -0
  12. package/dist/gates/prod-migration-drift.js +207 -0
  13. package/dist/gates/prod-migration-drift.js.map +1 -0
  14. package/dist/gates/test-over-deletion-guard.js +280 -0
  15. package/dist/gates/test-over-deletion-guard.js.map +1 -0
  16. package/dist/gates-runners.js +44 -3
  17. package/dist/gates-runners.js.map +1 -1
  18. package/dist/gates.js +3 -2
  19. package/dist/gates.js.map +1 -1
  20. package/dist/hooks/config-resolver.js +16 -1
  21. package/dist/hooks/config-resolver.js.map +1 -1
  22. package/dist/hooks/dirty-guard.js +43 -2
  23. package/dist/hooks/dirty-guard.js.map +1 -1
  24. package/dist/hooks/git-status-parser.js +22 -8
  25. package/dist/hooks/git-status-parser.js.map +1 -1
  26. package/dist/init-templates.js +241 -0
  27. package/dist/init-templates.js.map +1 -1
  28. package/dist/init.js +122 -16
  29. package/dist/init.js.map +1 -1
  30. package/dist/lumenflow-setup.js +144 -0
  31. package/dist/lumenflow-setup.js.map +1 -0
  32. package/dist/lumenflow-upgrade.js +43 -1
  33. package/dist/lumenflow-upgrade.js.map +1 -1
  34. package/dist/mem-create.js +10 -1
  35. package/dist/mem-create.js.map +1 -1
  36. package/dist/mem-signal.js +21 -4
  37. package/dist/mem-signal.js.map +1 -1
  38. package/dist/orchestrate-initiative.js +28 -3
  39. package/dist/orchestrate-initiative.js.map +1 -1
  40. package/dist/public-manifest.js +17 -7
  41. package/dist/public-manifest.js.map +1 -1
  42. package/dist/release.js +53 -18
  43. package/dist/release.js.map +1 -1
  44. package/dist/wu-done-gates.js +13 -9
  45. package/dist/wu-done-gates.js.map +1 -1
  46. package/dist/wu-done.js +14 -2
  47. package/dist/wu-done.js.map +1 -1
  48. package/dist/wu-edit-operations.js +74 -0
  49. package/dist/wu-edit-operations.js.map +1 -1
  50. package/dist/wu-edit-validators.js +58 -0
  51. package/dist/wu-edit-validators.js.map +1 -1
  52. package/dist/wu-edit.js +106 -4
  53. package/dist/wu-edit.js.map +1 -1
  54. package/dist/wu-prep.js +57 -9
  55. package/dist/wu-prep.js.map +1 -1
  56. package/dist/wu-recover.js +6 -0
  57. package/dist/wu-recover.js.map +1 -1
  58. package/dist/wu-release.js +120 -2
  59. package/dist/wu-release.js.map +1 -1
  60. package/dist/wu-sizing-validation.js +47 -17
  61. package/dist/wu-sizing-validation.js.map +1 -1
  62. package/dist/wu-status.js +33 -0
  63. package/dist/wu-status.js.map +1 -1
  64. package/package.json +13 -12
  65. package/packs/agent-runtime/package.json +1 -1
  66. package/packs/sidekick/package.json +1 -1
  67. package/packs/software-delivery/package.json +1 -1
  68. package/templates/core/AGENTS.md.template +67 -3
  69. package/templates/core/LUMENFLOW.md.template +196 -47
  70. package/dist/distribution-preflight.js +0 -230
  71. package/dist/distribution-preflight.js.map +0 -1
  72. package/packs/agent-runtime/agent-heartbeat.ts +0 -163
  73. package/packs/agent-runtime/auto-session-integration.ts +0 -888
  74. package/packs/agent-runtime/capability-factory.ts +0 -104
  75. package/packs/agent-runtime/constants.ts +0 -21
  76. package/packs/agent-runtime/delegation-registry-schema.ts +0 -220
  77. package/packs/agent-runtime/delegation-registry-store.ts +0 -269
  78. package/packs/agent-runtime/delegation-tree.ts +0 -328
  79. package/packs/agent-runtime/index.ts +0 -20
  80. package/packs/agent-runtime/manifest.ts +0 -348
  81. package/packs/agent-runtime/memory-coordination-contract.ts +0 -86
  82. package/packs/agent-runtime/orchestration.ts +0 -2027
  83. package/packs/agent-runtime/pack-registration.ts +0 -110
  84. package/packs/agent-runtime/policy-factory.ts +0 -165
  85. package/packs/agent-runtime/remote-controls/index.ts +0 -7
  86. package/packs/agent-runtime/remote-controls/operations.ts +0 -405
  87. package/packs/agent-runtime/remote-controls/port.ts +0 -48
  88. package/packs/agent-runtime/remote-controls/state-store.ts +0 -258
  89. package/packs/agent-runtime/remote-controls/types.ts +0 -105
  90. package/packs/agent-runtime/session-schema.ts +0 -467
  91. package/packs/agent-runtime/tool-impl/agent-turn-tools.ts +0 -793
  92. package/packs/agent-runtime/tool-impl/index.ts +0 -6
  93. package/packs/agent-runtime/tool-impl/provider-adapters.ts +0 -1245
  94. package/packs/agent-runtime/tool-impl/remote-controls.mock.ts +0 -256
  95. package/packs/agent-runtime/tool-impl/remote-controls.ts +0 -273
  96. package/packs/agent-runtime/tools/index.ts +0 -4
  97. package/packs/agent-runtime/tools/types.ts +0 -47
  98. package/packs/agent-runtime/turn-lifecycle-events.ts +0 -590
  99. package/packs/agent-runtime/types.ts +0 -128
  100. package/packs/agent-runtime/vitest.config.ts +0 -11
  101. package/packs/sidekick/channel-ingress.ts +0 -137
  102. package/packs/sidekick/constants.ts +0 -10
  103. package/packs/sidekick/index.ts +0 -8
  104. package/packs/sidekick/manifest-schema.ts +0 -49
  105. package/packs/sidekick/manifest.ts +0 -512
  106. package/packs/sidekick/pack-registration.ts +0 -110
  107. package/packs/sidekick/policy-factory.ts +0 -38
  108. package/packs/sidekick/sidekick-events.ts +0 -694
  109. package/packs/sidekick/src/adapters/cloud-queue.ts +0 -101
  110. package/packs/sidekick/src/adapters/control-plane-bridge.adapter.ts +0 -386
  111. package/packs/sidekick/src/adapters/filesystem-bridge.adapter.ts +0 -228
  112. package/packs/sidekick/src/domain/channel.types.ts +0 -64
  113. package/packs/sidekick/src/ports/channel-bridge.port.ts +0 -92
  114. package/packs/sidekick/src/routines/commit.ts +0 -74
  115. package/packs/sidekick/tool-impl/channel-tools.ts +0 -577
  116. package/packs/sidekick/tool-impl/channel-transports.ts +0 -75
  117. package/packs/sidekick/tool-impl/index.ts +0 -29
  118. package/packs/sidekick/tool-impl/memory-tools.ts +0 -290
  119. package/packs/sidekick/tool-impl/routine-commit.ts +0 -102
  120. package/packs/sidekick/tool-impl/routine-tools.ts +0 -440
  121. package/packs/sidekick/tool-impl/runtime-context.ts +0 -28
  122. package/packs/sidekick/tool-impl/shared.ts +0 -125
  123. package/packs/sidekick/tool-impl/storage.ts +0 -325
  124. package/packs/sidekick/tool-impl/system-tools.ts +0 -160
  125. package/packs/sidekick/tool-impl/task-tools.ts +0 -506
  126. package/packs/sidekick/tools/channel-tools.ts +0 -53
  127. package/packs/sidekick/tools/index.ts +0 -9
  128. package/packs/sidekick/tools/memory-tools.ts +0 -53
  129. package/packs/sidekick/tools/routine-tools.ts +0 -53
  130. package/packs/sidekick/tools/system-tools.ts +0 -47
  131. package/packs/sidekick/tools/task-tools.ts +0 -61
  132. package/packs/sidekick/tools/types.ts +0 -57
  133. package/packs/sidekick/vitest.config.ts +0 -11
  134. package/packs/software-delivery/constants.ts +0 -10
  135. package/packs/software-delivery/extensions.ts +0 -140
  136. package/packs/software-delivery/gate-policies.ts +0 -134
  137. package/packs/software-delivery/index.ts +0 -8
  138. package/packs/software-delivery/manifest-schema.ts +0 -268
  139. package/packs/software-delivery/manifest.ts +0 -657
  140. package/packs/software-delivery/pack-registration.ts +0 -113
  141. package/packs/software-delivery/src/commands/index.ts +0 -5
  142. package/packs/software-delivery/src/config/delivery-review-contract.ts +0 -256
  143. package/packs/software-delivery/src/config/env-accessors.ts +0 -66
  144. package/packs/software-delivery/src/config/index.ts +0 -8
  145. package/packs/software-delivery/src/config/normalize-config-keys.ts +0 -9
  146. package/packs/software-delivery/src/config/schemas/lumenflow-config-schema-types.ts +0 -460
  147. package/packs/software-delivery/src/config/workspace-reader.ts +0 -375
  148. package/packs/software-delivery/src/constants/backlog-patterns.ts +0 -31
  149. package/packs/software-delivery/src/constants/client-ids.ts +0 -19
  150. package/packs/software-delivery/src/constants/config-contract.ts +0 -7
  151. package/packs/software-delivery/src/constants/docs-layout-presets.ts +0 -50
  152. package/packs/software-delivery/src/constants/duration-constants.ts +0 -20
  153. package/packs/software-delivery/src/constants/gate-constants.ts +0 -32
  154. package/packs/software-delivery/src/constants/index.ts +0 -29
  155. package/packs/software-delivery/src/constants/lock-constants.ts +0 -35
  156. package/packs/software-delivery/src/constants/object-guards.ts +0 -12
  157. package/packs/software-delivery/src/constants/section-headings.ts +0 -107
  158. package/packs/software-delivery/src/constants/wu-cli-constants.ts +0 -500
  159. package/packs/software-delivery/src/constants/wu-domain-constants.ts +0 -466
  160. package/packs/software-delivery/src/constants/wu-git-constants.ts +0 -7
  161. package/packs/software-delivery/src/constants/wu-id-format.ts +0 -327
  162. package/packs/software-delivery/src/constants/wu-paths-constants.ts +0 -384
  163. package/packs/software-delivery/src/constants/wu-statuses.ts +0 -287
  164. package/packs/software-delivery/src/constants/wu-type-helpers.ts +0 -67
  165. package/packs/software-delivery/src/constants/wu-ui-constants.ts +0 -267
  166. package/packs/software-delivery/src/constants/wu-validation-constants.ts +0 -73
  167. package/packs/software-delivery/src/domain/index.ts +0 -5
  168. package/packs/software-delivery/src/domain/orchestration.constants.ts +0 -166
  169. package/packs/software-delivery/src/domain/orchestration.schemas.ts +0 -238
  170. package/packs/software-delivery/src/domain/orchestration.types.ts +0 -176
  171. package/packs/software-delivery/src/methodology/incremental-test.ts +0 -122
  172. package/packs/software-delivery/src/methodology/index.ts +0 -6
  173. package/packs/software-delivery/src/methodology/manual-test-validator.ts +0 -292
  174. package/packs/software-delivery/src/policy/coverage-gate.ts +0 -270
  175. package/packs/software-delivery/src/policy/gates-agent-mode.ts +0 -223
  176. package/packs/software-delivery/src/policy/gates-config-internal.ts +0 -121
  177. package/packs/software-delivery/src/policy/gates-config.ts +0 -300
  178. package/packs/software-delivery/src/policy/gates-coverage.ts +0 -356
  179. package/packs/software-delivery/src/policy/gates-presets.ts +0 -134
  180. package/packs/software-delivery/src/policy/gates-schemas.ts +0 -173
  181. package/packs/software-delivery/src/policy/index.ts +0 -22
  182. package/packs/software-delivery/src/policy/package-manager-resolver.ts +0 -319
  183. package/packs/software-delivery/src/policy/resolve-policy.ts +0 -601
  184. package/packs/software-delivery/src/ports/config.ports.ts +0 -90
  185. package/packs/software-delivery/src/ports/dashboard-renderer.port.ts +0 -125
  186. package/packs/software-delivery/src/ports/index.ts +0 -10
  187. package/packs/software-delivery/src/ports/sync-validator.ports.ts +0 -59
  188. package/packs/software-delivery/src/ports/wu-helpers.ports.ts +0 -168
  189. package/packs/software-delivery/src/ports/wu-state.ports.ts +0 -241
  190. package/packs/software-delivery/src/primitives/index.ts +0 -5
  191. package/packs/software-delivery/src/runtime/index.ts +0 -6
  192. package/packs/software-delivery/src/runtime/work-classifier.ts +0 -561
  193. package/packs/software-delivery/src/sandbox/index.ts +0 -10
  194. package/packs/software-delivery/src/sandbox/sandbox-allowlist.ts +0 -118
  195. package/packs/software-delivery/src/sandbox/sandbox-backend-linux.ts +0 -88
  196. package/packs/software-delivery/src/sandbox/sandbox-backend-macos.ts +0 -154
  197. package/packs/software-delivery/src/sandbox/sandbox-backend-windows.ts +0 -47
  198. package/packs/software-delivery/src/sandbox/sandbox-profile.ts +0 -153
  199. package/packs/software-delivery/src/schemas/index.ts +0 -5
  200. package/packs/software-delivery/src/state/date-utils.ts +0 -158
  201. package/packs/software-delivery/src/state/index.ts +0 -15
  202. package/packs/software-delivery/src/state/state-machine.ts +0 -119
  203. package/packs/software-delivery/src/state/wu-doc-types.ts +0 -51
  204. package/packs/software-delivery/src/state/wu-paths.ts +0 -381
  205. package/packs/software-delivery/src/state/wu-schema.ts +0 -1139
  206. package/packs/software-delivery/src/state/wu-state-schema.ts +0 -255
  207. package/packs/software-delivery/src/state/wu-yaml.ts +0 -338
  208. package/packs/software-delivery/tool-impl/agent-tools.ts +0 -263
  209. package/packs/software-delivery/tool-impl/delegation-tools.ts +0 -66
  210. package/packs/software-delivery/tool-impl/flow-metrics-tools.ts +0 -219
  211. package/packs/software-delivery/tool-impl/git-runner.ts +0 -113
  212. package/packs/software-delivery/tool-impl/git-tools.ts +0 -316
  213. package/packs/software-delivery/tool-impl/index.ts +0 -15
  214. package/packs/software-delivery/tool-impl/initiative-orchestration-tools.ts +0 -720
  215. package/packs/software-delivery/tool-impl/lane-lock.ts +0 -246
  216. package/packs/software-delivery/tool-impl/memory-tools.ts +0 -470
  217. package/packs/software-delivery/tool-impl/pending-runtime-tools.ts +0 -21
  218. package/packs/software-delivery/tool-impl/runtime-cli-adapter.ts +0 -329
  219. package/packs/software-delivery/tool-impl/runtime-native-tools.ts +0 -687
  220. package/packs/software-delivery/tool-impl/worker-loader.ts +0 -52
  221. package/packs/software-delivery/tool-impl/worktree-tools.ts +0 -46
  222. package/packs/software-delivery/tool-impl/wu-lifecycle-tools.ts +0 -807
  223. package/packs/software-delivery/tools/delegation-tools.ts +0 -23
  224. package/packs/software-delivery/tools/git-tools.ts +0 -55
  225. package/packs/software-delivery/tools/index.ts +0 -8
  226. package/packs/software-delivery/tools/lane-lock-tool.ts +0 -37
  227. package/packs/software-delivery/tools/types.ts +0 -71
  228. package/packs/software-delivery/tools/worktree-tools.ts +0 -49
  229. package/packs/software-delivery/vitest.config.ts +0 -11
@@ -1,88 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- import { spawnSync } from 'node:child_process';
5
- import {
6
- SANDBOX_BACKEND_IDS,
7
- type SandboxBackend,
8
- type SandboxExecutionPlan,
9
- type SandboxExecutionRequest,
10
- } from './sandbox-profile.js';
11
-
12
- export interface LinuxSandboxBackendOptions {
13
- commandExists?: (binary: string) => boolean;
14
- }
15
-
16
- const LINUX_SANDBOX_BINARY = 'bwrap';
17
-
18
- function defaultCommandExists(binary: string): boolean {
19
- const probe = spawnSync(binary, ['--help'], { stdio: 'ignore' });
20
- return !probe.error;
21
- }
22
-
23
- function buildUnavailablePlan(request: SandboxExecutionRequest): SandboxExecutionPlan {
24
- if (request.allowUnsandboxedFallback) {
25
- return {
26
- backendId: SANDBOX_BACKEND_IDS.LINUX,
27
- enforced: false,
28
- failClosed: false,
29
- warning:
30
- 'Running unsandboxed because bwrap is unavailable and fallback was explicitly enabled.',
31
- };
32
- }
33
-
34
- return {
35
- backendId: SANDBOX_BACKEND_IDS.LINUX,
36
- enforced: false,
37
- failClosed: true,
38
- reason: 'Linux sandbox backend unavailable: required binary "bwrap" was not found.',
39
- };
40
- }
41
-
42
- function buildInvocation(request: SandboxExecutionRequest) {
43
- const writableBinds = request.profile.allowlist.writableRoots.flatMap((entry) => [
44
- '--bind',
45
- entry.normalizedPath,
46
- entry.normalizedPath,
47
- ]);
48
-
49
- return {
50
- command: LINUX_SANDBOX_BINARY,
51
- args: [
52
- '--die-with-parent',
53
- '--new-session',
54
- '--ro-bind',
55
- '/',
56
- '/',
57
- ...writableBinds,
58
- '--proc',
59
- '/proc',
60
- '--dev',
61
- '/dev',
62
- '--',
63
- ...request.command,
64
- ],
65
- };
66
- }
67
-
68
- export function createLinuxSandboxBackend(
69
- options: LinuxSandboxBackendOptions = {},
70
- ): SandboxBackend {
71
- const commandExists = options.commandExists || defaultCommandExists;
72
-
73
- return {
74
- id: SANDBOX_BACKEND_IDS.LINUX,
75
- resolveExecution(request: SandboxExecutionRequest): SandboxExecutionPlan {
76
- if (!commandExists(LINUX_SANDBOX_BINARY)) {
77
- return buildUnavailablePlan(request);
78
- }
79
-
80
- return {
81
- backendId: SANDBOX_BACKEND_IDS.LINUX,
82
- enforced: true,
83
- failClosed: false,
84
- invocation: buildInvocation(request),
85
- };
86
- },
87
- };
88
- }
@@ -1,154 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- import { spawnSync } from 'node:child_process';
5
- import os from 'node:os';
6
- import {
7
- SANDBOX_BACKEND_IDS,
8
- type SandboxBackend,
9
- type SandboxExecutionPlan,
10
- type SandboxExecutionRequest,
11
- } from './sandbox-profile.js';
12
-
13
- export interface MacosSandboxBackendOptions {
14
- commandExists?: (binary: string) => boolean;
15
- }
16
-
17
- const MACOS_SANDBOX_BINARY = 'sandbox-exec';
18
-
19
- function defaultCommandExists(binary: string): boolean {
20
- const probe = spawnSync(binary, ['-h'], { stdio: 'ignore' });
21
- return !probe.error;
22
- }
23
-
24
- function escapePolicyPath(targetPath: string): string {
25
- return targetPath.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
26
- }
27
-
28
- function buildNetworkRules(profile: SandboxExecutionRequest['profile']): string[] {
29
- const posture = profile.networkPosture ?? 'full';
30
-
31
- if (posture === 'off') {
32
- return ['(deny network*)'];
33
- }
34
-
35
- if (posture === 'allowlist') {
36
- const rules: string[] = ['(deny network*)'];
37
- for (const host of profile.networkAllowlist) {
38
- rules.push(`(allow network-outbound (remote ip "${host}"))`);
39
- }
40
- return rules;
41
- }
42
-
43
- // posture === 'full'
44
- return ['(allow network*)'];
45
- }
46
-
47
- /** macOS system paths required for process execution (parity with bwrap --ro-bind /) */
48
- const MACOS_SYSTEM_READ_PATHS = [
49
- '/usr',
50
- '/System',
51
- '/Library',
52
- '/bin',
53
- '/sbin',
54
- '/private',
55
- '/dev',
56
- '/tmp',
57
- ];
58
-
59
- /** Sensitive paths denied from read access (parity with bwrap deny overlays) */
60
- const SENSITIVE_DENY_PATHS = ['.ssh', '.aws', '.gnupg'];
61
-
62
- function buildReadRules(profile: SandboxExecutionRequest['profile']): string[] {
63
- const readPaths = new Set<string>();
64
-
65
- // Workspace root (covers worktree, state, WU YAML)
66
- readPaths.add(profile.projectRoot);
67
-
68
- // System paths required for process execution
69
- for (const systemPath of MACOS_SYSTEM_READ_PATHS) {
70
- readPaths.add(systemPath);
71
- }
72
-
73
- // Temp path from profile
74
- readPaths.add(profile.tempPath);
75
-
76
- return [...readPaths].map(
77
- (readPath) => `(allow file-read* (subpath "${escapePolicyPath(readPath)}"))`,
78
- );
79
- }
80
-
81
- function buildDenyOverlays(): string[] {
82
- const homeDir = os.homedir();
83
- return SENSITIVE_DENY_PATHS.map(
84
- (sensitivePath) =>
85
- `(deny file-read* (subpath "${escapePolicyPath(homeDir)}/${sensitivePath}"))`,
86
- );
87
- }
88
-
89
- function buildPolicy(profile: SandboxExecutionRequest['profile']): string {
90
- const writableRules = profile.allowlist.writableRoots.map(
91
- (entry) => `(allow file-write* (subpath "${escapePolicyPath(entry.normalizedPath)}"))`,
92
- );
93
-
94
- return [
95
- '(version 1)',
96
- '(deny default)',
97
- '(allow process*)',
98
- ...buildReadRules(profile),
99
- ...buildDenyOverlays(),
100
- '(allow sysctl-read)',
101
- '(allow mach-lookup)',
102
- ...buildNetworkRules(profile),
103
- '(allow signal)',
104
- ...writableRules,
105
- ].join(' ');
106
- }
107
-
108
- function buildUnavailablePlan(request: SandboxExecutionRequest): SandboxExecutionPlan {
109
- if (request.allowUnsandboxedFallback) {
110
- return {
111
- backendId: SANDBOX_BACKEND_IDS.MACOS,
112
- enforced: false,
113
- failClosed: false,
114
- warning:
115
- 'Running unsandboxed because sandbox-exec is unavailable and fallback was explicitly enabled.',
116
- };
117
- }
118
-
119
- return {
120
- backendId: SANDBOX_BACKEND_IDS.MACOS,
121
- enforced: false,
122
- failClosed: true,
123
- reason: 'macOS sandbox backend unavailable: required binary "sandbox-exec" was not found.',
124
- };
125
- }
126
-
127
- function buildInvocation(request: SandboxExecutionRequest) {
128
- return {
129
- command: MACOS_SANDBOX_BINARY,
130
- args: ['-p', buildPolicy(request.profile), ...request.command],
131
- };
132
- }
133
-
134
- export function createMacosSandboxBackend(
135
- options: MacosSandboxBackendOptions = {},
136
- ): SandboxBackend {
137
- const commandExists = options.commandExists || defaultCommandExists;
138
-
139
- return {
140
- id: SANDBOX_BACKEND_IDS.MACOS,
141
- resolveExecution(request: SandboxExecutionRequest): SandboxExecutionPlan {
142
- if (!commandExists(MACOS_SANDBOX_BINARY)) {
143
- return buildUnavailablePlan(request);
144
- }
145
-
146
- return {
147
- backendId: SANDBOX_BACKEND_IDS.MACOS,
148
- enforced: true,
149
- failClosed: false,
150
- invocation: buildInvocation(request),
151
- };
152
- },
153
- };
154
- }
@@ -1,47 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- import {
5
- SANDBOX_BACKEND_IDS,
6
- type SandboxBackend,
7
- type SandboxExecutionPlan,
8
- type SandboxExecutionRequest,
9
- } from './sandbox-profile.js';
10
-
11
- export interface WindowsSandboxBackendOptions {
12
- commandExists?: (binary: string) => boolean;
13
- }
14
-
15
- const WINDOWS_ENFORCEMENT_UNAVAILABLE_REASON =
16
- 'Windows sandbox backend unavailable: write enforcement is not yet available on Windows.';
17
- const WINDOWS_ENFORCEMENT_UNAVAILABLE_WARNING =
18
- 'Running unsandboxed because write enforcement is not yet available on Windows and fallback was explicitly enabled.';
19
-
20
- function buildNotImplementedPlan(request: SandboxExecutionRequest): SandboxExecutionPlan {
21
- if (request.allowUnsandboxedFallback) {
22
- return {
23
- backendId: SANDBOX_BACKEND_IDS.WINDOWS,
24
- enforced: false,
25
- failClosed: false,
26
- warning: WINDOWS_ENFORCEMENT_UNAVAILABLE_WARNING,
27
- };
28
- }
29
-
30
- return {
31
- backendId: SANDBOX_BACKEND_IDS.WINDOWS,
32
- enforced: false,
33
- failClosed: true,
34
- reason: WINDOWS_ENFORCEMENT_UNAVAILABLE_REASON,
35
- };
36
- }
37
-
38
- export function createWindowsSandboxBackend(
39
- _options: WindowsSandboxBackendOptions = {},
40
- ): SandboxBackend {
41
- return {
42
- id: SANDBOX_BACKEND_IDS.WINDOWS,
43
- resolveExecution(request: SandboxExecutionRequest): SandboxExecutionPlan {
44
- return buildNotImplementedPlan(request);
45
- },
46
- };
47
- }
@@ -1,153 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- import os from 'node:os';
5
- import path from 'node:path';
6
- import {
7
- buildSandboxAllowlist,
8
- type SandboxAllowlist,
9
- type BuildSandboxAllowlistInput,
10
- } from './sandbox-allowlist.js';
11
- import { LUMENFLOW_PATHS } from '../constants/wu-paths-constants.js';
12
- import { createWuPaths } from '../state/wu-paths.js';
13
-
14
- export const SANDBOX_BACKEND_IDS = {
15
- LINUX: 'linux',
16
- MACOS: 'macos',
17
- WINDOWS: 'windows',
18
- UNSUPPORTED: 'unsupported',
19
- } as const;
20
-
21
- export type SandboxBackendId = (typeof SANDBOX_BACKEND_IDS)[keyof typeof SANDBOX_BACKEND_IDS];
22
-
23
- export type SandboxNetworkPosture = 'off' | 'allowlist' | 'full';
24
-
25
- export interface SandboxProfile {
26
- projectRoot: string;
27
- worktreePath: string;
28
- wuId: string;
29
- wuYamlPath: string;
30
- statePath: string;
31
- tempPath: string;
32
- allowlist: SandboxAllowlist;
33
- networkPosture: SandboxNetworkPosture;
34
- networkAllowlist: string[];
35
- }
36
-
37
- export interface BuildSandboxProfileInput {
38
- projectRoot: string;
39
- worktreePath: string;
40
- wuId: string;
41
- tempPath?: string;
42
- extraWritableRoots?: string[];
43
- networkPosture?: SandboxNetworkPosture;
44
- networkAllowlist?: string[];
45
- }
46
-
47
- export interface SandboxBackendResolution {
48
- id: SandboxBackendId;
49
- platform: NodeJS.Platform | string;
50
- supported: boolean;
51
- }
52
-
53
- export interface SandboxInvocation {
54
- command: string;
55
- args: string[];
56
- }
57
-
58
- export interface SandboxExecutionRequest {
59
- profile: SandboxProfile;
60
- command: string[];
61
- allowUnsandboxedFallback: boolean;
62
- }
63
-
64
- export interface SandboxExecutionPlan {
65
- backendId: SandboxBackendId;
66
- enforced: boolean;
67
- failClosed: boolean;
68
- invocation?: SandboxInvocation;
69
- reason?: string;
70
- warning?: string;
71
- }
72
-
73
- export interface SandboxBackend {
74
- id: SandboxBackendId;
75
- resolveExecution: (request: SandboxExecutionRequest) => SandboxExecutionPlan;
76
- }
77
-
78
- function resolveWorktreePath(projectRoot: string, worktreePath: string): string {
79
- if (path.isAbsolute(worktreePath)) {
80
- return path.resolve(worktreePath);
81
- }
82
-
83
- return path.resolve(projectRoot, worktreePath);
84
- }
85
-
86
- function buildDefaultWritableRoots(profile: {
87
- worktreePath: string;
88
- statePath: string;
89
- wuYamlPath: string;
90
- tempPath: string;
91
- }): string[] {
92
- return [profile.worktreePath, profile.statePath, profile.wuYamlPath, profile.tempPath];
93
- }
94
-
95
- export function buildSandboxProfile(input: BuildSandboxProfileInput): SandboxProfile {
96
- const projectRoot = path.resolve(input.projectRoot);
97
- const worktreePath = resolveWorktreePath(projectRoot, input.worktreePath);
98
- const wuYamlPath = path.resolve(projectRoot, createWuPaths({ projectRoot }).WU(input.wuId));
99
- const statePath = path.resolve(projectRoot, LUMENFLOW_PATHS.STATE_DIR);
100
- const tempPath = path.resolve(input.tempPath || os.tmpdir());
101
-
102
- const writableRoots = buildDefaultWritableRoots({
103
- worktreePath,
104
- statePath,
105
- wuYamlPath,
106
- tempPath,
107
- });
108
-
109
- if (input.extraWritableRoots && input.extraWritableRoots.length > 0) {
110
- writableRoots.push(...input.extraWritableRoots);
111
- }
112
-
113
- const allowlistInput: BuildSandboxAllowlistInput = {
114
- projectRoot,
115
- writableRoots,
116
- };
117
-
118
- const allowlist = buildSandboxAllowlist(allowlistInput);
119
-
120
- const networkPosture: SandboxNetworkPosture = input.networkPosture ?? 'full';
121
- const networkAllowlist: string[] =
122
- networkPosture === 'allowlist' && input.networkAllowlist ? [...input.networkAllowlist] : [];
123
-
124
- return {
125
- projectRoot,
126
- worktreePath,
127
- wuId: input.wuId,
128
- wuYamlPath,
129
- statePath,
130
- tempPath,
131
- allowlist,
132
- networkPosture,
133
- networkAllowlist,
134
- };
135
- }
136
-
137
- export function resolveSandboxBackendForPlatform(
138
- platform: NodeJS.Platform | string = process.platform,
139
- ): SandboxBackendResolution {
140
- if (platform === 'linux') {
141
- return { id: SANDBOX_BACKEND_IDS.LINUX, platform, supported: true };
142
- }
143
-
144
- if (platform === 'darwin') {
145
- return { id: SANDBOX_BACKEND_IDS.MACOS, platform, supported: true };
146
- }
147
-
148
- if (platform === 'win32') {
149
- return { id: SANDBOX_BACKEND_IDS.WINDOWS, platform, supported: true };
150
- }
151
-
152
- return { id: SANDBOX_BACKEND_IDS.UNSUPPORTED, platform, supported: false };
153
- }
@@ -1,5 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- // Barrel for pack-static-data schemas. Populated by Layer 2 of INIT-058.
5
- export {};
@@ -1,158 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * @file date-utils.ts
6
- * @description Date formatting utilities using date-fns library
7
- * WU-1082: Extract shared utilities (eliminate date formatting duplication)
8
- *
9
- * Replaces manual date formatting in:
10
- * - tools/wu-block.ts (todayISO)
11
- * - tools/wu-unblock.ts (todayISO)
12
- * - tools/wu-done.ts (todayISO - already uses date-fns)
13
- */
14
-
15
- import { format } from 'date-fns';
16
-
17
- /**
18
- * Get current date in ISO format (YYYY-MM-DD)
19
- * @returns {string} Current date in YYYY-MM-DD format
20
- * @example
21
- * todayISO(); // "2025-11-12"
22
- */
23
- export function todayISO() {
24
- return format(new Date(), 'yyyy-MM-dd');
25
- }
26
-
27
- /**
28
- * Format a date with a custom format string
29
- * @param {Date|string|number} date - Date to format
30
- * @param {string} formatString - date-fns format string
31
- * @returns {string} Formatted date string
32
- * @example
33
- * formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss');
34
- * formatDate('2025-11-12', 'MMMM d, yyyy'); // "November 12, 2025"
35
- */
36
- export function formatDate(date: Date | string | number, formatString: string) {
37
- return format(new Date(date), formatString);
38
- }
39
-
40
- /**
41
- * Date format constant for YYYY-MM-DD
42
- * @constant {string}
43
- */
44
- const DATE_FORMAT_ISO = 'yyyy-MM-dd';
45
-
46
- /**
47
- * Normalize a Date object or ISO timestamp string to YYYY-MM-DD format
48
- *
49
- * WU-1442: Fix date corruption when js-yaml parses YYYY-MM-DD as Date objects
50
- * Library-First: Uses date-fns for date formatting (no manual parsing)
51
- *
52
- * Use case: js-yaml parses `created: 2025-12-04` (unquoted) as a Date object.
53
- * When yaml.dump() serializes it back, it outputs `2025-12-04T00:00:00.000Z`.
54
- * This function normalizes Date objects back to YYYY-MM-DD string format.
55
- *
56
- * Handles:
57
- * - Date objects → YYYY-MM-DD string
58
- * - ISO timestamp strings → YYYY-MM-DD string (date portion)
59
- * - YYYY-MM-DD strings → preserved as-is
60
- * - undefined/null → preserved as undefined
61
- *
62
- * @param {Date|string|undefined|null} value - Date value to normalize
63
- * @returns {string|undefined} Date in YYYY-MM-DD format or undefined
64
- *
65
- * @example
66
- * normalizeToDateString(new Date('2025-12-04')); // '2025-12-04'
67
- * normalizeToDateString('2025-12-04T00:00:00.000Z'); // '2025-12-04'
68
- * normalizeToDateString('2025-12-04'); // '2025-12-04'
69
- * normalizeToDateString(undefined); // undefined
70
- */
71
- export function normalizeToDateString(value: unknown) {
72
- // Preserve undefined/null
73
- if (value == null) {
74
- return undefined;
75
- }
76
-
77
- // If already a YYYY-MM-DD string, return as-is
78
- if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(value)) {
79
- return value;
80
- }
81
-
82
- // Convert Date objects or timestamp strings to YYYY-MM-DD
83
- if (value instanceof Date) {
84
- return format(value, DATE_FORMAT_ISO);
85
- }
86
-
87
- // Handle ISO timestamp strings (e.g., '2025-12-04T00:00:00.000Z')
88
- if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}T/.test(value)) {
89
- return format(new Date(value), DATE_FORMAT_ISO);
90
- }
91
-
92
- // Fallback: try to parse and format (coerce to string for Date constructor)
93
- try {
94
- const date = new Date(String(value));
95
- if (!isNaN(date.getTime())) {
96
- return format(date, DATE_FORMAT_ISO);
97
- }
98
- } catch {
99
- // Invalid date - return undefined
100
- }
101
-
102
- return undefined;
103
- }
104
-
105
- /**
106
- * Normalize various date formats to ISO 8601 datetime (YYYY-MM-DDTHH:mm:ss.sssZ)
107
- *
108
- * WU-1337: Auto-repair date fields in WU YAML to consistent format
109
- * Library-First: Uses date-fns for date handling (no manual parsing)
110
- *
111
- * Handles:
112
- * - ISO date strings (YYYY-MM-DD) → midnight UTC
113
- * - ISO datetime strings (already valid) → preserved
114
- * - Unix timestamps (milliseconds) → converted
115
- * - undefined/null → preserved as undefined
116
- *
117
- * @param {string|number|undefined|null} value - Date value to normalize
118
- * @returns {string|undefined} ISO datetime string or undefined
119
- *
120
- * @example
121
- * normalizeISODateTime('2025-11-29'); // '2025-11-29T00:00:00.000Z'
122
- * normalizeISODateTime('2025-11-29T14:30:00.000Z'); // '2025-11-29T14:30:00.000Z'
123
- * normalizeISODateTime(1732896000000); // '2024-11-29T16:00:00.000Z'
124
- * normalizeISODateTime(undefined); // undefined
125
- */
126
- export function normalizeISODateTime(value: string | number | null | undefined) {
127
- // Preserve undefined/null (optional fields)
128
- if (value == null) {
129
- return undefined;
130
- }
131
-
132
- // If already a valid ISO datetime format, preserve it
133
- // Pattern: YYYY-MM-DDTHH:mm:ss.sssZ
134
- if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(value)) {
135
- return value;
136
- }
137
-
138
- // Handle Unix timestamps as strings (convert to number first)
139
- let dateInput = value;
140
- if (typeof value === 'string' && /^\d+$/.test(value)) {
141
- // Numeric string - treat as Unix timestamp in milliseconds
142
- dateInput = Number(value);
143
- }
144
-
145
- // Parse and convert to ISO datetime
146
- // date-fns/Date handles: ISO dates, ISO datetimes, Unix timestamps
147
- const date = new Date(dateInput);
148
-
149
- // Check for invalid date
150
- if (isNaN(date.getTime())) {
151
- // Fallback: return undefined for unparseable dates
152
- // Zod schema will catch invalid dates separately
153
- return undefined;
154
- }
155
-
156
- // Convert to ISO 8601 datetime format
157
- return date.toISOString();
158
- }
@@ -1,15 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- // Barrel for pack-local WU state modules. Populated by Layer 4 of INIT-058.
5
- // WU-2687 (narrowed): moved wu-state-schema, wu-doc-types from @lumenflow/core.
6
- // WU-2689 (L4 cascade): moved wu-paths, wu-yaml, wu-schema, date-utils from @lumenflow/core
7
- // after WU-2690 added getDirectories/getStatePaths to the pack workspace-reader.
8
- export * from './wu-state-schema.js';
9
- export * from './wu-doc-types.js';
10
- export * from './date-utils.js';
11
- export * from './wu-paths.js';
12
- export * from './wu-schema.js';
13
- export * from './wu-yaml.js';
14
- // WU-2699 (L4): moved state-machine (SDLC residue) from @lumenflow/core.
15
- export * from './state-machine.js';