@marinoscar/platform-cli 0.1.0-next.3 → 0.1.0-next.5
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 +88 -0
- package/README.md +126 -31
- 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 +10 -0
- package/dist/core/command-registry.d.ts.map +1 -1
- package/dist/core/command-registry.js +17 -0
- package/dist/core/command-registry.js.map +1 -1
- 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 +16 -2
- package/dist/core/env-spec-registry.d.ts.map +1 -1
- package/dist/core/env-spec-registry.js +15 -0
- package/dist/core/env-spec-registry.js.map +1 -1
- package/dist/core/env-values.d.ts +3 -2
- package/dist/core/env-values.d.ts.map +1 -1
- package/dist/core/env-values.js +5 -3
- package/dist/core/env-values.js.map +1 -1
- package/dist/core/index.d.ts +10 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -2
- package/dist/core/index.js.map +1 -1
- 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 +1159 -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/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 +146 -0
- package/dist/engine/deploy/health.d.ts.map +1 -0
- package/dist/engine/deploy/health.js +323 -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 +1304 -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 +101 -0
- package/dist/engine/deploy/repo.d.ts.map +1 -0
- package/dist/engine/deploy/repo.js +250 -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 +262 -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 +320 -0
- package/dist/engine/deploy/uninstall.js.map +1 -0
- package/dist/engine/deploy/update.d.ts +111 -0
- package/dist/engine/deploy/update.d.ts.map +1 -0
- package/dist/engine/deploy/update.js +1228 -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 +4 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- 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/index.d.ts +2 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/node-span-relay.d.ts +1 -1
- package/dist/telemetry/node-span-relay.d.ts.map +1 -1
- package/dist/telemetry/node-span-relay.js +39 -6
- package/dist/telemetry/node-span-relay.js.map +1 -1
- package/dist/telemetry/node-span.d.ts +39 -7
- package/dist/telemetry/node-span.d.ts.map +1 -1
- package/dist/telemetry/node-span.js +19 -1
- package/dist/telemetry/node-span.js.map +1 -1
- 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 +43 -5
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape persisted to `~/.appctl/config.json`.
|
|
3
|
+
*
|
|
4
|
+
* EVERY FIELD IS OPTIONAL AT READ TIME, deliberately. This file is on a user's
|
|
5
|
+
* disk: it survives CLI upgrades, gets hand-edited, gets partially restored
|
|
6
|
+
* from a backup, and gets written by a version that knew different fields. A
|
|
7
|
+
* reader that demands a complete record turns any of that into a hard failure
|
|
8
|
+
* for commands that did not need the missing piece. Completeness is asserted
|
|
9
|
+
* where it is actually required — `requireCredentials()` — and nowhere else.
|
|
10
|
+
*/
|
|
11
|
+
export interface StoredConfig {
|
|
12
|
+
/** What the user typed, e.g. `https://app.example.com`. NOT the `/api` root. */
|
|
13
|
+
serverUrl?: string;
|
|
14
|
+
/** The bearer credential. A `pat_...` token from the device flow (#141). */
|
|
15
|
+
token?: string;
|
|
16
|
+
/** Absolute ISO-8601 expiry of `token`, when the server told us one. */
|
|
17
|
+
expiresAt?: string;
|
|
18
|
+
/** PAT row id, so the user can find it in the web Access Tokens page. */
|
|
19
|
+
tokenId?: string;
|
|
20
|
+
/** PAT display name, same purpose. */
|
|
21
|
+
tokenName?: string;
|
|
22
|
+
/** When this file was last written, for `config` output. */
|
|
23
|
+
updatedAt?: string;
|
|
24
|
+
/**
|
|
25
|
+
* The `worker_nodes` row this machine registered (#272, epic #254).
|
|
26
|
+
*
|
|
27
|
+
* Stored so a restart RE-ATTACHES to its existing node rather than leaking a
|
|
28
|
+
* new row on every start — which is what a container without it would do,
|
|
29
|
+
* once per crash-loop iteration.
|
|
30
|
+
*/
|
|
31
|
+
nodeId?: string;
|
|
32
|
+
/** Worker-node settings. Absent on every machine that never ran `node register`. */
|
|
33
|
+
node?: StoredNodeConfig;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The persisted half of a worker node's settings (#272).
|
|
37
|
+
*
|
|
38
|
+
* Every field optional for the same reason every field of `StoredConfig` is:
|
|
39
|
+
* this file is on a user's disk and gets hand-edited, partially restored and
|
|
40
|
+
* written by other versions. Defaults are applied in `node-config.ts`, once,
|
|
41
|
+
* where the environment overlay is also applied.
|
|
42
|
+
*/
|
|
43
|
+
export interface StoredNodeConfig {
|
|
44
|
+
name?: string;
|
|
45
|
+
concurrency?: number;
|
|
46
|
+
eligibleTypes?: string[];
|
|
47
|
+
pollIntervalMs?: number;
|
|
48
|
+
}
|
|
49
|
+
/** Where a resolved field came from. Shown by `config`; used by diagnostics. */
|
|
50
|
+
export type ConfigSource = 'env' | 'file';
|
|
51
|
+
/** The merged view of environment and file, with nothing required. */
|
|
52
|
+
export interface ResolvedConfig {
|
|
53
|
+
serverUrl: string | undefined;
|
|
54
|
+
token: string | undefined;
|
|
55
|
+
expiresAt: string | undefined;
|
|
56
|
+
tokenId: string | undefined;
|
|
57
|
+
tokenName: string | undefined;
|
|
58
|
+
updatedAt: string | undefined;
|
|
59
|
+
/** Which layer supplied each credential field, when one did. */
|
|
60
|
+
serverUrlSource: ConfigSource | undefined;
|
|
61
|
+
tokenSource: ConfigSource | undefined;
|
|
62
|
+
/** Absolute path of the config file, whether or not it exists. */
|
|
63
|
+
path: string;
|
|
64
|
+
/** True when a readable config file was found. */
|
|
65
|
+
fileExists: boolean;
|
|
66
|
+
}
|
|
67
|
+
/** A complete credential. Only `requireCredentials()` can produce one. */
|
|
68
|
+
export interface Credentials {
|
|
69
|
+
serverUrl: string;
|
|
70
|
+
token: string;
|
|
71
|
+
expiresAt: string | undefined;
|
|
72
|
+
serverUrlSource: ConfigSource;
|
|
73
|
+
tokenSource: ConfigSource;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Injection seam for tests and for a caller that must not read the real
|
|
77
|
+
* environment. Everything in this module takes it as an optional last
|
|
78
|
+
* argument and defaults to the real process — so production code never has to
|
|
79
|
+
* thread it through, and a test never has to mutate `process.env` or
|
|
80
|
+
* `os.homedir` globally (which leaks across test files and produces failures
|
|
81
|
+
* that depend on execution order).
|
|
82
|
+
*/
|
|
83
|
+
export interface ConfigContext {
|
|
84
|
+
env?: NodeJS.ProcessEnv;
|
|
85
|
+
home?: string;
|
|
86
|
+
}
|
|
87
|
+
/** `APPCTL_SERVER_URL` — resolved once so help text and lookups cannot drift. */
|
|
88
|
+
export declare function serverUrlEnvVar(): string;
|
|
89
|
+
/** `APPCTL_TOKEN`. */
|
|
90
|
+
export declare function tokenEnvVar(): string;
|
|
91
|
+
/** The config directory, `~/.appctl`. */
|
|
92
|
+
export declare function configDirPath(ctx?: ConfigContext): string;
|
|
93
|
+
/** The config file, `~/.appctl/config.json`. */
|
|
94
|
+
export declare function configFilePath(ctx?: ConfigContext): string;
|
|
95
|
+
/**
|
|
96
|
+
* Read and validate the config file.
|
|
97
|
+
*
|
|
98
|
+
* Returns `undefined` when there is no file — an expected state, not an
|
|
99
|
+
* error, and the reason ENOENT is the one errno swallowed here. Everything
|
|
100
|
+
* else (EACCES on a file someone chowned, EISDIR on a path someone made a
|
|
101
|
+
* directory) becomes a ConfigError naming the path, because those are real
|
|
102
|
+
* problems that a silent `undefined` would convert into a misleading "not
|
|
103
|
+
* logged in".
|
|
104
|
+
*/
|
|
105
|
+
export declare function readConfigFile(ctx?: ConfigContext): StoredConfig | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* Persist the config, replacing whatever was there.
|
|
108
|
+
*
|
|
109
|
+
* ---------------------------------------------------------------------------
|
|
110
|
+
* HOW `0600` IS ACTUALLY GUARANTEED — the part with a trap in it
|
|
111
|
+
* ---------------------------------------------------------------------------
|
|
112
|
+
* The obvious implementation is `writeFileSync(path, json, { mode: 0o600 })`,
|
|
113
|
+
* and it is WRONG in a way that never shows up in a passing test.
|
|
114
|
+
*
|
|
115
|
+
* `mode` is the mode passed to `open(2)`, and `open(2)` APPLIES IT ONLY WHEN
|
|
116
|
+
* IT CREATES THE FILE. Writing over an existing `config.json` ignores `mode`
|
|
117
|
+
* entirely and leaves whatever permissions the file already had. So the first
|
|
118
|
+
* login on a clean machine produces a correct `0600` file and every test
|
|
119
|
+
* asserting the mode passes — while a user whose config was ever created by
|
|
120
|
+
* something else (an older build without the mode, a `cp` from a dotfiles
|
|
121
|
+
* repo, an editor that rewrote it, a restore from an archive that dropped
|
|
122
|
+
* modes) keeps a world-readable token forever, and re-running `login` does not
|
|
123
|
+
* fix it because that is exactly the path that ignores the mode.
|
|
124
|
+
*
|
|
125
|
+
* The other obvious implementation — write, then `chmod` — closes that gap but
|
|
126
|
+
* opens a window: between the write and the chmod the token is on disk under
|
|
127
|
+
* the process umask, typically `0644`. On a shared machine that window is all
|
|
128
|
+
* an attacker needs, and it is reopened on every single login. #143 asks for
|
|
129
|
+
* the mode AT CREATION for precisely this reason.
|
|
130
|
+
*
|
|
131
|
+
* So: create a BRAND NEW file with `flag: 'wx'` (O_CREAT|O_EXCL — the open
|
|
132
|
+
* fails rather than reusing anything, which makes `mode` unconditionally
|
|
133
|
+
* apply), then `rename(2)` it over the target. Rename moves the inode, so the
|
|
134
|
+
* destination ends up with the new file's `0600` no matter what the old one
|
|
135
|
+
* had, and it is atomic within a filesystem — a crash or a full disk mid-write
|
|
136
|
+
* leaves the previous config intact instead of a truncated file that reads as
|
|
137
|
+
* corrupt. The temp file is created in the SAME DIRECTORY because `rename`
|
|
138
|
+
* across filesystems fails with EXDEV, and `~` can easily be a different mount
|
|
139
|
+
* from the system temp directory.
|
|
140
|
+
*
|
|
141
|
+
* ON UMASK: `mode` is masked by the process umask, and a umask can only CLEAR
|
|
142
|
+
* permission bits, never set them. So `0o600 & ~umask` is at most `0o600` for
|
|
143
|
+
* every possible umask — the file can end up more restrictive (a `0o077`
|
|
144
|
+
* umask yields `0o600`, a `0o277` umask yields `0o400`) but never more
|
|
145
|
+
* permissive. That one-directional property is what makes "no window where it
|
|
146
|
+
* is world-readable" a guarantee rather than a hope.
|
|
147
|
+
* ---------------------------------------------------------------------------
|
|
148
|
+
*/
|
|
149
|
+
export declare function writeConfigFile(config: StoredConfig, ctx?: ConfigContext): string;
|
|
150
|
+
/**
|
|
151
|
+
* Convenience for the one write both login paths perform (#142): store the
|
|
152
|
+
* server URL and the credential together.
|
|
153
|
+
*
|
|
154
|
+
* Both paths go through here rather than each assembling a StoredConfig, so
|
|
155
|
+
* there is one place that decides what a successful login persists.
|
|
156
|
+
*/
|
|
157
|
+
export declare function saveCredentials(input: {
|
|
158
|
+
serverUrl: string;
|
|
159
|
+
token: string;
|
|
160
|
+
expiresAt?: string | undefined;
|
|
161
|
+
tokenId?: string | undefined;
|
|
162
|
+
tokenName?: string | undefined;
|
|
163
|
+
}, ctx?: ConfigContext): string;
|
|
164
|
+
/** Remove the config file. No-op when there is none. For a future `logout`. */
|
|
165
|
+
export declare function deleteConfigFile(ctx?: ConfigContext): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Merge environment over file. Never throws for "nothing configured".
|
|
168
|
+
*
|
|
169
|
+
* The merge is PER FIELD rather than all-or-nothing: `APPCTL_TOKEN` alone is a
|
|
170
|
+
* legitimate way to run one command as a different principal against the
|
|
171
|
+
* server already in the config file, and `APPCTL_SERVER_URL` alone is how you
|
|
172
|
+
* point an existing login at a different host. Requiring both to be set to use
|
|
173
|
+
* either would break both of those for no gain — and the case where a partial
|
|
174
|
+
* environment is genuinely a mistake is caught with a specific message in
|
|
175
|
+
* `requireCredentials()`, where the missing half is actually known.
|
|
176
|
+
*/
|
|
177
|
+
export declare function resolveConfig(ctx?: ConfigContext): ResolvedConfig;
|
|
178
|
+
/**
|
|
179
|
+
* The accessor every authenticated command uses (#144 onwards).
|
|
180
|
+
*
|
|
181
|
+
* THE WHOLE POINT IS THE FAILURE MESSAGE. Without this, a command reads an
|
|
182
|
+
* undefined token, sends `Authorization: Bearer undefined`, and reports the
|
|
183
|
+
* server's 401 — telling a user who has never logged in that their
|
|
184
|
+
* credentials were rejected. They were not rejected; they were never sent.
|
|
185
|
+
* That message sends people to revoke and re-issue tokens that were never the
|
|
186
|
+
* problem, and it is exactly the outcome #143 calls out.
|
|
187
|
+
*
|
|
188
|
+
* The three "nothing usable" cases get three different sentences, because
|
|
189
|
+
* they have three different fixes:
|
|
190
|
+
* - a half-set environment: name the variable that is missing (a CI
|
|
191
|
+
* misconfiguration, where "run login" is useless advice — there is no
|
|
192
|
+
* browser on the runner)
|
|
193
|
+
* - no server URL: say so
|
|
194
|
+
* - no token: run `login`
|
|
195
|
+
*/
|
|
196
|
+
export declare function requireCredentials(ctx?: ConfigContext): Credentials;
|
|
197
|
+
/**
|
|
198
|
+
* Turn a token into something safe to print.
|
|
199
|
+
*
|
|
200
|
+
* THIS FUNCTION CAN NEVER RETURN THE TOKEN. Every branch either returns a
|
|
201
|
+
* constant mask or a slice bounded by PAT_PREFIX_HINT_LENGTH, which is checked
|
|
202
|
+
* against MIN_LENGTH_TO_REVEAL first — so there is no input, including an
|
|
203
|
+
* empty string or a hand-crafted short value, for which the output equals the
|
|
204
|
+
* input. That property is the whole contract; anything added here must
|
|
205
|
+
* preserve it.
|
|
206
|
+
*/
|
|
207
|
+
export declare function maskToken(token: string | undefined): string;
|
|
208
|
+
/** A display-safe summary. Structurally incapable of carrying the token. */
|
|
209
|
+
export interface ConfigSummary {
|
|
210
|
+
serverUrl: string | undefined;
|
|
211
|
+
serverUrlSource: ConfigSource | undefined;
|
|
212
|
+
/** Masked. See `maskToken` — this field never holds a usable credential. */
|
|
213
|
+
tokenHint: string;
|
|
214
|
+
tokenSource: ConfigSource | undefined;
|
|
215
|
+
tokenName: string | undefined;
|
|
216
|
+
tokenId: string | undefined;
|
|
217
|
+
expiresAt: string | undefined;
|
|
218
|
+
/** True when `expiresAt` is in the past. `undefined` when there is no expiry. */
|
|
219
|
+
expired: boolean | undefined;
|
|
220
|
+
updatedAt: string | undefined;
|
|
221
|
+
path: string;
|
|
222
|
+
fileExists: boolean;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Build the summary a `config` command prints.
|
|
226
|
+
*
|
|
227
|
+
* The return type is the enforcement mechanism, not a convention: there is no
|
|
228
|
+
* field on ConfigSummary that a token could be assigned to without a type
|
|
229
|
+
* error, so a future edit cannot casually add one to the output. A function
|
|
230
|
+
* returning `Record<string, unknown>` would have made "never print the token"
|
|
231
|
+
* a rule somebody has to remember.
|
|
232
|
+
*/
|
|
233
|
+
export declare function describeConfig(ctx?: ConfigContext, now?: Date): ConfigSummary;
|
|
234
|
+
/**
|
|
235
|
+
* Has the stored token expired?
|
|
236
|
+
*
|
|
237
|
+
* `undefined` means UNKNOWN, and is returned both when no expiry was recorded
|
|
238
|
+
* and when the recorded one is unparseable. It deliberately does not collapse
|
|
239
|
+
* to `false`: a caller that wants to warn should not warn on a value it could
|
|
240
|
+
* not read, and a caller that wants to block must not treat "I cannot tell"
|
|
241
|
+
* as "it is fine". The server remains the authority either way — this is a
|
|
242
|
+
* courtesy check so the CLI can say "your token expired, run login" instead of
|
|
243
|
+
* relaying a bare 401.
|
|
244
|
+
*/
|
|
245
|
+
export declare function isExpired(expiresAt: string | undefined, now?: Date): boolean | undefined;
|
|
246
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/engine/config.ts"],"names":[],"mappings":"AA+CA;;;;;;;;;GASG;AACH,MAAM,WAAW,YAAY;IAC3B,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,gFAAgF;AAChF,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,MAAM,CAAC;AAE1C,sEAAsE;AACtE,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,gEAAgE;IAChE,eAAe,EAAE,YAAY,GAAG,SAAS,CAAC;IAC1C,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;IACtC,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,kDAAkD;IAClD,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,eAAe,EAAE,YAAY,CAAC;IAC9B,WAAW,EAAE,YAAY,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,iFAAiF;AACjF,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,sBAAsB;AACtB,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAMD,yCAAyC;AACzC,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,MAAM,CAEzD;AAED,gDAAgD;AAChD,wBAAgB,cAAc,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,MAAM,CAE1D;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,YAAY,GAAG,SAAS,CAkD5E;AAiCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,aAAa,GAAG,MAAM,CAoCjF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE;IACL,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAChC,EACD,GAAG,CAAC,EAAE,aAAa,GAClB,MAAM,CAWR;AAED,+EAA+E;AAC/E,wBAAgB,gBAAgB,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,OAAO,CAS7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,cAAc,CA0BjE;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,WAAW,CAqCnE;AAsCD;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAM3D;AAED,4EAA4E;AAC5E,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,eAAe,EAAE,YAAY,GAAG,SAAS,CAAC;IAC1C,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,YAAY,GAAG,SAAS,CAAC;IACtC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,iFAAiF;IACjF,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,GAAG,CAAC,EAAE,aAAa,EAAE,GAAG,GAAE,IAAiB,GAAG,aAAa,CAezF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,GAAE,IAAiB,GAAG,OAAO,GAAG,SAAS,CAKpG"}
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { cliName, configDirName, configFileName, envVar } from './identity.js';
|
|
6
|
+
import { AuthRequiredError, ConfigError } from './errors.js';
|
|
7
|
+
/** `APPCTL_SERVER_URL` — resolved once so help text and lookups cannot drift. */
|
|
8
|
+
export function serverUrlEnvVar() {
|
|
9
|
+
return envVar('SERVER_URL');
|
|
10
|
+
}
|
|
11
|
+
/** `APPCTL_TOKEN`. */
|
|
12
|
+
export function tokenEnvVar() {
|
|
13
|
+
return envVar('TOKEN');
|
|
14
|
+
}
|
|
15
|
+
function contextEnv(ctx) {
|
|
16
|
+
return ctx?.env ?? process.env;
|
|
17
|
+
}
|
|
18
|
+
/** The config directory, `~/.appctl`. */
|
|
19
|
+
export function configDirPath(ctx) {
|
|
20
|
+
return join(ctx?.home ?? homedir(), configDirName());
|
|
21
|
+
}
|
|
22
|
+
/** The config file, `~/.appctl/config.json`. */
|
|
23
|
+
export function configFilePath(ctx) {
|
|
24
|
+
return join(configDirPath(ctx), configFileName());
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Read and validate the config file.
|
|
28
|
+
*
|
|
29
|
+
* Returns `undefined` when there is no file — an expected state, not an
|
|
30
|
+
* error, and the reason ENOENT is the one errno swallowed here. Everything
|
|
31
|
+
* else (EACCES on a file someone chowned, EISDIR on a path someone made a
|
|
32
|
+
* directory) becomes a ConfigError naming the path, because those are real
|
|
33
|
+
* problems that a silent `undefined` would convert into a misleading "not
|
|
34
|
+
* logged in".
|
|
35
|
+
*/
|
|
36
|
+
export function readConfigFile(ctx) {
|
|
37
|
+
const path = configFilePath(ctx);
|
|
38
|
+
let raw;
|
|
39
|
+
try {
|
|
40
|
+
raw = readFileSync(path, 'utf8');
|
|
41
|
+
}
|
|
42
|
+
catch (cause) {
|
|
43
|
+
if (cause?.code === 'ENOENT')
|
|
44
|
+
return undefined;
|
|
45
|
+
throw new ConfigError(`Could not read ${path}: ${cause.message}`, { cause });
|
|
46
|
+
}
|
|
47
|
+
let parsed;
|
|
48
|
+
try {
|
|
49
|
+
parsed = JSON.parse(raw);
|
|
50
|
+
}
|
|
51
|
+
catch (cause) {
|
|
52
|
+
// Naming the remedy matters more than naming the parse position. The file
|
|
53
|
+
// is disposable — every field in it is re-obtainable by logging in again —
|
|
54
|
+
// so "delete it and re-login" is always correct and always sufficient.
|
|
55
|
+
throw new ConfigError(`${path} is not valid JSON. Delete it and run \`${cliName()} login\` again.`, { cause });
|
|
56
|
+
}
|
|
57
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
58
|
+
throw new ConfigError(`${path} does not contain a JSON object. Delete it and run \`${cliName()} login\` again.`);
|
|
59
|
+
}
|
|
60
|
+
const body = parsed;
|
|
61
|
+
// Every field is read through `readString`, which drops anything that is not
|
|
62
|
+
// a non-empty string. A `token: null` left behind by a hand-edit therefore
|
|
63
|
+
// reads as "no token" and produces the run-login message, rather than being
|
|
64
|
+
// sent to the server as the literal text `null` and coming back as a 401
|
|
65
|
+
// that blames the user's credentials.
|
|
66
|
+
return {
|
|
67
|
+
...optionalField('serverUrl', readString(body.serverUrl)),
|
|
68
|
+
...optionalField('token', readString(body.token)),
|
|
69
|
+
...optionalField('expiresAt', readString(body.expiresAt)),
|
|
70
|
+
...optionalField('tokenId', readString(body.tokenId)),
|
|
71
|
+
...optionalField('tokenName', readString(body.tokenName)),
|
|
72
|
+
...optionalField('updatedAt', readString(body.updatedAt)),
|
|
73
|
+
...optionalField('nodeId', readString(body.nodeId)),
|
|
74
|
+
...optionalField('node', readStoredNodeConfig(body.node)),
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Read the `node` block, dropping anything of the wrong type.
|
|
79
|
+
*
|
|
80
|
+
* Same contract as `readString`: a hand-edited `concurrency: "4"` reads as
|
|
81
|
+
* absent and the default applies, rather than propagating a string into
|
|
82
|
+
* arithmetic and producing a claim limit of `NaN` — which the server would
|
|
83
|
+
* reject with a validation error naming a field the user never set.
|
|
84
|
+
*/
|
|
85
|
+
function readStoredNodeConfig(value) {
|
|
86
|
+
if (value === null || typeof value !== 'object' || Array.isArray(value))
|
|
87
|
+
return undefined;
|
|
88
|
+
const body = value;
|
|
89
|
+
const types = Array.isArray(body.eligibleTypes)
|
|
90
|
+
? body.eligibleTypes.filter((entry) => typeof entry === 'string' && entry.trim().length > 0)
|
|
91
|
+
: undefined;
|
|
92
|
+
const block = {
|
|
93
|
+
...optionalField('name', readString(body.name)),
|
|
94
|
+
...optionalField('concurrency', readFiniteNumber(body.concurrency)),
|
|
95
|
+
...optionalField('eligibleTypes', types),
|
|
96
|
+
...optionalField('pollIntervalMs', readFiniteNumber(body.pollIntervalMs)),
|
|
97
|
+
};
|
|
98
|
+
return Object.keys(block).length > 0 ? block : undefined;
|
|
99
|
+
}
|
|
100
|
+
/** A finite number, or `undefined`. `NaN` and `Infinity` are not numbers a config may hold. */
|
|
101
|
+
function readFiniteNumber(value) {
|
|
102
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Persist the config, replacing whatever was there.
|
|
106
|
+
*
|
|
107
|
+
* ---------------------------------------------------------------------------
|
|
108
|
+
* HOW `0600` IS ACTUALLY GUARANTEED — the part with a trap in it
|
|
109
|
+
* ---------------------------------------------------------------------------
|
|
110
|
+
* The obvious implementation is `writeFileSync(path, json, { mode: 0o600 })`,
|
|
111
|
+
* and it is WRONG in a way that never shows up in a passing test.
|
|
112
|
+
*
|
|
113
|
+
* `mode` is the mode passed to `open(2)`, and `open(2)` APPLIES IT ONLY WHEN
|
|
114
|
+
* IT CREATES THE FILE. Writing over an existing `config.json` ignores `mode`
|
|
115
|
+
* entirely and leaves whatever permissions the file already had. So the first
|
|
116
|
+
* login on a clean machine produces a correct `0600` file and every test
|
|
117
|
+
* asserting the mode passes — while a user whose config was ever created by
|
|
118
|
+
* something else (an older build without the mode, a `cp` from a dotfiles
|
|
119
|
+
* repo, an editor that rewrote it, a restore from an archive that dropped
|
|
120
|
+
* modes) keeps a world-readable token forever, and re-running `login` does not
|
|
121
|
+
* fix it because that is exactly the path that ignores the mode.
|
|
122
|
+
*
|
|
123
|
+
* The other obvious implementation — write, then `chmod` — closes that gap but
|
|
124
|
+
* opens a window: between the write and the chmod the token is on disk under
|
|
125
|
+
* the process umask, typically `0644`. On a shared machine that window is all
|
|
126
|
+
* an attacker needs, and it is reopened on every single login. #143 asks for
|
|
127
|
+
* the mode AT CREATION for precisely this reason.
|
|
128
|
+
*
|
|
129
|
+
* So: create a BRAND NEW file with `flag: 'wx'` (O_CREAT|O_EXCL — the open
|
|
130
|
+
* fails rather than reusing anything, which makes `mode` unconditionally
|
|
131
|
+
* apply), then `rename(2)` it over the target. Rename moves the inode, so the
|
|
132
|
+
* destination ends up with the new file's `0600` no matter what the old one
|
|
133
|
+
* had, and it is atomic within a filesystem — a crash or a full disk mid-write
|
|
134
|
+
* leaves the previous config intact instead of a truncated file that reads as
|
|
135
|
+
* corrupt. The temp file is created in the SAME DIRECTORY because `rename`
|
|
136
|
+
* across filesystems fails with EXDEV, and `~` can easily be a different mount
|
|
137
|
+
* from the system temp directory.
|
|
138
|
+
*
|
|
139
|
+
* ON UMASK: `mode` is masked by the process umask, and a umask can only CLEAR
|
|
140
|
+
* permission bits, never set them. So `0o600 & ~umask` is at most `0o600` for
|
|
141
|
+
* every possible umask — the file can end up more restrictive (a `0o077`
|
|
142
|
+
* umask yields `0o600`, a `0o277` umask yields `0o400`) but never more
|
|
143
|
+
* permissive. That one-directional property is what makes "no window where it
|
|
144
|
+
* is world-readable" a guarantee rather than a hope.
|
|
145
|
+
* ---------------------------------------------------------------------------
|
|
146
|
+
*/
|
|
147
|
+
export function writeConfigFile(config, ctx) {
|
|
148
|
+
const dir = configDirPath(ctx);
|
|
149
|
+
const target = configFilePath(ctx);
|
|
150
|
+
// `0o700` on the directory is defence in depth, not the control: the file
|
|
151
|
+
// mode above is what protects the token. Like the file, the mode applies
|
|
152
|
+
// only on creation, and an existing directory is deliberately left alone —
|
|
153
|
+
// silently chmod-ing a directory a user created themselves is a surprise,
|
|
154
|
+
// and `~/.appctl` may legitimately hold other things by then.
|
|
155
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
156
|
+
const payload = `${JSON.stringify({ ...config, updatedAt: new Date().toISOString() }, null, 2)}\n`;
|
|
157
|
+
// Randomised so two concurrent logins cannot collide on the temp name and
|
|
158
|
+
// have one of them fail the O_EXCL open. The `.tmp` suffix keeps it clearly
|
|
159
|
+
// disposable, and the basename deliberately stays derived from
|
|
160
|
+
// CONFIG_FILE_NAME rather than being something like `credentials.tmp` — see
|
|
161
|
+
// the note on CONFIG_FILE_NAME in branding.ts about globally-ignored names.
|
|
162
|
+
const tmp = join(dir, `${configFileName()}.${process.pid}.${randomBytes(6).toString('hex')}.tmp`);
|
|
163
|
+
try {
|
|
164
|
+
writeFileSync(tmp, payload, { encoding: 'utf8', mode: 0o600, flag: 'wx' });
|
|
165
|
+
renameSync(tmp, target);
|
|
166
|
+
}
|
|
167
|
+
catch (cause) {
|
|
168
|
+
// Best-effort cleanup so a failed login does not litter `~/.appctl` with
|
|
169
|
+
// temp files that each contain a valid token. `force` because the file may
|
|
170
|
+
// never have been created (that is one of the ways we get here).
|
|
171
|
+
try {
|
|
172
|
+
rmSync(tmp, { force: true });
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
// Nothing useful to do, and the real error below is the one to report.
|
|
176
|
+
}
|
|
177
|
+
throw new ConfigError(`Could not write ${target}: ${cause.message}`, { cause });
|
|
178
|
+
}
|
|
179
|
+
return target;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Convenience for the one write both login paths perform (#142): store the
|
|
183
|
+
* server URL and the credential together.
|
|
184
|
+
*
|
|
185
|
+
* Both paths go through here rather than each assembling a StoredConfig, so
|
|
186
|
+
* there is one place that decides what a successful login persists.
|
|
187
|
+
*/
|
|
188
|
+
export function saveCredentials(input, ctx) {
|
|
189
|
+
return writeConfigFile({
|
|
190
|
+
serverUrl: input.serverUrl,
|
|
191
|
+
token: input.token,
|
|
192
|
+
...optionalField('expiresAt', input.expiresAt),
|
|
193
|
+
...optionalField('tokenId', input.tokenId),
|
|
194
|
+
...optionalField('tokenName', input.tokenName),
|
|
195
|
+
}, ctx);
|
|
196
|
+
}
|
|
197
|
+
/** Remove the config file. No-op when there is none. For a future `logout`. */
|
|
198
|
+
export function deleteConfigFile(ctx) {
|
|
199
|
+
const path = configFilePath(ctx);
|
|
200
|
+
try {
|
|
201
|
+
statSync(path);
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
rmSync(path, { force: true });
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Merge environment over file. Never throws for "nothing configured".
|
|
211
|
+
*
|
|
212
|
+
* The merge is PER FIELD rather than all-or-nothing: `APPCTL_TOKEN` alone is a
|
|
213
|
+
* legitimate way to run one command as a different principal against the
|
|
214
|
+
* server already in the config file, and `APPCTL_SERVER_URL` alone is how you
|
|
215
|
+
* point an existing login at a different host. Requiring both to be set to use
|
|
216
|
+
* either would break both of those for no gain — and the case where a partial
|
|
217
|
+
* environment is genuinely a mistake is caught with a specific message in
|
|
218
|
+
* `requireCredentials()`, where the missing half is actually known.
|
|
219
|
+
*/
|
|
220
|
+
export function resolveConfig(ctx) {
|
|
221
|
+
const env = contextEnv(ctx);
|
|
222
|
+
const file = readConfigFile(ctx);
|
|
223
|
+
const envServerUrl = readString(env[serverUrlEnvVar()]);
|
|
224
|
+
const envToken = readString(env[tokenEnvVar()]);
|
|
225
|
+
const serverUrl = envServerUrl ?? file?.serverUrl;
|
|
226
|
+
const token = envToken ?? file?.token;
|
|
227
|
+
return {
|
|
228
|
+
serverUrl,
|
|
229
|
+
token,
|
|
230
|
+
// Expiry belongs to the token, so it is only meaningful when the token
|
|
231
|
+
// came from the file. An `APPCTL_TOKEN` from CI has no expiry we know of,
|
|
232
|
+
// and pairing it with the file's leftover `expiresAt` would let the CLI
|
|
233
|
+
// announce that a perfectly valid pipeline token expired last week.
|
|
234
|
+
expiresAt: envToken === undefined ? file?.expiresAt : undefined,
|
|
235
|
+
tokenId: envToken === undefined ? file?.tokenId : undefined,
|
|
236
|
+
tokenName: envToken === undefined ? file?.tokenName : undefined,
|
|
237
|
+
updatedAt: file?.updatedAt,
|
|
238
|
+
serverUrlSource: envServerUrl !== undefined ? 'env' : file?.serverUrl !== undefined ? 'file' : undefined,
|
|
239
|
+
tokenSource: envToken !== undefined ? 'env' : file?.token !== undefined ? 'file' : undefined,
|
|
240
|
+
path: configFilePath(ctx),
|
|
241
|
+
fileExists: file !== undefined,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The accessor every authenticated command uses (#144 onwards).
|
|
246
|
+
*
|
|
247
|
+
* THE WHOLE POINT IS THE FAILURE MESSAGE. Without this, a command reads an
|
|
248
|
+
* undefined token, sends `Authorization: Bearer undefined`, and reports the
|
|
249
|
+
* server's 401 — telling a user who has never logged in that their
|
|
250
|
+
* credentials were rejected. They were not rejected; they were never sent.
|
|
251
|
+
* That message sends people to revoke and re-issue tokens that were never the
|
|
252
|
+
* problem, and it is exactly the outcome #143 calls out.
|
|
253
|
+
*
|
|
254
|
+
* The three "nothing usable" cases get three different sentences, because
|
|
255
|
+
* they have three different fixes:
|
|
256
|
+
* - a half-set environment: name the variable that is missing (a CI
|
|
257
|
+
* misconfiguration, where "run login" is useless advice — there is no
|
|
258
|
+
* browser on the runner)
|
|
259
|
+
* - no server URL: say so
|
|
260
|
+
* - no token: run `login`
|
|
261
|
+
*/
|
|
262
|
+
export function requireCredentials(ctx) {
|
|
263
|
+
const resolved = resolveConfig(ctx);
|
|
264
|
+
// Checked FIRST, before the generic messages, because "you set one of the
|
|
265
|
+
// two variables" is a much more specific diagnosis than "not logged in" and
|
|
266
|
+
// it is the single most likely way a pipeline is broken. Only reported when
|
|
267
|
+
// the file cannot cover the gap — a developer with a config file who
|
|
268
|
+
// exports one variable to override a single field is doing something
|
|
269
|
+
// supported, not something broken.
|
|
270
|
+
if (resolved.serverUrl === undefined && resolved.token !== undefined && resolved.tokenSource === 'env') {
|
|
271
|
+
throw new AuthRequiredError(`${tokenEnvVar()} is set but ${serverUrlEnvVar()} is not, and no server URL is stored in ${resolved.path}. Set both, or run \`${cliName()} login\`.`);
|
|
272
|
+
}
|
|
273
|
+
if (resolved.token === undefined && resolved.serverUrl !== undefined && resolved.serverUrlSource === 'env') {
|
|
274
|
+
throw new AuthRequiredError(`${serverUrlEnvVar()} is set but ${tokenEnvVar()} is not, and no token is stored in ${resolved.path}. Set both, or run \`${cliName()} login\`.`);
|
|
275
|
+
}
|
|
276
|
+
if (resolved.serverUrl === undefined || resolved.token === undefined) {
|
|
277
|
+
throw new AuthRequiredError(`Not logged in. Run \`${cliName()} login\` first, or set ${serverUrlEnvVar()} and ${tokenEnvVar()}.`);
|
|
278
|
+
}
|
|
279
|
+
return {
|
|
280
|
+
serverUrl: resolved.serverUrl,
|
|
281
|
+
token: resolved.token,
|
|
282
|
+
expiresAt: resolved.expiresAt,
|
|
283
|
+
// Both sources are known to be defined here: a field cannot have a value
|
|
284
|
+
// and no source. The non-null assertions state that rather than inventing
|
|
285
|
+
// a fallback that would be a lie if it ever ran.
|
|
286
|
+
serverUrlSource: resolved.serverUrlSource,
|
|
287
|
+
tokenSource: resolved.tokenSource,
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
// -----------------------------------------------------------------------------
|
|
291
|
+
// Display
|
|
292
|
+
// -----------------------------------------------------------------------------
|
|
293
|
+
/** What replaces the unreadable part of a token. Matches #115's credential store. */
|
|
294
|
+
const HINT_MASK = '••••••••';
|
|
295
|
+
/**
|
|
296
|
+
* How many leading characters of a `pat_` token are shown.
|
|
297
|
+
*
|
|
298
|
+
* EIGHT, and it is the LEADING characters — which is the opposite of #115's
|
|
299
|
+
* credential hints, on purpose. Two reasons, both specific to this token kind:
|
|
300
|
+
*
|
|
301
|
+
* 1. Those eight characters are ALREADY PUBLIC by the API's own design.
|
|
302
|
+
* `PatService` stores `tokenPrefix = 'pat_' + the first 4 hex characters`
|
|
303
|
+
* as a separate, non-secret column and `GET /api/pat` returns it. So the
|
|
304
|
+
* hint reveals nothing that the Access Tokens page does not already show
|
|
305
|
+
* the same user.
|
|
306
|
+
*
|
|
307
|
+
* 2. It is the only hint that does the job. A hint exists so a user can
|
|
308
|
+
* match what is on their machine against a row in the web UI and know
|
|
309
|
+
* which one to revoke — and the string the web UI displays is exactly
|
|
310
|
+
* this prefix. Revealing the last four characters instead would expose
|
|
311
|
+
* four genuinely secret bytes and still not match anything on screen.
|
|
312
|
+
*
|
|
313
|
+
* A token that is not a PAT (a session JWT supplied through the environment)
|
|
314
|
+
* gets NOTHING revealed: its leading characters are the base64 of a constant
|
|
315
|
+
* JOSE header, identical for every token ever issued, so revealing them would
|
|
316
|
+
* be a useless hint — and "useless" is not a reason to start revealing bytes
|
|
317
|
+
* of a credential.
|
|
318
|
+
*/
|
|
319
|
+
const PAT_PREFIX_HINT_LENGTH = 8;
|
|
320
|
+
/** Below this, reveal nothing: the prefix would be most of the value. */
|
|
321
|
+
const MIN_LENGTH_TO_REVEAL = 16;
|
|
322
|
+
/**
|
|
323
|
+
* Turn a token into something safe to print.
|
|
324
|
+
*
|
|
325
|
+
* THIS FUNCTION CAN NEVER RETURN THE TOKEN. Every branch either returns a
|
|
326
|
+
* constant mask or a slice bounded by PAT_PREFIX_HINT_LENGTH, which is checked
|
|
327
|
+
* against MIN_LENGTH_TO_REVEAL first — so there is no input, including an
|
|
328
|
+
* empty string or a hand-crafted short value, for which the output equals the
|
|
329
|
+
* input. That property is the whole contract; anything added here must
|
|
330
|
+
* preserve it.
|
|
331
|
+
*/
|
|
332
|
+
export function maskToken(token) {
|
|
333
|
+
if (token === undefined || token.length === 0)
|
|
334
|
+
return '(none)';
|
|
335
|
+
if (token.startsWith('pat_') && token.length >= MIN_LENGTH_TO_REVEAL) {
|
|
336
|
+
return `${token.slice(0, PAT_PREFIX_HINT_LENGTH)}${HINT_MASK}`;
|
|
337
|
+
}
|
|
338
|
+
return HINT_MASK;
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Build the summary a `config` command prints.
|
|
342
|
+
*
|
|
343
|
+
* The return type is the enforcement mechanism, not a convention: there is no
|
|
344
|
+
* field on ConfigSummary that a token could be assigned to without a type
|
|
345
|
+
* error, so a future edit cannot casually add one to the output. A function
|
|
346
|
+
* returning `Record<string, unknown>` would have made "never print the token"
|
|
347
|
+
* a rule somebody has to remember.
|
|
348
|
+
*/
|
|
349
|
+
export function describeConfig(ctx, now = new Date()) {
|
|
350
|
+
const resolved = resolveConfig(ctx);
|
|
351
|
+
return {
|
|
352
|
+
serverUrl: resolved.serverUrl,
|
|
353
|
+
serverUrlSource: resolved.serverUrlSource,
|
|
354
|
+
tokenHint: maskToken(resolved.token),
|
|
355
|
+
tokenSource: resolved.tokenSource,
|
|
356
|
+
tokenName: resolved.tokenName,
|
|
357
|
+
tokenId: resolved.tokenId,
|
|
358
|
+
expiresAt: resolved.expiresAt,
|
|
359
|
+
expired: isExpired(resolved.expiresAt, now),
|
|
360
|
+
updatedAt: resolved.updatedAt,
|
|
361
|
+
path: resolved.path,
|
|
362
|
+
fileExists: resolved.fileExists,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Has the stored token expired?
|
|
367
|
+
*
|
|
368
|
+
* `undefined` means UNKNOWN, and is returned both when no expiry was recorded
|
|
369
|
+
* and when the recorded one is unparseable. It deliberately does not collapse
|
|
370
|
+
* to `false`: a caller that wants to warn should not warn on a value it could
|
|
371
|
+
* not read, and a caller that wants to block must not treat "I cannot tell"
|
|
372
|
+
* as "it is fine". The server remains the authority either way — this is a
|
|
373
|
+
* courtesy check so the CLI can say "your token expired, run login" instead of
|
|
374
|
+
* relaying a bare 401.
|
|
375
|
+
*/
|
|
376
|
+
export function isExpired(expiresAt, now = new Date()) {
|
|
377
|
+
if (expiresAt === undefined)
|
|
378
|
+
return undefined;
|
|
379
|
+
const parsed = Date.parse(expiresAt);
|
|
380
|
+
if (Number.isNaN(parsed))
|
|
381
|
+
return undefined;
|
|
382
|
+
return parsed <= now.getTime();
|
|
383
|
+
}
|
|
384
|
+
// -----------------------------------------------------------------------------
|
|
385
|
+
// Helpers
|
|
386
|
+
// -----------------------------------------------------------------------------
|
|
387
|
+
/**
|
|
388
|
+
* A non-empty string, or `undefined`.
|
|
389
|
+
*
|
|
390
|
+
* Empty and whitespace-only both become `undefined` because that is what they
|
|
391
|
+
* mean in practice: `APPCTL_TOKEN=` in a CI file is an UNSET variable that the
|
|
392
|
+
* shell happens to export as empty, and treating it as a credential produces
|
|
393
|
+
* `Authorization: Bearer ` — a malformed header and a 401 whose message tells
|
|
394
|
+
* the user their token was rejected rather than that it was blank.
|
|
395
|
+
*/
|
|
396
|
+
function readString(value) {
|
|
397
|
+
if (typeof value !== 'string')
|
|
398
|
+
return undefined;
|
|
399
|
+
const trimmed = value.trim();
|
|
400
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* `{ key: value }` when defined, `{}` when not.
|
|
404
|
+
*
|
|
405
|
+
* Required by `exactOptionalPropertyTypes`, which is on for this package: it
|
|
406
|
+
* makes `{ expiresAt: undefined }` a type error where `expiresAt?: string` is
|
|
407
|
+
* declared, precisely so that "absent" and "explicitly nothing" cannot be
|
|
408
|
+
* confused. It also keeps the written JSON clean — `JSON.stringify` drops
|
|
409
|
+
* undefined values, but only after they have been allowed into the object.
|
|
410
|
+
*/
|
|
411
|
+
function optionalField(key, value) {
|
|
412
|
+
return value === undefined ? {} : { [key]: value };
|
|
413
|
+
}
|
|
414
|
+
//# sourceMappingURL=config.js.map
|