@cotal-ai/cli 0.90.1 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/chat-view.d.ts +17 -0
- package/dist/chat/chat-view.d.ts.map +1 -0
- package/dist/chat/chat-view.js +179 -0
- package/dist/chat/chat-view.js.map +1 -0
- package/dist/chat/controller.d.ts +20 -0
- package/dist/chat/controller.d.ts.map +1 -0
- package/dist/chat/controller.js +132 -0
- package/dist/chat/controller.js.map +1 -0
- package/dist/chat/engine.d.ts +110 -0
- package/dist/chat/engine.d.ts.map +1 -0
- package/dist/chat/engine.js +224 -0
- package/dist/chat/engine.js.map +1 -0
- package/dist/chat/frontend.d.ts +35 -0
- package/dist/chat/frontend.d.ts.map +1 -0
- package/dist/chat/frontend.js +166 -0
- package/dist/chat/frontend.js.map +1 -0
- package/dist/chat/native-session.d.ts +93 -0
- package/dist/chat/native-session.d.ts.map +1 -0
- package/dist/chat/native-session.js +389 -0
- package/dist/chat/native-session.js.map +1 -0
- package/dist/chat/open-session.d.ts +8 -0
- package/dist/chat/open-session.d.ts.map +1 -0
- package/dist/chat/open-session.js +120 -0
- package/dist/chat/open-session.js.map +1 -0
- package/dist/chat/picker.d.ts +35 -0
- package/dist/chat/picker.d.ts.map +1 -0
- package/dist/chat/picker.js +99 -0
- package/dist/chat/picker.js.map +1 -0
- package/dist/chat/plain.d.ts +15 -0
- package/dist/chat/plain.d.ts.map +1 -0
- package/dist/chat/plain.js +249 -0
- package/dist/chat/plain.js.map +1 -0
- package/dist/chat/session.d.ts +222 -0
- package/dist/chat/session.d.ts.map +1 -0
- package/dist/chat/session.js +2 -0
- package/dist/chat/session.js.map +1 -0
- package/dist/chat/static-session.d.ts +61 -0
- package/dist/chat/static-session.d.ts.map +1 -0
- package/dist/chat/static-session.js +212 -0
- package/dist/chat/static-session.js.map +1 -0
- package/dist/chat/stdio-io.d.ts +35 -0
- package/dist/chat/stdio-io.d.ts.map +1 -0
- package/dist/chat/stdio-io.js +176 -0
- package/dist/chat/stdio-io.js.map +1 -0
- package/dist/chat/stdio.d.ts +173 -0
- package/dist/chat/stdio.d.ts.map +1 -0
- package/dist/chat/stdio.js +401 -0
- package/dist/chat/stdio.js.map +1 -0
- package/dist/chat/user-session.d.ts +21 -0
- package/dist/chat/user-session.d.ts.map +1 -0
- package/dist/chat/user-session.js +180 -0
- package/dist/chat/user-session.js.map +1 -0
- package/dist/chat/view.d.ts +217 -0
- package/dist/chat/view.d.ts.map +1 -0
- package/dist/chat/view.js +433 -0
- package/dist/chat/view.js.map +1 -0
- package/dist/command.d.ts +11 -3
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +395 -147
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.d.ts +103 -11
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +506 -251
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/app-identity.d.ts.map +1 -1
- package/dist/commands/app-identity.js +10 -1
- package/dist/commands/app-identity.js.map +1 -1
- package/dist/commands/backup-maintenance.d.ts +4 -0
- package/dist/commands/backup-maintenance.d.ts.map +1 -0
- package/dist/commands/backup-maintenance.js +93 -0
- package/dist/commands/backup-maintenance.js.map +1 -0
- package/dist/commands/backup-read.d.ts +4 -0
- package/dist/commands/backup-read.d.ts.map +1 -0
- package/dist/commands/backup-read.js +30 -0
- package/dist/commands/backup-read.js.map +1 -0
- package/dist/commands/backup-restore.d.ts +7 -0
- package/dist/commands/backup-restore.d.ts.map +1 -0
- package/dist/commands/backup-restore.js +78 -0
- package/dist/commands/backup-restore.js.map +1 -0
- package/dist/commands/backup.d.ts +2 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +123 -32
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/channel-members.d.ts +8 -0
- package/dist/commands/channel-members.d.ts.map +1 -0
- package/dist/commands/channel-members.js +144 -0
- package/dist/commands/channel-members.js.map +1 -0
- package/dist/commands/channels.d.ts +75 -22
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +181 -100
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat.d.ts +109 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/chat.js +227 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/clean.d.ts +43 -1
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +90 -47
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/completion.d.ts +39 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +211 -87
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/config.d.ts +33 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +159 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/console.d.ts.map +1 -1
- package/dist/commands/console.js +25 -7
- package/dist/commands/console.js.map +1 -1
- package/dist/commands/describe.d.ts +63 -31
- package/dist/commands/describe.d.ts.map +1 -1
- package/dist/commands/describe.js +270 -136
- package/dist/commands/describe.js.map +1 -1
- package/dist/commands/doctor.d.ts +11 -6
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +195 -288
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/down-services.d.ts +29 -0
- package/dist/commands/down-services.d.ts.map +1 -0
- package/dist/commands/down-services.js +129 -0
- package/dist/commands/down-services.js.map +1 -0
- package/dist/commands/down.d.ts +37 -11
- package/dist/commands/down.d.ts.map +1 -1
- package/dist/commands/down.js +384 -117
- package/dist/commands/down.js.map +1 -1
- package/dist/commands/endpoint-authoring.d.ts +6 -0
- package/dist/commands/endpoint-authoring.d.ts.map +1 -0
- package/dist/commands/endpoint-authoring.js +130 -0
- package/dist/commands/endpoint-authoring.js.map +1 -0
- package/dist/commands/endpoint-deregister.d.ts +5 -0
- package/dist/commands/endpoint-deregister.d.ts.map +1 -0
- package/dist/commands/endpoint-deregister.js +70 -0
- package/dist/commands/endpoint-deregister.js.map +1 -0
- package/dist/commands/endpoint.d.ts +118 -0
- package/dist/commands/endpoint.d.ts.map +1 -0
- package/dist/commands/endpoint.js +177 -0
- package/dist/commands/endpoint.js.map +1 -0
- package/dist/commands/endpoints.d.ts +27 -1
- package/dist/commands/endpoints.d.ts.map +1 -1
- package/dist/commands/endpoints.js +42 -30
- package/dist/commands/endpoints.js.map +1 -1
- package/dist/commands/ext.d.ts +38 -1
- package/dist/commands/ext.d.ts.map +1 -1
- package/dist/commands/ext.js +84 -49
- package/dist/commands/ext.js.map +1 -1
- package/dist/commands/feedback.d.ts +58 -1
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +119 -47
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/help.d.ts +20 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +52 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/history-clear.d.ts +14 -0
- package/dist/commands/history-clear.d.ts.map +1 -0
- package/dist/commands/history-clear.js +74 -0
- package/dist/commands/history-clear.js.map +1 -0
- package/dist/commands/history.d.ts +146 -4
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +437 -19
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/join.d.ts.map +1 -1
- package/dist/commands/join.js +7 -3
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/meshes-add.d.ts +3 -0
- package/dist/commands/meshes-add.d.ts.map +1 -1
- package/dist/commands/meshes-add.js +41 -34
- package/dist/commands/meshes-add.js.map +1 -1
- package/dist/commands/meshes-wizard.js +3 -3
- package/dist/commands/meshes-wizard.js.map +1 -1
- package/dist/commands/mint-endpoint-caller.d.ts +5 -0
- package/dist/commands/mint-endpoint-caller.d.ts.map +1 -0
- package/dist/commands/mint-endpoint-caller.js +130 -0
- package/dist/commands/mint-endpoint-caller.js.map +1 -0
- package/dist/commands/mint.d.ts +2 -37
- package/dist/commands/mint.d.ts.map +1 -1
- package/dist/commands/mint.js +142 -325
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/models.d.ts +30 -8
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +72 -41
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/persona-remote.d.ts +5 -0
- package/dist/commands/persona-remote.d.ts.map +1 -0
- package/dist/commands/persona-remote.js +237 -0
- package/dist/commands/persona-remote.js.map +1 -0
- package/dist/commands/persona.d.ts +91 -0
- package/dist/commands/persona.d.ts.map +1 -0
- package/dist/commands/persona.js +200 -0
- package/dist/commands/persona.js.map +1 -0
- package/dist/commands/personas.d.ts.map +1 -1
- package/dist/commands/personas.js +16 -59
- package/dist/commands/personas.js.map +1 -1
- package/dist/commands/reset-space-apply.d.ts +5 -0
- package/dist/commands/reset-space-apply.d.ts.map +1 -0
- package/dist/commands/reset-space-apply.js +127 -0
- package/dist/commands/reset-space-apply.js.map +1 -0
- package/dist/commands/reset-store-apply.d.ts +35 -0
- package/dist/commands/reset-store-apply.d.ts.map +1 -0
- package/dist/commands/reset-store-apply.js +216 -0
- package/dist/commands/reset-store-apply.js.map +1 -0
- package/dist/commands/reset.d.ts +26 -0
- package/dist/commands/reset.d.ts.map +1 -0
- package/dist/commands/reset.js +155 -0
- package/dist/commands/reset.js.map +1 -0
- package/dist/commands/runtimes.d.ts +26 -1
- package/dist/commands/runtimes.d.ts.map +1 -1
- package/dist/commands/runtimes.js +68 -32
- package/dist/commands/runtimes.js.map +1 -1
- package/dist/commands/send.d.ts +91 -6
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +180 -106
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/service-actions.d.ts +6 -0
- package/dist/commands/service-actions.d.ts.map +1 -0
- package/dist/commands/service-actions.js +413 -0
- package/dist/commands/service-actions.js.map +1 -0
- package/dist/commands/service-log-follow.d.ts +5 -0
- package/dist/commands/service-log-follow.d.ts.map +1 -0
- package/dist/commands/service-log-follow.js +107 -0
- package/dist/commands/service-log-follow.js.map +1 -0
- package/dist/commands/service-registry.d.ts +67 -0
- package/dist/commands/service-registry.d.ts.map +1 -0
- package/dist/commands/service-registry.js +275 -0
- package/dist/commands/service-registry.js.map +1 -0
- package/dist/commands/service-set-stop.d.ts +6 -0
- package/dist/commands/service-set-stop.d.ts.map +1 -0
- package/dist/commands/service-set-stop.js +164 -0
- package/dist/commands/service-set-stop.js.map +1 -0
- package/dist/commands/service-unit-entry.d.ts +5 -0
- package/dist/commands/service-unit-entry.d.ts.map +1 -0
- package/dist/commands/service-unit-entry.js +113 -0
- package/dist/commands/service-unit-entry.js.map +1 -0
- package/dist/commands/setup-start.d.ts +21 -0
- package/dist/commands/setup-start.d.ts.map +1 -0
- package/dist/commands/setup-start.js +95 -0
- package/dist/commands/setup-start.js.map +1 -0
- package/dist/commands/setup.d.ts +86 -100
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +766 -487
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/space-delete.d.ts +3 -0
- package/dist/commands/space-delete.d.ts.map +1 -0
- package/dist/commands/space-delete.js +386 -0
- package/dist/commands/space-delete.js.map +1 -0
- package/dist/commands/space-registration.d.ts +92 -0
- package/dist/commands/space-registration.d.ts.map +1 -0
- package/dist/commands/space-registration.js +394 -0
- package/dist/commands/space-registration.js.map +1 -0
- package/dist/commands/space.d.ts +128 -0
- package/dist/commands/space.d.ts.map +1 -0
- package/dist/commands/space.js +230 -0
- package/dist/commands/space.js.map +1 -0
- package/dist/commands/spawn-manifest.d.ts.map +1 -1
- package/dist/commands/spawn-manifest.js +2 -2
- package/dist/commands/spawn-manifest.js.map +1 -1
- package/dist/commands/spawn-preview.d.ts +9 -0
- package/dist/commands/spawn-preview.d.ts.map +1 -0
- package/dist/commands/spawn-preview.js +68 -0
- package/dist/commands/spawn-preview.js.map +1 -0
- package/dist/commands/spawn.d.ts +81 -21
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +254 -107
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.d.ts +20 -0
- package/dist/commands/stack-down.d.ts.map +1 -0
- package/dist/commands/stack-down.js +313 -0
- package/dist/commands/stack-down.js.map +1 -0
- package/dist/commands/stack-up.d.ts +154 -0
- package/dist/commands/stack-up.d.ts.map +1 -0
- package/dist/commands/stack-up.js +498 -0
- package/dist/commands/stack-up.js.map +1 -0
- package/dist/commands/stack-user-auth.d.ts +52 -0
- package/dist/commands/stack-user-auth.d.ts.map +1 -0
- package/dist/commands/stack-user-auth.js +128 -0
- package/dist/commands/stack-user-auth.js.map +1 -0
- package/dist/commands/status.d.ts +244 -5
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +1044 -407
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/sync.d.ts +23 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +69 -17
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/team-agent-apply.d.ts +5 -0
- package/dist/commands/team-agent-apply.d.ts.map +1 -0
- package/dist/commands/team-agent-apply.js +204 -0
- package/dist/commands/team-agent-apply.js.map +1 -0
- package/dist/commands/team-agent-remove.d.ts +87 -0
- package/dist/commands/team-agent-remove.d.ts.map +1 -0
- package/dist/commands/team-agent-remove.js +348 -0
- package/dist/commands/team-agent-remove.js.map +1 -0
- package/dist/commands/team-boot-controller.d.ts +11 -0
- package/dist/commands/team-boot-controller.d.ts.map +1 -0
- package/dist/commands/team-boot-controller.js +176 -0
- package/dist/commands/team-boot-controller.js.map +1 -0
- package/dist/commands/team-channel-remove.d.ts +167 -0
- package/dist/commands/team-channel-remove.d.ts.map +1 -0
- package/dist/commands/team-channel-remove.js +486 -0
- package/dist/commands/team-channel-remove.js.map +1 -0
- package/dist/commands/team-deploy-apply.d.ts +11 -0
- package/dist/commands/team-deploy-apply.d.ts.map +1 -0
- package/dist/commands/team-deploy-apply.js +320 -0
- package/dist/commands/team-deploy-apply.js.map +1 -0
- package/dist/commands/team-mixed-remove.d.ts +8 -0
- package/dist/commands/team-mixed-remove.d.ts.map +1 -0
- package/dist/commands/team-mixed-remove.js +207 -0
- package/dist/commands/team-mixed-remove.js.map +1 -0
- package/dist/commands/team.d.ts +51 -0
- package/dist/commands/team.d.ts.map +1 -0
- package/dist/commands/team.js +728 -0
- package/dist/commands/team.js.map +1 -0
- package/dist/commands/topology.d.ts +4 -0
- package/dist/commands/topology.d.ts.map +1 -1
- package/dist/commands/topology.js +8 -0
- package/dist/commands/topology.js.map +1 -1
- package/dist/commands/up.d.ts +146 -6
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +1123 -131
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update.d.ts +13 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +90 -22
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/use.d.ts +16 -3
- package/dist/commands/use.d.ts.map +1 -1
- package/dist/commands/use.js +45 -19
- package/dist/commands/use.js.map +1 -1
- package/dist/commands/watch.d.ts +37 -0
- package/dist/commands/watch.d.ts.map +1 -0
- package/dist/commands/watch.js +106 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/commands/who.d.ts +79 -0
- package/dist/commands/who.d.ts.map +1 -0
- package/dist/commands/who.js +193 -0
- package/dist/commands/who.js.map +1 -0
- package/dist/commands/whoami.d.ts +56 -0
- package/dist/commands/whoami.d.ts.map +1 -0
- package/dist/commands/whoami.js +106 -0
- package/dist/commands/whoami.js.map +1 -0
- package/dist/console/app.d.ts.map +1 -1
- package/dist/console/app.js +8 -4
- package/dist/console/app.js.map +1 -1
- package/dist/console/commands.d.ts.map +1 -1
- package/dist/console/commands.js +12 -6
- package/dist/console/commands.js.map +1 -1
- package/dist/exec-endpoint/definition.d.ts +15 -0
- package/dist/exec-endpoint/definition.d.ts.map +1 -0
- package/dist/exec-endpoint/definition.js +56 -0
- package/dist/exec-endpoint/definition.js.map +1 -0
- package/dist/exec-endpoint/handler.d.ts +13 -0
- package/dist/exec-endpoint/handler.d.ts.map +1 -0
- package/dist/exec-endpoint/handler.js +155 -0
- package/dist/exec-endpoint/handler.js.map +1 -0
- package/dist/exec-endpoint/registration.d.ts +34 -0
- package/dist/exec-endpoint/registration.d.ts.map +1 -0
- package/dist/exec-endpoint/registration.js +148 -0
- package/dist/exec-endpoint/registration.js.map +1 -0
- package/dist/exec-endpoint/serve.d.ts +8 -0
- package/dist/exec-endpoint/serve.d.ts.map +1 -0
- package/dist/exec-endpoint/serve.js +159 -0
- package/dist/exec-endpoint/serve.js.map +1 -0
- package/dist/exec-endpoint/service-adapter.d.ts +6 -0
- package/dist/exec-endpoint/service-adapter.d.ts.map +1 -0
- package/dist/exec-endpoint/service-adapter.js +110 -0
- package/dist/exec-endpoint/service-adapter.js.map +1 -0
- package/dist/ext-loader.d.ts +10 -0
- package/dist/ext-loader.d.ts.map +1 -1
- package/dist/ext-loader.js +61 -13
- package/dist/ext-loader.js.map +1 -1
- package/dist/help.d.ts +18 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +256 -0
- package/dist/help.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +446 -119
- package/dist/index.js.map +1 -1
- package/dist/lib/assist.d.ts.map +1 -1
- package/dist/lib/assist.js +3 -2
- package/dist/lib/assist.js.map +1 -1
- package/dist/lib/attach-client.d.ts +7 -6
- package/dist/lib/attach-client.d.ts.map +1 -1
- package/dist/lib/attach-client.js +14 -15
- package/dist/lib/attach-client.js.map +1 -1
- package/dist/lib/auth-proc.d.ts +3 -3
- package/dist/lib/auth-proc.d.ts.map +1 -1
- package/dist/lib/auth-proc.js +8 -8
- package/dist/lib/auth-proc.js.map +1 -1
- package/dist/lib/backup-artifact.d.ts +41 -1
- package/dist/lib/backup-artifact.d.ts.map +1 -1
- package/dist/lib/backup-artifact.js +96 -22
- package/dist/lib/backup-artifact.js.map +1 -1
- package/dist/lib/broker-service.d.ts +19 -0
- package/dist/lib/broker-service.d.ts.map +1 -0
- package/dist/lib/broker-service.js +369 -0
- package/dist/lib/broker-service.js.map +1 -0
- package/dist/lib/cancel.js +1 -1
- package/dist/lib/cancel.js.map +1 -1
- package/dist/lib/choose-target.d.ts +10 -0
- package/dist/lib/choose-target.d.ts.map +1 -0
- package/dist/lib/choose-target.js +42 -0
- package/dist/lib/choose-target.js.map +1 -0
- package/dist/lib/command-path.d.ts +13 -0
- package/dist/lib/command-path.d.ts.map +1 -0
- package/dist/lib/command-path.js +40 -0
- package/dist/lib/command-path.js.map +1 -0
- package/dist/lib/completion-install.d.ts +29 -0
- package/dist/lib/completion-install.d.ts.map +1 -0
- package/dist/lib/completion-install.js +369 -0
- package/dist/lib/completion-install.js.map +1 -0
- package/dist/lib/completion-scripts.d.ts +4 -0
- package/dist/lib/completion-scripts.d.ts.map +1 -0
- package/dist/lib/completion-scripts.js +15 -0
- package/dist/lib/completion-scripts.js.map +1 -0
- package/dist/lib/completion.d.ts.map +1 -1
- package/dist/lib/completion.js +4 -1
- package/dist/lib/completion.js.map +1 -1
- package/dist/lib/confirmation-required.d.ts +13 -0
- package/dist/lib/confirmation-required.d.ts.map +1 -0
- package/dist/lib/confirmation-required.js +10 -0
- package/dist/lib/confirmation-required.js.map +1 -0
- package/dist/lib/control.d.ts +65 -6
- package/dist/lib/control.d.ts.map +1 -1
- package/dist/lib/control.js +121 -27
- package/dist/lib/control.js.map +1 -1
- package/dist/lib/controller-preserve.d.ts +12 -0
- package/dist/lib/controller-preserve.d.ts.map +1 -0
- package/dist/lib/controller-preserve.js +373 -0
- package/dist/lib/controller-preserve.js.map +1 -0
- package/dist/lib/controller-restore.d.ts +38 -0
- package/dist/lib/controller-restore.d.ts.map +1 -0
- package/dist/lib/controller-restore.js +205 -0
- package/dist/lib/controller-restore.js.map +1 -0
- package/dist/lib/controller-resume.d.ts +92 -0
- package/dist/lib/controller-resume.d.ts.map +1 -0
- package/dist/lib/controller-resume.js +300 -0
- package/dist/lib/controller-resume.js.map +1 -0
- package/dist/lib/credential-authority.d.ts +17 -0
- package/dist/lib/credential-authority.d.ts.map +1 -0
- package/dist/lib/credential-authority.js +29 -0
- package/dist/lib/credential-authority.js.map +1 -0
- package/dist/lib/default-persona.d.ts +38 -0
- package/dist/lib/default-persona.d.ts.map +1 -0
- package/dist/lib/default-persona.js +85 -0
- package/dist/lib/default-persona.js.map +1 -0
- package/dist/lib/delivery-proc.d.ts +9 -9
- package/dist/lib/delivery-proc.d.ts.map +1 -1
- package/dist/lib/delivery-proc.js +44 -23
- package/dist/lib/delivery-proc.js.map +1 -1
- package/dist/lib/endpoint-capability-gates.d.ts +10 -0
- package/dist/lib/endpoint-capability-gates.d.ts.map +1 -0
- package/dist/lib/endpoint-capability-gates.js +70 -0
- package/dist/lib/endpoint-capability-gates.js.map +1 -0
- package/dist/lib/endpoint-client.d.ts +23 -0
- package/dist/lib/endpoint-client.d.ts.map +1 -0
- package/dist/lib/endpoint-client.js +46 -0
- package/dist/lib/endpoint-client.js.map +1 -0
- package/dist/lib/endpoint-errors.d.ts +20 -0
- package/dist/lib/endpoint-errors.d.ts.map +1 -0
- package/dist/lib/endpoint-errors.js +46 -0
- package/dist/lib/endpoint-errors.js.map +1 -0
- package/dist/lib/endpoint-goal.d.ts +19 -0
- package/dist/lib/endpoint-goal.d.ts.map +1 -0
- package/dist/lib/endpoint-goal.js +31 -0
- package/dist/lib/endpoint-goal.js.map +1 -0
- package/dist/lib/endpoint-inventory.d.ts +30 -0
- package/dist/lib/endpoint-inventory.d.ts.map +1 -0
- package/dist/lib/endpoint-inventory.js +79 -0
- package/dist/lib/endpoint-inventory.js.map +1 -0
- package/dist/lib/endpoint-references.d.ts +22 -0
- package/dist/lib/endpoint-references.d.ts.map +1 -0
- package/dist/lib/endpoint-references.js +44 -0
- package/dist/lib/endpoint-references.js.map +1 -0
- package/dist/lib/endpoint-scatter.d.ts +57 -0
- package/dist/lib/endpoint-scatter.d.ts.map +1 -0
- package/dist/lib/endpoint-scatter.js +75 -0
- package/dist/lib/endpoint-scatter.js.map +1 -0
- package/dist/lib/endpoint-selection.d.ts +35 -0
- package/dist/lib/endpoint-selection.d.ts.map +1 -0
- package/dist/lib/endpoint-selection.js +80 -0
- package/dist/lib/endpoint-selection.js.map +1 -0
- package/dist/lib/install-umask.d.ts +6 -0
- package/dist/lib/install-umask.d.ts.map +1 -0
- package/dist/lib/install-umask.js +15 -0
- package/dist/lib/install-umask.js.map +1 -0
- package/dist/lib/isolated-broker.d.ts.map +1 -1
- package/dist/lib/isolated-broker.js +9 -5
- package/dist/lib/isolated-broker.js.map +1 -1
- package/dist/lib/local-process-stop.d.ts.map +1 -1
- package/dist/lib/local-process-stop.js +7 -1
- package/dist/lib/local-process-stop.js.map +1 -1
- package/dist/lib/manager-proc.d.ts +11 -5
- package/dist/lib/manager-proc.d.ts.map +1 -1
- package/dist/lib/manager-proc.js +12 -17
- package/dist/lib/manager-proc.js.map +1 -1
- package/dist/lib/manifest/apply.d.ts +4 -1
- package/dist/lib/manifest/apply.d.ts.map +1 -1
- package/dist/lib/manifest/apply.js +1 -1
- package/dist/lib/manifest/apply.js.map +1 -1
- package/dist/lib/manifest/ledger.d.ts +3 -1
- package/dist/lib/manifest/ledger.d.ts.map +1 -1
- package/dist/lib/manifest/ledger.js +16 -3
- package/dist/lib/manifest/ledger.js.map +1 -1
- package/dist/lib/manifest/schema.d.ts +1 -117
- package/dist/lib/manifest/schema.d.ts.map +1 -1
- package/dist/lib/manifest/schema.js +1 -95
- package/dist/lib/manifest/schema.js.map +1 -1
- package/dist/lib/offline-recipient.d.ts +5 -0
- package/dist/lib/offline-recipient.d.ts.map +1 -0
- package/dist/lib/offline-recipient.js +7 -0
- package/dist/lib/offline-recipient.js.map +1 -0
- package/dist/lib/onboard.js +3 -3
- package/dist/lib/onboard.js.map +1 -1
- package/dist/lib/persona-files.d.ts +29 -0
- package/dist/lib/persona-files.d.ts.map +1 -0
- package/dist/lib/persona-files.js +154 -0
- package/dist/lib/persona-files.js.map +1 -0
- package/dist/lib/personas.d.ts +3 -0
- package/dist/lib/personas.d.ts.map +1 -1
- package/dist/lib/personas.js +14 -2
- package/dist/lib/personas.js.map +1 -1
- package/dist/lib/prompts.d.ts +16 -0
- package/dist/lib/prompts.d.ts.map +1 -0
- package/dist/lib/prompts.js +35 -0
- package/dist/lib/prompts.js.map +1 -0
- package/dist/lib/protected-records.d.ts +2 -0
- package/dist/lib/protected-records.d.ts.map +1 -0
- package/dist/lib/protected-records.js +3 -0
- package/dist/lib/protected-records.js.map +1 -0
- package/dist/lib/registry-errors.d.ts +4 -0
- package/dist/lib/registry-errors.d.ts.map +1 -0
- package/dist/lib/registry-errors.js +6 -0
- package/dist/lib/registry-errors.js.map +1 -0
- package/dist/lib/reset-space-plan.d.ts +36 -0
- package/dist/lib/reset-space-plan.d.ts.map +1 -0
- package/dist/lib/reset-space-plan.js +202 -0
- package/dist/lib/reset-space-plan.js.map +1 -0
- package/dist/lib/restore.d.ts +13 -1
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +73 -11
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/seat-resume.d.ts +4 -1
- package/dist/lib/seat-resume.d.ts.map +1 -1
- package/dist/lib/seat-resume.js +7 -4
- package/dist/lib/seat-resume.js.map +1 -1
- package/dist/lib/service-adapters.d.ts +32 -0
- package/dist/lib/service-adapters.d.ts.map +1 -0
- package/dist/lib/service-adapters.js +55 -0
- package/dist/lib/service-adapters.js.map +1 -0
- package/dist/lib/service-census.d.ts +73 -0
- package/dist/lib/service-census.d.ts.map +1 -0
- package/dist/lib/service-census.js +42 -0
- package/dist/lib/service-census.js.map +1 -0
- package/dist/lib/service-definitions.d.ts +49 -0
- package/dist/lib/service-definitions.d.ts.map +1 -0
- package/dist/lib/service-definitions.js +61 -0
- package/dist/lib/service-definitions.js.map +1 -0
- package/dist/lib/service-install-intent.d.ts +48 -0
- package/dist/lib/service-install-intent.d.ts.map +1 -0
- package/dist/lib/service-install-intent.js +95 -0
- package/dist/lib/service-install-intent.js.map +1 -0
- package/dist/lib/service-instances.d.ts +143 -0
- package/dist/lib/service-instances.d.ts.map +1 -0
- package/dist/lib/service-instances.js +193 -0
- package/dist/lib/service-instances.js.map +1 -0
- package/dist/lib/service-journal.d.ts +38 -0
- package/dist/lib/service-journal.d.ts.map +1 -0
- package/dist/lib/service-journal.js +210 -0
- package/dist/lib/service-journal.js.map +1 -0
- package/dist/lib/service-launchd-plan.d.ts +21 -0
- package/dist/lib/service-launchd-plan.d.ts.map +1 -0
- package/dist/lib/service-launchd-plan.js +69 -0
- package/dist/lib/service-launchd-plan.js.map +1 -0
- package/dist/lib/service-launchd-unit.d.ts +20 -0
- package/dist/lib/service-launchd-unit.d.ts.map +1 -0
- package/dist/lib/service-launchd-unit.js +66 -0
- package/dist/lib/service-launchd-unit.js.map +1 -0
- package/dist/lib/service-presets.d.ts +17 -0
- package/dist/lib/service-presets.d.ts.map +1 -0
- package/dist/lib/service-presets.js +139 -0
- package/dist/lib/service-presets.js.map +1 -0
- package/dist/lib/service-private-seed.d.ts +7 -0
- package/dist/lib/service-private-seed.d.ts.map +1 -0
- package/dist/lib/service-private-seed.js +64 -0
- package/dist/lib/service-private-seed.js.map +1 -0
- package/dist/lib/service-private-tree.d.ts +6 -0
- package/dist/lib/service-private-tree.d.ts.map +1 -0
- package/dist/lib/service-private-tree.js +100 -0
- package/dist/lib/service-private-tree.js.map +1 -0
- package/dist/lib/service-process.d.ts +146 -0
- package/dist/lib/service-process.d.ts.map +1 -0
- package/dist/lib/service-process.js +862 -0
- package/dist/lib/service-process.js.map +1 -0
- package/dist/lib/service-stopped-allocation.d.ts +6 -0
- package/dist/lib/service-stopped-allocation.d.ts.map +1 -0
- package/dist/lib/service-stopped-allocation.js +42 -0
- package/dist/lib/service-stopped-allocation.js.map +1 -0
- package/dist/lib/service-supervision.d.ts +59 -0
- package/dist/lib/service-supervision.d.ts.map +1 -0
- package/dist/lib/service-supervision.js +71 -0
- package/dist/lib/service-supervision.js.map +1 -0
- package/dist/lib/service-systemd-attempt-read.d.ts +40 -0
- package/dist/lib/service-systemd-attempt-read.d.ts.map +1 -0
- package/dist/lib/service-systemd-attempt-read.js +80 -0
- package/dist/lib/service-systemd-attempt-read.js.map +1 -0
- package/dist/lib/service-systemd-control.d.ts +38 -0
- package/dist/lib/service-systemd-control.d.ts.map +1 -0
- package/dist/lib/service-systemd-control.js +141 -0
- package/dist/lib/service-systemd-control.js.map +1 -0
- package/dist/lib/service-systemd-files.d.ts +8 -0
- package/dist/lib/service-systemd-files.d.ts.map +1 -0
- package/dist/lib/service-systemd-files.js +63 -0
- package/dist/lib/service-systemd-files.js.map +1 -0
- package/dist/lib/service-systemd-install.d.ts +17 -0
- package/dist/lib/service-systemd-install.d.ts.map +1 -0
- package/dist/lib/service-systemd-install.js +146 -0
- package/dist/lib/service-systemd-install.js.map +1 -0
- package/dist/lib/service-systemd-plan.d.ts +28 -0
- package/dist/lib/service-systemd-plan.d.ts.map +1 -0
- package/dist/lib/service-systemd-plan.js +56 -0
- package/dist/lib/service-systemd-plan.js.map +1 -0
- package/dist/lib/service-systemd-reseed.d.ts +16 -0
- package/dist/lib/service-systemd-reseed.d.ts.map +1 -0
- package/dist/lib/service-systemd-reseed.js +106 -0
- package/dist/lib/service-systemd-reseed.js.map +1 -0
- package/dist/lib/service-systemd-uninstall-plan.d.ts +29 -0
- package/dist/lib/service-systemd-uninstall-plan.d.ts.map +1 -0
- package/dist/lib/service-systemd-uninstall-plan.js +56 -0
- package/dist/lib/service-systemd-uninstall-plan.js.map +1 -0
- package/dist/lib/service-systemd-uninstall.d.ts +17 -0
- package/dist/lib/service-systemd-uninstall.d.ts.map +1 -0
- package/dist/lib/service-systemd-uninstall.js +106 -0
- package/dist/lib/service-systemd-uninstall.js.map +1 -0
- package/dist/lib/service-systemd-unit.d.ts +28 -0
- package/dist/lib/service-systemd-unit.d.ts.map +1 -0
- package/dist/lib/service-systemd-unit.js +73 -0
- package/dist/lib/service-systemd-unit.js.map +1 -0
- package/dist/lib/service-systemd.d.ts +49 -0
- package/dist/lib/service-systemd.d.ts.map +1 -0
- package/dist/lib/service-systemd.js +134 -0
- package/dist/lib/service-systemd.js.map +1 -0
- package/dist/lib/service-uninstall-intent.d.ts +38 -0
- package/dist/lib/service-uninstall-intent.d.ts.map +1 -0
- package/dist/lib/service-uninstall-intent.js +74 -0
- package/dist/lib/service-uninstall-intent.js.map +1 -0
- package/dist/lib/service-unit-action.d.ts +24 -0
- package/dist/lib/service-unit-action.d.ts.map +1 -0
- package/dist/lib/service-unit-action.js +61 -0
- package/dist/lib/service-unit-action.js.map +1 -0
- package/dist/lib/setup-log.d.ts +5 -4
- package/dist/lib/setup-log.d.ts.map +1 -1
- package/dist/lib/setup-log.js +18 -9
- package/dist/lib/setup-log.js.map +1 -1
- package/dist/lib/shown-time.d.ts +5 -0
- package/dist/lib/shown-time.d.ts.map +1 -0
- package/dist/lib/shown-time.js +9 -0
- package/dist/lib/shown-time.js.map +1 -0
- package/dist/lib/space-schema-inspection.d.ts +73 -0
- package/dist/lib/space-schema-inspection.d.ts.map +1 -0
- package/dist/lib/space-schema-inspection.js +118 -0
- package/dist/lib/space-schema-inspection.js.map +1 -0
- package/dist/lib/space-schema-report.d.ts +82 -0
- package/dist/lib/space-schema-report.d.ts.map +1 -0
- package/dist/lib/space-schema-report.js +109 -0
- package/dist/lib/space-schema-report.js.map +1 -0
- package/dist/lib/spawn-defaults.d.ts +14 -0
- package/dist/lib/spawn-defaults.d.ts.map +1 -0
- package/dist/lib/spawn-defaults.js +20 -0
- package/dist/lib/spawn-defaults.js.map +1 -0
- package/dist/lib/stack-journal.d.ts +166 -0
- package/dist/lib/stack-journal.d.ts.map +1 -0
- package/dist/lib/stack-journal.js +421 -0
- package/dist/lib/stack-journal.js.map +1 -0
- package/dist/lib/stack-resume.d.ts +35 -0
- package/dist/lib/stack-resume.d.ts.map +1 -0
- package/dist/lib/stack-resume.js +123 -0
- package/dist/lib/stack-resume.js.map +1 -0
- package/dist/lib/status.d.ts +19 -20
- package/dist/lib/status.d.ts.map +1 -1
- package/dist/lib/status.js +41 -40
- package/dist/lib/status.js.map +1 -1
- package/dist/lib/stdout-owner.d.ts +17 -0
- package/dist/lib/stdout-owner.d.ts.map +1 -0
- package/dist/lib/stdout-owner.js +44 -0
- package/dist/lib/stdout-owner.js.map +1 -0
- package/dist/lib/steps.d.ts.map +1 -1
- package/dist/lib/steps.js +3 -2
- package/dist/lib/steps.js.map +1 -1
- package/dist/lib/systemd-supervision.d.ts +11 -4
- package/dist/lib/systemd-supervision.d.ts.map +1 -1
- package/dist/lib/systemd-supervision.js +19 -8
- package/dist/lib/systemd-supervision.js.map +1 -1
- package/dist/lib/team-additive-attempt.d.ts +286 -0
- package/dist/lib/team-additive-attempt.d.ts.map +1 -0
- package/dist/lib/team-additive-attempt.js +387 -0
- package/dist/lib/team-additive-attempt.js.map +1 -0
- package/dist/lib/team-additive-native.d.ts +17 -0
- package/dist/lib/team-additive-native.d.ts.map +1 -0
- package/dist/lib/team-additive-native.js +29 -0
- package/dist/lib/team-additive-native.js.map +1 -0
- package/dist/lib/team-agent-removal.d.ts +104 -0
- package/dist/lib/team-agent-removal.d.ts.map +1 -0
- package/dist/lib/team-agent-removal.js +121 -0
- package/dist/lib/team-agent-removal.js.map +1 -0
- package/dist/lib/team-channel-removal.d.ts +220 -0
- package/dist/lib/team-channel-removal.d.ts.map +1 -0
- package/dist/lib/team-channel-removal.js +258 -0
- package/dist/lib/team-channel-removal.js.map +1 -0
- package/dist/lib/team-deploy-inspection.d.ts +59 -0
- package/dist/lib/team-deploy-inspection.d.ts.map +1 -0
- package/dist/lib/team-deploy-inspection.js +177 -0
- package/dist/lib/team-deploy-inspection.js.map +1 -0
- package/dist/lib/team-fresh.d.ts +73 -0
- package/dist/lib/team-fresh.d.ts.map +1 -0
- package/dist/lib/team-fresh.js +207 -0
- package/dist/lib/team-fresh.js.map +1 -0
- package/dist/lib/team-removal-reconcile.d.ts +118 -0
- package/dist/lib/team-removal-reconcile.d.ts.map +1 -0
- package/dist/lib/team-removal-reconcile.js +90 -0
- package/dist/lib/team-removal-reconcile.js.map +1 -0
- package/dist/lib/team-removal-record.d.ts +7 -0
- package/dist/lib/team-removal-record.d.ts.map +1 -0
- package/dist/lib/team-removal-record.js +46 -0
- package/dist/lib/team-removal-record.js.map +1 -0
- package/dist/lib/team-retained.d.ts +33 -0
- package/dist/lib/team-retained.d.ts.map +1 -0
- package/dist/lib/team-retained.js +55 -0
- package/dist/lib/team-retained.js.map +1 -0
- package/dist/lib/theme.d.ts.map +1 -1
- package/dist/lib/theme.js +9 -8
- package/dist/lib/theme.js.map +1 -1
- package/dist/lib/transient.d.ts +14 -9
- package/dist/lib/transient.d.ts.map +1 -1
- package/dist/lib/transient.js +25 -18
- package/dist/lib/transient.js.map +1 -1
- package/dist/lib/up-report.d.ts +3 -0
- package/dist/lib/up-report.d.ts.map +1 -1
- package/dist/lib/up-report.js +4 -1
- package/dist/lib/up-report.js.map +1 -1
- package/dist/lib/version.d.ts +8 -2
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +16 -9
- package/dist/lib/version.js.map +1 -1
- package/dist/managed-handoff.d.ts +3 -0
- package/dist/managed-handoff.d.ts.map +1 -1
- package/dist/managed-handoff.js +5 -0
- package/dist/managed-handoff.js.map +1 -1
- package/dist/seed/paths.d.ts +1 -1
- package/dist/seed/paths.js +1 -1
- package/dist/seed/reconcile.d.ts.map +1 -1
- package/dist/seed/reconcile.js +19 -3
- package/dist/seed/reconcile.js.map +1 -1
- package/dist/ui.d.ts +10 -2
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +28 -6
- package/dist/ui.js.map +1 -1
- package/dist/watch-data.d.ts +15 -0
- package/dist/watch-data.d.ts.map +1 -0
- package/dist/watch-data.js +66 -0
- package/dist/watch-data.js.map +1 -0
- package/dist/watch-json.d.ts +5 -0
- package/dist/watch-json.d.ts.map +1 -0
- package/dist/watch-json.js +132 -0
- package/dist/watch-json.js.map +1 -0
- package/dist/watch-view.d.ts +8 -0
- package/dist/watch-view.d.ts.map +1 -0
- package/dist/watch-view.js +65 -0
- package/dist/watch-view.js.map +1 -0
- package/package.json +8 -5
- package/dist/commands/service.d.ts +0 -17
- package/dist/commands/service.d.ts.map +0 -1
- package/dist/commands/service.js +0 -589
- package/dist/commands/service.js.map +0 -1
package/dist/command.js
CHANGED
|
@@ -1,94 +1,121 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { writeSync } from "node:fs";
|
|
2
|
+
import { commandDeclarationProblems, findCommand, findSubcommand, parseCommandArgs } from "@cotal-ai/core";
|
|
3
|
+
import { CommandFailure, commandFailureReport, cachedPreferences, disableColor, disableInput, envelopeLine, exitCode, failureEnvelope, globalFlagDeclarationProblems, hasMeshTargetFlags, inOperationSpace, isCommandFailure, isConnectRefusal, isSeededCommand, isWorkspaceTargetError, outputDeclarationProblems, renderReport, renderWorkspaceError, runOperation, workspaceErrorParts, targetErrorCode, terminalWidth, } from "@cotal-ai/workspace";
|
|
4
|
+
import { c, staleStoreHint, stderrLine } from "./ui.js";
|
|
4
5
|
import { isExtensionStub, materializeExtension, materializeExtensionCommand, overlayExtensions, setCommandSurface, setInstalledExtensionsEnabled, } from "./ext-loader.js";
|
|
5
6
|
import { reconcileSeededConnectors } from "./seed/reconcile.js";
|
|
6
7
|
import { isAuthenticSeedChild } from "./seed/lock.js";
|
|
7
|
-
import {
|
|
8
|
-
import { prepareCatalogCommand } from "./commands/sync.js";
|
|
8
|
+
import { printCommandHelp, printHelpPath, printEntry } from "./help.js";
|
|
9
|
+
import { CatalogPreparationError, prepareCatalogCommand } from "./commands/sync.js";
|
|
10
|
+
import { servicePresetCommand } from "./lib/service-presets.js";
|
|
11
|
+
import { metadataPositionals } from "./lib/command-path.js";
|
|
12
|
+
import { chooseMeshTarget } from "./lib/choose-target.js";
|
|
13
|
+
import { ConfirmationRequired } from "./lib/confirmation-required.js";
|
|
9
14
|
import { takeManagedHandoffCustody } from "./managed-handoff.js";
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function help(commands) {
|
|
16
|
-
// `__`-prefixed commands are internal (e.g. `__complete`, the completion dispatcher); `hidden`
|
|
17
|
-
// ones are runnable dev/test aids (e.g. `demo`) kept off the surface — hide both.
|
|
18
|
-
const visible = commands.filter((cmd) => !cmd.name.startsWith("__") && !cmd.hidden);
|
|
19
|
-
const groups = new Map();
|
|
20
|
-
for (const cmd of visible) {
|
|
21
|
-
const g = cmd.group ?? "Commands";
|
|
22
|
-
(groups.get(g) ?? groups.set(g, []).get(g)).push(cmd);
|
|
23
|
-
}
|
|
24
|
-
const rank = (g) => {
|
|
25
|
-
const i = GROUP_ORDER.indexOf(g);
|
|
26
|
-
return i === -1 ? GROUP_ORDER.length : i;
|
|
27
|
-
};
|
|
28
|
-
const ordered = [...groups.entries()].sort(([a], [b]) => rank(a) - rank(b));
|
|
29
|
-
const pad = Math.max(...visible.map((c) => c.name.length));
|
|
30
|
-
let out = `${c.bold("cotal")} - lateral agent coordination over NATS\n`;
|
|
31
|
-
for (const [group, cmds] of ordered) {
|
|
32
|
-
out += `\n${c.bold(group)}\n`;
|
|
33
|
-
for (const cmd of cmds)
|
|
34
|
-
out += ` ${cmd.name.padEnd(pad)} ${c.dim(cmd.summary)}\n`;
|
|
35
|
-
}
|
|
36
|
-
console.log(out);
|
|
15
|
+
/** Whether `args` ask for help: `--help` or `-h` before any `--`, after which every word is text. */
|
|
16
|
+
function asksForHelp(args) {
|
|
17
|
+
const end = args.indexOf("--");
|
|
18
|
+
const options = end === -1 ? args : args.slice(0, end);
|
|
19
|
+
return options.includes("--help") || options.includes("-h");
|
|
37
20
|
}
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
21
|
+
/** Whether a global flag (`--no-color`, `--no-input`) is `word`, applying it when it is. */
|
|
22
|
+
function takeGlobalFlag(word) {
|
|
23
|
+
if (word === "--no-color")
|
|
24
|
+
disableColor();
|
|
25
|
+
else if (word === "--no-input")
|
|
26
|
+
disableInput();
|
|
27
|
+
else
|
|
28
|
+
return false;
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
/** `words` without the global flags before any `--`, each applied. */
|
|
32
|
+
function stripGlobalFlags(words) {
|
|
33
|
+
const end = words.indexOf("--");
|
|
34
|
+
const head = (end === -1 ? words : words.slice(0, end)).filter((word) => !takeGlobalFlag(word));
|
|
35
|
+
return end === -1 ? head : [...head, ...words.slice(end)];
|
|
36
|
+
}
|
|
37
|
+
/** Whether `cmd` takes its words raw: it declares so, or it is an internal command, whose words are
|
|
38
|
+
* another command line. Such a command parses no flags of its own. */
|
|
39
|
+
function takesWordsRaw(cmd) {
|
|
40
|
+
return Boolean(cmd && (cmd.rawArgs || cmd.name.startsWith("__")));
|
|
41
|
+
}
|
|
42
|
+
/** The words `cmd` parses: the global flags are the kernel's, except for a command that takes its
|
|
43
|
+
* words raw. */
|
|
44
|
+
function ownWords(cmd, words) {
|
|
45
|
+
return takesWordsRaw(cmd) ? [...words] : stripGlobalFlags(words);
|
|
46
|
+
}
|
|
47
|
+
/** Whether the invoked mode declares a structured output, so it reports every outcome by the 0 to 5
|
|
48
|
+
* table: the subcommand `first` selects, else the command's bare form. */
|
|
49
|
+
function structured(cmd, first) {
|
|
50
|
+
const sub = findSubcommand(cmd, first);
|
|
51
|
+
return ((sub ? sub.outputs : cmd.outputs) ?? []).some((mode) => mode === "json" || mode === "ndjson");
|
|
52
|
+
}
|
|
53
|
+
/** Whether `args` ask `cmd` for JSON before any `--`: `--json`, `-j`, or `-j` in a group of the
|
|
54
|
+
* command's boolean short flags. Read from the words, because a usage error has no parse, so the mode
|
|
55
|
+
* is the first word that is not a flag. */
|
|
56
|
+
function asksForJson(cmd, args) {
|
|
57
|
+
if (!structured(cmd, args.find((word) => !word.startsWith("-"))))
|
|
58
|
+
return false;
|
|
59
|
+
const booleans = new Set((cmd.flags ?? []).flatMap((flag) => (flag.type === "boolean" && flag.short ? [flag.short] : [])));
|
|
60
|
+
const end = args.indexOf("--");
|
|
61
|
+
return (end === -1 ? args : args.slice(0, end)).some((word) => word === "--json" || word === "-j" || (/^-[A-Za-z]{2,}$/.test(word) && word.includes("j") && [...word.slice(1)].every((ch) => booleans.has(ch))));
|
|
62
|
+
}
|
|
63
|
+
/** A classified failure: its line and remedy on stderr, its envelope on stdout when one was asked
|
|
64
|
+
* for, and the exit code its outcome sets. The envelope is written synchronously, because stdout
|
|
65
|
+
* to a pipe is asynchronous on some platforms and `exit` would cut it short. */
|
|
66
|
+
function failureExit(cmd, failure, json, plain = false) {
|
|
67
|
+
// A command's own usage refusal reads as the parser's: the error, its remedy, then the help. A
|
|
68
|
+
// missing --yes is not a grammar mistake, and its remedy says the whole fix.
|
|
69
|
+
if (failure.code === "USAGE_INVALID" && !json) {
|
|
70
|
+
stderrLine("✗ ", failure.message, c.red);
|
|
71
|
+
if (failure.remedy)
|
|
72
|
+
stderrLine(" ", failure.remedy, c.dim);
|
|
73
|
+
if (!(failure instanceof ConfirmationRequired))
|
|
74
|
+
printCommandHelp(cmd, undefined, (line) => console.error(line), terminalWidth(process.stderr));
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
writeSync(2, `${renderReport(commandFailureReport(failure), plain ? "plain" : "rich", terminalWidth(process.stderr))}
|
|
78
|
+
`);
|
|
79
|
+
if (json)
|
|
80
|
+
writeSync(1, envelopeLine(failureEnvelope(cmd.name, failure)));
|
|
81
|
+
process.exit(exitCode(failure.outcome, failure.code));
|
|
53
82
|
}
|
|
54
83
|
/**
|
|
55
|
-
*
|
|
56
|
-
* `
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* survives a corrupt manifest.
|
|
60
|
-
* - every other real command reconciles first (so `npm i -g cotal-ai && cotal ext list` shows the
|
|
61
|
-
* four, and a first-command `ext add` still seeds), EXCEPT completion/help and an AUTHENTIC seed
|
|
62
|
-
* CHILD — an `ext add` whose `COTAL_EXT_SEEDING` nonce + parent PID match the live reconcile lock
|
|
63
|
-
* (a forged marker no longer skips, so it can't bypass the recursive-reconcile guard or the lock).
|
|
84
|
+
* `ext seed [--repair|--reset|--force]`, dispatched before the manifest overlay so repair survives a
|
|
85
|
+
* corrupt manifest. Returns `true` iff `argv` was that command (or its help), so the caller returns.
|
|
86
|
+
* The overlay cannot list the command yet, so the built-in `ext` is found through the registry,
|
|
87
|
+
* which resolves its alias too.
|
|
64
88
|
*/
|
|
65
|
-
async function
|
|
66
|
-
const [
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (argv.includes("--help") || argv.includes("-h")) {
|
|
75
|
-
commandHelp(extCmd);
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
await extCmd.run(parseCommandArgs(extCmd, argv.slice(1)));
|
|
89
|
+
async function extSeedGate(registry, argv) {
|
|
90
|
+
const [word, sub] = argv;
|
|
91
|
+
const extCmd = word === undefined || !registry.has("command", word) ? undefined : registry.resolve("command", word);
|
|
92
|
+
if (extCmd?.name !== "ext" || sub !== "seed")
|
|
93
|
+
return false;
|
|
94
|
+
// A help request short-circuits to usage and mutates NOTHING (the maintenance run writes the seed
|
|
95
|
+
// stamp/manifest).
|
|
96
|
+
if (asksForHelp(argv)) {
|
|
97
|
+
printCommandHelp(extCmd);
|
|
79
98
|
return true;
|
|
80
99
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
await reconcileSeededConnectors();
|
|
84
|
-
return false;
|
|
100
|
+
await extCmd.run(parseCommandArgs(extCmd, stripGlobalFlags(argv.slice(1))));
|
|
101
|
+
return true;
|
|
85
102
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Whether a validated invocation skips the connector seed. Every command reconciles first (so a
|
|
105
|
+
* first-command `ext add` still seeds, and the first command after an upgrade refreshes what is
|
|
106
|
+
* installed), EXCEPT help, version, completion, a read its command declares and the cases below. A
|
|
107
|
+
* read never repairs as a hidden prelude. `name` is the canonical command, `cmd` the command when it
|
|
108
|
+
* resolved, and `sub` its first positional; an AUTHENTIC seed CHILD is an `ext add` whose
|
|
109
|
+
* `COTAL_EXT_SEEDING` nonce + parent PID match the live reconcile lock (a forged marker no longer
|
|
110
|
+
* skips, so it can't bypass the recursive-reconcile guard or the lock).
|
|
111
|
+
*/
|
|
112
|
+
function skipsSeed(name, sub, argv, cmd) {
|
|
113
|
+
if (name === "help" || name === "version" || name === "__complete" || name === "completion")
|
|
114
|
+
return true;
|
|
115
|
+
if (cmd && readsOnly(cmd, sub))
|
|
89
116
|
return true;
|
|
90
|
-
if (
|
|
91
|
-
return true; //
|
|
117
|
+
if (name === "use" && sub === undefined)
|
|
118
|
+
return true; // bare `use` shows the selection: a read
|
|
92
119
|
// A dry run promises to plan and print while mutating NOTHING, and the boot-gate reconcile is a
|
|
93
120
|
// mutation of the operator-global seed store, manifest and npm prefix — it ran BEFORE the command
|
|
94
121
|
// body could reject the invocation, so `down --preserve-state --dry-run` (an unsupported
|
|
@@ -97,6 +124,18 @@ function skipAutoReconcile(argv) {
|
|
|
97
124
|
// planning surface reads what is installed; it never seeds to make the plan prettier.
|
|
98
125
|
if (argv.includes("--dry-run"))
|
|
99
126
|
return true;
|
|
127
|
+
if (name === "persona" || (name === "personas" && !argv.includes("--running")))
|
|
128
|
+
return true; // local files or existing native manager routes; neither installs connectors
|
|
129
|
+
if (["__service-feedback-intake", "__service-delivery", "__service-manager", "__service-auth", "__service-linear", "__service-web", "__service-exec-endpoint"].includes(name))
|
|
130
|
+
return true; // explicit native service child; never repairs the installation
|
|
131
|
+
if (name === "team" && (sub === "deploy" || sub === "remove"))
|
|
132
|
+
return true; // existing native manager/channel operations never install local connectors
|
|
133
|
+
// `backup restore` is excluded: it starts the restored stack and resumes its seats through `up
|
|
134
|
+
// --restore`, so it reconciles connectors under the same rules as that startup. Other modes stay offline.
|
|
135
|
+
if (name === "reset" || name === "down" || name === "doctor" || name === "feedback" || (name === "backup" && sub !== "restore") || name === "mint" || name === "manager" || name === "channel" || name === "stop" || name === "input" || name === "auth" || name === "endpoint" || name === "service")
|
|
136
|
+
return true; // native maintenance and channel policy never install connector packages
|
|
137
|
+
if (name === "run" && (sub === "turns" || sub === "yield"))
|
|
138
|
+
return true; // self-only relay does not repair the operator installation
|
|
100
139
|
if (name === "update")
|
|
101
140
|
return true; // update owns one explicit reconcile; never auto-refresh then force-refresh
|
|
102
141
|
// The seed is skipped for an INTERNAL CHILD re-exec — the `up`/`spawn` that spawns the delivery
|
|
@@ -105,8 +144,6 @@ function skipAutoReconcile(argv) {
|
|
|
105
144
|
// `cotal supervise --roster`, the agent supervisor + container entrypoint) still seeds on first run.
|
|
106
145
|
if (process.env.COTAL_SKIP_CONNECTOR_SEED === "1")
|
|
107
146
|
return true;
|
|
108
|
-
if (name === "ext" && sub === "root")
|
|
109
|
-
return true; // a side-effect-free path print: no seed noise, so `$(cotal ext root)` stays exactly one line even on first run
|
|
110
147
|
if (name === "ext" && sub === "seed")
|
|
111
148
|
return true; // the explicit maintenance command self-reconciles
|
|
112
149
|
if (name === "ext" && sub === "add" && isAuthenticSeedChild())
|
|
@@ -117,6 +154,8 @@ function skipAutoReconcile(argv) {
|
|
|
117
154
|
// (disconnecting a live seat at its token's expiry, #1857), and a matching generation seeded every
|
|
118
155
|
// connector as a side effect of a credential exchange. The seat's env carries no
|
|
119
156
|
// COTAL_SKIP_CONNECTOR_SEED (only an operator-set one is forwarded), so the skip is by name.
|
|
157
|
+
if (name === "history" && sub === "clear")
|
|
158
|
+
return true; // purge authority does not require installing connectors
|
|
120
159
|
if (name === "agent-bearer")
|
|
121
160
|
return true;
|
|
122
161
|
// `app-identity` is machine-facing too: the Claude connector's local server runs it on every
|
|
@@ -125,6 +164,11 @@ function skipAutoReconcile(argv) {
|
|
|
125
164
|
return true;
|
|
126
165
|
return false;
|
|
127
166
|
}
|
|
167
|
+
/** Whether the invocation is a mode its command declares as a read ({@link Command.reads}). */
|
|
168
|
+
function readsOnly(cmd, first) {
|
|
169
|
+
const sub = findSubcommand(cmd, first);
|
|
170
|
+
return sub ? sub.reads === true : cmd.reads === true;
|
|
171
|
+
}
|
|
128
172
|
/** node's parseArgs throws these for unknown/malformed flags; treat as a usage error. */
|
|
129
173
|
function isArgError(e) {
|
|
130
174
|
const code = e?.code;
|
|
@@ -132,8 +176,18 @@ function isArgError(e) {
|
|
|
132
176
|
}
|
|
133
177
|
/** One dispatcher-owned catalog gate for every command that uses the shared mesh target grammar,
|
|
134
178
|
* including commands self-registered by other packages. Registry-local `meshes add/rm` stay
|
|
135
|
-
* offline. `use` takes its target positionally, and status keeps stale bytes diagnostic-only.
|
|
179
|
+
* offline. `use` takes its target positionally, and status keeps stale bytes diagnostic-only.
|
|
180
|
+
* Those commands then let a terminal choose between running spaces (see {@link chooseMeshTarget});
|
|
181
|
+
* `status` reports an ambiguous target instead. */
|
|
136
182
|
async function prepareCatalogForCommand(cmd, args) {
|
|
183
|
+
if ((cmd.name === "supervise" || cmd.name === "__daemon-manager") && args.values.execution === "none")
|
|
184
|
+
return;
|
|
185
|
+
if (args.values["dry-run"] === true)
|
|
186
|
+
return; // preview handlers own read-only resolution; no catalog refresh or picker
|
|
187
|
+
if (findSubcommand(cmd, args.positionals[0])?.prepareMeshTarget === false)
|
|
188
|
+
return;
|
|
189
|
+
if (cmd.name === "update" && args.values.check === true)
|
|
190
|
+
return;
|
|
137
191
|
if (cmd.name === "meshes") {
|
|
138
192
|
const sub = args.positionals[0];
|
|
139
193
|
if (sub === undefined || sub === "list")
|
|
@@ -142,109 +196,303 @@ async function prepareCatalogForCommand(cmd, args) {
|
|
|
142
196
|
}
|
|
143
197
|
if (cmd.name === "use")
|
|
144
198
|
return prepareCatalogCommand(args, false, "use");
|
|
145
|
-
if (cmd.name === "status")
|
|
146
|
-
|
|
199
|
+
if (cmd.name === "status") {
|
|
200
|
+
if (!args.positionals.length)
|
|
201
|
+
return prepareCatalogCommand(args, true);
|
|
202
|
+
await prepareCatalogCommand(args);
|
|
203
|
+
return chooseMeshTarget(args);
|
|
204
|
+
}
|
|
147
205
|
if (cmd.name === "personas" && args.values.running !== true)
|
|
148
206
|
return;
|
|
149
|
-
if (cmd.prepareMeshTarget !== false && hasMeshTargetFlags(cmd.flags))
|
|
207
|
+
if (cmd.prepareMeshTarget !== false && hasMeshTargetFlags(cmd.flags)) {
|
|
150
208
|
await prepareCatalogCommand(args);
|
|
209
|
+
await chooseMeshTarget(args);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
/** A usage error, rendered as one red line plus the command's help when there is one. Exit 1. */
|
|
213
|
+
function usageExit(message, cmd, json = false) {
|
|
214
|
+
// A JSON caller gets the refusal as an envelope, so stdout stays one document and the help text
|
|
215
|
+
// the remedy names stays out of it.
|
|
216
|
+
if (cmd && json)
|
|
217
|
+
failureExit(cmd, new CommandFailure("refused", "USAGE_INVALID", message, { remedy: `run \`cotal help ${cmd.name}\`` }), true);
|
|
218
|
+
// The help goes to stderr with the reason, so a refused run leaves stdout empty and a script that
|
|
219
|
+
// sources or parses it gets nothing.
|
|
220
|
+
stderrLine("✗ ", message, c.red);
|
|
221
|
+
if (cmd)
|
|
222
|
+
printCommandHelp(cmd, undefined, (line) => console.error(line), terminalWidth(process.stderr));
|
|
223
|
+
process.exit(1);
|
|
224
|
+
}
|
|
225
|
+
/** `rest` parsed against `cmd`'s declared flags, positionals and subcommands, or a usage exit. Node's
|
|
226
|
+
* parse error is trimmed to its first sentence: the verbose "To specify a positional argument
|
|
227
|
+
* starting with a '-' …" tail is dropped. */
|
|
228
|
+
function parseOrExit(cmd, rest) {
|
|
229
|
+
const json = asksForJson(cmd, rest);
|
|
230
|
+
let parsed;
|
|
231
|
+
try {
|
|
232
|
+
parsed = parseCommandArgs(cmd, rest);
|
|
233
|
+
}
|
|
234
|
+
catch (e) {
|
|
235
|
+
if (isArgError(e))
|
|
236
|
+
usageExit(e.message.split(".")[0], cmd, json);
|
|
237
|
+
throw e;
|
|
238
|
+
}
|
|
239
|
+
const first = parsed.positionals[0];
|
|
240
|
+
// History also accepts a root channel positional; only its reserved clear token is a mode.
|
|
241
|
+
if (cmd.subcommands?.length && first !== undefined && cmd.name !== "history" && !findSubcommand(cmd, first))
|
|
242
|
+
usageExit(`cotal ${cmd.name} has no subcommand "${first}" - run \`cotal help ${cmd.name}\``, cmd, json);
|
|
243
|
+
// `--json` implies `--no-input`: a script reading one document cannot answer a prompt.
|
|
244
|
+
if (structured(cmd, first) && parsed.values.json === true)
|
|
245
|
+
disableInput();
|
|
246
|
+
const canonical = canonicalSubcommand(cmd, parsed);
|
|
247
|
+
try {
|
|
248
|
+
cmd.validate?.(canonical);
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
if (isCommandFailure(error))
|
|
252
|
+
failureExit(cmd, error, json, canonical.values.plain === true);
|
|
253
|
+
if (isArgError(error))
|
|
254
|
+
usageExit(error.message.split(".")[0], cmd, json);
|
|
255
|
+
throw error;
|
|
256
|
+
}
|
|
257
|
+
return canonical;
|
|
258
|
+
}
|
|
259
|
+
/** The parsed args with a subcommand alias in the first positional replaced by its name, so `run`
|
|
260
|
+
* only ever sees canonical subcommands. */
|
|
261
|
+
function canonicalSubcommand(cmd, parsed) {
|
|
262
|
+
const positionals = [...parsed.positionals];
|
|
263
|
+
let surface = cmd;
|
|
264
|
+
let changed = false;
|
|
265
|
+
for (let index = 0; index < positionals.length; index++) {
|
|
266
|
+
const sub = findSubcommand(surface, positionals[index]);
|
|
267
|
+
if (!sub)
|
|
268
|
+
break;
|
|
269
|
+
changed ||= sub.name !== positionals[index];
|
|
270
|
+
positionals[index] = sub.name;
|
|
271
|
+
surface = sub;
|
|
272
|
+
if (!sub.subcommands?.length)
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
return changed ? { ...parsed, positionals } : parsed;
|
|
151
276
|
}
|
|
152
|
-
/**
|
|
153
|
-
*
|
|
154
|
-
|
|
277
|
+
/** `-h`/`--help` anywhere after a command: that command's help, or its subcommand's when the first
|
|
278
|
+
* positional names one. Read from the declared specs, so a stub's help never imports its package. */
|
|
279
|
+
function printHelpFor(cmd, rest) {
|
|
280
|
+
const words = metadataPositionals(cmd, rest).positionals.map((item) => item.value);
|
|
281
|
+
let surface = cmd;
|
|
282
|
+
const path = [];
|
|
283
|
+
for (const word of words) {
|
|
284
|
+
const sub = findSubcommand(surface, word);
|
|
285
|
+
if (!sub || sub.hidden)
|
|
286
|
+
break;
|
|
287
|
+
path.push(sub.name);
|
|
288
|
+
surface = sub;
|
|
289
|
+
if (!sub.subcommands?.length)
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
printHelpPath(cmd, path);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Dispatch `argv` against the commands self-registered in a {@link Registry}. The single entry point
|
|
296
|
+
* a composition root calls — no hardcoded command list.
|
|
297
|
+
*
|
|
298
|
+
* It runs in two phases. The front end reads only local metadata: it resolves the command by exact
|
|
299
|
+
* name or alias (never a prefix), answers help and version, and parses a built-in command's flags
|
|
300
|
+
* against its declared specs. Only an invocation that passed it reaches the effects: the connector
|
|
301
|
+
* seed, provider materialization, target preparation and `run`. So a usage error seeds, writes and
|
|
302
|
+
* launches nothing. An extension command's flags are parsed after the seed, because its live specs
|
|
303
|
+
* come from importing a package the seed keeps current.
|
|
304
|
+
*/
|
|
155
305
|
export async function runCli(registry, argv, opts = {}) {
|
|
156
|
-
//
|
|
157
|
-
// the
|
|
158
|
-
|
|
159
|
-
//
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
306
|
+
// Global flags before the command word apply whatever the command is. The output flags are the
|
|
307
|
+
// command's own, so one written before the command word moves after it, and a `--` there ends
|
|
308
|
+
// the leading flags. A command that takes its words raw has no flags to read them as, so it
|
|
309
|
+
// refuses them there. The built-in surface decides that before any extension overlay is read.
|
|
310
|
+
const output = [];
|
|
311
|
+
let lead = 0;
|
|
312
|
+
for (; lead < argv.length; lead++) {
|
|
313
|
+
const word = argv[lead];
|
|
314
|
+
if (word === "--json" || word === "-j" || word === "--plain")
|
|
315
|
+
output.push(word);
|
|
316
|
+
else if (!takeGlobalFlag(word))
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
if (argv[lead] === "--")
|
|
320
|
+
lead++;
|
|
321
|
+
if (output.length && lead >= argv.length)
|
|
322
|
+
usageExit(`${output[0]} needs a command after it - run \`cotal help\` to list commands`);
|
|
323
|
+
if (output.length && takesWordsRaw(findCommand(registry.all("command"), argv[lead])))
|
|
324
|
+
usageExit(`${output[0]} before ${argv[lead]} is not read - ${argv[lead]} takes its words raw, with no output flags`);
|
|
325
|
+
argv = [...argv.slice(lead, lead + 1), ...output, ...argv.slice(lead + 1)];
|
|
326
|
+
// A recorded unit boots from built-in code only. Even reading the extension overlay can
|
|
327
|
+
// prevent recovery from an unrelated broken manifest. Validate before any handoff custody,
|
|
328
|
+
// installation repair, package materialization or target preparation. This is one exact
|
|
329
|
+
// private entry, not an exemption for arbitrary internal or extension command names.
|
|
330
|
+
if (argv[0] === "__service-unit") {
|
|
331
|
+
if (!registry.has("command", "__service-unit"))
|
|
332
|
+
usageExit("the native unit entry is not available in this composition root");
|
|
333
|
+
const unit = registry.resolve("command", "__service-unit");
|
|
334
|
+
const parsed = parseOrExit(unit, argv.slice(1));
|
|
335
|
+
try {
|
|
336
|
+
await unit.run(parsed);
|
|
337
|
+
}
|
|
338
|
+
catch (error) {
|
|
339
|
+
failureExit(unit, isCommandFailure(error) ? error : new CommandFailure("unknown", "OPERATION_UNKNOWN", "the original unit entry did not confirm its outcome; no replacement or repair was attempted"), false, true);
|
|
170
340
|
}
|
|
171
|
-
console.log(lines.join("\n"));
|
|
172
341
|
return;
|
|
173
342
|
}
|
|
343
|
+
// Before any ordinary dispatch outcome can exit, take the spawn handoff and ensure no child
|
|
344
|
+
// inherits its variable. The unit entry refuses such a handoff without consuming its file.
|
|
345
|
+
takeManagedHandoffCustody(process.env);
|
|
174
346
|
setInstalledExtensionsEnabled(Boolean(opts.extensions));
|
|
175
|
-
//
|
|
176
|
-
|
|
177
|
-
|
|
347
|
+
// The global spellings of help and version are the `help` and `version` commands.
|
|
348
|
+
if (argv[0] === "-v")
|
|
349
|
+
usageExit("-v is not the version flag - run `cotal version` or `cotal -V`");
|
|
350
|
+
if (argv[0] === "--version" || argv[0] === "-V")
|
|
351
|
+
argv = ["version", ...argv.slice(1)];
|
|
352
|
+
else if (argv[0] === "--help" || argv[0] === "-h")
|
|
353
|
+
argv = ["help", ...argv.slice(1)];
|
|
178
354
|
if (opts.extensions) {
|
|
179
355
|
try {
|
|
180
|
-
if (await
|
|
356
|
+
if (await extSeedGate(registry, argv))
|
|
181
357
|
return;
|
|
182
358
|
}
|
|
183
359
|
catch (e) {
|
|
184
|
-
|
|
360
|
+
stderrLine("✗ ", e.message, c.red);
|
|
185
361
|
process.exit(1);
|
|
186
362
|
}
|
|
187
363
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
364
|
+
const surface = () => {
|
|
365
|
+
let commands;
|
|
366
|
+
try {
|
|
367
|
+
commands = opts.extensions ? overlayExtensions(registry) : registry.all("command");
|
|
368
|
+
}
|
|
369
|
+
catch (e) {
|
|
370
|
+
// A corrupt extensions manifest must not silently shrink the surface — fatal and loud, but
|
|
371
|
+
// rendered as the CLI's one red line, not an unhandled-rejection stack dump.
|
|
372
|
+
stderrLine("✗ ", e.message, c.red);
|
|
373
|
+
process.exit(1);
|
|
374
|
+
}
|
|
375
|
+
for (const cmd of commands) {
|
|
376
|
+
const problems = [
|
|
377
|
+
...commandDeclarationProblems(cmd),
|
|
378
|
+
...outputDeclarationProblems(cmd),
|
|
379
|
+
...(cmd.subcommands ?? []).flatMap((sub) => outputDeclarationProblems({ name: `${cmd.name} ${sub.name}`, outputs: sub.outputs, flags: cmd.flags })),
|
|
380
|
+
...globalFlagDeclarationProblems(cmd),
|
|
381
|
+
];
|
|
382
|
+
if (problems.length)
|
|
383
|
+
usageExit(`internal error: ${problems.join("; ")}`);
|
|
384
|
+
}
|
|
385
|
+
setCommandSurface(commands); // the completion dispatcher reads the SAME surface help renders
|
|
386
|
+
return commands;
|
|
387
|
+
};
|
|
388
|
+
let commands = surface();
|
|
389
|
+
const [word, ...words] = argv;
|
|
390
|
+
if (word === undefined)
|
|
391
|
+
return printEntry(commands);
|
|
392
|
+
let cmd = findCommand(commands, word);
|
|
393
|
+
let rest = ownWords(cmd, words);
|
|
394
|
+
const wantsHelp = asksForHelp(rest);
|
|
395
|
+
if (cmd?.name === "service") {
|
|
396
|
+
try {
|
|
397
|
+
cmd = servicePresetCommand(cmd, rest);
|
|
398
|
+
}
|
|
399
|
+
catch (error) {
|
|
400
|
+
const failure = isCommandFailure(error) ? error : new CommandFailure("refused", "SCHEMA_INVALID", "service preset metadata could not be read; no provider was imported or installed");
|
|
401
|
+
failureExit(cmd, failure, asksForJson(cmd, rest), rest.includes("--plain"));
|
|
402
|
+
}
|
|
209
403
|
}
|
|
404
|
+
// A seeded package's command (`web`) can be absent only because the first seed has not installed
|
|
405
|
+
// it yet, so running it seeds and resolves again. Asking for its help seeds nothing, and any other
|
|
406
|
+
// unknown word is a usage error.
|
|
407
|
+
const awaitingSeed = !cmd && opts.extensions === true && isSeededCommand(word) && !wantsHelp && !skipsSeed(word, rest[0], rest);
|
|
408
|
+
if (!cmd && !awaitingSeed)
|
|
409
|
+
usageExit(`unknown command: ${word} - run \`cotal help\` to list commands`);
|
|
210
410
|
// `cotal <cmd> --help` / `-h` → that command's help, never run it. This intercept also covers
|
|
211
411
|
// rawArgs commands and extension STUBS (cached specs are exactly the display surface) — only
|
|
212
412
|
// `__`-internal ones are exempt, because __complete's argv is ANOTHER command's half-typed
|
|
213
413
|
// line, where `--help` is a word being completed, not a request.
|
|
214
|
-
if (!cmd.name.startsWith("__") &&
|
|
215
|
-
|
|
216
|
-
|
|
414
|
+
if (cmd && !cmd.name.startsWith("__") && wantsHelp)
|
|
415
|
+
return printHelpFor(cmd, rest);
|
|
416
|
+
let parsed = cmd && !isExtensionStub(cmd) ? parseOrExit(cmd, rest) : undefined;
|
|
417
|
+
// ---- Effects: only a validated invocation reaches this line. ----
|
|
418
|
+
// The seed can install or upgrade an extension package, so the surface is read again after it and
|
|
419
|
+
// an extension stub resolves against the manifest the seed left.
|
|
420
|
+
const controlOnlyManager = parsed?.values.execution === "none" && (cmd?.name === "supervise" || cmd?.name === "__daemon-manager");
|
|
421
|
+
if (opts.extensions && !controlOnlyManager && !skipsSeed(cmd?.name ?? word, parsed ? parsed.positionals[0] : rest[0], rest, cmd)) {
|
|
422
|
+
try {
|
|
423
|
+
await reconcileSeededConnectors();
|
|
424
|
+
}
|
|
425
|
+
catch (e) {
|
|
426
|
+
stderrLine("✗ ", e.message, c.red);
|
|
427
|
+
process.exit(1);
|
|
428
|
+
}
|
|
429
|
+
commands = surface();
|
|
430
|
+
cmd = findCommand(commands, word);
|
|
431
|
+
if (!cmd)
|
|
432
|
+
usageExit(`unknown command: ${word} - run \`cotal help\` to list commands`);
|
|
433
|
+
rest = ownWords(cmd, words);
|
|
217
434
|
}
|
|
218
435
|
// An extension stub materializes before parsing: verify the version pin, import the package
|
|
219
436
|
// (self-registers), and parse with the LIVE specs — the cache never drives run's input.
|
|
220
|
-
if (isExtensionStub(cmd)) {
|
|
437
|
+
if (cmd && isExtensionStub(cmd)) {
|
|
221
438
|
try {
|
|
222
439
|
cmd = await materializeExtensionCommand(cmd);
|
|
223
440
|
}
|
|
224
441
|
catch (e) {
|
|
225
|
-
|
|
442
|
+
stderrLine("✗ ", e.message, c.red);
|
|
226
443
|
process.exit(1);
|
|
227
444
|
}
|
|
445
|
+
parsed = parseOrExit(cmd, rest);
|
|
446
|
+
}
|
|
447
|
+
if (!cmd || !parsed)
|
|
448
|
+
throw new Error("internal error: dispatch reached its effects without a parsed command");
|
|
449
|
+
// A preferences file that does not validate stops every command, as a broken config file does, so
|
|
450
|
+
// nothing runs on a default the person did not mean. Help has already returned above.
|
|
451
|
+
if (!cmd.name.startsWith("__")) {
|
|
452
|
+
try {
|
|
453
|
+
cachedPreferences();
|
|
454
|
+
}
|
|
455
|
+
catch (e) {
|
|
456
|
+
if (!isCommandFailure(e))
|
|
457
|
+
throw e;
|
|
458
|
+
failureExit(cmd, e, structured(cmd, parsed.positionals[0]) && parsed.values.json === true, parsed.values.plain === true);
|
|
459
|
+
}
|
|
228
460
|
}
|
|
461
|
+
// A failure raised after the command recorded the space it resolved is reported in that space.
|
|
462
|
+
const scope = {};
|
|
229
463
|
try {
|
|
230
|
-
const parsed = parseCommandArgs(cmd, rest);
|
|
231
464
|
if (opts.extensions && cmd.requiredExtensions) {
|
|
232
465
|
for (const ref of cmd.requiredExtensions(parsed))
|
|
233
466
|
await materializeExtension(ref);
|
|
234
467
|
}
|
|
235
468
|
await prepareCatalogForCommand(cmd, parsed);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
469
|
+
await runOperation(scope, async () => {
|
|
470
|
+
if (cmd.prepare)
|
|
471
|
+
await cmd.prepare(parsed);
|
|
472
|
+
await cmd.run(parsed);
|
|
473
|
+
});
|
|
239
474
|
}
|
|
240
475
|
catch (e) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
476
|
+
const mode = parsed.positionals[0];
|
|
477
|
+
const json = structured(cmd, mode) && parsed.values.json === true;
|
|
478
|
+
// A usage error a command raises from its own checks prints the command's help, not a stack trace.
|
|
479
|
+
if (isArgError(e))
|
|
480
|
+
usageExit(e.message.split(".")[0], cmd, json);
|
|
481
|
+
if (isCommandFailure(e))
|
|
482
|
+
failureExit(cmd, inOperationSpace(e, scope.space), json, parsed.values.plain === true);
|
|
483
|
+
// A command that declares a structured output reports by the outcome table. A target it could
|
|
484
|
+
// not resolve or connect to is refused before any request, under the refusal's own code; a
|
|
485
|
+
// failure it did not classify is unknown: it may have had effects that cannot be attributed.
|
|
486
|
+
if (structured(cmd, mode)) {
|
|
487
|
+
if (isConnectRefusal(e))
|
|
488
|
+
failureExit(cmd, inOperationSpace(e.failure(), scope.space), json, parsed.values.plain === true);
|
|
489
|
+
if (isWorkspaceTargetError(e)) {
|
|
490
|
+
const { message, remedy } = workspaceErrorParts({ kind: "target", error: e });
|
|
491
|
+
failureExit(cmd, new CommandFailure("refused", targetErrorCode(e.code), message, remedy ? { remedy } : {}), json, parsed.values.plain === true);
|
|
492
|
+
}
|
|
493
|
+
if (e instanceof CatalogPreparationError)
|
|
494
|
+
failureExit(cmd, new CommandFailure("refused", e.code, e.message), json, parsed.values.plain === true);
|
|
495
|
+
failureExit(cmd, inOperationSpace(new CommandFailure("unknown", "OPERATION_UNKNOWN", e instanceof Error ? e.message : String(e)), scope.space), json, parsed.values.plain === true);
|
|
248
496
|
}
|
|
249
497
|
// A workspace TARGET error carries structured recovery — which entry, whether it was removed,
|
|
250
498
|
// what to run next — and has its own renderer. Its raw `.message` is deliberately dev-safe
|
|
@@ -263,12 +511,12 @@ export async function runCli(registry, argv, opts = {}) {
|
|
|
263
511
|
// contract is "denied, not absent", not a crash. The full stack stays available under
|
|
264
512
|
// COTAL_DEBUG for diagnosis.
|
|
265
513
|
const msg = e instanceof Error ? e.message : String(e);
|
|
266
|
-
|
|
514
|
+
stderrLine("✗ ", msg, c.red);
|
|
267
515
|
// Known failure signatures get a one-line operator hint (e.g. a stale-store durable
|
|
268
516
|
// collision names the `cotal clean` reset) - the error itself stays verbatim.
|
|
269
517
|
const hint = staleStoreHint(msg);
|
|
270
518
|
if (hint)
|
|
271
|
-
|
|
519
|
+
stderrLine(" ↳ ", hint, c.dim);
|
|
272
520
|
if (process.env.COTAL_DEBUG && e instanceof Error && e.stack)
|
|
273
521
|
console.error(c.dim(e.stack));
|
|
274
522
|
process.exit(1);
|