@lumenflow/cli 5.4.0 → 5.7.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/README.md +42 -40
  2. package/dist/db-journal-recover.js +400 -0
  3. package/dist/db-journal-recover.js.map +1 -0
  4. package/dist/docs-sync.js +8 -3
  5. package/dist/docs-sync.js.map +1 -1
  6. package/dist/gate-defaults.js +191 -9
  7. package/dist/gate-defaults.js.map +1 -1
  8. package/dist/gate-registry.js.map +1 -1
  9. package/dist/gates/monolithic-file-contention-guard.js +167 -0
  10. package/dist/gates/monolithic-file-contention-guard.js.map +1 -0
  11. package/dist/gates/prod-migration-drift.js +207 -0
  12. package/dist/gates/prod-migration-drift.js.map +1 -0
  13. package/dist/gates/test-over-deletion-guard.js +255 -0
  14. package/dist/gates/test-over-deletion-guard.js.map +1 -0
  15. package/dist/gates-runners.js +401 -2
  16. package/dist/gates-runners.js.map +1 -1
  17. package/dist/gates.js +349 -4
  18. package/dist/gates.js.map +1 -1
  19. package/dist/lumenflow-setup.js +144 -0
  20. package/dist/lumenflow-setup.js.map +1 -0
  21. package/dist/lumenflow-upgrade.js +2 -1
  22. package/dist/lumenflow-upgrade.js.map +1 -1
  23. package/dist/mem-create.js +10 -1
  24. package/dist/mem-create.js.map +1 -1
  25. package/dist/mem-signal.js +21 -4
  26. package/dist/mem-signal.js.map +1 -1
  27. package/dist/metrics-cli.js +19 -2
  28. package/dist/metrics-cli.js.map +1 -1
  29. package/dist/metrics-snapshot.js +25 -2
  30. package/dist/metrics-snapshot.js.map +1 -1
  31. package/dist/orchestrate-initiative.js +28 -3
  32. package/dist/orchestrate-initiative.js.map +1 -1
  33. package/dist/public-manifest.js +17 -0
  34. package/dist/public-manifest.js.map +1 -1
  35. package/dist/release.js +53 -18
  36. package/dist/release.js.map +1 -1
  37. package/dist/wu-done-gates.js +121 -8
  38. package/dist/wu-done-gates.js.map +1 -1
  39. package/dist/wu-done.js +30 -6
  40. package/dist/wu-done.js.map +1 -1
  41. package/dist/wu-edit-operations.js +74 -0
  42. package/dist/wu-edit-operations.js.map +1 -1
  43. package/dist/wu-edit-validators.js +58 -0
  44. package/dist/wu-edit-validators.js.map +1 -1
  45. package/dist/wu-edit.js +106 -4
  46. package/dist/wu-edit.js.map +1 -1
  47. package/dist/wu-prep.js +132 -8
  48. package/dist/wu-prep.js.map +1 -1
  49. package/dist/wu-recover.js +6 -0
  50. package/dist/wu-recover.js.map +1 -1
  51. package/dist/wu-release.js +120 -2
  52. package/dist/wu-release.js.map +1 -1
  53. package/dist/wu-sizing-validation.js +47 -17
  54. package/dist/wu-sizing-validation.js.map +1 -1
  55. package/dist/wu-status.js +33 -0
  56. package/dist/wu-status.js.map +1 -1
  57. package/package.json +13 -11
  58. package/packs/agent-runtime/package.json +1 -1
  59. package/packs/sidekick/package.json +1 -1
  60. package/packs/software-delivery/package.json +1 -1
  61. package/templates/core/AGENTS.md.template +162 -26
  62. package/templates/core/LUMENFLOW.md.template +381 -70
  63. package/templates/core/ai/onboarding/agent-invocation-guide.md.template +0 -5
  64. package/templates/core/ai/onboarding/agent-safety-card.md.template +63 -17
  65. package/templates/core/ai/onboarding/initiative-orchestration.md.template +4 -0
  66. package/templates/core/ai/onboarding/release-process.md.template +7 -7
  67. package/templates/core/ai/onboarding/vendor-support.md.template +74 -10
  68. package/templates/vendors/claude/.claude/skills/frontend-design/SKILL.md.template +1 -1
  69. package/templates/vendors/claude/.claude/skills/wu-lifecycle/SKILL.md.template +28 -0
  70. package/packs/agent-runtime/agent-heartbeat.ts +0 -163
  71. package/packs/agent-runtime/auto-session-integration.ts +0 -888
  72. package/packs/agent-runtime/capability-factory.ts +0 -104
  73. package/packs/agent-runtime/constants.ts +0 -21
  74. package/packs/agent-runtime/delegation-registry-schema.ts +0 -220
  75. package/packs/agent-runtime/delegation-registry-store.ts +0 -269
  76. package/packs/agent-runtime/delegation-tree.ts +0 -328
  77. package/packs/agent-runtime/index.ts +0 -20
  78. package/packs/agent-runtime/manifest.ts +0 -348
  79. package/packs/agent-runtime/memory-coordination-contract.ts +0 -86
  80. package/packs/agent-runtime/orchestration.ts +0 -2027
  81. package/packs/agent-runtime/pack-registration.ts +0 -110
  82. package/packs/agent-runtime/policy-factory.ts +0 -165
  83. package/packs/agent-runtime/remote-controls/index.ts +0 -7
  84. package/packs/agent-runtime/remote-controls/operations.ts +0 -405
  85. package/packs/agent-runtime/remote-controls/port.ts +0 -48
  86. package/packs/agent-runtime/remote-controls/state-store.ts +0 -258
  87. package/packs/agent-runtime/remote-controls/types.ts +0 -105
  88. package/packs/agent-runtime/session-schema.ts +0 -467
  89. package/packs/agent-runtime/tool-impl/agent-turn-tools.ts +0 -793
  90. package/packs/agent-runtime/tool-impl/index.ts +0 -6
  91. package/packs/agent-runtime/tool-impl/provider-adapters.ts +0 -1245
  92. package/packs/agent-runtime/tool-impl/remote-controls.mock.ts +0 -256
  93. package/packs/agent-runtime/tool-impl/remote-controls.ts +0 -273
  94. package/packs/agent-runtime/tools/index.ts +0 -4
  95. package/packs/agent-runtime/tools/types.ts +0 -47
  96. package/packs/agent-runtime/turn-lifecycle-events.ts +0 -590
  97. package/packs/agent-runtime/types.ts +0 -128
  98. package/packs/agent-runtime/vitest.config.ts +0 -11
  99. package/packs/sidekick/channel-ingress.ts +0 -137
  100. package/packs/sidekick/constants.ts +0 -10
  101. package/packs/sidekick/index.ts +0 -8
  102. package/packs/sidekick/manifest-schema.ts +0 -49
  103. package/packs/sidekick/manifest.ts +0 -512
  104. package/packs/sidekick/pack-registration.ts +0 -110
  105. package/packs/sidekick/policy-factory.ts +0 -38
  106. package/packs/sidekick/sidekick-events.ts +0 -694
  107. package/packs/sidekick/src/adapters/cloud-queue.ts +0 -101
  108. package/packs/sidekick/src/adapters/control-plane-bridge.adapter.ts +0 -386
  109. package/packs/sidekick/src/adapters/filesystem-bridge.adapter.ts +0 -228
  110. package/packs/sidekick/src/domain/channel.types.ts +0 -64
  111. package/packs/sidekick/src/ports/channel-bridge.port.ts +0 -92
  112. package/packs/sidekick/src/routines/commit.ts +0 -74
  113. package/packs/sidekick/tool-impl/channel-tools.ts +0 -577
  114. package/packs/sidekick/tool-impl/channel-transports.ts +0 -75
  115. package/packs/sidekick/tool-impl/index.ts +0 -29
  116. package/packs/sidekick/tool-impl/memory-tools.ts +0 -290
  117. package/packs/sidekick/tool-impl/routine-commit.ts +0 -102
  118. package/packs/sidekick/tool-impl/routine-tools.ts +0 -440
  119. package/packs/sidekick/tool-impl/runtime-context.ts +0 -28
  120. package/packs/sidekick/tool-impl/shared.ts +0 -125
  121. package/packs/sidekick/tool-impl/storage.ts +0 -325
  122. package/packs/sidekick/tool-impl/system-tools.ts +0 -160
  123. package/packs/sidekick/tool-impl/task-tools.ts +0 -506
  124. package/packs/sidekick/tools/channel-tools.ts +0 -53
  125. package/packs/sidekick/tools/index.ts +0 -9
  126. package/packs/sidekick/tools/memory-tools.ts +0 -53
  127. package/packs/sidekick/tools/routine-tools.ts +0 -53
  128. package/packs/sidekick/tools/system-tools.ts +0 -47
  129. package/packs/sidekick/tools/task-tools.ts +0 -61
  130. package/packs/sidekick/tools/types.ts +0 -57
  131. package/packs/sidekick/vitest.config.ts +0 -11
  132. package/packs/software-delivery/constants.ts +0 -10
  133. package/packs/software-delivery/extensions.ts +0 -140
  134. package/packs/software-delivery/gate-policies.ts +0 -134
  135. package/packs/software-delivery/index.ts +0 -8
  136. package/packs/software-delivery/manifest-schema.ts +0 -268
  137. package/packs/software-delivery/manifest.ts +0 -657
  138. package/packs/software-delivery/pack-registration.ts +0 -113
  139. package/packs/software-delivery/src/commands/index.ts +0 -5
  140. package/packs/software-delivery/src/config/delivery-review-contract.ts +0 -256
  141. package/packs/software-delivery/src/config/env-accessors.ts +0 -66
  142. package/packs/software-delivery/src/config/index.ts +0 -8
  143. package/packs/software-delivery/src/config/normalize-config-keys.ts +0 -9
  144. package/packs/software-delivery/src/config/schemas/lumenflow-config-schema-types.ts +0 -460
  145. package/packs/software-delivery/src/config/workspace-reader.ts +0 -375
  146. package/packs/software-delivery/src/constants/backlog-patterns.ts +0 -31
  147. package/packs/software-delivery/src/constants/client-ids.ts +0 -19
  148. package/packs/software-delivery/src/constants/config-contract.ts +0 -7
  149. package/packs/software-delivery/src/constants/docs-layout-presets.ts +0 -50
  150. package/packs/software-delivery/src/constants/duration-constants.ts +0 -20
  151. package/packs/software-delivery/src/constants/gate-constants.ts +0 -32
  152. package/packs/software-delivery/src/constants/index.ts +0 -29
  153. package/packs/software-delivery/src/constants/lock-constants.ts +0 -35
  154. package/packs/software-delivery/src/constants/object-guards.ts +0 -12
  155. package/packs/software-delivery/src/constants/section-headings.ts +0 -107
  156. package/packs/software-delivery/src/constants/wu-cli-constants.ts +0 -488
  157. package/packs/software-delivery/src/constants/wu-domain-constants.ts +0 -466
  158. package/packs/software-delivery/src/constants/wu-git-constants.ts +0 -7
  159. package/packs/software-delivery/src/constants/wu-id-format.ts +0 -327
  160. package/packs/software-delivery/src/constants/wu-paths-constants.ts +0 -384
  161. package/packs/software-delivery/src/constants/wu-statuses.ts +0 -287
  162. package/packs/software-delivery/src/constants/wu-type-helpers.ts +0 -67
  163. package/packs/software-delivery/src/constants/wu-ui-constants.ts +0 -267
  164. package/packs/software-delivery/src/constants/wu-validation-constants.ts +0 -73
  165. package/packs/software-delivery/src/domain/index.ts +0 -5
  166. package/packs/software-delivery/src/domain/orchestration.constants.ts +0 -166
  167. package/packs/software-delivery/src/domain/orchestration.schemas.ts +0 -238
  168. package/packs/software-delivery/src/domain/orchestration.types.ts +0 -176
  169. package/packs/software-delivery/src/methodology/incremental-test.ts +0 -122
  170. package/packs/software-delivery/src/methodology/index.ts +0 -6
  171. package/packs/software-delivery/src/methodology/manual-test-validator.ts +0 -292
  172. package/packs/software-delivery/src/policy/coverage-gate.ts +0 -270
  173. package/packs/software-delivery/src/policy/gates-agent-mode.ts +0 -223
  174. package/packs/software-delivery/src/policy/gates-config-internal.ts +0 -121
  175. package/packs/software-delivery/src/policy/gates-config.ts +0 -300
  176. package/packs/software-delivery/src/policy/gates-coverage.ts +0 -356
  177. package/packs/software-delivery/src/policy/gates-presets.ts +0 -134
  178. package/packs/software-delivery/src/policy/gates-schemas.ts +0 -173
  179. package/packs/software-delivery/src/policy/index.ts +0 -22
  180. package/packs/software-delivery/src/policy/package-manager-resolver.ts +0 -319
  181. package/packs/software-delivery/src/policy/resolve-policy.ts +0 -601
  182. package/packs/software-delivery/src/ports/config.ports.ts +0 -90
  183. package/packs/software-delivery/src/ports/dashboard-renderer.port.ts +0 -125
  184. package/packs/software-delivery/src/ports/index.ts +0 -10
  185. package/packs/software-delivery/src/ports/sync-validator.ports.ts +0 -59
  186. package/packs/software-delivery/src/ports/wu-helpers.ports.ts +0 -168
  187. package/packs/software-delivery/src/ports/wu-state.ports.ts +0 -241
  188. package/packs/software-delivery/src/primitives/index.ts +0 -5
  189. package/packs/software-delivery/src/runtime/index.ts +0 -6
  190. package/packs/software-delivery/src/runtime/work-classifier.ts +0 -561
  191. package/packs/software-delivery/src/sandbox/index.ts +0 -10
  192. package/packs/software-delivery/src/sandbox/sandbox-allowlist.ts +0 -118
  193. package/packs/software-delivery/src/sandbox/sandbox-backend-linux.ts +0 -88
  194. package/packs/software-delivery/src/sandbox/sandbox-backend-macos.ts +0 -154
  195. package/packs/software-delivery/src/sandbox/sandbox-backend-windows.ts +0 -47
  196. package/packs/software-delivery/src/sandbox/sandbox-profile.ts +0 -153
  197. package/packs/software-delivery/src/schemas/index.ts +0 -5
  198. package/packs/software-delivery/src/state/date-utils.ts +0 -158
  199. package/packs/software-delivery/src/state/index.ts +0 -15
  200. package/packs/software-delivery/src/state/state-machine.ts +0 -119
  201. package/packs/software-delivery/src/state/wu-doc-types.ts +0 -51
  202. package/packs/software-delivery/src/state/wu-paths.ts +0 -381
  203. package/packs/software-delivery/src/state/wu-schema.ts +0 -1139
  204. package/packs/software-delivery/src/state/wu-state-schema.ts +0 -255
  205. package/packs/software-delivery/src/state/wu-yaml.ts +0 -338
  206. package/packs/software-delivery/tool-impl/agent-tools.ts +0 -263
  207. package/packs/software-delivery/tool-impl/delegation-tools.ts +0 -66
  208. package/packs/software-delivery/tool-impl/flow-metrics-tools.ts +0 -219
  209. package/packs/software-delivery/tool-impl/git-runner.ts +0 -113
  210. package/packs/software-delivery/tool-impl/git-tools.ts +0 -316
  211. package/packs/software-delivery/tool-impl/index.ts +0 -15
  212. package/packs/software-delivery/tool-impl/initiative-orchestration-tools.ts +0 -720
  213. package/packs/software-delivery/tool-impl/lane-lock.ts +0 -246
  214. package/packs/software-delivery/tool-impl/memory-tools.ts +0 -470
  215. package/packs/software-delivery/tool-impl/pending-runtime-tools.ts +0 -21
  216. package/packs/software-delivery/tool-impl/runtime-cli-adapter.ts +0 -329
  217. package/packs/software-delivery/tool-impl/runtime-native-tools.ts +0 -687
  218. package/packs/software-delivery/tool-impl/worker-loader.ts +0 -52
  219. package/packs/software-delivery/tool-impl/worktree-tools.ts +0 -46
  220. package/packs/software-delivery/tool-impl/wu-lifecycle-tools.ts +0 -807
  221. package/packs/software-delivery/tools/delegation-tools.ts +0 -23
  222. package/packs/software-delivery/tools/git-tools.ts +0 -55
  223. package/packs/software-delivery/tools/index.ts +0 -8
  224. package/packs/software-delivery/tools/lane-lock-tool.ts +0 -37
  225. package/packs/software-delivery/tools/types.ts +0 -71
  226. package/packs/software-delivery/tools/worktree-tools.ts +0 -49
  227. package/packs/software-delivery/vitest.config.ts +0 -11
@@ -1,166 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Orchestration Domain Constants
6
- *
7
- * Centralised constants for the agent orchestration dashboard.
8
- * Avoids magic numbers and hardcoded strings throughout the orchestration layer.
9
- *
10
- * @module orchestration.constants
11
- * @see {@link ../ports/dashboard-renderer.port.ts} - Uses these constants
12
- * @see {@link ../ports/metrics-collector.port.ts} - Uses these constants
13
- */
14
-
15
- import { DIRECTORIES, LUMENFLOW_PATHS } from '../constants/wu-paths-constants.js';
16
-
17
- /**
18
- * Total number of Definition of Done checkpoints.
19
- * Used by dashboard to show DoD progress (X/11).
20
- */
21
- export const DOD_TOTAL = 11;
22
-
23
- /**
24
- * Valid lane names in the LumenFlow system.
25
- * Used for type-safe lane validation.
26
- *
27
- * Note: This should match the lanes defined in workspace.yaml.
28
- * These are LumenFlow framework lanes, not application-specific lanes.
29
- */
30
- export const LANES = [
31
- 'Framework: Core',
32
- 'Framework: CLI',
33
- 'Framework: Memory',
34
- 'Framework: Agent',
35
- 'Framework: Metrics',
36
- 'Framework: Initiatives',
37
- 'Framework: Shims',
38
- 'Operations: Infrastructure',
39
- 'Operations: CI/CD',
40
- 'Content: Documentation',
41
- ] as const;
42
-
43
- /** Type for valid lane names */
44
- export type Lane = (typeof LANES)[number];
45
-
46
- /**
47
- * Known agent names in the orchestration system.
48
- * Includes both mandatory (Tier 1) and suggested (Tier 2) agents.
49
- *
50
- * Note: These are the framework's vendor-neutral default aliases. Vendor
51
- * overlays may materialize them in different native surfaces, and
52
- * application-specific agents should still be configured separately.
53
- *
54
- * v2 roster refresh: the default set removes `lumenflow-doc-sync` and adds
55
- * `initiative-architect`.
56
- */
57
- export const AGENT_NAMES = [
58
- 'general-purpose',
59
- 'lumenflow-pm',
60
- 'test-engineer',
61
- 'code-reviewer',
62
- 'bug-triage',
63
- 'lumenflow-enforcer',
64
- 'initiative-architect',
65
- ] as const;
66
-
67
- /**
68
- * Alert severity levels for dashboard display.
69
- * HIGH = action required immediately
70
- * MEDIUM = action suggested
71
- * LOW = informational
72
- */
73
- export const SEVERITY_LEVELS = ['high', 'medium', 'low'] as const;
74
-
75
- /** Type for severity levels */
76
- export type SeverityLevel = (typeof SEVERITY_LEVELS)[number];
77
-
78
- /**
79
- * Default timeline window for dashboard display (hours).
80
- */
81
- export const TIMELINE_WINDOW_HOURS = 24;
82
-
83
- /**
84
- * Maximum alerts to display in dashboard.
85
- */
86
- export const MAX_ALERTS_DISPLAY = 10;
87
-
88
- /**
89
- * Agent result statuses for WU progress tracking.
90
- */
91
- export const AGENT_RESULT_STATUSES = ['pending', 'pass', 'fail', 'skipped'] as const;
92
-
93
- /** Type for agent result statuses */
94
- export type AgentResultStatus = (typeof AGENT_RESULT_STATUSES)[number];
95
-
96
- /**
97
- * Timeline event types for orchestration history.
98
- */
99
- export const TIMELINE_EVENT_TYPES = ['claim', 'done', 'block', 'agent', 'gates'] as const;
100
-
101
- /** Type for timeline event types */
102
- export type TimelineEventType = (typeof TIMELINE_EVENT_TYPES)[number];
103
-
104
- /**
105
- * Event severity levels for timeline display.
106
- */
107
- export const EVENT_SEVERITY_LEVELS = ['info', 'warning', 'error'] as const;
108
-
109
- /** Type for event severity levels */
110
- export type EventSeverityLevel = (typeof EVENT_SEVERITY_LEVELS)[number];
111
-
112
- /**
113
- * User choice options for execution plan confirmation.
114
- */
115
- export const USER_CHOICE_OPTIONS = ['approve', 'reject', 'edit'] as const;
116
-
117
- /** Type for user choice options */
118
- export type UserChoiceOption = (typeof USER_CHOICE_OPTIONS)[number];
119
-
120
- /**
121
- * Mandatory agent names (subset of AGENT_NAMES)
122
- *
123
- * Note: For LumenFlow framework development, mandatory agents are not currently
124
- * enforced since this is a workflow framework, not an application with domain-specific concerns.
125
- * Projects using LumenFlow can define their own mandatory agents in their config.
126
- *
127
- * The test-engineer and code-reviewer agents are suggested but not mandatory.
128
- */
129
- export const MANDATORY_AGENT_NAMES = [] as const;
130
-
131
- /**
132
- * Mandatory agent triggers - glob patterns that indicate when agents must be invoked.
133
- * Uses minimatch patterns (NOT regex) for file path matching.
134
- *
135
- * Note: For LumenFlow framework development, this is empty since we don't have
136
- * application-specific concerns. Projects using LumenFlow
137
- * should configure their own triggers based on their domain requirements.
138
- *
139
- * Example application-specific triggers (configure in your project):
140
- * - security-auditor: supabase/migrations/**, auth/**, rls/**
141
- * - llm-reviewer: prompts/**, llm/**
142
- *
143
- * Usage:
144
- * ```typescript
145
- * import { minimatch } from 'minimatch';
146
- * const triggers = MANDATORY_TRIGGERS['my-agent'];
147
- * const shouldTrigger = triggers?.some(pattern => minimatch(filePath, pattern));
148
- * ```
149
- */
150
- export const MANDATORY_TRIGGERS: Record<string, readonly string[]> = {
151
- // No mandatory triggers for LumenFlow framework development.
152
- // Projects should configure their own triggers based on their domain.
153
- };
154
-
155
- /**
156
- * File system paths for metrics collection.
157
- * Used by FileSystemMetricsCollector to avoid hardcoded strings.
158
- */
159
- export const FILESYSTEM_PATHS = {
160
- WU_DIR: DIRECTORIES.WU_DIR,
161
- STATUS_FILE: DIRECTORIES.STATUS_PATH,
162
- BACKLOG_FILE: DIRECTORIES.BACKLOG_PATH,
163
- TELEMETRY_DIR: LUMENFLOW_PATHS.TELEMETRY,
164
- STAMPS_DIR: LUMENFLOW_PATHS.STAMPS_DIR,
165
- SESSION_FILE: LUMENFLOW_PATHS.SESSION_CURRENT,
166
- };
@@ -1,238 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Orchestration Domain Schemas
6
- *
7
- * Zod schemas for runtime validation of orchestration domain types.
8
- * Single source of truth - types are inferred from these schemas.
9
- *
10
- * @module orchestration.schemas
11
- * @see {@link ./orchestration.types.ts} - Types inferred from these schemas
12
- * @see {@link ./orchestration.constants.ts} - Constants used in validation
13
- */
14
-
15
- import { z } from 'zod';
16
- import {
17
- LANES,
18
- SEVERITY_LEVELS,
19
- AGENT_RESULT_STATUSES,
20
- TIMELINE_EVENT_TYPES,
21
- EVENT_SEVERITY_LEVELS,
22
- USER_CHOICE_OPTIONS,
23
- DOD_TOTAL,
24
- } from './orchestration.constants.js';
25
-
26
- /**
27
- * Schema for the longest running WU information.
28
- */
29
- const LongestRunningSchema = z.object({
30
- wuId: z.string().min(1),
31
- lane: z.enum(LANES),
32
- durationMs: z.number().nonnegative(),
33
- });
34
-
35
- /**
36
- * Schema for pending mandatory agent information.
37
- */
38
- const PendingMandatorySchema = z.object({
39
- wuId: z.string().min(1),
40
- agent: z.string().min(1),
41
- });
42
-
43
- /**
44
- * Schema for active agent session (WU-1438).
45
- */
46
- const ActiveSessionSchema = z.object({
47
- sessionId: z.string().uuid(),
48
- wuId: z.string().min(1),
49
- started: z.string().datetime(),
50
- contextTier: z.union([z.literal(1), z.literal(2), z.literal(3)]),
51
- incidentsLogged: z.number().int().nonnegative(),
52
- });
53
-
54
- /**
55
- * Schema for worktree with uncommitted changes (WU-1748).
56
- * Used for cross-agent visibility of abandoned WU work.
57
- */
58
- const WorktreeWithUncommittedChangesSchema = z.object({
59
- /** WU ID extracted from worktree branch name */
60
- wuId: z.string().min(1),
61
- /** Worktree directory path */
62
- worktreePath: z.string().min(1),
63
- /** Number of uncommitted files */
64
- uncommittedFileCount: z.number().int().nonnegative(),
65
- /** Last git activity timestamp (ISO 8601) */
66
- lastActivityTimestamp: z.string(),
67
- });
68
-
69
- /**
70
- * Schema for global orchestration status.
71
- * Shows high-level dashboard metrics at a glance.
72
- */
73
- export const GlobalStatusSchema = z.object({
74
- /** Number of WUs currently in progress */
75
- activeWUs: z.number().int().nonnegative(),
76
- /** Number of WUs completed in the last 24 hours */
77
- completed24h: z.number().int().nonnegative(),
78
- /** Number of currently blocked WUs */
79
- blocked: z.number().int().nonnegative(),
80
- /** Number of WUs with failing gates */
81
- gatesFailing: z.number().int().nonnegative(),
82
- /** Information about the longest running WU, or null if none active */
83
- longestRunning: LongestRunningSchema.nullable(),
84
- /** List of WUs with pending mandatory agents */
85
- pendingMandatory: z.array(PendingMandatorySchema),
86
- /** Current active agent session, or null if none (WU-1438) */
87
- activeSession: ActiveSessionSchema.nullable(),
88
- /** Worktrees with uncommitted changes for cross-agent visibility (WU-1748) */
89
- worktreesWithUncommittedChanges: z.array(WorktreeWithUncommittedChangesSchema),
90
- });
91
-
92
- /**
93
- * Schema for last run information within agent metrics.
94
- */
95
- const LastRunSchema = z.object({
96
- wuId: z.string().min(1),
97
- timestamp: z.string().datetime(),
98
- result: z.enum(['pass', 'fail']),
99
- });
100
-
101
- /**
102
- * Schema for per-agent metrics.
103
- * Tracks invocation counts, pass rates, and timing.
104
- */
105
- export const AgentMetricSchema = z.object({
106
- /** Total number of times this agent has been invoked */
107
- invoked: z.number().int().nonnegative(),
108
- /** Pass rate as percentage (0-100) */
109
- passRate: z.number().min(0).max(100),
110
- /** Average duration in milliseconds */
111
- avgDurationMs: z.number().nonnegative(),
112
- /** Information about the most recent run, or null if never run */
113
- lastRun: LastRunSchema.nullable(),
114
- });
115
-
116
- /**
117
- * Schema for WU progress tracking.
118
- * Shows DoD progress and agent status per WU.
119
- */
120
- export const WUProgressSchema = z.object({
121
- /** Work Unit ID (e.g., "WU-1234") */
122
- wuId: z.string().min(1),
123
- /** Lane the WU is assigned to */
124
- lane: z.enum(LANES),
125
- /** Human-readable title of the WU */
126
- title: z.string().min(1),
127
- /** Current DoD checkpoint progress (0 to DOD_TOTAL) */
128
- dodProgress: z.number().int().min(0).max(DOD_TOTAL),
129
- /** Total DoD checkpoints (always DOD_TOTAL) */
130
- dodTotal: z.literal(DOD_TOTAL),
131
- /** Status of each agent that has been or should be run */
132
- agents: z.record(z.string(), z.enum(AGENT_RESULT_STATUSES)),
133
- /** Tufte-style headline sentence describing current state */
134
- headline: z.string(),
135
- });
136
-
137
- /**
138
- * Schema for timeline events.
139
- * Records orchestration history for dashboard display.
140
- */
141
- export const TimelineEventSchema = z.object({
142
- /** ISO 8601 timestamp of the event */
143
- timestamp: z.string().datetime(),
144
- /** Type of orchestration event */
145
- event: z.enum(TIMELINE_EVENT_TYPES),
146
- /** Associated Work Unit ID */
147
- wuId: z.string().min(1),
148
- /** Human-readable event description */
149
- detail: z.string(),
150
- /** Visual severity for display */
151
- severity: z.enum(EVENT_SEVERITY_LEVELS),
152
- });
153
-
154
- /**
155
- * Schema for dashboard alerts.
156
- * Highlights items requiring attention.
157
- */
158
- export const AlertSchema = z.object({
159
- /** Alert severity level */
160
- severity: z.enum(SEVERITY_LEVELS),
161
- /** Human-readable alert message */
162
- message: z.string().min(1),
163
- /** Associated Work Unit ID */
164
- wuId: z.string().min(1),
165
- /** Suggested action or command */
166
- action: z.string().min(1),
167
- });
168
-
169
- /**
170
- * Schema for orchestration suggestions.
171
- * Recommendations for next actions.
172
- */
173
- export const SuggestionSchema = z.object({
174
- /** Unique suggestion identifier */
175
- id: z.string().min(1),
176
- /** Suggestion priority level */
177
- priority: z.enum(SEVERITY_LEVELS),
178
- /** Short action description */
179
- action: z.string().min(1),
180
- /** Reason for the suggestion */
181
- reason: z.string().min(1),
182
- /** CLI command to execute the suggestion */
183
- command: z.string().min(1),
184
- });
185
-
186
- /**
187
- * Schema for execution plan steps.
188
- */
189
- const ExecutionStepSchema = z.object({
190
- /** Execution order (1-based) */
191
- order: z.number().int().positive(),
192
- /** Agent to run (if applicable) */
193
- agent: z.string().optional(),
194
- /** Action to perform (if not an agent) */
195
- action: z.string().optional(),
196
- /** Step execution status */
197
- status: z.enum(AGENT_RESULT_STATUSES),
198
- });
199
-
200
- /**
201
- * Schema for execution plans.
202
- * Proposed sequence of orchestration actions.
203
- */
204
- export const ExecutionPlanSchema = z.object({
205
- /** Work Unit ID this plan is for */
206
- wuId: z.string().min(1),
207
- /** Ordered list of steps to execute */
208
- steps: z.array(ExecutionStepSchema),
209
- /** Estimated token cost for the full plan */
210
- estimatedTokens: z.number().int().nonnegative(),
211
- });
212
-
213
- /**
214
- * Schema for user choices on execution plans.
215
- */
216
- export const UserChoiceSchema = z.object({
217
- /** User's choice */
218
- choice: z.enum(USER_CHOICE_OPTIONS),
219
- /** Modifications if choice is 'edit' */
220
- modifications: z.array(z.string()).optional(),
221
- });
222
-
223
- /**
224
- * Schema for complete dashboard data.
225
- * Aggregates all data needed for dashboard rendering.
226
- */
227
- export const DashboardDataSchema = z.object({
228
- /** Global status metrics */
229
- globalStatus: GlobalStatusSchema,
230
- /** Per-agent metrics keyed by agent name */
231
- agentMetrics: z.record(z.string(), AgentMetricSchema),
232
- /** Progress for all active WUs */
233
- wuProgress: z.array(WUProgressSchema),
234
- /** Recent timeline events */
235
- timeline: z.array(TimelineEventSchema),
236
- /** Current alerts */
237
- alerts: z.array(AlertSchema),
238
- });
@@ -1,176 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Orchestration Domain Types
6
- *
7
- * TypeScript types inferred from Zod schemas.
8
- * Single source of truth - schemas validate at runtime, types at compile time.
9
- *
10
- * @module orchestration.types
11
- * @see {@link ./orchestration.schemas.ts} - Schemas these types are inferred from
12
- * @see {@link ./orchestration.constants.ts} - Constants and derived types
13
- */
14
-
15
- import type { z } from 'zod';
16
- import type {
17
- GlobalStatusSchema,
18
- AgentMetricSchema,
19
- WUProgressSchema,
20
- TimelineEventSchema,
21
- AlertSchema,
22
- SuggestionSchema,
23
- ExecutionPlanSchema,
24
- UserChoiceSchema,
25
- DashboardDataSchema,
26
- } from './orchestration.schemas.js';
27
-
28
- // Re-export constant-derived types for convenience
29
- export type {
30
- Lane,
31
- SeverityLevel,
32
- AgentResultStatus,
33
- TimelineEventType,
34
- EventSeverityLevel,
35
- UserChoiceOption,
36
- } from './orchestration.constants.js';
37
-
38
- // Re-export const values as well
39
- export {
40
- LANES,
41
- AGENT_NAMES,
42
- SEVERITY_LEVELS,
43
- AGENT_RESULT_STATUSES,
44
- TIMELINE_EVENT_TYPES,
45
- EVENT_SEVERITY_LEVELS,
46
- USER_CHOICE_OPTIONS,
47
- MANDATORY_AGENT_NAMES,
48
- } from './orchestration.constants.js';
49
-
50
- /**
51
- * Global orchestration status.
52
- * Shows high-level dashboard metrics at a glance.
53
- *
54
- * @example
55
- * const status: GlobalStatus = {
56
- * activeWUs: 2,
57
- * completed24h: 5,
58
- * blocked: 1,
59
- * gatesFailing: 0,
60
- * longestRunning: { wuId: 'WU-1234', lane: 'Intelligence', durationMs: 2700000 },
61
- * pendingMandatory: [{ wuId: 'WU-1235', agent: 'security-auditor' }],
62
- * };
63
- */
64
- export type GlobalStatus = z.infer<typeof GlobalStatusSchema>;
65
-
66
- /**
67
- * Per-agent metrics for dashboard display.
68
- * Tracks invocation counts, pass rates, and timing.
69
- *
70
- * @example
71
- * const metric: AgentMetric = {
72
- * invoked: 3,
73
- * passRate: 100,
74
- * avgDurationMs: 120000,
75
- * lastRun: { wuId: 'WU-1234', timestamp: '2025-01-15T10:00:00Z', result: 'pass' },
76
- * };
77
- */
78
- export type AgentMetric = z.infer<typeof AgentMetricSchema>;
79
-
80
- /**
81
- * Work Unit progress for dashboard display.
82
- * Shows DoD progress and agent status per WU.
83
- *
84
- * @example
85
- * const progress: WUProgress = {
86
- * wuId: 'WU-1234',
87
- * lane: 'Intelligence',
88
- * title: 'LLM Classification Feature',
89
- * dodProgress: 8,
90
- * dodTotal: 11,
91
- * agents: { 'llm-reviewer': 'pass', 'code-reviewer': 'pending' },
92
- * headline: 'Blocked on code-reviewer - awaiting approval',
93
- * };
94
- */
95
- export type WUProgress = z.infer<typeof WUProgressSchema>;
96
-
97
- /**
98
- * Timeline event for orchestration history.
99
- * Records key events for dashboard display.
100
- *
101
- * @example
102
- * const event: TimelineEvent = {
103
- * timestamp: '2025-01-15T09:00:00Z',
104
- * event: 'claim',
105
- * wuId: 'WU-1234',
106
- * detail: 'Claimed for Intelligence lane',
107
- * severity: 'info',
108
- * };
109
- */
110
- export type TimelineEvent = z.infer<typeof TimelineEventSchema>;
111
-
112
- /**
113
- * Dashboard alert for items requiring attention.
114
- *
115
- * @example
116
- * const alert: Alert = {
117
- * severity: 'high',
118
- * message: 'Mandatory agent not yet invoked',
119
- * wuId: 'WU-1235',
120
- * action: 'Run security-auditor before wu:done',
121
- * };
122
- */
123
- export type Alert = z.infer<typeof AlertSchema>;
124
-
125
- /**
126
- * Orchestration suggestion for next actions.
127
- *
128
- * @example
129
- * const suggestion: Suggestion = {
130
- * id: 'sug-001',
131
- * priority: 'high',
132
- * action: 'Run security-auditor',
133
- * reason: 'WU touches auth paths',
134
- * command: 'pnpm orchestrate:run security-auditor',
135
- * };
136
- */
137
- export type Suggestion = z.infer<typeof SuggestionSchema>;
138
-
139
- /**
140
- * Execution plan for proposed orchestration actions.
141
- *
142
- * @example
143
- * const plan: ExecutionPlan = {
144
- * wuId: 'WU-1234',
145
- * steps: [
146
- * { order: 1, agent: 'llm-reviewer', status: 'pending' },
147
- * { order: 2, action: 'gates', status: 'pending' },
148
- * ],
149
- * estimatedTokens: 5000,
150
- * };
151
- */
152
- export type ExecutionPlan = z.infer<typeof ExecutionPlanSchema>;
153
-
154
- /**
155
- * User choice on execution plan confirmation.
156
- *
157
- * @example
158
- * const choice: UserChoice = { choice: 'approve' };
159
- * const editChoice: UserChoice = { choice: 'edit', modifications: ['Skip step 2'] };
160
- */
161
- export type UserChoice = z.infer<typeof UserChoiceSchema>;
162
-
163
- /**
164
- * Complete dashboard data aggregating all metrics.
165
- * This is the main data structure passed to renderers.
166
- *
167
- * @example
168
- * const data: DashboardData = {
169
- * globalStatus: { ... },
170
- * agentMetrics: { 'security-auditor': { ... } },
171
- * wuProgress: [{ ... }],
172
- * timeline: [{ ... }],
173
- * alerts: [{ ... }],
174
- * };
175
- */
176
- export type DashboardData = z.infer<typeof DashboardDataSchema>;
@@ -1,122 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * @file incremental-test.ts
6
- * @description Helpers for Vitest --changed execution
7
- *
8
- * WU-1920: Add incremental test execution to gates
9
- * WU-2504: Use Vitest --changed instead of custom file diff logic
10
- * WU-2905: Code-file extensions are sourced from the resolved
11
- * tdd_diff_evidence policy so non-TS/JS consumers (.NET, Python,
12
- * Go, ...) can teach the gate which files count as production code
13
- * via workspace.yaml. Extension defaults remain TS/JS so existing
14
- * consumers see no behaviour change.
15
- */
16
-
17
- import { GIT_REFS } from '../constants/wu-git-constants.js';
18
- import { DEFAULT_TDD_DIFF_CODE_FILE_EXTENSIONS } from '../policy/resolve-policy.js';
19
-
20
- // WU-2790 follow-up: the software-delivery pack cannot import from
21
- // @lumenflow/core (pack import-boundary enforcement restricts packs to
22
- // @lumenflow/kernel + Node built-ins). Vitest --changed's base branch
23
- // therefore stays on the pack's own GIT_REFS constant. If the host
24
- // workspace reconfigures software_delivery.git.mainBranch, incremental
25
- // test selection here falls back to origin/main — slightly over-selects
26
- // when running --changed, but preserves correctness. Proper fix requires
27
- // relocating the integration-target resolver into kernel; tracked
28
- // separately as a pack-boundary follow-up.
29
-
30
- /**
31
- * Glob patterns to exclude slow integration/golden tests from changed runs.
32
- *
33
- * NOTE (WU-2905): These are runtime-platform excludes (slow integration /
34
- * golden suites), not language-test patterns. They stay hardcoded because
35
- * Vitest itself only exists in TS/JS contexts; non-TS/JS consumers do not
36
- * use buildVitestChangedArgs(). Per-language test detection happens via
37
- * tdd_diff_evidence.test_file_patterns, not here.
38
- *
39
- * @type {string[]}
40
- */
41
- export const VITEST_CHANGED_EXCLUDES = Object.freeze(['**/*.integration.*', '**/golden-*.test.*']);
42
-
43
- /**
44
- * File extensions considered executable code for test runs.
45
- *
46
- * Re-exported alias for `DEFAULT_TDD_DIFF_CODE_FILE_EXTENSIONS` (single
47
- * source of truth). Kept for backwards compatibility with existing imports
48
- * (`@lumenflow/core/incremental-test#CODE_FILE_EXTENSIONS`).
49
- *
50
- * @type {string[]}
51
- */
52
- export const CODE_FILE_EXTENSIONS = DEFAULT_TDD_DIFF_CODE_FILE_EXTENSIONS;
53
-
54
- /**
55
- * Options for {@link isCodeFilePath}.
56
- *
57
- * WU-2905: Callers in gate paths can pass the resolved
58
- * tdd_diff_evidence.code_file_extensions so the classification honours
59
- * workspace overrides (e.g. ['.cs'] for C#). When omitted, falls back to the
60
- * built-in TS/JS defaults.
61
- */
62
- export interface IsCodeFilePathOptions {
63
- /** Override the default TS/JS code file extensions. */
64
- extensions?: readonly string[];
65
- }
66
-
67
- /**
68
- * Check if a path points to a code file that should trigger full tests.
69
- *
70
- * @param filePath - Path to check
71
- * @param options - Optional extension override (WU-2905)
72
- * @returns True if the path has a code extension recognised by the gate
73
- */
74
- export function isCodeFilePath(filePath: string, options?: IsCodeFilePathOptions): boolean {
75
- if (!filePath || typeof filePath !== 'string') {
76
- return false;
77
- }
78
-
79
- // Guard against `.filter(isCodeFilePath)` style callers, where the second
80
- // argument is the array index (number), not an options object. WU-2905.
81
- const safeOptions = typeof options === 'object' && !Array.isArray(options) ? options : undefined;
82
- const extensions = safeOptions?.extensions ?? CODE_FILE_EXTENSIONS;
83
- const normalized = filePath.replace(/\\/g, '/').toLowerCase();
84
- return extensions.some((ext) => normalized.endsWith(ext.toLowerCase()));
85
- }
86
-
87
- /**
88
- * Options for building Vitest changed args
89
- */
90
- interface BuildVitestChangedArgsOptions {
91
- /** Base branch for diff */
92
- baseBranch?: string;
93
- /**
94
- * WU-2905: Optional excludes override. When omitted, defaults to
95
- * VITEST_CHANGED_EXCLUDES (slow integration / golden suites).
96
- */
97
- excludes?: readonly string[];
98
- }
99
-
100
- /**
101
- * Build Vitest CLI args for --changed runs.
102
- *
103
- * @param {BuildVitestChangedArgsOptions} [options]
104
- * @returns {string[]} Vitest args for changed test runs
105
- */
106
- export function buildVitestChangedArgs(options: BuildVitestChangedArgsOptions = {}) {
107
- const { baseBranch = GIT_REFS.ORIGIN_MAIN, excludes = VITEST_CHANGED_EXCLUDES } = options;
108
- const args = [
109
- '--changed',
110
- baseBranch,
111
- '--run',
112
- '--passWithNoTests',
113
- '--maxWorkers=1',
114
- '--teardownTimeout=30000',
115
- ];
116
-
117
- for (const pattern of excludes) {
118
- args.push(`--exclude='${pattern}'`);
119
- }
120
-
121
- return args;
122
- }
@@ -1,6 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- // WU-2683 (INIT-058 L4): Methodology cohort barrel — re-export relocated modules.
5
- export * from './manual-test-validator.js';
6
- export * from './incremental-test.js';