@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,720 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: LicenseRef-LumenFlow-Proprietary
3
-
4
- import type { ToolOutput } from '@lumenflow/kernel';
5
- import { RUNTIME_CLI_COMMANDS, runtimeCliAdapter } from './runtime-cli-adapter.js';
6
-
7
- const INITIATIVE_ORCHESTRATION_TOOLS = {
8
- CLOUD_CONNECT: 'cloud:connect',
9
- WORKSPACE_INIT: 'workspace:init',
10
- INITIATIVE_ADD_WU: 'initiative:add-wu',
11
- INITIATIVE_BULK_ASSIGN: 'initiative:bulk-assign',
12
- INITIATIVE_CREATE: 'initiative:create',
13
- INITIATIVE_EDIT: 'initiative:edit',
14
- INITIATIVE_LIST: 'initiative:list',
15
- INITIATIVE_PLAN: 'initiative:plan',
16
- INITIATIVE_REMOVE_WU: 'initiative:remove-wu',
17
- INITIATIVE_STATUS: 'initiative:status',
18
- ORCHESTRATE_INIT_STATUS: 'orchestrate:init-status',
19
- ORCHESTRATE_INITIATIVE: 'orchestrate:initiative',
20
- ORCHESTRATE_MONITOR: 'orchestrate:monitor',
21
- PLAN_CREATE: 'plan:create',
22
- PLAN_EDIT: 'plan:edit',
23
- PLAN_LINK: 'plan:link',
24
- PLAN_PROMOTE: 'plan:promote',
25
- DELEGATION_LIST: 'delegation:list',
26
- DOCS_SYNC: 'docs:sync',
27
- INIT_PLAN: 'init:plan',
28
- LUMENFLOW: 'lumenflow',
29
- LUMENFLOW_DOCTOR: 'lumenflow:doctor',
30
- LUMENFLOW_INTEGRATE: 'lumenflow:integrate',
31
- LUMENFLOW_RELEASE: 'lumenflow:release',
32
- LUMENFLOW_UPGRADE: 'lumenflow:upgrade',
33
- SYNC_TEMPLATES: 'sync:templates',
34
- } as const;
35
-
36
- type InitiativeOrchestrationToolName =
37
- (typeof INITIATIVE_ORCHESTRATION_TOOLS)[keyof typeof INITIATIVE_ORCHESTRATION_TOOLS];
38
-
39
- const INITIATIVE_ORCHESTRATION_TOOL_ERROR_CODES: Record<InitiativeOrchestrationToolName, string> = {
40
- 'cloud:connect': 'CLOUD_CONNECT_ERROR',
41
- 'workspace:init': 'WORKSPACE_INIT_ERROR',
42
- 'initiative:add-wu': 'INITIATIVE_ADD_WU_ERROR',
43
- 'initiative:bulk-assign': 'INITIATIVE_BULK_ASSIGN_ERROR',
44
- 'initiative:create': 'INITIATIVE_CREATE_ERROR',
45
- 'initiative:edit': 'INITIATIVE_EDIT_ERROR',
46
- 'initiative:list': 'INITIATIVE_LIST_ERROR',
47
- 'initiative:plan': 'INITIATIVE_PLAN_ERROR',
48
- 'initiative:remove-wu': 'INITIATIVE_REMOVE_WU_ERROR',
49
- 'initiative:status': 'INITIATIVE_STATUS_ERROR',
50
- 'orchestrate:init-status': 'ORCHESTRATE_INIT_STATUS_ERROR',
51
- 'orchestrate:initiative': 'ORCHESTRATE_INITIATIVE_ERROR',
52
- 'orchestrate:monitor': 'ORCHESTRATE_MONITOR_ERROR',
53
- 'plan:create': 'PLAN_CREATE_ERROR',
54
- 'plan:edit': 'PLAN_EDIT_ERROR',
55
- 'plan:link': 'PLAN_LINK_ERROR',
56
- 'plan:promote': 'PLAN_PROMOTE_ERROR',
57
- 'delegation:list': 'DELEGATION_LIST_ERROR',
58
- 'docs:sync': 'DOCS_SYNC_ERROR',
59
- 'init:plan': 'INIT_PLAN_ERROR',
60
- lumenflow: 'LUMENFLOW_INIT_ERROR',
61
- 'lumenflow:doctor': 'LUMENFLOW_DOCTOR_ERROR',
62
- 'lumenflow:integrate': 'LUMENFLOW_INTEGRATE_ERROR',
63
- 'lumenflow:release': 'LUMENFLOW_RELEASE_ERROR',
64
- 'lumenflow:upgrade': 'LUMENFLOW_UPGRADE_ERROR',
65
- 'sync:templates': 'SYNC_TEMPLATES_ALIAS_ERROR',
66
- };
67
-
68
- const INITIATIVE_ORCHESTRATION_TOOL_COMMANDS: Record<
69
- InitiativeOrchestrationToolName,
70
- (typeof RUNTIME_CLI_COMMANDS)[keyof typeof RUNTIME_CLI_COMMANDS]
71
- > = {
72
- 'cloud:connect': RUNTIME_CLI_COMMANDS.INIT,
73
- 'workspace:init': RUNTIME_CLI_COMMANDS.WORKSPACE_INIT,
74
- 'initiative:add-wu': RUNTIME_CLI_COMMANDS.INITIATIVE_ADD_WU,
75
- 'initiative:bulk-assign': RUNTIME_CLI_COMMANDS.INITIATIVE_BULK_ASSIGN,
76
- 'initiative:create': RUNTIME_CLI_COMMANDS.INITIATIVE_CREATE,
77
- 'initiative:edit': RUNTIME_CLI_COMMANDS.INITIATIVE_EDIT,
78
- 'initiative:list': RUNTIME_CLI_COMMANDS.INITIATIVE_LIST,
79
- 'initiative:plan': RUNTIME_CLI_COMMANDS.INITIATIVE_PLAN,
80
- 'initiative:remove-wu': RUNTIME_CLI_COMMANDS.INITIATIVE_REMOVE_WU,
81
- 'initiative:status': RUNTIME_CLI_COMMANDS.INITIATIVE_STATUS,
82
- 'orchestrate:init-status': RUNTIME_CLI_COMMANDS.ORCHESTRATE_INIT_STATUS,
83
- 'orchestrate:initiative': RUNTIME_CLI_COMMANDS.ORCHESTRATE_INITIATIVE,
84
- 'orchestrate:monitor': RUNTIME_CLI_COMMANDS.ORCHESTRATE_MONITOR,
85
- 'plan:create': RUNTIME_CLI_COMMANDS.PLAN_CREATE,
86
- 'plan:edit': RUNTIME_CLI_COMMANDS.PLAN_EDIT,
87
- 'plan:link': RUNTIME_CLI_COMMANDS.PLAN_LINK,
88
- 'plan:promote': RUNTIME_CLI_COMMANDS.PLAN_PROMOTE,
89
- 'delegation:list': RUNTIME_CLI_COMMANDS.DELEGATION_LIST,
90
- 'docs:sync': RUNTIME_CLI_COMMANDS.DOCS_SYNC,
91
- 'init:plan': RUNTIME_CLI_COMMANDS.INITIATIVE_PLAN,
92
- lumenflow: RUNTIME_CLI_COMMANDS.INIT,
93
- 'lumenflow:doctor': RUNTIME_CLI_COMMANDS.LUMENFLOW_DOCTOR,
94
- 'lumenflow:integrate': RUNTIME_CLI_COMMANDS.INTEGRATE,
95
- 'lumenflow:release': RUNTIME_CLI_COMMANDS.RELEASE,
96
- 'lumenflow:upgrade': RUNTIME_CLI_COMMANDS.LUMENFLOW_UPGRADE,
97
- 'sync:templates': RUNTIME_CLI_COMMANDS.SYNC_TEMPLATES,
98
- };
99
-
100
- const FLAG_NAMES = {
101
- ADD_LANE: '--add-lane',
102
- ADD_PHASE: '--add-phase',
103
- ADD_SUCCESS_METRIC: '--add-success-metric',
104
- APPEND: '--append',
105
- APPLY: '--apply',
106
- CHECKPOINT_PER_WAVE: '--checkpoint-per-wave',
107
- CLIENT: '--client',
108
- CONFIG: '--config',
109
- CONTENT: '--content',
110
- CREATE: '--create',
111
- CREATED: '--created',
112
- DESCRIPTION: '--description',
113
- DRY_RUN: '--dry-run',
114
- ENDPOINT: '--endpoint',
115
- FORCE: '--force',
116
- FORMAT: '--format',
117
- FRAMEWORK: '--framework',
118
- FULL: '--full',
119
- ID: '--id',
120
- INITIATIVE: '--initiative',
121
- JSON: '--json',
122
- MERGE: '--merge',
123
- MINIMAL: '--minimal',
124
- NOTES: '--notes',
125
- ORG_ID: '--org-id',
126
- OUTPUT: '--output',
127
- PHASE: '--phase',
128
- PHASE_ID: '--phase-id',
129
- PHASE_STATUS: '--phase-status',
130
- PLAN: '--plan',
131
- POLICY_MODE: '--policy-mode',
132
- PRIORITY: '--priority',
133
- PROJECT_ID: '--project-id',
134
- PROGRESS: '--progress',
135
- RECOVER: '--recover',
136
- REMOVE_LANE: '--remove-lane',
137
- SECTION: '--section',
138
- SIGNALS_ONLY: '--signals-only',
139
- SINCE: '--since',
140
- SLUG: '--slug',
141
- STATUS: '--status',
142
- SYNC_INTERVAL: '--sync-interval',
143
- SYNC_FROM_INITIATIVE: '--sync-from-initiative',
144
- TARGET_DATE: '--target-date',
145
- THRESHOLD: '--threshold',
146
- TOKEN_ENV: '--token-env',
147
- TITLE: '--title',
148
- UNBLOCK: '--unblock',
149
- VENDOR: '--vendor',
150
- WU: '--wu',
151
- YES: '--yes',
152
- } as const;
153
-
154
- const CLOUD_CONNECT_SUBCOMMAND = 'cloud:connect';
155
- const LUMENFLOW_DEFAULT_SUBCOMMAND = 'commands';
156
-
157
- const MISSING_PARAMETER_MESSAGES = {
158
- CLIENT_REQUIRED: 'client is required',
159
- DELEGATION_TARGET_REQUIRED: 'Either wu or initiative is required',
160
- ENDPOINT_REQUIRED: 'endpoint is required',
161
- ID_REQUIRED: 'id is required',
162
- INITIATIVE_REQUIRED: 'initiative is required',
163
- ORG_ID_REQUIRED: 'org_id is required',
164
- PLAN_REQUIRED: 'plan is required',
165
- PROJECT_ID_REQUIRED: 'project_id is required',
166
- TITLE_REQUIRED: 'title is required',
167
- WU_REQUIRED: 'wu is required',
168
- } as const;
169
-
170
- interface CommandExecutionResult {
171
- ok: boolean;
172
- status: number;
173
- stdout: string;
174
- stderr: string;
175
- executionError?: string;
176
- }
177
-
178
- function toRecord(input: unknown): Record<string, unknown> {
179
- if (input && typeof input === 'object') {
180
- return input as Record<string, unknown>;
181
- }
182
- return {};
183
- }
184
-
185
- function toStringValue(value: unknown): string | null {
186
- if (typeof value !== 'string') {
187
- return null;
188
- }
189
- const trimmed = value.trim();
190
- return trimmed.length > 0 ? trimmed : null;
191
- }
192
-
193
- function toStringArray(value: unknown): string[] {
194
- if (!Array.isArray(value)) {
195
- return [];
196
- }
197
- return value
198
- .map((entry) => toStringValue(entry))
199
- .filter((entry): entry is string => entry !== null);
200
- }
201
-
202
- function toIntegerString(value: unknown): string | null {
203
- if (typeof value === 'number' && Number.isFinite(value)) {
204
- return String(Math.trunc(value));
205
- }
206
- if (typeof value === 'string') {
207
- const trimmed = value.trim();
208
- return trimmed.length > 0 ? trimmed : null;
209
- }
210
- return null;
211
- }
212
-
213
- function appendFlagIfTrue(args: string[], enabled: unknown, flagName: string): void {
214
- if (enabled === true) {
215
- args.push(flagName);
216
- }
217
- }
218
-
219
- function appendValueIfPresent(
220
- args: string[],
221
- flagName: string,
222
- value: unknown,
223
- converter: (value: unknown) => string | null = toStringValue,
224
- ): void {
225
- const converted = converter(value);
226
- if (converted) {
227
- args.push(flagName, converted);
228
- }
229
- }
230
-
231
- async function runInitiativeOrchestrationCommand(
232
- toolName: InitiativeOrchestrationToolName,
233
- args: string[],
234
- ): Promise<CommandExecutionResult> {
235
- return runtimeCliAdapter.run(INITIATIVE_ORCHESTRATION_TOOL_COMMANDS[toolName], args);
236
- }
237
-
238
- function createMissingParameterOutput(message: string): ToolOutput {
239
- return {
240
- success: false,
241
- error: {
242
- code: 'MISSING_PARAMETER',
243
- message,
244
- },
245
- };
246
- }
247
-
248
- function createFailureOutput(
249
- toolName: InitiativeOrchestrationToolName,
250
- execution: CommandExecutionResult,
251
- ): ToolOutput {
252
- const stderrMessage = execution.stderr.trim();
253
- const stdoutMessage = execution.stdout.trim();
254
- const message =
255
- execution.executionError ??
256
- (stderrMessage.length > 0
257
- ? stderrMessage
258
- : stdoutMessage.length > 0
259
- ? stdoutMessage
260
- : `${toolName} failed`);
261
-
262
- return {
263
- success: false,
264
- error: {
265
- code: INITIATIVE_ORCHESTRATION_TOOL_ERROR_CODES[toolName],
266
- message,
267
- details: {
268
- exit_code: execution.status,
269
- stdout: execution.stdout,
270
- stderr: execution.stderr,
271
- },
272
- },
273
- };
274
- }
275
-
276
- function parseJsonOutput(stdout: string): unknown | null {
277
- const trimmed = stdout.trim();
278
- if (trimmed.length === 0) {
279
- return null;
280
- }
281
- try {
282
- return JSON.parse(trimmed) as unknown;
283
- } catch {
284
- return null;
285
- }
286
- }
287
-
288
- function createSuccessOutput(
289
- toolName: InitiativeOrchestrationToolName,
290
- execution: CommandExecutionResult,
291
- ): ToolOutput {
292
- const parsedJson = parseJsonOutput(execution.stdout);
293
- if (parsedJson !== null) {
294
- return {
295
- success: true,
296
- data: parsedJson,
297
- };
298
- }
299
-
300
- const message = execution.stdout.trim().length > 0 ? execution.stdout.trim() : `${toolName} ran`;
301
- return {
302
- success: true,
303
- data: {
304
- message,
305
- },
306
- };
307
- }
308
-
309
- async function executeInitiativeOrchestrationTool(
310
- toolName: InitiativeOrchestrationToolName,
311
- args: string[],
312
- ): Promise<ToolOutput> {
313
- const execution = await runInitiativeOrchestrationCommand(toolName, args);
314
- if (!execution.ok) {
315
- return createFailureOutput(toolName, execution);
316
- }
317
- return createSuccessOutput(toolName, execution);
318
- }
319
-
320
- function requireId(parsed: Record<string, unknown>): string | null {
321
- const id = toStringValue(parsed.id);
322
- return id ?? null;
323
- }
324
-
325
- function requireInitiative(parsed: Record<string, unknown>): string | null {
326
- const initiative = toStringValue(parsed.initiative);
327
- return initiative ?? null;
328
- }
329
-
330
- function requireWu(parsed: Record<string, unknown>): string | null {
331
- const wu = toStringValue(parsed.wu);
332
- return wu ?? null;
333
- }
334
-
335
- function buildInitiativePlanArgs(parsed: Record<string, unknown>): string[] | null {
336
- const initiative = requireInitiative(parsed);
337
- if (!initiative) {
338
- return null;
339
- }
340
- const args = [FLAG_NAMES.INITIATIVE, initiative];
341
- appendValueIfPresent(args, FLAG_NAMES.PLAN, parsed.plan);
342
- appendFlagIfTrue(args, parsed.create, FLAG_NAMES.CREATE);
343
- return args;
344
- }
345
-
346
- export async function initiativeListTool(input: unknown): Promise<ToolOutput> {
347
- const parsed = toRecord(input);
348
- const args: string[] = [];
349
- appendValueIfPresent(args, FLAG_NAMES.STATUS, parsed.status);
350
- appendValueIfPresent(args, FLAG_NAMES.FORMAT, parsed.format);
351
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.INITIATIVE_LIST, args);
352
- }
353
-
354
- export async function initiativeStatusTool(input: unknown): Promise<ToolOutput> {
355
- const parsed = toRecord(input);
356
- const id = requireId(parsed);
357
- if (!id) {
358
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.ID_REQUIRED);
359
- }
360
- const args = [FLAG_NAMES.ID, id];
361
- appendValueIfPresent(args, FLAG_NAMES.FORMAT, parsed.format);
362
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.INITIATIVE_STATUS, args);
363
- }
364
-
365
- export async function initiativeCreateTool(input: unknown): Promise<ToolOutput> {
366
- const parsed = toRecord(input);
367
- const id = requireId(parsed);
368
- if (!id) {
369
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.ID_REQUIRED);
370
- }
371
- const title = toStringValue(parsed.title);
372
- if (!title) {
373
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.TITLE_REQUIRED);
374
- }
375
-
376
- const args = [FLAG_NAMES.ID, id];
377
- appendValueIfPresent(args, FLAG_NAMES.SLUG, parsed.slug);
378
- args.push(FLAG_NAMES.TITLE, title);
379
- appendValueIfPresent(args, FLAG_NAMES.PRIORITY, parsed.priority);
380
- appendValueIfPresent(args, '--owner', parsed.owner);
381
- appendValueIfPresent(args, FLAG_NAMES.TARGET_DATE, parsed.target_date);
382
-
383
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.INITIATIVE_CREATE, args);
384
- }
385
-
386
- export async function initiativeEditTool(input: unknown): Promise<ToolOutput> {
387
- const parsed = toRecord(input);
388
- const id = requireId(parsed);
389
- if (!id) {
390
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.ID_REQUIRED);
391
- }
392
-
393
- const args = [FLAG_NAMES.ID, id];
394
- appendValueIfPresent(args, FLAG_NAMES.DESCRIPTION, parsed.description);
395
- appendValueIfPresent(args, FLAG_NAMES.STATUS, parsed.status);
396
- appendValueIfPresent(args, '--blocked-by', parsed.blocked_by);
397
- appendValueIfPresent(args, '--blocked-reason', parsed.blocked_reason);
398
- appendFlagIfTrue(args, parsed.unblock, FLAG_NAMES.UNBLOCK);
399
- appendValueIfPresent(args, FLAG_NAMES.NOTES, parsed.notes);
400
- appendValueIfPresent(args, FLAG_NAMES.PHASE_ID, parsed.phase_id);
401
- appendValueIfPresent(args, FLAG_NAMES.PHASE_STATUS, parsed.phase_status);
402
- appendValueIfPresent(args, FLAG_NAMES.CREATED, parsed.created);
403
-
404
- for (const lane of toStringArray(parsed.add_lane)) {
405
- args.push(FLAG_NAMES.ADD_LANE, lane);
406
- }
407
- for (const lane of toStringArray(parsed.remove_lane)) {
408
- args.push(FLAG_NAMES.REMOVE_LANE, lane);
409
- }
410
- for (const phase of toStringArray(parsed.add_phase)) {
411
- args.push(FLAG_NAMES.ADD_PHASE, phase);
412
- }
413
- for (const metric of toStringArray(parsed.add_success_metric)) {
414
- args.push(FLAG_NAMES.ADD_SUCCESS_METRIC, metric);
415
- }
416
-
417
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.INITIATIVE_EDIT, args);
418
- }
419
-
420
- export async function initiativeAddWuTool(input: unknown): Promise<ToolOutput> {
421
- const parsed = toRecord(input);
422
- const initiative = requireInitiative(parsed);
423
- if (!initiative) {
424
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.INITIATIVE_REQUIRED);
425
- }
426
- const wu = requireWu(parsed);
427
- if (!wu) {
428
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.WU_REQUIRED);
429
- }
430
-
431
- const args = [FLAG_NAMES.INITIATIVE, initiative, FLAG_NAMES.WU, wu];
432
- appendValueIfPresent(args, FLAG_NAMES.PHASE, parsed.phase, toIntegerString);
433
-
434
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.INITIATIVE_ADD_WU, args);
435
- }
436
-
437
- export async function initiativeRemoveWuTool(input: unknown): Promise<ToolOutput> {
438
- const parsed = toRecord(input);
439
- const initiative = requireInitiative(parsed);
440
- if (!initiative) {
441
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.INITIATIVE_REQUIRED);
442
- }
443
- const wu = requireWu(parsed);
444
- if (!wu) {
445
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.WU_REQUIRED);
446
- }
447
-
448
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.INITIATIVE_REMOVE_WU, [
449
- FLAG_NAMES.INITIATIVE,
450
- initiative,
451
- FLAG_NAMES.WU,
452
- wu,
453
- ]);
454
- }
455
-
456
- export async function initiativeBulkAssignTool(input: unknown): Promise<ToolOutput> {
457
- const parsed = toRecord(input);
458
- const args: string[] = [];
459
- appendValueIfPresent(args, FLAG_NAMES.CONFIG, parsed.config);
460
- appendFlagIfTrue(args, parsed.apply, FLAG_NAMES.APPLY);
461
- appendValueIfPresent(args, FLAG_NAMES.SYNC_FROM_INITIATIVE, parsed.sync_from_initiative);
462
-
463
- return executeInitiativeOrchestrationTool(
464
- INITIATIVE_ORCHESTRATION_TOOLS.INITIATIVE_BULK_ASSIGN,
465
- args,
466
- );
467
- }
468
-
469
- export async function initiativePlanTool(input: unknown): Promise<ToolOutput> {
470
- const parsed = toRecord(input);
471
- const args = buildInitiativePlanArgs(parsed);
472
- if (!args) {
473
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.INITIATIVE_REQUIRED);
474
- }
475
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.INITIATIVE_PLAN, args);
476
- }
477
-
478
- export async function initPlanTool(input: unknown): Promise<ToolOutput> {
479
- const parsed = toRecord(input);
480
- const args = buildInitiativePlanArgs(parsed);
481
- if (!args) {
482
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.INITIATIVE_REQUIRED);
483
- }
484
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.INIT_PLAN, args);
485
- }
486
-
487
- export async function orchestrateInitStatusTool(input: unknown): Promise<ToolOutput> {
488
- const parsed = toRecord(input);
489
- const initiative = requireInitiative(parsed);
490
- if (!initiative) {
491
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.INITIATIVE_REQUIRED);
492
- }
493
- return executeInitiativeOrchestrationTool(
494
- INITIATIVE_ORCHESTRATION_TOOLS.ORCHESTRATE_INIT_STATUS,
495
- [FLAG_NAMES.INITIATIVE, initiative],
496
- );
497
- }
498
-
499
- export async function orchestrateInitiativeTool(input: unknown): Promise<ToolOutput> {
500
- const parsed = toRecord(input);
501
- const initiative = requireInitiative(parsed);
502
- if (!initiative) {
503
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.INITIATIVE_REQUIRED);
504
- }
505
-
506
- const args = [FLAG_NAMES.INITIATIVE, initiative];
507
- appendFlagIfTrue(args, parsed.dry_run, FLAG_NAMES.DRY_RUN);
508
- appendFlagIfTrue(args, parsed.progress, FLAG_NAMES.PROGRESS);
509
- appendFlagIfTrue(args, parsed.checkpoint_per_wave, FLAG_NAMES.CHECKPOINT_PER_WAVE);
510
-
511
- return executeInitiativeOrchestrationTool(
512
- INITIATIVE_ORCHESTRATION_TOOLS.ORCHESTRATE_INITIATIVE,
513
- args,
514
- );
515
- }
516
-
517
- export async function orchestrateMonitorTool(input: unknown): Promise<ToolOutput> {
518
- const parsed = toRecord(input);
519
- const args: string[] = [];
520
- appendValueIfPresent(args, FLAG_NAMES.THRESHOLD, parsed.threshold, toIntegerString);
521
- appendFlagIfTrue(args, parsed.recover, FLAG_NAMES.RECOVER);
522
- appendFlagIfTrue(args, parsed.dry_run, FLAG_NAMES.DRY_RUN);
523
- appendValueIfPresent(args, FLAG_NAMES.SINCE, parsed.since);
524
- appendValueIfPresent(args, FLAG_NAMES.WU, parsed.wu);
525
- appendFlagIfTrue(args, parsed.signals_only, FLAG_NAMES.SIGNALS_ONLY);
526
-
527
- return executeInitiativeOrchestrationTool(
528
- INITIATIVE_ORCHESTRATION_TOOLS.ORCHESTRATE_MONITOR,
529
- args,
530
- );
531
- }
532
-
533
- export async function planCreateTool(input: unknown): Promise<ToolOutput> {
534
- const parsed = toRecord(input);
535
- const id = requireId(parsed);
536
- if (!id) {
537
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.ID_REQUIRED);
538
- }
539
- const title = toStringValue(parsed.title);
540
- if (!title) {
541
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.TITLE_REQUIRED);
542
- }
543
-
544
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.PLAN_CREATE, [
545
- FLAG_NAMES.ID,
546
- id,
547
- FLAG_NAMES.TITLE,
548
- title,
549
- ]);
550
- }
551
-
552
- export async function planEditTool(input: unknown): Promise<ToolOutput> {
553
- const parsed = toRecord(input);
554
- const id = requireId(parsed);
555
- if (!id) {
556
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.ID_REQUIRED);
557
- }
558
-
559
- const args = [FLAG_NAMES.ID, id];
560
- appendValueIfPresent(args, FLAG_NAMES.SECTION, parsed.section);
561
- appendValueIfPresent(args, FLAG_NAMES.CONTENT, parsed.content);
562
- appendValueIfPresent(args, FLAG_NAMES.APPEND, parsed.append);
563
-
564
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.PLAN_EDIT, args);
565
- }
566
-
567
- export async function planLinkTool(input: unknown): Promise<ToolOutput> {
568
- const parsed = toRecord(input);
569
- const id = requireId(parsed);
570
- if (!id) {
571
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.ID_REQUIRED);
572
- }
573
- const plan = toStringValue(parsed.plan);
574
- if (!plan) {
575
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.PLAN_REQUIRED);
576
- }
577
-
578
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.PLAN_LINK, [
579
- FLAG_NAMES.ID,
580
- id,
581
- FLAG_NAMES.PLAN,
582
- plan,
583
- ]);
584
- }
585
-
586
- export async function planPromoteTool(input: unknown): Promise<ToolOutput> {
587
- const parsed = toRecord(input);
588
- const id = requireId(parsed);
589
- if (!id) {
590
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.ID_REQUIRED);
591
- }
592
-
593
- const args = [FLAG_NAMES.ID, id];
594
- appendFlagIfTrue(args, parsed.force, FLAG_NAMES.FORCE);
595
-
596
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.PLAN_PROMOTE, args);
597
- }
598
-
599
- export async function delegationListTool(input: unknown): Promise<ToolOutput> {
600
- const parsed = toRecord(input);
601
- const wu = requireWu(parsed);
602
- const initiative = requireInitiative(parsed);
603
- if (!wu && !initiative) {
604
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.DELEGATION_TARGET_REQUIRED);
605
- }
606
-
607
- const args: string[] = [];
608
- if (wu) {
609
- args.push(FLAG_NAMES.WU, wu);
610
- }
611
- if (initiative) {
612
- args.push(FLAG_NAMES.INITIATIVE, initiative);
613
- }
614
- appendFlagIfTrue(args, parsed.json, FLAG_NAMES.JSON);
615
-
616
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.DELEGATION_LIST, args);
617
- }
618
-
619
- export async function docsSyncTool(input: unknown): Promise<ToolOutput> {
620
- const parsed = toRecord(input);
621
- const args: string[] = [];
622
- appendValueIfPresent(args, FLAG_NAMES.VENDOR, parsed.vendor);
623
- appendFlagIfTrue(args, parsed.force, FLAG_NAMES.FORCE);
624
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.DOCS_SYNC, args);
625
- }
626
-
627
- export async function cloudConnectTool(input: unknown): Promise<ToolOutput> {
628
- const parsed = toRecord(input);
629
- const endpoint = toStringValue(parsed.endpoint);
630
- if (!endpoint) {
631
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.ENDPOINT_REQUIRED);
632
- }
633
- const orgId = toStringValue(parsed.org_id);
634
- if (!orgId) {
635
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.ORG_ID_REQUIRED);
636
- }
637
- const projectId = toStringValue(parsed.project_id);
638
- if (!projectId) {
639
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.PROJECT_ID_REQUIRED);
640
- }
641
-
642
- const args = [
643
- CLOUD_CONNECT_SUBCOMMAND,
644
- FLAG_NAMES.ENDPOINT,
645
- endpoint,
646
- FLAG_NAMES.ORG_ID,
647
- orgId,
648
- FLAG_NAMES.PROJECT_ID,
649
- projectId,
650
- ];
651
- appendValueIfPresent(args, FLAG_NAMES.TOKEN_ENV, parsed.token_env);
652
- appendValueIfPresent(args, FLAG_NAMES.POLICY_MODE, parsed.policy_mode);
653
- appendValueIfPresent(args, FLAG_NAMES.SYNC_INTERVAL, parsed.sync_interval, toIntegerString);
654
- appendValueIfPresent(args, FLAG_NAMES.OUTPUT, parsed.output);
655
- appendFlagIfTrue(args, parsed.force, FLAG_NAMES.FORCE);
656
-
657
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.CLOUD_CONNECT, args);
658
- }
659
-
660
- export async function workspaceInitTool(input: unknown): Promise<ToolOutput> {
661
- const parsed = toRecord(input);
662
- const args: string[] = [];
663
- appendFlagIfTrue(args, parsed.yes, FLAG_NAMES.YES);
664
- appendValueIfPresent(args, FLAG_NAMES.OUTPUT, parsed.output);
665
- appendFlagIfTrue(args, parsed.force, FLAG_NAMES.FORCE);
666
-
667
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.WORKSPACE_INIT, args);
668
- }
669
-
670
- export async function lumenflowTool(input: unknown): Promise<ToolOutput> {
671
- const parsed = toRecord(input);
672
- const args: string[] = [];
673
- appendValueIfPresent(args, FLAG_NAMES.CLIENT, parsed.client);
674
- appendFlagIfTrue(args, parsed.merge, FLAG_NAMES.MERGE);
675
- appendFlagIfTrue(args, parsed.full, FLAG_NAMES.FULL);
676
- appendFlagIfTrue(args, parsed.minimal, FLAG_NAMES.MINIMAL);
677
- appendValueIfPresent(args, FLAG_NAMES.FRAMEWORK, parsed.framework);
678
- if (args.length === 0) {
679
- args.push(LUMENFLOW_DEFAULT_SUBCOMMAND);
680
- }
681
-
682
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.LUMENFLOW, args);
683
- }
684
-
685
- export async function lumenflowDoctorTool(_input: unknown): Promise<ToolOutput> {
686
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.LUMENFLOW_DOCTOR, []);
687
- }
688
-
689
- export async function lumenflowIntegrateTool(input: unknown): Promise<ToolOutput> {
690
- const parsed = toRecord(input);
691
- const client = toStringValue(parsed.client);
692
- if (!client) {
693
- return createMissingParameterOutput(MISSING_PARAMETER_MESSAGES.CLIENT_REQUIRED);
694
- }
695
-
696
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.LUMENFLOW_INTEGRATE, [
697
- FLAG_NAMES.CLIENT,
698
- client,
699
- ]);
700
- }
701
-
702
- export async function lumenflowReleaseTool(input: unknown): Promise<ToolOutput> {
703
- const parsed = toRecord(input);
704
- const args: string[] = [];
705
- appendFlagIfTrue(args, parsed.dry_run, FLAG_NAMES.DRY_RUN);
706
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.LUMENFLOW_RELEASE, args);
707
- }
708
-
709
- export async function lumenflowUpgradeTool(_input: unknown): Promise<ToolOutput> {
710
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.LUMENFLOW_UPGRADE, []);
711
- }
712
-
713
- export async function syncTemplatesTool(input: unknown): Promise<ToolOutput> {
714
- const parsed = toRecord(input);
715
- const args: string[] = [];
716
- appendFlagIfTrue(args, parsed.dry_run, FLAG_NAMES.DRY_RUN);
717
- appendFlagIfTrue(args, parsed.verbose, '--verbose');
718
- appendFlagIfTrue(args, parsed.check_drift, '--check-drift');
719
- return executeInitiativeOrchestrationTool(INITIATIVE_ORCHESTRATION_TOOLS.SYNC_TEMPLATES, args);
720
- }