@dreamlake/dreamlake-cli 0.88.1 → 0.89.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/access.d.ts +83 -0
- package/dist/api/access.js +77 -0
- package/dist/api/agent.d.ts +156 -0
- package/dist/api/agent.js +111 -0
- package/dist/api/browser.d.ts +90 -0
- package/dist/api/browser.js +102 -0
- package/dist/api/client.d.ts +53 -0
- package/dist/api/client.js +102 -0
- package/dist/api/common.d.ts +28 -0
- package/dist/api/common.js +16 -0
- package/dist/api/content.d.ts +195 -0
- package/dist/api/content.js +147 -0
- package/dist/api/execution.d.ts +84 -0
- package/dist/api/execution.js +73 -0
- package/dist/api/http.d.ts +19 -0
- package/dist/api/http.js +66 -0
- package/dist/api/index.d.ts +2330 -0
- package/dist/api/index.js +114 -0
- package/dist/api/infra.d.ts +2 -0
- package/dist/api/infra.js +2 -0
- package/dist/api/jobs.d.ts +2 -0
- package/dist/api/jobs.js +2 -0
- package/dist/api/layout.d.ts +2 -0
- package/dist/api/layout.js +2 -0
- package/dist/api/library-edit.d.ts +3 -0
- package/dist/api/library-edit.js +3 -0
- package/dist/api/library-manifest.d.ts +2 -0
- package/dist/api/library-manifest.js +2 -0
- package/dist/api/note-character-plan.d.ts +2 -0
- package/dist/api/note-character-plan.js +2 -0
- package/dist/api/note-editing.d.ts +2 -0
- package/dist/api/note-editing.js +2 -0
- package/dist/api/note-edits.d.ts +21 -0
- package/dist/api/note-edits.js +10 -0
- package/dist/api/note-events.d.ts +5 -0
- package/dist/api/note-events.js +11 -0
- package/dist/api/note-files.d.ts +75 -0
- package/dist/api/note-files.js +65 -0
- package/dist/api/note-html-read.d.ts +2 -0
- package/dist/api/note-html-read.js +2 -0
- package/dist/api/note-html.d.ts +2 -0
- package/dist/api/note-html.js +2 -0
- package/dist/api/note-toc.d.ts +2 -0
- package/dist/api/note-toc.js +2 -0
- package/dist/api/notes.d.ts +304 -0
- package/dist/api/notes.js +181 -0
- package/dist/api/open-resources.d.ts +27 -0
- package/dist/api/open-resources.js +102 -0
- package/dist/api/ownership.d.ts +12 -0
- package/dist/api/ownership.js +24 -0
- package/dist/api/platform.d.ts +83 -0
- package/dist/api/platform.js +56 -0
- package/dist/api/presigned-transfer.d.ts +2 -0
- package/dist/api/presigned-transfer.js +2 -0
- package/dist/api/registered-runs.d.ts +48 -0
- package/dist/api/registered-runs.js +33 -0
- package/dist/api/sessions.d.ts +299 -0
- package/dist/api/sessions.js +105 -0
- package/dist/api/storage.d.ts +46 -0
- package/dist/api/storage.js +34 -0
- package/dist/api/streams.d.ts +18 -0
- package/dist/api/streams.js +70 -0
- package/dist/api/vault.d.ts +93 -0
- package/dist/api/vault.js +79 -0
- package/dist/api/workspace.d.ts +180 -0
- package/dist/api/workspace.js +146 -0
- package/dist/cli/agent-identity.d.ts +4 -0
- package/dist/cli/agent-identity.js +21 -0
- package/dist/cli/agents/identity.d.ts +50 -0
- package/dist/cli/agents/identity.js +105 -0
- package/dist/cli/agents/index.d.ts +31 -0
- package/dist/cli/agents/index.js +580 -0
- package/dist/cli/agents/manage.d.ts +43 -0
- package/dist/cli/agents/manage.js +376 -0
- package/dist/cli/agents/spec.d.ts +104 -0
- package/dist/cli/agents/spec.js +280 -0
- package/dist/cli/agents/web.d.ts +7 -0
- package/dist/cli/agents/web.js +109 -0
- package/dist/cli/artifact/incremental.d.ts +21 -0
- package/dist/cli/artifact/incremental.js +80 -0
- package/dist/cli/artifact/index.d.ts +52 -0
- package/dist/cli/artifact/index.js +405 -0
- package/dist/cli/artifact/meta.d.ts +69 -0
- package/dist/cli/artifact/meta.js +189 -0
- package/dist/cli/auth/commands.d.ts +29 -0
- package/dist/cli/auth/commands.js +327 -0
- package/dist/cli/auth/constants.d.ts +13 -0
- package/dist/cli/auth/constants.js +18 -0
- package/dist/cli/auth/credentials.d.ts +37 -0
- package/dist/cli/auth/credentials.js +155 -0
- package/dist/cli/auth/device-flow.d.ts +32 -0
- package/dist/cli/auth/device-flow.js +154 -0
- package/dist/cli/auth/device-secret.d.ts +6 -0
- package/dist/cli/auth/device-secret.js +26 -0
- package/dist/cli/auth/machine.d.ts +15 -0
- package/dist/cli/auth/machine.js +126 -0
- package/dist/cli/auth/materialized.d.ts +32 -0
- package/dist/cli/auth/materialized.js +102 -0
- package/dist/cli/auth/migrate.d.ts +10 -0
- package/dist/cli/auth/migrate.js +75 -0
- package/dist/cli/client.d.ts +102 -0
- package/dist/cli/client.js +206 -0
- package/dist/cli/collection-list.d.ts +3 -0
- package/dist/cli/collection-list.js +25 -0
- package/dist/cli/compat/ctx.d.ts +26 -0
- package/dist/cli/compat/ctx.js +76 -0
- package/dist/cli/compat/dreamdb-wasm-embedded.d.ts +2 -0
- package/dist/cli/compat/dreamdb-wasm-embedded.js +8 -0
- package/dist/cli/compat/dreamdb-wasm.d.ts +1 -0
- package/dist/cli/compat/dreamdb-wasm.js +26 -0
- package/dist/cli/compat/dreamdb.d.ts +112 -0
- package/dist/cli/compat/dreamdb.js +219 -0
- package/dist/cli/compat/flags.d.ts +2 -0
- package/dist/cli/compat/flags.js +13 -0
- package/dist/cli/compat/http.d.ts +23 -0
- package/dist/cli/compat/http.js +137 -0
- package/dist/cli/compat/presignedTransfer.d.ts +139 -0
- package/dist/cli/compat/presignedTransfer.js +580 -0
- package/dist/cli/compat/s3-backend.d.ts +73 -0
- package/dist/cli/compat/s3-backend.js +132 -0
- package/dist/cli/config.d.ts +22 -0
- package/dist/cli/config.js +96 -0
- package/dist/cli/connection/dto.d.ts +159 -0
- package/dist/cli/connection/dto.js +497 -0
- package/dist/cli/connection/index.d.ts +50 -0
- package/dist/cli/connection/index.js +413 -0
- package/dist/cli/connection/oauth.d.ts +23 -0
- package/dist/cli/connection/oauth.js +290 -0
- package/dist/cli/connection/write.d.ts +47 -0
- package/dist/cli/connection/write.js +573 -0
- package/dist/cli/create/index.d.ts +19 -0
- package/dist/cli/create/index.js +209 -0
- package/dist/cli/declare/index.d.ts +29 -0
- package/dist/cli/declare/index.js +304 -0
- package/dist/cli/delete/index.d.ts +18 -0
- package/dist/cli/delete/index.js +232 -0
- package/dist/cli/download/index.d.ts +9 -0
- package/dist/cli/download/index.js +128 -0
- package/dist/cli/env/compose.d.ts +88 -0
- package/dist/cli/env/compose.js +402 -0
- package/dist/cli/env/index.d.ts +176 -0
- package/dist/cli/env/index.js +1011 -0
- package/dist/cli/experiments/index.d.ts +11 -0
- package/dist/cli/experiments/index.js +168 -0
- package/dist/cli/glob.d.ts +1 -0
- package/dist/cli/glob.js +45 -0
- package/dist/cli/graphql-helpers.d.ts +23 -0
- package/dist/cli/graphql-helpers.js +42 -0
- package/dist/cli/graphql.d.ts +10 -0
- package/dist/cli/graphql.js +47 -0
- package/dist/cli/help-examples.generated.d.ts +1 -0
- package/dist/cli/help-examples.generated.js +192 -0
- package/dist/cli/helpers.d.ts +8 -0
- package/dist/cli/helpers.js +106 -0
- package/dist/cli/hosts/api.d.ts +29 -0
- package/dist/cli/hosts/api.js +54 -0
- package/dist/cli/hosts/bootstrap-source.d.ts +1 -0
- package/dist/cli/hosts/bootstrap-source.js +2 -0
- package/dist/cli/hosts/catalog.d.ts +26 -0
- package/dist/cli/hosts/catalog.js +55 -0
- package/dist/cli/hosts/config.d.ts +45 -0
- package/dist/cli/hosts/config.js +179 -0
- package/dist/cli/hosts/credentials.d.ts +19 -0
- package/dist/cli/hosts/credentials.js +173 -0
- package/dist/cli/hosts/enroll.d.ts +17 -0
- package/dist/cli/hosts/enroll.js +109 -0
- package/dist/cli/hosts/enrollments.d.ts +25 -0
- package/dist/cli/hosts/enrollments.js +54 -0
- package/dist/cli/hosts/index.d.ts +6 -0
- package/dist/cli/hosts/index.js +279 -0
- package/dist/cli/hosts/inventory.d.ts +40 -0
- package/dist/cli/hosts/inventory.js +91 -0
- package/dist/cli/hosts/lifecycle.d.ts +15 -0
- package/dist/cli/hosts/lifecycle.js +108 -0
- package/dist/cli/hosts/metrics-source.d.ts +12 -0
- package/dist/cli/hosts/metrics-source.js +89 -0
- package/dist/cli/hosts/observations.d.ts +39 -0
- package/dist/cli/hosts/observations.js +102 -0
- package/dist/cli/hosts/remote.d.ts +5 -0
- package/dist/cli/hosts/remote.js +66 -0
- package/dist/cli/hosts/ssh.d.ts +63 -0
- package/dist/cli/hosts/ssh.js +276 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +288 -0
- package/dist/cli/infra/api.d.ts +95 -0
- package/dist/cli/infra/api.js +291 -0
- package/dist/cli/infra/index.d.ts +5 -0
- package/dist/cli/infra/index.js +102 -0
- package/dist/cli/infra/move.d.ts +15 -0
- package/dist/cli/infra/move.js +123 -0
- package/dist/cli/infra/transfer.d.ts +15 -0
- package/dist/cli/infra/transfer.js +280 -0
- package/dist/cli/jobs/api.d.ts +69 -0
- package/dist/cli/jobs/api.js +121 -0
- package/dist/cli/jobs/index.d.ts +5 -0
- package/dist/cli/jobs/index.js +140 -0
- package/dist/cli/lakeshore/index.d.ts +98 -0
- package/dist/cli/lakeshore/index.js +502 -0
- package/dist/cli/launch/index.d.ts +43 -0
- package/dist/cli/launch/index.js +270 -0
- package/dist/cli/layout/index.d.ts +2 -0
- package/dist/cli/layout/index.js +44 -0
- package/dist/cli/layout/transport.d.ts +12 -0
- package/dist/cli/layout/transport.js +70 -0
- package/dist/cli/library/add.d.ts +60 -0
- package/dist/cli/library/add.js +348 -0
- package/dist/cli/library/cache.d.ts +26 -0
- package/dist/cli/library/cache.js +88 -0
- package/dist/cli/library/config.d.ts +75 -0
- package/dist/cli/library/config.js +198 -0
- package/dist/cli/library/digest.d.ts +5 -0
- package/dist/cli/library/digest.js +19 -0
- package/dist/cli/library/discover.d.ts +87 -0
- package/dist/cli/library/discover.js +534 -0
- package/dist/cli/library/freshness.d.ts +35 -0
- package/dist/cli/library/freshness.js +109 -0
- package/dist/cli/library/generation.d.ts +35 -0
- package/dist/cli/library/generation.js +211 -0
- package/dist/cli/library/index.d.ts +2 -0
- package/dist/cli/library/index.js +36 -0
- package/dist/cli/library/info.d.ts +69 -0
- package/dist/cli/library/info.js +311 -0
- package/dist/cli/library/list.d.ts +33 -0
- package/dist/cli/library/list.js +86 -0
- package/dist/cli/library/manifest.d.ts +81 -0
- package/dist/cli/library/manifest.js +200 -0
- package/dist/cli/library/manifestCache.d.ts +45 -0
- package/dist/cli/library/manifestCache.js +169 -0
- package/dist/cli/library/pull.d.ts +30 -0
- package/dist/cli/library/pull.js +438 -0
- package/dist/cli/library/push.d.ts +72 -0
- package/dist/cli/library/push.js +642 -0
- package/dist/cli/library/rm.d.ts +31 -0
- package/dist/cli/library/rm.js +200 -0
- package/dist/cli/library/search.d.ts +18 -0
- package/dist/cli/library/search.js +181 -0
- package/dist/cli/library/stat.d.ts +15 -0
- package/dist/cli/library/stat.js +127 -0
- package/dist/cli/library/tools.d.ts +104 -0
- package/dist/cli/library/tools.js +163 -0
- package/dist/cli/library/wire.d.ts +47 -0
- package/dist/cli/library/wire.js +120 -0
- package/dist/cli/list/index.d.ts +26 -0
- package/dist/cli/list/index.js +256 -0
- package/dist/cli/notes/character-plan.d.ts +22 -0
- package/dist/cli/notes/character-plan.js +232 -0
- package/dist/cli/notes/document.d.ts +73 -0
- package/dist/cli/notes/document.js +306 -0
- package/dist/cli/notes/edit-commands.d.ts +106 -0
- package/dist/cli/notes/edit-commands.js +623 -0
- package/dist/cli/notes/editing.d.ts +81 -0
- package/dist/cli/notes/editing.js +305 -0
- package/dist/cli/notes/events.d.ts +36 -0
- package/dist/cli/notes/events.js +54 -0
- package/dist/cli/notes/files-commands.d.ts +120 -0
- package/dist/cli/notes/files-commands.js +554 -0
- package/dist/cli/notes/html-read.d.ts +9 -0
- package/dist/cli/notes/html-read.js +90 -0
- package/dist/cli/notes/html.d.ts +73 -0
- package/dist/cli/notes/html.js +381 -0
- package/dist/cli/notes/index.d.ts +123 -0
- package/dist/cli/notes/index.js +1303 -0
- package/dist/cli/notes/linger.d.ts +59 -0
- package/dist/cli/notes/linger.js +339 -0
- package/dist/cli/notes/media-commands.d.ts +5 -0
- package/dist/cli/notes/media-commands.js +51 -0
- package/dist/cli/notes/move-command.d.ts +83 -0
- package/dist/cli/notes/move-command.js +259 -0
- package/dist/cli/notes/rm-command.d.ts +22 -0
- package/dist/cli/notes/rm-command.js +110 -0
- package/dist/cli/notes/select-command.d.ts +12 -0
- package/dist/cli/notes/select-command.js +84 -0
- package/dist/cli/notes/suggest-diff.d.ts +56 -0
- package/dist/cli/notes/suggest-diff.js +311 -0
- package/dist/cli/notes/toc.d.ts +38 -0
- package/dist/cli/notes/toc.js +144 -0
- package/dist/cli/notes/transfer-command.d.ts +6 -0
- package/dist/cli/notes/transfer-command.js +9 -0
- package/dist/cli/notes/version-commands.d.ts +19 -0
- package/dist/cli/notes/version-commands.js +178 -0
- package/dist/cli/nymph/index.d.ts +74 -0
- package/dist/cli/nymph/index.js +349 -0
- package/dist/cli/org/index.d.ts +34 -0
- package/dist/cli/org/index.js +341 -0
- package/dist/cli/ownership/index.d.ts +12 -0
- package/dist/cli/ownership/index.js +122 -0
- package/dist/cli/ownership/metadata-transfer.d.ts +20 -0
- package/dist/cli/ownership/metadata-transfer.js +159 -0
- package/dist/cli/page/index.d.ts +58 -0
- package/dist/cli/page/index.js +387 -0
- package/dist/cli/pipeline/index.d.ts +69 -0
- package/dist/cli/pipeline/index.js +604 -0
- package/dist/cli/progress.d.ts +60 -0
- package/dist/cli/progress.js +276 -0
- package/dist/cli/project/attachments.d.ts +10 -0
- package/dist/cli/project/attachments.js +39 -0
- package/dist/cli/project/grants.d.ts +10 -0
- package/dist/cli/project/grants.js +39 -0
- package/dist/cli/project/index.d.ts +8 -0
- package/dist/cli/project/index.js +92 -0
- package/dist/cli/project/move.d.ts +57 -0
- package/dist/cli/project/move.js +242 -0
- package/dist/cli/project/output.d.ts +2 -0
- package/dist/cli/project/output.js +29 -0
- package/dist/cli/project/stream.d.ts +55 -0
- package/dist/cli/project/stream.js +207 -0
- package/dist/cli/project/transfer-preview.d.ts +8 -0
- package/dist/cli/project/transfer-preview.js +10 -0
- package/dist/cli/prompt.d.ts +1 -0
- package/dist/cli/prompt.js +17 -0
- package/dist/cli/provider/dreamdir.d.ts +52 -0
- package/dist/cli/provider/dreamdir.js +138 -0
- package/dist/cli/provider/index.d.ts +4 -0
- package/dist/cli/provider/index.js +419 -0
- package/dist/cli/provider/jump-worker.d.ts +9 -0
- package/dist/cli/provider/jump-worker.js +141 -0
- package/dist/cli/provider/lifecycle.d.ts +149 -0
- package/dist/cli/provider/lifecycle.js +1390 -0
- package/dist/cli/provider/machine.d.ts +17 -0
- package/dist/cli/provider/machine.js +116 -0
- package/dist/cli/provider/ssh.d.ts +105 -0
- package/dist/cli/provider/ssh.js +305 -0
- package/dist/cli/provider/terraform.d.ts +140 -0
- package/dist/cli/provider/terraform.js +288 -0
- package/dist/cli/providers/index.d.ts +18 -0
- package/dist/cli/providers/index.js +422 -0
- package/dist/cli/python.d.ts +61 -0
- package/dist/cli/python.js +255 -0
- package/dist/cli/queues/index.d.ts +33 -0
- package/dist/cli/queues/index.js +248 -0
- package/dist/cli/queues/slurm.d.ts +10 -0
- package/dist/cli/queues/slurm.js +134 -0
- package/dist/cli/resources.d.ts +72 -0
- package/dist/cli/resources.js +137 -0
- package/dist/cli/run/index.d.ts +15 -0
- package/dist/cli/run/index.js +163 -0
- package/dist/cli/run/input.d.ts +34 -0
- package/dist/cli/run/input.js +135 -0
- package/dist/cli/run/recovery.d.ts +2 -0
- package/dist/cli/run/recovery.js +18 -0
- package/dist/cli/run/setup.d.ts +3 -0
- package/dist/cli/run/setup.js +62 -0
- package/dist/cli/runconfig/index.d.ts +12 -0
- package/dist/cli/runconfig/index.js +130 -0
- package/dist/cli/runnable/index.d.ts +35 -0
- package/dist/cli/runnable/index.js +575 -0
- package/dist/cli/runnable/path.d.ts +115 -0
- package/dist/cli/runnable/path.js +288 -0
- package/dist/cli/runnable/run.d.ts +91 -0
- package/dist/cli/runnable/run.js +239 -0
- package/dist/cli/runnable/upload.d.ts +43 -0
- package/dist/cli/runnable/upload.js +342 -0
- package/dist/cli/runnable/worker.d.ts +1 -0
- package/dist/cli/runnable/worker.js +44 -0
- package/dist/cli/schemas/workflow-spec.schema.json +335 -0
- package/dist/cli/self-update/index.d.ts +5 -0
- package/dist/cli/self-update/index.js +107 -0
- package/dist/cli/self-update/install.d.ts +60 -0
- package/dist/cli/self-update/install.js +428 -0
- package/dist/cli/self-update/paths.d.ts +40 -0
- package/dist/cli/self-update/paths.js +87 -0
- package/dist/cli/self-update/releases.d.ts +41 -0
- package/dist/cli/self-update/releases.js +153 -0
- package/dist/cli/self-update/settings.d.ts +16 -0
- package/dist/cli/self-update/settings.js +68 -0
- package/dist/cli/self-update/update.d.ts +18 -0
- package/dist/cli/self-update/update.js +241 -0
- package/dist/cli/service-accounts/index.d.ts +3 -0
- package/dist/cli/service-accounts/index.js +149 -0
- package/dist/cli/session-affiliation.d.ts +26 -0
- package/dist/cli/session-affiliation.js +135 -0
- package/dist/cli/sessions/affiliation.d.ts +8 -0
- package/dist/cli/sessions/affiliation.js +66 -0
- package/dist/cli/sessions/api.d.ts +55 -0
- package/dist/cli/sessions/api.js +88 -0
- package/dist/cli/sessions/control.d.ts +6 -0
- package/dist/cli/sessions/control.js +159 -0
- package/dist/cli/sessions/conversation.d.ts +15 -0
- package/dist/cli/sessions/conversation.js +118 -0
- package/dist/cli/sessions/index.d.ts +2 -0
- package/dist/cli/sessions/index.js +209 -0
- package/dist/cli/sessions/managed.d.ts +39 -0
- package/dist/cli/sessions/managed.js +63 -0
- package/dist/cli/sessions/redaction.d.ts +2 -0
- package/dist/cli/sessions/redaction.js +11 -0
- package/dist/cli/sessions/runner/exec.d.ts +108 -0
- package/dist/cli/sessions/runner/exec.js +335 -0
- package/dist/cli/sessions/runner/journal.d.ts +26 -0
- package/dist/cli/sessions/runner/journal.js +49 -0
- package/dist/cli/sessions/runner/native.d.ts +48 -0
- package/dist/cli/sessions/runner/native.js +170 -0
- package/dist/cli/sessions/runner/pod.d.ts +30 -0
- package/dist/cli/sessions/runner/pod.js +129 -0
- package/dist/cli/sessions/runner/serve.d.ts +85 -0
- package/dist/cli/sessions/runner/serve.js +558 -0
- package/dist/cli/sessions/sync.d.ts +47 -0
- package/dist/cli/sessions/sync.js +80 -0
- package/dist/cli/sessions/transport.d.ts +14 -0
- package/dist/cli/sessions/transport.js +116 -0
- package/dist/cli/share.d.ts +15 -0
- package/dist/cli/share.js +139 -0
- package/dist/cli/skill/catalog.d.ts +141 -0
- package/dist/cli/skill/catalog.js +442 -0
- package/dist/cli/skill/files.d.ts +89 -0
- package/dist/cli/skill/files.js +264 -0
- package/dist/cli/skill/index.d.ts +268 -0
- package/dist/cli/skill/index.js +1216 -0
- package/dist/cli/skill/manifest.d.ts +30 -0
- package/dist/cli/skill/manifest.js +101 -0
- package/dist/cli/skill/prefs.d.ts +9 -0
- package/dist/cli/skill/prefs.js +32 -0
- package/dist/cli/skill/reminders.d.ts +15 -0
- package/dist/cli/skill/reminders.js +105 -0
- package/dist/cli/skill/tar.d.ts +17 -0
- package/dist/cli/skill/tar.js +195 -0
- package/dist/cli/snapshot/index.d.ts +24 -0
- package/dist/cli/snapshot/index.js +146 -0
- package/dist/cli/source/access.d.ts +45 -0
- package/dist/cli/source/access.js +563 -0
- package/dist/cli/source/control.d.ts +103 -0
- package/dist/cli/source/control.js +546 -0
- package/dist/cli/source/delete.d.ts +89 -0
- package/dist/cli/source/delete.js +463 -0
- package/dist/cli/source/index.d.ts +288 -0
- package/dist/cli/source/index.js +1348 -0
- package/dist/cli/source/share.d.ts +65 -0
- package/dist/cli/source/share.js +530 -0
- package/dist/cli/source/upload.d.ts +62 -0
- package/dist/cli/source/upload.js +258 -0
- package/dist/cli/source/write.d.ts +77 -0
- package/dist/cli/source/write.js +335 -0
- package/dist/cli/spawn.d.ts +28 -0
- package/dist/cli/spawn.js +81 -0
- package/dist/cli/target.d.ts +22 -0
- package/dist/cli/target.js +85 -0
- package/dist/cli/tasks/index.d.ts +38 -0
- package/dist/cli/tasks/index.js +365 -0
- package/dist/cli/team/index.d.ts +37 -0
- package/dist/cli/team/index.js +407 -0
- package/dist/cli/telemetry.d.ts +23 -0
- package/dist/cli/telemetry.js +262 -0
- package/dist/cli/telemetryJournal.d.ts +26 -0
- package/dist/cli/telemetryJournal.js +104 -0
- package/dist/cli/update/index.d.ts +21 -0
- package/dist/cli/update/index.js +284 -0
- package/dist/cli/upload/index.d.ts +11 -0
- package/dist/cli/upload/index.js +261 -0
- package/dist/cli/upload/kinds.d.ts +10 -0
- package/dist/cli/upload/kinds.js +85 -0
- package/dist/cli/upload/multipart.d.ts +21 -0
- package/dist/cli/upload/multipart.js +248 -0
- package/dist/cli/vault/affected-preview.d.ts +15 -0
- package/dist/cli/vault/affected-preview.js +38 -0
- package/dist/cli/vault/cloud.d.ts +55 -0
- package/dist/cli/vault/cloud.js +287 -0
- package/dist/cli/vault/format.d.ts +18 -0
- package/dist/cli/vault/format.js +104 -0
- package/dist/cli/vault/hostCredentials.d.ts +21 -0
- package/dist/cli/vault/hostCredentials.js +71 -0
- package/dist/cli/vault/hostSupersessions.d.ts +18 -0
- package/dist/cli/vault/hostSupersessions.js +68 -0
- package/dist/cli/vault/import.d.ts +3 -0
- package/dist/cli/vault/import.js +79 -0
- package/dist/cli/vault/index.d.ts +14 -0
- package/dist/cli/vault/index.js +225 -0
- package/dist/cli/vault/keys.d.ts +5 -0
- package/dist/cli/vault/keys.js +165 -0
- package/dist/cli/vault/kms.d.ts +6 -0
- package/dist/cli/vault/kms.js +169 -0
- package/dist/cli/vault/list.d.ts +13 -0
- package/dist/cli/vault/list.js +60 -0
- package/dist/cli/vault/listView.d.ts +21 -0
- package/dist/cli/vault/listView.js +123 -0
- package/dist/cli/vault/managementMetadata.d.ts +2 -0
- package/dist/cli/vault/managementMetadata.js +23 -0
- package/dist/cli/vault/mutations.d.ts +8 -0
- package/dist/cli/vault/mutations.js +151 -0
- package/dist/cli/vault/otp.d.ts +6 -0
- package/dist/cli/vault/otp.js +62 -0
- package/dist/cli/vault/otpIntent.d.ts +23 -0
- package/dist/cli/vault/otpIntent.js +76 -0
- package/dist/cli/vault/passImport.d.ts +25 -0
- package/dist/cli/vault/passImport.js +129 -0
- package/dist/cli/vault/passOtp.d.ts +51 -0
- package/dist/cli/vault/passOtp.js +101 -0
- package/dist/cli/vault/passStore.d.ts +26 -0
- package/dist/cli/vault/passStore.js +134 -0
- package/dist/cli/vault/passwordCommand.d.ts +39 -0
- package/dist/cli/vault/passwordCommand.js +101 -0
- package/dist/cli/vault/passwordProbe.d.ts +27 -0
- package/dist/cli/vault/passwordProbe.js +282 -0
- package/dist/cli/vault/passwordRotation.d.ts +9 -0
- package/dist/cli/vault/passwordRotation.js +273 -0
- package/dist/cli/vault/rotationApi.d.ts +13 -0
- package/dist/cli/vault/rotationApi.js +58 -0
- package/dist/cli/vault/rotationCommand.d.ts +2 -0
- package/dist/cli/vault/rotationCommand.js +75 -0
- package/dist/cli/vault/rotationEngine.d.ts +19 -0
- package/dist/cli/vault/rotationEngine.js +65 -0
- package/dist/cli/vault/rotationHelperSource.d.ts +2 -0
- package/dist/cli/vault/rotationHelperSource.js +3 -0
- package/dist/cli/vault/rotationInput.d.ts +11 -0
- package/dist/cli/vault/rotationInput.js +48 -0
- package/dist/cli/vault/rotationJournal.d.ts +16 -0
- package/dist/cli/vault/rotationJournal.js +183 -0
- package/dist/cli/vault/rotationKeys.d.ts +4 -0
- package/dist/cli/vault/rotationKeys.js +48 -0
- package/dist/cli/vault/rotationPrepare.d.ts +17 -0
- package/dist/cli/vault/rotationPrepare.js +108 -0
- package/dist/cli/vault/rotationRemote.d.ts +33 -0
- package/dist/cli/vault/rotationRemote.js +156 -0
- package/dist/cli/vault/rotationState.d.ts +42 -0
- package/dist/cli/vault/rotationState.js +115 -0
- package/dist/cli/vault/rotationTransport.d.ts +18 -0
- package/dist/cli/vault/rotationTransport.js +71 -0
- package/dist/cli/vault/sshSource.d.ts +18 -0
- package/dist/cli/vault/sshSource.js +196 -0
- package/dist/cli/vault/sshSync.d.ts +17 -0
- package/dist/cli/vault/sshSync.js +224 -0
- package/dist/cli/vault/sshTransfer.d.ts +22 -0
- package/dist/cli/vault/sshTransfer.js +140 -0
- package/dist/cli/vault/terraformState.d.ts +66 -0
- package/dist/cli/vault/terraformState.js +252 -0
- package/dist/cli/vault/terraformStateCommand.d.ts +2 -0
- package/dist/cli/vault/terraformStateCommand.js +61 -0
- package/dist/cli/vault/tree.d.ts +43 -0
- package/dist/cli/vault/tree.js +292 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.js +9 -0
- package/dist/cli/workflow/index.d.ts +76 -0
- package/dist/cli/workflow/index.js +826 -0
- package/dist/cli/workflow/validate.d.ts +19 -0
- package/dist/cli/workflow/validate.js +353 -0
- package/dist/package.json +1 -0
- package/package.json +28 -10
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { request } from './index.js';
|
|
2
|
+
import { bindingInput } from './hostCredentials.js';
|
|
3
|
+
const fields = ['operationId', 'expectedEntryId', 'expectedEntryRevision', 'replacementEntryId', 'replacementEntryRevision'];
|
|
4
|
+
export function validateSupersession(bindingId, data) {
|
|
5
|
+
if (!/^[a-f0-9-]{36}$/.test(bindingId ?? '') || fields.some(k => k.endsWith('Revision') ? !Number.isSafeInteger(data[k]) || Number(data[k]) < 1 : typeof data[k] !== 'string' || !/^[A-Za-z0-9_-]{1,128}$/.test(String(data[k]))) || data.expectedEntryId === data.replacementEntryId)
|
|
6
|
+
throw new Error('Invalid credential replacement intent');
|
|
7
|
+
return data;
|
|
8
|
+
}
|
|
9
|
+
export function supersessionReceipt(result, operationId, bindingId, expected) {
|
|
10
|
+
const op = result?.operation;
|
|
11
|
+
if (!op || op.operationId !== operationId || bindingId !== undefined && op.bindingId !== bindingId || expected && fields.some(k => op[k] !== expected[k]))
|
|
12
|
+
throw new Error('Replacement receipt identity mismatch');
|
|
13
|
+
validateSupersession(op.bindingId, op);
|
|
14
|
+
bindingInput({ ...op, entryId: op.replacementEntryId, entryRevision: op.replacementEntryRevision });
|
|
15
|
+
if (op.state !== 'cleanup_pending' || typeof op.createdAt !== 'string' || !op.createdAt)
|
|
16
|
+
throw new Error('Invalid replacement receipt');
|
|
17
|
+
return Object.fromEntries([...fields, 'bindingId', 'hostId', 'enrollmentId', 'role', 'endpoint', 'kind', 'state', 'createdAt'].map(k => [k, op[k]]));
|
|
18
|
+
}
|
|
19
|
+
/** Operation lookup can expose a later cleanup lifecycle without changing the
|
|
20
|
+
* immutable original supersession receipt returned by an exact POST replay. */
|
|
21
|
+
export function hostOperationReceipt(result, operationId) {
|
|
22
|
+
const op = result?.operation;
|
|
23
|
+
if (op?.state !== 'cleanup_confirmed')
|
|
24
|
+
return supersessionReceipt(result, operationId);
|
|
25
|
+
const original = supersessionReceipt({ operation: { ...op, state: 'cleanup_pending' } }, operationId);
|
|
26
|
+
const proof = op.confirmation;
|
|
27
|
+
if (!proof || typeof proof !== 'object' || Array.isArray(proof) ||
|
|
28
|
+
Object.keys(proof).sort().join(',') !== 'bindingId,expectedEntryId,expectedEntryRevision,replacementEntryId,replacementEntryRevision,verification' ||
|
|
29
|
+
['bindingId', 'expectedEntryId', 'expectedEntryRevision', 'replacementEntryId', 'replacementEntryRevision'].some(k => proof[k] !== op[k]) ||
|
|
30
|
+
op.verificationSource !== 'client_attestation' || typeof op.cleanupConfirmedAt !== 'string' || !Number.isFinite(Date.parse(op.cleanupConfirmedAt)))
|
|
31
|
+
throw new Error('Invalid cleanup receipt');
|
|
32
|
+
// The summary does not echo arbitrary attestation fields or remote identity.
|
|
33
|
+
return { ...original, state: 'cleanup_confirmed', cleanupConfirmedAt: op.cleanupConfirmedAt, verificationSource: 'client_attestation' };
|
|
34
|
+
}
|
|
35
|
+
export function registerHostSupersessions(vault) {
|
|
36
|
+
vault.command('supersede').description('conditionally replace a host credential reference; no SSH changes; both entries remain retained')
|
|
37
|
+
.requiredOption('--binding-id <id>', 'current binding identity')
|
|
38
|
+
.requiredOption('--operation-id <id>', 'persist before use; reuse for recovery')
|
|
39
|
+
.requiredOption('--expected-entry-id <id>', 'current immutable entry identity')
|
|
40
|
+
.requiredOption('--expected-entry-revision <number>', 'current binding and entry revision')
|
|
41
|
+
.requiredOption('--replacement-entry-id <id>', 'distinct replacement entry identity')
|
|
42
|
+
.requiredOption('--replacement-entry-revision <number>', 'current replacement revision')
|
|
43
|
+
.action(async (opts) => {
|
|
44
|
+
try {
|
|
45
|
+
const data = validateSupersession(opts.bindingId, { operationId: opts.operationId, expectedEntryId: opts.expectedEntryId, expectedEntryRevision: Number(opts.expectedEntryRevision), replacementEntryId: opts.replacementEntryId, replacementEntryRevision: Number(opts.replacementEntryRevision) });
|
|
46
|
+
const result = await request('/v1/vault/host-credentials/' + opts.bindingId + '/supersede', data, 'POST');
|
|
47
|
+
console.log(JSON.stringify(supersessionReceipt(result, data.operationId, opts.bindingId, data), null, 2));
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
console.error('Replacement not confirmed. Recover with vault host-operation --operation-id using the same ID, or retry the exact arguments. No remote SSH cleanup is confirmed.');
|
|
51
|
+
process.exitCode = 1;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
vault.command('host-operation').description('recover account-owned host replacement metadata; missing receipt does not prove failure')
|
|
55
|
+
.requiredOption('--operation-id <id>', 'persisted replacement operation identity')
|
|
56
|
+
.action(async (opts) => {
|
|
57
|
+
try {
|
|
58
|
+
if (!/^[A-Za-z0-9_-]{1,128}$/.test(opts.operationId))
|
|
59
|
+
throw new Error();
|
|
60
|
+
const result = await request('/v1/vault/host-credential-operations/' + opts.operationId);
|
|
61
|
+
console.log(JSON.stringify(hostOperationReceipt(result, opts.operationId), null, 2));
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
console.error('Replacement receipt unavailable. Missing status does not prove failure; retain the original operation ID and arguments.');
|
|
65
|
+
process.exitCode = 1;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { importPassOtp } from './passImport.js';
|
|
2
|
+
import { confirm } from './sshSync.js';
|
|
3
|
+
import { invocationPrefix } from './index.js';
|
|
4
|
+
import { configureSshImport, runSshImport } from './sshSync.js';
|
|
5
|
+
import { previewPassStore } from './passStore.js';
|
|
6
|
+
/** Validate source and source-specific options before discovery, decryption or HTTP. */
|
|
7
|
+
export function registerVaultImport(vault) {
|
|
8
|
+
const command = configureSshImport(vault.command('import')
|
|
9
|
+
.description('selected one-way import: SSH or OTP upload'))
|
|
10
|
+
.option('--ssh', 'import explicitly selected SSH profiles or keys')
|
|
11
|
+
.option('--pass-otp', 'import selected OTP registrations; HOTP defaults inactive')
|
|
12
|
+
.option('--hotp-owner <owner>', 'activate imported HOTP under dreamlake authority; stop other generators')
|
|
13
|
+
.option('--pass', 'reserved; ordinary pass entry import is not implemented')
|
|
14
|
+
.option('--store <directory>', 'explicit pass store directory (--pass-otp only)')
|
|
15
|
+
.option('--gpg-home <directory>', 'explicit GPG keyring (--pass-otp only)')
|
|
16
|
+
.addHelpText('after', '\nChoose exactly one of --ssh or --pass-otp. --pass-otp requires --store; upload requires explicit --select paths and --prefix. HOTP defaults inactive; --hotp-owner dreamlake explicitly takes counter ownership.\nLegacy aliases: vault ssh sync; vault pass sync --otp. Sync reconciliation is not implemented.');
|
|
17
|
+
command.options.find(option => option.long === '--select').description = 'explicit SSH item ID or pass path without .gpg (repeatable; consents to noninteractive upload)';
|
|
18
|
+
command.options.find(option => option.long === '--dry-run').description = 'preview only; no upload (SSH never reads private keys)';
|
|
19
|
+
command.action(async (options, current) => {
|
|
20
|
+
try {
|
|
21
|
+
if (options.pass)
|
|
22
|
+
throw new Error('Ordinary pass entry import (--pass) is not implemented');
|
|
23
|
+
if (Number(!!options.ssh) + Number(!!options.passOtp) !== 1)
|
|
24
|
+
throw new Error('Choose exactly one source: --ssh or --pass-otp');
|
|
25
|
+
const explicit = (name) => current.getOptionValueSource(name) === 'cli';
|
|
26
|
+
if (options.ssh) {
|
|
27
|
+
if (explicit('store') || explicit('gpgHome') || explicit('hotpOwner'))
|
|
28
|
+
throw new Error('--store and --gpg-home require --pass-otp');
|
|
29
|
+
await runSshImport(options, current);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (['config', 'ifMatch', 'retry'].some(explicit))
|
|
33
|
+
throw new Error('--config, --if-match and --retry require --ssh');
|
|
34
|
+
if (!options.dryRun) {
|
|
35
|
+
const interactive = !!process.stdin.isTTY && !!process.stderr.isTTY && !options.json;
|
|
36
|
+
let cancelled = false;
|
|
37
|
+
const cancel = () => { cancelled = true; };
|
|
38
|
+
process.on("SIGINT", cancel);
|
|
39
|
+
process.on("SIGTERM", cancel);
|
|
40
|
+
let result;
|
|
41
|
+
try {
|
|
42
|
+
result = await importPassOtp({ ...options, prefix: invocationPrefix(current) }, interactive ? async (entries) => {
|
|
43
|
+
process.stderr.write(JSON.stringify({ prefix: invocationPrefix(current), entries }, null, 2) + '\n');
|
|
44
|
+
return confirm('Upload only these OTP entries? Explicit HOTP ownership means stopping all other generators.');
|
|
45
|
+
} : undefined, () => cancelled);
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
process.off("SIGINT", cancel);
|
|
49
|
+
process.off("SIGTERM", cancel);
|
|
50
|
+
}
|
|
51
|
+
process.stdout.write(JSON.stringify(result, null, 2) + '\n');
|
|
52
|
+
if (!result.uploaded && !result.cancelled)
|
|
53
|
+
process.exitCode = 1;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (options.hotpOwner)
|
|
57
|
+
throw new Error('--hotp-owner is for upload, not preview');
|
|
58
|
+
if (options.select.length)
|
|
59
|
+
throw new Error('--select is for upload; dry-run previews the explicit store');
|
|
60
|
+
if (!options.store)
|
|
61
|
+
throw new Error('--pass-otp requires an explicit --store directory');
|
|
62
|
+
// Existing preview emits metadata only, never OTP seeds or adjacent passwords.
|
|
63
|
+
let result;
|
|
64
|
+
try {
|
|
65
|
+
result = await previewPassStore({ ...options, otp: true, prefix: invocationPrefix(current) });
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
throw new Error('Pass OTP preview failed; source details redacted');
|
|
69
|
+
}
|
|
70
|
+
process.stdout.write(JSON.stringify(result, null, 2) + '\n');
|
|
71
|
+
if (result.failed || result.invalid)
|
|
72
|
+
process.exitCode = 1;
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
process.stderr.write(error.message + '\n');
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
export declare function collectPrefix(value: string, previous?: string): string;
|
|
3
|
+
export declare function invocationPrefix(command: Command): string;
|
|
4
|
+
export declare function vaultScope(): string | undefined;
|
|
5
|
+
export declare function validVaultScope(value: unknown): string | undefined;
|
|
6
|
+
export declare class VaultRequestError extends Error {
|
|
7
|
+
status?: number | undefined;
|
|
8
|
+
constructor(message: string, status?: number | undefined);
|
|
9
|
+
}
|
|
10
|
+
export declare function request(path: string, body?: unknown, method?: string, revision?: number, extraHeaders?: Record<string, string>, connection?: {
|
|
11
|
+
remote: string;
|
|
12
|
+
token: string;
|
|
13
|
+
}): Promise<any>;
|
|
14
|
+
export declare function registerVaultCommand(program: Command): void;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
import { collectionList } from "../collection-list.js";
|
|
2
|
+
import { managementMetadata } from './managementMetadata.js';
|
|
3
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
+
import { showTree } from './tree.js';
|
|
5
|
+
import { registerVaultCloud } from './cloud.js';
|
|
6
|
+
import { registerTerraformState } from './terraformStateCommand.js';
|
|
7
|
+
import { registerPasswordRotations } from './passwordRotation.js';
|
|
8
|
+
import { registerPasswordVerification } from './passwordCommand.js';
|
|
9
|
+
import { registerRotation } from './rotationCommand.js';
|
|
10
|
+
import { registerVaultKms } from './kms.js';
|
|
11
|
+
import { registerHostSupersessions } from './hostSupersessions.js';
|
|
12
|
+
import { listEntries } from './list.js';
|
|
13
|
+
import { interactiveList, showList } from './listView.js';
|
|
14
|
+
import { registerHostBindings } from './hostCredentials.js';
|
|
15
|
+
import { registerVaultOtp } from './otp.js';
|
|
16
|
+
import { registerVaultImport } from "./import.js";
|
|
17
|
+
import { registerSshSync } from "./sshSync.js";
|
|
18
|
+
import { registerPassCommands } from "./passStore.js";
|
|
19
|
+
import { registerVaultKeys } from "./keys.js";
|
|
20
|
+
import { registerVaultMutations } from "./mutations.js";
|
|
21
|
+
import { resolveRemote, resolveToken } from "../config.js";
|
|
22
|
+
import { formatEntries, resolveSelector, validateOutputRequest } from "./format.js";
|
|
23
|
+
export function collectPrefix(value, previous) {
|
|
24
|
+
if (previous !== undefined && previous !== value)
|
|
25
|
+
throw new Error("Conflicting prefixes");
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
export function invocationPrefix(command) {
|
|
29
|
+
const values = [];
|
|
30
|
+
for (let current = command; current; current = current.parent)
|
|
31
|
+
if (current.opts().prefix !== undefined)
|
|
32
|
+
values.push(current.opts().prefix);
|
|
33
|
+
if (new Set(values).size > 1)
|
|
34
|
+
throw new Error("Conflicting prefixes");
|
|
35
|
+
return values[0] ?? "";
|
|
36
|
+
}
|
|
37
|
+
const scopeContext = new AsyncLocalStorage();
|
|
38
|
+
export function vaultScope() { return scopeContext.getStore(); }
|
|
39
|
+
export function validVaultScope(value) {
|
|
40
|
+
if (value === undefined)
|
|
41
|
+
return undefined;
|
|
42
|
+
if (typeof value !== 'string' || !/^(org|team):[a-f0-9]{24}$/.test(value))
|
|
43
|
+
throw new Error('Invalid vault scope');
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
export class VaultRequestError extends Error {
|
|
47
|
+
status;
|
|
48
|
+
constructor(message, status) {
|
|
49
|
+
super(message);
|
|
50
|
+
this.status = status;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
export async function request(path, body, method = body ? "POST" : "GET", revision, extraHeaders = {}, connection) {
|
|
54
|
+
const scope = vaultScope();
|
|
55
|
+
if (scope) {
|
|
56
|
+
const route = path.split('?')[0];
|
|
57
|
+
if (!['/v1/vault/scopes', '/v1/vault/entries', '/v1/vault/entries/read', '/v1/vault/entry', '/v1/vault/restore', '/v1/vault/capabilities', '/v1/vault/policy', '/v1/vault/audit', '/v1/vault/secret-transfers/preview'].includes(route) && !route.startsWith('/v1/vault/write-operations/') && !route.startsWith('/v1/vault/secret-transfers/') && !route.startsWith('/v1/vault/secret-transfer-requests/'))
|
|
58
|
+
throw new VaultRequestError('Shared vault operation unsupported', 403);
|
|
59
|
+
}
|
|
60
|
+
if (Object.keys(extraHeaders).some(key => key.toLowerCase() === 'x-vault-scope'))
|
|
61
|
+
throw new Error('Use --scope to select the vault');
|
|
62
|
+
const token = connection?.token ?? resolveToken();
|
|
63
|
+
if (!token)
|
|
64
|
+
throw new Error("Vault authentication required; run dreamlake login");
|
|
65
|
+
let response;
|
|
66
|
+
try {
|
|
67
|
+
// Bun can replay PUT/DELETE after a pooled connection drops. A fresh connection keeps recovery under the caller's
|
|
68
|
+
// explicit request-ID/reconciliation policy instead of a transport retry.
|
|
69
|
+
response = await fetch(`${connection?.remote ?? resolveRemote()}${path}`, { method, keepalive: false, redirect: "error", headers: { ...extraHeaders, ...(scope ? { "X-Vault-Scope": scope } : {}), Authorization: `Bearer ${token}`, ...(body === undefined ? {} : { "Content-Type": "application/json" }), ...(revision === undefined ? {} : { "If-Match": String(revision) }) }, body: body ? JSON.stringify(body) : undefined, signal: AbortSignal.timeout(30_000) });
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
throw new VaultRequestError("Vault connection failed");
|
|
73
|
+
}
|
|
74
|
+
if (!response.ok)
|
|
75
|
+
throw new VaultRequestError(`Vault request failed (HTTP ${response.status})`, response.status);
|
|
76
|
+
try {
|
|
77
|
+
return await response.json();
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
throw new VaultRequestError("Invalid vault response");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
export function registerVaultCommand(program) {
|
|
84
|
+
// Let the selected command consume its values before interpreting root
|
|
85
|
+
// flags: quoted SSH arguments may themselves begin with `-p`.
|
|
86
|
+
program.enablePositionalOptions();
|
|
87
|
+
program.option("-p, --prefix <prefix>", "path prefix for vault commands", collectPrefix);
|
|
88
|
+
const vault = program.command("vault").description("read account-authorized vault entries")
|
|
89
|
+
.option("-p, --prefix <prefix>", "vault path prefix", collectPrefix)
|
|
90
|
+
.option("--scope <scope>", "immutable org:<id> or team:<id> vault scope");
|
|
91
|
+
vault.hook('preAction', (_thisCommand, actionCommand) => {
|
|
92
|
+
const scope = validVaultScope(actionCommand.optsWithGlobals().scope);
|
|
93
|
+
scopeContext.enterWith(scope);
|
|
94
|
+
let top = actionCommand;
|
|
95
|
+
while (top.parent && top.parent !== vault)
|
|
96
|
+
top = top.parent;
|
|
97
|
+
if (scope && !['get', 'list', 'show', 'add', 'delete', 'restore', 'write-status', 'scopes', 'secret-copy-preview', 'secret-copy', 'secret-copy-recover', 'policy', 'audit', 'capabilities'].includes(top.name()))
|
|
98
|
+
throw new Error('Shared vault operation unsupported');
|
|
99
|
+
if (scope && actionCommand.opts().tree)
|
|
100
|
+
throw new Error('Shared vault operation unsupported');
|
|
101
|
+
});
|
|
102
|
+
vault.hook('postAction', () => { scopeContext.enterWith(undefined); });
|
|
103
|
+
vault.command('scopes').description('discover authorized shared vault scopes').action(async () => {
|
|
104
|
+
try {
|
|
105
|
+
process.stdout.write(JSON.stringify(await request('/v1/vault/scopes'), null, 2) + "\n");
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
console.error('Vault scope discovery failed');
|
|
109
|
+
process.exitCode = 1;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
vault.command('secret-copy-preview').requiredOption('--name <name>').requiredOption('--destination-scope <scope>', 'org:<id>, team:<id>, or personal').requiredOption('--destination-name <name>').requiredOption('--if-match <revision>').requiredOption('--request-id <id>').action(async (options) => {
|
|
113
|
+
try {
|
|
114
|
+
process.stdout.write(JSON.stringify(managementMetadata(await request('/v1/vault/secret-transfers/preview', { name: options.name, destinationScope: options.destinationScope === 'personal' ? null : validVaultScope(options.destinationScope), destinationName: options.destinationName, expectedRevision: Number(options.ifMatch), requestId: options.requestId, mode: 'copy' }))) + '\n');
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
console.error('Secret copy preview failed; recover or replay the same request ID in the original scope.');
|
|
118
|
+
process.exitCode = 1;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
vault.command('secret-copy').requiredOption('--operation-id <id>').option('--action <action>', 'status, commit, or cancel', 'status').action(async (options) => {
|
|
122
|
+
try {
|
|
123
|
+
if (!/^[a-f0-9-]{36}$/.test(options.operationId) || !['status', 'commit', 'cancel'].includes(options.action))
|
|
124
|
+
throw Error('Invalid operation');
|
|
125
|
+
const suffix = options.action === 'status' ? '' : '/' + options.action;
|
|
126
|
+
process.stdout.write(JSON.stringify(managementMetadata(await request('/v1/vault/secret-transfers/' + options.operationId + suffix, undefined, options.action === 'status' ? 'GET' : 'POST'))) + '\n');
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
console.error('Secret copy outcome unavailable; recover the same operation in the original scope.');
|
|
130
|
+
process.exitCode = 1;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
vault.command('secret-copy-recover').requiredOption('--request-id <id>').action(async (options) => { try {
|
|
134
|
+
if (!/^[A-Za-z0-9_-]{1,128}$/.test(options.requestId))
|
|
135
|
+
throw Error('Invalid request');
|
|
136
|
+
process.stdout.write(JSON.stringify(managementMetadata(await request('/v1/vault/secret-transfer-requests/' + options.requestId))) + '\n');
|
|
137
|
+
}
|
|
138
|
+
catch {
|
|
139
|
+
console.error('Secret copy recovery unavailable');
|
|
140
|
+
process.exitCode = 1;
|
|
141
|
+
} });
|
|
142
|
+
for (const name of ['capabilities', 'audit'])
|
|
143
|
+
vault.command(name).action(async () => { try {
|
|
144
|
+
process.stdout.write(JSON.stringify(managementMetadata(await request('/v1/vault/' + name))) + '\n');
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
console.error('Vault metadata unavailable');
|
|
148
|
+
process.exitCode = 1;
|
|
149
|
+
} });
|
|
150
|
+
vault.command('policy').option('--export <boolean>', 'true or false').option('--if-match <revision>').option('--request-id <id>').action(async (options) => { try {
|
|
151
|
+
if (options.export !== undefined && (!['true', 'false'].includes(options.export) || !/^\d+$/.test(options.ifMatch ?? '') || !options.requestId))
|
|
152
|
+
throw Error('Invalid policy');
|
|
153
|
+
process.stdout.write(JSON.stringify(managementMetadata(await request('/v1/vault/policy', options.export === undefined ? undefined : { exportEnabled: options.export === 'true', expectedRevision: Number(options.ifMatch), requestId: options.requestId }, options.export === undefined ? 'GET' : 'PUT'))) + '\n');
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
console.error('Vault policy operation unavailable; reconcile the original request ID.');
|
|
157
|
+
process.exitCode = 1;
|
|
158
|
+
} });
|
|
159
|
+
registerVaultKms(vault);
|
|
160
|
+
registerVaultImport(vault);
|
|
161
|
+
registerVaultCloud(vault);
|
|
162
|
+
registerTerraformState(vault);
|
|
163
|
+
registerVaultOtp(vault);
|
|
164
|
+
registerHostBindings(vault);
|
|
165
|
+
registerHostSupersessions(vault);
|
|
166
|
+
registerRotation(vault);
|
|
167
|
+
registerPasswordVerification(vault);
|
|
168
|
+
registerPasswordRotations(vault);
|
|
169
|
+
registerSshSync(vault);
|
|
170
|
+
registerVaultMutations(vault);
|
|
171
|
+
registerVaultKeys(vault);
|
|
172
|
+
registerPassCommands(vault, invocationPrefix);
|
|
173
|
+
vault.command("get").requiredOption("-n, --name <selector>", "entry path or path.field (repeatable)", (value, previous) => [...previous, value], [])
|
|
174
|
+
.option("-p, --prefix <prefix>", "vault path prefix", collectPrefix)
|
|
175
|
+
.option("--to-json", "emit JSON")
|
|
176
|
+
.option("--to-envs", "emit POSIX shell exports")
|
|
177
|
+
.option("--env-prefix <prefix>", "prefix for emitted environment names")
|
|
178
|
+
.action(async (options, command) => {
|
|
179
|
+
try {
|
|
180
|
+
if (options.toJson && options.toEnvs)
|
|
181
|
+
throw new Error("Choose --to-json or --to-envs");
|
|
182
|
+
if (options.envPrefix && !options.toEnvs)
|
|
183
|
+
throw new Error("--env-prefix requires --to-envs");
|
|
184
|
+
const selectors = options.name.map((name) => resolveSelector(name, invocationPrefix(command)));
|
|
185
|
+
validateOutputRequest(selectors, options);
|
|
186
|
+
const result = await request("/v1/vault/entries/read", { selectors: selectors.map((selector) => selector.includes("=") ? selector.split("=")[1] : selector) });
|
|
187
|
+
const output = formatEntries(result.entries, selectors, options);
|
|
188
|
+
process.stdout.write(output);
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
console.error(error instanceof Error ? error.message : "Vault request failed");
|
|
192
|
+
process.exitCode = 1;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
collectionList(vault, "list").option("-p, --prefix <prefix>", "vault path prefix", collectPrefix)
|
|
196
|
+
.option("--limit <count>", "return one metadata page (1–200)")
|
|
197
|
+
.option("--cursor <cursor>", "continue one metadata page")
|
|
198
|
+
.option("--include-deleted", "include retired metadata (owner only)")
|
|
199
|
+
.option("--tree", "browse owner-only prefix policy metadata")
|
|
200
|
+
.option("--preview-key <ref>", "explicit key reference for read-only selected-prefix preview (press p)")
|
|
201
|
+
.option("--to-json", "emit metadata JSON instead of the interactive terminal view")
|
|
202
|
+
.action(async (options, command) => {
|
|
203
|
+
try {
|
|
204
|
+
const prefix = invocationPrefix(command);
|
|
205
|
+
if (prefix)
|
|
206
|
+
resolveSelector("probe", prefix);
|
|
207
|
+
if (options.tree) {
|
|
208
|
+
if (options.includeDeleted)
|
|
209
|
+
throw Error("Tree does not support --include-deleted");
|
|
210
|
+
await showTree(prefix, options);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (options.previewKey)
|
|
214
|
+
throw Error("Tree options require --tree");
|
|
215
|
+
const result = await listEntries(prefix, options);
|
|
216
|
+
const selected = interactiveList(!!options.toJson) ? await showList(result, prefix) : result;
|
|
217
|
+
if (selected)
|
|
218
|
+
process.stdout.write(JSON.stringify(selected, null, 2) + "\n");
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
221
|
+
console.error("Vault listing failed");
|
|
222
|
+
process.exitCode = 1;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
export declare function durationSeconds(value: string, maximum?: number): number;
|
|
3
|
+
export declare function keyMetadata(value: any): Record<string, unknown>;
|
|
4
|
+
export declare function issuanceMetadata(result: any, requestId: string): Record<string, unknown>;
|
|
5
|
+
export declare function registerVaultKeys(vault: Command): void;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { collectionList } from "../collection-list.js";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { closeSync, openSync, writeFileSync, fsyncSync, unlinkSync, fstatSync, lstatSync } from "node:fs";
|
|
4
|
+
import { collectPrefix, invocationPrefix, request } from "./index.js";
|
|
5
|
+
import { resolveSelector } from "./format.js";
|
|
6
|
+
export function durationSeconds(value, maximum = Number.MAX_SAFE_INTEGER) {
|
|
7
|
+
const match = /^([1-9][0-9]*)(s|m|h|d)?$/.exec(value);
|
|
8
|
+
const seconds = match ? Number(match[1]) * ({ s: 1, m: 60, h: 3600, d: 86400 }[match[2] ?? "s"] ?? 1) : NaN;
|
|
9
|
+
if (!Number.isSafeInteger(seconds) || seconds > maximum)
|
|
10
|
+
throw new Error("Invalid TTL");
|
|
11
|
+
return seconds;
|
|
12
|
+
}
|
|
13
|
+
export function keyMetadata(value) {
|
|
14
|
+
const invalid = () => { throw new Error("Invalid vault key response"); };
|
|
15
|
+
if (!value || typeof value !== "object" || typeof value.id !== "string" || !/^[a-f0-9-]{36}$/.test(value.id) || !Array.isArray(value.scopes))
|
|
16
|
+
return invalid();
|
|
17
|
+
for (const scope of value.scopes) {
|
|
18
|
+
if (!scope || typeof scope.name !== "string" || typeof scope.entryId !== "string" || !/^[a-f0-9-]{36}$/.test(scope.entryId) || !(scope.fields === null || Array.isArray(scope.fields) && scope.fields.every((field) => typeof field === "string" && /^[A-Za-z0-9_-]+$/.test(field))))
|
|
19
|
+
return invalid();
|
|
20
|
+
resolveSelector(scope.name);
|
|
21
|
+
}
|
|
22
|
+
if (value.requestId != null && (typeof value.requestId !== "string" || !/^[A-Za-z0-9_-]{1,128}$/.test(value.requestId)))
|
|
23
|
+
return invalid();
|
|
24
|
+
if (typeof value.createdAt !== "string" || typeof value.expiresAt !== "string")
|
|
25
|
+
return invalid();
|
|
26
|
+
for (const field of ["createdAt", "expiresAt", "renewUntil", "consumedAt", "revokedAt"])
|
|
27
|
+
if (value[field] !== null && (typeof value[field] !== "string" || !/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d+)?Z$/.test(value[field])))
|
|
28
|
+
return invalid();
|
|
29
|
+
if (!Number.isSafeInteger(value.maxTtlSeconds) || value.maxTtlSeconds < 1 || typeof value.renewable !== "boolean" || typeof value.oneTime !== "boolean")
|
|
30
|
+
return invalid();
|
|
31
|
+
return Object.fromEntries(["id", "requestId", "scopes", "createdAt", "expiresAt", "maxTtlSeconds", "renewable", "renewUntil", "oneTime", "consumedAt", "revokedAt"].map(key => [key, key === "scopes" ? value.scopes.map((s) => ({ name: s.name, entryId: s.entryId, fields: s.fields })) : value[key]]));
|
|
32
|
+
}
|
|
33
|
+
export function issuanceMetadata(result, requestId) {
|
|
34
|
+
const metadata = keyMetadata(result?.key);
|
|
35
|
+
if (metadata.requestId !== requestId || typeof result.replayed !== "boolean" || (result.tokenUnavailable === true && result.token !== undefined) || (result.replayed && result.tokenUnavailable !== true))
|
|
36
|
+
throw new Error("Invalid vault key response");
|
|
37
|
+
return metadata;
|
|
38
|
+
}
|
|
39
|
+
function keyId(id) {
|
|
40
|
+
if (!/^[a-f0-9-]{36}$/.test(id))
|
|
41
|
+
throw new Error("Invalid key ID");
|
|
42
|
+
return id;
|
|
43
|
+
}
|
|
44
|
+
export function registerVaultKeys(vault) {
|
|
45
|
+
const keys = vault.command("keys").description("issue and manage scoped vault retrieval keys")
|
|
46
|
+
.option("-p, --prefix <prefix>", "vault path prefix", collectPrefix);
|
|
47
|
+
keys.command("create")
|
|
48
|
+
.option("-n, --name <selector>", "entry or field scope (repeatable)", (v, p) => [...p, v], [])
|
|
49
|
+
.option("--credential <selector>", "entry or field scope (repeatable alias)", (v, p) => [...p, v], [])
|
|
50
|
+
.option("-p, --prefix <prefix>", "vault path prefix", collectPrefix)
|
|
51
|
+
.requiredOption("--ttl <duration>", "initial expiry: seconds or suffix s/m/h/d; server policy sets maximum")
|
|
52
|
+
.option("--renewable", "permit renewal while active within original TTL")
|
|
53
|
+
.option("--one-time", "allow one successful batch retrieval")
|
|
54
|
+
.option("--max-lifetime <duration>", "absolute renewal lifetime; omitted permits ongoing renewal")
|
|
55
|
+
.option("--request-id <id>", "stable issuance ID for safe retry; default generates one")
|
|
56
|
+
.option("--token-file <path>", "write token into a new private file (never overwrite)")
|
|
57
|
+
.option("--to-stdout", "explicitly emit raw bearer token for piping; do not log output")
|
|
58
|
+
.action(async (options, command) => {
|
|
59
|
+
const requestId = options.requestId ?? randomUUID();
|
|
60
|
+
let fd;
|
|
61
|
+
let createdFile = false;
|
|
62
|
+
let issued = false;
|
|
63
|
+
let fileIdentity;
|
|
64
|
+
try {
|
|
65
|
+
if (typeof requestId !== "string" || !/^[A-Za-z0-9_-]{1,128}$/.test(requestId))
|
|
66
|
+
throw new Error("Invalid request ID");
|
|
67
|
+
if (!!options.tokenFile === !!options.toStdout)
|
|
68
|
+
throw new Error("Choose --token-file or --to-stdout");
|
|
69
|
+
if (options.renewable && options.oneTime)
|
|
70
|
+
throw new Error("One-time keys cannot renew");
|
|
71
|
+
const selectors = [...options.name, ...options.credential].map(name => resolveSelector(name, invocationPrefix(command)));
|
|
72
|
+
if (!selectors.length || selectors.some(s => s.includes("=")))
|
|
73
|
+
throw new Error("Provide entry or field scopes without output aliases");
|
|
74
|
+
const ttlSeconds = durationSeconds(options.ttl);
|
|
75
|
+
const maxLifetimeSeconds = options.maxLifetime === undefined ? undefined : durationSeconds(options.maxLifetime, 2147483647);
|
|
76
|
+
if (maxLifetimeSeconds !== undefined && (!options.renewable || maxLifetimeSeconds < ttlSeconds))
|
|
77
|
+
throw new Error("Invalid maximum lifetime");
|
|
78
|
+
if (options.tokenFile) {
|
|
79
|
+
fd = openSync(options.tokenFile, "wx", 0o600);
|
|
80
|
+
createdFile = true;
|
|
81
|
+
fileIdentity = fstatSync(fd);
|
|
82
|
+
}
|
|
83
|
+
const result = await request("/v1/vault/keys", { selectors, ttlSeconds, renewable: !!options.renewable, oneTime: !!options.oneTime, ...(maxLifetimeSeconds === undefined ? {} : { maxLifetimeSeconds }) }, "POST", undefined, { "Idempotency-Key": requestId });
|
|
84
|
+
issued = true;
|
|
85
|
+
const metadata = issuanceMetadata(result, requestId);
|
|
86
|
+
if (result.replayed === true && result.tokenUnavailable === true) {
|
|
87
|
+
if (fd !== undefined) {
|
|
88
|
+
closeSync(fd);
|
|
89
|
+
fd = undefined;
|
|
90
|
+
}
|
|
91
|
+
if (createdFile && fileIdentity) {
|
|
92
|
+
const current = lstatSync(options.tokenFile);
|
|
93
|
+
if (current.dev === fileIdentity.dev && current.ino === fileIdentity.ino)
|
|
94
|
+
unlinkSync(options.tokenFile);
|
|
95
|
+
createdFile = false;
|
|
96
|
+
}
|
|
97
|
+
console.error(JSON.stringify({ key: metadata, replayed: true, tokenUnavailable: true }));
|
|
98
|
+
console.error("Original token cannot be recovered. Revoke this key and issue with a new request ID if delivery was lost.");
|
|
99
|
+
process.exitCode = 3;
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (typeof result.token !== "string" || !/^dlv1_[A-Za-z0-9_-]{43}$/.test(result.token))
|
|
103
|
+
throw new Error("Invalid vault key response");
|
|
104
|
+
if (fd !== undefined) {
|
|
105
|
+
writeFileSync(fd, result.token);
|
|
106
|
+
fsyncSync(fd);
|
|
107
|
+
closeSync(fd);
|
|
108
|
+
fd = undefined;
|
|
109
|
+
createdFile = false;
|
|
110
|
+
process.stdout.write(JSON.stringify(metadata, null, 2) + "\n");
|
|
111
|
+
}
|
|
112
|
+
else
|
|
113
|
+
process.stdout.write(result.token);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
if (fd !== undefined) {
|
|
117
|
+
try {
|
|
118
|
+
closeSync(fd);
|
|
119
|
+
}
|
|
120
|
+
catch { }
|
|
121
|
+
}
|
|
122
|
+
if (createdFile && fileIdentity) {
|
|
123
|
+
try {
|
|
124
|
+
const current = lstatSync(options.tokenFile);
|
|
125
|
+
if (current.dev === fileIdentity.dev && current.ino === fileIdentity.ino)
|
|
126
|
+
unlinkSync(options.tokenFile);
|
|
127
|
+
}
|
|
128
|
+
catch { }
|
|
129
|
+
}
|
|
130
|
+
const safe = error instanceof Error && /^(Invalid TTL|Invalid request ID|Invalid maximum lifetime|Choose --token-file or --to-stdout|One-time keys cannot renew|Provide entry or field scopes without output aliases|Invalid vault selector|Invalid vault prefix|Conflicting prefixes|Vault request failed \(HTTP [0-9]+\))$/.test(error.message) ? error.message : "Vault key creation failed";
|
|
131
|
+
console.error(issued ? "Vault key provisioning failed; a key may exist. List and revoke it before retrying." : `${safe}. Check options, authentication and destination; if a request was sent, its outcome may be unknown.`);
|
|
132
|
+
console.error(`Issuance request ID: ${/^[A-Za-z0-9_-]{1,128}$/.test(requestId) ? requestId : "invalid"}`);
|
|
133
|
+
process.exitCode = 1;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
collectionList(keys, "list").action(async () => {
|
|
137
|
+
try {
|
|
138
|
+
const result = await request("/v1/vault/keys");
|
|
139
|
+
if (!Array.isArray(result.keys))
|
|
140
|
+
throw new Error();
|
|
141
|
+
const output = result.keys.map(keyMetadata);
|
|
142
|
+
process.stdout.write(JSON.stringify({ keys: output }, null, 2) + "\n");
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
console.error("Vault key listing failed");
|
|
146
|
+
process.exitCode = 1;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
for (const operation of ["renew", "revoke"]) {
|
|
150
|
+
const command = keys.command(operation).requiredOption("--id <id>", "key ID, never the bearer token");
|
|
151
|
+
if (operation === "renew")
|
|
152
|
+
command.requiredOption("--ttl <duration>", "renewal duration within original TTL");
|
|
153
|
+
command.action(async (options) => {
|
|
154
|
+
try {
|
|
155
|
+
const id = keyId(options.id);
|
|
156
|
+
const result = operation === "renew" ? await request(`/v1/vault/keys/${id}/renew`, { ttlSeconds: durationSeconds(options.ttl) }) : await request(`/v1/vault/keys/${id}`, undefined, "DELETE");
|
|
157
|
+
process.stdout.write(JSON.stringify(keyMetadata(result.key), null, 2) + "\n");
|
|
158
|
+
}
|
|
159
|
+
catch {
|
|
160
|
+
console.error("Vault key operation failed");
|
|
161
|
+
process.exitCode = 1;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
/** Metadata-only allowlist: unexpected server fields never reach console output. */
|
|
3
|
+
export declare function kmsView(value: any, operation?: boolean): Record<string, unknown>;
|
|
4
|
+
export declare function kmsMigrationView(value: any): Record<string, unknown>;
|
|
5
|
+
export declare function kmsReadView(value: unknown, prefix: string, keyRef?: string, affectedLimit?: number): Record<string, unknown>;
|
|
6
|
+
export declare function registerVaultKms(vault: Command): void;
|