@lumenflow/packs-software-delivery 4.24.0 → 5.0.1

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 (286) hide show
  1. package/dist/manifest-schema.d.ts +12 -0
  2. package/dist/manifest-schema.d.ts.map +1 -1
  3. package/dist/manifest-schema.js +10 -0
  4. package/dist/manifest-schema.js.map +1 -1
  5. package/dist/manifest.d.ts +21 -0
  6. package/dist/manifest.d.ts.map +1 -1
  7. package/dist/manifest.js +92 -1
  8. package/dist/manifest.js.map +1 -1
  9. package/dist/src/commands/index.d.ts +2 -0
  10. package/dist/src/commands/index.d.ts.map +1 -0
  11. package/dist/src/commands/index.js +5 -0
  12. package/dist/src/commands/index.js.map +1 -0
  13. package/dist/src/config/delivery-review-contract.d.ts +17 -0
  14. package/dist/src/config/delivery-review-contract.d.ts.map +1 -0
  15. package/dist/src/config/delivery-review-contract.js +19 -0
  16. package/dist/src/config/delivery-review-contract.js.map +1 -0
  17. package/dist/src/config/env-accessors.d.ts +16 -0
  18. package/dist/src/config/env-accessors.d.ts.map +1 -0
  19. package/dist/src/config/env-accessors.js +18 -0
  20. package/dist/src/config/env-accessors.js.map +1 -0
  21. package/dist/src/config/index.d.ts +3 -0
  22. package/dist/src/config/index.d.ts.map +1 -0
  23. package/dist/src/config/index.js +8 -0
  24. package/dist/src/config/index.js.map +1 -0
  25. package/dist/src/config/normalize-config-keys.d.ts +16 -0
  26. package/dist/src/config/normalize-config-keys.d.ts.map +1 -0
  27. package/dist/src/config/normalize-config-keys.js +18 -0
  28. package/dist/src/config/normalize-config-keys.js.map +1 -0
  29. package/dist/src/config/schemas/lumenflow-config-schema-types.d.ts +190 -0
  30. package/dist/src/config/schemas/lumenflow-config-schema-types.d.ts.map +1 -0
  31. package/dist/src/config/schemas/lumenflow-config-schema-types.js +182 -0
  32. package/dist/src/config/schemas/lumenflow-config-schema-types.js.map +1 -0
  33. package/dist/src/config/schemas/lumenflow-config-schema.d.ts +190 -0
  34. package/dist/src/config/schemas/lumenflow-config-schema.d.ts.map +1 -0
  35. package/dist/src/config/schemas/lumenflow-config-schema.js +182 -0
  36. package/dist/src/config/schemas/lumenflow-config-schema.js.map +1 -0
  37. package/dist/src/config/workspace-reader.d.ts +56 -0
  38. package/dist/src/config/workspace-reader.d.ts.map +1 -0
  39. package/dist/src/config/workspace-reader.js +209 -0
  40. package/dist/src/config/workspace-reader.js.map +1 -0
  41. package/dist/src/constants/backlog-patterns.d.ts +21 -0
  42. package/dist/src/constants/backlog-patterns.d.ts.map +1 -0
  43. package/dist/src/constants/backlog-patterns.js +26 -0
  44. package/dist/src/constants/backlog-patterns.js.map +1 -0
  45. package/dist/src/constants/client-ids.d.ts +16 -0
  46. package/dist/src/constants/client-ids.d.ts.map +1 -0
  47. package/dist/src/constants/client-ids.js +16 -0
  48. package/dist/src/constants/client-ids.js.map +1 -0
  49. package/dist/src/constants/config-contract.d.ts +2 -0
  50. package/dist/src/constants/config-contract.d.ts.map +1 -0
  51. package/dist/src/constants/config-contract.js +7 -0
  52. package/dist/src/constants/config-contract.js.map +1 -0
  53. package/dist/src/constants/docs-layout-presets.d.ts +31 -0
  54. package/dist/src/constants/docs-layout-presets.d.ts.map +1 -0
  55. package/dist/src/constants/docs-layout-presets.js +41 -0
  56. package/dist/src/constants/docs-layout-presets.js.map +1 -0
  57. package/dist/src/constants/duration-constants.d.ts +11 -0
  58. package/dist/src/constants/duration-constants.d.ts.map +1 -0
  59. package/dist/src/constants/duration-constants.js +13 -0
  60. package/dist/src/constants/duration-constants.js.map +1 -0
  61. package/dist/src/constants/gate-constants.d.ts +24 -0
  62. package/dist/src/constants/gate-constants.d.ts.map +1 -0
  63. package/dist/src/constants/gate-constants.js +26 -0
  64. package/dist/src/constants/gate-constants.js.map +1 -0
  65. package/dist/src/constants/index.d.ts +18 -0
  66. package/dist/src/constants/index.d.ts.map +1 -0
  67. package/dist/src/constants/index.js +29 -0
  68. package/dist/src/constants/index.js.map +1 -0
  69. package/dist/src/constants/lock-constants.d.ts +29 -0
  70. package/dist/src/constants/lock-constants.d.ts.map +1 -0
  71. package/dist/src/constants/lock-constants.js +31 -0
  72. package/dist/src/constants/lock-constants.js.map +1 -0
  73. package/dist/src/constants/object-guards.d.ts +9 -0
  74. package/dist/src/constants/object-guards.d.ts.map +1 -0
  75. package/dist/src/constants/object-guards.js +11 -0
  76. package/dist/src/constants/object-guards.js.map +1 -0
  77. package/dist/src/constants/section-headings.d.ts +35 -0
  78. package/dist/src/constants/section-headings.d.ts.map +1 -0
  79. package/dist/src/constants/section-headings.js +82 -0
  80. package/dist/src/constants/section-headings.js.map +1 -0
  81. package/dist/src/constants/wu-cli-constants.d.ts +434 -0
  82. package/dist/src/constants/wu-cli-constants.d.ts.map +1 -0
  83. package/dist/src/constants/wu-cli-constants.js +439 -0
  84. package/dist/src/constants/wu-cli-constants.js.map +1 -0
  85. package/dist/src/constants/wu-domain-constants.d.ts +296 -0
  86. package/dist/src/constants/wu-domain-constants.d.ts.map +1 -0
  87. package/dist/src/constants/wu-domain-constants.js +400 -0
  88. package/dist/src/constants/wu-domain-constants.js.map +1 -0
  89. package/dist/src/constants/wu-git-constants.d.ts +2 -0
  90. package/dist/src/constants/wu-git-constants.d.ts.map +1 -0
  91. package/dist/src/constants/wu-git-constants.js +7 -0
  92. package/dist/src/constants/wu-git-constants.js.map +1 -0
  93. package/dist/src/constants/wu-id-format.d.ts +138 -0
  94. package/dist/src/constants/wu-id-format.d.ts.map +1 -0
  95. package/dist/src/constants/wu-id-format.js +265 -0
  96. package/dist/src/constants/wu-id-format.js.map +1 -0
  97. package/dist/src/constants/wu-paths-constants.d.ts +254 -0
  98. package/dist/src/constants/wu-paths-constants.d.ts.map +1 -0
  99. package/dist/src/constants/wu-paths-constants.js +276 -0
  100. package/dist/src/constants/wu-paths-constants.js.map +1 -0
  101. package/dist/src/constants/wu-statuses.d.ts +209 -0
  102. package/dist/src/constants/wu-statuses.d.ts.map +1 -0
  103. package/dist/src/constants/wu-statuses.js +245 -0
  104. package/dist/src/constants/wu-statuses.js.map +1 -0
  105. package/dist/src/constants/wu-type-helpers.d.ts +28 -0
  106. package/dist/src/constants/wu-type-helpers.d.ts.map +1 -0
  107. package/dist/src/constants/wu-type-helpers.js +49 -0
  108. package/dist/src/constants/wu-type-helpers.js.map +1 -0
  109. package/dist/src/constants/wu-ui-constants.d.ts +236 -0
  110. package/dist/src/constants/wu-ui-constants.d.ts.map +1 -0
  111. package/dist/src/constants/wu-ui-constants.js +238 -0
  112. package/dist/src/constants/wu-ui-constants.js.map +1 -0
  113. package/dist/src/constants/wu-validation-constants.d.ts +61 -0
  114. package/dist/src/constants/wu-validation-constants.d.ts.map +1 -0
  115. package/dist/src/constants/wu-validation-constants.js +69 -0
  116. package/dist/src/constants/wu-validation-constants.js.map +1 -0
  117. package/dist/src/domain/index.d.ts +4 -0
  118. package/dist/src/domain/index.d.ts.map +1 -0
  119. package/dist/src/domain/index.js +6 -0
  120. package/dist/src/domain/index.js.map +1 -0
  121. package/dist/src/domain/orchestration.constants.d.ts +111 -0
  122. package/dist/src/domain/orchestration.constants.d.ts.map +1 -0
  123. package/dist/src/domain/orchestration.constants.js +130 -0
  124. package/dist/src/domain/orchestration.constants.js.map +1 -0
  125. package/dist/src/domain/orchestration.schemas.d.ts +307 -0
  126. package/dist/src/domain/orchestration.schemas.d.ts.map +1 -0
  127. package/dist/src/domain/orchestration.schemas.js +214 -0
  128. package/dist/src/domain/orchestration.schemas.js.map +1 -0
  129. package/dist/src/domain/orchestration.types.d.ts +134 -0
  130. package/dist/src/domain/orchestration.types.d.ts.map +1 -0
  131. package/dist/src/domain/orchestration.types.js +5 -0
  132. package/dist/src/domain/orchestration.types.js.map +1 -0
  133. package/dist/src/methodology/incremental-test.d.ts +33 -0
  134. package/dist/src/methodology/incremental-test.d.ts.map +1 -0
  135. package/dist/src/methodology/incremental-test.js +73 -0
  136. package/dist/src/methodology/incremental-test.js.map +1 -0
  137. package/dist/src/methodology/index.d.ts +3 -0
  138. package/dist/src/methodology/index.d.ts.map +1 -0
  139. package/dist/src/methodology/index.js +6 -0
  140. package/dist/src/methodology/index.js.map +1 -0
  141. package/dist/src/methodology/manual-test-validator.d.ts +97 -0
  142. package/dist/src/methodology/manual-test-validator.d.ts.map +1 -0
  143. package/dist/src/methodology/manual-test-validator.js +248 -0
  144. package/dist/src/methodology/manual-test-validator.js.map +1 -0
  145. package/dist/src/policy/coverage-gate.d.ts +127 -0
  146. package/dist/src/policy/coverage-gate.d.ts.map +1 -0
  147. package/dist/src/policy/coverage-gate.js +211 -0
  148. package/dist/src/policy/coverage-gate.js.map +1 -0
  149. package/dist/src/policy/gates-agent-mode.d.ts +107 -0
  150. package/dist/src/policy/gates-agent-mode.d.ts.map +1 -0
  151. package/dist/src/policy/gates-agent-mode.js +138 -0
  152. package/dist/src/policy/gates-agent-mode.js.map +1 -0
  153. package/dist/src/policy/gates-config-internal.d.ts +54 -0
  154. package/dist/src/policy/gates-config-internal.d.ts.map +1 -0
  155. package/dist/src/policy/gates-config-internal.js +108 -0
  156. package/dist/src/policy/gates-config-internal.js.map +1 -0
  157. package/dist/src/policy/gates-config.d.ts +67 -0
  158. package/dist/src/policy/gates-config.d.ts.map +1 -0
  159. package/dist/src/policy/gates-config.js +193 -0
  160. package/dist/src/policy/gates-config.js.map +1 -0
  161. package/dist/src/policy/gates-coverage.d.ts +48 -0
  162. package/dist/src/policy/gates-coverage.d.ts.map +1 -0
  163. package/dist/src/policy/gates-coverage.js +182 -0
  164. package/dist/src/policy/gates-coverage.js.map +1 -0
  165. package/dist/src/policy/gates-presets.d.ts +51 -0
  166. package/dist/src/policy/gates-presets.d.ts.map +1 -0
  167. package/dist/src/policy/gates-presets.js +117 -0
  168. package/dist/src/policy/gates-presets.js.map +1 -0
  169. package/dist/src/policy/gates-schemas.d.ts +142 -0
  170. package/dist/src/policy/gates-schemas.d.ts.map +1 -0
  171. package/dist/src/policy/gates-schemas.js +67 -0
  172. package/dist/src/policy/gates-schemas.js.map +1 -0
  173. package/dist/src/policy/index.d.ts +19 -0
  174. package/dist/src/policy/index.d.ts.map +1 -0
  175. package/dist/src/policy/index.js +21 -0
  176. package/dist/src/policy/index.js.map +1 -0
  177. package/dist/src/policy/package-manager-resolver.d.ts +79 -0
  178. package/dist/src/policy/package-manager-resolver.d.ts.map +1 -0
  179. package/dist/src/policy/package-manager-resolver.js +245 -0
  180. package/dist/src/policy/package-manager-resolver.js.map +1 -0
  181. package/dist/src/policy/resolve-policy.d.ts +337 -0
  182. package/dist/src/policy/resolve-policy.d.ts.map +1 -0
  183. package/dist/src/policy/resolve-policy.js +353 -0
  184. package/dist/src/policy/resolve-policy.js.map +1 -0
  185. package/dist/src/ports/config.ports.d.ts +83 -0
  186. package/dist/src/ports/config.ports.d.ts.map +1 -0
  187. package/dist/src/ports/config.ports.js +4 -0
  188. package/dist/src/ports/config.ports.js.map +1 -0
  189. package/dist/src/ports/dashboard-renderer.port.d.ts +113 -0
  190. package/dist/src/ports/dashboard-renderer.port.d.ts.map +1 -0
  191. package/dist/src/ports/dashboard-renderer.port.js +4 -0
  192. package/dist/src/ports/dashboard-renderer.port.js.map +1 -0
  193. package/dist/src/ports/index.d.ts +5 -0
  194. package/dist/src/ports/index.d.ts.map +1 -0
  195. package/dist/src/ports/index.js +10 -0
  196. package/dist/src/ports/index.js.map +1 -0
  197. package/dist/src/ports/sync-validator.ports.d.ts +52 -0
  198. package/dist/src/ports/sync-validator.ports.d.ts.map +1 -0
  199. package/dist/src/ports/sync-validator.ports.js +4 -0
  200. package/dist/src/ports/sync-validator.ports.js.map +1 -0
  201. package/dist/src/ports/wu-helpers.ports.d.ts +157 -0
  202. package/dist/src/ports/wu-helpers.ports.d.ts.map +1 -0
  203. package/dist/src/ports/wu-helpers.ports.js +4 -0
  204. package/dist/src/ports/wu-helpers.ports.js.map +1 -0
  205. package/dist/src/ports/wu-state.ports.d.ts +209 -0
  206. package/dist/src/ports/wu-state.ports.d.ts.map +1 -0
  207. package/dist/src/ports/wu-state.ports.js +4 -0
  208. package/dist/src/ports/wu-state.ports.js.map +1 -0
  209. package/dist/src/primitives/index.d.ts +2 -0
  210. package/dist/src/primitives/index.d.ts.map +1 -0
  211. package/dist/src/primitives/index.js +5 -0
  212. package/dist/src/primitives/index.js.map +1 -0
  213. package/dist/src/runtime/index.d.ts +2 -0
  214. package/dist/src/runtime/index.d.ts.map +1 -0
  215. package/dist/src/runtime/index.js +6 -0
  216. package/dist/src/runtime/index.js.map +1 -0
  217. package/dist/src/runtime/work-classifier.d.ts +103 -0
  218. package/dist/src/runtime/work-classifier.d.ts.map +1 -0
  219. package/dist/src/runtime/work-classifier.js +427 -0
  220. package/dist/src/runtime/work-classifier.js.map +1 -0
  221. package/dist/src/sandbox/index.d.ts +6 -0
  222. package/dist/src/sandbox/index.d.ts.map +1 -0
  223. package/dist/src/sandbox/index.js +10 -0
  224. package/dist/src/sandbox/index.js.map +1 -0
  225. package/dist/src/sandbox/sandbox-allowlist.d.ts +16 -0
  226. package/dist/src/sandbox/sandbox-allowlist.d.ts.map +1 -0
  227. package/dist/src/sandbox/sandbox-allowlist.js +77 -0
  228. package/dist/src/sandbox/sandbox-allowlist.js.map +1 -0
  229. package/dist/src/sandbox/sandbox-backend-linux.d.ts +6 -0
  230. package/dist/src/sandbox/sandbox-backend-linux.d.ts.map +1 -0
  231. package/dist/src/sandbox/sandbox-backend-linux.js +67 -0
  232. package/dist/src/sandbox/sandbox-backend-linux.js.map +1 -0
  233. package/dist/src/sandbox/sandbox-backend-macos.d.ts +6 -0
  234. package/dist/src/sandbox/sandbox-backend-macos.d.ts.map +1 -0
  235. package/dist/src/sandbox/sandbox-backend-macos.js +112 -0
  236. package/dist/src/sandbox/sandbox-backend-macos.js.map +1 -0
  237. package/dist/src/sandbox/sandbox-backend-windows.d.ts +6 -0
  238. package/dist/src/sandbox/sandbox-backend-windows.d.ts.map +1 -0
  239. package/dist/src/sandbox/sandbox-backend-windows.js +30 -0
  240. package/dist/src/sandbox/sandbox-backend-windows.js.map +1 -0
  241. package/dist/src/sandbox/sandbox-profile.d.ts +58 -0
  242. package/dist/src/sandbox/sandbox-profile.d.ts.map +1 -0
  243. package/dist/src/sandbox/sandbox-profile.js +69 -0
  244. package/dist/src/sandbox/sandbox-profile.js.map +1 -0
  245. package/dist/src/schemas/index.d.ts +2 -0
  246. package/dist/src/schemas/index.d.ts.map +1 -0
  247. package/dist/src/schemas/index.js +5 -0
  248. package/dist/src/schemas/index.js.map +1 -0
  249. package/dist/src/state/date-utils.d.ts +66 -0
  250. package/dist/src/state/date-utils.d.ts.map +1 -0
  251. package/dist/src/state/date-utils.js +143 -0
  252. package/dist/src/state/date-utils.js.map +1 -0
  253. package/dist/src/state/index.d.ts +8 -0
  254. package/dist/src/state/index.d.ts.map +1 -0
  255. package/dist/src/state/index.js +15 -0
  256. package/dist/src/state/index.js.map +1 -0
  257. package/dist/src/state/state-machine.d.ts +14 -0
  258. package/dist/src/state/state-machine.d.ts.map +1 -0
  259. package/dist/src/state/state-machine.js +92 -0
  260. package/dist/src/state/state-machine.js.map +1 -0
  261. package/dist/src/state/wu-doc-types.d.ts +48 -0
  262. package/dist/src/state/wu-doc-types.d.ts.map +1 -0
  263. package/dist/src/state/wu-doc-types.js +4 -0
  264. package/dist/src/state/wu-doc-types.js.map +1 -0
  265. package/dist/src/state/wu-paths.d.ts +275 -0
  266. package/dist/src/state/wu-paths.d.ts.map +1 -0
  267. package/dist/src/state/wu-paths.js +335 -0
  268. package/dist/src/state/wu-paths.js.map +1 -0
  269. package/dist/src/state/wu-schema.d.ts +831 -0
  270. package/dist/src/state/wu-schema.d.ts.map +1 -0
  271. package/dist/src/state/wu-schema.js +934 -0
  272. package/dist/src/state/wu-schema.js.map +1 -0
  273. package/dist/src/state/wu-state-schema.d.ts +292 -0
  274. package/dist/src/state/wu-state-schema.d.ts.map +1 -0
  275. package/dist/src/state/wu-state-schema.js +215 -0
  276. package/dist/src/state/wu-state-schema.js.map +1 -0
  277. package/dist/src/state/wu-yaml.d.ts +113 -0
  278. package/dist/src/state/wu-yaml.d.ts.map +1 -0
  279. package/dist/src/state/wu-yaml.js +307 -0
  280. package/dist/src/state/wu-yaml.js.map +1 -0
  281. package/dist/tool-impl/wu-lifecycle-tools.d.ts +11 -0
  282. package/dist/tool-impl/wu-lifecycle-tools.d.ts.map +1 -1
  283. package/dist/tool-impl/wu-lifecycle-tools.js +17 -0
  284. package/dist/tool-impl/wu-lifecycle-tools.js.map +1 -1
  285. package/manifest.yaml +210 -230
  286. package/package.json +88 -3
@@ -0,0 +1,112 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+ import { spawnSync } from 'node:child_process';
4
+ import os from 'node:os';
5
+ import { SANDBOX_BACKEND_IDS, } from './sandbox-profile.js';
6
+ const MACOS_SANDBOX_BINARY = 'sandbox-exec';
7
+ function defaultCommandExists(binary) {
8
+ const probe = spawnSync(binary, ['-h'], { stdio: 'ignore' });
9
+ return !probe.error;
10
+ }
11
+ function escapePolicyPath(targetPath) {
12
+ return targetPath.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
13
+ }
14
+ function buildNetworkRules(profile) {
15
+ const posture = profile.networkPosture ?? 'full';
16
+ if (posture === 'off') {
17
+ return ['(deny network*)'];
18
+ }
19
+ if (posture === 'allowlist') {
20
+ const rules = ['(deny network*)'];
21
+ for (const host of profile.networkAllowlist) {
22
+ rules.push(`(allow network-outbound (remote ip "${host}"))`);
23
+ }
24
+ return rules;
25
+ }
26
+ // posture === 'full'
27
+ return ['(allow network*)'];
28
+ }
29
+ /** macOS system paths required for process execution (parity with bwrap --ro-bind /) */
30
+ const MACOS_SYSTEM_READ_PATHS = [
31
+ '/usr',
32
+ '/System',
33
+ '/Library',
34
+ '/bin',
35
+ '/sbin',
36
+ '/private',
37
+ '/dev',
38
+ '/tmp',
39
+ ];
40
+ /** Sensitive paths denied from read access (parity with bwrap deny overlays) */
41
+ const SENSITIVE_DENY_PATHS = ['.ssh', '.aws', '.gnupg'];
42
+ function buildReadRules(profile) {
43
+ const readPaths = new Set();
44
+ // Workspace root (covers worktree, state, WU YAML)
45
+ readPaths.add(profile.projectRoot);
46
+ // System paths required for process execution
47
+ for (const systemPath of MACOS_SYSTEM_READ_PATHS) {
48
+ readPaths.add(systemPath);
49
+ }
50
+ // Temp path from profile
51
+ readPaths.add(profile.tempPath);
52
+ return [...readPaths].map((readPath) => `(allow file-read* (subpath "${escapePolicyPath(readPath)}"))`);
53
+ }
54
+ function buildDenyOverlays() {
55
+ const homeDir = os.homedir();
56
+ return SENSITIVE_DENY_PATHS.map((sensitivePath) => `(deny file-read* (subpath "${escapePolicyPath(homeDir)}/${sensitivePath}"))`);
57
+ }
58
+ function buildPolicy(profile) {
59
+ const writableRules = profile.allowlist.writableRoots.map((entry) => `(allow file-write* (subpath "${escapePolicyPath(entry.normalizedPath)}"))`);
60
+ return [
61
+ '(version 1)',
62
+ '(deny default)',
63
+ '(allow process*)',
64
+ ...buildReadRules(profile),
65
+ ...buildDenyOverlays(),
66
+ '(allow sysctl-read)',
67
+ '(allow mach-lookup)',
68
+ ...buildNetworkRules(profile),
69
+ '(allow signal)',
70
+ ...writableRules,
71
+ ].join(' ');
72
+ }
73
+ function buildUnavailablePlan(request) {
74
+ if (request.allowUnsandboxedFallback) {
75
+ return {
76
+ backendId: SANDBOX_BACKEND_IDS.MACOS,
77
+ enforced: false,
78
+ failClosed: false,
79
+ warning: 'Running unsandboxed because sandbox-exec is unavailable and fallback was explicitly enabled.',
80
+ };
81
+ }
82
+ return {
83
+ backendId: SANDBOX_BACKEND_IDS.MACOS,
84
+ enforced: false,
85
+ failClosed: true,
86
+ reason: 'macOS sandbox backend unavailable: required binary "sandbox-exec" was not found.',
87
+ };
88
+ }
89
+ function buildInvocation(request) {
90
+ return {
91
+ command: MACOS_SANDBOX_BINARY,
92
+ args: ['-p', buildPolicy(request.profile), ...request.command],
93
+ };
94
+ }
95
+ export function createMacosSandboxBackend(options = {}) {
96
+ const commandExists = options.commandExists || defaultCommandExists;
97
+ return {
98
+ id: SANDBOX_BACKEND_IDS.MACOS,
99
+ resolveExecution(request) {
100
+ if (!commandExists(MACOS_SANDBOX_BINARY)) {
101
+ return buildUnavailablePlan(request);
102
+ }
103
+ return {
104
+ backendId: SANDBOX_BACKEND_IDS.MACOS,
105
+ enforced: true,
106
+ failClosed: false,
107
+ invocation: buildInvocation(request),
108
+ };
109
+ },
110
+ };
111
+ }
112
+ //# sourceMappingURL=sandbox-backend-macos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-backend-macos.js","sourceRoot":"","sources":["../../../src/sandbox/sandbox-backend-macos.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,yCAAyC;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EACL,mBAAmB,GAIpB,MAAM,sBAAsB,CAAC;AAM9B,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAE5C,SAAS,oBAAoB,CAAC,MAAc;IAC1C,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC7D,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;AACtB,CAAC;AAED,SAAS,gBAAgB,CAAC,UAAkB;IAC1C,OAAO,UAAU,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,iBAAiB,CAAC,OAA2C;IACpE,MAAM,OAAO,GAAG,OAAO,CAAC,cAAc,IAAI,MAAM,CAAC;IAEjD,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;QACtB,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC7B,CAAC;IAED,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;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AAgB,CAAC,OAAgC;YAC/C,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,EAAE,CAAC;gBACzC,OAAO,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACvC,CAAC;YAED,OAAO;gBACL,SAAS,EAAE,mBAAmB,CAAC,KAAK;gBACpC,QAAQ,EAAE,IAAI;gBACd,UAAU,EAAE,KAAK;gBACjB,UAAU,EAAE,eAAe,CAAC,OAAO,CAAC;aACrC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type SandboxBackend } from './sandbox-profile.js';
2
+ export interface WindowsSandboxBackendOptions {
3
+ commandExists?: (binary: string) => boolean;
4
+ }
5
+ export declare function createWindowsSandboxBackend(_options?: WindowsSandboxBackendOptions): SandboxBackend;
6
+ //# sourceMappingURL=sandbox-backend-windows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-backend-windows.d.ts","sourceRoot":"","sources":["../../../src/sandbox/sandbox-backend-windows.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,cAAc,EAGpB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,4BAA4B;IAC3C,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;CAC7C;AAyBD,wBAAgB,2BAA2B,CACzC,QAAQ,GAAE,4BAAiC,GAC1C,cAAc,CAOhB"}
@@ -0,0 +1,30 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+ import { SANDBOX_BACKEND_IDS, } from './sandbox-profile.js';
4
+ const WINDOWS_ENFORCEMENT_UNAVAILABLE_REASON = 'Windows sandbox backend unavailable: write enforcement is not yet available on Windows.';
5
+ const WINDOWS_ENFORCEMENT_UNAVAILABLE_WARNING = 'Running unsandboxed because write enforcement is not yet available on Windows and fallback was explicitly enabled.';
6
+ function buildNotImplementedPlan(request) {
7
+ if (request.allowUnsandboxedFallback) {
8
+ return {
9
+ backendId: SANDBOX_BACKEND_IDS.WINDOWS,
10
+ enforced: false,
11
+ failClosed: false,
12
+ warning: WINDOWS_ENFORCEMENT_UNAVAILABLE_WARNING,
13
+ };
14
+ }
15
+ return {
16
+ backendId: SANDBOX_BACKEND_IDS.WINDOWS,
17
+ enforced: false,
18
+ failClosed: true,
19
+ reason: WINDOWS_ENFORCEMENT_UNAVAILABLE_REASON,
20
+ };
21
+ }
22
+ export function createWindowsSandboxBackend(_options = {}) {
23
+ return {
24
+ id: SANDBOX_BACKEND_IDS.WINDOWS,
25
+ resolveExecution(request) {
26
+ return buildNotImplementedPlan(request);
27
+ },
28
+ };
29
+ }
30
+ //# sourceMappingURL=sandbox-backend-windows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-backend-windows.js","sourceRoot":"","sources":["../../../src/sandbox/sandbox-backend-windows.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,yCAAyC;AAEzC,OAAO,EACL,mBAAmB,GAIpB,MAAM,sBAAsB,CAAC;AAM9B,MAAM,sCAAsC,GAC1C,yFAAyF,CAAC;AAC5F,MAAM,uCAAuC,GAC3C,oHAAoH,CAAC;AAEvH,SAAS,uBAAuB,CAAC,OAAgC;IAC/D,IAAI,OAAO,CAAC,wBAAwB,EAAE,CAAC;QACrC,OAAO;YACL,SAAS,EAAE,mBAAmB,CAAC,OAAO;YACtC,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,KAAK;YACjB,OAAO,EAAE,uCAAuC;SACjD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,SAAS,EAAE,mBAAmB,CAAC,OAAO;QACtC,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,IAAI;QAChB,MAAM,EAAE,sCAAsC;KAC/C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,WAAyC,EAAE;IAE3C,OAAO;QACL,EAAE,EAAE,mBAAmB,CAAC,OAAO;QAC/B,gBAAgB,CAAC,OAAgC;YAC/C,OAAO,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { type SandboxAllowlist } from './sandbox-allowlist.js';
2
+ export declare const SANDBOX_BACKEND_IDS: {
3
+ readonly LINUX: "linux";
4
+ readonly MACOS: "macos";
5
+ readonly WINDOWS: "windows";
6
+ readonly UNSUPPORTED: "unsupported";
7
+ };
8
+ export type SandboxBackendId = (typeof SANDBOX_BACKEND_IDS)[keyof typeof SANDBOX_BACKEND_IDS];
9
+ export type SandboxNetworkPosture = 'off' | 'allowlist' | 'full';
10
+ export interface SandboxProfile {
11
+ projectRoot: string;
12
+ worktreePath: string;
13
+ wuId: string;
14
+ wuYamlPath: string;
15
+ statePath: string;
16
+ tempPath: string;
17
+ allowlist: SandboxAllowlist;
18
+ networkPosture: SandboxNetworkPosture;
19
+ networkAllowlist: string[];
20
+ }
21
+ export interface BuildSandboxProfileInput {
22
+ projectRoot: string;
23
+ worktreePath: string;
24
+ wuId: string;
25
+ tempPath?: string;
26
+ extraWritableRoots?: string[];
27
+ networkPosture?: SandboxNetworkPosture;
28
+ networkAllowlist?: string[];
29
+ }
30
+ export interface SandboxBackendResolution {
31
+ id: SandboxBackendId;
32
+ platform: NodeJS.Platform | string;
33
+ supported: boolean;
34
+ }
35
+ export interface SandboxInvocation {
36
+ command: string;
37
+ args: string[];
38
+ }
39
+ export interface SandboxExecutionRequest {
40
+ profile: SandboxProfile;
41
+ command: string[];
42
+ allowUnsandboxedFallback: boolean;
43
+ }
44
+ export interface SandboxExecutionPlan {
45
+ backendId: SandboxBackendId;
46
+ enforced: boolean;
47
+ failClosed: boolean;
48
+ invocation?: SandboxInvocation;
49
+ reason?: string;
50
+ warning?: string;
51
+ }
52
+ export interface SandboxBackend {
53
+ id: SandboxBackendId;
54
+ resolveExecution: (request: SandboxExecutionRequest) => SandboxExecutionPlan;
55
+ }
56
+ export declare function buildSandboxProfile(input: BuildSandboxProfileInput): SandboxProfile;
57
+ export declare function resolveSandboxBackendForPlatform(platform?: NodeJS.Platform | string): SandboxBackendResolution;
58
+ //# sourceMappingURL=sandbox-profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox-profile.d.ts","sourceRoot":"","sources":["../../../src/sandbox/sandbox-profile.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,gBAAgB,EAEtB,MAAM,wBAAwB,CAAC;AAIhC,eAAO,MAAM,mBAAmB;;;;;CAKtB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAE9F,MAAM,MAAM,qBAAqB,GAAG,KAAK,GAAG,WAAW,GAAG,MAAM,CAAC;AAEjE,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,cAAc,EAAE,qBAAqB,CAAC;IACtC,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,gBAAgB,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC;IACnC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,wBAAwB,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,gBAAgB,CAAC;IACrB,gBAAgB,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,oBAAoB,CAAC;CAC9E;AAmBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,cAAc,CAwCnF;AAED,wBAAgB,gCAAgC,CAC9C,QAAQ,GAAE,MAAM,CAAC,QAAQ,GAAG,MAAyB,GACpD,wBAAwB,CAc1B"}
@@ -0,0 +1,69 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { buildSandboxAllowlist, } from './sandbox-allowlist.js';
6
+ import { LUMENFLOW_PATHS } from '../constants/wu-paths-constants.js';
7
+ import { createWuPaths } from '../state/wu-paths.js';
8
+ export const SANDBOX_BACKEND_IDS = {
9
+ LINUX: 'linux',
10
+ MACOS: 'macos',
11
+ WINDOWS: 'windows',
12
+ UNSUPPORTED: 'unsupported',
13
+ };
14
+ function resolveWorktreePath(projectRoot, worktreePath) {
15
+ if (path.isAbsolute(worktreePath)) {
16
+ return path.resolve(worktreePath);
17
+ }
18
+ return path.resolve(projectRoot, worktreePath);
19
+ }
20
+ function buildDefaultWritableRoots(profile) {
21
+ return [profile.worktreePath, profile.statePath, profile.wuYamlPath, profile.tempPath];
22
+ }
23
+ export function buildSandboxProfile(input) {
24
+ const projectRoot = path.resolve(input.projectRoot);
25
+ const worktreePath = resolveWorktreePath(projectRoot, input.worktreePath);
26
+ const wuYamlPath = path.resolve(projectRoot, createWuPaths({ projectRoot }).WU(input.wuId));
27
+ const statePath = path.resolve(projectRoot, LUMENFLOW_PATHS.STATE_DIR);
28
+ const tempPath = path.resolve(input.tempPath || os.tmpdir());
29
+ const writableRoots = buildDefaultWritableRoots({
30
+ worktreePath,
31
+ statePath,
32
+ wuYamlPath,
33
+ tempPath,
34
+ });
35
+ if (input.extraWritableRoots && input.extraWritableRoots.length > 0) {
36
+ writableRoots.push(...input.extraWritableRoots);
37
+ }
38
+ const allowlistInput = {
39
+ projectRoot,
40
+ writableRoots,
41
+ };
42
+ const allowlist = buildSandboxAllowlist(allowlistInput);
43
+ const networkPosture = input.networkPosture ?? 'full';
44
+ const networkAllowlist = networkPosture === 'allowlist' && input.networkAllowlist ? [...input.networkAllowlist] : [];
45
+ return {
46
+ projectRoot,
47
+ worktreePath,
48
+ wuId: input.wuId,
49
+ wuYamlPath,
50
+ statePath,
51
+ tempPath,
52
+ allowlist,
53
+ networkPosture,
54
+ networkAllowlist,
55
+ };
56
+ }
57
+ export function resolveSandboxBackendForPlatform(platform = process.platform) {
58
+ if (platform === 'linux') {
59
+ return { id: SANDBOX_BACKEND_IDS.LINUX, platform, supported: true };
60
+ }
61
+ if (platform === 'darwin') {
62
+ return { id: SANDBOX_BACKEND_IDS.MACOS, platform, supported: true };
63
+ }
64
+ if (platform === 'win32') {
65
+ return { id: SANDBOX_BACKEND_IDS.WINDOWS, platform, supported: true };
66
+ }
67
+ return { id: SANDBOX_BACKEND_IDS.UNSUPPORTED, platform, supported: false };
68
+ }
69
+ //# sourceMappingURL=sandbox-prof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,CAAC;IAED,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,EAAE,EAAE,EAAE,mBAAmB,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACtE,CAAC;IAED,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO,EAAE,EAAE,EAAE,mBAAmB,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACxE,CAAC;IAED,OAAO,EAAE,EAAE,EAAE,mBAAmB,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+ // Barrel for pack-static-data schemas. Populated by Layer 2 of INIT-058.
4
+ export {};
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,yCAAyC;AAEzC,yEAAyE;AACzE,OAAO,EAAE,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Get current date in ISO format (YYYY-MM-DD)
3
+ * @returns {string} Current date in YYYY-MM-DD format
4
+ * @example
5
+ * todayISO(); // "2025-11-12"
6
+ */
7
+ export declare function todayISO(): string;
8
+ /**
9
+ * Format a date with a custom format string
10
+ * @param {Date|string|number} date - Date to format
11
+ * @param {string} formatString - date-fns format string
12
+ * @returns {string} Formatted date string
13
+ * @example
14
+ * formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss');
15
+ * formatDate('2025-11-12', 'MMMM d, yyyy'); // "November 12, 2025"
16
+ */
17
+ export declare function formatDate(date: Date | string | number, formatString: string): string;
18
+ /**
19
+ * Normalize a Date object or ISO timestamp string to YYYY-MM-DD format
20
+ *
21
+ * WU-1442: Fix date corruption when js-yaml parses YYYY-MM-DD as Date objects
22
+ * Library-First: Uses date-fns for date formatting (no manual parsing)
23
+ *
24
+ * Use case: js-yaml parses `created: 2025-12-04` (unquoted) as a Date object.
25
+ * When yaml.dump() serializes it back, it outputs `2025-12-04T00:00:00.000Z`.
26
+ * This function normalizes Date objects back to YYYY-MM-DD string format.
27
+ *
28
+ * Handles:
29
+ * - Date objects → YYYY-MM-DD string
30
+ * - ISO timestamp strings → YYYY-MM-DD string (date portion)
31
+ * - YYYY-MM-DD strings → preserved as-is
32
+ * - undefined/null → preserved as undefined
33
+ *
34
+ * @param {Date|string|undefined|null} value - Date value to normalize
35
+ * @returns {string|undefined} Date in YYYY-MM-DD format or undefined
36
+ *
37
+ * @example
38
+ * normalizeToDateString(new Date('2025-12-04')); // '2025-12-04'
39
+ * normalizeToDateString('2025-12-04T00:00:00.000Z'); // '2025-12-04'
40
+ * normalizeToDateString('2025-12-04'); // '2025-12-04'
41
+ * normalizeToDateString(undefined); // undefined
42
+ */
43
+ export declare function normalizeToDateString(value: unknown): string | undefined;
44
+ /**
45
+ * Normalize various date formats to ISO 8601 datetime (YYYY-MM-DDTHH:mm:ss.sssZ)
46
+ *
47
+ * WU-1337: Auto-repair date fields in WU YAML to consistent format
48
+ * Library-First: Uses date-fns for date handling (no manual parsing)
49
+ *
50
+ * Handles:
51
+ * - ISO date strings (YYYY-MM-DD) → midnight UTC
52
+ * - ISO datetime strings (already valid) → preserved
53
+ * - Unix timestamps (milliseconds) → converted
54
+ * - undefined/null → preserved as undefined
55
+ *
56
+ * @param {string|number|undefined|null} value - Date value to normalize
57
+ * @returns {string|undefined} ISO datetime string or undefined
58
+ *
59
+ * @example
60
+ * normalizeISODateTime('2025-11-29'); // '2025-11-29T00:00:00.000Z'
61
+ * normalizeISODateTime('2025-11-29T14:30:00.000Z'); // '2025-11-29T14:30:00.000Z'
62
+ * normalizeISODateTime(1732896000000); // '2024-11-29T16:00:00.000Z'
63
+ * normalizeISODateTime(undefined); // undefined
64
+ */
65
+ export declare function normalizeISODateTime(value: string | number | null | undefined): string | undefined;
66
+ //# sourceMappingURL=date-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../../src/state/date-utils.ts"],"names":[],"mappings":"AAgBA;;;;;GAKG;AACH,wBAAgB,QAAQ,WAEvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,EAAE,YAAY,EAAE,MAAM,UAE5E;AAQD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,sBAgCnD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,sBAgC7E"}
@@ -0,0 +1,143 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+ /**
4
+ * @file date-utils.ts
5
+ * @description Date formatting utilities using date-fns library
6
+ * WU-1082: Extract shared utilities (eliminate date formatting duplication)
7
+ *
8
+ * Replaces manual date formatting in:
9
+ * - tools/wu-block.ts (todayISO)
10
+ * - tools/wu-unblock.ts (todayISO)
11
+ * - tools/wu-done.ts (todayISO - already uses date-fns)
12
+ */
13
+ import { format } from 'date-fns';
14
+ /**
15
+ * Get current date in ISO format (YYYY-MM-DD)
16
+ * @returns {string} Current date in YYYY-MM-DD format
17
+ * @example
18
+ * todayISO(); // "2025-11-12"
19
+ */
20
+ export function todayISO() {
21
+ return format(new Date(), 'yyyy-MM-dd');
22
+ }
23
+ /**
24
+ * Format a date with a custom format string
25
+ * @param {Date|string|number} date - Date to format
26
+ * @param {string} formatString - date-fns format string
27
+ * @returns {string} Formatted date string
28
+ * @example
29
+ * formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss');
30
+ * formatDate('2025-11-12', 'MMMM d, yyyy'); // "November 12, 2025"
31
+ */
32
+ export function formatDate(date, formatString) {
33
+ return format(new Date(date), formatString);
34
+ }
35
+ /**
36
+ * Date format constant for YYYY-MM-DD
37
+ * @constant {string}
38
+ */
39
+ const DATE_FORMAT_ISO = 'yyyy-MM-dd';
40
+ /**
41
+ * Normalize a Date object or ISO timestamp string to YYYY-MM-DD format
42
+ *
43
+ * WU-1442: Fix date corruption when js-yaml parses YYYY-MM-DD as Date objects
44
+ * Library-First: Uses date-fns for date formatting (no manual parsing)
45
+ *
46
+ * Use case: js-yaml parses `created: 2025-12-04` (unquoted) as a Date object.
47
+ * When yaml.dump() serializes it back, it outputs `2025-12-04T00:00:00.000Z`.
48
+ * This function normalizes Date objects back to YYYY-MM-DD string format.
49
+ *
50
+ * Handles:
51
+ * - Date objects → YYYY-MM-DD string
52
+ * - ISO timestamp strings → YYYY-MM-DD string (date portion)
53
+ * - YYYY-MM-DD strings → preserved as-is
54
+ * - undefined/null → preserved as undefined
55
+ *
56
+ * @param {Date|string|undefined|null} value - Date value to normalize
57
+ * @returns {string|undefined} Date in YYYY-MM-DD format or undefined
58
+ *
59
+ * @example
60
+ * normalizeToDateString(new Date('2025-12-04')); // '2025-12-04'
61
+ * normalizeToDateString('2025-12-04T00:00:00.000Z'); // '2025-12-04'
62
+ * normalizeToDateString('2025-12-04'); // '2025-12-04'
63
+ * normalizeToDateString(undefined); // undefined
64
+ */
65
+ export function normalizeToDateString(value) {
66
+ // Preserve undefined/null
67
+ if (value == null) {
68
+ return undefined;
69
+ }
70
+ // If already a YYYY-MM-DD string, return as-is
71
+ if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(value)) {
72
+ return value;
73
+ }
74
+ // Convert Date objects or timestamp strings to YYYY-MM-DD
75
+ if (value instanceof Date) {
76
+ return format(value, DATE_FORMAT_ISO);
77
+ }
78
+ // Handle ISO timestamp strings (e.g., '2025-12-04T00:00:00.000Z')
79
+ if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}T/.test(value)) {
80
+ return format(new Date(value), DATE_FORMAT_ISO);
81
+ }
82
+ // Fallback: try to parse and format (coerce to string for Date constructor)
83
+ try {
84
+ const date = new Date(String(value));
85
+ if (!isNaN(date.getTime())) {
86
+ return format(date, DATE_FORMAT_ISO);
87
+ }
88
+ }
89
+ catch {
90
+ // Invalid date - return undefined
91
+ }
92
+ return undefined;
93
+ }
94
+ /**
95
+ * Normalize various date formats to ISO 8601 datetime (YYYY-MM-DDTHH:mm:ss.sssZ)
96
+ *
97
+ * WU-1337: Auto-repair date fields in WU YAML to consistent format
98
+ * Library-First: Uses date-fns for date handling (no manual parsing)
99
+ *
100
+ * Handles:
101
+ * - ISO date strings (YYYY-MM-DD) → midnight UTC
102
+ * - ISO datetime strings (already valid) → preserved
103
+ * - Unix timestamps (milliseconds) → converted
104
+ * - undefined/null → preserved as undefined
105
+ *
106
+ * @param {string|number|undefined|null} value - Date value to normalize
107
+ * @returns {string|undefined} ISO datetime string or undefined
108
+ *
109
+ * @example
110
+ * normalizeISODateTime('2025-11-29'); // '2025-11-29T00:00:00.000Z'
111
+ * normalizeISODateTime('2025-11-29T14:30:00.000Z'); // '2025-11-29T14:30:00.000Z'
112
+ * normalizeISODateTime(1732896000000); // '2024-11-29T16:00:00.000Z'
113
+ * normalizeISODateTime(undefined); // undefined
114
+ */
115
+ export function normalizeISODateTime(value) {
116
+ // Preserve undefined/null (optional fields)
117
+ if (value == null) {
118
+ return undefined;
119
+ }
120
+ // If already a valid ISO datetime format, preserve it
121
+ // Pattern: YYYY-MM-DDTHH:mm:ss.sssZ
122
+ if (typeof value === 'string' && /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(value)) {
123
+ return value;
124
+ }
125
+ // Handle Unix timestamps as strings (convert to number first)
126
+ let dateInput = value;
127
+ if (typeof value === 'string' && /^\d+$/.test(value)) {
128
+ // Numeric string - treat as Unix timestamp in milliseconds
129
+ dateInput = Number(value);
130
+ }
131
+ // Parse and convert to ISO datetime
132
+ // date-fns/Date handles: ISO dates, ISO datetimes, Unix timestamps
133
+ const date = new Date(dateInput);
134
+ // Check for invalid date
135
+ if (isNaN(date.getTime())) {
136
+ // Fallback: return undefined for unparseable dates
137
+ // Zod schema will catch invalid dates separately
138
+ return undefined;
139
+ }
140
+ // Convert to ISO 8601 datetime format
141
+ return date.toISOString();
142
+ }
143
+ //# sourceMappingURL=date-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../../src/state/date-utils.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,yCAAyC;AAEzC;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;GAKG;AACH,MAAM,UAAU,QAAQ;IACtB,OAAO,MAAM,CAAC,IAAI,IAAI,EAAE,EAAE,YAAY,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CAAC,IAA4B,EAAE,YAAoB;IAC3E,OAAO,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC,CAAC;AAC9C,CAAC;AAED;;;GAGG;AACH,MAAM,eAAe,GAAG,YAAY,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,0BAA0B;IAC1B,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,+CAA+C;IAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,qBAAqB,CAAC,IAAI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,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,oCAAoC;IACpC,mEAAmE;IACnE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IAEjC,yBAAyB;IACzB,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;QAC1B,mDAAmD;QACnD,iDAAiD;QACjD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,sCAAsC;IACtC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,8 @@
1
+ export * from './wu-state-schema.js';
2
+ export * from './wu-doc-types.js';
3
+ export * from './date-utils.js';
4
+ export * from './wu-paths.js';
5
+ export * from './wu-schema.js';
6
+ export * from './wu-yaml.js';
7
+ export * from './state-machine.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/state/index.ts"],"names":[],"mappings":"AAOA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAE7B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+ // Barrel for pack-local WU state modules. Populated by Layer 4 of INIT-058.
4
+ // WU-2687 (narrowed): moved wu-state-schema, wu-doc-types from @lumenflow/core.
5
+ // WU-2689 (L4 cascade): moved wu-paths, wu-yaml, wu-schema, date-utils from @lumenflow/core
6
+ // after WU-2690 added getDirectories/getStatePaths to the pack workspace-reader.
7
+ export * from './wu-state-schema.js';
8
+ export * from './wu-doc-types.js';
9
+ export * from './date-utils.js';
10
+ export * from './wu-paths.js';
11
+ export * from './wu-schema.js';
12
+ export * from './wu-yaml.js';
13
+ // WU-2699 (L4): moved state-machine (SDLC residue) from @lumenflow/core.
14
+ export * from './state-machine.js';
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/state/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,yCAAyC;AAEzC,4EAA4E;AAC5E,gFAAgF;AAChF,4FAA4F;AAC5F,mFAAmF;AACnF,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,yEAAyE;AACzE,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Validates a SDLC WU state transition and throws if illegal.
3
+ *
4
+ * Delegates graph evaluation to `@lumenflow/kernel/primitives/state-machine`
5
+ * and rewraps kernel errors with the `STATE_ERROR` error code that core
6
+ * callers already rely on.
7
+ *
8
+ * @param from Current WU status (e.g., `in_progress`, `blocked`).
9
+ * @param to Desired WU status.
10
+ * @param wuid Work Unit ID (e.g., `WU-416`) used in error messages.
11
+ * @throws Error with `code === 'STATE_ERROR'` for invalid/illegal transitions.
12
+ */
13
+ export declare function assertTransition(from: string | null | undefined, to: string | null | undefined, wuid: string): void;
14
+ //# sourceMappingURL=state-machine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-machine.d.ts","sourceRoot":"","sources":["../../../src/state/state-machine.ts"],"names":[],"mappings":"AAkFA;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC7B,IAAI,EAAE,MAAM,GACX,IAAI,CAoBN"}