@cotal-ai/cli 0.181.0 → 0.182.1
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/command.d.ts.map +1 -1
- package/dist/command.js +198 -64
- package/dist/command.js.map +1 -1
- package/dist/commands/agents.d.ts +6 -1
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +62 -18
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/backup-maintenance.d.ts.map +1 -1
- package/dist/commands/backup-maintenance.js +9 -7
- package/dist/commands/backup-maintenance.js.map +1 -1
- package/dist/commands/backup.d.ts.map +1 -1
- package/dist/commands/backup.js +36 -10
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +2 -1
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +16 -4
- package/dist/commands/clean.js.map +1 -1
- package/dist/commands/doctor.js +5 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/ext.d.ts +1 -0
- package/dist/commands/ext.d.ts.map +1 -1
- package/dist/commands/ext.js +58 -12
- package/dist/commands/ext.js.map +1 -1
- package/dist/commands/feedback.js +1 -1
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/help.d.ts.map +1 -1
- package/dist/commands/help.js +14 -17
- package/dist/commands/help.js.map +1 -1
- package/dist/commands/history.d.ts.map +1 -1
- package/dist/commands/history.js +5 -1
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/join.js +1 -1
- package/dist/commands/join.js.map +1 -1
- package/dist/commands/mint.js +27 -26
- package/dist/commands/mint.js.map +1 -1
- package/dist/commands/persona.d.ts +2 -2
- package/dist/commands/persona.d.ts.map +1 -1
- package/dist/commands/persona.js +12 -10
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/personas.js +12 -5
- package/dist/commands/personas.js.map +1 -1
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +49 -20
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/service-actions.js +1 -1
- package/dist/commands/service-actions.js.map +1 -1
- package/dist/commands/service-registry.d.ts +1 -1
- package/dist/commands/service-registry.d.ts.map +1 -1
- package/dist/commands/service-registry.js +21 -8
- package/dist/commands/service-registry.js.map +1 -1
- package/dist/commands/setup.d.ts.map +1 -1
- package/dist/commands/setup.js +42 -18
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/space-registration.d.ts +3 -3
- package/dist/commands/space-registration.d.ts.map +1 -1
- package/dist/commands/space-registration.js +17 -8
- package/dist/commands/space-registration.js.map +1 -1
- package/dist/commands/space.d.ts +1 -1
- package/dist/commands/space.d.ts.map +1 -1
- package/dist/commands/space.js +22 -4
- package/dist/commands/space.js.map +1 -1
- package/dist/commands/spawn-flags.d.ts +1 -0
- package/dist/commands/spawn-flags.d.ts.map +1 -1
- package/dist/commands/spawn-flags.js +14 -0
- package/dist/commands/spawn-flags.js.map +1 -1
- package/dist/commands/spawn-managed-launch.d.ts.map +1 -1
- package/dist/commands/spawn-managed-launch.js +13 -9
- package/dist/commands/spawn-managed-launch.js.map +1 -1
- package/dist/commands/spawn-preview.js +4 -3
- package/dist/commands/spawn-preview.js.map +1 -1
- package/dist/commands/spawn.d.ts.map +1 -1
- package/dist/commands/spawn.js +7 -8
- package/dist/commands/spawn.js.map +1 -1
- package/dist/commands/stack-down.d.ts.map +1 -1
- package/dist/commands/stack-down.js +27 -13
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-gone.d.ts.map +1 -1
- package/dist/commands/stack-gone.js +22 -11
- package/dist/commands/stack-gone.js.map +1 -1
- package/dist/commands/stack-lost-records.d.ts +3 -1
- package/dist/commands/stack-lost-records.d.ts.map +1 -1
- package/dist/commands/stack-lost-records.js +22 -9
- package/dist/commands/stack-lost-records.js.map +1 -1
- package/dist/commands/stack-up.d.ts +1 -1
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +15 -11
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/stack-user-auth.d.ts +2 -2
- package/dist/commands/stack-user-auth.d.ts.map +1 -1
- package/dist/commands/stack-user-auth.js +6 -3
- package/dist/commands/stack-user-auth.js.map +1 -1
- package/dist/commands/status-health.d.ts +1 -1
- package/dist/commands/status-health.d.ts.map +1 -1
- package/dist/commands/status-health.js +3 -1
- package/dist/commands/status-health.js.map +1 -1
- package/dist/commands/status-legacy.d.ts +2 -2
- package/dist/commands/status-legacy.js +4 -4
- package/dist/commands/status-meshes.d.ts +6 -1
- package/dist/commands/status-meshes.d.ts.map +1 -1
- package/dist/commands/status-meshes.js +32 -11
- package/dist/commands/status-meshes.js.map +1 -1
- package/dist/commands/status-render.d.ts +2 -1
- package/dist/commands/status-render.d.ts.map +1 -1
- package/dist/commands/status-render.js +28 -13
- package/dist/commands/status-render.js.map +1 -1
- package/dist/commands/status.js +23 -28
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team-boot-controller.d.ts +1 -0
- package/dist/commands/team-boot-controller.d.ts.map +1 -1
- package/dist/commands/team-boot-controller.js +3 -2
- package/dist/commands/team-boot-controller.js.map +1 -1
- package/dist/commands/team.d.ts.map +1 -1
- package/dist/commands/team.js +23 -3
- package/dist/commands/team.js.map +1 -1
- package/dist/commands/up-detach.js +1 -1
- package/dist/commands/up-detach.js.map +1 -1
- package/dist/commands/up-foreground-listener.d.ts +20 -0
- package/dist/commands/up-foreground-listener.d.ts.map +1 -0
- package/dist/commands/up-foreground-listener.js +156 -0
- package/dist/commands/up-foreground-listener.js.map +1 -0
- package/dist/commands/up-manifest.d.ts +1 -0
- package/dist/commands/up-manifest.d.ts.map +1 -1
- package/dist/commands/up-manifest.js +9 -3
- package/dist/commands/up-manifest.js.map +1 -1
- package/dist/commands/up-resume.d.ts +1 -1
- package/dist/commands/up-resume.d.ts.map +1 -1
- package/dist/commands/up-resume.js +12 -5
- package/dist/commands/up-resume.js.map +1 -1
- package/dist/commands/up.d.ts.map +1 -1
- package/dist/commands/up.js +38 -155
- package/dist/commands/up.js.map +1 -1
- package/dist/commands/update-continuity.d.ts.map +1 -1
- package/dist/commands/update-continuity.js +3 -4
- package/dist/commands/update-continuity.js.map +1 -1
- package/dist/commands/update-process.d.ts +6 -4
- package/dist/commands/update-process.d.ts.map +1 -1
- package/dist/commands/update-process.js +107 -19
- package/dist/commands/update-process.js.map +1 -1
- package/dist/commands/update-windows-install.d.ts +2 -0
- package/dist/commands/update-windows-install.d.ts.map +1 -0
- package/dist/commands/update-windows-install.js +59 -0
- package/dist/commands/update-windows-install.js.map +1 -0
- package/dist/commands/update.js +7 -7
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/whoami.js +1 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/console/app.d.ts.map +1 -1
- package/dist/console/app.js +18 -11
- package/dist/console/app.js.map +1 -1
- package/dist/console/mesh.d.ts +4 -1
- package/dist/console/mesh.d.ts.map +1 -1
- package/dist/console/mesh.js +1 -1
- package/dist/console/mesh.js.map +1 -1
- package/dist/console/ui/CommandPalette.d.ts +2 -1
- package/dist/console/ui/CommandPalette.d.ts.map +1 -1
- package/dist/console/ui/CommandPalette.js +4 -4
- package/dist/console/ui/CommandPalette.js.map +1 -1
- package/dist/console/ui/Help.d.ts +2 -1
- package/dist/console/ui/Help.d.ts.map +1 -1
- package/dist/console/ui/Help.js +48 -8
- package/dist/console/ui/Help.js.map +1 -1
- package/dist/exec-endpoint/handler.js +1 -1
- package/dist/exec-endpoint/handler.js.map +1 -1
- package/dist/help.d.ts +1 -6
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +19 -3
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/auth-proc.js +1 -1
- package/dist/lib/auth-proc.js.map +1 -1
- package/dist/lib/broker-service.js +1 -1
- package/dist/lib/broker-service.js.map +1 -1
- package/dist/lib/broker-spawn.d.ts +3 -1
- package/dist/lib/broker-spawn.d.ts.map +1 -1
- package/dist/lib/broker-spawn.js.map +1 -1
- package/dist/lib/choose-target.d.ts.map +1 -1
- package/dist/lib/choose-target.js +3 -2
- package/dist/lib/choose-target.js.map +1 -1
- package/dist/lib/command-path.d.ts +6 -0
- package/dist/lib/command-path.d.ts.map +1 -1
- package/dist/lib/command-path.js +3 -0
- package/dist/lib/command-path.js.map +1 -1
- package/dist/lib/completion-scripts.d.ts.map +1 -1
- package/dist/lib/completion-scripts.js +1 -1
- package/dist/lib/completion-scripts.js.map +1 -1
- package/dist/lib/delivery-proc.js +1 -1
- package/dist/lib/delivery-proc.js.map +1 -1
- package/dist/lib/endpoint-errors.d.ts.map +1 -1
- package/dist/lib/endpoint-errors.js +17 -2
- package/dist/lib/endpoint-errors.js.map +1 -1
- package/dist/lib/exec-words.d.ts +3 -2
- package/dist/lib/exec-words.d.ts.map +1 -1
- package/dist/lib/exec-words.js +6 -5
- package/dist/lib/exec-words.js.map +1 -1
- package/dist/lib/extension-stage.d.ts +2 -0
- package/dist/lib/extension-stage.d.ts.map +1 -1
- package/dist/lib/extension-stage.js +32 -1
- package/dist/lib/extension-stage.js.map +1 -1
- package/dist/lib/foreground-broker-stop.d.ts +6 -0
- package/dist/lib/foreground-broker-stop.d.ts.map +1 -0
- package/dist/lib/foreground-broker-stop.js +31 -0
- package/dist/lib/foreground-broker-stop.js.map +1 -0
- package/dist/lib/foreground-hold.d.ts +2 -2
- package/dist/lib/foreground-hold.d.ts.map +1 -1
- package/dist/lib/foreground-hold.js +31 -8
- package/dist/lib/foreground-hold.js.map +1 -1
- package/dist/lib/history-command.d.ts +2 -1
- package/dist/lib/history-command.d.ts.map +1 -1
- package/dist/lib/history-command.js +4 -2
- package/dist/lib/history-command.js.map +1 -1
- package/dist/lib/isolated-broker.d.ts.map +1 -1
- package/dist/lib/isolated-broker.js +80 -31
- package/dist/lib/isolated-broker.js.map +1 -1
- package/dist/lib/leading-flags.d.ts +1 -0
- package/dist/lib/leading-flags.d.ts.map +1 -1
- package/dist/lib/leading-flags.js +5 -2
- package/dist/lib/leading-flags.js.map +1 -1
- package/dist/lib/local-process-stop.d.ts.map +1 -1
- package/dist/lib/local-process-stop.js +6 -2
- package/dist/lib/local-process-stop.js.map +1 -1
- package/dist/lib/manager-proc.d.ts.map +1 -1
- package/dist/lib/manager-proc.js +50 -2
- package/dist/lib/manager-proc.js.map +1 -1
- package/dist/lib/manifest/resolve.d.ts.map +1 -1
- package/dist/lib/manifest/resolve.js +2 -0
- package/dist/lib/manifest/resolve.js.map +1 -1
- package/dist/lib/nats-bin.js +2 -2
- package/dist/lib/nats-bin.js.map +1 -1
- package/dist/lib/npm-invocation.d.ts +13 -9
- package/dist/lib/npm-invocation.d.ts.map +1 -1
- package/dist/lib/npm-invocation.js +76 -17
- package/dist/lib/npm-invocation.js.map +1 -1
- package/dist/lib/paths.d.ts +1 -1
- package/dist/lib/paths.d.ts.map +1 -1
- package/dist/lib/paths.js +3 -3
- package/dist/lib/paths.js.map +1 -1
- package/dist/lib/persona-files.d.ts.map +1 -1
- package/dist/lib/persona-files.js +21 -3
- package/dist/lib/persona-files.js.map +1 -1
- package/dist/lib/personas.d.ts +6 -6
- package/dist/lib/personas.d.ts.map +1 -1
- package/dist/lib/personas.js +16 -9
- package/dist/lib/personas.js.map +1 -1
- package/dist/lib/restore-streams.d.ts.map +1 -1
- package/dist/lib/restore-streams.js +4 -4
- package/dist/lib/restore-streams.js.map +1 -1
- package/dist/lib/restore.d.ts +6 -2
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +19 -12
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/seat-capture.js +2 -2
- package/dist/lib/seat-capture.js.map +1 -1
- package/dist/lib/seat-restore.js +1 -1
- package/dist/lib/seat-restore.js.map +1 -1
- package/dist/lib/self-exec.js +1 -1
- package/dist/lib/self-exec.js.map +1 -1
- package/dist/lib/service-preset-target.d.ts +2 -2
- package/dist/lib/service-preset-target.d.ts.map +1 -1
- package/dist/lib/service-preset-target.js +7 -5
- package/dist/lib/service-preset-target.js.map +1 -1
- package/dist/lib/service-presets.d.ts.map +1 -1
- package/dist/lib/service-presets.js +5 -1
- package/dist/lib/service-presets.js.map +1 -1
- package/dist/lib/service-process.d.ts +1 -1
- package/dist/lib/service-process.d.ts.map +1 -1
- package/dist/lib/service-process.js +7 -4
- package/dist/lib/service-process.js.map +1 -1
- package/dist/lib/service-scope.d.ts.map +1 -1
- package/dist/lib/service-scope.js +13 -1
- package/dist/lib/service-scope.js.map +1 -1
- package/dist/lib/spawn-defaults.d.ts +5 -0
- package/dist/lib/spawn-defaults.d.ts.map +1 -1
- package/dist/lib/spawn-defaults.js +40 -3
- package/dist/lib/spawn-defaults.js.map +1 -1
- package/dist/lib/stack-journal.d.ts +12 -5
- package/dist/lib/stack-journal.d.ts.map +1 -1
- package/dist/lib/stack-journal.js +54 -14
- package/dist/lib/stack-journal.js.map +1 -1
- package/dist/lib/stack-resume.js +1 -1
- package/dist/lib/stack-resume.js.map +1 -1
- package/dist/lib/status.d.ts +2 -0
- package/dist/lib/status.d.ts.map +1 -1
- package/dist/lib/status.js +16 -2
- package/dist/lib/status.js.map +1 -1
- package/dist/lib/up-broker-address.d.ts +1 -0
- package/dist/lib/up-broker-address.d.ts.map +1 -1
- package/dist/lib/up-broker-address.js +6 -3
- package/dist/lib/up-broker-address.js.map +1 -1
- package/dist/lib/update-connector-config.d.ts.map +1 -1
- package/dist/lib/update-connector-config.js +3 -1
- package/dist/lib/update-connector-config.js.map +1 -1
- package/dist/lib/update-manager-install-linux.d.ts +8 -0
- package/dist/lib/update-manager-install-linux.d.ts.map +1 -0
- package/dist/lib/update-manager-install-linux.js +128 -0
- package/dist/lib/update-manager-install-linux.js.map +1 -0
- package/dist/lib/update-managers.d.ts +3 -0
- package/dist/lib/update-managers.d.ts.map +1 -1
- package/dist/lib/update-managers.js +25 -6
- package/dist/lib/update-managers.js.map +1 -1
- package/dist/lib/update-pending.d.ts +1 -0
- package/dist/lib/update-pending.d.ts.map +1 -1
- package/dist/lib/update-pending.js +3 -2
- package/dist/lib/update-pending.js.map +1 -1
- package/dist/lib/version.d.ts +2 -1
- package/dist/lib/version.d.ts.map +1 -1
- package/dist/lib/version.js +12 -7
- package/dist/lib/version.js.map +1 -1
- package/dist/seed/reconcile.d.ts +1 -1
- package/dist/seed/reconcile.d.ts.map +1 -1
- package/dist/seed/reconcile.js +11 -8
- package/dist/seed/reconcile.js.map +1 -1
- package/dist/seed/verify.d.ts +6 -1
- package/dist/seed/verify.d.ts.map +1 -1
- package/dist/seed/verify.js +21 -4
- package/dist/seed/verify.js.map +1 -1
- package/package.json +4 -4
package/dist/command.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAIA,OAAO,EAA6E,KAAK,OAAO,EAAkC,KAAK,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAIA,OAAO,EAA6E,KAAK,OAAO,EAAkC,KAAK,QAAQ,EAAmB,MAAM,gBAAgB,CAAC;AAmEzL,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAuWlF,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B;;;oCAGgC;IAChC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;gCAE4B;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAiWD,+FAA+F;AAC/F,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAUtE;AA8JD;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,GAAE,aAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGlG"}
|
package/dist/command.js
CHANGED
|
@@ -3,7 +3,7 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import { isAbsolute, join, parse, resolve } from "node:path";
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
5
|
import { commandDeclarationProblems, findCommand, findSubcommand, parseCommandArgs } from "@cotal-ai/core";
|
|
6
|
-
import { CommandFailure, commandFailureReport, cachedPreferences, CorruptExtensionsManifestError, cotalDirProblem, cotalHomeProblem, findCotalRoot, disableColor, disableInput, envelopeLine, exitCode, failureEnvelope, GLOBAL_FLAGS, globalConfigDirProblem, globalFlagDeclarationProblems, hasMeshTargetFlags, inOperationSpace, isCommandFailure, checkServer, isConnectRefusal, isMeshRegistryError, isSeededCommand, isWorkspaceTargetError, jsonFlag, localeIsUtf8, operationWarnings, outputDeclarationProblems, oneLine, paintFor, preferencesFolderWarning, recordOperationWarning, renderReport, renderWorkspaceError, runOperation, workspaceErrorParts, spaceRootTarget, targetErrorCode, targetErrorSpace, terminalWidth, userCotalDir, staleStoreHint, UnreadableConnectorSelection, } from "@cotal-ai/workspace";
|
|
6
|
+
import { CommandFailure, commandFailureReport, cachedPreferences, CorruptExtensionsManifestError, cotalDirProblem, cotalHomeProblem, findCotalRoot, disableColor, disableInput, envelopeLine, exitCode, failureEnvelope, GLOBAL_FLAGS, globalConfigDirProblem, globalFlagDeclarationProblems, hasMeshTargetFlags, inOperationSpace, isCommandFailure, checkServer, isConnectRefusal, isMeshRegistryError, isSeededCommand, isWorkspaceTargetError, jsonFlag, localeIsUtf8, operationWarnings, outputDeclarationProblems, oneLine, paintFor, preferencesFolderWarning, recordOperationWarning, renderReport, renderWorkspaceError, runOperation, workspaceErrorParts, spaceRootTarget, targetErrorCode, targetErrorSpace, terminalWidth, userCotalDir, windowsShellWord, staleStoreHint, UnreadableConnectorSelection, } from "@cotal-ai/workspace";
|
|
7
7
|
import { c, stderrLine } from "./ui.js";
|
|
8
8
|
import { debugFlag } from "./lib/debug-flag.js";
|
|
9
9
|
import { commandSurface, isExtensionStub, materializeExtension, materializeExtensionCommand, overlayExtensions, setCommandSurface, setInstalledExtensionsEnabled, } from "./ext-loader.js";
|
|
@@ -16,7 +16,7 @@ import { historySetupFailureRecords, membershipSetupFailureRecords, watchSetupFa
|
|
|
16
16
|
import { HISTORY_LIMIT_FLAGS } from "./commands/history-limit.js";
|
|
17
17
|
import { CatalogPreparationError, prepareCatalogCommand } from "./commands/sync.js";
|
|
18
18
|
import { keepStartupNotice } from "./lib/interrupt-notice.js";
|
|
19
|
-
import { metadataPositionals } from "./lib/command-path.js";
|
|
19
|
+
import { metadataPositionals, parserOptions } from "./lib/command-path.js";
|
|
20
20
|
import { chooseMeshTarget, spaceChoiceRemedy } from "./lib/choose-target.js";
|
|
21
21
|
import { registryFailure } from "./lib/registry-errors.js";
|
|
22
22
|
import { FlagValueRefusal } from "./lib/flag-value-refusal.js";
|
|
@@ -25,7 +25,7 @@ import { npmProjectDirectory, preserveUpdatePath } from "./lib/npm-invocation.js
|
|
|
25
25
|
import { reportLostOutput, writeAllSync } from "./lib/stdout-owner.js";
|
|
26
26
|
import { shellWord } from "./lib/endpoint-errors.js";
|
|
27
27
|
import { displayRemedy, hasMovedStackRemedy } from "./lib/self-exec.js";
|
|
28
|
-
import { asksForHelp, GLOBAL_FLAG_WORDS, leadingInvocation, OUTPUT_FLAG_WORDS } from "./lib/leading-flags.js";
|
|
28
|
+
import { asksForHelp, GLOBAL_FLAG_WORDS, leadingInvocation, OUTPUT_FLAG_WORDS, TYPOGRAPHIC_OPTION } from "./lib/leading-flags.js";
|
|
29
29
|
import { takeManagedHandoffCustody } from "./managed-handoff.js";
|
|
30
30
|
import { nearestWords, LEADING_FLAGS, unknownCommandMessage, unknownSubcommandMessage } from "./lib/nearest-word.js";
|
|
31
31
|
import { UnusableFile } from "./lib/unusable-file.js";
|
|
@@ -83,8 +83,10 @@ function takesWordsRaw(cmd) {
|
|
|
83
83
|
return Boolean(cmd && (cmd.rawArgs || cmd.name.startsWith("__")));
|
|
84
84
|
}
|
|
85
85
|
/** Refuse a repeated global flag using the command's output mode and subcommand help. */
|
|
86
|
-
async function repeatedGlobalFlag(word, cmd, words, warnings = []) {
|
|
87
|
-
const
|
|
86
|
+
async function repeatedGlobalFlag(word, cmd, words, warnings = [], textWords) {
|
|
87
|
+
const surface = await serviceSurface(takesWordsRaw(cmd) ? undefined : cmd, words, true);
|
|
88
|
+
const json = surface.cmd !== undefined && asksForJson(surface.cmd, surface.rest);
|
|
89
|
+
const { cmd: found, rest } = !json && textWords ? { cmd: undefined, rest: textWords } : surface;
|
|
88
90
|
const end = rest.indexOf("--");
|
|
89
91
|
const options = end === -1 ? rest : rest.slice(0, end);
|
|
90
92
|
// A global word in a string option's value slot cannot supply that value.
|
|
@@ -96,11 +98,11 @@ async function repeatedGlobalFlag(word, cmd, words, warnings = []) {
|
|
|
96
98
|
? { message: `--${flag.name} cannot be repeated`, remedy: `use --${flag.name} once` }
|
|
97
99
|
: missingValue(found, rest, flag)
|
|
98
100
|
: { message: `Option '${word}' cannot be repeated` };
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
return
|
|
101
|
+
if (found && json && isExtensionStub(found)) {
|
|
102
|
+
return runOperation({ warnings }, () => usageExit(refusal.message, found, json, options.includes("--plain"), refusal.remedy, rest));
|
|
103
|
+
}
|
|
104
|
+
routeCollisionWarnings(warnings, found, rest, false);
|
|
105
|
+
return usageExit(refusal.message, found, json, options.includes("--plain"), refusal.remedy, rest);
|
|
104
106
|
}
|
|
105
107
|
/** Whether the invoked mode declares a structured output, so it reports every outcome by the 0 to 5
|
|
106
108
|
* table: the subcommand `first` selects, else the command's bare form. */
|
|
@@ -207,10 +209,12 @@ function failureExit(cmd, failure, json, plain = false, scope, words = [], valid
|
|
|
207
209
|
const historyFollow = cmd.name === "history" && follow
|
|
208
210
|
&& !findSubcommand(cmd, validationArgs.positionals[0]);
|
|
209
211
|
const membershipFollow = cmd.name === "channel" && follow && validationArgs.positionals[0] === "members";
|
|
212
|
+
const target = failure.target;
|
|
210
213
|
const records = historyFollow ? historySetupFailureRecords(validationArgs, failure)
|
|
211
214
|
: membershipFollow ? membershipSetupFailureRecords({
|
|
212
215
|
space: validationArgs.values.space,
|
|
213
|
-
channel:
|
|
216
|
+
channel: (target && typeof target === "object" && "channel" in target && typeof target.channel === "string"
|
|
217
|
+
? target.channel : validationArgs.positionals[1])?.replace(/^#/, "") ?? null,
|
|
214
218
|
}, failure)
|
|
215
219
|
: cmd.name === "watch" && validationArgs && !plain ? watchSetupFailureRecords(validationArgs, failure) : undefined;
|
|
216
220
|
const lines = records ? records.map((record) => `${JSON.stringify(record)}\n`).join("") : envelopeLine(failureEnvelope(command, failure, warnings, scope));
|
|
@@ -465,6 +469,15 @@ function streamRefusalArgs(cmd, words) {
|
|
|
465
469
|
args.splice(missing.index + 1, 0, "");
|
|
466
470
|
}
|
|
467
471
|
}
|
|
472
|
+
/** An unreadable extension surface refuses dispatch, using the known built-in output mode if available. */
|
|
473
|
+
function overlayFailureExit(error, builtin, words, wantsHelp, scope) {
|
|
474
|
+
if (error instanceof CorruptExtensionsManifestError && builtin && !wantsHelp && !takesWordsRaw(builtin) && asksForJson(builtin, words)) {
|
|
475
|
+
const failure = new CommandFailure("refused", "SCHEMA_INVALID", error.diagnosis, { remedy: error.remedy, cause: error });
|
|
476
|
+
failureExit(builtin, failure, true, false, scope, words, streamRefusalArgs(builtin, words));
|
|
477
|
+
}
|
|
478
|
+
stderrLine("✗ ", error.message, c.red);
|
|
479
|
+
process.exit(1);
|
|
480
|
+
}
|
|
468
481
|
/** A usage error, written by {@link usageRefusal} with the help of the command or subcommand `words`
|
|
469
482
|
* name when there is one, and with `remedy` under the message when the parser can name one. Exit 1. */
|
|
470
483
|
function usageExit(message, cmd, json = false, plain = false, remedy, words = []) {
|
|
@@ -480,7 +493,7 @@ function usageExit(message, cmd, json = false, plain = false, remedy, words = []
|
|
|
480
493
|
/** The refusal for a named or short option typed with a typographic dash pasted from
|
|
481
494
|
* typeset text, as `\u2013\u2013json`, naming it with hyphens; undefined when `word` is no such option. */
|
|
482
495
|
function typographicOption(word, names, flags = []) {
|
|
483
|
-
const typed =
|
|
496
|
+
const typed = TYPOGRAPHIC_OPTION.exec(word);
|
|
484
497
|
if (!typed)
|
|
485
498
|
return undefined;
|
|
486
499
|
const [, name, value] = typed;
|
|
@@ -527,10 +540,12 @@ function misspelledOption(cmd, rest, flagNames) {
|
|
|
527
540
|
const flag = short && cmd.flags?.find((item) => item.short === short[1] && item.type === "string");
|
|
528
541
|
if (short && flag) {
|
|
529
542
|
const value = short[2];
|
|
530
|
-
const
|
|
543
|
+
const windows = process.platform === "win32";
|
|
544
|
+
const common = windows ? windowsShellWord(value) : undefined;
|
|
545
|
+
const quoted = windows ? common ?? `'${value.replaceAll("'", "''")}'` : shellWord(value);
|
|
531
546
|
const long = `--${flag.name}=${quoted}`;
|
|
532
547
|
const correction = value.startsWith("-") ? long : `-${short[1]} ${quoted} or ${long}`;
|
|
533
|
-
return { message: `${word} gives -${short[1]} the value "=${value}"`, remedy: `write ${correction}` };
|
|
548
|
+
return { message: `${word} gives -${short[1]} the value "=${value}"`, remedy: `write ${correction}${windows && common === undefined ? " in PowerShell" : ""}` };
|
|
534
549
|
}
|
|
535
550
|
const typed = positionals.has(index) ? recognize(word) : undefined;
|
|
536
551
|
if (typed && (cmd.name === "ext" || cmd.name === "endpoint") && typed.flagName && typed.flagName !== "help") {
|
|
@@ -545,9 +560,6 @@ function misspelledOption(cmd, rest, flagNames) {
|
|
|
545
560
|
}
|
|
546
561
|
return undefined;
|
|
547
562
|
}
|
|
548
|
-
function parserOptions(cmd) {
|
|
549
|
-
return Object.fromEntries((cmd.flags ?? []).map(({ name, type, short }) => [name, { type, ...(short ? { short } : {}) }]));
|
|
550
|
-
}
|
|
551
563
|
/** Strip standalone globals, but keep any global where a string option needs its value. */
|
|
552
564
|
function stripGlobalFlags(cmd, words) {
|
|
553
565
|
if (takesWordsRaw(cmd))
|
|
@@ -563,10 +575,111 @@ function stripGlobalFlags(cmd, words) {
|
|
|
563
575
|
function missingValue(cmd, words, flag, beforeSeparator = false) {
|
|
564
576
|
if (cmd.name === "run" && (flag.name === "adopt" || flag.name === "release") && helpPath(cmd, words).path[0] === "check")
|
|
565
577
|
return { message: `\`run check\` does not take --${flag.name}`, remedy: `run the check without --${flag.name}` };
|
|
578
|
+
if (cmd.name === "endpoint" && flag.name === "file" && helpPath(cmd, words).path[0] === "check")
|
|
579
|
+
return { message: "`endpoint check` does not take --file", remedy: "omit --file and keep the contract path" };
|
|
580
|
+
if (cmd.name === "service" && flag.name === "exec" && helpPath(cmd, words).path[0] === "status")
|
|
581
|
+
return { message: "`service status` does not take --exec", remedy: "omit --exec" };
|
|
582
|
+
if (cmd.name === "history") {
|
|
583
|
+
const sub = helpPath(cmd, words).path[0];
|
|
584
|
+
if (sub === "limit" && flag.name === "server")
|
|
585
|
+
return { message: "`history limit` does not take --server", remedy: "omit --server and use --space if you need to select a space" };
|
|
586
|
+
if (sub === "clear" && HISTORY_LIMIT_FLAGS.some((name) => name === flag.name))
|
|
587
|
+
return { message: `\`history clear\` does not take --${flag.name}`, remedy: `omit --${flag.name} from this command. Use it with \`history limit\` to change retention` };
|
|
588
|
+
}
|
|
589
|
+
if (cmd.name === "persona" && flag.name === "subscribe")
|
|
590
|
+
return { message: "--subscribe needs a value", remedy: `write --subscribe <a,b> or --subscribe= for none${beforeSeparator ? " (before --)" : ""}` };
|
|
566
591
|
return { message: `--${flag.name} needs a value`, remedy: `write --${flag.name} ${flag.value ?? "<value>"}${beforeSeparator ? " before --" : ""}` };
|
|
567
592
|
}
|
|
568
|
-
function switchValueRefusal(flag) {
|
|
569
|
-
|
|
593
|
+
function switchValueRefusal(flag, cmd, rest = [], json = false) {
|
|
594
|
+
const first = cmd && metadataPositionals(cmd, rest).positionals[0]?.value;
|
|
595
|
+
const acceptsFlag = GLOBAL_FLAG_WORDS.has(flag) || (cmd && (flag === "--plain"
|
|
596
|
+
? !json && (findSubcommand(cmd, first) ?? cmd).outputs?.includes("plain")
|
|
597
|
+
: structured(cmd, first)));
|
|
598
|
+
return { message: `${flag} takes no value`, remedy: `omit ${flag}${acceptsFlag ? " or pass it without a value" : ""}` };
|
|
599
|
+
}
|
|
600
|
+
/** Positional word limit for the separator remedy only, counting subcommand words. Commands with
|
|
601
|
+
* variable or unspecified arity keep their own grammar. */
|
|
602
|
+
function operandLimit(cmd, selected, first, rest) {
|
|
603
|
+
const mode = selected.name;
|
|
604
|
+
const values = () => parseArgs({ args: [...rest], options: parserOptions(cmd), strict: false, allowPositionals: true }).values;
|
|
605
|
+
switch (cmd.name) {
|
|
606
|
+
case "app-identity":
|
|
607
|
+
case "chat":
|
|
608
|
+
case "clean":
|
|
609
|
+
case "describe":
|
|
610
|
+
case "docs":
|
|
611
|
+
case "doctor":
|
|
612
|
+
case "feedback":
|
|
613
|
+
case "manager":
|
|
614
|
+
case "pending":
|
|
615
|
+
case "telemetry": return 1;
|
|
616
|
+
case "backup":
|
|
617
|
+
case "invoke":
|
|
618
|
+
case "persona":
|
|
619
|
+
case "reset":
|
|
620
|
+
case "service-endpoint":
|
|
621
|
+
case "space":
|
|
622
|
+
return 2;
|
|
623
|
+
case "config": return mode === "set" ? 3 : 2;
|
|
624
|
+
case "actor": return mode === "list" ? 1 : mode === "label" ? 3 : 2;
|
|
625
|
+
case "auth": return mode === "grants" || mode === "signer" ? 1 : mode === "inspect" ? 3 : 2;
|
|
626
|
+
case "channel": return mode === "defaults" ? 1 : 2;
|
|
627
|
+
case "daemon": return mode === "name" ? 2 : 1;
|
|
628
|
+
case "endpoint":
|
|
629
|
+
if (mode === "list")
|
|
630
|
+
return 1;
|
|
631
|
+
if (mode === "lease" || mode === "commit")
|
|
632
|
+
return 4;
|
|
633
|
+
if (mode === "work")
|
|
634
|
+
return 3;
|
|
635
|
+
return ["deregister", "invoke", "watch", "session"].includes(mode) ? 3 : 2;
|
|
636
|
+
case "ext": return mode === "root" || mode === "list" ? 1 : mode === "add" || mode === "remove" ? 2 : Infinity;
|
|
637
|
+
case "linear": return mode === "account" ? 2 : ["add", "login", "show", "call", "resource", "prompt"].includes(mode) ? 3 : 2;
|
|
638
|
+
case "meshes": return first === "add" ? 2 : Infinity;
|
|
639
|
+
case "personas":
|
|
640
|
+
case "service":
|
|
641
|
+
case "team": return mode === "list" ? 1 : 2;
|
|
642
|
+
case "run":
|
|
643
|
+
if (mode === "list" || mode === "turns")
|
|
644
|
+
return 1;
|
|
645
|
+
if (mode === "answer" || mode === "amend")
|
|
646
|
+
return 3;
|
|
647
|
+
if (mode === "check")
|
|
648
|
+
return values().file === undefined ? 3 : 2;
|
|
649
|
+
if (mode === "start" && values().file !== undefined)
|
|
650
|
+
return 1;
|
|
651
|
+
return 2;
|
|
652
|
+
case "attach": return values().name === undefined ? 1 : 0;
|
|
653
|
+
case "history": return mode === "clear" || mode === "limit" || !values().dms ? 1 : 0;
|
|
654
|
+
case "input": {
|
|
655
|
+
const { name, text } = values();
|
|
656
|
+
return name !== undefined ? 0 : text !== undefined ? 1 : 2;
|
|
657
|
+
}
|
|
658
|
+
case "login": {
|
|
659
|
+
const { cloud, idp, "migrate-from": migrateFrom } = values();
|
|
660
|
+
return cloud || idp !== undefined || migrateFrom !== undefined ? 0 : 1;
|
|
661
|
+
}
|
|
662
|
+
case "send": {
|
|
663
|
+
const { file, stdin } = values();
|
|
664
|
+
return file !== undefined || stdin ? 0 : 1;
|
|
665
|
+
}
|
|
666
|
+
case "spawn": return values().file === undefined ? 1 : 0;
|
|
667
|
+
case "status": {
|
|
668
|
+
const { all, components, wide, verbose } = values();
|
|
669
|
+
return all || components || wide || verbose ? 0 : 1;
|
|
670
|
+
}
|
|
671
|
+
case "stop": {
|
|
672
|
+
const { self, name } = values();
|
|
673
|
+
return self || name !== undefined ? 0 : 1;
|
|
674
|
+
}
|
|
675
|
+
case "topology": return values().file === undefined ? 2 : 1;
|
|
676
|
+
case "update": {
|
|
677
|
+
const { auto, notify } = values();
|
|
678
|
+
return auto || notify ? 1 : 0;
|
|
679
|
+
}
|
|
680
|
+
case "use": return values().clear ? 0 : 1;
|
|
681
|
+
default: return Infinity;
|
|
682
|
+
}
|
|
570
683
|
}
|
|
571
684
|
/** A parse error as a refusal. A mistyped option names its spelling. A word that starts with `-`
|
|
572
685
|
* goes after `--` only where the command has room for an operand and there is no spelling suggestion.
|
|
@@ -594,7 +707,7 @@ function parseRefusal(error, cmd, rest, flagNames, takesOperands, operandsFull)
|
|
|
594
707
|
const message = spellings ? `${reason} - did you mean ${spellings}?` : reason;
|
|
595
708
|
const remedy = cmd.name === "completion" ? "drop the unknown option"
|
|
596
709
|
: !takesOperands ? undefined : spellings ? `use ${spellings}`
|
|
597
|
-
: operandsFull ? "drop the unknown option" : "to pass a word that starts with \"-\", put -- before it";
|
|
710
|
+
: operandsFull() ? "drop the unknown option" : "to pass a word that starts with \"-\", put -- before it";
|
|
598
711
|
return { message, remedy };
|
|
599
712
|
}
|
|
600
713
|
if (error.code === "ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL") {
|
|
@@ -661,16 +774,7 @@ function parseOrExit(cmd, rest, noMoreOperands = false) {
|
|
|
661
774
|
}
|
|
662
775
|
const takesOperands = !seed && cmd.positionals !== undefined &&
|
|
663
776
|
(!cmd.subcommands?.length || cmd.name === "history" || (first !== undefined && findSubcommand(cmd, first) !== undefined));
|
|
664
|
-
const operandsFull = noMoreOperands ||
|
|
665
|
-
|| ((selected.name === "get" || selected.name === "unset") && positionals.length >= 2)))
|
|
666
|
-
|| (cmd.name === "ext" && selected.name === "root")
|
|
667
|
-
|| (cmd.name === "history" && selected.name === "limit")
|
|
668
|
-
|| (cmd.name === "space" && selected.name === "add" && positionals.length >= 2)
|
|
669
|
-
|| (cmd.name === "channel" && selected.name === "set" && positionals.length >= 2)
|
|
670
|
-
|| (cmd.name === "service" && selected !== cmd && (selected.name === "list" || positionals.length >= 2))
|
|
671
|
-
|| (cmd.name === "team" && ["check", "boot", "deploy"].includes(selected.name) && positionals.length >= 2)
|
|
672
|
-
|| (cmd.name === "endpoint" && ((selected.name === "check" && positionals.length >= 2)
|
|
673
|
-
|| (first === "work" && selected.name === "lease" && positionals.length >= 4)));
|
|
777
|
+
const operandsFull = () => noMoreOperands || positionals.length >= operandLimit(cmd, selected, first, rest);
|
|
674
778
|
const refusal = parseRefusal(e, cmd, rest, seed?.flagNames ?? selected.flagNames, takesOperands, operandsFull);
|
|
675
779
|
usageExit(refusal.message, cmd, json, plain, refusal.remedy, rest);
|
|
676
780
|
}
|
|
@@ -822,7 +926,7 @@ function helpPath(cmd, rest) {
|
|
|
822
926
|
* does, so a mistyped subcommand never gets its group's help. */
|
|
823
927
|
function printHelpFor(cmd, rest) {
|
|
824
928
|
const { path, unknown } = helpPath(cmd, rest);
|
|
825
|
-
paintFor(process.stdout, () => printHelpPath(cmd, unknown === undefined ? path : [...path, unknown]));
|
|
929
|
+
paintFor(process.stdout, () => printHelpPath(cmd, unknown === undefined ? path : [...path, unknown], undefined, undefined, undefined, rest));
|
|
826
930
|
}
|
|
827
931
|
/** A service invocation takes its preset's flags, and `manager <verb>` is `service <verb> manager`.
|
|
828
932
|
* Preset details can enrich a global flag refusal but cannot replace it. */
|
|
@@ -844,19 +948,41 @@ async function serviceSurface(found, words, forRefusal = false) {
|
|
|
844
948
|
}
|
|
845
949
|
}
|
|
846
950
|
/** Recover the command and output mode for a malformed leading switch without dispatching it. */
|
|
847
|
-
async function unknownInvocationExit(commands, word, args, output, beforeSeparator) {
|
|
951
|
+
async function unknownInvocationExit(commands, word, args, output, beforeSeparator, warnings) {
|
|
952
|
+
const typed = typographicOption(word, new Set(LEADING_FLAGS.map((flag) => flag.slice(2))), [
|
|
953
|
+
jsonFlag, { name: "help", short: "h", type: "boolean" }, { name: "version", short: "V", type: "boolean" },
|
|
954
|
+
]);
|
|
848
955
|
const equals = word.indexOf("=");
|
|
849
|
-
const flag = equals === -1 ?
|
|
850
|
-
|
|
851
|
-
|
|
956
|
+
const flag = equals === -1 ? word : word.slice(0, equals);
|
|
957
|
+
const malformedSwitch = equals !== -1 && (GLOBAL_FLAG_WORDS.has(flag) || OUTPUT_FLAG_WORDS.has(flag));
|
|
958
|
+
const textExit = () => {
|
|
959
|
+
routeCollisionWarnings(warnings, undefined, [...output, ...args], false);
|
|
960
|
+
return usageExit(typed?.message ?? unknownCommandMessage(commands, word), undefined, false, false, typed?.remedy);
|
|
961
|
+
};
|
|
962
|
+
if (!beforeSeparator || (!typed && !malformedSwitch))
|
|
963
|
+
return textExit();
|
|
852
964
|
const retry = leadingInvocation(args, true);
|
|
853
965
|
const found = findCommand(commands, retry.word);
|
|
854
966
|
const words = [...output, ...retry.leading.filter((item) => OUTPUT_FLAG_WORDS.has(item)), ...retry.args];
|
|
855
967
|
const { cmd, rest } = await serviceSurface(takesWordsRaw(found) ? undefined : found, words, true);
|
|
968
|
+
const json = cmd !== undefined && asksForJson(cmd, rest);
|
|
969
|
+
if (typed && !json)
|
|
970
|
+
return textExit();
|
|
971
|
+
routeCollisionWarnings(warnings, cmd, rest, false);
|
|
856
972
|
const end = rest.indexOf("--");
|
|
857
973
|
const plain = (end === -1 ? rest : rest.slice(0, end)).includes("--plain");
|
|
858
|
-
const
|
|
859
|
-
return usageExit(message, cmd,
|
|
974
|
+
const refusal = typed ?? switchValueRefusal(flag, cmd, rest, json);
|
|
975
|
+
return usageExit(refusal.message, cmd, json, plain, refusal.remedy, rest);
|
|
976
|
+
}
|
|
977
|
+
function repeatedInvocationExit(repeated, cmd, rest, warnings, commands, tail, output) {
|
|
978
|
+
if (!cmd) {
|
|
979
|
+
// A valued leading switch can hide the command from dispatch, but not from its JSON refusal.
|
|
980
|
+
const retry = leadingInvocation(tail, true);
|
|
981
|
+
const found = retry.leading.length ? findCommand(commands, retry.word) : undefined;
|
|
982
|
+
if (found)
|
|
983
|
+
return repeatedGlobalFlag(repeated, found, [...output, ...retry.leading.filter((flag) => OUTPUT_FLAG_WORDS.has(flag)), ...retry.args], warnings, rest);
|
|
984
|
+
}
|
|
985
|
+
return repeatedGlobalFlag(repeated, cmd, rest, warnings);
|
|
860
986
|
}
|
|
861
987
|
/**
|
|
862
988
|
* Dispatch `argv` against the commands self-registered in a {@link Registry}. The single entry point
|
|
@@ -873,6 +999,11 @@ export function runCli(registry, argv, opts = {}) {
|
|
|
873
999
|
const scope = {};
|
|
874
1000
|
return runOperation(scope, () => dispatchCli(registry, argv, opts, scope));
|
|
875
1001
|
}
|
|
1002
|
+
// Explicit help for the bundled reference needs only the built-in command metadata.
|
|
1003
|
+
function isExplicitDocsHelp(registry, builtin, wantsHelp, words) {
|
|
1004
|
+
return builtin?.name === "help" && !wantsHelp && registry.has("command", "docs")
|
|
1005
|
+
&& metadataPositionals(builtin, words).positionals[0]?.value === "docs";
|
|
1006
|
+
}
|
|
876
1007
|
async function dispatchCli(registry, argv, opts, scope) {
|
|
877
1008
|
const startedAt = Date.now();
|
|
878
1009
|
const { leading, original, word, args } = leadingInvocation(argv);
|
|
@@ -914,18 +1045,26 @@ async function dispatchCli(registry, argv, opts, scope) {
|
|
|
914
1045
|
// Before any ordinary dispatch outcome can exit, a spawn takes its handoff, and no command lets a
|
|
915
1046
|
// child inherit the variable. The unit entry refuses such a handoff without consuming its file.
|
|
916
1047
|
takeManagedHandoffCustody(process.env, builtin?.name === "spawn");
|
|
917
|
-
|
|
1048
|
+
const docsHelp = isExplicitDocsHelp(registry, builtin, wantsHelp, words);
|
|
1049
|
+
setInstalledExtensionsEnabled(Boolean(opts.extensions) && !docsHelp);
|
|
1050
|
+
const pendingWarnings = [];
|
|
918
1051
|
const builtinDuplicate = builtin && duplicate(builtin);
|
|
919
|
-
if (builtinDuplicate)
|
|
920
|
-
|
|
1052
|
+
if (builtinDuplicate) {
|
|
1053
|
+
try {
|
|
1054
|
+
if (opts.extensions && !docsHelp)
|
|
1055
|
+
overlayExtensions(registry, collisionWarning(pendingWarnings));
|
|
1056
|
+
}
|
|
1057
|
+
catch { /* An unreadable manifest does not replace the argument refusal. */ }
|
|
1058
|
+
return repeatedGlobalFlag(builtinDuplicate, builtin, ownWords(builtin), pendingWarnings);
|
|
1059
|
+
}
|
|
921
1060
|
if (word === "-v")
|
|
922
1061
|
usageExit("-v is not the version flag - run `cotal version` or `cotal -V`");
|
|
923
1062
|
// The built-in check reports an unreadable inventory itself. Do not require that inventory to
|
|
924
1063
|
// construct its command surface, or recover an installation as a prelude to this read-only mode.
|
|
925
1064
|
const updateCheck = builtin?.name === "update" && words.includes("--check") && !wantsHelp
|
|
926
1065
|
&& parseOrExit(builtin, ownWords(builtin)).values.check === true;
|
|
927
|
-
//
|
|
928
|
-
const
|
|
1066
|
+
// Version reports inventory failures itself and needs no extension commands.
|
|
1067
|
+
const versionRead = builtin?.name === "version" && !wantsHelp;
|
|
929
1068
|
// The built-in updater repairs its connector paths before opening any promotion journal.
|
|
930
1069
|
const selfUpdate = builtin?.name === "update" && words.includes("--self") && !wantsHelp
|
|
931
1070
|
&& parseOrExit(builtin, ownWords(builtin)).values.self === true;
|
|
@@ -939,7 +1078,7 @@ async function dispatchCli(registry, argv, opts, scope) {
|
|
|
939
1078
|
? metadataPositionals(builtin, words).positionals[0]?.value : undefined;
|
|
940
1079
|
const configRead = builtin?.name === "config" && !wantsHelp && (readMode === undefined || readMode === "get");
|
|
941
1080
|
const completionStatus = builtin?.name === "completion" && !wantsHelp && readMode === undefined;
|
|
942
|
-
let useExtensionOverlay = opts.extensions && !updateCheck && !selfUpdate && !preference?.auto && !preference?.notify && builtin?.name !== "start";
|
|
1081
|
+
let useExtensionOverlay = opts.extensions && !docsHelp && !updateCheck && !selfUpdate && !preference?.auto && !preference?.notify && builtin?.name !== "start";
|
|
943
1082
|
function skipUnreadableConnectorOverlay(error) {
|
|
944
1083
|
if (!(error instanceof UnreadableConnectorSelection) || !builtin || !["version", "status", "down"].includes(builtin.name))
|
|
945
1084
|
return false;
|
|
@@ -979,21 +1118,25 @@ async function dispatchCli(registry, argv, opts, scope) {
|
|
|
979
1118
|
}
|
|
980
1119
|
}
|
|
981
1120
|
}
|
|
982
|
-
const pendingWarnings = [];
|
|
983
1121
|
const surface = (warnings) => {
|
|
984
1122
|
let commands;
|
|
985
1123
|
try {
|
|
986
|
-
commands = useExtensionOverlay && !
|
|
1124
|
+
commands = useExtensionOverlay && !versionRead && !extDiagnostics && !configFolder ? overlayExtensions(registry, collisionWarning(warnings)) : registry.all("command");
|
|
987
1125
|
}
|
|
988
1126
|
catch (e) {
|
|
989
|
-
|
|
1127
|
+
const infrastructureStatus = builtin?.name === "status" && !wantsHelp && !words.includes("--components")
|
|
1128
|
+
&& metadataPositionals(builtin, words).positionals.length === 0;
|
|
1129
|
+
if (((configRead || completionStatus || infrastructureStatus) && e instanceof CorruptExtensionsManifestError)
|
|
1130
|
+
|| (infrastructureStatus && isCommandFailure(e) && e.code === "PERMISSION_DENIED") || skipUnreadableConnectorOverlay(e)) {
|
|
1131
|
+
// The infrastructure report reads the manifest itself and can name the gap.
|
|
1132
|
+
if (infrastructureStatus)
|
|
1133
|
+
setInstalledExtensionsEnabled(false);
|
|
990
1134
|
commands = registry.all("command");
|
|
1135
|
+
}
|
|
991
1136
|
else {
|
|
992
1137
|
if (repeatedLeading)
|
|
993
1138
|
usageExit(`Option '${repeatedLeading}' cannot be repeated`);
|
|
994
|
-
|
|
995
|
-
stderrLine("✗ ", e.message, c.red);
|
|
996
|
-
process.exit(1);
|
|
1139
|
+
overlayFailureExit(e, builtin, words, wantsHelp, scope);
|
|
997
1140
|
}
|
|
998
1141
|
}
|
|
999
1142
|
for (const cmd of commands) {
|
|
@@ -1014,7 +1157,11 @@ async function dispatchCli(registry, argv, opts, scope) {
|
|
|
1014
1157
|
let rest = ownWords(cmd);
|
|
1015
1158
|
const repeated = duplicate(cmd);
|
|
1016
1159
|
if (repeated)
|
|
1017
|
-
return
|
|
1160
|
+
return repeatedInvocationExit(repeated, cmd, rest, pendingWarnings, commands, argv.slice(leading.length), output);
|
|
1161
|
+
// A seeded command can be absent until the first seed installs it. Help and unknown words do not seed.
|
|
1162
|
+
const awaitingSeed = !cmd && word !== undefined && opts.extensions === true && isSeededCommand(word) && !wantsHelp && !skipsSeed(word, rest[0], rest);
|
|
1163
|
+
if (!cmd && word !== undefined && !awaitingSeed)
|
|
1164
|
+
return unknownInvocationExit(commands, word, args, output, argv[leading.length] !== "--", pendingWarnings);
|
|
1018
1165
|
routeCollisionWarnings(pendingWarnings, cmd, rest, wantsHelp);
|
|
1019
1166
|
if (word === undefined)
|
|
1020
1167
|
return paintFor(process.stdout, () => printEntry(commands));
|
|
@@ -1035,19 +1182,6 @@ async function dispatchCli(registry, argv, opts, scope) {
|
|
|
1035
1182
|
}
|
|
1036
1183
|
};
|
|
1037
1184
|
arm();
|
|
1038
|
-
// A seeded package's command (`web`) can be absent only because the first seed has not installed
|
|
1039
|
-
// it yet, so running it seeds and resolves again. Asking for its help seeds nothing, and any other
|
|
1040
|
-
// unknown word is a usage error.
|
|
1041
|
-
const awaitingSeed = !cmd && opts.extensions === true && isSeededCommand(word) && !wantsHelp && !skipsSeed(word, rest[0], rest);
|
|
1042
|
-
// A leading flag typed with a typographic dash is read as the command word, so it is refused as the
|
|
1043
|
-
// same word after the command word is.
|
|
1044
|
-
const typed = cmd || awaitingSeed ? undefined : typographicOption(word, new Set(LEADING_FLAGS.map((flag) => flag.slice(2))), [
|
|
1045
|
-
jsonFlag, { name: "help", short: "h", type: "boolean" }, { name: "version", short: "V", type: "boolean" },
|
|
1046
|
-
]);
|
|
1047
|
-
if (typed)
|
|
1048
|
-
usageExit(typed.message, undefined, false, false, typed.remedy);
|
|
1049
|
-
if (!cmd && !awaitingSeed)
|
|
1050
|
-
return unknownInvocationExit(commands, word, args, output, argv[leading.length] !== "--");
|
|
1051
1185
|
// `cotal <cmd> --help` / `-h` → that command's help, never run it. This intercept also covers
|
|
1052
1186
|
// rawArgs commands and extension STUBS (cached specs are exactly the display surface) — only
|
|
1053
1187
|
// `__`-internal ones are exempt, because __complete's argv is ANOTHER command's half-typed
|
|
@@ -1119,7 +1253,7 @@ async function dispatchCli(registry, argv, opts, scope) {
|
|
|
1119
1253
|
cmd = await materializeExtensionCommand(cmd);
|
|
1120
1254
|
}
|
|
1121
1255
|
catch (e) {
|
|
1122
|
-
stderrLine("✗ ", e.message, c.red);
|
|
1256
|
+
stderrLine("✗ ", displayRemedy(e.message), c.red);
|
|
1123
1257
|
process.exit(1);
|
|
1124
1258
|
}
|
|
1125
1259
|
parsed = parseOrExit(cmd, rest);
|