@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,319 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Package Manager and Test Runner Resolution
6
- *
7
- * WU-2037: Extracted from gates-config.ts
8
- *
9
- * Resolves package manager, test runner, build commands, gates commands,
10
- * and ignore patterns from workspace.yaml software_delivery configuration.
11
- *
12
- * @module package-manager-resolver
13
- */
14
-
15
- import { asRecord, isString } from '../constants/object-guards.js';
16
- import type { GatesCommands } from './gates-schemas.js';
17
- import {
18
- GATES_RUNTIME_DEFAULTS,
19
- SOFTWARE_DELIVERY_FIELDS,
20
- GATES_FIELDS,
21
- GATES_COMMAND_FIELDS,
22
- loadSoftwareDeliveryConfig,
23
- getGatesSection,
24
- } from './gates-config-internal.js';
25
-
26
- // ---------------------------------------------------------------------------
27
- // Supported values
28
- // ---------------------------------------------------------------------------
29
-
30
- const SUPPORTED_PACKAGE_MANAGERS = ['pnpm', 'npm', 'yarn', 'bun'] as const;
31
- const SUPPORTED_TEST_RUNNERS = ['vitest', 'jest', 'mocha'] as const;
32
- const GATE_PRESET_FIELD = 'preset';
33
- const NODE_GATE_PRESET = 'node';
34
-
35
- /**
36
- * WU-1356: Supported package managers type
37
- */
38
- type PackageManager = (typeof SUPPORTED_PACKAGE_MANAGERS)[number];
39
-
40
- /**
41
- * WU-1356: Supported test runners type
42
- */
43
- type TestRunner = (typeof SUPPORTED_TEST_RUNNERS)[number];
44
-
45
- export type ScopedUnitTestExecutionPlan =
46
- | {
47
- mode: 'direct';
48
- runner: TestRunner;
49
- args: string[];
50
- }
51
- | {
52
- mode: 'default-flow';
53
- preset: string;
54
- };
55
-
56
- // ---------------------------------------------------------------------------
57
- // Default command tables
58
- // ---------------------------------------------------------------------------
59
-
60
- /**
61
- * WU-1356: Default gates commands by package manager
62
- *
63
- * Provides sensible defaults for different package manager and test runner combinations.
64
- */
65
- const DEFAULT_GATES_COMMANDS: Record<PackageManager, GatesCommands> = {
66
- pnpm: {
67
- test_full: 'pnpm turbo run test',
68
- test_docs_only: '',
69
- test_incremental: 'pnpm vitest run --changed origin/main',
70
- lint: 'pnpm lint',
71
- typecheck: 'pnpm typecheck',
72
- format: 'pnpm format:check',
73
- migration_verify: '',
74
- },
75
- npm: {
76
- test_full: 'npm test',
77
- test_docs_only: '',
78
- test_incremental: 'npm test -- --onlyChanged',
79
- lint: 'npm run lint',
80
- typecheck: 'npm run typecheck',
81
- format: 'npm run format:check',
82
- migration_verify: '',
83
- },
84
- yarn: {
85
- test_full: 'yarn test',
86
- test_docs_only: '',
87
- test_incremental: 'yarn test --onlyChanged',
88
- lint: 'yarn lint',
89
- typecheck: 'yarn typecheck',
90
- format: 'yarn format:check',
91
- migration_verify: '',
92
- },
93
- bun: {
94
- test_full: 'bun test',
95
- test_docs_only: '',
96
- test_incremental: 'bun test --changed',
97
- lint: 'bun run lint',
98
- typecheck: 'bun run typecheck',
99
- format: 'bun run format:check',
100
- migration_verify: '',
101
- },
102
- };
103
-
104
- /**
105
- * WU-1356: Default build commands by package manager
106
- */
107
- const DEFAULT_BUILD_COMMANDS: Record<PackageManager, string> = {
108
- pnpm: 'pnpm --filter @lumenflow/cli build',
109
- npm: 'npm run build --workspace @lumenflow/cli',
110
- yarn: 'yarn workspace @lumenflow/cli build',
111
- bun: 'bun run --filter @lumenflow/cli build',
112
- };
113
-
114
- /**
115
- * WU-1356: Ignore patterns by test runner
116
- *
117
- * Different test runners use different cache directories that should be ignored.
118
- */
119
- const IGNORE_PATTERNS_BY_RUNNER: Record<TestRunner, string[]> = {
120
- vitest: ['.turbo'],
121
- jest: ['coverage', '.jest-cache'],
122
- mocha: ['coverage', '.nyc_output'],
123
- };
124
-
125
- const SCOPED_UNIT_TEST_ARGS_BY_RUNNER: Record<TestRunner, (paths: string[]) => string[]> = {
126
- vitest: (paths) => ['vitest', 'run', ...paths, '--passWithNoTests', '--maxWorkers=1'],
127
- jest: (paths) => ['jest', ...paths, '--passWithNoTests'],
128
- mocha: (paths) => ['mocha', ...paths],
129
- };
130
-
131
- function normalizeScopedUnitTestPaths(scopedUnitTests: string[]): string[] {
132
- return scopedUnitTests
133
- .filter((entry): entry is string => typeof entry === 'string')
134
- .map((entry) => entry.trim())
135
- .filter(Boolean);
136
- }
137
-
138
- export function resolveGatePreset(projectRoot: string): string | undefined {
139
- const gates = getGatesSection(projectRoot);
140
- const execution = asRecord(gates?.[GATES_FIELDS.EXECUTION]);
141
- const preset = execution?.[GATE_PRESET_FIELD];
142
-
143
- if (!isString(preset)) {
144
- return undefined;
145
- }
146
-
147
- const normalized = preset.trim();
148
- return normalized.length > 0 ? normalized : undefined;
149
- }
150
-
151
- export function resolveScopedUnitTestExecutionPlan(options: {
152
- projectRoot: string;
153
- scopedUnitTests: string[];
154
- }): ScopedUnitTestExecutionPlan | null {
155
- const normalizedPaths = normalizeScopedUnitTestPaths(options.scopedUnitTests);
156
- if (normalizedPaths.length === 0) {
157
- return null;
158
- }
159
-
160
- const preset = resolveGatePreset(options.projectRoot);
161
- if (preset && preset !== NODE_GATE_PRESET) {
162
- return {
163
- mode: 'default-flow',
164
- preset,
165
- };
166
- }
167
-
168
- const runner = resolveTestRunner(options.projectRoot);
169
- return {
170
- mode: 'direct',
171
- runner,
172
- args: SCOPED_UNIT_TEST_ARGS_BY_RUNNER[runner](normalizedPaths),
173
- };
174
- }
175
-
176
- export function formatScopedUnitTestFallbackMessage(
177
- plan: Extract<ScopedUnitTestExecutionPlan, { mode: 'default-flow' }>,
178
- ): string {
179
- return (
180
- `gates.execution.preset "${plan.preset}" does not support path-scoped tests.unit execution; ` +
181
- 'falling back to the configured default test flow.'
182
- );
183
- }
184
-
185
- // ---------------------------------------------------------------------------
186
- // Public API
187
- // ---------------------------------------------------------------------------
188
-
189
- /**
190
- * WU-1356: Resolve package manager from configuration
191
- *
192
- * Reads the package_manager field from workspace.yaml software_delivery.
193
- * Returns 'pnpm' as default if not configured.
194
- *
195
- * @param projectRoot - Project root directory
196
- * @returns Resolved package manager ('pnpm', 'npm', 'yarn', or 'bun')
197
- */
198
- export function resolvePackageManager(projectRoot: string): PackageManager {
199
- const softwareDelivery = loadSoftwareDeliveryConfig(projectRoot);
200
- if (!softwareDelivery) {
201
- return GATES_RUNTIME_DEFAULTS.DEFAULT_PACKAGE_MANAGER;
202
- }
203
-
204
- const pm =
205
- softwareDelivery[SOFTWARE_DELIVERY_FIELDS.PACKAGE_MANAGER] ??
206
- softwareDelivery[SOFTWARE_DELIVERY_FIELDS.PACKAGE_MANAGER_CAMEL];
207
- if (isString(pm) && SUPPORTED_PACKAGE_MANAGERS.includes(pm as PackageManager)) {
208
- return pm as PackageManager;
209
- }
210
- return GATES_RUNTIME_DEFAULTS.DEFAULT_PACKAGE_MANAGER;
211
- }
212
-
213
- /**
214
- * WU-1356: Resolve test runner from configuration
215
- *
216
- * Reads the test_runner field from workspace.yaml software_delivery.
217
- * Returns 'vitest' as default if not configured.
218
- *
219
- * @param projectRoot - Project root directory
220
- * @returns Resolved test runner ('vitest', 'jest', or 'mocha')
221
- */
222
- export function resolveTestRunner(projectRoot: string): TestRunner {
223
- const softwareDelivery = loadSoftwareDeliveryConfig(projectRoot);
224
- if (!softwareDelivery) {
225
- return GATES_RUNTIME_DEFAULTS.DEFAULT_TEST_RUNNER;
226
- }
227
-
228
- const runner =
229
- softwareDelivery[SOFTWARE_DELIVERY_FIELDS.TEST_RUNNER] ??
230
- softwareDelivery[SOFTWARE_DELIVERY_FIELDS.TEST_RUNNER_CAMEL];
231
- if (isString(runner) && SUPPORTED_TEST_RUNNERS.includes(runner as TestRunner)) {
232
- return runner as TestRunner;
233
- }
234
- return GATES_RUNTIME_DEFAULTS.DEFAULT_TEST_RUNNER;
235
- }
236
-
237
- /**
238
- * WU-1356: Resolve build command from configuration
239
- *
240
- * Reads the build_command field from workspace.yaml software_delivery.
241
- * If not configured, uses default based on package_manager.
242
- *
243
- * @param projectRoot - Project root directory
244
- * @returns Resolved build command
245
- */
246
- export function resolveBuildCommand(projectRoot: string): string {
247
- const defaultPm = resolvePackageManager(projectRoot);
248
- const softwareDelivery = loadSoftwareDeliveryConfig(projectRoot);
249
- if (!softwareDelivery) {
250
- return DEFAULT_BUILD_COMMANDS[defaultPm];
251
- }
252
-
253
- const configuredBuildCommand =
254
- softwareDelivery[SOFTWARE_DELIVERY_FIELDS.BUILD_COMMAND] ??
255
- softwareDelivery[SOFTWARE_DELIVERY_FIELDS.BUILD_COMMAND_CAMEL];
256
- if (isString(configuredBuildCommand) && configuredBuildCommand.length > 0) {
257
- return configuredBuildCommand;
258
- }
259
-
260
- return DEFAULT_BUILD_COMMANDS[defaultPm];
261
- }
262
-
263
- /**
264
- * WU-1356: Resolve gates commands from configuration
265
- *
266
- * Reads gates.commands from workspace.yaml software_delivery.
267
- * Merges with defaults based on package_manager if not fully specified.
268
- *
269
- * @param projectRoot - Project root directory
270
- * @returns Resolved gates commands configuration
271
- */
272
- export function resolveGatesCommands(projectRoot: string): GatesCommands {
273
- const pm = resolvePackageManager(projectRoot);
274
- const defaults = DEFAULT_GATES_COMMANDS[pm];
275
- const gates = getGatesSection(projectRoot);
276
- if (!gates) {
277
- return defaults;
278
- }
279
-
280
- const commands = asRecord(gates[GATES_FIELDS.COMMANDS]);
281
- if (!commands) {
282
- return defaults;
283
- }
284
-
285
- // Merge user config with defaults (user config wins)
286
- return {
287
- test_full:
288
- (commands[GATES_COMMAND_FIELDS.TEST_FULL] as string | undefined) ?? defaults.test_full,
289
- test_docs_only:
290
- (commands[GATES_COMMAND_FIELDS.TEST_DOCS_ONLY] as string | undefined) ??
291
- defaults.test_docs_only,
292
- test_incremental:
293
- (commands[GATES_COMMAND_FIELDS.TEST_INCREMENTAL] as string | undefined) ??
294
- defaults.test_incremental,
295
- lint: (commands[GATES_COMMAND_FIELDS.LINT] as string | undefined) ?? defaults.lint,
296
- typecheck:
297
- (commands[GATES_COMMAND_FIELDS.TYPECHECK] as string | undefined) ?? defaults.typecheck,
298
- format: (commands[GATES_COMMAND_FIELDS.FORMAT] as string | undefined) ?? defaults.format,
299
- migration_verify:
300
- (commands[GATES_COMMAND_FIELDS.MIGRATION_VERIFY] as string | undefined) ??
301
- defaults.migration_verify,
302
- };
303
- }
304
-
305
- /**
306
- * WU-1356: Get ignore patterns for test runner
307
- *
308
- * Returns patterns to ignore when detecting changed tests,
309
- * based on the test runner configuration.
310
- *
311
- * @param testRunner - Test runner type (vitest, jest, mocha)
312
- * @returns Array of ignore patterns
313
- */
314
- export function getIgnorePatterns(testRunner: TestRunner): string[] {
315
- return (
316
- IGNORE_PATTERNS_BY_RUNNER[testRunner] ??
317
- IGNORE_PATTERNS_BY_RUNNER[GATES_RUNTIME_DEFAULTS.DEFAULT_TEST_RUNNER]
318
- );
319
- }