@lumenflow/core 1.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 (263) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +119 -0
  3. package/dist/active-wu-detector.d.ts +33 -0
  4. package/dist/active-wu-detector.js +106 -0
  5. package/dist/adapters/filesystem-metrics.adapter.d.ts +108 -0
  6. package/dist/adapters/filesystem-metrics.adapter.js +519 -0
  7. package/dist/adapters/terminal-renderer.adapter.d.ts +106 -0
  8. package/dist/adapters/terminal-renderer.adapter.js +337 -0
  9. package/dist/arg-parser.d.ts +63 -0
  10. package/dist/arg-parser.js +560 -0
  11. package/dist/backlog-editor.d.ts +98 -0
  12. package/dist/backlog-editor.js +179 -0
  13. package/dist/backlog-generator.d.ts +111 -0
  14. package/dist/backlog-generator.js +381 -0
  15. package/dist/backlog-parser.d.ts +45 -0
  16. package/dist/backlog-parser.js +102 -0
  17. package/dist/backlog-sync-validator.d.ts +78 -0
  18. package/dist/backlog-sync-validator.js +294 -0
  19. package/dist/branch-drift.d.ts +34 -0
  20. package/dist/branch-drift.js +51 -0
  21. package/dist/cleanup-install-config.d.ts +33 -0
  22. package/dist/cleanup-install-config.js +37 -0
  23. package/dist/cleanup-lock.d.ts +139 -0
  24. package/dist/cleanup-lock.js +313 -0
  25. package/dist/code-path-validator.d.ts +146 -0
  26. package/dist/code-path-validator.js +537 -0
  27. package/dist/code-paths-overlap.d.ts +55 -0
  28. package/dist/code-paths-overlap.js +245 -0
  29. package/dist/commands-logger.d.ts +77 -0
  30. package/dist/commands-logger.js +254 -0
  31. package/dist/commit-message-utils.d.ts +25 -0
  32. package/dist/commit-message-utils.js +41 -0
  33. package/dist/compliance-parser.d.ts +150 -0
  34. package/dist/compliance-parser.js +507 -0
  35. package/dist/constants/backlog-patterns.d.ts +20 -0
  36. package/dist/constants/backlog-patterns.js +23 -0
  37. package/dist/constants/dora-constants.d.ts +49 -0
  38. package/dist/constants/dora-constants.js +53 -0
  39. package/dist/constants/gate-constants.d.ts +15 -0
  40. package/dist/constants/gate-constants.js +15 -0
  41. package/dist/constants/linter-constants.d.ts +16 -0
  42. package/dist/constants/linter-constants.js +16 -0
  43. package/dist/constants/tokenizer-constants.d.ts +15 -0
  44. package/dist/constants/tokenizer-constants.js +15 -0
  45. package/dist/core/scope-checker.d.ts +97 -0
  46. package/dist/core/scope-checker.js +163 -0
  47. package/dist/core/tool-runner.d.ts +161 -0
  48. package/dist/core/tool-runner.js +393 -0
  49. package/dist/core/tool.constants.d.ts +105 -0
  50. package/dist/core/tool.constants.js +101 -0
  51. package/dist/core/tool.schemas.d.ts +226 -0
  52. package/dist/core/tool.schemas.js +226 -0
  53. package/dist/core/worktree-guard.d.ts +130 -0
  54. package/dist/core/worktree-guard.js +242 -0
  55. package/dist/coverage-gate.d.ts +108 -0
  56. package/dist/coverage-gate.js +196 -0
  57. package/dist/date-utils.d.ts +75 -0
  58. package/dist/date-utils.js +140 -0
  59. package/dist/dependency-graph.d.ts +142 -0
  60. package/dist/dependency-graph.js +550 -0
  61. package/dist/dependency-guard.d.ts +54 -0
  62. package/dist/dependency-guard.js +142 -0
  63. package/dist/dependency-validator.d.ts +105 -0
  64. package/dist/dependency-validator.js +154 -0
  65. package/dist/docs-path-validator.d.ts +36 -0
  66. package/dist/docs-path-validator.js +95 -0
  67. package/dist/domain/orchestration.constants.d.ts +99 -0
  68. package/dist/domain/orchestration.constants.js +97 -0
  69. package/dist/domain/orchestration.schemas.d.ts +280 -0
  70. package/dist/domain/orchestration.schemas.js +211 -0
  71. package/dist/domain/orchestration.types.d.ts +133 -0
  72. package/dist/domain/orchestration.types.js +12 -0
  73. package/dist/error-handler.d.ts +116 -0
  74. package/dist/error-handler.js +136 -0
  75. package/dist/file-classifiers.d.ts +62 -0
  76. package/dist/file-classifiers.js +108 -0
  77. package/dist/gates-agent-mode.d.ts +81 -0
  78. package/dist/gates-agent-mode.js +94 -0
  79. package/dist/generate-traceability.d.ts +107 -0
  80. package/dist/generate-traceability.js +411 -0
  81. package/dist/git-adapter.d.ts +395 -0
  82. package/dist/git-adapter.js +649 -0
  83. package/dist/git-staged-validator.d.ts +32 -0
  84. package/dist/git-staged-validator.js +48 -0
  85. package/dist/hardcoded-strings.d.ts +61 -0
  86. package/dist/hardcoded-strings.js +270 -0
  87. package/dist/incremental-lint.d.ts +78 -0
  88. package/dist/incremental-lint.js +129 -0
  89. package/dist/incremental-test.d.ts +39 -0
  90. package/dist/incremental-test.js +61 -0
  91. package/dist/index.d.ts +42 -0
  92. package/dist/index.js +61 -0
  93. package/dist/invariants/check-automated-tests.d.ts +50 -0
  94. package/dist/invariants/check-automated-tests.js +166 -0
  95. package/dist/invariants-runner.d.ts +103 -0
  96. package/dist/invariants-runner.js +527 -0
  97. package/dist/lane-checker.d.ts +50 -0
  98. package/dist/lane-checker.js +319 -0
  99. package/dist/lane-inference.d.ts +39 -0
  100. package/dist/lane-inference.js +195 -0
  101. package/dist/lane-lock.d.ts +211 -0
  102. package/dist/lane-lock.js +474 -0
  103. package/dist/lane-validator.d.ts +48 -0
  104. package/dist/lane-validator.js +114 -0
  105. package/dist/logs-lib.d.ts +104 -0
  106. package/dist/logs-lib.js +207 -0
  107. package/dist/lumenflow-config-schema.d.ts +272 -0
  108. package/dist/lumenflow-config-schema.js +207 -0
  109. package/dist/lumenflow-config.d.ts +95 -0
  110. package/dist/lumenflow-config.js +236 -0
  111. package/dist/manual-test-validator.d.ts +80 -0
  112. package/dist/manual-test-validator.js +200 -0
  113. package/dist/merge-lock.d.ts +115 -0
  114. package/dist/merge-lock.js +251 -0
  115. package/dist/micro-worktree.d.ts +159 -0
  116. package/dist/micro-worktree.js +427 -0
  117. package/dist/migration-deployer.d.ts +69 -0
  118. package/dist/migration-deployer.js +151 -0
  119. package/dist/orchestration-advisory-loader.d.ts +28 -0
  120. package/dist/orchestration-advisory-loader.js +87 -0
  121. package/dist/orchestration-advisory.d.ts +58 -0
  122. package/dist/orchestration-advisory.js +94 -0
  123. package/dist/orchestration-di.d.ts +48 -0
  124. package/dist/orchestration-di.js +57 -0
  125. package/dist/orchestration-rules.d.ts +57 -0
  126. package/dist/orchestration-rules.js +201 -0
  127. package/dist/orphan-detector.d.ts +131 -0
  128. package/dist/orphan-detector.js +226 -0
  129. package/dist/path-classifiers.d.ts +57 -0
  130. package/dist/path-classifiers.js +93 -0
  131. package/dist/piped-command-detector.d.ts +34 -0
  132. package/dist/piped-command-detector.js +64 -0
  133. package/dist/ports/dashboard-renderer.port.d.ts +112 -0
  134. package/dist/ports/dashboard-renderer.port.js +25 -0
  135. package/dist/ports/metrics-collector.port.d.ts +132 -0
  136. package/dist/ports/metrics-collector.port.js +26 -0
  137. package/dist/process-detector.d.ts +84 -0
  138. package/dist/process-detector.js +172 -0
  139. package/dist/prompt-linter.d.ts +72 -0
  140. package/dist/prompt-linter.js +312 -0
  141. package/dist/prompt-monitor.d.ts +15 -0
  142. package/dist/prompt-monitor.js +205 -0
  143. package/dist/rebase-artifact-cleanup.d.ts +145 -0
  144. package/dist/rebase-artifact-cleanup.js +433 -0
  145. package/dist/retry-strategy.d.ts +189 -0
  146. package/dist/retry-strategy.js +283 -0
  147. package/dist/risk-detector.d.ts +108 -0
  148. package/dist/risk-detector.js +252 -0
  149. package/dist/rollback-utils.d.ts +76 -0
  150. package/dist/rollback-utils.js +104 -0
  151. package/dist/section-headings.d.ts +43 -0
  152. package/dist/section-headings.js +49 -0
  153. package/dist/spawn-escalation.d.ts +90 -0
  154. package/dist/spawn-escalation.js +253 -0
  155. package/dist/spawn-monitor.d.ts +229 -0
  156. package/dist/spawn-monitor.js +672 -0
  157. package/dist/spawn-recovery.d.ts +82 -0
  158. package/dist/spawn-recovery.js +298 -0
  159. package/dist/spawn-registry-schema.d.ts +98 -0
  160. package/dist/spawn-registry-schema.js +108 -0
  161. package/dist/spawn-registry-store.d.ts +146 -0
  162. package/dist/spawn-registry-store.js +273 -0
  163. package/dist/spawn-tree.d.ts +121 -0
  164. package/dist/spawn-tree.js +285 -0
  165. package/dist/stamp-status-validator.d.ts +84 -0
  166. package/dist/stamp-status-validator.js +134 -0
  167. package/dist/stamp-utils.d.ts +100 -0
  168. package/dist/stamp-utils.js +229 -0
  169. package/dist/state-machine.d.ts +26 -0
  170. package/dist/state-machine.js +83 -0
  171. package/dist/system-map-validator.d.ts +80 -0
  172. package/dist/system-map-validator.js +272 -0
  173. package/dist/telemetry.d.ts +80 -0
  174. package/dist/telemetry.js +213 -0
  175. package/dist/token-counter.d.ts +51 -0
  176. package/dist/token-counter.js +145 -0
  177. package/dist/usecases/get-dashboard-data.usecase.d.ts +52 -0
  178. package/dist/usecases/get-dashboard-data.usecase.js +61 -0
  179. package/dist/usecases/get-suggestions.usecase.d.ts +100 -0
  180. package/dist/usecases/get-suggestions.usecase.js +153 -0
  181. package/dist/user-normalizer.d.ts +41 -0
  182. package/dist/user-normalizer.js +141 -0
  183. package/dist/validators/phi-constants.d.ts +97 -0
  184. package/dist/validators/phi-constants.js +152 -0
  185. package/dist/validators/phi-scanner.d.ts +58 -0
  186. package/dist/validators/phi-scanner.js +215 -0
  187. package/dist/worktree-ownership.d.ts +50 -0
  188. package/dist/worktree-ownership.js +74 -0
  189. package/dist/worktree-scanner.d.ts +103 -0
  190. package/dist/worktree-scanner.js +168 -0
  191. package/dist/worktree-symlink.d.ts +99 -0
  192. package/dist/worktree-symlink.js +359 -0
  193. package/dist/wu-backlog-updater.d.ts +17 -0
  194. package/dist/wu-backlog-updater.js +37 -0
  195. package/dist/wu-checkpoint.d.ts +124 -0
  196. package/dist/wu-checkpoint.js +233 -0
  197. package/dist/wu-claim-helpers.d.ts +26 -0
  198. package/dist/wu-claim-helpers.js +63 -0
  199. package/dist/wu-claim-resume.d.ts +106 -0
  200. package/dist/wu-claim-resume.js +276 -0
  201. package/dist/wu-consistency-checker.d.ts +95 -0
  202. package/dist/wu-consistency-checker.js +567 -0
  203. package/dist/wu-constants.d.ts +1275 -0
  204. package/dist/wu-constants.js +1382 -0
  205. package/dist/wu-create-validators.d.ts +42 -0
  206. package/dist/wu-create-validators.js +93 -0
  207. package/dist/wu-done-branch-only.d.ts +63 -0
  208. package/dist/wu-done-branch-only.js +191 -0
  209. package/dist/wu-done-messages.d.ts +119 -0
  210. package/dist/wu-done-messages.js +185 -0
  211. package/dist/wu-done-pr.d.ts +72 -0
  212. package/dist/wu-done-pr.js +174 -0
  213. package/dist/wu-done-retry-helpers.d.ts +85 -0
  214. package/dist/wu-done-retry-helpers.js +172 -0
  215. package/dist/wu-done-ui.d.ts +37 -0
  216. package/dist/wu-done-ui.js +69 -0
  217. package/dist/wu-done-validators.d.ts +411 -0
  218. package/dist/wu-done-validators.js +1229 -0
  219. package/dist/wu-done-worktree.d.ts +182 -0
  220. package/dist/wu-done-worktree.js +1097 -0
  221. package/dist/wu-helpers.d.ts +128 -0
  222. package/dist/wu-helpers.js +248 -0
  223. package/dist/wu-lint.d.ts +70 -0
  224. package/dist/wu-lint.js +234 -0
  225. package/dist/wu-paths.d.ts +171 -0
  226. package/dist/wu-paths.js +178 -0
  227. package/dist/wu-preflight-validators.d.ts +86 -0
  228. package/dist/wu-preflight-validators.js +251 -0
  229. package/dist/wu-recovery.d.ts +138 -0
  230. package/dist/wu-recovery.js +341 -0
  231. package/dist/wu-repair-core.d.ts +131 -0
  232. package/dist/wu-repair-core.js +669 -0
  233. package/dist/wu-schema-normalization.d.ts +17 -0
  234. package/dist/wu-schema-normalization.js +82 -0
  235. package/dist/wu-schema.d.ts +793 -0
  236. package/dist/wu-schema.js +881 -0
  237. package/dist/wu-spawn-helpers.d.ts +121 -0
  238. package/dist/wu-spawn-helpers.js +271 -0
  239. package/dist/wu-spawn.d.ts +158 -0
  240. package/dist/wu-spawn.js +1306 -0
  241. package/dist/wu-state-schema.d.ts +213 -0
  242. package/dist/wu-state-schema.js +156 -0
  243. package/dist/wu-state-store.d.ts +264 -0
  244. package/dist/wu-state-store.js +691 -0
  245. package/dist/wu-status-transition.d.ts +63 -0
  246. package/dist/wu-status-transition.js +382 -0
  247. package/dist/wu-status-updater.d.ts +25 -0
  248. package/dist/wu-status-updater.js +116 -0
  249. package/dist/wu-transaction-collectors.d.ts +116 -0
  250. package/dist/wu-transaction-collectors.js +272 -0
  251. package/dist/wu-transaction.d.ts +170 -0
  252. package/dist/wu-transaction.js +273 -0
  253. package/dist/wu-validation-constants.d.ts +60 -0
  254. package/dist/wu-validation-constants.js +66 -0
  255. package/dist/wu-validation.d.ts +118 -0
  256. package/dist/wu-validation.js +243 -0
  257. package/dist/wu-validator.d.ts +62 -0
  258. package/dist/wu-validator.js +325 -0
  259. package/dist/wu-yaml-fixer.d.ts +97 -0
  260. package/dist/wu-yaml-fixer.js +264 -0
  261. package/dist/wu-yaml.d.ts +86 -0
  262. package/dist/wu-yaml.js +222 -0
  263. package/package.json +114 -0
@@ -0,0 +1,793 @@
1
+ /**
2
+ * Work Unit YAML Schema
3
+ *
4
+ * Zod schema for runtime validation of WU YAML structure.
5
+ * Provides compile-time type inference and semantic validation.
6
+ *
7
+ * Part of WU-1162: Add Zod schema validation to prevent placeholder WU completions
8
+ * Part of WU-1539: Add BaseWUSchema pattern for create/edit validation
9
+ *
10
+ * Schema Architecture (DRY pattern):
11
+ * - BaseWUSchema: Structural validation only (field types, formats, lengths)
12
+ * - WUSchema: Extends base + placeholder rejection (for wu:claim, wu:done)
13
+ * - ReadyWUSchema: Alias for BaseWUSchema (for wu:create, wu:edit)
14
+ *
15
+ * @see {@link tools/wu-done.mjs} - Consumer (validates spec completeness, uses WUSchema)
16
+ * @see {@link tools/wu-claim.mjs} - Consumer (validates spec completeness, uses WUSchema)
17
+ * @see {@link tools/wu-create.mjs} - Consumer (structural validation, uses ReadyWUSchema)
18
+ * @see {@link tools/wu-edit.mjs} - Consumer (structural validation, uses ReadyWUSchema)
19
+ * @see {@link tools/validate.mjs} - Consumer (CI validation)
20
+ * @see {@link apps/web/src/lib/llm/schemas/orchestrator.ts} - Pattern reference
21
+ */
22
+ import { z } from 'zod';
23
+ /**
24
+ * Placeholder sentinel constant
25
+ *
26
+ * Used in wu:create template generation and validation.
27
+ * Single source of truth for placeholder detection (DRY principle).
28
+ *
29
+ * @example
30
+ * // tools/wu-create.mjs
31
+ * description: `${PLACEHOLDER_SENTINEL} Describe the work...`
32
+ *
33
+ * @example
34
+ * // tools/validate.mjs
35
+ * if (doc.description.includes(PLACEHOLDER_SENTINEL)) { error(); }
36
+ */
37
+ export declare const PLACEHOLDER_SENTINEL = "[PLACEHOLDER]";
38
+ /**
39
+ * Base WU Schema (structural validation only)
40
+ *
41
+ * WU-1539: Used by wu:create and wu:edit for fail-fast structural validation.
42
+ * Allows placeholder markers - only checks field types, formats, and lengths.
43
+ *
44
+ * Use case: Validate WU structure at creation/edit time before placeholders are filled.
45
+ */
46
+ export declare const BaseWUSchema: z.ZodObject<{
47
+ description: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
48
+ acceptance: z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>]>;
49
+ id: z.ZodString;
50
+ title: z.ZodString;
51
+ lane: z.ZodString;
52
+ type: z.ZodDefault<z.ZodEnum<{
53
+ documentation: "documentation";
54
+ process: "process";
55
+ feature: "feature";
56
+ tooling: "tooling";
57
+ bug: "bug";
58
+ chore: "chore";
59
+ refactor: "refactor";
60
+ }>>;
61
+ status: z.ZodDefault<z.ZodEnum<{
62
+ todo: "todo";
63
+ ready: "ready";
64
+ backlog: "backlog";
65
+ in_progress: "in_progress";
66
+ blocked: "blocked";
67
+ done: "done";
68
+ completed: "completed";
69
+ cancelled: "cancelled";
70
+ abandoned: "abandoned";
71
+ deferred: "deferred";
72
+ closed: "closed";
73
+ superseded: "superseded";
74
+ }>>;
75
+ priority: z.ZodDefault<z.ZodEnum<{
76
+ P2: "P2";
77
+ P0: "P0";
78
+ P1: "P1";
79
+ P3: "P3";
80
+ }>>;
81
+ created: z.ZodString;
82
+ code_paths: z.ZodDefault<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
83
+ tests: z.ZodDefault<z.ZodOptional<z.ZodObject<{
84
+ manual: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
85
+ unit: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
86
+ integration: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
87
+ e2e: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
88
+ }, z.core.$strip>>>;
89
+ artifacts: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>>;
90
+ dependencies: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>>;
91
+ initiative: z.ZodOptional<z.ZodString>;
92
+ phase: z.ZodOptional<z.ZodNumber>;
93
+ blocks: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
94
+ blocked_by: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
95
+ labels: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
96
+ spec_refs: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
97
+ file: z.ZodOptional<z.ZodString>;
98
+ section: z.ZodString;
99
+ }, z.core.$strip>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
100
+ file: z.ZodOptional<z.ZodString>;
101
+ section: z.ZodString;
102
+ }, z.core.$strip>]>>]>>;
103
+ risks: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>>;
104
+ notes: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>, z.ZodTransform<string, string | string[]>>;
105
+ requires_review: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
106
+ locked: z.ZodOptional<z.ZodBoolean>;
107
+ completed_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
108
+ claimed_mode: z.ZodOptional<z.ZodEnum<{
109
+ worktree: "worktree";
110
+ "branch-only": "branch-only";
111
+ "worktree-pr": "worktree-pr";
112
+ }>>;
113
+ assigned_to: z.ZodOptional<z.ZodString>;
114
+ claimed_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
115
+ blocked_reason: z.ZodOptional<z.ZodString>;
116
+ worktree_path: z.ZodOptional<z.ZodString>;
117
+ session_id: z.ZodOptional<z.ZodString>;
118
+ agent_sessions: z.ZodOptional<z.ZodArray<z.ZodObject<{
119
+ session_id: z.ZodString;
120
+ started: z.ZodString;
121
+ completed: z.ZodOptional<z.ZodString>;
122
+ agent_type: z.ZodEnum<{
123
+ "claude-code": "claude-code";
124
+ cursor: "cursor";
125
+ copilot: "copilot";
126
+ other: "other";
127
+ }>;
128
+ context_tier: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
129
+ incidents_logged: z.ZodDefault<z.ZodNumber>;
130
+ incidents_major: z.ZodDefault<z.ZodNumber>;
131
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
132
+ }, z.core.$strip>>>;
133
+ exposure: z.ZodOptional<z.ZodEnum<{
134
+ documentation: "documentation";
135
+ ui: "ui";
136
+ api: "api";
137
+ "backend-only": "backend-only";
138
+ }>>;
139
+ user_journey: z.ZodOptional<z.ZodString>;
140
+ ui_pairing_wus: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
141
+ navigation_path: z.ZodOptional<z.ZodString>;
142
+ escalation_triggers: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<{
143
+ budget: "budget";
144
+ phi_pii: "phi_pii";
145
+ security_p0: "security_p0";
146
+ external_compliance: "external_compliance";
147
+ cross_lane_arch: "cross_lane_arch";
148
+ }>>>>;
149
+ requires_human_escalation: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
150
+ approved_by: z.ZodOptional<z.ZodArray<z.ZodString>>;
151
+ approved_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
152
+ escalation_resolved_by: z.ZodOptional<z.ZodString>;
153
+ escalation_resolved_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
154
+ requires_cso_approval: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
155
+ requires_cto_approval: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
156
+ requires_design_approval: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
157
+ }, z.core.$strip>;
158
+ /**
159
+ * Ready WU Schema (alias for BaseWUSchema)
160
+ *
161
+ * WU-1539: Semantic alias for clarity in wu:create and wu:edit.
162
+ * Same validation as BaseWUSchema - allows placeholders, enforces structure.
163
+ */
164
+ export declare const ReadyWUSchema: z.ZodObject<{
165
+ description: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
166
+ acceptance: z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>]>;
167
+ id: z.ZodString;
168
+ title: z.ZodString;
169
+ lane: z.ZodString;
170
+ type: z.ZodDefault<z.ZodEnum<{
171
+ documentation: "documentation";
172
+ process: "process";
173
+ feature: "feature";
174
+ tooling: "tooling";
175
+ bug: "bug";
176
+ chore: "chore";
177
+ refactor: "refactor";
178
+ }>>;
179
+ status: z.ZodDefault<z.ZodEnum<{
180
+ todo: "todo";
181
+ ready: "ready";
182
+ backlog: "backlog";
183
+ in_progress: "in_progress";
184
+ blocked: "blocked";
185
+ done: "done";
186
+ completed: "completed";
187
+ cancelled: "cancelled";
188
+ abandoned: "abandoned";
189
+ deferred: "deferred";
190
+ closed: "closed";
191
+ superseded: "superseded";
192
+ }>>;
193
+ priority: z.ZodDefault<z.ZodEnum<{
194
+ P2: "P2";
195
+ P0: "P0";
196
+ P1: "P1";
197
+ P3: "P3";
198
+ }>>;
199
+ created: z.ZodString;
200
+ code_paths: z.ZodDefault<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
201
+ tests: z.ZodDefault<z.ZodOptional<z.ZodObject<{
202
+ manual: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
203
+ unit: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
204
+ integration: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
205
+ e2e: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
206
+ }, z.core.$strip>>>;
207
+ artifacts: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>>;
208
+ dependencies: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>>;
209
+ initiative: z.ZodOptional<z.ZodString>;
210
+ phase: z.ZodOptional<z.ZodNumber>;
211
+ blocks: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
212
+ blocked_by: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
213
+ labels: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
214
+ spec_refs: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
215
+ file: z.ZodOptional<z.ZodString>;
216
+ section: z.ZodString;
217
+ }, z.core.$strip>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
218
+ file: z.ZodOptional<z.ZodString>;
219
+ section: z.ZodString;
220
+ }, z.core.$strip>]>>]>>;
221
+ risks: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>>;
222
+ notes: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>, z.ZodTransform<string, string | string[]>>;
223
+ requires_review: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
224
+ locked: z.ZodOptional<z.ZodBoolean>;
225
+ completed_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
226
+ claimed_mode: z.ZodOptional<z.ZodEnum<{
227
+ worktree: "worktree";
228
+ "branch-only": "branch-only";
229
+ "worktree-pr": "worktree-pr";
230
+ }>>;
231
+ assigned_to: z.ZodOptional<z.ZodString>;
232
+ claimed_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
233
+ blocked_reason: z.ZodOptional<z.ZodString>;
234
+ worktree_path: z.ZodOptional<z.ZodString>;
235
+ session_id: z.ZodOptional<z.ZodString>;
236
+ agent_sessions: z.ZodOptional<z.ZodArray<z.ZodObject<{
237
+ session_id: z.ZodString;
238
+ started: z.ZodString;
239
+ completed: z.ZodOptional<z.ZodString>;
240
+ agent_type: z.ZodEnum<{
241
+ "claude-code": "claude-code";
242
+ cursor: "cursor";
243
+ copilot: "copilot";
244
+ other: "other";
245
+ }>;
246
+ context_tier: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
247
+ incidents_logged: z.ZodDefault<z.ZodNumber>;
248
+ incidents_major: z.ZodDefault<z.ZodNumber>;
249
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
250
+ }, z.core.$strip>>>;
251
+ exposure: z.ZodOptional<z.ZodEnum<{
252
+ documentation: "documentation";
253
+ ui: "ui";
254
+ api: "api";
255
+ "backend-only": "backend-only";
256
+ }>>;
257
+ user_journey: z.ZodOptional<z.ZodString>;
258
+ ui_pairing_wus: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
259
+ navigation_path: z.ZodOptional<z.ZodString>;
260
+ escalation_triggers: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<{
261
+ budget: "budget";
262
+ phi_pii: "phi_pii";
263
+ security_p0: "security_p0";
264
+ external_compliance: "external_compliance";
265
+ cross_lane_arch: "cross_lane_arch";
266
+ }>>>>;
267
+ requires_human_escalation: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
268
+ approved_by: z.ZodOptional<z.ZodArray<z.ZodString>>;
269
+ approved_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
270
+ escalation_resolved_by: z.ZodOptional<z.ZodString>;
271
+ escalation_resolved_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
272
+ requires_cso_approval: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
273
+ requires_cto_approval: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
274
+ requires_design_approval: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
275
+ }, z.core.$strip>;
276
+ /**
277
+ * Strict WU Schema (structural + placeholder rejection)
278
+ *
279
+ * Validates WU files against LumenFlow requirements:
280
+ * - No placeholder text in done WUs
281
+ * - Minimum description length (50 chars)
282
+ * - Code paths present for non-documentation WUs
283
+ * - Proper status/lane/type enums
284
+ *
285
+ * Used by wu:claim and wu:done to ensure specs are complete.
286
+ * Provides runtime validation and TypeScript type inference.
287
+ */
288
+ export declare const WUSchema: z.ZodObject<{
289
+ description: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
290
+ acceptance: z.ZodUnion<readonly [z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>, z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>]>;
291
+ id: z.ZodString;
292
+ title: z.ZodString;
293
+ lane: z.ZodString;
294
+ type: z.ZodDefault<z.ZodEnum<{
295
+ documentation: "documentation";
296
+ process: "process";
297
+ feature: "feature";
298
+ tooling: "tooling";
299
+ bug: "bug";
300
+ chore: "chore";
301
+ refactor: "refactor";
302
+ }>>;
303
+ status: z.ZodDefault<z.ZodEnum<{
304
+ todo: "todo";
305
+ ready: "ready";
306
+ backlog: "backlog";
307
+ in_progress: "in_progress";
308
+ blocked: "blocked";
309
+ done: "done";
310
+ completed: "completed";
311
+ cancelled: "cancelled";
312
+ abandoned: "abandoned";
313
+ deferred: "deferred";
314
+ closed: "closed";
315
+ superseded: "superseded";
316
+ }>>;
317
+ priority: z.ZodDefault<z.ZodEnum<{
318
+ P2: "P2";
319
+ P0: "P0";
320
+ P1: "P1";
321
+ P3: "P3";
322
+ }>>;
323
+ created: z.ZodString;
324
+ code_paths: z.ZodDefault<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
325
+ tests: z.ZodDefault<z.ZodOptional<z.ZodObject<{
326
+ manual: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
327
+ unit: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
328
+ integration: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
329
+ e2e: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
330
+ }, z.core.$strip>>>;
331
+ artifacts: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>>;
332
+ dependencies: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>>;
333
+ initiative: z.ZodOptional<z.ZodString>;
334
+ phase: z.ZodOptional<z.ZodNumber>;
335
+ blocks: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
336
+ blocked_by: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
337
+ labels: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>;
338
+ spec_refs: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
339
+ file: z.ZodOptional<z.ZodString>;
340
+ section: z.ZodString;
341
+ }, z.core.$strip>, z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
342
+ file: z.ZodOptional<z.ZodString>;
343
+ section: z.ZodString;
344
+ }, z.core.$strip>]>>]>>;
345
+ risks: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>>>;
346
+ notes: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>, z.ZodTransform<string, string | string[]>>;
347
+ requires_review: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
348
+ locked: z.ZodOptional<z.ZodBoolean>;
349
+ completed_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
350
+ claimed_mode: z.ZodOptional<z.ZodEnum<{
351
+ worktree: "worktree";
352
+ "branch-only": "branch-only";
353
+ "worktree-pr": "worktree-pr";
354
+ }>>;
355
+ assigned_to: z.ZodOptional<z.ZodString>;
356
+ claimed_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
357
+ blocked_reason: z.ZodOptional<z.ZodString>;
358
+ worktree_path: z.ZodOptional<z.ZodString>;
359
+ session_id: z.ZodOptional<z.ZodString>;
360
+ agent_sessions: z.ZodOptional<z.ZodArray<z.ZodObject<{
361
+ session_id: z.ZodString;
362
+ started: z.ZodString;
363
+ completed: z.ZodOptional<z.ZodString>;
364
+ agent_type: z.ZodEnum<{
365
+ "claude-code": "claude-code";
366
+ cursor: "cursor";
367
+ copilot: "copilot";
368
+ other: "other";
369
+ }>;
370
+ context_tier: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
371
+ incidents_logged: z.ZodDefault<z.ZodNumber>;
372
+ incidents_major: z.ZodDefault<z.ZodNumber>;
373
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
374
+ }, z.core.$strip>>>;
375
+ exposure: z.ZodOptional<z.ZodEnum<{
376
+ documentation: "documentation";
377
+ ui: "ui";
378
+ api: "api";
379
+ "backend-only": "backend-only";
380
+ }>>;
381
+ user_journey: z.ZodOptional<z.ZodString>;
382
+ ui_pairing_wus: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string[], string[]>>, z.ZodArray<z.ZodString>>>;
383
+ navigation_path: z.ZodOptional<z.ZodString>;
384
+ escalation_triggers: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodEnum<{
385
+ budget: "budget";
386
+ phi_pii: "phi_pii";
387
+ security_p0: "security_p0";
388
+ external_compliance: "external_compliance";
389
+ cross_lane_arch: "cross_lane_arch";
390
+ }>>>>;
391
+ requires_human_escalation: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
392
+ approved_by: z.ZodOptional<z.ZodArray<z.ZodString>>;
393
+ approved_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
394
+ escalation_resolved_by: z.ZodOptional<z.ZodString>;
395
+ escalation_resolved_at: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string, string>>;
396
+ requires_cso_approval: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
397
+ requires_cto_approval: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
398
+ requires_design_approval: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
399
+ }, z.core.$strip>;
400
+ /**
401
+ * TypeScript type inferred from schema
402
+ *
403
+ * Single source of truth for both runtime validation and compile-time types.
404
+ * Replaces manual WU interfaces (DRY principle).
405
+ *
406
+ * Note: Type inference available in TypeScript via z.infer<typeof WUSchema>
407
+ * This is a JavaScript file, so the type export is not needed here.
408
+ *
409
+ * @typedef {import('zod').z.infer<typeof WUSchema>} WU
410
+ */
411
+ /**
412
+ * Validates WU data against strict schema (placeholder rejection)
413
+ *
414
+ * Used by wu:claim and wu:done to ensure specs are complete.
415
+ * Rejects WUs with placeholder markers.
416
+ *
417
+ * @param {unknown} data - Parsed YAML data to validate
418
+ * @returns {z.SafeParseReturnType<WU, WU>} Validation result
419
+ *
420
+ * @example
421
+ * const result = validateWU(yamlData);
422
+ * if (!result.success) {
423
+ * result.error.issues.forEach(issue => {
424
+ * console.error(`${issue.path.join('.')}: ${issue.message}`);
425
+ * });
426
+ * }
427
+ */
428
+ export declare function validateWU(data: any): z.ZodSafeParseResult<{
429
+ id: string;
430
+ title: string;
431
+ lane: string;
432
+ type: "documentation" | "process" | "feature" | "tooling" | "bug" | "chore" | "refactor";
433
+ status: "todo" | "ready" | "backlog" | "in_progress" | "blocked" | "done" | "completed" | "cancelled" | "abandoned" | "deferred" | "closed" | "superseded";
434
+ priority: "P2" | "P0" | "P1" | "P3";
435
+ created: string;
436
+ code_paths: string[];
437
+ tests: {
438
+ manual?: string[];
439
+ unit?: string[];
440
+ integration?: string[];
441
+ e2e?: string[];
442
+ };
443
+ artifacts: string[];
444
+ dependencies: string[];
445
+ risks: string[];
446
+ requires_review: boolean;
447
+ escalation_triggers: ("budget" | "phi_pii" | "security_p0" | "external_compliance" | "cross_lane_arch")[];
448
+ requires_human_escalation: boolean;
449
+ requires_cso_approval: boolean;
450
+ requires_cto_approval: boolean;
451
+ requires_design_approval: boolean;
452
+ description?: string;
453
+ acceptance?: string[] | Record<string, string[]>;
454
+ initiative?: string;
455
+ phase?: number;
456
+ blocks?: string[];
457
+ blocked_by?: string[];
458
+ labels?: string[];
459
+ spec_refs?: {
460
+ section: string;
461
+ file?: string;
462
+ } | (string | {
463
+ section: string;
464
+ file?: string;
465
+ })[];
466
+ notes?: string;
467
+ locked?: boolean;
468
+ completed_at?: string;
469
+ claimed_mode?: "worktree" | "branch-only" | "worktree-pr";
470
+ assigned_to?: string;
471
+ claimed_at?: string;
472
+ blocked_reason?: string;
473
+ worktree_path?: string;
474
+ session_id?: string;
475
+ agent_sessions?: {
476
+ session_id: string;
477
+ started: string;
478
+ agent_type: "claude-code" | "cursor" | "copilot" | "other";
479
+ incidents_logged: number;
480
+ incidents_major: number;
481
+ completed?: string;
482
+ context_tier?: 1 | 2 | 3;
483
+ artifacts?: string[];
484
+ }[];
485
+ exposure?: "documentation" | "ui" | "api" | "backend-only";
486
+ user_journey?: string;
487
+ ui_pairing_wus?: string[];
488
+ navigation_path?: string;
489
+ approved_by?: string[];
490
+ approved_at?: string;
491
+ escalation_resolved_by?: string;
492
+ escalation_resolved_at?: string;
493
+ }>;
494
+ /**
495
+ * Validates WU data against base schema (structural only)
496
+ *
497
+ * WU-1539: Used by wu:create and wu:edit for fail-fast structural validation.
498
+ * Allows placeholder markers - only checks field types, formats, and lengths.
499
+ *
500
+ * @param {unknown} data - Parsed YAML data to validate
501
+ * @returns {z.SafeParseReturnType<WU, WU>} Validation result
502
+ *
503
+ * @example
504
+ * const result = validateReadyWU(yamlData);
505
+ * if (!result.success) {
506
+ * const errors = result.error.issues
507
+ * .map(issue => ` • ${issue.path.join('.')}: ${issue.message}`)
508
+ * .join('\n');
509
+ * die(`WU YAML validation failed:\n\n${errors}`);
510
+ * }
511
+ */
512
+ export declare function validateReadyWU(data: any): z.ZodSafeParseResult<{
513
+ id: string;
514
+ title: string;
515
+ lane: string;
516
+ type: "documentation" | "process" | "feature" | "tooling" | "bug" | "chore" | "refactor";
517
+ status: "todo" | "ready" | "backlog" | "in_progress" | "blocked" | "done" | "completed" | "cancelled" | "abandoned" | "deferred" | "closed" | "superseded";
518
+ priority: "P2" | "P0" | "P1" | "P3";
519
+ created: string;
520
+ code_paths: string[];
521
+ tests: {
522
+ manual?: string[];
523
+ unit?: string[];
524
+ integration?: string[];
525
+ e2e?: string[];
526
+ };
527
+ artifacts: string[];
528
+ dependencies: string[];
529
+ risks: string[];
530
+ requires_review: boolean;
531
+ escalation_triggers: ("budget" | "phi_pii" | "security_p0" | "external_compliance" | "cross_lane_arch")[];
532
+ requires_human_escalation: boolean;
533
+ requires_cso_approval: boolean;
534
+ requires_cto_approval: boolean;
535
+ requires_design_approval: boolean;
536
+ description?: string;
537
+ acceptance?: string[] | Record<string, string[]>;
538
+ initiative?: string;
539
+ phase?: number;
540
+ blocks?: string[];
541
+ blocked_by?: string[];
542
+ labels?: string[];
543
+ spec_refs?: {
544
+ section: string;
545
+ file?: string;
546
+ } | (string | {
547
+ section: string;
548
+ file?: string;
549
+ })[];
550
+ notes?: string;
551
+ locked?: boolean;
552
+ completed_at?: string;
553
+ claimed_mode?: "worktree" | "branch-only" | "worktree-pr";
554
+ assigned_to?: string;
555
+ claimed_at?: string;
556
+ blocked_reason?: string;
557
+ worktree_path?: string;
558
+ session_id?: string;
559
+ agent_sessions?: {
560
+ session_id: string;
561
+ started: string;
562
+ agent_type: "claude-code" | "cursor" | "copilot" | "other";
563
+ incidents_logged: number;
564
+ incidents_major: number;
565
+ completed?: string;
566
+ context_tier?: 1 | 2 | 3;
567
+ artifacts?: string[];
568
+ }[];
569
+ exposure?: "documentation" | "ui" | "api" | "backend-only";
570
+ user_journey?: string;
571
+ ui_pairing_wus?: string[];
572
+ navigation_path?: string;
573
+ approved_by?: string[];
574
+ approved_at?: string;
575
+ escalation_resolved_by?: string;
576
+ escalation_resolved_at?: string;
577
+ }>;
578
+ /**
579
+ * Validates WU spec completeness for done status
580
+ *
581
+ * Additional validation beyond schema for WUs marked as done:
582
+ * - Code paths required for non-documentation WUs
583
+ * - Locked must be true
584
+ * - Completed timestamp must be present
585
+ *
586
+ * @param {WU} wu - Validated WU data
587
+ * @returns {{valid: boolean, errors: string[]}} Validation result
588
+ *
589
+ * @example
590
+ * const schemaResult = validateWU(data);
591
+ * if (schemaResult.success && data.status === 'done') {
592
+ * const completenessResult = validateDoneWU(schemaResult.data);
593
+ * if (!completenessResult.valid) {
594
+ * console.error(completenessResult.errors);
595
+ * }
596
+ * }
597
+ */
598
+ export declare function validateDoneWU(wu: any): {
599
+ valid: boolean;
600
+ errors: any[];
601
+ };
602
+ /**
603
+ * WU-2080: Valid escalation trigger types
604
+ *
605
+ * These are the only conditions that require human intervention.
606
+ * Everything else is auto-approved by agents.
607
+ */
608
+ export declare const ESCALATION_TRIGGER_TYPES: string[];
609
+ /**
610
+ * WU-2080: Agent-first approval validation
611
+ *
612
+ * AGENT-FIRST MODEL: Agents auto-approve by default.
613
+ * Human escalation only when escalation_triggers is non-empty
614
+ * AND requires_human_escalation is true AND not yet resolved.
615
+ *
616
+ * Returns:
617
+ * - valid: true if agent can proceed (no unresolved escalation)
618
+ * - errors: blocking issues requiring human resolution
619
+ * - warnings: advisory messages (non-blocking)
620
+ *
621
+ * @param {object} wu - Validated WU data
622
+ * @returns {{valid: boolean, errors: string[], warnings: string[]}}
623
+ */
624
+ export declare function validateApprovalGates(wu: any): {
625
+ valid: boolean;
626
+ errors: any[];
627
+ warnings: any[];
628
+ };
629
+ /**
630
+ * WU-2080: Detect escalation triggers from WU content
631
+ *
632
+ * Analyzes WU metadata to detect conditions requiring human escalation.
633
+ * Called by wu:claim to auto-set escalation_triggers.
634
+ *
635
+ * @param {object} wu - WU data with lane, type, code_paths
636
+ * @returns {string[]} Array of triggered escalation types
637
+ */
638
+ export declare function detectEscalationTriggers(wu: any): any[];
639
+ /**
640
+ * WU-2080: Generate auto-approval metadata for wu:claim
641
+ *
642
+ * Called by wu:claim to auto-approve agents within policy.
643
+ * Sets approved_by and approved_at, detects escalation triggers.
644
+ *
645
+ * @param {object} wu - WU data
646
+ * @param {string} agentEmail - Email of claiming agent
647
+ * @returns {{approved_by: string[], approved_at: string, escalation_triggers: string[], requires_human_escalation: boolean}}
648
+ */
649
+ export declare function generateAutoApproval(wu: any, agentEmail: any): {
650
+ approved_by: any[];
651
+ approved_at: string;
652
+ escalation_triggers: any[];
653
+ requires_human_escalation: boolean;
654
+ };
655
+ /**
656
+ * @deprecated Use detectEscalationTriggers instead
657
+ * WU-2079: Legacy function for backwards compatibility
658
+ */
659
+ export declare function determineRequiredApprovals(wu: any): {
660
+ requires_cso_approval: boolean;
661
+ requires_cto_approval: boolean;
662
+ requires_design_approval: boolean;
663
+ };
664
+ /**
665
+ * WU-1811: Validates and normalizes WU YAML data with auto-fixable normalisations
666
+ *
667
+ * This function validates the WU YAML schema and applies fixable normalisations:
668
+ * - Trimming whitespace from string fields
669
+ * - Normalizing escaped newlines (\\n → \n)
670
+ * - Splitting embedded newlines in arrays (["a\nb"] → ["a", "b"])
671
+ *
672
+ * Returns:
673
+ * - valid: true if schema validation passes (after normalisations)
674
+ * - normalized: the normalized data (even if validation fails, partial normalization is returned)
675
+ * - errors: validation errors if any
676
+ * - wasNormalized: true if any normalisations were applied
677
+ *
678
+ * @param {unknown} data - Parsed YAML data to validate and normalize
679
+ * @returns {{valid: boolean, normalized: object|null, errors: string[], wasNormalized: boolean}}
680
+ *
681
+ * @example
682
+ * const { valid, normalized, errors, wasNormalized } = validateAndNormalizeWUYAML(yamlData);
683
+ * if (valid && wasNormalized) {
684
+ * // Write normalized data back to YAML file
685
+ * writeWU(wuPath, normalized);
686
+ * }
687
+ * if (!valid) {
688
+ * die(`Validation failed:\n${errors.join('\n')}`);
689
+ * }
690
+ */
691
+ export declare function validateAndNormalizeWUYAML(data: any): {
692
+ valid: boolean;
693
+ normalized: any;
694
+ errors: string[];
695
+ wasNormalized: boolean;
696
+ } | {
697
+ valid: boolean;
698
+ normalized: {
699
+ id: string;
700
+ title: string;
701
+ lane: string;
702
+ type: "documentation" | "process" | "feature" | "tooling" | "bug" | "chore" | "refactor";
703
+ status: "todo" | "ready" | "backlog" | "in_progress" | "blocked" | "done" | "completed" | "cancelled" | "abandoned" | "deferred" | "closed" | "superseded";
704
+ priority: "P2" | "P0" | "P1" | "P3";
705
+ created: string;
706
+ code_paths: string[];
707
+ tests: {
708
+ manual?: string[];
709
+ unit?: string[];
710
+ integration?: string[];
711
+ e2e?: string[];
712
+ };
713
+ artifacts: string[];
714
+ dependencies: string[];
715
+ risks: string[];
716
+ requires_review: boolean;
717
+ escalation_triggers: ("budget" | "phi_pii" | "security_p0" | "external_compliance" | "cross_lane_arch")[];
718
+ requires_human_escalation: boolean;
719
+ requires_cso_approval: boolean;
720
+ requires_cto_approval: boolean;
721
+ requires_design_approval: boolean;
722
+ description?: string;
723
+ acceptance?: string[] | Record<string, string[]>;
724
+ initiative?: string;
725
+ phase?: number;
726
+ blocks?: string[];
727
+ blocked_by?: string[];
728
+ labels?: string[];
729
+ spec_refs?: {
730
+ section: string;
731
+ file?: string;
732
+ } | (string | {
733
+ section: string;
734
+ file?: string;
735
+ })[];
736
+ notes?: string;
737
+ locked?: boolean;
738
+ completed_at?: string;
739
+ claimed_mode?: "worktree" | "branch-only" | "worktree-pr";
740
+ assigned_to?: string;
741
+ claimed_at?: string;
742
+ blocked_reason?: string;
743
+ worktree_path?: string;
744
+ session_id?: string;
745
+ agent_sessions?: {
746
+ session_id: string;
747
+ started: string;
748
+ agent_type: "claude-code" | "cursor" | "copilot" | "other";
749
+ incidents_logged: number;
750
+ incidents_major: number;
751
+ completed?: string;
752
+ context_tier?: 1 | 2 | 3;
753
+ artifacts?: string[];
754
+ }[];
755
+ exposure?: "documentation" | "ui" | "api" | "backend-only";
756
+ user_journey?: string;
757
+ ui_pairing_wus?: string[];
758
+ navigation_path?: string;
759
+ approved_by?: string[];
760
+ approved_at?: string;
761
+ escalation_resolved_by?: string;
762
+ escalation_resolved_at?: string;
763
+ };
764
+ errors: any[];
765
+ wasNormalized: boolean;
766
+ };
767
+ /**
768
+ * WU-1833: Validate WU spec completeness with advisory warnings
769
+ *
770
+ * Provides soft validation that warns (doesn't fail) when recommended fields are missing.
771
+ * Used by wu:validate command to surface quality issues without blocking workflow.
772
+ *
773
+ * Feature and bug WUs should have:
774
+ * - notes (implementation context, deployment instructions)
775
+ * - tests.manual (verification steps)
776
+ * - spec_refs (links to plans, design docs) - for features only
777
+ *
778
+ * @param {object} wu - Validated WU data (must pass WUSchema first)
779
+ * @returns {{warnings: string[]}} Array of warning messages
780
+ *
781
+ * @example
782
+ * const schemaResult = validateWU(data);
783
+ * if (schemaResult.success) {
784
+ * const { warnings } = validateWUCompleteness(schemaResult.data);
785
+ * if (warnings.length > 0) {
786
+ * console.warn('Quality warnings:');
787
+ * warnings.forEach(w => console.warn(` ⚠️ ${w}`));
788
+ * }
789
+ * }
790
+ */
791
+ export declare function validateWUCompleteness(wu: any): {
792
+ warnings: any[];
793
+ };