@marinoscar/platform-cli 0.0.0-stage → 0.1.0-next.10
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/CHANGELOG.md +149 -0
- package/LICENSE +21 -0
- package/README.md +182 -2
- package/dist/android/build.d.ts +30 -0
- package/dist/android/build.d.ts.map +1 -0
- package/dist/android/build.js +126 -0
- package/dist/android/build.js.map +1 -0
- package/dist/android/command.d.ts +21 -0
- package/dist/android/command.d.ts.map +1 -0
- package/dist/android/command.js +355 -0
- package/dist/android/command.js.map +1 -0
- package/dist/android/deploy-step.d.ts +85 -0
- package/dist/android/deploy-step.d.ts.map +1 -0
- package/dist/android/deploy-step.js +268 -0
- package/dist/android/deploy-step.js.map +1 -0
- package/dist/android/doctor.d.ts +47 -0
- package/dist/android/doctor.d.ts.map +1 -0
- package/dist/android/doctor.js +219 -0
- package/dist/android/doctor.js.map +1 -0
- package/dist/android/exec.d.ts +42 -0
- package/dist/android/exec.d.ts.map +1 -0
- package/dist/android/exec.js +103 -0
- package/dist/android/exec.js.map +1 -0
- package/dist/android/fix-plan.d.ts +44 -0
- package/dist/android/fix-plan.d.ts.map +1 -0
- package/dist/android/fix-plan.js +86 -0
- package/dist/android/fix-plan.js.map +1 -0
- package/dist/android/git-freshness.d.ts +34 -0
- package/dist/android/git-freshness.d.ts.map +1 -0
- package/dist/android/git-freshness.js +120 -0
- package/dist/android/git-freshness.js.map +1 -0
- package/dist/android/gradle.d.ts +32 -0
- package/dist/android/gradle.d.ts.map +1 -0
- package/dist/android/gradle.js +55 -0
- package/dist/android/gradle.js.map +1 -0
- package/dist/android/identity.d.ts +27 -0
- package/dist/android/identity.d.ts.map +1 -0
- package/dist/android/identity.js +60 -0
- package/dist/android/identity.js.map +1 -0
- package/dist/android/index.d.ts +7 -0
- package/dist/android/index.d.ts.map +1 -0
- package/dist/android/index.js +8 -0
- package/dist/android/index.js.map +1 -0
- package/dist/android/installer.d.ts +28 -0
- package/dist/android/installer.d.ts.map +1 -0
- package/dist/android/installer.js +96 -0
- package/dist/android/installer.js.map +1 -0
- package/dist/android/java.d.ts +26 -0
- package/dist/android/java.d.ts.map +1 -0
- package/dist/android/java.js +65 -0
- package/dist/android/java.js.map +1 -0
- package/dist/android/keystore.d.ts +54 -0
- package/dist/android/keystore.d.ts.map +1 -0
- package/dist/android/keystore.js +159 -0
- package/dist/android/keystore.js.map +1 -0
- package/dist/android/metadata.d.ts +39 -0
- package/dist/android/metadata.d.ts.map +1 -0
- package/dist/android/metadata.js +61 -0
- package/dist/android/metadata.js.map +1 -0
- package/dist/android/operations.d.ts +42 -0
- package/dist/android/operations.d.ts.map +1 -0
- package/dist/android/operations.js +59 -0
- package/dist/android/operations.js.map +1 -0
- package/dist/android/paths.d.ts +29 -0
- package/dist/android/paths.d.ts.map +1 -0
- package/dist/android/paths.js +97 -0
- package/dist/android/paths.js.map +1 -0
- package/dist/android/publish.d.ts +37 -0
- package/dist/android/publish.d.ts.map +1 -0
- package/dist/android/publish.js +119 -0
- package/dist/android/publish.js.map +1 -0
- package/dist/android/registrations.d.ts +92 -0
- package/dist/android/registrations.d.ts.map +1 -0
- package/dist/android/registrations.js +112 -0
- package/dist/android/registrations.js.map +1 -0
- package/dist/android/release-status.d.ts +73 -0
- package/dist/android/release-status.d.ts.map +1 -0
- package/dist/android/release-status.js +161 -0
- package/dist/android/release-status.js.map +1 -0
- package/dist/android/release.d.ts +33 -0
- package/dist/android/release.d.ts.map +1 -0
- package/dist/android/release.js +59 -0
- package/dist/android/release.js.map +1 -0
- package/dist/android/screen-layout.d.ts +26 -0
- package/dist/android/screen-layout.d.ts.map +1 -0
- package/dist/android/screen-layout.js +24 -0
- package/dist/android/screen-layout.js.map +1 -0
- package/dist/android/screen-model.d.ts +56 -0
- package/dist/android/screen-model.d.ts.map +1 -0
- package/dist/android/screen-model.js +207 -0
- package/dist/android/screen-model.js.map +1 -0
- package/dist/android/screen.d.ts +8 -0
- package/dist/android/screen.d.ts.map +1 -0
- package/dist/android/screen.js +395 -0
- package/dist/android/screen.js.map +1 -0
- package/dist/android/sdk.d.ts +48 -0
- package/dist/android/sdk.d.ts.map +1 -0
- package/dist/android/sdk.js +82 -0
- package/dist/android/sdk.js.map +1 -0
- package/dist/android/server-url.d.ts +19 -0
- package/dist/android/server-url.d.ts.map +1 -0
- package/dist/android/server-url.js +36 -0
- package/dist/android/server-url.js.map +1 -0
- package/dist/android/upload-progress.d.ts +3 -0
- package/dist/android/upload-progress.d.ts.map +1 -0
- package/dist/android/upload-progress.js +47 -0
- package/dist/android/upload-progress.js.map +1 -0
- package/dist/android/version.d.ts +47 -0
- package/dist/android/version.d.ts.map +1 -0
- package/dist/android/version.js +136 -0
- package/dist/android/version.js.map +1 -0
- package/dist/api-client/index.d.ts +3 -0
- package/dist/api-client/index.d.ts.map +1 -0
- package/dist/api-client/index.js +5 -0
- package/dist/api-client/index.js.map +1 -0
- package/dist/commands/index.d.ts +52 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +63 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/core/cli-registry.d.ts +41 -0
- package/dist/core/cli-registry.d.ts.map +1 -0
- package/dist/core/cli-registry.js +49 -0
- package/dist/core/cli-registry.js.map +1 -0
- package/dist/core/command-registry.d.ts +60 -0
- package/dist/core/command-registry.d.ts.map +1 -0
- package/dist/core/command-registry.js +114 -0
- package/dist/core/command-registry.js.map +1 -0
- package/dist/core/env-annotation-registry.d.ts +58 -0
- package/dist/core/env-annotation-registry.d.ts.map +1 -0
- package/dist/core/env-annotation-registry.js +80 -0
- package/dist/core/env-annotation-registry.js.map +1 -0
- package/dist/core/env-generator-registry.d.ts +59 -0
- package/dist/core/env-generator-registry.d.ts.map +1 -0
- package/dist/core/env-generator-registry.js +102 -0
- package/dist/core/env-generator-registry.js.map +1 -0
- package/dist/core/env-group-registry.d.ts +65 -0
- package/dist/core/env-group-registry.d.ts.map +1 -0
- package/dist/core/env-group-registry.js +77 -0
- package/dist/core/env-group-registry.js.map +1 -0
- package/dist/core/env-spec-registry.d.ts +133 -0
- package/dist/core/env-spec-registry.d.ts.map +1 -0
- package/dist/core/env-spec-registry.js +103 -0
- package/dist/core/env-spec-registry.js.map +1 -0
- package/dist/core/env-values.d.ts +76 -0
- package/dist/core/env-values.d.ts.map +1 -0
- package/dist/core/env-values.js +125 -0
- package/dist/core/env-values.js.map +1 -0
- package/dist/core/index.d.ts +14 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +10 -0
- package/dist/core/index.js.map +1 -0
- package/dist/deploy/index.d.ts +3 -0
- package/dist/deploy/index.d.ts.map +1 -0
- package/dist/deploy/index.js +5 -0
- package/dist/deploy/index.js.map +1 -0
- package/dist/engine/api-client.d.ts +211 -0
- package/dist/engine/api-client.d.ts.map +1 -0
- package/dist/engine/api-client.js +350 -0
- package/dist/engine/api-client.js.map +1 -0
- package/dist/engine/browser.d.ts +18 -0
- package/dist/engine/browser.d.ts.map +1 -0
- package/dist/engine/browser.js +115 -0
- package/dist/engine/browser.js.map +1 -0
- package/dist/engine/builtin-registrations.d.ts +20 -0
- package/dist/engine/builtin-registrations.d.ts.map +1 -0
- package/dist/engine/builtin-registrations.js +86 -0
- package/dist/engine/builtin-registrations.js.map +1 -0
- package/dist/engine/commands/api.d.ts +88 -0
- package/dist/engine/commands/api.d.ts.map +1 -0
- package/dist/engine/commands/api.js +398 -0
- package/dist/engine/commands/api.js.map +1 -0
- package/dist/engine/commands/config.d.ts +5 -0
- package/dist/engine/commands/config.d.ts.map +1 -0
- package/dist/engine/commands/config.js +83 -0
- package/dist/engine/commands/config.js.map +1 -0
- package/dist/engine/commands/deploy.d.ts +243 -0
- package/dist/engine/commands/deploy.d.ts.map +1 -0
- package/dist/engine/commands/deploy.js +1164 -0
- package/dist/engine/commands/deploy.js.map +1 -0
- package/dist/engine/commands/init.d.ts +18 -0
- package/dist/engine/commands/init.d.ts.map +1 -0
- package/dist/engine/commands/init.js +50 -0
- package/dist/engine/commands/init.js.map +1 -0
- package/dist/engine/commands/login.d.ts +4 -0
- package/dist/engine/commands/login.d.ts.map +1 -0
- package/dist/engine/commands/login.js +205 -0
- package/dist/engine/commands/login.js.map +1 -0
- package/dist/engine/commands/node.d.ts +21 -0
- package/dist/engine/commands/node.d.ts.map +1 -0
- package/dist/engine/commands/node.js +436 -0
- package/dist/engine/commands/node.js.map +1 -0
- package/dist/engine/config.d.ts +246 -0
- package/dist/engine/config.d.ts.map +1 -0
- package/dist/engine/config.js +414 -0
- package/dist/engine/config.js.map +1 -0
- package/dist/engine/conformance.d.ts +187 -0
- package/dist/engine/conformance.d.ts.map +1 -0
- package/dist/engine/conformance.js +227 -0
- package/dist/engine/conformance.js.map +1 -0
- package/dist/engine/create-cli.d.ts +94 -0
- package/dist/engine/create-cli.d.ts.map +1 -0
- package/dist/engine/create-cli.js +60 -0
- package/dist/engine/create-cli.js.map +1 -0
- package/dist/engine/deploy/about.d.ts +12 -0
- package/dist/engine/deploy/about.d.ts.map +1 -0
- package/dist/engine/deploy/about.js +110 -0
- package/dist/engine/deploy/about.js.map +1 -0
- package/dist/engine/deploy/adopt.d.ts +21 -0
- package/dist/engine/deploy/adopt.d.ts.map +1 -0
- package/dist/engine/deploy/adopt.js +78 -0
- package/dist/engine/deploy/adopt.js.map +1 -0
- package/dist/engine/deploy/answers-file.d.ts +7 -0
- package/dist/engine/deploy/answers-file.d.ts.map +1 -0
- package/dist/engine/deploy/answers-file.js +49 -0
- package/dist/engine/deploy/answers-file.js.map +1 -0
- package/dist/engine/deploy/app-role.d.ts +278 -0
- package/dist/engine/deploy/app-role.d.ts.map +1 -0
- package/dist/engine/deploy/app-role.js +826 -0
- package/dist/engine/deploy/app-role.js.map +1 -0
- package/dist/engine/deploy/app-version.d.ts +47 -0
- package/dist/engine/deploy/app-version.d.ts.map +1 -0
- package/dist/engine/deploy/app-version.js +232 -0
- package/dist/engine/deploy/app-version.js.map +1 -0
- package/dist/engine/deploy/checks/database.d.ts +83 -0
- package/dist/engine/deploy/checks/database.d.ts.map +1 -0
- package/dist/engine/deploy/checks/database.js +455 -0
- package/dist/engine/deploy/checks/database.js.map +1 -0
- package/dist/engine/deploy/checks/dns.d.ts +3 -0
- package/dist/engine/deploy/checks/dns.d.ts.map +1 -0
- package/dist/engine/deploy/checks/dns.js +85 -0
- package/dist/engine/deploy/checks/dns.js.map +1 -0
- package/dist/engine/deploy/checks/host.d.ts +19 -0
- package/dist/engine/deploy/checks/host.d.ts.map +1 -0
- package/dist/engine/deploy/checks/host.js +530 -0
- package/dist/engine/deploy/checks/host.js.map +1 -0
- package/dist/engine/deploy/checks/index.d.ts +33 -0
- package/dist/engine/deploy/checks/index.d.ts.map +1 -0
- package/dist/engine/deploy/checks/index.js +67 -0
- package/dist/engine/deploy/checks/index.js.map +1 -0
- package/dist/engine/deploy/checks/registry.d.ts +102 -0
- package/dist/engine/deploy/checks/registry.d.ts.map +1 -0
- package/dist/engine/deploy/checks/registry.js +103 -0
- package/dist/engine/deploy/checks/registry.js.map +1 -0
- package/dist/engine/deploy/checks/source.d.ts +45 -0
- package/dist/engine/deploy/checks/source.d.ts.map +1 -0
- package/dist/engine/deploy/checks/source.js +175 -0
- package/dist/engine/deploy/checks/source.js.map +1 -0
- package/dist/engine/deploy/checks/tls.d.ts +87 -0
- package/dist/engine/deploy/checks/tls.d.ts.map +1 -0
- package/dist/engine/deploy/checks/tls.js +552 -0
- package/dist/engine/deploy/checks/tls.js.map +1 -0
- package/dist/engine/deploy/checks/types.d.ts +178 -0
- package/dist/engine/deploy/checks/types.d.ts.map +1 -0
- package/dist/engine/deploy/checks/types.js +199 -0
- package/dist/engine/deploy/checks/types.js.map +1 -0
- package/dist/engine/deploy/compose-files.d.ts +29 -0
- package/dist/engine/deploy/compose-files.d.ts.map +1 -0
- package/dist/engine/deploy/compose-files.js +118 -0
- package/dist/engine/deploy/compose-files.js.map +1 -0
- package/dist/engine/deploy/compose-hints.d.ts +11 -0
- package/dist/engine/deploy/compose-hints.d.ts.map +1 -0
- package/dist/engine/deploy/compose-hints.js +70 -0
- package/dist/engine/deploy/compose-hints.js.map +1 -0
- package/dist/engine/deploy/consent.d.ts +29 -0
- package/dist/engine/deploy/consent.d.ts.map +1 -0
- package/dist/engine/deploy/consent.js +35 -0
- package/dist/engine/deploy/consent.js.map +1 -0
- package/dist/engine/deploy/database-drop.d.ts +22 -0
- package/dist/engine/deploy/database-drop.d.ts.map +1 -0
- package/dist/engine/deploy/database-drop.js +135 -0
- package/dist/engine/deploy/database-drop.js.map +1 -0
- package/dist/engine/deploy/database.d.ts +116 -0
- package/dist/engine/deploy/database.d.ts.map +1 -0
- package/dist/engine/deploy/database.js +252 -0
- package/dist/engine/deploy/database.js.map +1 -0
- package/dist/engine/deploy/deploy-info.d.ts +48 -0
- package/dist/engine/deploy/deploy-info.d.ts.map +1 -0
- package/dist/engine/deploy/deploy-info.js +163 -0
- package/dist/engine/deploy/deploy-info.js.map +1 -0
- package/dist/engine/deploy/deployment-evidence.d.ts +38 -0
- package/dist/engine/deploy/deployment-evidence.d.ts.map +1 -0
- package/dist/engine/deploy/deployment-evidence.js +92 -0
- package/dist/engine/deploy/deployment-evidence.js.map +1 -0
- package/dist/engine/deploy/edge-config.d.ts +103 -0
- package/dist/engine/deploy/edge-config.d.ts.map +1 -0
- package/dist/engine/deploy/edge-config.js +170 -0
- package/dist/engine/deploy/edge-config.js.map +1 -0
- package/dist/engine/deploy/env-absence.d.ts +61 -0
- package/dist/engine/deploy/env-absence.d.ts.map +1 -0
- package/dist/engine/deploy/env-absence.js +33 -0
- package/dist/engine/deploy/env-absence.js.map +1 -0
- package/dist/engine/deploy/env-file.d.ts +14 -0
- package/dist/engine/deploy/env-file.d.ts.map +1 -0
- package/dist/engine/deploy/env-file.js +58 -0
- package/dist/engine/deploy/env-file.js.map +1 -0
- package/dist/engine/deploy/env-fragments.d.ts +29 -0
- package/dist/engine/deploy/env-fragments.d.ts.map +1 -0
- package/dist/engine/deploy/env-fragments.js +73 -0
- package/dist/engine/deploy/env-fragments.js.map +1 -0
- package/dist/engine/deploy/env-metadata.d.ts +73 -0
- package/dist/engine/deploy/env-metadata.d.ts.map +1 -0
- package/dist/engine/deploy/env-metadata.js +227 -0
- package/dist/engine/deploy/env-metadata.js.map +1 -0
- package/dist/engine/deploy/env-spec.d.ts +75 -0
- package/dist/engine/deploy/env-spec.d.ts.map +1 -0
- package/dist/engine/deploy/env-spec.js +239 -0
- package/dist/engine/deploy/env-spec.js.map +1 -0
- package/dist/engine/deploy/env-wizard.d.ts +56 -0
- package/dist/engine/deploy/env-wizard.d.ts.map +1 -0
- package/dist/engine/deploy/env-wizard.js +235 -0
- package/dist/engine/deploy/env-wizard.js.map +1 -0
- package/dist/engine/deploy/executor.d.ts +81 -0
- package/dist/engine/deploy/executor.d.ts.map +1 -0
- package/dist/engine/deploy/executor.js +247 -0
- package/dist/engine/deploy/executor.js.map +1 -0
- package/dist/engine/deploy/health.d.ts +153 -0
- package/dist/engine/deploy/health.d.ts.map +1 -0
- package/dist/engine/deploy/health.js +335 -0
- package/dist/engine/deploy/health.js.map +1 -0
- package/dist/engine/deploy/hooks.d.ts +66 -0
- package/dist/engine/deploy/hooks.d.ts.map +1 -0
- package/dist/engine/deploy/hooks.js +19 -0
- package/dist/engine/deploy/hooks.js.map +1 -0
- package/dist/engine/deploy/host-facts.d.ts +23 -0
- package/dist/engine/deploy/host-facts.d.ts.map +1 -0
- package/dist/engine/deploy/host-facts.js +67 -0
- package/dist/engine/deploy/host-facts.js.map +1 -0
- package/dist/engine/deploy/install.d.ts +233 -0
- package/dist/engine/deploy/install.d.ts.map +1 -0
- package/dist/engine/deploy/install.js +1315 -0
- package/dist/engine/deploy/install.js.map +1 -0
- package/dist/engine/deploy/inventory.d.ts +30 -0
- package/dist/engine/deploy/inventory.d.ts.map +1 -0
- package/dist/engine/deploy/inventory.js +122 -0
- package/dist/engine/deploy/inventory.js.map +1 -0
- package/dist/engine/deploy/journal.d.ts +77 -0
- package/dist/engine/deploy/journal.d.ts.map +1 -0
- package/dist/engine/deploy/journal.js +221 -0
- package/dist/engine/deploy/journal.js.map +1 -0
- package/dist/engine/deploy/layout.d.ts +77 -0
- package/dist/engine/deploy/layout.d.ts.map +1 -0
- package/dist/engine/deploy/layout.js +191 -0
- package/dist/engine/deploy/layout.js.map +1 -0
- package/dist/engine/deploy/oauth-check.d.ts +58 -0
- package/dist/engine/deploy/oauth-check.d.ts.map +1 -0
- package/dist/engine/deploy/oauth-check.js +213 -0
- package/dist/engine/deploy/oauth-check.js.map +1 -0
- package/dist/engine/deploy/proxy-bootstrap.d.ts +149 -0
- package/dist/engine/deploy/proxy-bootstrap.d.ts.map +1 -0
- package/dist/engine/deploy/proxy-bootstrap.js +416 -0
- package/dist/engine/deploy/proxy-bootstrap.js.map +1 -0
- package/dist/engine/deploy/proxy-streams.d.ts +110 -0
- package/dist/engine/deploy/proxy-streams.d.ts.map +1 -0
- package/dist/engine/deploy/proxy-streams.js +208 -0
- package/dist/engine/deploy/proxy-streams.js.map +1 -0
- package/dist/engine/deploy/proxy.d.ts +375 -0
- package/dist/engine/deploy/proxy.d.ts.map +1 -0
- package/dist/engine/deploy/proxy.js +758 -0
- package/dist/engine/deploy/proxy.js.map +1 -0
- package/dist/engine/deploy/renewal.d.ts +54 -0
- package/dist/engine/deploy/renewal.d.ts.map +1 -0
- package/dist/engine/deploy/renewal.js +169 -0
- package/dist/engine/deploy/renewal.js.map +1 -0
- package/dist/engine/deploy/repo.d.ts +119 -0
- package/dist/engine/deploy/repo.d.ts.map +1 -0
- package/dist/engine/deploy/repo.js +277 -0
- package/dist/engine/deploy/repo.js.map +1 -0
- package/dist/engine/deploy/run-record.d.ts +28 -0
- package/dist/engine/deploy/run-record.d.ts.map +1 -0
- package/dist/engine/deploy/run-record.js +44 -0
- package/dist/engine/deploy/run-record.js.map +1 -0
- package/dist/engine/deploy/state.d.ts +289 -0
- package/dist/engine/deploy/state.d.ts.map +1 -0
- package/dist/engine/deploy/state.js +163 -0
- package/dist/engine/deploy/state.js.map +1 -0
- package/dist/engine/deploy/steps/app-step-context.d.ts +24 -0
- package/dist/engine/deploy/steps/app-step-context.d.ts.map +1 -0
- package/dist/engine/deploy/steps/app-step-context.js +45 -0
- package/dist/engine/deploy/steps/app-step-context.js.map +1 -0
- package/dist/engine/deploy/steps/pipeline.d.ts +46 -0
- package/dist/engine/deploy/steps/pipeline.d.ts.map +1 -0
- package/dist/engine/deploy/steps/pipeline.js +73 -0
- package/dist/engine/deploy/steps/pipeline.js.map +1 -0
- package/dist/engine/deploy/steps/plan.d.ts +28 -0
- package/dist/engine/deploy/steps/plan.d.ts.map +1 -0
- package/dist/engine/deploy/steps/plan.js +32 -0
- package/dist/engine/deploy/steps/plan.js.map +1 -0
- package/dist/engine/deploy/steps/registry.d.ts +182 -0
- package/dist/engine/deploy/steps/registry.d.ts.map +1 -0
- package/dist/engine/deploy/steps/registry.js +212 -0
- package/dist/engine/deploy/steps/registry.js.map +1 -0
- package/dist/engine/deploy/steps/step-values.d.ts +28 -0
- package/dist/engine/deploy/steps/step-values.d.ts.map +1 -0
- package/dist/engine/deploy/steps/step-values.js +33 -0
- package/dist/engine/deploy/steps/step-values.js.map +1 -0
- package/dist/engine/deploy/testing/fake-postgres.d.ts +88 -0
- package/dist/engine/deploy/testing/fake-postgres.d.ts.map +1 -0
- package/dist/engine/deploy/testing/fake-postgres.js +236 -0
- package/dist/engine/deploy/testing/fake-postgres.js.map +1 -0
- package/dist/engine/deploy/testing/fake-vps.d.ts +147 -0
- package/dist/engine/deploy/testing/fake-vps.d.ts.map +1 -0
- package/dist/engine/deploy/testing/fake-vps.js +365 -0
- package/dist/engine/deploy/testing/fake-vps.js.map +1 -0
- package/dist/engine/deploy/uninstall.d.ts +87 -0
- package/dist/engine/deploy/uninstall.d.ts.map +1 -0
- package/dist/engine/deploy/uninstall.js +321 -0
- package/dist/engine/deploy/uninstall.js.map +1 -0
- package/dist/engine/deploy/update.d.ts +112 -0
- package/dist/engine/deploy/update.d.ts.map +1 -0
- package/dist/engine/deploy/update.js +1279 -0
- package/dist/engine/deploy/update.js.map +1 -0
- package/dist/engine/deploy/version-step.d.ts +65 -0
- package/dist/engine/deploy/version-step.d.ts.map +1 -0
- package/dist/engine/deploy/version-step.js +176 -0
- package/dist/engine/deploy/version-step.js.map +1 -0
- package/dist/engine/device-auth.d.ts +240 -0
- package/dist/engine/device-auth.d.ts.map +1 -0
- package/dist/engine/device-auth.js +442 -0
- package/dist/engine/device-auth.js.map +1 -0
- package/dist/engine/device-login.d.ts +126 -0
- package/dist/engine/device-login.d.ts.map +1 -0
- package/dist/engine/device-login.js +164 -0
- package/dist/engine/device-login.js.map +1 -0
- package/dist/engine/errors.d.ts +314 -0
- package/dist/engine/errors.d.ts.map +1 -0
- package/dist/engine/errors.js +561 -0
- package/dist/engine/errors.js.map +1 -0
- package/dist/engine/identity.d.ts +169 -0
- package/dist/engine/identity.d.ts.map +1 -0
- package/dist/engine/identity.js +227 -0
- package/dist/engine/identity.js.map +1 -0
- package/dist/engine/index.d.ts +104 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +126 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/init/local-profile.d.ts +93 -0
- package/dist/engine/init/local-profile.d.ts.map +1 -0
- package/dist/engine/init/local-profile.js +295 -0
- package/dist/engine/init/local-profile.js.map +1 -0
- package/dist/engine/init/run-init.d.ts +41 -0
- package/dist/engine/init/run-init.d.ts.map +1 -0
- package/dist/engine/init/run-init.js +297 -0
- package/dist/engine/init/run-init.js.map +1 -0
- package/dist/engine/node/capabilities.d.ts +238 -0
- package/dist/engine/node/capabilities.d.ts.map +1 -0
- package/dist/engine/node/capabilities.js +316 -0
- package/dist/engine/node/capabilities.js.map +1 -0
- package/dist/engine/node/daemon.d.ts +63 -0
- package/dist/engine/node/daemon.d.ts.map +1 -0
- package/dist/engine/node/daemon.js +227 -0
- package/dist/engine/node/daemon.js.map +1 -0
- package/dist/engine/node/doctor.d.ts +58 -0
- package/dist/engine/node/doctor.d.ts.map +1 -0
- package/dist/engine/node/doctor.js +394 -0
- package/dist/engine/node/doctor.js.map +1 -0
- package/dist/engine/node/enrollment.d.ts +98 -0
- package/dist/engine/node/enrollment.d.ts.map +1 -0
- package/dist/engine/node/enrollment.js +189 -0
- package/dist/engine/node/enrollment.js.map +1 -0
- package/dist/engine/node/env-flags.d.ts +5 -0
- package/dist/engine/node/env-flags.d.ts.map +1 -0
- package/dist/engine/node/env-flags.js +22 -0
- package/dist/engine/node/env-flags.js.map +1 -0
- package/dist/engine/node/executors/credential-hygiene.d.ts +63 -0
- package/dist/engine/node/executors/credential-hygiene.d.ts.map +1 -0
- package/dist/engine/node/executors/credential-hygiene.js +189 -0
- package/dist/engine/node/executors/credential-hygiene.js.map +1 -0
- package/dist/engine/node/executors/db-backup-run.d.ts +73 -0
- package/dist/engine/node/executors/db-backup-run.d.ts.map +1 -0
- package/dist/engine/node/executors/db-backup-run.js +362 -0
- package/dist/engine/node/executors/db-backup-run.js.map +1 -0
- package/dist/engine/node/executors/example-checksum.d.ts +30 -0
- package/dist/engine/node/executors/example-checksum.d.ts.map +1 -0
- package/dist/engine/node/executors/example-checksum.js +56 -0
- package/dist/engine/node/executors/example-checksum.js.map +1 -0
- package/dist/engine/node/executors/index.d.ts +168 -0
- package/dist/engine/node/executors/index.d.ts.map +1 -0
- package/dist/engine/node/executors/index.js +44 -0
- package/dist/engine/node/executors/index.js.map +1 -0
- package/dist/engine/node/executors/registry.d.ts +38 -0
- package/dist/engine/node/executors/registry.d.ts.map +1 -0
- package/dist/engine/node/executors/registry.js +92 -0
- package/dist/engine/node/executors/registry.js.map +1 -0
- package/dist/engine/node/heap-snapshot.d.ts +37 -0
- package/dist/engine/node/heap-snapshot.d.ts.map +1 -0
- package/dist/engine/node/heap-snapshot.js +160 -0
- package/dist/engine/node/heap-snapshot.js.map +1 -0
- package/dist/engine/node/install-deps.d.ts +73 -0
- package/dist/engine/node/install-deps.d.ts.map +1 -0
- package/dist/engine/node/install-deps.js +150 -0
- package/dist/engine/node/install-deps.js.map +1 -0
- package/dist/engine/node/ipc-protocol.d.ts +67 -0
- package/dist/engine/node/ipc-protocol.d.ts.map +1 -0
- package/dist/engine/node/ipc-protocol.js +83 -0
- package/dist/engine/node/ipc-protocol.js.map +1 -0
- package/dist/engine/node/lifecycle.d.ts +103 -0
- package/dist/engine/node/lifecycle.d.ts.map +1 -0
- package/dist/engine/node/lifecycle.js +259 -0
- package/dist/engine/node/lifecycle.js.map +1 -0
- package/dist/engine/node/logger.d.ts +82 -0
- package/dist/engine/node/logger.d.ts.map +1 -0
- package/dist/engine/node/logger.js +241 -0
- package/dist/engine/node/logger.js.map +1 -0
- package/dist/engine/node/memory-watchdog.d.ts +78 -0
- package/dist/engine/node/memory-watchdog.d.ts.map +1 -0
- package/dist/engine/node/memory-watchdog.js +224 -0
- package/dist/engine/node/memory-watchdog.js.map +1 -0
- package/dist/engine/node/node-api.d.ts +391 -0
- package/dist/engine/node/node-api.d.ts.map +1 -0
- package/dist/engine/node/node-api.js +123 -0
- package/dist/engine/node/node-api.js.map +1 -0
- package/dist/engine/node/node-config.d.ts +128 -0
- package/dist/engine/node/node-config.d.ts.map +1 -0
- package/dist/engine/node/node-config.js +237 -0
- package/dist/engine/node/node-config.js.map +1 -0
- package/dist/engine/node/node-dashboard-source.d.ts +56 -0
- package/dist/engine/node/node-dashboard-source.d.ts.map +1 -0
- package/dist/engine/node/node-dashboard-source.js +213 -0
- package/dist/engine/node/node-dashboard-source.js.map +1 -0
- package/dist/engine/node/node-engine.d.ts +229 -0
- package/dist/engine/node/node-engine.d.ts.map +1 -0
- package/dist/engine/node/node-engine.js +723 -0
- package/dist/engine/node/node-engine.js.map +1 -0
- package/dist/engine/node/node-errors.d.ts +54 -0
- package/dist/engine/node/node-errors.d.ts.map +1 -0
- package/dist/engine/node/node-errors.js +71 -0
- package/dist/engine/node/node-errors.js.map +1 -0
- package/dist/engine/node/node-events.d.ts +132 -0
- package/dist/engine/node/node-events.d.ts.map +1 -0
- package/dist/engine/node/node-events.js +2 -0
- package/dist/engine/node/node-events.js.map +1 -0
- package/dist/engine/node/node-vitals.d.ts +123 -0
- package/dist/engine/node/node-vitals.d.ts.map +1 -0
- package/dist/engine/node/node-vitals.js +266 -0
- package/dist/engine/node/node-vitals.js.map +1 -0
- package/dist/engine/node/paths.d.ts +39 -0
- package/dist/engine/node/paths.d.ts.map +1 -0
- package/dist/engine/node/paths.js +60 -0
- package/dist/engine/node/paths.js.map +1 -0
- package/dist/engine/node/pg-dump.d.ts +126 -0
- package/dist/engine/node/pg-dump.d.ts.map +1 -0
- package/dist/engine/node/pg-dump.js +223 -0
- package/dist/engine/node/pg-dump.js.map +1 -0
- package/dist/engine/node/pidfile.d.ts +38 -0
- package/dist/engine/node/pidfile.d.ts.map +1 -0
- package/dist/engine/node/pidfile.js +156 -0
- package/dist/engine/node/pidfile.js.map +1 -0
- package/dist/engine/node/runtime-tuning.d.ts +65 -0
- package/dist/engine/node/runtime-tuning.d.ts.map +1 -0
- package/dist/engine/node/runtime-tuning.js +198 -0
- package/dist/engine/node/runtime-tuning.js.map +1 -0
- package/dist/engine/node/service.d.ts +39 -0
- package/dist/engine/node/service.d.ts.map +1 -0
- package/dist/engine/node/service.js +211 -0
- package/dist/engine/node/service.js.map +1 -0
- package/dist/engine/node/start.d.ts +62 -0
- package/dist/engine/node/start.d.ts.map +1 -0
- package/dist/engine/node/start.js +245 -0
- package/dist/engine/node/start.js.map +1 -0
- package/dist/engine/node/worker-env-table.d.ts +15 -0
- package/dist/engine/node/worker-env-table.d.ts.map +1 -0
- package/dist/engine/node/worker-env-table.js +97 -0
- package/dist/engine/node/worker-env-table.js.map +1 -0
- package/dist/engine/node/worker-env.d.ts +50 -0
- package/dist/engine/node/worker-env.d.ts.map +1 -0
- package/dist/engine/node/worker-env.js +101 -0
- package/dist/engine/node/worker-env.js.map +1 -0
- package/dist/engine/output.d.ts +97 -0
- package/dist/engine/output.d.ts.map +1 -0
- package/dist/engine/output.js +274 -0
- package/dist/engine/output.js.map +1 -0
- package/dist/engine/package-info.d.ts +7 -0
- package/dist/engine/package-info.d.ts.map +1 -0
- package/dist/engine/package-info.js +38 -0
- package/dist/engine/package-info.js.map +1 -0
- package/dist/engine/program.d.ts +50 -0
- package/dist/engine/program.d.ts.map +1 -0
- package/dist/engine/program.js +197 -0
- package/dist/engine/program.js.map +1 -0
- package/dist/engine/prompt.d.ts +69 -0
- package/dist/engine/prompt.d.ts.map +1 -0
- package/dist/engine/prompt.js +205 -0
- package/dist/engine/prompt.js.map +1 -0
- package/dist/engine/registries.d.ts +5 -0
- package/dist/engine/registries.d.ts.map +1 -0
- package/dist/engine/registries.js +52 -0
- package/dist/engine/registries.js.map +1 -0
- package/dist/engine/request-body.d.ts +31 -0
- package/dist/engine/request-body.d.ts.map +1 -0
- package/dist/engine/request-body.js +156 -0
- package/dist/engine/request-body.js.map +1 -0
- package/dist/engine/test-support.d.ts +50 -0
- package/dist/engine/test-support.d.ts.map +1 -0
- package/dist/engine/test-support.js +86 -0
- package/dist/engine/test-support.js.map +1 -0
- package/dist/engine/tui/app.d.ts +3 -0
- package/dist/engine/tui/app.d.ts.map +1 -0
- package/dist/engine/tui/app.js +100 -0
- package/dist/engine/tui/app.js.map +1 -0
- package/dist/engine/tui/builtin-screens.d.ts +6 -0
- package/dist/engine/tui/builtin-screens.d.ts.map +1 -0
- package/dist/engine/tui/builtin-screens.js +54 -0
- package/dist/engine/tui/builtin-screens.js.map +1 -0
- package/dist/engine/tui/index.d.ts +23 -0
- package/dist/engine/tui/index.d.ts.map +1 -0
- package/dist/engine/tui/index.js +71 -0
- package/dist/engine/tui/index.js.map +1 -0
- package/dist/engine/tui/layout.d.ts +132 -0
- package/dist/engine/tui/layout.d.ts.map +1 -0
- package/dist/engine/tui/layout.js +200 -0
- package/dist/engine/tui/layout.js.map +1 -0
- package/dist/engine/tui/routes.d.ts +5 -0
- package/dist/engine/tui/routes.d.ts.map +1 -0
- package/dist/engine/tui/routes.js +16 -0
- package/dist/engine/tui/routes.js.map +1 -0
- package/dist/engine/tui/screen-registry.d.ts +100 -0
- package/dist/engine/tui/screen-registry.d.ts.map +1 -0
- package/dist/engine/tui/screen-registry.js +96 -0
- package/dist/engine/tui/screen-registry.js.map +1 -0
- package/dist/engine/tui/screen-sections.d.ts +9 -0
- package/dist/engine/tui/screen-sections.d.ts.map +1 -0
- package/dist/engine/tui/screen-sections.js +45 -0
- package/dist/engine/tui/screen-sections.js.map +1 -0
- package/dist/engine/tui/screens/deploy/advanced-model.d.ts +69 -0
- package/dist/engine/tui/screens/deploy/advanced-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/advanced-model.js +228 -0
- package/dist/engine/tui/screens/deploy/advanced-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor-model.d.ts +37 -0
- package/dist/engine/tui/screens/deploy/doctor-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor-model.js +89 -0
- package/dist/engine/tui/screens/deploy/doctor-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor.d.ts +8 -0
- package/dist/engine/tui/screens/deploy/doctor.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/doctor.js +153 -0
- package/dist/engine/tui/screens/deploy/doctor.js.map +1 -0
- package/dist/engine/tui/screens/deploy/fields.d.ts +123 -0
- package/dist/engine/tui/screens/deploy/fields.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/fields.js +202 -0
- package/dist/engine/tui/screens/deploy/fields.js.map +1 -0
- package/dist/engine/tui/screens/deploy/flags-model.d.ts +67 -0
- package/dist/engine/tui/screens/deploy/flags-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/flags-model.js +302 -0
- package/dist/engine/tui/screens/deploy/flags-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/index.d.ts +6 -0
- package/dist/engine/tui/screens/deploy/index.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/index.js +83 -0
- package/dist/engine/tui/screens/deploy/index.js.map +1 -0
- package/dist/engine/tui/screens/deploy/install-model.d.ts +159 -0
- package/dist/engine/tui/screens/deploy/install-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/install-model.js +319 -0
- package/dist/engine/tui/screens/deploy/install-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/install.d.ts +8 -0
- package/dist/engine/tui/screens/deploy/install.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/install.js +361 -0
- package/dist/engine/tui/screens/deploy/install.js.map +1 -0
- package/dist/engine/tui/screens/deploy/model.d.ts +49 -0
- package/dist/engine/tui/screens/deploy/model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/model.js +59 -0
- package/dist/engine/tui/screens/deploy/model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/run-model.d.ts +58 -0
- package/dist/engine/tui/screens/deploy/run-model.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/run-model.js +117 -0
- package/dist/engine/tui/screens/deploy/run-model.js.map +1 -0
- package/dist/engine/tui/screens/deploy/run.d.ts +75 -0
- package/dist/engine/tui/screens/deploy/run.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/run.js +201 -0
- package/dist/engine/tui/screens/deploy/run.js.map +1 -0
- package/dist/engine/tui/screens/deploy/status.d.ts +17 -0
- package/dist/engine/tui/screens/deploy/status.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/status.js +107 -0
- package/dist/engine/tui/screens/deploy/status.js.map +1 -0
- package/dist/engine/tui/screens/deploy/update.d.ts +41 -0
- package/dist/engine/tui/screens/deploy/update.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy/update.js +175 -0
- package/dist/engine/tui/screens/deploy/update.js.map +1 -0
- package/dist/engine/tui/screens/deploy.d.ts +12 -0
- package/dist/engine/tui/screens/deploy.d.ts.map +1 -0
- package/dist/engine/tui/screens/deploy.js +23 -0
- package/dist/engine/tui/screens/deploy.js.map +1 -0
- package/dist/engine/tui/screens/invoke.d.ts +6 -0
- package/dist/engine/tui/screens/invoke.d.ts.map +1 -0
- package/dist/engine/tui/screens/invoke.js +193 -0
- package/dist/engine/tui/screens/invoke.js.map +1 -0
- package/dist/engine/tui/screens/login.d.ts +6 -0
- package/dist/engine/tui/screens/login.d.ts.map +1 -0
- package/dist/engine/tui/screens/login.js +255 -0
- package/dist/engine/tui/screens/login.js.map +1 -0
- package/dist/engine/tui/screens/logout.d.ts +6 -0
- package/dist/engine/tui/screens/logout.d.ts.map +1 -0
- package/dist/engine/tui/screens/logout.js +142 -0
- package/dist/engine/tui/screens/logout.js.map +1 -0
- package/dist/engine/tui/screens/menu.d.ts +22 -0
- package/dist/engine/tui/screens/menu.d.ts.map +1 -0
- package/dist/engine/tui/screens/menu.js +84 -0
- package/dist/engine/tui/screens/menu.js.map +1 -0
- package/dist/engine/tui/screens/node.d.ts +6 -0
- package/dist/engine/tui/screens/node.d.ts.map +1 -0
- package/dist/engine/tui/screens/node.js +228 -0
- package/dist/engine/tui/screens/node.js.map +1 -0
- package/dist/engine/tui/screens/status.d.ts +6 -0
- package/dist/engine/tui/screens/status.d.ts.map +1 -0
- package/dist/engine/tui/screens/status.js +134 -0
- package/dist/engine/tui/screens/status.js.map +1 -0
- package/dist/engine/tui/scroll-box.d.ts +27 -0
- package/dist/engine/tui/scroll-box.d.ts.map +1 -0
- package/dist/engine/tui/scroll-box.js +52 -0
- package/dist/engine/tui/scroll-box.js.map +1 -0
- package/dist/engine/tui/section-registry.d.ts +65 -0
- package/dist/engine/tui/section-registry.d.ts.map +1 -0
- package/dist/engine/tui/section-registry.js +90 -0
- package/dist/engine/tui/section-registry.js.map +1 -0
- package/dist/engine/tui/terminal.d.ts +31 -0
- package/dist/engine/tui/terminal.d.ts.map +1 -0
- package/dist/engine/tui/terminal.js +142 -0
- package/dist/engine/tui/terminal.js.map +1 -0
- package/dist/engine/tui/tty.d.ts +49 -0
- package/dist/engine/tui/tty.d.ts.map +1 -0
- package/dist/engine/tui/tty.js +139 -0
- package/dist/engine/tui/tty.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/node/index.d.ts +3 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +5 -0
- package/dist/node/index.js.map +1 -0
- package/dist/telemetry/env-fragment.d.ts +47 -0
- package/dist/telemetry/env-fragment.d.ts.map +1 -0
- package/dist/telemetry/env-fragment.js +73 -0
- package/dist/telemetry/env-fragment.js.map +1 -0
- package/dist/telemetry/index.d.ts +7 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +7 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/node-span-relay.d.ts +107 -0
- package/dist/telemetry/node-span-relay.d.ts.map +1 -0
- package/dist/telemetry/node-span-relay.js +314 -0
- package/dist/telemetry/node-span-relay.js.map +1 -0
- package/dist/telemetry/node-span.d.ts +92 -0
- package/dist/telemetry/node-span.d.ts.map +1 -0
- package/dist/telemetry/node-span.js +28 -0
- package/dist/telemetry/node-span.js.map +1 -0
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +4 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/tui/index.d.ts +3 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +5 -0
- package/dist/tui/index.js.map +1 -0
- package/package.json +102 -4
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface PromptContext {
|
|
2
|
+
input?: NodeJS.ReadStream | undefined;
|
|
3
|
+
output?: NodeJS.WriteStream | undefined;
|
|
4
|
+
}
|
|
5
|
+
/** True when we can actually ask a question and expect an answer. */
|
|
6
|
+
export declare function canPrompt(ctx?: PromptContext): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Ask a question on stderr and return the trimmed answer.
|
|
9
|
+
*
|
|
10
|
+
* Throws UsageError (exit 2 — the invocation was wrong, not the server)
|
|
11
|
+
* when there is no TTY.
|
|
12
|
+
*/
|
|
13
|
+
export declare function prompt(question: string, ctx?: PromptContext): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Ask for the server URL.
|
|
16
|
+
*
|
|
17
|
+
* The default is shown in the prompt and returned on an empty answer, so a
|
|
18
|
+
* repeat login is one keypress. Returning the default rather than re-asking
|
|
19
|
+
* matters: an empty line at the end of piped input would otherwise loop
|
|
20
|
+
* forever.
|
|
21
|
+
*/
|
|
22
|
+
export declare function promptForServerUrl(defaultUrl?: string | undefined, ctx?: PromptContext): Promise<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Ask a yes/no question.
|
|
25
|
+
*
|
|
26
|
+
* An unrecognised answer RE-ASKS rather than falling back to the default. The
|
|
27
|
+
* default applies to an empty line only - somebody who typed "yeah" has an
|
|
28
|
+
* opinion, and silently reading it as "no" is how a confirmation stops meaning
|
|
29
|
+
* anything.
|
|
30
|
+
*
|
|
31
|
+
* Callers pass `defaultValue: false` for anything destructive. The TUI holds
|
|
32
|
+
* the same convention for the same reason (see tui/screens/logout.tsx): a
|
|
33
|
+
* destructive action defaulting to yes is one stray Enter away from happening
|
|
34
|
+
* by accident.
|
|
35
|
+
*/
|
|
36
|
+
export declare function confirm(question: string, options?: {
|
|
37
|
+
defaultValue?: boolean | undefined;
|
|
38
|
+
}, ctx?: PromptContext): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Ask for a value without echoing it.
|
|
41
|
+
*
|
|
42
|
+
* NOT ECHOING IS NOT COSMETIC. These values reach scrollback, `script` logs,
|
|
43
|
+
* and the screen behind whoever is standing near an operator on a laptop.
|
|
44
|
+
*
|
|
45
|
+
* THE MUTING IS DONE AT THE OUTPUT STREAM, not by patching readline. The usual
|
|
46
|
+
* trick - replacing the interface's `_writeToOutput` - SILENTLY STOPPED
|
|
47
|
+
* WORKING: Node's readline moved its internals behind symbols, so the property
|
|
48
|
+
* is still assignable, the assignment still appears to succeed, and every
|
|
49
|
+
* keystroke is echoed anyway. It fails open, which is the worst way for
|
|
50
|
+
* something like this to fail, and nothing about the code looks wrong.
|
|
51
|
+
*
|
|
52
|
+
* Handing readline a gated view of the output stream cannot fail that way: if
|
|
53
|
+
* writes stop going through `write`, nothing is displayed at all, which is
|
|
54
|
+
* obvious the first time anyone runs it.
|
|
55
|
+
*/
|
|
56
|
+
export declare function promptSecret(question: string, ctx?: PromptContext): Promise<string>;
|
|
57
|
+
export interface SelectChoice<T extends string> {
|
|
58
|
+
value: T;
|
|
59
|
+
label: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Ask the operator to pick one of a short list.
|
|
63
|
+
*
|
|
64
|
+
* Plain readline, not ink. This is the SUBCOMMAND path, which has to work over
|
|
65
|
+
* a bare SSH session and must never load the TUI - tui/tty.ts is explicit that
|
|
66
|
+
* an explicit subcommand never consults the TUI gate.
|
|
67
|
+
*/
|
|
68
|
+
export declare function select<T extends string>(question: string, choices: readonly SelectChoice<T>[], ctx?: PromptContext): Promise<T>;
|
|
69
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/engine/prompt.ts"],"names":[],"mappings":"AA+BA,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,GAAG,SAAS,CAAC;CACzC;AAED,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,OAAO,CAEtD;AAED;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBnF;AAED;;;;;;;GAOG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,EAC/B,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAAC,MAAM,CAAC,CAUjB;AAgDD;;;;;;;;;;;;GAYG;AACH,wBAAsB,OAAO,CAC3B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;CAAE,EAChD,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAAC,OAAO,CAAC,CAoBlB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAAC,MAAM,CAAC,CA6CjB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,SAAS,MAAM;IAC5C,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAsB,MAAM,CAAC,CAAC,SAAS,MAAM,EAC3C,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,SAAS,YAAY,CAAC,CAAC,CAAC,EAAE,EACnC,GAAG,CAAC,EAAE,aAAa,GAClB,OAAO,CAAC,CAAC,CAAC,CAwBZ"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { createInterface } from 'node:readline/promises';
|
|
2
|
+
import { cliName } from './identity.js';
|
|
3
|
+
import { UsageError } from './errors.js';
|
|
4
|
+
/** True when we can actually ask a question and expect an answer. */
|
|
5
|
+
export function canPrompt(ctx) {
|
|
6
|
+
return (ctx?.input ?? process.stdin).isTTY === true;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Ask a question on stderr and return the trimmed answer.
|
|
10
|
+
*
|
|
11
|
+
* Throws UsageError (exit 2 — the invocation was wrong, not the server)
|
|
12
|
+
* when there is no TTY.
|
|
13
|
+
*/
|
|
14
|
+
export async function prompt(question, ctx) {
|
|
15
|
+
const input = ctx?.input ?? process.stdin;
|
|
16
|
+
const output = ctx?.output ?? process.stderr;
|
|
17
|
+
if (input.isTTY !== true) {
|
|
18
|
+
throw new UsageError(`${cliName()} needs an interactive terminal to ask "${question.trim()}". Supply the value on the command line instead.`);
|
|
19
|
+
}
|
|
20
|
+
const rl = createInterface({ input, output, terminal: true });
|
|
21
|
+
try {
|
|
22
|
+
return (await rl.question(question)).trim();
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
// Always closed, including when the promise rejects on Ctrl-C. A readline
|
|
26
|
+
// interface left open holds stdin in raw mode: the shell the user returns
|
|
27
|
+
// to stops echoing what they type, which looks like a broken terminal and
|
|
28
|
+
// is fixed only by `reset`.
|
|
29
|
+
rl.close();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Ask for the server URL.
|
|
34
|
+
*
|
|
35
|
+
* The default is shown in the prompt and returned on an empty answer, so a
|
|
36
|
+
* repeat login is one keypress. Returning the default rather than re-asking
|
|
37
|
+
* matters: an empty line at the end of piped input would otherwise loop
|
|
38
|
+
* forever.
|
|
39
|
+
*/
|
|
40
|
+
export async function promptForServerUrl(defaultUrl, ctx) {
|
|
41
|
+
const suffix = defaultUrl === undefined ? '' : ` [${defaultUrl}]`;
|
|
42
|
+
const answer = await prompt(`Server URL${suffix}: `, ctx);
|
|
43
|
+
if (answer.length > 0)
|
|
44
|
+
return answer;
|
|
45
|
+
if (defaultUrl !== undefined)
|
|
46
|
+
return defaultUrl;
|
|
47
|
+
throw new UsageError(`A server URL is required. Re-run with --server <url> (for example: --server https://app.example.com).`);
|
|
48
|
+
}
|
|
49
|
+
// =============================================================================
|
|
50
|
+
// The three primitives the deployment wizard needs (issue #175, epic #168)
|
|
51
|
+
// =============================================================================
|
|
52
|
+
//
|
|
53
|
+
// Still `node:readline/promises`, still no dependency. The header above argues
|
|
54
|
+
// that a prompt library earns its weight only when you need select lists and
|
|
55
|
+
// validation loops; the wizard does need those, but it needs THREE of them,
|
|
56
|
+
// and the ink TUI already owns the rich case. Three small functions is a
|
|
57
|
+
// better trade than a dependency the TUI would make redundant.
|
|
58
|
+
//
|
|
59
|
+
// All three keep the two rules above: stderr, and no TTY means a clear error.
|
|
60
|
+
// =============================================================================
|
|
61
|
+
/**
|
|
62
|
+
* Opens ONE readline interface for a question that may be asked repeatedly.
|
|
63
|
+
*
|
|
64
|
+
* `confirm` and `select` both re-ask on a bad answer, and calling `prompt()` in
|
|
65
|
+
* a loop would open and close an interface per iteration. That is wasteful with
|
|
66
|
+
* a real terminal - raw mode toggled on and off each time - and outright wrong
|
|
67
|
+
* with buffered input: closing an interface discards what readline has already
|
|
68
|
+
* read ahead, so the answer to the second question disappears and the CLI hangs
|
|
69
|
+
* waiting for input that was consumed and thrown away.
|
|
70
|
+
*/
|
|
71
|
+
async function withInterface(ctx, body) {
|
|
72
|
+
const input = ctx?.input ?? process.stdin;
|
|
73
|
+
const output = ctx?.output ?? process.stderr;
|
|
74
|
+
if (input.isTTY !== true) {
|
|
75
|
+
throw new UsageError(`${cliName()} needs an interactive terminal to ask a question. Supply the value on the command line instead.`);
|
|
76
|
+
}
|
|
77
|
+
const rl = createInterface({ input, output, terminal: true });
|
|
78
|
+
try {
|
|
79
|
+
return await body(async (question) => (await rl.question(question)).trim());
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
// Same reason as `prompt`: an interface left open holds stdin in raw mode
|
|
83
|
+
// and the shell the user returns to stops echoing.
|
|
84
|
+
rl.close();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Ask a yes/no question.
|
|
89
|
+
*
|
|
90
|
+
* An unrecognised answer RE-ASKS rather than falling back to the default. The
|
|
91
|
+
* default applies to an empty line only - somebody who typed "yeah" has an
|
|
92
|
+
* opinion, and silently reading it as "no" is how a confirmation stops meaning
|
|
93
|
+
* anything.
|
|
94
|
+
*
|
|
95
|
+
* Callers pass `defaultValue: false` for anything destructive. The TUI holds
|
|
96
|
+
* the same convention for the same reason (see tui/screens/logout.tsx): a
|
|
97
|
+
* destructive action defaulting to yes is one stray Enter away from happening
|
|
98
|
+
* by accident.
|
|
99
|
+
*/
|
|
100
|
+
export async function confirm(question, options, ctx) {
|
|
101
|
+
const defaultValue = options?.defaultValue;
|
|
102
|
+
const hint = defaultValue === true ? '[Y/n]' : defaultValue === false ? '[y/N]' : '[y/n]';
|
|
103
|
+
const output = ctx?.output ?? process.stderr;
|
|
104
|
+
return await withInterface(ctx, async (ask) => {
|
|
105
|
+
for (;;) {
|
|
106
|
+
const answer = (await ask(`${question} ${hint} `)).toLowerCase();
|
|
107
|
+
if (answer === '') {
|
|
108
|
+
if (defaultValue !== undefined)
|
|
109
|
+
return defaultValue;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (answer === 'y' || answer === 'yes')
|
|
113
|
+
return true;
|
|
114
|
+
if (answer === 'n' || answer === 'no')
|
|
115
|
+
return false;
|
|
116
|
+
output.write(' Please answer y or n.\n');
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Ask for a value without echoing it.
|
|
122
|
+
*
|
|
123
|
+
* NOT ECHOING IS NOT COSMETIC. These values reach scrollback, `script` logs,
|
|
124
|
+
* and the screen behind whoever is standing near an operator on a laptop.
|
|
125
|
+
*
|
|
126
|
+
* THE MUTING IS DONE AT THE OUTPUT STREAM, not by patching readline. The usual
|
|
127
|
+
* trick - replacing the interface's `_writeToOutput` - SILENTLY STOPPED
|
|
128
|
+
* WORKING: Node's readline moved its internals behind symbols, so the property
|
|
129
|
+
* is still assignable, the assignment still appears to succeed, and every
|
|
130
|
+
* keystroke is echoed anyway. It fails open, which is the worst way for
|
|
131
|
+
* something like this to fail, and nothing about the code looks wrong.
|
|
132
|
+
*
|
|
133
|
+
* Handing readline a gated view of the output stream cannot fail that way: if
|
|
134
|
+
* writes stop going through `write`, nothing is displayed at all, which is
|
|
135
|
+
* obvious the first time anyone runs it.
|
|
136
|
+
*/
|
|
137
|
+
export async function promptSecret(question, ctx) {
|
|
138
|
+
const input = ctx?.input ?? process.stdin;
|
|
139
|
+
const output = ctx?.output ?? process.stderr;
|
|
140
|
+
if (input.isTTY !== true) {
|
|
141
|
+
throw new UsageError(`${cliName()} needs an interactive terminal to ask "${question.trim()}". Supply the value in the environment file instead.`);
|
|
142
|
+
}
|
|
143
|
+
let muted = false;
|
|
144
|
+
// A proxy rather than a hand-built stub: readline reaches for `columns`,
|
|
145
|
+
// `rows`, `cursorTo` and the event methods of a terminal output, and
|
|
146
|
+
// enumerating them here would break the next time it reaches for one more.
|
|
147
|
+
const gated = new Proxy(output, {
|
|
148
|
+
get(target, property, receiver) {
|
|
149
|
+
if (property === 'write') {
|
|
150
|
+
return (chunk, ...rest) => {
|
|
151
|
+
if (muted)
|
|
152
|
+
return true;
|
|
153
|
+
return target.write(chunk, ...rest);
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
const value = Reflect.get(target, property, receiver);
|
|
157
|
+
return typeof value === 'function' ? value.bind(target) : value;
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
const rl = createInterface({ input, output: gated, terminal: true });
|
|
161
|
+
try {
|
|
162
|
+
// The prompt is written while unmuted; everything after it is the user's
|
|
163
|
+
// own keystrokes being echoed back.
|
|
164
|
+
const pending = rl.question(question);
|
|
165
|
+
muted = true;
|
|
166
|
+
const answer = await pending;
|
|
167
|
+
// Readline's own newline was suppressed along with the echo.
|
|
168
|
+
output.write('\n');
|
|
169
|
+
return answer.trim();
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
muted = false;
|
|
173
|
+
// Same reason as `prompt`: an interface left open holds stdin in raw mode
|
|
174
|
+
// and the shell the user returns to stops echoing what they type.
|
|
175
|
+
rl.close();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Ask the operator to pick one of a short list.
|
|
180
|
+
*
|
|
181
|
+
* Plain readline, not ink. This is the SUBCOMMAND path, which has to work over
|
|
182
|
+
* a bare SSH session and must never load the TUI - tui/tty.ts is explicit that
|
|
183
|
+
* an explicit subcommand never consults the TUI gate.
|
|
184
|
+
*/
|
|
185
|
+
export async function select(question, choices, ctx) {
|
|
186
|
+
if (choices.length === 0) {
|
|
187
|
+
throw new UsageError('select() needs at least one choice');
|
|
188
|
+
}
|
|
189
|
+
const output = ctx?.output ?? process.stderr;
|
|
190
|
+
return await withInterface(ctx, async (ask) => {
|
|
191
|
+
for (;;) {
|
|
192
|
+
output.write(`${question}\n`);
|
|
193
|
+
choices.forEach((choice, index) => {
|
|
194
|
+
output.write(` ${index + 1}) ${choice.label}\n`);
|
|
195
|
+
});
|
|
196
|
+
const answer = await ask(`Choose 1-${choices.length}: `);
|
|
197
|
+
const index = Number(answer);
|
|
198
|
+
if (Number.isInteger(index) && index >= 1 && index <= choices.length) {
|
|
199
|
+
return choices[index - 1].value;
|
|
200
|
+
}
|
|
201
|
+
output.write(` Enter a number between 1 and ${choices.length}.\n`);
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/engine/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAiCzC,qEAAqE;AACrE,MAAM,UAAU,SAAS,CAAC,GAAmB;IAC3C,OAAO,CAAC,GAAG,EAAE,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,IAAI,CAAC;AACtD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,QAAgB,EAAE,GAAmB;IAChE,MAAM,KAAK,GAAG,GAAG,EAAE,KAAK,IAAI,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AAE,KAAK,EAAE,GAAG,EAAE,EAAE;QAC5C,SAAS,CAAC;YACR,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,IAAI,CAAC,CAAC;YAC9B,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;gBAChC,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,GAAG,CAAC,KAAK,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;YACpD,CAAC,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,YAAY,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC;YACzD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;YAE7B,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;gBACrE,OAAQ,OAAO,CAAC,KAAK,GAAG,CAAC,CAAqB,CAAC,KAAK,CAAC;YACvD,CAAC;YAED,MAAM,CAAC,KAAK,CAAC,kCAAkC,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;QACtE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Freezes every CLI registry; `createCli` calls it last. */
|
|
2
|
+
export declare function freezeCliRegistries(by: string): void;
|
|
3
|
+
/** Empties and unfreezes every CLI registry. Tests only. */
|
|
4
|
+
export declare function resetCliRegistriesForTests(): void;
|
|
5
|
+
//# sourceMappingURL=registries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registries.d.ts","sourceRoot":"","sources":["../../src/engine/registries.ts"],"names":[],"mappings":"AAiCA,6DAA6D;AAC7D,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAapD;AAED,4DAA4D;AAC5D,wBAAgB,0BAA0B,IAAI,IAAI,CAYjD"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { freezeCommandRegistry, freezeEnvAnnotationRegistry, freezeEnvGeneratorRegistry, freezeEnvGroupRegistry, freezeEnvSpecRegistry, resetEnvAnnotationRegistryForTests, resetEnvGeneratorRegistryForTests, } from '../core/index.js';
|
|
2
|
+
import { resetPlatformRegistrationsForTests } from './builtin-registrations.js';
|
|
3
|
+
import { freezeDeployCheckRegistry, resetDeployCheckRegistryForTests } from './deploy/checks/registry.js';
|
|
4
|
+
import { freezeEdgeConfigRegistry, resetEdgeConfigRegistryForTests } from './deploy/edge-config.js';
|
|
5
|
+
import { freezeProxyStreamRegistry, resetProxyStreamRegistryForTests } from './deploy/proxy-streams.js';
|
|
6
|
+
import { freezeDeployStepRegistry, resetDeployStepRegistryForTests } from './deploy/steps/registry.js';
|
|
7
|
+
import { resetCapabilityRegistriesForTests } from './node/capabilities.js';
|
|
8
|
+
import { freezeNodeExecutorRegistry, resetNodeExecutorRegistryForTests } from './node/executors/registry.js';
|
|
9
|
+
import { freezeTuiSectionRegistry, resetTuiSectionRegistryForTests } from './tui/section-registry.js';
|
|
10
|
+
import { freezeTuiScreenRegistry, resetTuiScreenRegistryForTests } from './tui/screen-registry.js';
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// The CLI's registries, together (PP-8.9, #715)
|
|
13
|
+
// =============================================================================
|
|
14
|
+
//
|
|
15
|
+
// Registries make a CLI an app's own: commands and env-spec fragments
|
|
16
|
+
// (`/core`, #706), TUI screens, deploy steps, node executors and (PP-14.22)
|
|
17
|
+
// proxy stream paths and the other deploy extension points. Each has
|
|
18
|
+
// string ids, a duplicate-id error and a deterministic order (built-ins
|
|
19
|
+
// first, then registration order). `createCli` FREEZES all five once the CLI
|
|
20
|
+
// is built: a registration that arrives later would be missing from the CLI
|
|
21
|
+
// that is already running, so it throws instead of being silently ignored.
|
|
22
|
+
// =============================================================================
|
|
23
|
+
/** Freezes every CLI registry; `createCli` calls it last. */
|
|
24
|
+
export function freezeCliRegistries(by) {
|
|
25
|
+
freezeCommandRegistry(by);
|
|
26
|
+
freezeEnvSpecRegistry(by);
|
|
27
|
+
freezeEnvGroupRegistry(by);
|
|
28
|
+
freezeEnvGeneratorRegistry(by);
|
|
29
|
+
freezeEnvAnnotationRegistry(by);
|
|
30
|
+
freezeTuiScreenRegistry(by);
|
|
31
|
+
freezeDeployStepRegistry(by);
|
|
32
|
+
freezeNodeExecutorRegistry(by);
|
|
33
|
+
freezeTuiSectionRegistry(by);
|
|
34
|
+
freezeProxyStreamRegistry(by);
|
|
35
|
+
freezeDeployCheckRegistry(by);
|
|
36
|
+
freezeEdgeConfigRegistry(by);
|
|
37
|
+
}
|
|
38
|
+
/** Empties and unfreezes every CLI registry. Tests only. */
|
|
39
|
+
export function resetCliRegistriesForTests() {
|
|
40
|
+
resetPlatformRegistrationsForTests();
|
|
41
|
+
resetTuiScreenRegistryForTests();
|
|
42
|
+
resetTuiSectionRegistryForTests();
|
|
43
|
+
resetDeployStepRegistryForTests();
|
|
44
|
+
resetNodeExecutorRegistryForTests();
|
|
45
|
+
resetCapabilityRegistriesForTests();
|
|
46
|
+
resetProxyStreamRegistryForTests();
|
|
47
|
+
resetEnvGeneratorRegistryForTests();
|
|
48
|
+
resetEnvAnnotationRegistryForTests();
|
|
49
|
+
resetDeployCheckRegistryForTests();
|
|
50
|
+
resetEdgeConfigRegistryForTests();
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=registries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registries.js","sourceRoot":"","sources":["../../src/engine/registries.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,2BAA2B,EAC3B,0BAA0B,EAC1B,sBAAsB,EACtB,qBAAqB,EACrB,kCAAkC,EAClC,iCAAiC,GAClC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,kCAAkC,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAA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AC5D,MAAM,UAAU,0BAA0B;IACxC,kCAAkC,EAAE,CAAC;IACrC,8BAA8B,EAAE,CAAC;IACjC,+BAA+B,EAAE,CAAC;IAClC,+BAA+B,EAAE,CAAC;IAClC,iCAAiC,EAAE,CAAC;IACpC,iCAAiC,EAAE,CAAC;IACpC,gCAAgC,EAAE,CAAC;IACnC,iCAAiC,EAAE,CAAC;IACpC,kCAAkC,EAAE,CAAC;IACrC,gCAAgC,EAAE,CAAC;IACnC,+BAA+B,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Where a `--data` payload came from, for error messages that name the source. */
|
|
2
|
+
export type BodySourceKind = 'inline' | 'file' | 'stdin';
|
|
3
|
+
export interface ResolvedBody {
|
|
4
|
+
/** The parsed value, ready to hand to `ApiClient`. */
|
|
5
|
+
value: unknown;
|
|
6
|
+
kind: BodySourceKind;
|
|
7
|
+
/** Human-readable origin: `--data`, a path, or `stdin`. */
|
|
8
|
+
description: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Injection seam. Tests supply their own reader instead of writing temp files
|
|
12
|
+
* or monkey-patching a global stdin, both of which leak across test files.
|
|
13
|
+
*/
|
|
14
|
+
export interface BodyResolutionContext {
|
|
15
|
+
readFile?: ((path: string) => string) | undefined;
|
|
16
|
+
readStdin?: (() => Promise<string>) | undefined;
|
|
17
|
+
/** `process.stdin.isTTY`. See the guard in `readStdinText`. */
|
|
18
|
+
stdinIsTTY?: boolean | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Turn whatever the user passed to `--data` into a parsed JSON value.
|
|
22
|
+
*
|
|
23
|
+
* Returns `undefined` when `--data` was not given at all, which is NOT the
|
|
24
|
+
* same as `--data null`: the first sends no body and no Content-Type, the
|
|
25
|
+
* second sends the four bytes `null`. `ApiClient.send` draws exactly that
|
|
26
|
+
* distinction (`body !== undefined`), so preserving it here matters — a POST
|
|
27
|
+
* to a body-less endpoint such as `/api/auth/logout` must not start declaring
|
|
28
|
+
* a JSON content type it has no body for, which Fastify answers with a 400.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveRequestBody(raw: string | undefined, ctx?: BodyResolutionContext): Promise<ResolvedBody | undefined>;
|
|
31
|
+
//# sourceMappingURL=request-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-body.d.ts","sourceRoot":"","sources":["../../src/engine/request-body.ts"],"names":[],"mappings":"AAyCA,mFAAmF;AACnF,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;AAEzD,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,cAAc,CAAC;IACrB,2DAA2D;IAC3D,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAC;IAClD,SAAS,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,CAAC;IAChD,+DAA+D;IAC/D,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAClC;AA6BD;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,GAAG,CAAC,EAAE,qBAAqB,GAC1B,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAoBnC"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { UsageError } from './errors.js';
|
|
3
|
+
/**
|
|
4
|
+
* The sentinel meaning "read stdin".
|
|
5
|
+
*
|
|
6
|
+
* UNAMBIGUOUS BY CONSTRUCTION, which is why no escape hatch is needed: `-` is
|
|
7
|
+
* not valid JSON on its own (a bare minus sign is an incomplete number), so no
|
|
8
|
+
* legitimate inline payload can ever be exactly this string. The same argument
|
|
9
|
+
* covers `@` below — see `DATA_FILE_PREFIX`.
|
|
10
|
+
*/
|
|
11
|
+
const STDIN_SENTINEL = '-';
|
|
12
|
+
/**
|
|
13
|
+
* The prefix meaning "read this file".
|
|
14
|
+
*
|
|
15
|
+
* A valid JSON document can only begin with `{`, `[`, `"`, a digit, `-`, or
|
|
16
|
+
* one of `true`/`false`/`null`. NEVER with `@`. So treating a leading `@` as a
|
|
17
|
+
* filename cannot shadow a real payload, and this CLI needs no `--data-raw`
|
|
18
|
+
* counterpart to escape it — curl grew one only because its `--data` also
|
|
19
|
+
* accepts non-JSON form bodies, where `@` is a plausible first character.
|
|
20
|
+
*
|
|
21
|
+
* THE COLLISION THAT DOES EXIST, stated plainly because it is unfixable rather
|
|
22
|
+
* than overlooked: a file whose name literally starts with `@` cannot be named
|
|
23
|
+
* here, since the first `@` is always consumed as the marker. `--data @@x.json`
|
|
24
|
+
* reads a file called `@x.json`, and that is the whole workaround. Use `./@x`
|
|
25
|
+
* — a relative path — if that ever matters.
|
|
26
|
+
*/
|
|
27
|
+
const DATA_FILE_PREFIX = '@';
|
|
28
|
+
/**
|
|
29
|
+
* Turn whatever the user passed to `--data` into a parsed JSON value.
|
|
30
|
+
*
|
|
31
|
+
* Returns `undefined` when `--data` was not given at all, which is NOT the
|
|
32
|
+
* same as `--data null`: the first sends no body and no Content-Type, the
|
|
33
|
+
* second sends the four bytes `null`. `ApiClient.send` draws exactly that
|
|
34
|
+
* distinction (`body !== undefined`), so preserving it here matters — a POST
|
|
35
|
+
* to a body-less endpoint such as `/api/auth/logout` must not start declaring
|
|
36
|
+
* a JSON content type it has no body for, which Fastify answers with a 400.
|
|
37
|
+
*/
|
|
38
|
+
export async function resolveRequestBody(raw, ctx) {
|
|
39
|
+
if (raw === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
if (raw === STDIN_SENTINEL || raw === `${DATA_FILE_PREFIX}${STDIN_SENTINEL}`) {
|
|
42
|
+
const text = await readStdinText(ctx);
|
|
43
|
+
return { value: parseJson(text, 'stdin', 'stdin'), kind: 'stdin', description: 'stdin' };
|
|
44
|
+
}
|
|
45
|
+
if (raw.startsWith(DATA_FILE_PREFIX)) {
|
|
46
|
+
const path = raw.slice(DATA_FILE_PREFIX.length);
|
|
47
|
+
if (path.length === 0) {
|
|
48
|
+
throw new UsageError('--data @ needs a filename, for example --data @body.json (or --data - to read stdin).');
|
|
49
|
+
}
|
|
50
|
+
const text = readFileText(path, ctx);
|
|
51
|
+
return { value: parseJson(text, 'file', path), kind: 'file', description: path };
|
|
52
|
+
}
|
|
53
|
+
return { value: parseJson(raw, 'inline', '--data'), kind: 'inline', description: '--data' };
|
|
54
|
+
}
|
|
55
|
+
// -----------------------------------------------------------------------------
|
|
56
|
+
// Sources
|
|
57
|
+
// -----------------------------------------------------------------------------
|
|
58
|
+
function readFileText(path, ctx) {
|
|
59
|
+
const read = ctx?.readFile ?? ((p) => readFileSync(p, 'utf8'));
|
|
60
|
+
try {
|
|
61
|
+
return read(path);
|
|
62
|
+
}
|
|
63
|
+
catch (cause) {
|
|
64
|
+
const code = cause?.code;
|
|
65
|
+
// Each of these has a different fix, so each gets its own sentence rather
|
|
66
|
+
// than a generic "could not read". ENOENT in particular is nearly always a
|
|
67
|
+
// relative-path or a typo problem, and saying so beats echoing an errno.
|
|
68
|
+
if (code === 'ENOENT') {
|
|
69
|
+
throw new UsageError(`--data file not found: ${path}`, { cause });
|
|
70
|
+
}
|
|
71
|
+
if (code === 'EISDIR') {
|
|
72
|
+
throw new UsageError(`--data ${path} is a directory, not a file.`, { cause });
|
|
73
|
+
}
|
|
74
|
+
if (code === 'EACCES') {
|
|
75
|
+
throw new UsageError(`--data file is not readable: ${path}`, { cause });
|
|
76
|
+
}
|
|
77
|
+
throw new UsageError(`Could not read --data file ${path}: ${cause.message}`, {
|
|
78
|
+
cause,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Read stdin to the end.
|
|
84
|
+
*
|
|
85
|
+
* THE TTY GUARD IS THE POINT OF THIS FUNCTION. Without it,
|
|
86
|
+
* `appctl api POST /api/allowlist --data -` typed at an interactive prompt simply HANGS — the
|
|
87
|
+
* terminal is a valid stdin that will never reach EOF until the user happens
|
|
88
|
+
* to know to press Ctrl-D. To anyone who mistyped the flag that is an
|
|
89
|
+
* unresponsive CLI, and the usual reaction is Ctrl-C and a bug report. Failing
|
|
90
|
+
* immediately with the actual remedy costs one branch.
|
|
91
|
+
*
|
|
92
|
+
* Read by async iteration rather than `readFileSync(0)`: reading fd 0
|
|
93
|
+
* synchronously throws EAGAIN on a non-blocking pipe on some platforms — a
|
|
94
|
+
* failure that depends on how the caller's shell set the descriptor up and so
|
|
95
|
+
* reproduces on one machine in ten.
|
|
96
|
+
*
|
|
97
|
+
* NO SIZE LIMIT, deliberately. The reason this path exists is bodies too big
|
|
98
|
+
* or too sensitive for a command line, and capping it would defeat that. The
|
|
99
|
+
* ceiling is available memory, and the JSON has to be parsed into memory
|
|
100
|
+
* regardless.
|
|
101
|
+
*/
|
|
102
|
+
async function readStdinText(ctx) {
|
|
103
|
+
if (ctx?.readStdin !== undefined)
|
|
104
|
+
return ctx.readStdin();
|
|
105
|
+
const isTTY = ctx?.stdinIsTTY ?? process.stdin.isTTY === true;
|
|
106
|
+
if (isTTY) {
|
|
107
|
+
throw new UsageError('--data - reads the request body from stdin, but stdin is a terminal. ' +
|
|
108
|
+
'Pipe the body in (`cat body.json | appctl api ...`) or use --data @body.json.');
|
|
109
|
+
}
|
|
110
|
+
const chunks = [];
|
|
111
|
+
for await (const chunk of process.stdin) {
|
|
112
|
+
chunks.push(typeof chunk === 'string' ? Buffer.from(chunk, 'utf8') : chunk);
|
|
113
|
+
}
|
|
114
|
+
// Concatenated as BYTES and decoded once at the end, not decoded per chunk:
|
|
115
|
+
// a multi-byte UTF-8 character can be split across a chunk boundary, and
|
|
116
|
+
// decoding the halves independently yields two replacement characters — a
|
|
117
|
+
// corruption that only appears for non-ASCII payloads over a certain size,
|
|
118
|
+
// which is about the least reproducible bug available.
|
|
119
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
120
|
+
}
|
|
121
|
+
// -----------------------------------------------------------------------------
|
|
122
|
+
// Parsing
|
|
123
|
+
// -----------------------------------------------------------------------------
|
|
124
|
+
/**
|
|
125
|
+
* Parse, and turn a failure into a message that names both the source and the
|
|
126
|
+
* likely cause.
|
|
127
|
+
*
|
|
128
|
+
* The shell-quoting hint is attached ONLY to the inline form, because that is
|
|
129
|
+
* the only form where it is the probable explanation — and it is a very
|
|
130
|
+
* probable one. `--data "{"email":"a@b.com"}"` in bash produces the argument
|
|
131
|
+
* `{email:a@b.com}`: the double quotes are consumed by the shell, and the CLI
|
|
132
|
+
* is handed something that is not JSON and never was. Printing "unexpected
|
|
133
|
+
* token e" without that hint sends people to check the API's schema.
|
|
134
|
+
*/
|
|
135
|
+
function parseJson(text, kind, source) {
|
|
136
|
+
const trimmed = text.trim();
|
|
137
|
+
if (trimmed.length === 0) {
|
|
138
|
+
// An empty file or an empty pipe is nearly always an upstream command that
|
|
139
|
+
// produced nothing (a failed generator, a wrong path in a pipeline), and
|
|
140
|
+
// sending an empty body would surface it as a confusing 400 from the API
|
|
141
|
+
// instead of as the local mistake it is.
|
|
142
|
+
const what = kind === 'stdin' ? 'stdin was empty' : kind === 'file' ? `${source} is empty` : '--data was empty';
|
|
143
|
+
throw new UsageError(`${what}. A request body must be a JSON document.`);
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
return JSON.parse(trimmed);
|
|
147
|
+
}
|
|
148
|
+
catch (cause) {
|
|
149
|
+
const detail = cause.message;
|
|
150
|
+
const hint = kind === 'inline'
|
|
151
|
+
? " If your shell ate the quotes, wrap the whole value in single quotes: --data '{\"key\":\"value\"}' — or use --data @file.json."
|
|
152
|
+
: '';
|
|
153
|
+
throw new UsageError(`${source} is not valid JSON: ${detail}.${hint}`, { cause });
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=request-body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-body.js","sourceRoot":"","sources":["../../src/engine/request-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA6DzC;;;;;;;GAOG;AACH,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;;;;;;;;;;;;GAcG;AACH,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAAuB,EACvB,GAA2B;IAE3B,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAExC,IAAI,GAAG,KAAK,cAAc,IAAI,GAAG,KAAK,GAAG,gBAAgB,GAAG,cAAc,EAAE,EAAE,CAAC;QAC7E,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,CAAC;QACtC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;IAC3F,CAAC;IAED,IAAI,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAChD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,UAAU,CAClB,uFAAuF,CACxF,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACrC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,M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C,CAAC,kBAAkB,CAAC;QACrG,MAAM,IAAI,UAAU,CAAC,GAAG,IAAI,2CAA2C,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,GAAI,KAAe,CAAC,OAAO,CAAC;QACxC,MAAM,IAAI,GACR,IAAI,KAAK,QAAQ;YACf,CAAC,CAAC,gIAAgI;YAClI,CAAC,CAAC,EAAE,CAAC;QACT,MAAM,IAAI,UAAU,CAAC,GAAG,MAAM,uBAAuB,MAAM,IAAI,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACpF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { DeployStepContext } from './deploy/steps/registry.js';
|
|
2
|
+
import { type CliIdentity } from './identity.js';
|
|
3
|
+
/**
|
|
4
|
+
* An identity for tests: the reference app's executable name `appctl`, with a neutral product name.
|
|
5
|
+
*
|
|
6
|
+
* @stability experimental
|
|
7
|
+
*/
|
|
8
|
+
export declare const TEST_CLI_IDENTITY: Readonly<CliIdentity>;
|
|
9
|
+
/**
|
|
10
|
+
* Replaces the process's CLI identity for a test, bypassing set-once.
|
|
11
|
+
*
|
|
12
|
+
* @param identity - The identity to use, or `undefined` for "none set".
|
|
13
|
+
* @param version - The app version `cliVersion()` reports. Defaults to the
|
|
14
|
+
* current one, else `0.0.0-test`.
|
|
15
|
+
* @returns A function that restores the previous identity.
|
|
16
|
+
* @stability experimental
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const restore = useTestCliIdentity({ name: 'acmectl', displayName: 'Acme CLI', repoSlug: 'acme/acme' });
|
|
20
|
+
* afterEach(restore);
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function useTestCliIdentity(identity: CliIdentity | undefined, version?: string): () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Forgets everything `createCli` set up: the identity and every registry
|
|
26
|
+
* (commands, env-spec fragments, TUI screens, deploy steps, node executors),
|
|
27
|
+
* so the next `createCli` starts from a fresh process's state.
|
|
28
|
+
*
|
|
29
|
+
* @stability experimental
|
|
30
|
+
*/
|
|
31
|
+
export declare function resetCliForTests(): void;
|
|
32
|
+
/**
|
|
33
|
+
* A {@link DeployStepContext} for testing an app deploy step without a
|
|
34
|
+
* pipeline: a deployment under `/opt/infra/apps/app`, no commit, commands that
|
|
35
|
+
* succeed with no output, `log`/`progress` that record nothing, and `env` /
|
|
36
|
+
* `answers` built from the given variables with the secret rules of the real
|
|
37
|
+
* context (a secret key is present but never readable).
|
|
38
|
+
*
|
|
39
|
+
* @param overrides - Fields to replace.
|
|
40
|
+
* @param values - Variables for `env` (and `answers`, unless it is overridden).
|
|
41
|
+
* @returns A complete context.
|
|
42
|
+
* @stability experimental
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const context = testDeployStepContext({ commitSha: 'abc123' }, { COACH_URL: 'https://coach.example' });
|
|
46
|
+
* await step.run(context);
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function testDeployStepContext(overrides?: Partial<DeployStepContext>, values?: Readonly<Record<string, string>>): DeployStepContext;
|
|
50
|
+
//# sourceMappingURL=test-support.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../../src/engine/test-support.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EAA8B,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAc7E;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,WAAW,CAKlD,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,IAAI,CAElG;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CACnC,SAAS,GAAE,OAAO,CAAC,iBAAiB,CAAM,EAC1C,MAAM,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAM,GAC5C,iBAAiB,CAenB"}
|