@lumenflow/cli 5.5.0 → 5.7.14

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 (229) hide show
  1. package/README.md +41 -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/doctor.js +11 -0
  7. package/dist/doctor.js.map +1 -1
  8. package/dist/gate-defaults.js +37 -0
  9. package/dist/gate-defaults.js.map +1 -1
  10. package/dist/gates/monolithic-file-contention-guard.js +167 -0
  11. package/dist/gates/monolithic-file-contention-guard.js.map +1 -0
  12. package/dist/gates/prod-migration-drift.js +207 -0
  13. package/dist/gates/prod-migration-drift.js.map +1 -0
  14. package/dist/gates/test-over-deletion-guard.js +280 -0
  15. package/dist/gates/test-over-deletion-guard.js.map +1 -0
  16. package/dist/gates-runners.js +44 -3
  17. package/dist/gates-runners.js.map +1 -1
  18. package/dist/gates.js +3 -2
  19. package/dist/gates.js.map +1 -1
  20. package/dist/hooks/config-resolver.js +16 -1
  21. package/dist/hooks/config-resolver.js.map +1 -1
  22. package/dist/hooks/dirty-guard.js +43 -2
  23. package/dist/hooks/dirty-guard.js.map +1 -1
  24. package/dist/hooks/git-status-parser.js +22 -8
  25. package/dist/hooks/git-status-parser.js.map +1 -1
  26. package/dist/init-templates.js +241 -0
  27. package/dist/init-templates.js.map +1 -1
  28. package/dist/init.js +122 -16
  29. package/dist/init.js.map +1 -1
  30. package/dist/lumenflow-setup.js +144 -0
  31. package/dist/lumenflow-setup.js.map +1 -0
  32. package/dist/lumenflow-upgrade.js +43 -1
  33. package/dist/lumenflow-upgrade.js.map +1 -1
  34. package/dist/mem-create.js +10 -1
  35. package/dist/mem-create.js.map +1 -1
  36. package/dist/mem-signal.js +21 -4
  37. package/dist/mem-signal.js.map +1 -1
  38. package/dist/orchestrate-initiative.js +28 -3
  39. package/dist/orchestrate-initiative.js.map +1 -1
  40. package/dist/public-manifest.js +17 -7
  41. package/dist/public-manifest.js.map +1 -1
  42. package/dist/release.js +53 -18
  43. package/dist/release.js.map +1 -1
  44. package/dist/wu-done-gates.js +13 -9
  45. package/dist/wu-done-gates.js.map +1 -1
  46. package/dist/wu-done.js +14 -2
  47. package/dist/wu-done.js.map +1 -1
  48. package/dist/wu-edit-operations.js +74 -0
  49. package/dist/wu-edit-operations.js.map +1 -1
  50. package/dist/wu-edit-validators.js +58 -0
  51. package/dist/wu-edit-validators.js.map +1 -1
  52. package/dist/wu-edit.js +106 -4
  53. package/dist/wu-edit.js.map +1 -1
  54. package/dist/wu-prep.js +57 -9
  55. package/dist/wu-prep.js.map +1 -1
  56. package/dist/wu-recover.js +6 -0
  57. package/dist/wu-recover.js.map +1 -1
  58. package/dist/wu-release.js +120 -2
  59. package/dist/wu-release.js.map +1 -1
  60. package/dist/wu-sizing-validation.js +47 -17
  61. package/dist/wu-sizing-validation.js.map +1 -1
  62. package/dist/wu-status.js +33 -0
  63. package/dist/wu-status.js.map +1 -1
  64. package/package.json +13 -12
  65. package/packs/agent-runtime/package.json +1 -1
  66. package/packs/sidekick/package.json +1 -1
  67. package/packs/software-delivery/package.json +1 -1
  68. package/templates/core/AGENTS.md.template +67 -3
  69. package/templates/core/LUMENFLOW.md.template +196 -47
  70. package/dist/distribution-preflight.js +0 -230
  71. package/dist/distribution-preflight.js.map +0 -1
  72. package/packs/agent-runtime/agent-heartbeat.ts +0 -163
  73. package/packs/agent-runtime/auto-session-integration.ts +0 -888
  74. package/packs/agent-runtime/capability-factory.ts +0 -104
  75. package/packs/agent-runtime/constants.ts +0 -21
  76. package/packs/agent-runtime/delegation-registry-schema.ts +0 -220
  77. package/packs/agent-runtime/delegation-registry-store.ts +0 -269
  78. package/packs/agent-runtime/delegation-tree.ts +0 -328
  79. package/packs/agent-runtime/index.ts +0 -20
  80. package/packs/agent-runtime/manifest.ts +0 -348
  81. package/packs/agent-runtime/memory-coordination-contract.ts +0 -86
  82. package/packs/agent-runtime/orchestration.ts +0 -2027
  83. package/packs/agent-runtime/pack-registration.ts +0 -110
  84. package/packs/agent-runtime/policy-factory.ts +0 -165
  85. package/packs/agent-runtime/remote-controls/index.ts +0 -7
  86. package/packs/agent-runtime/remote-controls/operations.ts +0 -405
  87. package/packs/agent-runtime/remote-controls/port.ts +0 -48
  88. package/packs/agent-runtime/remote-controls/state-store.ts +0 -258
  89. package/packs/agent-runtime/remote-controls/types.ts +0 -105
  90. package/packs/agent-runtime/session-schema.ts +0 -467
  91. package/packs/agent-runtime/tool-impl/agent-turn-tools.ts +0 -793
  92. package/packs/agent-runtime/tool-impl/index.ts +0 -6
  93. package/packs/agent-runtime/tool-impl/provider-adapters.ts +0 -1245
  94. package/packs/agent-runtime/tool-impl/remote-controls.mock.ts +0 -256
  95. package/packs/agent-runtime/tool-impl/remote-controls.ts +0 -273
  96. package/packs/agent-runtime/tools/index.ts +0 -4
  97. package/packs/agent-runtime/tools/types.ts +0 -47
  98. package/packs/agent-runtime/turn-lifecycle-events.ts +0 -590
  99. package/packs/agent-runtime/types.ts +0 -128
  100. package/packs/agent-runtime/vitest.config.ts +0 -11
  101. package/packs/sidekick/channel-ingress.ts +0 -137
  102. package/packs/sidekick/constants.ts +0 -10
  103. package/packs/sidekick/index.ts +0 -8
  104. package/packs/sidekick/manifest-schema.ts +0 -49
  105. package/packs/sidekick/manifest.ts +0 -512
  106. package/packs/sidekick/pack-registration.ts +0 -110
  107. package/packs/sidekick/policy-factory.ts +0 -38
  108. package/packs/sidekick/sidekick-events.ts +0 -694
  109. package/packs/sidekick/src/adapters/cloud-queue.ts +0 -101
  110. package/packs/sidekick/src/adapters/control-plane-bridge.adapter.ts +0 -386
  111. package/packs/sidekick/src/adapters/filesystem-bridge.adapter.ts +0 -228
  112. package/packs/sidekick/src/domain/channel.types.ts +0 -64
  113. package/packs/sidekick/src/ports/channel-bridge.port.ts +0 -92
  114. package/packs/sidekick/src/routines/commit.ts +0 -74
  115. package/packs/sidekick/tool-impl/channel-tools.ts +0 -577
  116. package/packs/sidekick/tool-impl/channel-transports.ts +0 -75
  117. package/packs/sidekick/tool-impl/index.ts +0 -29
  118. package/packs/sidekick/tool-impl/memory-tools.ts +0 -290
  119. package/packs/sidekick/tool-impl/routine-commit.ts +0 -102
  120. package/packs/sidekick/tool-impl/routine-tools.ts +0 -440
  121. package/packs/sidekick/tool-impl/runtime-context.ts +0 -28
  122. package/packs/sidekick/tool-impl/shared.ts +0 -125
  123. package/packs/sidekick/tool-impl/storage.ts +0 -325
  124. package/packs/sidekick/tool-impl/system-tools.ts +0 -160
  125. package/packs/sidekick/tool-impl/task-tools.ts +0 -506
  126. package/packs/sidekick/tools/channel-tools.ts +0 -53
  127. package/packs/sidekick/tools/index.ts +0 -9
  128. package/packs/sidekick/tools/memory-tools.ts +0 -53
  129. package/packs/sidekick/tools/routine-tools.ts +0 -53
  130. package/packs/sidekick/tools/system-tools.ts +0 -47
  131. package/packs/sidekick/tools/task-tools.ts +0 -61
  132. package/packs/sidekick/tools/types.ts +0 -57
  133. package/packs/sidekick/vitest.config.ts +0 -11
  134. package/packs/software-delivery/constants.ts +0 -10
  135. package/packs/software-delivery/extensions.ts +0 -140
  136. package/packs/software-delivery/gate-policies.ts +0 -134
  137. package/packs/software-delivery/index.ts +0 -8
  138. package/packs/software-delivery/manifest-schema.ts +0 -268
  139. package/packs/software-delivery/manifest.ts +0 -657
  140. package/packs/software-delivery/pack-registration.ts +0 -113
  141. package/packs/software-delivery/src/commands/index.ts +0 -5
  142. package/packs/software-delivery/src/config/delivery-review-contract.ts +0 -256
  143. package/packs/software-delivery/src/config/env-accessors.ts +0 -66
  144. package/packs/software-delivery/src/config/index.ts +0 -8
  145. package/packs/software-delivery/src/config/normalize-config-keys.ts +0 -9
  146. package/packs/software-delivery/src/config/schemas/lumenflow-config-schema-types.ts +0 -460
  147. package/packs/software-delivery/src/config/workspace-reader.ts +0 -375
  148. package/packs/software-delivery/src/constants/backlog-patterns.ts +0 -31
  149. package/packs/software-delivery/src/constants/client-ids.ts +0 -19
  150. package/packs/software-delivery/src/constants/config-contract.ts +0 -7
  151. package/packs/software-delivery/src/constants/docs-layout-presets.ts +0 -50
  152. package/packs/software-delivery/src/constants/duration-constants.ts +0 -20
  153. package/packs/software-delivery/src/constants/gate-constants.ts +0 -32
  154. package/packs/software-delivery/src/constants/index.ts +0 -29
  155. package/packs/software-delivery/src/constants/lock-constants.ts +0 -35
  156. package/packs/software-delivery/src/constants/object-guards.ts +0 -12
  157. package/packs/software-delivery/src/constants/section-headings.ts +0 -107
  158. package/packs/software-delivery/src/constants/wu-cli-constants.ts +0 -500
  159. package/packs/software-delivery/src/constants/wu-domain-constants.ts +0 -466
  160. package/packs/software-delivery/src/constants/wu-git-constants.ts +0 -7
  161. package/packs/software-delivery/src/constants/wu-id-format.ts +0 -327
  162. package/packs/software-delivery/src/constants/wu-paths-constants.ts +0 -384
  163. package/packs/software-delivery/src/constants/wu-statuses.ts +0 -287
  164. package/packs/software-delivery/src/constants/wu-type-helpers.ts +0 -67
  165. package/packs/software-delivery/src/constants/wu-ui-constants.ts +0 -267
  166. package/packs/software-delivery/src/constants/wu-validation-constants.ts +0 -73
  167. package/packs/software-delivery/src/domain/index.ts +0 -5
  168. package/packs/software-delivery/src/domain/orchestration.constants.ts +0 -166
  169. package/packs/software-delivery/src/domain/orchestration.schemas.ts +0 -238
  170. package/packs/software-delivery/src/domain/orchestration.types.ts +0 -176
  171. package/packs/software-delivery/src/methodology/incremental-test.ts +0 -122
  172. package/packs/software-delivery/src/methodology/index.ts +0 -6
  173. package/packs/software-delivery/src/methodology/manual-test-validator.ts +0 -292
  174. package/packs/software-delivery/src/policy/coverage-gate.ts +0 -270
  175. package/packs/software-delivery/src/policy/gates-agent-mode.ts +0 -223
  176. package/packs/software-delivery/src/policy/gates-config-internal.ts +0 -121
  177. package/packs/software-delivery/src/policy/gates-config.ts +0 -300
  178. package/packs/software-delivery/src/policy/gates-coverage.ts +0 -356
  179. package/packs/software-delivery/src/policy/gates-presets.ts +0 -134
  180. package/packs/software-delivery/src/policy/gates-schemas.ts +0 -173
  181. package/packs/software-delivery/src/policy/index.ts +0 -22
  182. package/packs/software-delivery/src/policy/package-manager-resolver.ts +0 -319
  183. package/packs/software-delivery/src/policy/resolve-policy.ts +0 -601
  184. package/packs/software-delivery/src/ports/config.ports.ts +0 -90
  185. package/packs/software-delivery/src/ports/dashboard-renderer.port.ts +0 -125
  186. package/packs/software-delivery/src/ports/index.ts +0 -10
  187. package/packs/software-delivery/src/ports/sync-validator.ports.ts +0 -59
  188. package/packs/software-delivery/src/ports/wu-helpers.ports.ts +0 -168
  189. package/packs/software-delivery/src/ports/wu-state.ports.ts +0 -241
  190. package/packs/software-delivery/src/primitives/index.ts +0 -5
  191. package/packs/software-delivery/src/runtime/index.ts +0 -6
  192. package/packs/software-delivery/src/runtime/work-classifier.ts +0 -561
  193. package/packs/software-delivery/src/sandbox/index.ts +0 -10
  194. package/packs/software-delivery/src/sandbox/sandbox-allowlist.ts +0 -118
  195. package/packs/software-delivery/src/sandbox/sandbox-backend-linux.ts +0 -88
  196. package/packs/software-delivery/src/sandbox/sandbox-backend-macos.ts +0 -154
  197. package/packs/software-delivery/src/sandbox/sandbox-backend-windows.ts +0 -47
  198. package/packs/software-delivery/src/sandbox/sandbox-profile.ts +0 -153
  199. package/packs/software-delivery/src/schemas/index.ts +0 -5
  200. package/packs/software-delivery/src/state/date-utils.ts +0 -158
  201. package/packs/software-delivery/src/state/index.ts +0 -15
  202. package/packs/software-delivery/src/state/state-machine.ts +0 -119
  203. package/packs/software-delivery/src/state/wu-doc-types.ts +0 -51
  204. package/packs/software-delivery/src/state/wu-paths.ts +0 -381
  205. package/packs/software-delivery/src/state/wu-schema.ts +0 -1139
  206. package/packs/software-delivery/src/state/wu-state-schema.ts +0 -255
  207. package/packs/software-delivery/src/state/wu-yaml.ts +0 -338
  208. package/packs/software-delivery/tool-impl/agent-tools.ts +0 -263
  209. package/packs/software-delivery/tool-impl/delegation-tools.ts +0 -66
  210. package/packs/software-delivery/tool-impl/flow-metrics-tools.ts +0 -219
  211. package/packs/software-delivery/tool-impl/git-runner.ts +0 -113
  212. package/packs/software-delivery/tool-impl/git-tools.ts +0 -316
  213. package/packs/software-delivery/tool-impl/index.ts +0 -15
  214. package/packs/software-delivery/tool-impl/initiative-orchestration-tools.ts +0 -720
  215. package/packs/software-delivery/tool-impl/lane-lock.ts +0 -246
  216. package/packs/software-delivery/tool-impl/memory-tools.ts +0 -470
  217. package/packs/software-delivery/tool-impl/pending-runtime-tools.ts +0 -21
  218. package/packs/software-delivery/tool-impl/runtime-cli-adapter.ts +0 -329
  219. package/packs/software-delivery/tool-impl/runtime-native-tools.ts +0 -687
  220. package/packs/software-delivery/tool-impl/worker-loader.ts +0 -52
  221. package/packs/software-delivery/tool-impl/worktree-tools.ts +0 -46
  222. package/packs/software-delivery/tool-impl/wu-lifecycle-tools.ts +0 -807
  223. package/packs/software-delivery/tools/delegation-tools.ts +0 -23
  224. package/packs/software-delivery/tools/git-tools.ts +0 -55
  225. package/packs/software-delivery/tools/index.ts +0 -8
  226. package/packs/software-delivery/tools/lane-lock-tool.ts +0 -37
  227. package/packs/software-delivery/tools/types.ts +0 -71
  228. package/packs/software-delivery/tools/worktree-tools.ts +0 -49
  229. package/packs/software-delivery/vitest.config.ts +0 -11
@@ -1,125 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Dashboard Renderer Port
6
- *
7
- * Hexagonal Architecture - Output Port
8
- * Defines the contract for rendering orchestration dashboard data to UnsafeAny UI.
9
- * This abstraction allows the application layer to remain independent of
10
- * specific rendering implementations.
11
- *
12
- * Current Implementations:
13
- * - TerminalDashboardRenderer (WU-1322) - ASCII/ANSI terminal output
14
- *
15
- * Future Implementations:
16
- * - WebDashboardRenderer - Browser-based UI
17
- * - VSCodeWebviewRenderer - VS Code extension panel
18
- *
19
- * SOLID Principles:
20
- * - Dependency Inversion: Use cases depend on this abstraction, not concrete renderers
21
- * - Interface Segregation: Focused on rendering, no data fetching concerns
22
- * - Open/Closed: New renderers can be added without modifying existing code
23
- *
24
- * @module dashboard-renderer.port
25
- * @see {@link ../domain/orchestration.types.ts} - Types used in this interface
26
- * @see {@link ../../adapters/terminal-renderer.adapter.ts} - Terminal implementation (WU-1322)
27
- */
28
-
29
- import type {
30
- DashboardData,
31
- Suggestion,
32
- ExecutionPlan,
33
- UserChoice,
34
- } from '../domain/orchestration.types.js';
35
-
36
- /**
37
- * Dashboard Renderer Port Interface
38
- *
39
- * Implementers must provide methods to render all dashboard sections
40
- * and handle user interactions for execution plan approval.
41
- *
42
- * @example
43
- * // Implementing a custom renderer
44
- * class CustomRenderer implements IDashboardRenderer {
45
- * render(data: DashboardData): void {
46
- * // Render global status, agent metrics, WU progress, timeline, alerts
47
- * }
48
- *
49
- * renderSuggestions(suggestions: Suggestion[]): void {
50
- * // Display prioritised suggestions
51
- * }
52
- *
53
- * renderPlan(plan: ExecutionPlan): Promise<UserChoice> {
54
- * // Show plan and get user approval
55
- * }
56
- *
57
- * clear(): void {
58
- * // Clear previous output
59
- * }
60
- * }
61
- *
62
- * @example
63
- * // Using in a use case
64
- * class GetDashboardDataUseCase {
65
- * constructor(
66
- * private readonly renderer: IDashboardRenderer,
67
- * private readonly collector: IMetricsCollector,
68
- * ) {}
69
- *
70
- * async execute(): Promise<void> {
71
- * const data = await this.collectData();
72
- * this.renderer.render(data);
73
- * }
74
- * }
75
- */
76
- export interface IDashboardRenderer {
77
- /**
78
- * Render the complete dashboard with all sections.
79
- *
80
- * Sections to render:
81
- * 1. Global Status - Active WUs, completed, blocked, gates failing
82
- * 2. Agent Small Multiples - Per-agent metrics comparison
83
- * 3. WU Progress - DoD progress bars with agent status
84
- * 4. Timeline - Recent orchestration events
85
- * 5. Alerts - Items requiring attention
86
- *
87
- * @param data - Complete dashboard data from metrics collector
88
- */
89
- render(data: DashboardData): void;
90
-
91
- /**
92
- * Render a list of prioritised suggestions.
93
- *
94
- * Suggestions should be displayed with:
95
- * - Priority indicator (HIGH/MEDIUM/LOW)
96
- * - Action description
97
- * - Reason for suggestion
98
- * - Command to execute
99
- *
100
- * @param suggestions - Ordered list of suggestions (highest priority first)
101
- */
102
- renderSuggestions(suggestions: Suggestion[]): void;
103
-
104
- /**
105
- * Render an execution plan and get user approval.
106
- *
107
- * Should display:
108
- * - WU being executed
109
- * - Ordered list of steps
110
- * - Estimated token cost
111
- * - Approval prompt (approve/reject/edit)
112
- *
113
- * @param plan - Proposed execution plan
114
- * @returns User's choice (approve, reject, or edit with modifications)
115
- */
116
- renderPlan(plan: ExecutionPlan): Promise<UserChoice>;
117
-
118
- /**
119
- * Clear UnsafeAny previous dashboard output.
120
- *
121
- * Used before re-rendering to prevent stale data display.
122
- * Implementation depends on output medium (e.g., clear terminal, DOM update).
123
- */
124
- clear(): void;
125
- }
@@ -1,10 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- // Barrel for pack-local port contracts. Populated by Layer 4 of INIT-058.
5
- // WU-2699: moved wu-state.ports, sync-validator.ports from @lumenflow/core.
6
- // WU-2716: moved wu-helpers.ports, config.ports from @lumenflow/core.
7
- export * from './wu-state.ports.js';
8
- export * from './sync-validator.ports.js';
9
- export * from './wu-helpers.ports.js';
10
- export * from './config.ports.js';
@@ -1,59 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * Sync Validator Port Interfaces
6
- *
7
- * Canonical git adapter contract for main-branch sync validation helpers.
8
- *
9
- * @module ports/sync-validator
10
- */
11
-
12
- import type { IGitAdapter } from '@lumenflow/host/git/git-validator.ports';
13
-
14
- /**
15
- * Canonical git adapter shape for sync validation operations.
16
- */
17
- export interface ISyncValidatorGitAdapter {
18
- fetch: IGitAdapter['fetch'];
19
- getCommitHash: IGitAdapter['getCommitHash'];
20
- revList: IGitAdapter['revList'];
21
- }
22
-
23
- /**
24
- * WU-2208: Git adapter shape for remote-aware WU ID generation.
25
- *
26
- * Extends the sync validator contract with tree listing and file content
27
- * retrieval at a specific git ref (e.g., origin/main). Designed to
28
- * accommodate future cloud `allocateWuId()` by keeping the interface
29
- * narrow and async.
30
- */
31
- export interface IWuIdGitAdapter {
32
- /** Fetch remote refs (e.g., origin main). */
33
- fetch: IGitAdapter['fetch'];
34
-
35
- /**
36
- * List file/directory names at a given ref and tree path.
37
- *
38
- * Equivalent to: git ls-tree --name-only <ref> <path>/
39
- * Returns an array of filenames (not full paths) within the directory.
40
- * Returns empty array if the path does not exist at the given ref.
41
- *
42
- * @param ref - Git ref (e.g., 'origin/main')
43
- * @param path - Directory path relative to repo root (e.g., 'docs/operations/tasks/wu')
44
- * @returns Array of filenames in the directory at the given ref
45
- */
46
- listTreeAtRef(ref: string, path: string): Promise<string[]>;
47
-
48
- /**
49
- * Show a file's content at a given ref.
50
- *
51
- * Equivalent to: git show <ref>:<path>
52
- * Returns empty string if the file does not exist at the given ref.
53
- *
54
- * @param ref - Git ref (e.g., 'origin/main')
55
- * @param path - File path relative to repo root
56
- * @returns File content as string, or empty string if not found
57
- */
58
- showFileAtRef(ref: string, path: string): Promise<string>;
59
- }
@@ -1,168 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * WU Helpers Port Interfaces
6
- *
7
- * WU-1102: INIT-003 Phase 2b - Port interfaces for WU helper modules
8
- *
9
- * Hexagonal Architecture - Input Ports:
10
- * These abstractions allow external users to inject custom implementations
11
- * for WU lifecycle operations.
12
- *
13
- * @module ports/wu-helpers
14
- */
15
-
16
- import type { ISyncValidatorGitAdapter } from './sync-validator.ports.js';
17
-
18
- /**
19
- * Git adapter interface for ensureOnMain and ensureMainUpToDate operations
20
- */
21
- export interface IWuGitAdapter extends Pick<ISyncValidatorGitAdapter, 'fetch' | 'getCommitHash'> {
22
- /**
23
- * Get the current git branch name
24
- * @returns Promise resolving to branch name
25
- */
26
- getCurrentBranch(): Promise<string>;
27
- }
28
-
29
- /**
30
- * WU status check result
31
- */
32
- export interface IWuStatusCheckResult {
33
- /** Whether the operation is allowed */
34
- allowed: boolean;
35
- /** Current WU status */
36
- status: string | null;
37
- /** Error message if not allowed */
38
- error: string | null;
39
- }
40
-
41
- /**
42
- * Branch validation result
43
- */
44
- export interface IBranchValidationResult {
45
- /** Whether the branch name is valid */
46
- valid: boolean;
47
- /** Lane name (kebab-case) or null */
48
- lane: string | null;
49
- /** WU ID (uppercase) or null */
50
- wuid: string | null;
51
- /** Error message if invalid */
52
- error: string | null;
53
- }
54
-
55
- /**
56
- * WU YAML reader interface
57
- */
58
- export interface IWuYamlReader {
59
- /**
60
- * Read and parse WU YAML file
61
- * @param wuPath - Path to WU YAML file
62
- * @param expectedId - Expected WU ID for validation
63
- * @returns Parsed WU document
64
- */
65
- readWU(wuPath: string, expectedId: string): unknown;
66
-
67
- /**
68
- * Read YAML file without ID validation
69
- * @param yamlPath - Path to YAML file
70
- * @returns Parsed document
71
- */
72
- readWURaw(yamlPath: string): unknown;
73
- }
74
-
75
- /**
76
- * WU YAML writer interface
77
- */
78
- export interface IWuYamlWriter {
79
- /**
80
- * Write WU document to file
81
- * @param wuPath - Path to WU YAML file
82
- * @param doc - Document to write
83
- */
84
- writeWU(wuPath: string, doc: unknown): void;
85
- }
86
-
87
- // WU-2020: IWuStateStore is now canonically defined in wu-state.ports.ts
88
- // Re-export here for backward compatibility with consumers importing from wu-helpers.ports.
89
- export type { IWuStateStore } from './wu-state.ports.js';
90
-
91
- /**
92
- * WU checkpoint interface
93
- */
94
- export interface IWuCheckpointManager {
95
- /**
96
- * Create a pre-gates checkpoint
97
- */
98
- createPreGatesCheckpoint(
99
- params: { wuId: string; worktreePath: string; branchName: string; gatesPassed?: boolean },
100
- options?: { baseDir?: string },
101
- ): Promise<{ checkpointId: string; gatesPassed: boolean }>;
102
-
103
- /**
104
- * Mark checkpoint as gates passed
105
- * @param wuId - WU identifier
106
- * @returns True if updated
107
- */
108
- markGatesPassed(wuId: string, options?: { baseDir?: string }): boolean;
109
-
110
- /**
111
- * Get checkpoint for a WU
112
- * @param wuId - WU identifier
113
- * @returns Checkpoint or null
114
- */
115
- getCheckpoint(
116
- wuId: string,
117
- options?: { baseDir?: string },
118
- ): { gatesPassed: boolean; worktreeHeadSha: string } | null;
119
-
120
- /**
121
- * Clear checkpoint
122
- * @param wuId - WU identifier
123
- */
124
- clearCheckpoint(wuId: string, options?: { baseDir?: string }): void;
125
-
126
- /**
127
- * Check if gates can be skipped
128
- */
129
- canSkipGates(
130
- wuId: string,
131
- options?: { baseDir?: string; currentHeadSha?: string },
132
- ): { canSkip: boolean; reason?: string };
133
- }
134
-
135
- /**
136
- * WU paths interface
137
- */
138
- export interface IWuPaths {
139
- /** Get path to WU YAML file */
140
- WU(id: string): string;
141
-
142
- /** Get path to WU directory */
143
- WU_DIR(): string;
144
-
145
- /** Get path to status.md */
146
- STATUS(): string;
147
-
148
- /** Get path to backlog.md */
149
- BACKLOG(): string;
150
-
151
- /** Get path to stamps directory */
152
- STAMPS_DIR(): string;
153
-
154
- /** Get path to WU done stamp file */
155
- STAMP(id: string): string;
156
-
157
- /** Get path to state directory */
158
- STATE_DIR(): string;
159
-
160
- /** Get path to initiatives directory */
161
- INITIATIVES_DIR(): string;
162
-
163
- /** Get path to initiative YAML file */
164
- INITIATIVE(id: string): string;
165
-
166
- /** Get path to worktrees directory */
167
- WORKTREES_DIR(): string;
168
- }
@@ -1,241 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- /**
5
- * WU State Ports (WU-2013)
6
- *
7
- * Focused interfaces for the decomposed WU state store services.
8
- * Each interface defines a single responsibility boundary.
9
- *
10
- * Error Contract (WU-2128):
11
- * Port methods THROW on failure (boundary contracts). Specifically:
12
- * - State transition methods (claim, complete, block, etc.) throw if the
13
- * WU is in an invalid state for the requested transition.
14
- * - Lock methods (acquireLock) throw if the lock cannot be acquired.
15
- * - Query methods (getWUState, getByStatus) return undefined/empty set for
16
- * "not found" conditions -- absence of data is not an error.
17
- *
18
- * @module ports/wu-state
19
- */
20
-
21
- import type { WUEvent } from '../state/wu-state-schema.js';
22
-
23
- /**
24
- * WU state entry in the in-memory store
25
- */
26
- export interface WUStateEntry {
27
- status: string;
28
- lane: string;
29
- title: string;
30
- completedAt?: string;
31
- lastCheckpoint?: string;
32
- lastCheckpointNote?: string;
33
- }
34
-
35
- /**
36
- * Checkpoint options for recording WU progress
37
- */
38
- export interface CheckpointOptions {
39
- sessionId?: string;
40
- progress?: string;
41
- nextSteps?: string;
42
- }
43
-
44
- /**
45
- * Lock file data structure
46
- */
47
- export interface LockData {
48
- pid: number;
49
- timestamp: number;
50
- hostname: string;
51
- }
52
-
53
- /**
54
- * Repair result from corruption recovery
55
- */
56
- export interface RepairResult {
57
- success: boolean;
58
- linesKept: number;
59
- linesRemoved: number;
60
- backupPath: string | null;
61
- warnings: string[];
62
- }
63
-
64
- /**
65
- * Event log interface for loading, replaying, and appending WU events.
66
- *
67
- * Responsible for:
68
- * - Loading events from JSONL storage
69
- * - Replaying events to rebuild in-memory state
70
- * - Appending new validated events
71
- */
72
- export interface IWuEventLog {
73
- /**
74
- * Load and replay events from storage into in-memory state.
75
- * Resets all state before replaying.
76
- */
77
- load(): Promise<void>;
78
-
79
- /**
80
- * Append a validated event to persistent storage and apply to in-memory state.
81
- */
82
- appendAndApply(event: WUEvent): Promise<void>;
83
-
84
- /**
85
- * Apply a validated event to in-memory state without persisting.
86
- */
87
- applyEvent(event: WUEvent): void;
88
- }
89
-
90
- /**
91
- * Lock manager interface for file-level locking with stale detection.
92
- *
93
- * Responsible for:
94
- * - Acquiring file locks with retry logic
95
- * - Releasing file locks
96
- * - Detecting stale locks (expired or dead process)
97
- */
98
- export interface IWuLockManager {
99
- /**
100
- * Acquire a file lock at the given path.
101
- * Retries with stale lock detection.
102
- *
103
- * @throws Error if lock cannot be acquired after retries
104
- */
105
- acquireLock(lockPath: string): Promise<void>;
106
-
107
- /**
108
- * Release a file lock at the given path.
109
- * Silently ignores errors if lock file doesn't exist.
110
- */
111
- releaseLock(lockPath: string): void;
112
-
113
- /**
114
- * Check if a lock is stale (expired timeout or dead process).
115
- */
116
- isLockStale(lockData: LockData): boolean;
117
- }
118
-
119
- /**
120
- * State query interface for O(1) lookups into WU state.
121
- *
122
- * Responsible for:
123
- * - Querying WU state by ID
124
- * - Querying WU IDs by status (O(1))
125
- * - Querying WU IDs by lane (O(1))
126
- * - Querying child WU IDs by parent (O(1))
127
- */
128
- export interface IWuStateQuery {
129
- /**
130
- * Get current in-memory state for a WU.
131
- */
132
- getWUState(wuId: string): WUStateEntry | undefined;
133
-
134
- /**
135
- * Get WU IDs by status (O(1) lookup).
136
- */
137
- getByStatus(status: string): Set<string>;
138
-
139
- /**
140
- * Get WU IDs by lane (O(1) lookup).
141
- */
142
- getByLane(lane: string): Set<string>;
143
-
144
- /**
145
- * Get child WU IDs delegated from a parent WU (O(1) lookup).
146
- */
147
- getChildWUs(parentWuId: string): Set<string>;
148
-
149
- /**
150
- * WU-2552: Resolve a (possibly stale) WU id to its current canonical
151
- * id after any observed wu_renamed events. Returns the input unchanged
152
- * if no rename chain applies.
153
- */
154
- resolveRenamedWuId(wuId: string): string;
155
- }
156
-
157
- // ---------------------------------------------------------------------------
158
- // Composite interface for command handler injection (WU-2020)
159
- // ---------------------------------------------------------------------------
160
-
161
- /**
162
- * WU State Store interface for dependency injection in command handlers.
163
- *
164
- * Combines event log and state query capabilities into a single injectable
165
- * interface. Command handlers should depend on this interface rather than
166
- * importing and instantiating WUStateStore directly.
167
- *
168
- * WU-2020: DIP compliance - high-level modules depend on abstraction,
169
- * not on the concrete WUStateStore class.
170
- *
171
- * @example
172
- * ```typescript
173
- * // Command handler accepts interface, not concrete class
174
- * async function completeWU(store: IWuStateStore, wuId: string) {
175
- * await store.load();
176
- * await store.complete(wuId);
177
- * }
178
- * ```
179
- */
180
- export interface IWuStateStore extends IWuEventLog, IWuStateQuery {
181
- /**
182
- * Claim a WU, transitioning it to in_progress status.
183
- * @throws Error if WU is already in_progress
184
- */
185
- claim(wuId: string, lane: string, title: string): Promise<void>;
186
-
187
- /**
188
- * Complete a WU, transitioning it to done status.
189
- * @throws Error if WU is not in_progress
190
- */
191
- complete(wuId: string): Promise<void>;
192
-
193
- /**
194
- * Block a WU with a reason.
195
- * @throws Error if WU is not in_progress
196
- */
197
- block(wuId: string, reason: string): Promise<void>;
198
-
199
- /**
200
- * Unblock a WU, transitioning it back to in_progress.
201
- * @throws Error if WU is not blocked
202
- */
203
- unblock(wuId: string): Promise<void>;
204
-
205
- /**
206
- * Record a checkpoint for a WU without changing its status.
207
- */
208
- checkpoint(wuId: string, note: string, options?: CheckpointOptions): Promise<void>;
209
-
210
- /**
211
- * Record a parent-child delegation relationship.
212
- */
213
- delegate(childWuId: string, parentWuId: string, delegationId: string): Promise<void>;
214
-
215
- /**
216
- * Release a WU, transitioning it from in_progress to ready.
217
- * @throws Error if WU is not in_progress
218
- */
219
- release(wuId: string, reason: string): Promise<void>;
220
-
221
- /**
222
- * WU-2552: Append a wu_renamed event mapping `from` to `to`. Historical
223
- * events are not rewritten; the in-memory rename map is updated so
224
- * subsequent events and queries resolve `from` -> `to`.
225
- */
226
- renameWu(from: string, to: string, reason?: string): Promise<void>;
227
-
228
- /**
229
- * Create a complete event without persisting it.
230
- * Useful for transactional flows.
231
- * @throws Error if WU is not in_progress
232
- */
233
- createCompleteEvent(wuId: string, timestamp?: string): WUEvent;
234
-
235
- /**
236
- * Create a release event without persisting it.
237
- * Useful for transactional flows.
238
- * @throws Error if WU is not in_progress
239
- */
240
- createReleaseEvent(wuId: string, reason: string, timestamp?: string): WUEvent;
241
- }
@@ -1,5 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- // Barrel for pack-local primitives. Populated by Layers 2-4 of INIT-058.
5
- export {};
@@ -1,6 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- // Barrel for pack-runtime-helpers. Populated by Layer 4 of INIT-058.
5
- // WU-2698: added work-classifier (L4-prep narrow — pure leaf from @lumenflow/core).
6
- export * from './work-classifier.js';