@lumenflow/packs-software-delivery 4.24.0 → 5.0.0

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 +46 -0
  286. package/package.json +88 -3
@@ -0,0 +1,296 @@
1
+ /**
2
+ * Regex patterns for WU operations
3
+ *
4
+ * Note: WU_ID pattern is also in wu-schema.ts for Zod validation
5
+ */
6
+ export declare const PATTERNS: {
7
+ /** WU identifier format: WU-123 */
8
+ WU_ID: RegExp;
9
+ /** Extract WU ID from text: captures "WU-123" */
10
+ WU_ID_EXTRACT: RegExp;
11
+ /**
12
+ * Extract WU ID from worktree paths (case-insensitive)
13
+ *
14
+ * WU-1090: Worktree names use lowercase like 'framework-core-wu-1090'
15
+ * This pattern matches both 'WU-123' and 'wu-123' to support
16
+ * extracting WU IDs from worktree paths.
17
+ */
18
+ WU_ID_EXTRACT_CI: RegExp;
19
+ /** Lane branch format: lane/<lane-kebab>/wu-<id> */
20
+ LANE_BRANCH: RegExp;
21
+ /** Worktree path format: worktrees/<lane-kebab>-wu-<id> */
22
+ WORKTREE_PATH: RegExp;
23
+ };
24
+ /**
25
+ * Commit message formats
26
+ *
27
+ * These are functions that generate properly formatted commit messages
28
+ */
29
+ export declare const COMMIT_FORMATS: {
30
+ CLAIM: (id: string, laneKebab: string) => string;
31
+ DONE: (id: string, title: string) => string;
32
+ CREATE: (id: string, title: string) => string;
33
+ EDIT: (id: string) => string;
34
+ SPEC_UPDATE: (id: string) => string;
35
+ BLOCK: (id: string) => string;
36
+ UNBLOCK: (id: string) => string;
37
+ REPAIR: (id: string) => string;
38
+ REBASE_ARTIFACT_CLEANUP: (id: string) => string;
39
+ BACKLOG_REPAIR: (id: string) => string;
40
+ ESCALATE: (id: string) => string;
41
+ };
42
+ /**
43
+ * Consistency check types (WU-1276)
44
+ *
45
+ * Layer 2 defense-in-depth: detect and repair WU state inconsistencies
46
+ */
47
+ export declare const CONSISTENCY_TYPES: {
48
+ /** WU YAML has status 'done' but WU appears in status.md In Progress section */
49
+ YAML_DONE_STATUS_IN_PROGRESS: string;
50
+ /** WU appears in both Done AND In Progress sections of backlog.md */
51
+ BACKLOG_DUAL_SECTION: string;
52
+ /** WU YAML has status 'done' but no stamp file exists */
53
+ YAML_DONE_NO_STAMP: string;
54
+ /** WU has status 'done' but still has an associated worktree */
55
+ ORPHAN_WORKTREE_DONE: string;
56
+ /** Stamp file exists but WU YAML status is not 'done' (partial wu:done failure) */
57
+ STAMP_EXISTS_YAML_NOT_DONE: string;
58
+ /** WU is claimed but its worktree directory is missing */
59
+ MISSING_WORKTREE_CLAIMED: string;
60
+ };
61
+ /**
62
+ * Consistency check messages
63
+ */
64
+ export declare const CONSISTENCY_MESSAGES: {
65
+ MISSING_WORKTREE_CLAIMED: (id: string, status: string, worktreePath: string) => string;
66
+ MISSING_WORKTREE_CLAIMED_REPAIR: string;
67
+ };
68
+ /**
69
+ * Worktree warning messages
70
+ */
71
+ export declare const WORKTREE_WARNINGS: {
72
+ MISSING_TRACKED_HEADER: string;
73
+ MISSING_TRACKED_LINE: (worktreePath: string) => string;
74
+ };
75
+ /**
76
+ * Cleanup guard constants
77
+ */
78
+ export declare const CLEANUP_GUARD: {
79
+ REASONS: {
80
+ UNCOMMITTED_CHANGES: string;
81
+ UNPUSHED_COMMITS: string;
82
+ STATUS_NOT_DONE: string;
83
+ MISSING_STAMP: string;
84
+ PR_NOT_MERGED: string;
85
+ };
86
+ TITLES: {
87
+ BLOCKED: string;
88
+ NEXT_STEPS: string;
89
+ };
90
+ MESSAGES: {
91
+ UNCOMMITTED_CHANGES: string;
92
+ UNPUSHED_COMMITS: string;
93
+ STATUS_NOT_DONE: string;
94
+ MISSING_STAMP: string;
95
+ PR_NOT_MERGED: string;
96
+ };
97
+ NEXT_STEPS: {
98
+ DEFAULT: {
99
+ text: string;
100
+ appendId: boolean;
101
+ }[];
102
+ UNCOMMITTED_CHANGES: {
103
+ text: string;
104
+ appendId: boolean;
105
+ }[];
106
+ UNPUSHED_COMMITS: {
107
+ text: string;
108
+ appendId: boolean;
109
+ }[];
110
+ STATUS_NOT_DONE: {
111
+ text: string;
112
+ appendId: boolean;
113
+ }[];
114
+ MISSING_STAMP: {
115
+ text: string;
116
+ appendId: boolean;
117
+ }[];
118
+ PR_NOT_MERGED: {
119
+ text: string;
120
+ appendId: boolean;
121
+ }[];
122
+ };
123
+ PR_CHECK: {
124
+ START: string;
125
+ RESULT: string;
126
+ };
127
+ };
128
+ /**
129
+ * Session display constants
130
+ *
131
+ * Emergency fix (Session 2): Centralized from hardcoded magic numbers
132
+ */
133
+ export declare const SESSION: {
134
+ /** Standard length for displaying session ID prefix (e.g., "sess-123") */
135
+ ID_DISPLAY_LENGTH: number;
136
+ };
137
+ /**
138
+ * Validation constants
139
+ *
140
+ * WU-1281: Centralized from local constants in validators
141
+ */
142
+ export declare const VALIDATION: {
143
+ /** Minimum description length for WU spec completeness */
144
+ MIN_DESCRIPTION_LENGTH: number;
145
+ };
146
+ /**
147
+ * Threshold constants for pre-flight checks
148
+ *
149
+ * WU-1302: Centralized to eliminate magic numbers
150
+ * WU-1370: Added graduated drift thresholds for early warnings
151
+ */
152
+ export declare const THRESHOLDS: {
153
+ /** Info threshold: commits behind main to suggest rebasing (WU-1370) */
154
+ BRANCH_DRIFT_INFO: number;
155
+ /** Warning threshold: commits behind main where rebase is recommended (WU-1370) */
156
+ BRANCH_DRIFT_WARNING: number;
157
+ /** Maximum commits behind main before requiring rebase (WU-755 pre-flight) */
158
+ BRANCH_DRIFT_MAX: number;
159
+ };
160
+ /**
161
+ * Default values
162
+ */
163
+ export declare const DEFAULTS: {
164
+ /** Default worktrees directory */
165
+ WORKTREES_DIR: string;
166
+ /** Maximum commit subject length (commitlint default) */
167
+ MAX_COMMIT_SUBJECT: number;
168
+ /** Parent directory traversal depth from tools/lib to project root */
169
+ PROJECT_ROOT_DEPTH: number;
170
+ /**
171
+ * Default email domain for username -> email conversion
172
+ * WU-1068: Made configurable, no longer hardcoded to exampleapp.co.uk
173
+ * @see user-normalizer.ts - Infers from git config first
174
+ */
175
+ EMAIL_DOMAIN: string;
176
+ };
177
+ /**
178
+ * Default values for WU YAML fields
179
+ *
180
+ * WU-1337: Centralized defaults for auto-repair in schema validation
181
+ * DRY principle: Single source of truth for optional field defaults
182
+ *
183
+ * Used by wu-schema.ts Zod transformations to provide sensible defaults
184
+ * when agents omit optional fields, reducing validation errors.
185
+ */
186
+ export declare const WU_DEFAULTS: {
187
+ /** Default priority level (medium priority) */
188
+ priority: string;
189
+ /** Default status for new WUs */
190
+ status: string;
191
+ /** Default work type */
192
+ type: string;
193
+ /** Default code paths (empty until populated) */
194
+ code_paths: string[];
195
+ /** Default test structure (includes all test types) */
196
+ tests: {
197
+ manual: string[];
198
+ unit: string[];
199
+ integration: string[];
200
+ e2e: string[];
201
+ };
202
+ /** Default artifacts (empty - wu:done adds stamp) */
203
+ artifacts: string[];
204
+ /** Default dependencies (no blockers) */
205
+ dependencies: string[];
206
+ /** Default risks (none identified) */
207
+ risks: string[];
208
+ /** Default notes (empty string, not undefined) */
209
+ notes: string;
210
+ /** Default review requirement (agent-completed WUs) */
211
+ requires_review: boolean;
212
+ };
213
+ /**
214
+ * Safety-critical test glob patterns
215
+ *
216
+ * WU-2242: Centralized list of glob patterns for safety tests that MUST exist.
217
+ * Gates fail if UnsafeAny of these patterns find no matches.
218
+ */
219
+ export declare const SAFETY_CRITICAL_TEST_GLOBS: readonly string[];
220
+ /**
221
+ * Lane-to-code_paths validation patterns (WU-1372)
222
+ *
223
+ * Advisory patterns to warn when a WU's lane doesn't match its code_paths.
224
+ */
225
+ export declare const LANE_PATH_PATTERNS: {
226
+ Operations: {
227
+ exclude: string[];
228
+ allowExceptions: string[];
229
+ };
230
+ Intelligence: {
231
+ exclude: string[];
232
+ allowExceptions: string[];
233
+ };
234
+ };
235
+ /**
236
+ * Convert lane name to kebab-case using change-case library
237
+ *
238
+ * @param lane - Lane name (e.g., 'Operations: Tooling')
239
+ * @returns Kebab-case lane (e.g., 'operations-tooling')
240
+ */
241
+ export declare function toKebab(lane: string | null | undefined): string;
242
+ /**
243
+ * Generate worktree path from lane and WU ID
244
+ *
245
+ * @param lane - Lane name
246
+ * @param id - WU ID
247
+ * @returns Worktree path (e.g., 'worktrees/operations-tooling-wu-123')
248
+ */
249
+ export declare function getWorktreePath(lane: string, id: string): string;
250
+ /**
251
+ * Generate lane branch name from lane and WU ID
252
+ *
253
+ * @param lane - Lane name
254
+ * @param id - WU ID
255
+ * @returns Branch name (e.g., 'lane/operations-tooling/wu-123')
256
+ */
257
+ export declare function getLaneBranch(lane: string, id: string): string;
258
+ /**
259
+ * Get project root directory from a module URL
260
+ *
261
+ * WU-923: Centralized path resolution to eliminate '../..' magic strings
262
+ *
263
+ * @param moduleUrl - import.meta.url of the calling module
264
+ * @returns Absolute path to project root
265
+ */
266
+ export declare function getProjectRoot(moduleUrl: string): string;
267
+ /**
268
+ * Options for discovering safety tests
269
+ */
270
+ export interface DiscoverSafetyTestsOptions {
271
+ /** Project root directory */
272
+ projectRoot?: string;
273
+ }
274
+ /**
275
+ * Discover safety-critical test files
276
+ *
277
+ * WU-2242: Scans for test files matching safety-critical patterns.
278
+ * Uses glob to find all matching files.
279
+ *
280
+ * @param options - Discovery options
281
+ * @returns List of discovered test file paths
282
+ */
283
+ export declare function discoverSafetyTests(options?: DiscoverSafetyTestsOptions): Promise<string[]>;
284
+ /**
285
+ * Validate that required safety-critical tests exist
286
+ *
287
+ * WU-2242: Checks that each pattern category has at least one matching test file.
288
+ * Returns a validation result with missing patterns and found files.
289
+ */
290
+ export declare function validateSafetyTestsExist(options?: DiscoverSafetyTestsOptions): Promise<{
291
+ valid: boolean;
292
+ missingTests: string[];
293
+ foundTests: string[];
294
+ error: string | undefined;
295
+ }>;
296
+ //# sourceMappingURL=wu-domain-constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wu-domain-constants.d.ts","sourceRoot":"","sources":["../../../src/constants/wu-domain-constants.ts"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,eAAO,MAAM,QAAQ;IACnB,mCAAmC;;IAGnC,iDAAiD;;IAGjD;;;;;;OAMG;;IAGH,oDAAoD;;IAGpD,2DAA2D;;CAE5D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc;gBACb,MAAM,aAAa,MAAM;eAC1B,MAAM,SAAS,MAAM;iBACnB,MAAM,SAAS,MAAM;eACvB,MAAM;sBACC,MAAM;gBACZ,MAAM;kBACJ,MAAM;iBACP,MAAM;kCACW,MAAM;yBAEf,MAAM;mBAEZ,MAAM;CACtB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;IAC5B,gFAAgF;;IAGhF,qEAAqE;;IAGrE,yDAAyD;;IAGzD,gEAAgE;;IAGhE,mFAAmF;;IAGnF,0DAA0D;;CAE3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;mCACA,MAAM,UAAU,MAAM,gBAAgB,MAAM;;CAG5E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;yCAES,MAAM;CAC5C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO;IAClB,0EAA0E;;CAE3E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU;IACrB,0DAA0D;;CAE3D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,UAAU;IACrB,wEAAwE;;IAGxE,mFAAmF;;IAGnF,8EAA8E;;CAE/E,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ;IACnB,kCAAkC;;IAGlC,yDAAyD;;IAGzD,sEAAsE;;IAGtE;;;;OAIG;;CAEJ,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW;IACtB,+CAA+C;;IAG/C,iCAAiC;;IAGjC,wBAAwB;;IAGxB,iDAAiD;gBAC/B,MAAM,EAAE;IAE1B,uDAAuD;;gBAEvC,MAAM,EAAE;cACV,MAAM,EAAE;qBACD,MAAM,EAAE;aAChB,MAAM,EAAE;;IAGrB,qDAAqD;eACpC,MAAM,EAAE;IAEzB,yCAAyC;kBACrB,MAAM,EAAE;IAE5B,sCAAsC;WACzB,MAAM,EAAE;IAErB,kDAAkD;;IAGlD,uDAAuD;;CAExD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,0BAA0B,mBAoBrC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;yBAGJ,MAAM,EAAE;;;;;;CAMlC,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAK/D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAIhE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAI9D;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CASxD;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,6BAA6B;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,GAAE,0BAA+B,GACvC,OAAO,CAAC,MAAM,EAAE,CAAC,CAkBnB;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,GAAE,0BAA+B;;;;;GA8CtF"}
@@ -0,0 +1,400 @@
1
+ // Copyright (c) 2026 Hellmai Ltd
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+ /**
4
+ * Domain Constants
5
+ *
6
+ * WU-1549: Extracted from wu-constants.ts for domain-specific modularity.
7
+ * Contains WU patterns, commit formats, consistency checks, cleanup guards,
8
+ * defaults, validation thresholds, safety tests, lane path patterns, and
9
+ * utility functions (toKebab, getWorktreePath, getLaneBranch, getProjectRoot).
10
+ *
11
+ * @module wu-domain-constants
12
+ */
13
+ import path from 'node:path';
14
+ import { kebabCase } from 'change-case';
15
+ import { LOG_PREFIX } from './wu-ui-constants.js';
16
+ /**
17
+ * Regex patterns for WU operations
18
+ *
19
+ * Note: WU_ID pattern is also in wu-schema.ts for Zod validation
20
+ */
21
+ export const PATTERNS = {
22
+ /** WU identifier format: WU-123 */
23
+ WU_ID: /^WU-\d+$/,
24
+ /** Extract WU ID from text: captures "WU-123" */
25
+ WU_ID_EXTRACT: /WU-\d+/,
26
+ /**
27
+ * Extract WU ID from worktree paths (case-insensitive)
28
+ *
29
+ * WU-1090: Worktree names use lowercase like 'framework-core-wu-1090'
30
+ * This pattern matches both 'WU-123' and 'wu-123' to support
31
+ * extracting WU IDs from worktree paths.
32
+ */
33
+ WU_ID_EXTRACT_CI: /wu-\d+/i,
34
+ /** Lane branch format: lane/<lane-kebab>/wu-<id> */
35
+ LANE_BRANCH: /^lane\/[\w-]+\/wu-\d+$/,
36
+ /** Worktree path format: worktrees/<lane-kebab>-wu-<id> */
37
+ WORKTREE_PATH: /^worktrees\/[\w-]+-wu-\d+$/,
38
+ };
39
+ /**
40
+ * Commit message formats
41
+ *
42
+ * These are functions that generate properly formatted commit messages
43
+ */
44
+ export const COMMIT_FORMATS = {
45
+ CLAIM: (id, laneKebab) => `wu(${id}): claim for ${laneKebab} lane`,
46
+ DONE: (id, title) => `wu(${id}): done - ${title}`,
47
+ CREATE: (id, title) => `docs: create ${id.toLowerCase()} for ${title}`,
48
+ EDIT: (id) => `docs: edit ${id.toLowerCase()} spec`,
49
+ SPEC_UPDATE: (id) => `wu(${id.toLowerCase()}): spec update`,
50
+ BLOCK: (id) => `wu(${id}): block`,
51
+ UNBLOCK: (id) => `wu(${id}): unblock`,
52
+ REPAIR: (id) => `fix(${id}): repair state inconsistency`,
53
+ REBASE_ARTIFACT_CLEANUP: (id) => `chore(${id.toLowerCase()}): remove rebased completion artifacts`,
54
+ BACKLOG_REPAIR: (id) => `chore(repair): repair backlog duplicates for ${id.toLowerCase()}`,
55
+ ESCALATE: (id) => `wu(${id.toLowerCase()}): resolve escalation`,
56
+ };
57
+ /**
58
+ * Consistency check types (WU-1276)
59
+ *
60
+ * Layer 2 defense-in-depth: detect and repair WU state inconsistencies
61
+ */
62
+ export const CONSISTENCY_TYPES = {
63
+ /** WU YAML has status 'done' but WU appears in status.md In Progress section */
64
+ YAML_DONE_STATUS_IN_PROGRESS: 'YAML_DONE_STATUS_IN_PROGRESS',
65
+ /** WU appears in both Done AND In Progress sections of backlog.md */
66
+ BACKLOG_DUAL_SECTION: 'BACKLOG_DUAL_SECTION',
67
+ /** WU YAML has status 'done' but no stamp file exists */
68
+ YAML_DONE_NO_STAMP: 'YAML_DONE_NO_STAMP',
69
+ /** WU has status 'done' but still has an associated worktree */
70
+ ORPHAN_WORKTREE_DONE: 'ORPHAN_WORKTREE_DONE',
71
+ /** Stamp file exists but WU YAML status is not 'done' (partial wu:done failure) */
72
+ STAMP_EXISTS_YAML_NOT_DONE: 'STAMP_EXISTS_YAML_NOT_DONE',
73
+ /** WU is claimed but its worktree directory is missing */
74
+ MISSING_WORKTREE_CLAIMED: 'MISSING_WORKTREE_CLAIMED',
75
+ };
76
+ /**
77
+ * Consistency check messages
78
+ */
79
+ export const CONSISTENCY_MESSAGES = {
80
+ MISSING_WORKTREE_CLAIMED: (id, status, worktreePath) => `WU ${id} is '${status}' but worktree path is missing (${worktreePath})`,
81
+ MISSING_WORKTREE_CLAIMED_REPAIR: 'Recover worktree or re-claim WU',
82
+ };
83
+ /**
84
+ * Worktree warning messages
85
+ */
86
+ export const WORKTREE_WARNINGS = {
87
+ MISSING_TRACKED_HEADER: 'Tracked worktrees missing on disk (possible manual deletion):',
88
+ MISSING_TRACKED_LINE: (worktreePath) => `Missing: ${worktreePath}`,
89
+ };
90
+ /**
91
+ * Cleanup guard constants
92
+ */
93
+ export const CLEANUP_GUARD = {
94
+ REASONS: {
95
+ UNCOMMITTED_CHANGES: 'UNCOMMITTED_CHANGES',
96
+ UNPUSHED_COMMITS: 'UNPUSHED_COMMITS',
97
+ STATUS_NOT_DONE: 'STATUS_NOT_DONE',
98
+ MISSING_STAMP: 'MISSING_STAMP',
99
+ PR_NOT_MERGED: 'PR_NOT_MERGED',
100
+ },
101
+ TITLES: {
102
+ BLOCKED: 'CLEANUP BLOCKED',
103
+ NEXT_STEPS: 'Next steps:',
104
+ },
105
+ MESSAGES: {
106
+ UNCOMMITTED_CHANGES: 'Worktree has uncommitted changes. Refusing to delete.',
107
+ UNPUSHED_COMMITS: 'Worktree has unpushed commits. Refusing to delete.',
108
+ STATUS_NOT_DONE: 'WU YAML status is not done. Refusing to delete.',
109
+ MISSING_STAMP: 'WU stamp is missing. Refusing to delete.',
110
+ PR_NOT_MERGED: 'PR is not merged (or cannot be verified). Refusing to delete.',
111
+ },
112
+ /* eslint-disable sonarjs/no-duplicate-string -- Intentional: cleanup instructions repeated for each error type for readability */
113
+ NEXT_STEPS: {
114
+ DEFAULT: [
115
+ { text: '1. Resolve the issue above', appendId: false },
116
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
117
+ ],
118
+ UNCOMMITTED_CHANGES: [
119
+ { text: '1. Commit or stash changes in the worktree', appendId: false },
120
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
121
+ ],
122
+ UNPUSHED_COMMITS: [
123
+ { text: '1. Push the lane branch to origin', appendId: false },
124
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
125
+ ],
126
+ STATUS_NOT_DONE: [
127
+ {
128
+ text: `1. Complete the WU with ${LOG_PREFIX.DONE} (creates stamp + done status)`,
129
+ appendId: false,
130
+ },
131
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
132
+ ],
133
+ MISSING_STAMP: [
134
+ { text: '1. Run wu:done to create the stamp file', appendId: false },
135
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
136
+ ],
137
+ PR_NOT_MERGED: [
138
+ { text: '1. Merge the PR in GitHub', appendId: false },
139
+ { text: '2. Re-run: pnpm wu:cleanup --id', appendId: true },
140
+ ],
141
+ },
142
+ /* eslint-enable sonarjs/no-duplicate-string */
143
+ PR_CHECK: {
144
+ START: 'Verifying PR merge status...',
145
+ RESULT: 'PR merge verification via',
146
+ },
147
+ };
148
+ /**
149
+ * Session display constants
150
+ *
151
+ * Emergency fix (Session 2): Centralized from hardcoded magic numbers
152
+ */
153
+ export const SESSION = {
154
+ /** Standard length for displaying session ID prefix (e.g., "sess-123") */
155
+ ID_DISPLAY_LENGTH: 8,
156
+ };
157
+ /**
158
+ * Validation constants
159
+ *
160
+ * WU-1281: Centralized from local constants in validators
161
+ */
162
+ export const VALIDATION = {
163
+ /** Minimum description length for WU spec completeness */
164
+ MIN_DESCRIPTION_LENGTH: 50,
165
+ };
166
+ /**
167
+ * Threshold constants for pre-flight checks
168
+ *
169
+ * WU-1302: Centralized to eliminate magic numbers
170
+ * WU-1370: Added graduated drift thresholds for early warnings
171
+ */
172
+ export const THRESHOLDS = {
173
+ /** Info threshold: commits behind main to suggest rebasing (WU-1370) */
174
+ BRANCH_DRIFT_INFO: 10,
175
+ /** Warning threshold: commits behind main where rebase is recommended (WU-1370) */
176
+ BRANCH_DRIFT_WARNING: 15,
177
+ /** Maximum commits behind main before requiring rebase (WU-755 pre-flight) */
178
+ BRANCH_DRIFT_MAX: 20,
179
+ };
180
+ /**
181
+ * Default values
182
+ */
183
+ export const DEFAULTS = {
184
+ /** Default worktrees directory */
185
+ WORKTREES_DIR: 'worktrees',
186
+ /** Maximum commit subject length (commitlint default) */
187
+ MAX_COMMIT_SUBJECT: 100,
188
+ /** Parent directory traversal depth from tools/lib to project root */
189
+ PROJECT_ROOT_DEPTH: 2,
190
+ /**
191
+ * Default email domain for username -> email conversion
192
+ * WU-1068: Made configurable, no longer hardcoded to exampleapp.co.uk
193
+ * @see user-normalizer.ts - Infers from git config first
194
+ */
195
+ EMAIL_DOMAIN: 'example.com',
196
+ };
197
+ /**
198
+ * Default values for WU YAML fields
199
+ *
200
+ * WU-1337: Centralized defaults for auto-repair in schema validation
201
+ * DRY principle: Single source of truth for optional field defaults
202
+ *
203
+ * Used by wu-schema.ts Zod transformations to provide sensible defaults
204
+ * when agents omit optional fields, reducing validation errors.
205
+ */
206
+ export const WU_DEFAULTS = {
207
+ /** Default priority level (medium priority) */
208
+ priority: 'P2',
209
+ /** Default status for new WUs */
210
+ status: 'ready',
211
+ /** Default work type */
212
+ type: 'feature',
213
+ /** Default code paths (empty until populated) */
214
+ code_paths: [],
215
+ /** Default test structure (includes all test types) */
216
+ tests: {
217
+ manual: [],
218
+ unit: [],
219
+ integration: [],
220
+ e2e: [],
221
+ },
222
+ /** Default artifacts (empty - wu:done adds stamp) */
223
+ artifacts: [],
224
+ /** Default dependencies (no blockers) */
225
+ dependencies: [],
226
+ /** Default risks (none identified) */
227
+ risks: [],
228
+ /** Default notes (empty string, not undefined) */
229
+ notes: '',
230
+ /** Default review requirement (agent-completed WUs) */
231
+ requires_review: false,
232
+ };
233
+ /**
234
+ * Safety-critical test glob patterns
235
+ *
236
+ * WU-2242: Centralized list of glob patterns for safety tests that MUST exist.
237
+ * Gates fail if UnsafeAny of these patterns find no matches.
238
+ */
239
+ export const SAFETY_CRITICAL_TEST_GLOBS = Object.freeze([
240
+ // Escalation trigger tests
241
+ 'apps/web/src/**/*escalation*.test.{ts,tsx}',
242
+ 'apps/web/src/**/*Escalation*.test.{ts,tsx}',
243
+ // Privacy detection tests
244
+ 'apps/web/src/**/*privacy*.test.{ts,tsx}',
245
+ 'apps/web/src/**/*Privacy*.test.{ts,tsx}',
246
+ // Constitutional enforcer tests
247
+ 'apps/web/src/**/*constitutional*.test.{ts,tsx}',
248
+ 'apps/web/src/**/*Constitutional*.test.{ts,tsx}',
249
+ // Safe prompt wrapper tests
250
+ 'apps/web/src/**/*safePrompt*.test.{ts,tsx}',
251
+ 'apps/web/src/**/*SafePrompt*.test.{ts,tsx}',
252
+ // Crisis/emergency handling tests
253
+ 'apps/web/src/**/*crisis*.test.{ts,tsx}',
254
+ 'apps/web/src/**/*Crisis*.test.{ts,tsx}',
255
+ ]);
256
+ /**
257
+ * Lane-to-code_paths validation patterns (WU-1372)
258
+ *
259
+ * Advisory patterns to warn when a WU's lane doesn't match its code_paths.
260
+ */
261
+ export const LANE_PATH_PATTERNS = {
262
+ Operations: {
263
+ exclude: ['ai/prompts/**', 'apps/web/src/lib/prompts/**'],
264
+ allowExceptions: [],
265
+ },
266
+ Intelligence: {
267
+ exclude: ['tools/**'],
268
+ allowExceptions: ['tools/lib/prompt-*', 'tools/prompts-eval/**'],
269
+ },
270
+ };
271
+ /**
272
+ * Convert lane name to kebab-case using change-case library
273
+ *
274
+ * @param lane - Lane name (e.g., 'Operations: Tooling')
275
+ * @returns Kebab-case lane (e.g., 'operations-tooling')
276
+ */
277
+ export function toKebab(lane) {
278
+ if (lane == null)
279
+ return '';
280
+ const normalized = String(lane).trim();
281
+ if (normalized === '')
282
+ return '';
283
+ return kebabCase(normalized);
284
+ }
285
+ /**
286
+ * Generate worktree path from lane and WU ID
287
+ *
288
+ * @param lane - Lane name
289
+ * @param id - WU ID
290
+ * @returns Worktree path (e.g., 'worktrees/operations-tooling-wu-123')
291
+ */
292
+ export function getWorktreePath(lane, id) {
293
+ const laneKebab = toKebab(lane);
294
+ const idLower = id.toLowerCase();
295
+ return `${DEFAULTS.WORKTREES_DIR}/${laneKebab}-${idLower}`;
296
+ }
297
+ /**
298
+ * Generate lane branch name from lane and WU ID
299
+ *
300
+ * @param lane - Lane name
301
+ * @param id - WU ID
302
+ * @returns Branch name (e.g., 'lane/operations-tooling/wu-123')
303
+ */
304
+ export function getLaneBranch(lane, id) {
305
+ const laneKebab = toKebab(lane);
306
+ const idLower = id.toLowerCase();
307
+ return `lane/${laneKebab}/${idLower}`;
308
+ }
309
+ /**
310
+ * Get project root directory from a module URL
311
+ *
312
+ * WU-923: Centralized path resolution to eliminate '../..' magic strings
313
+ *
314
+ * @param moduleUrl - import.meta.url of the calling module
315
+ * @returns Absolute path to project root
316
+ */
317
+ export function getProjectRoot(moduleUrl) {
318
+ const { dirname } = path;
319
+ const currentDir = dirname(new URL(moduleUrl).pathname);
320
+ let root = currentDir;
321
+ for (let i = 0; i < DEFAULTS.PROJECT_ROOT_DEPTH; i++) {
322
+ root = dirname(root);
323
+ }
324
+ return root;
325
+ }
326
+ /**
327
+ * Discover safety-critical test files
328
+ *
329
+ * WU-2242: Scans for test files matching safety-critical patterns.
330
+ * Uses glob to find all matching files.
331
+ *
332
+ * @param options - Discovery options
333
+ * @returns List of discovered test file paths
334
+ */
335
+ export async function discoverSafetyTests(options = {}) {
336
+ const { projectRoot = process.cwd() } = options;
337
+ const { glob } = await import('glob');
338
+ const foundFiles = [];
339
+ for (const pattern of SAFETY_CRITICAL_TEST_GLOBS) {
340
+ try {
341
+ const matches = await glob(pattern, {
342
+ cwd: projectRoot,
343
+ absolute: false,
344
+ });
345
+ foundFiles.push(...matches);
346
+ }
347
+ catch {
348
+ // Pattern may not match anything, that's fine
349
+ }
350
+ }
351
+ return [...new Set(foundFiles)]; // Deduplicate
352
+ }
353
+ /**
354
+ * Validate that required safety-critical tests exist
355
+ *
356
+ * WU-2242: Checks that each pattern category has at least one matching test file.
357
+ * Returns a validation result with missing patterns and found files.
358
+ */
359
+ export async function validateSafetyTestsExist(options = {}) {
360
+ const { projectRoot = process.cwd() } = options;
361
+ const { glob } = await import('glob');
362
+ const missingTests = [];
363
+ const foundTests = [];
364
+ const categories = [
365
+ { name: 'Escalation', patterns: SAFETY_CRITICAL_TEST_GLOBS.slice(0, 2) },
366
+ { name: 'Privacy detection', patterns: SAFETY_CRITICAL_TEST_GLOBS.slice(2, 4) },
367
+ { name: 'Constitutional', patterns: SAFETY_CRITICAL_TEST_GLOBS.slice(4, 6) },
368
+ { name: 'Safe prompt wrapper', patterns: SAFETY_CRITICAL_TEST_GLOBS.slice(6, 8) },
369
+ { name: 'Crisis handling', patterns: SAFETY_CRITICAL_TEST_GLOBS.slice(8, 10) },
370
+ ];
371
+ for (const category of categories) {
372
+ let categoryHasTests = false;
373
+ for (const pattern of category.patterns) {
374
+ try {
375
+ const matches = await glob(pattern, {
376
+ cwd: projectRoot,
377
+ absolute: false,
378
+ });
379
+ if (matches.length > 0) {
380
+ categoryHasTests = true;
381
+ foundTests.push(...matches);
382
+ }
383
+ }
384
+ catch {
385
+ // Pattern error, treat as no matches
386
+ }
387
+ }
388
+ if (!categoryHasTests) {
389
+ missingTests.push(`${category.name}: ${category.patterns.join(', ')}`);
390
+ }
391
+ }
392
+ const valid = missingTests.length === 0;
393
+ return {
394
+ valid,
395
+ missingTests,
396
+ foundTests: [...new Set(foundTests)],
397
+ error: valid ? undefined : `Missing safety-critical tests: ${missingTests.join('; ')}`,
398
+ };
399
+ }
400
+ //# sourceMappingURL=wu-domain-constants.js.map