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