@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,407 @@
|
|
|
1
|
+
import { collectionList } from "../collection-list.js";
|
|
2
|
+
import { gql } from "../graphql.js";
|
|
3
|
+
import { resolveOrg, resolveTeam, resolveUserId } from "../graphql-helpers.js";
|
|
4
|
+
import { emitJson, fail, ok, renderTable } from "../helpers.js";
|
|
5
|
+
import { confirm } from "../prompt.js";
|
|
6
|
+
function normalizeRole(raw) {
|
|
7
|
+
if (!raw)
|
|
8
|
+
return undefined;
|
|
9
|
+
const v = raw.toLowerCase();
|
|
10
|
+
if (v === "maintainer")
|
|
11
|
+
return "MAINTAINER";
|
|
12
|
+
if (v === "member")
|
|
13
|
+
return "MEMBER";
|
|
14
|
+
throw new Error(`--role must be 'maintainer' or 'member', got '${raw}'`);
|
|
15
|
+
}
|
|
16
|
+
function normalizeVisibility(raw) {
|
|
17
|
+
if (!raw)
|
|
18
|
+
return undefined;
|
|
19
|
+
const v = raw.toLowerCase();
|
|
20
|
+
if (v === "visible")
|
|
21
|
+
return "VISIBLE";
|
|
22
|
+
if (v === "secret")
|
|
23
|
+
return "SECRET";
|
|
24
|
+
throw new Error(`--visibility must be 'visible' or 'secret', got '${raw}'`);
|
|
25
|
+
}
|
|
26
|
+
// ─── list ────────────────────────────────────────────────────────────
|
|
27
|
+
export async function runTeamList(orgSlug, opts) {
|
|
28
|
+
try {
|
|
29
|
+
let teams;
|
|
30
|
+
if (orgSlug) {
|
|
31
|
+
const org = await resolveOrg(orgSlug);
|
|
32
|
+
if (!org) {
|
|
33
|
+
fail(`organization '${orgSlug}' not found`);
|
|
34
|
+
return 1;
|
|
35
|
+
}
|
|
36
|
+
const data = await gql(`query($orgId:ID!){ organizationTeams(orgId:$orgId){ slug name visibility } }`, { orgId: org.id });
|
|
37
|
+
teams = data.organizationTeams ?? [];
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const data = await gql(`query{ myTeams{ slug name visibility org{ slug } } }`);
|
|
41
|
+
teams = data.myTeams ?? [];
|
|
42
|
+
}
|
|
43
|
+
if (opts.json) {
|
|
44
|
+
emitJson(teams);
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
process.stdout.write(orgSlug ? `Teams in ${orgSlug}\n\n` : "My teams\n\n");
|
|
48
|
+
if (teams.length === 0) {
|
|
49
|
+
process.stdout.write(" (none)\n");
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
const rows = teams.map((t) => ({
|
|
53
|
+
slug: t.slug,
|
|
54
|
+
name: t.name,
|
|
55
|
+
visibility: t.visibility ?? "",
|
|
56
|
+
...(orgSlug ? {} : { org: t.org?.slug ?? "" }),
|
|
57
|
+
}));
|
|
58
|
+
const cols = orgSlug ? ["slug", "name", "visibility"] : ["slug", "name", "visibility", "org"];
|
|
59
|
+
process.stdout.write(renderTable(rows, cols));
|
|
60
|
+
process.stdout.write(`\n ${teams.length} team(s)\n`);
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
fail(err.message);
|
|
65
|
+
return 1;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// ─── show ────────────────────────────────────────────────────────────
|
|
69
|
+
export async function runTeamShow(orgSlug, teamSlug, opts) {
|
|
70
|
+
try {
|
|
71
|
+
const ref = await resolveTeam(orgSlug, teamSlug);
|
|
72
|
+
if (!ref) {
|
|
73
|
+
fail(`team '${teamSlug}' not found in ${orgSlug}`);
|
|
74
|
+
return 1;
|
|
75
|
+
}
|
|
76
|
+
const data = await gql(`query($id:ID!){ team(id:$id){
|
|
77
|
+
slug name description visibility myRole
|
|
78
|
+
parent{ slug name } children{ slug name }
|
|
79
|
+
members{ role user{ name email slug } }
|
|
80
|
+
} }`, { id: ref.id });
|
|
81
|
+
const team = data.team;
|
|
82
|
+
if (!team) {
|
|
83
|
+
fail(`team '${teamSlug}' not found`);
|
|
84
|
+
return 1;
|
|
85
|
+
}
|
|
86
|
+
if (opts.json) {
|
|
87
|
+
emitJson(team);
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
90
|
+
process.stdout.write(`Team: ${team.name} (${orgSlug}/${team.slug})\n`);
|
|
91
|
+
process.stdout.write(` visibility: ${team.visibility ?? ""}\n`);
|
|
92
|
+
process.stdout.write(` your role: ${team.myRole ?? "(not a member)"}\n`);
|
|
93
|
+
if (team.description)
|
|
94
|
+
process.stdout.write(` description: ${team.description}\n`);
|
|
95
|
+
if (team.parent)
|
|
96
|
+
process.stdout.write(` parent: ${team.parent.slug}\n`);
|
|
97
|
+
if (team.children?.length) {
|
|
98
|
+
process.stdout.write(` children: ${team.children.map((c) => c.slug).join(", ")}\n`);
|
|
99
|
+
}
|
|
100
|
+
process.stdout.write(`\n Members (${team.members?.length ?? 0}):\n`);
|
|
101
|
+
const rows = (team.members ?? []).map((m) => ({
|
|
102
|
+
role: m.role,
|
|
103
|
+
name: m.user?.name ?? "",
|
|
104
|
+
email: m.user?.email ?? "",
|
|
105
|
+
namespace: m.user?.slug ?? "",
|
|
106
|
+
}));
|
|
107
|
+
process.stdout.write(rows.length ? renderTable(rows, ["role", "name", "email", "namespace"]) : " (none)\n");
|
|
108
|
+
return 0;
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
fail(err.message);
|
|
112
|
+
return 1;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// ─── create / update / delete / leave ────────────────────────────────
|
|
116
|
+
export async function runTeamCreate(orgSlug, teamSlug, opts) {
|
|
117
|
+
try {
|
|
118
|
+
const visibility = normalizeVisibility(opts.visibility);
|
|
119
|
+
const org = await resolveOrg(orgSlug);
|
|
120
|
+
if (!org) {
|
|
121
|
+
fail(`organization '${orgSlug}' not found`);
|
|
122
|
+
return 1;
|
|
123
|
+
}
|
|
124
|
+
let parentId;
|
|
125
|
+
if (opts.parent) {
|
|
126
|
+
const parent = await resolveTeam(orgSlug, opts.parent);
|
|
127
|
+
if (!parent) {
|
|
128
|
+
fail(`parent team '${opts.parent}' not found in ${orgSlug}`);
|
|
129
|
+
return 1;
|
|
130
|
+
}
|
|
131
|
+
parentId = parent.id;
|
|
132
|
+
}
|
|
133
|
+
const input = {
|
|
134
|
+
orgId: org.id,
|
|
135
|
+
slug: teamSlug,
|
|
136
|
+
name: opts.name ?? teamSlug,
|
|
137
|
+
};
|
|
138
|
+
if (opts.description)
|
|
139
|
+
input.description = opts.description;
|
|
140
|
+
if (visibility)
|
|
141
|
+
input.visibility = visibility;
|
|
142
|
+
if (parentId)
|
|
143
|
+
input.parentId = parentId;
|
|
144
|
+
await gql(`mutation($input:TeamCreateInput!){ teamCreate(input:$input){ id slug } }`, { input });
|
|
145
|
+
ok(`Created team: ${teamSlug} in ${orgSlug}`);
|
|
146
|
+
process.stdout.write(` you are now MAINTAINER\n`);
|
|
147
|
+
if (opts.parent)
|
|
148
|
+
process.stdout.write(` parent: ${opts.parent}\n`);
|
|
149
|
+
return 0;
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
fail(err.message);
|
|
153
|
+
return 1;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export async function runTeamUpdate(orgSlug, teamSlug, opts) {
|
|
157
|
+
try {
|
|
158
|
+
const visibility = normalizeVisibility(opts.visibility);
|
|
159
|
+
if (opts.name === undefined && opts.description === undefined && visibility === undefined) {
|
|
160
|
+
fail("nothing to update. use --name, --description, or --visibility");
|
|
161
|
+
return 1;
|
|
162
|
+
}
|
|
163
|
+
const ref = await resolveTeam(orgSlug, teamSlug);
|
|
164
|
+
if (!ref) {
|
|
165
|
+
fail(`team '${teamSlug}' not found in ${orgSlug}`);
|
|
166
|
+
return 1;
|
|
167
|
+
}
|
|
168
|
+
const input = {};
|
|
169
|
+
if (opts.name !== undefined)
|
|
170
|
+
input.name = opts.name;
|
|
171
|
+
if (opts.description !== undefined)
|
|
172
|
+
input.description = opts.description;
|
|
173
|
+
if (visibility !== undefined)
|
|
174
|
+
input.visibility = visibility;
|
|
175
|
+
await gql(`mutation($id:ID!,$input:TeamUpdateInput!){ teamUpdate(id:$id, input:$input){ id } }`, { id: ref.id, input });
|
|
176
|
+
ok(`Updated team: ${orgSlug}/${teamSlug}`);
|
|
177
|
+
return 0;
|
|
178
|
+
}
|
|
179
|
+
catch (err) {
|
|
180
|
+
fail(err.message);
|
|
181
|
+
return 1;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
export async function runTeamDelete(orgSlug, teamSlug, opts) {
|
|
185
|
+
try {
|
|
186
|
+
const ref = await resolveTeam(orgSlug, teamSlug);
|
|
187
|
+
if (!ref) {
|
|
188
|
+
fail(`team '${teamSlug}' not found in ${orgSlug}`);
|
|
189
|
+
return 1;
|
|
190
|
+
}
|
|
191
|
+
if (!opts.yes) {
|
|
192
|
+
const proceed = await confirm(`Delete team '${orgSlug}/${teamSlug}'? (must have no child teams)`, false);
|
|
193
|
+
if (!proceed) {
|
|
194
|
+
process.stdout.write("Cancelled.\n");
|
|
195
|
+
return 0;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
await gql(`mutation($id:ID!){ teamDelete(id:$id) }`, { id: ref.id });
|
|
199
|
+
ok(`Deleted team: ${orgSlug}/${teamSlug}`);
|
|
200
|
+
return 0;
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
fail(err.message);
|
|
204
|
+
return 1;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
export async function runTeamLeave(orgSlug, teamSlug, opts) {
|
|
208
|
+
try {
|
|
209
|
+
const ref = await resolveTeam(orgSlug, teamSlug);
|
|
210
|
+
if (!ref) {
|
|
211
|
+
fail(`team '${teamSlug}' not found in ${orgSlug}`);
|
|
212
|
+
return 1;
|
|
213
|
+
}
|
|
214
|
+
if (!opts.yes) {
|
|
215
|
+
const proceed = await confirm(`Leave team '${orgSlug}/${teamSlug}'?`, false);
|
|
216
|
+
if (!proceed) {
|
|
217
|
+
process.stdout.write("Cancelled.\n");
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
await gql(`mutation($id:ID!){ teamMemberLeave(teamId:$id) }`, { id: ref.id });
|
|
222
|
+
ok(`Left team: ${orgSlug}/${teamSlug}`);
|
|
223
|
+
return 0;
|
|
224
|
+
}
|
|
225
|
+
catch (err) {
|
|
226
|
+
fail(err.message);
|
|
227
|
+
return 1;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// ─── member subcommands ──────────────────────────────────────────────
|
|
231
|
+
export async function runTeamMemberList(orgSlug, teamSlug, opts) {
|
|
232
|
+
try {
|
|
233
|
+
const ref = await resolveTeam(orgSlug, teamSlug);
|
|
234
|
+
if (!ref) {
|
|
235
|
+
fail(`team '${teamSlug}' not found in ${orgSlug}`);
|
|
236
|
+
return 1;
|
|
237
|
+
}
|
|
238
|
+
const data = await gql(`query($id:ID!){ teamMembers(teamId:$id){ role joinedAt user{ name email slug } } }`, { id: ref.id });
|
|
239
|
+
const members = data.teamMembers ?? [];
|
|
240
|
+
if (opts.json) {
|
|
241
|
+
emitJson(members);
|
|
242
|
+
return 0;
|
|
243
|
+
}
|
|
244
|
+
process.stdout.write(`Members of ${orgSlug}/${teamSlug}\n\n`);
|
|
245
|
+
const rows = members.map((m) => ({
|
|
246
|
+
role: m.role,
|
|
247
|
+
name: m.user?.name ?? "",
|
|
248
|
+
email: m.user?.email ?? "",
|
|
249
|
+
namespace: m.user?.slug ?? "",
|
|
250
|
+
joined: String(m.joinedAt ?? "").slice(0, 10),
|
|
251
|
+
}));
|
|
252
|
+
process.stdout.write(rows.length ? renderTable(rows, ["role", "name", "email", "namespace", "joined"]) : " (none)\n");
|
|
253
|
+
process.stdout.write(`\n ${members.length} member(s)\n`);
|
|
254
|
+
return 0;
|
|
255
|
+
}
|
|
256
|
+
catch (err) {
|
|
257
|
+
fail(err.message);
|
|
258
|
+
return 1;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
export async function runTeamMemberAdd(orgSlug, teamSlug, user, opts) {
|
|
262
|
+
try {
|
|
263
|
+
const role = normalizeRole(opts.role);
|
|
264
|
+
const ref = await resolveTeam(orgSlug, teamSlug);
|
|
265
|
+
if (!ref) {
|
|
266
|
+
fail(`team '${teamSlug}' not found in ${orgSlug}`);
|
|
267
|
+
return 1;
|
|
268
|
+
}
|
|
269
|
+
const userId = await resolveUserId(user);
|
|
270
|
+
await gql(`mutation($teamId:ID!,$userId:ID!,$role:TeamRole){
|
|
271
|
+
teamMemberAdd(teamId:$teamId, userId:$userId, role:$role){ id } }`, { teamId: ref.id, userId, role: role ?? null });
|
|
272
|
+
ok(`Added ${user} to ${orgSlug}/${teamSlug} as ${role ?? "MEMBER"}`);
|
|
273
|
+
return 0;
|
|
274
|
+
}
|
|
275
|
+
catch (err) {
|
|
276
|
+
fail(err.message);
|
|
277
|
+
return 1;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
export async function runTeamMemberRole(orgSlug, teamSlug, user, opts) {
|
|
281
|
+
try {
|
|
282
|
+
const role = normalizeRole(opts.role);
|
|
283
|
+
if (!role) {
|
|
284
|
+
fail("--role is required (maintainer|member)");
|
|
285
|
+
return 1;
|
|
286
|
+
}
|
|
287
|
+
const ref = await resolveTeam(orgSlug, teamSlug);
|
|
288
|
+
if (!ref) {
|
|
289
|
+
fail(`team '${teamSlug}' not found in ${orgSlug}`);
|
|
290
|
+
return 1;
|
|
291
|
+
}
|
|
292
|
+
const userId = await resolveUserId(user);
|
|
293
|
+
await gql(`mutation($teamId:ID!,$userId:ID!,$role:TeamRole!){
|
|
294
|
+
teamMemberUpdateRole(teamId:$teamId, userId:$userId, role:$role){ id } }`, { teamId: ref.id, userId, role });
|
|
295
|
+
ok(`Set ${user}'s role in ${orgSlug}/${teamSlug} to ${role}`);
|
|
296
|
+
return 0;
|
|
297
|
+
}
|
|
298
|
+
catch (err) {
|
|
299
|
+
fail(err.message);
|
|
300
|
+
return 1;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
export async function runTeamMemberRemove(orgSlug, teamSlug, user, opts) {
|
|
304
|
+
try {
|
|
305
|
+
const ref = await resolveTeam(orgSlug, teamSlug);
|
|
306
|
+
if (!ref) {
|
|
307
|
+
fail(`team '${teamSlug}' not found in ${orgSlug}`);
|
|
308
|
+
return 1;
|
|
309
|
+
}
|
|
310
|
+
const userId = await resolveUserId(user);
|
|
311
|
+
if (!opts.yes) {
|
|
312
|
+
const proceed = await confirm(`Remove ${user} from ${orgSlug}/${teamSlug}?`, false);
|
|
313
|
+
if (!proceed) {
|
|
314
|
+
process.stdout.write("Cancelled.\n");
|
|
315
|
+
return 0;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
await gql(`mutation($teamId:ID!,$userId:ID!){ teamMemberRemove(teamId:$teamId, userId:$userId) }`, { teamId: ref.id, userId });
|
|
319
|
+
ok(`Removed ${user} from ${orgSlug}/${teamSlug}`);
|
|
320
|
+
return 0;
|
|
321
|
+
}
|
|
322
|
+
catch (err) {
|
|
323
|
+
fail(err.message);
|
|
324
|
+
return 1;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
// ─── registration ────────────────────────────────────────────────────
|
|
328
|
+
export function registerTeamCommand(program) {
|
|
329
|
+
const team = program.command("team").description("manage teams within an organization");
|
|
330
|
+
collectionList(team, "list")
|
|
331
|
+
.description("list teams in an org, or all teams you belong to (omit <org>)")
|
|
332
|
+
.argument("[org]", "organization slug (omit to list your own teams)")
|
|
333
|
+
.option("--json", "emit JSON")
|
|
334
|
+
.action(async (org, opts) => process.exit(await runTeamList(org, opts)));
|
|
335
|
+
team
|
|
336
|
+
.command("show")
|
|
337
|
+
.description("show a team with its members and sub-teams")
|
|
338
|
+
.argument("<org>", "organization slug")
|
|
339
|
+
.argument("<team>", "team slug")
|
|
340
|
+
.option("--json", "emit JSON")
|
|
341
|
+
.action(async (org, t, opts) => process.exit(await runTeamShow(org, t, opts)));
|
|
342
|
+
team
|
|
343
|
+
.command("create")
|
|
344
|
+
.description("create a team in an organization (you become MAINTAINER)")
|
|
345
|
+
.argument("<org>", "organization slug")
|
|
346
|
+
.argument("<team>", "team slug (3-40 chars, lowercase/hyphens)")
|
|
347
|
+
.option("--name <text>", "display name (default: slug)")
|
|
348
|
+
.option("--description <text>", "description")
|
|
349
|
+
.option("--visibility <vis>", "visible|secret (default: visible)")
|
|
350
|
+
.option("--parent <team>", "parent team slug (for nesting)")
|
|
351
|
+
.action(async (org, t, opts) => process.exit(await runTeamCreate(org, t, opts)));
|
|
352
|
+
team
|
|
353
|
+
.command("update")
|
|
354
|
+
.description("update a team's name / description / visibility")
|
|
355
|
+
.argument("<org>", "organization slug")
|
|
356
|
+
.argument("<team>", "team slug")
|
|
357
|
+
.option("--name <text>", "new display name")
|
|
358
|
+
.option("--description <text>", "new description")
|
|
359
|
+
.option("--visibility <vis>", "visible|secret")
|
|
360
|
+
.action(async (org, t, opts) => process.exit(await runTeamUpdate(org, t, opts)));
|
|
361
|
+
team
|
|
362
|
+
.command("delete")
|
|
363
|
+
.description("delete a team (must have no child teams)")
|
|
364
|
+
.argument("<org>", "organization slug")
|
|
365
|
+
.argument("<team>", "team slug")
|
|
366
|
+
.option("--yes", "skip the confirmation prompt")
|
|
367
|
+
.action(async (org, t, opts) => process.exit(await runTeamDelete(org, t, opts)));
|
|
368
|
+
team
|
|
369
|
+
.command("leave")
|
|
370
|
+
.description("leave a team (last maintainer must promote someone first)")
|
|
371
|
+
.argument("<org>", "organization slug")
|
|
372
|
+
.argument("<team>", "team slug")
|
|
373
|
+
.option("--yes", "skip the confirmation prompt")
|
|
374
|
+
.action(async (org, t, opts) => process.exit(await runTeamLeave(org, t, opts)));
|
|
375
|
+
// ── members ──
|
|
376
|
+
const member = team.command("member").description("manage team members");
|
|
377
|
+
collectionList(member, "list")
|
|
378
|
+
.description("list members of a team")
|
|
379
|
+
.argument("<org>", "organization slug")
|
|
380
|
+
.argument("<team>", "team slug")
|
|
381
|
+
.option("--json", "emit JSON")
|
|
382
|
+
.action(async (org, t, opts) => process.exit(await runTeamMemberList(org, t, opts)));
|
|
383
|
+
member
|
|
384
|
+
.command("add")
|
|
385
|
+
.description("add a user to a team (added to the org too if needed)")
|
|
386
|
+
.argument("<org>", "organization slug")
|
|
387
|
+
.argument("<team>", "team slug")
|
|
388
|
+
.argument("<user>", "user email or name")
|
|
389
|
+
.option("--role <role>", "maintainer|member (default: member)")
|
|
390
|
+
.action(async (org, t, user, opts) => process.exit(await runTeamMemberAdd(org, t, user, opts)));
|
|
391
|
+
member
|
|
392
|
+
.command("role")
|
|
393
|
+
.description("change a team member's role")
|
|
394
|
+
.argument("<org>", "organization slug")
|
|
395
|
+
.argument("<team>", "team slug")
|
|
396
|
+
.argument("<user>", "user email or name")
|
|
397
|
+
.requiredOption("--role <role>", "maintainer|member")
|
|
398
|
+
.action(async (org, t, user, opts) => process.exit(await runTeamMemberRole(org, t, user, opts)));
|
|
399
|
+
member
|
|
400
|
+
.command("remove")
|
|
401
|
+
.description("remove a member from a team")
|
|
402
|
+
.argument("<org>", "organization slug")
|
|
403
|
+
.argument("<team>", "team slug")
|
|
404
|
+
.argument("<user>", "user email or name")
|
|
405
|
+
.option("--yes", "skip the confirmation prompt")
|
|
406
|
+
.action(async (org, t, user, opts) => process.exit(await runTeamMemberRemove(org, t, user, opts)));
|
|
407
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
export declare function telemetryEnabled(env?: NodeJS.ProcessEnv, dir?: string): boolean;
|
|
3
|
+
export declare function setTelemetry(enabled: boolean, dir?: string): void;
|
|
4
|
+
export declare function telemetryHeaders(): Record<string, string>;
|
|
5
|
+
export declare function configureTelemetryCommand(command: Command): void;
|
|
6
|
+
/** Cover direct fetch paths as well as the common client, only at our API origin. */
|
|
7
|
+
export declare function installTelemetryOptOut(): void;
|
|
8
|
+
export declare function registerTelemetryCommand(program: Command): void;
|
|
9
|
+
export declare function commandPath(command: Command): string;
|
|
10
|
+
export interface Completion {
|
|
11
|
+
uuid: string;
|
|
12
|
+
timestamp: string;
|
|
13
|
+
command: string;
|
|
14
|
+
version: string;
|
|
15
|
+
platform: string;
|
|
16
|
+
exit_code: number;
|
|
17
|
+
duration_ms: number;
|
|
18
|
+
}
|
|
19
|
+
/** Bind queued records to their original API and account, without storing a credential. */
|
|
20
|
+
export declare function telemetryScope(remote: string, token: string): string;
|
|
21
|
+
export declare function startCommandTelemetry(command: string): void;
|
|
22
|
+
/** Retry in a detached process with a bounded lifetime. Each event triggers an attempt. */
|
|
23
|
+
export declare function deliverTelemetry(scope: string): Promise<void>;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync, openSync, closeSync, fsyncSync, unlinkSync, statSync } from 'node:fs';
|
|
2
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
3
|
+
import { TelemetryJournal } from './telemetryJournal.js';
|
|
4
|
+
import { spawn } from 'node:child_process';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
7
|
+
import { dreamlakeDir } from './auth/materialized.js';
|
|
8
|
+
import { LOCAL_REMOTE, resolveRemote, resolveToken } from './config.js';
|
|
9
|
+
import { VERSION } from './version.js';
|
|
10
|
+
export function telemetryEnabled(env = process.env, dir = dreamlakeDir()) {
|
|
11
|
+
if (/^(0|false|off)$/i.test(env.DREAMLAKE_TELEMETRY ?? '') || env.DO_NOT_TRACK === '1')
|
|
12
|
+
return false;
|
|
13
|
+
try {
|
|
14
|
+
const value = JSON.parse(readFileSync(path.join(dir, 'telemetry.json'), 'utf8'));
|
|
15
|
+
return value.enabled === true;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
return error.code === 'ENOENT';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function setTelemetry(enabled, dir = dreamlakeDir()) {
|
|
22
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
23
|
+
const target = path.join(dir, 'telemetry.json');
|
|
24
|
+
const tmp = `${target}.${process.pid}.tmp`;
|
|
25
|
+
const fd = openSync(tmp, 'w', 0o600);
|
|
26
|
+
try {
|
|
27
|
+
writeFileSync(fd, JSON.stringify({ enabled }) + '\n');
|
|
28
|
+
fsyncSync(fd);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
closeSync(fd);
|
|
32
|
+
}
|
|
33
|
+
renameSync(tmp, target);
|
|
34
|
+
if (process.platform !== 'win32') {
|
|
35
|
+
const parent = openSync(dir, 'r');
|
|
36
|
+
try {
|
|
37
|
+
fsyncSync(parent);
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
closeSync(parent);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (!enabled)
|
|
44
|
+
new TelemetryJournal(path.join(dir, 'telemetry-events')).clear();
|
|
45
|
+
}
|
|
46
|
+
export function telemetryHeaders() {
|
|
47
|
+
return telemetryEnabled() ? {} : { 'X-DreamLake-Telemetry': 'off' };
|
|
48
|
+
}
|
|
49
|
+
const apiOrigins = new Set();
|
|
50
|
+
export function configureTelemetryCommand(command) {
|
|
51
|
+
const opts = command.optsWithGlobals();
|
|
52
|
+
for (const remote of [opts.url, opts.remote, opts.debug ? LOCAL_REMOTE : undefined]) {
|
|
53
|
+
if (typeof remote === 'string') {
|
|
54
|
+
try {
|
|
55
|
+
apiOrigins.add(new URL(remote).origin);
|
|
56
|
+
}
|
|
57
|
+
catch { }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Explicit one-command credentials/endpoints must not report to a different
|
|
61
|
+
// saved account. The selected API still measures requests unless opted out.
|
|
62
|
+
if (opts.url || opts.remote || opts.token || opts.debug)
|
|
63
|
+
return;
|
|
64
|
+
startCommandTelemetry(commandPath(command));
|
|
65
|
+
}
|
|
66
|
+
/** Cover direct fetch paths as well as the common client, only at our API origin. */
|
|
67
|
+
export function installTelemetryOptOut() {
|
|
68
|
+
try {
|
|
69
|
+
apiOrigins.add(new URL(resolveRemote()).origin);
|
|
70
|
+
}
|
|
71
|
+
catch { /* Machine configuration may be absent. */ }
|
|
72
|
+
const fetchImpl = globalThis.fetch;
|
|
73
|
+
globalThis.fetch = ((input, init) => {
|
|
74
|
+
if (!telemetryEnabled()) {
|
|
75
|
+
try {
|
|
76
|
+
const url = input instanceof Request ? input.url : String(input);
|
|
77
|
+
if (apiOrigins.has(new URL(url).origin)) {
|
|
78
|
+
const headers = new Headers(input instanceof Request ? input.headers : undefined);
|
|
79
|
+
new Headers(init?.headers).forEach((value, key) => headers.set(key, value));
|
|
80
|
+
headers.set('X-DreamLake-Telemetry', 'off');
|
|
81
|
+
init = { ...init, headers };
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch { /* Preserve the original fetch's validation behavior. */ }
|
|
85
|
+
}
|
|
86
|
+
return fetchImpl(input, init);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export function registerTelemetryCommand(program) {
|
|
90
|
+
const command = program.command('telemetry').description('inspect or change product analytics preferences');
|
|
91
|
+
command.command('status').description('show effective telemetry preference')
|
|
92
|
+
.action(() => console.log(telemetryEnabled() ? 'enabled' : 'disabled'));
|
|
93
|
+
for (const enabled of [true, false]) {
|
|
94
|
+
command.command(enabled ? 'enable' : 'disable').description(`${enabled ? 'enable' : 'disable'} product analytics`)
|
|
95
|
+
.option('--quiet', 'save without output').action((opts) => {
|
|
96
|
+
setTelemetry(enabled);
|
|
97
|
+
if (!opts.quiet)
|
|
98
|
+
console.log(telemetryEnabled() ? 'enabled' : 'disabled');
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export function commandPath(command) {
|
|
103
|
+
const parts = [];
|
|
104
|
+
for (let current = command; current?.parent; current = current.parent)
|
|
105
|
+
parts.unshift(current.name());
|
|
106
|
+
return parts.join(' ');
|
|
107
|
+
}
|
|
108
|
+
function journal() { return new TelemetryJournal(path.join(dreamlakeDir(), 'telemetry-events')); }
|
|
109
|
+
/** Bind queued records to their original API and account, without storing a credential. */
|
|
110
|
+
export function telemetryScope(remote, token) {
|
|
111
|
+
let identity = token;
|
|
112
|
+
try {
|
|
113
|
+
const claims = JSON.parse(Buffer.from(token.split('.')[1], 'base64url').toString());
|
|
114
|
+
if (typeof claims.sub === 'string' && claims.sub)
|
|
115
|
+
identity = JSON.stringify([claims.iss ?? '', claims.sub]);
|
|
116
|
+
}
|
|
117
|
+
catch { /* Opaque tokens are scoped by their hash; rotation will expire them after replacement. */ }
|
|
118
|
+
return createHash('sha256').update(JSON.stringify([remote, identity])).digest('hex');
|
|
119
|
+
}
|
|
120
|
+
function destination() {
|
|
121
|
+
const token = resolveToken();
|
|
122
|
+
if (!token)
|
|
123
|
+
return;
|
|
124
|
+
const url = new URL(resolveRemote());
|
|
125
|
+
if (url.username || url.password || url.search || url.hash ||
|
|
126
|
+
(url.protocol !== 'https:' && !(url.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname))))
|
|
127
|
+
return;
|
|
128
|
+
const remote = url.toString().replace(/\/$/, '');
|
|
129
|
+
return { remote, token, scope: telemetryScope(remote, token) };
|
|
130
|
+
}
|
|
131
|
+
function launchUpload(scope) {
|
|
132
|
+
const source = import.meta.url.includes('$bunfs') ? null : fileURLToPath(new URL(import.meta.url.endsWith('.ts') ? './index.ts' : './index.js', import.meta.url));
|
|
133
|
+
const args = source === null ? [] : [
|
|
134
|
+
...(!process.versions.bun && source.endsWith('.ts') ? ['--import', import.meta.resolve('tsx')] : []), source,
|
|
135
|
+
];
|
|
136
|
+
const child = spawn(process.execPath, [...args, '--internal-telemetry', scope], {
|
|
137
|
+
detached: true, stdio: 'ignore', windowsHide: true,
|
|
138
|
+
});
|
|
139
|
+
child.on('error', () => { });
|
|
140
|
+
child.unref();
|
|
141
|
+
}
|
|
142
|
+
export function startCommandTelemetry(command) {
|
|
143
|
+
if (!telemetryEnabled()) {
|
|
144
|
+
try {
|
|
145
|
+
journal().clear();
|
|
146
|
+
}
|
|
147
|
+
catch { }
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (command.startsWith('telemetry') || command.startsWith('self-update'))
|
|
151
|
+
return;
|
|
152
|
+
let scope;
|
|
153
|
+
try {
|
|
154
|
+
const target = destination();
|
|
155
|
+
if (!target)
|
|
156
|
+
return;
|
|
157
|
+
scope = target.scope;
|
|
158
|
+
// Retry old records even if the current command is long-running.
|
|
159
|
+
if (journal().pending(scope).length)
|
|
160
|
+
launchUpload(scope);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const start = performance.now();
|
|
166
|
+
process.once('exit', code => {
|
|
167
|
+
try {
|
|
168
|
+
if (!telemetryEnabled()) {
|
|
169
|
+
journal().clear();
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const event = { uuid: randomUUID(), timestamp: new Date().toISOString(), command, version: VERSION,
|
|
173
|
+
platform: ['linux', 'darwin', 'win32'].includes(process.platform) ? process.platform : 'other',
|
|
174
|
+
exit_code: Math.max(0, Math.min(255, code)),
|
|
175
|
+
duration_ms: Math.min(604800000, Math.max(0, Math.round(performance.now() - start))) };
|
|
176
|
+
// Synchronous local commit is required here: Node cannot await exit handlers.
|
|
177
|
+
journal().append(scope, event);
|
|
178
|
+
launchUpload(scope);
|
|
179
|
+
}
|
|
180
|
+
catch { /* Disk/network failure must not alter the command result or output. */ }
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
/** Retry in a detached process with a bounded lifetime. Each event triggers an attempt. */
|
|
184
|
+
export async function deliverTelemetry(scope) {
|
|
185
|
+
let lock;
|
|
186
|
+
const owner = randomUUID();
|
|
187
|
+
try {
|
|
188
|
+
if (!telemetryEnabled()) {
|
|
189
|
+
journal().clear();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const target = destination();
|
|
193
|
+
if (!target || target.scope !== scope)
|
|
194
|
+
return;
|
|
195
|
+
const records = journal();
|
|
196
|
+
if (!records.pending(scope).length)
|
|
197
|
+
return;
|
|
198
|
+
lock = path.join(records.dir, 'uploader.lock');
|
|
199
|
+
try {
|
|
200
|
+
if (Date.now() - statSync(lock).mtimeMs > 30000)
|
|
201
|
+
unlinkSync(lock);
|
|
202
|
+
}
|
|
203
|
+
catch { }
|
|
204
|
+
try {
|
|
205
|
+
const fd = openSync(lock, 'wx', 0o600);
|
|
206
|
+
try {
|
|
207
|
+
writeFileSync(fd, owner);
|
|
208
|
+
}
|
|
209
|
+
finally {
|
|
210
|
+
closeSync(fd);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch {
|
|
214
|
+
lock = undefined;
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const deadline = Date.now() + 8000;
|
|
218
|
+
// Rescan after batches to include events appended while this worker is running.
|
|
219
|
+
while (Date.now() < deadline) {
|
|
220
|
+
const pending = records.pending(scope);
|
|
221
|
+
if (!pending.length)
|
|
222
|
+
break;
|
|
223
|
+
let progressed = false;
|
|
224
|
+
for (const record of pending) {
|
|
225
|
+
if (!telemetryEnabled()) {
|
|
226
|
+
records.clear();
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
if (Date.now() >= deadline || destination()?.scope !== scope)
|
|
230
|
+
return;
|
|
231
|
+
const parsed = record.payload;
|
|
232
|
+
const { uuid, timestamp, command, version, platform, exit_code, duration_ms } = parsed;
|
|
233
|
+
if (!/^[0-9a-f-]{36}$/i.test(uuid) || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/.test(timestamp) || !Number.isFinite(Date.parse(timestamp)) ||
|
|
234
|
+
typeof command !== 'string' || !/^[a-z][a-z0-9-]*( [a-z][a-z0-9-]*){0,5}$/.test(command) || command.length > 120 ||
|
|
235
|
+
!/^\d+\.\d+\.\d+([-.][a-zA-Z0-9.-]+)?$/.test(version) || version.length > 40 ||
|
|
236
|
+
!['linux', 'darwin', 'win32', 'other'].includes(platform) || !Number.isInteger(exit_code) || exit_code < 0 || exit_code > 255 ||
|
|
237
|
+
!Number.isInteger(duration_ms) || duration_ms < 0 || duration_ms > 604800000)
|
|
238
|
+
continue;
|
|
239
|
+
const response = await fetch(`${target.remote}/telemetry/events`, {
|
|
240
|
+
method: 'POST', redirect: 'error', signal: AbortSignal.timeout(Math.min(1500, Math.max(1, deadline - Date.now()))),
|
|
241
|
+
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${target.token}` },
|
|
242
|
+
body: JSON.stringify({ uuid, timestamp, command, version, platform, exit_code, duration_ms }),
|
|
243
|
+
});
|
|
244
|
+
await response.body?.cancel();
|
|
245
|
+
if (response.status !== 204)
|
|
246
|
+
return; // Keep pending until the collector acknowledges persistence.
|
|
247
|
+
records.acknowledge(record.file);
|
|
248
|
+
progressed = true;
|
|
249
|
+
}
|
|
250
|
+
if (!progressed)
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
catch { /* Offline records stay pending; a later event retries them. */ }
|
|
255
|
+
finally {
|
|
256
|
+
try {
|
|
257
|
+
if (lock && readFileSync(lock, 'utf8') === owner)
|
|
258
|
+
unlinkSync(lock);
|
|
259
|
+
}
|
|
260
|
+
catch { }
|
|
261
|
+
}
|
|
262
|
+
}
|