@dreamlake/dreamlake-cli 0.88.0 → 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,534 @@
|
|
|
1
|
+
// Asset discovery for `dreamlake library push` — the half of the authoring
|
|
2
|
+
// model that turns a plain directory into a list of assets, before any hash
|
|
3
|
+
// or network I/O.
|
|
4
|
+
//
|
|
5
|
+
// The pipeline: walk the tree (dot-segments and `discover.exclude` pruned) →
|
|
6
|
+
// pick asset roots (yml `discover.assets` globs, else conventions: one asset
|
|
7
|
+
// per top-level directory + one per loose top-level file) → overlay
|
|
8
|
+
// dreamlake.yml (explicit file sets, added assets, metadata, entry
|
|
9
|
+
// overrides) → detect kind/entry/entryPoints per asset from the files
|
|
10
|
+
// themselves.
|
|
11
|
+
//
|
|
12
|
+
// The glob dialect is deliberately tiny — `*` (one path segment) and `**`
|
|
13
|
+
// (any depth) only, matched segment-wise. No dependency, no `?`, no
|
|
14
|
+
// character classes: dreamlake.yml is user-authored, and a dialect small
|
|
15
|
+
// enough to state in one sentence beats one that needs a reference manual.
|
|
16
|
+
import { closeSync, openSync, readSync, readdirSync } from "node:fs";
|
|
17
|
+
import path from "node:path";
|
|
18
|
+
import { ASSET_ID_RE, DREAMLAKE_YML } from "./config.js";
|
|
19
|
+
// ─── the glob matcher ─────────────────────────────────────────────────
|
|
20
|
+
const SEGMENT_RE_CACHE = new Map();
|
|
21
|
+
/** One pattern segment → an anchored regex; `*` matches any run of
|
|
22
|
+
* non-separator characters. Everything else is literal. */
|
|
23
|
+
function segmentRe(seg) {
|
|
24
|
+
let re = SEGMENT_RE_CACHE.get(seg);
|
|
25
|
+
if (!re) {
|
|
26
|
+
const source = seg
|
|
27
|
+
.split("*")
|
|
28
|
+
.map((lit) => lit.replace(/[.+^${}()|[\]\\?]/g, "\\$&"))
|
|
29
|
+
.join("[^/]*");
|
|
30
|
+
re = new RegExp(`^${source}$`);
|
|
31
|
+
SEGMENT_RE_CACHE.set(seg, re);
|
|
32
|
+
}
|
|
33
|
+
return re;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Segment-wise glob match: `*` spans one segment (or part of one), a bare
|
|
37
|
+
* `**` segment spans any number of segments, zero included. Trailing `/` on
|
|
38
|
+
* the pattern (directory spelling) is ignored. Anchored — the pattern must
|
|
39
|
+
* account for the whole path.
|
|
40
|
+
*/
|
|
41
|
+
export function matchLibraryGlob(pattern, relPath) {
|
|
42
|
+
const pat = pattern.replace(/\/+$/, "").split("/").filter((s) => s !== "");
|
|
43
|
+
const segs = relPath.split("/").filter((s) => s !== "");
|
|
44
|
+
return segsMatch(pat, 0, segs, 0);
|
|
45
|
+
}
|
|
46
|
+
function segsMatch(pat, pi, segs, si) {
|
|
47
|
+
if (pi === pat.length)
|
|
48
|
+
return si === segs.length;
|
|
49
|
+
const head = pat[pi];
|
|
50
|
+
if (head === "**") {
|
|
51
|
+
for (let skip = si; skip <= segs.length; skip++) {
|
|
52
|
+
if (segsMatch(pat, pi + 1, segs, skip))
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
if (si === segs.length)
|
|
58
|
+
return false;
|
|
59
|
+
if (!segmentRe(head).test(segs[si]))
|
|
60
|
+
return false;
|
|
61
|
+
return segsMatch(pat, pi + 1, segs, si + 1);
|
|
62
|
+
}
|
|
63
|
+
/** Whether a path — or any of its ancestor directories — matches one of the
|
|
64
|
+
* patterns. Matching an ancestor prunes the subtree wholesale, the way an
|
|
65
|
+
* ignore rule for a directory is expected to behave. */
|
|
66
|
+
export function isExcluded(relPath, patterns) {
|
|
67
|
+
if (patterns.length === 0)
|
|
68
|
+
return false;
|
|
69
|
+
const segs = relPath.split("/");
|
|
70
|
+
for (let end = 1; end <= segs.length; end++) {
|
|
71
|
+
const prefix = segs.slice(0, end).join("/");
|
|
72
|
+
for (const p of patterns) {
|
|
73
|
+
if (matchLibraryGlob(p, prefix))
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
// ─── the walk ─────────────────────────────────────────────────────────
|
|
80
|
+
/**
|
|
81
|
+
* Every regular file under `root`, as sorted POSIX-relative paths.
|
|
82
|
+
*
|
|
83
|
+
* Skipped, always: any path with a dot-leading segment (`.git`, `.DS_Store`,
|
|
84
|
+
* a stray `.dreamlake/` from an old pull) and `dreamlake.yml` itself (it is
|
|
85
|
+
* handled by name, not by discovery); plus everything `exclude` prunes.
|
|
86
|
+
* Symlinks are skipped too — a link out of the tree would upload bytes the
|
|
87
|
+
* closure never declared.
|
|
88
|
+
*/
|
|
89
|
+
export function walkUserFiles(root, exclude = []) {
|
|
90
|
+
const out = [];
|
|
91
|
+
const visit = (relDir) => {
|
|
92
|
+
const absDir = relDir === "" ? root : path.join(root, relDir);
|
|
93
|
+
for (const ent of readdirSync(absDir, { withFileTypes: true })) {
|
|
94
|
+
if (ent.name.startsWith("."))
|
|
95
|
+
continue;
|
|
96
|
+
const rel = relDir === "" ? ent.name : `${relDir}/${ent.name}`;
|
|
97
|
+
if (rel === DREAMLAKE_YML)
|
|
98
|
+
continue;
|
|
99
|
+
if (isExcluded(rel, exclude))
|
|
100
|
+
continue;
|
|
101
|
+
if (ent.isDirectory())
|
|
102
|
+
visit(rel);
|
|
103
|
+
else if (ent.isFile())
|
|
104
|
+
out.push(rel);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
visit("");
|
|
108
|
+
out.sort();
|
|
109
|
+
return out;
|
|
110
|
+
}
|
|
111
|
+
// ─── kind + entry detection ───────────────────────────────────────────
|
|
112
|
+
const SNIFF_HEAD_BYTES = 4096;
|
|
113
|
+
const SNIFF_BODY_BYTES = 2 * 1024 * 1024;
|
|
114
|
+
const MESH_EXTS = new Set(["glb", "gltf", "obj", "stl"]);
|
|
115
|
+
const SPLAT_EXTS = new Set(["ply", "splat", "spz", "ksplat"]);
|
|
116
|
+
const IMAGE_EXTS = new Set(["png", "jpg", "jpeg", "webp"]);
|
|
117
|
+
function ext(rel) {
|
|
118
|
+
const base = rel.slice(rel.lastIndexOf("/") + 1);
|
|
119
|
+
const dot = base.lastIndexOf(".");
|
|
120
|
+
return dot <= 0 ? "" : base.slice(dot + 1).toLowerCase();
|
|
121
|
+
}
|
|
122
|
+
function stem(rel) {
|
|
123
|
+
const base = rel.slice(rel.lastIndexOf("/") + 1);
|
|
124
|
+
const dot = base.lastIndexOf(".");
|
|
125
|
+
return dot <= 0 ? base : base.slice(0, dot);
|
|
126
|
+
}
|
|
127
|
+
function readSlice(absPath, maxBytes) {
|
|
128
|
+
const fd = openSync(absPath, "r");
|
|
129
|
+
try {
|
|
130
|
+
const buf = Buffer.alloc(maxBytes);
|
|
131
|
+
const n = readSync(fd, buf, 0, maxBytes, 0);
|
|
132
|
+
return buf.subarray(0, n).toString("utf8");
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
closeSync(fd);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// ─── compressed splats (PlayCanvas SOG) ───────────────────────────────
|
|
139
|
+
// A SOG asset is a DIRECTORY, not a file: meta.json plus a set of WebP
|
|
140
|
+
// planes. SOG-LOD wraps that — lod-meta.json at the root, one full SOG set
|
|
141
|
+
// per node subdirectory. Neither has a single "the model" file, which is why
|
|
142
|
+
// the single-file kind rules below cannot see them at all.
|
|
143
|
+
const SOG_LOD_META = "lod-meta.json";
|
|
144
|
+
const SOG_META = "meta.json";
|
|
145
|
+
// The planes every SOG variant carries. `means` is split across a low and a
|
|
146
|
+
// high byte plane; the spherical-harmonics pair (shN_centroids/shN_labels) is
|
|
147
|
+
// optional, so it is NOT part of the signature.
|
|
148
|
+
const SOG_REQUIRED_PLANES = ["means_l.webp", "means_u.webp"];
|
|
149
|
+
/**
|
|
150
|
+
* Whether `meta.json`'s content is a splat-transform SOG descriptor.
|
|
151
|
+
*
|
|
152
|
+
* Mirrors the MJCF `<mujoco` sniff: `meta.json` is far too common a name to
|
|
153
|
+
* claim on filename alone, so the bytes have to agree. The splat-transform
|
|
154
|
+
* shape is an object with a `means` descriptor naming its own plane files.
|
|
155
|
+
*/
|
|
156
|
+
function looksLikeSogMeta(absPath) {
|
|
157
|
+
let parsed;
|
|
158
|
+
try {
|
|
159
|
+
parsed = JSON.parse(readSlice(absPath, SNIFF_BODY_BYTES));
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return false; // unreadable, truncated, or not JSON at all
|
|
163
|
+
}
|
|
164
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
165
|
+
return false;
|
|
166
|
+
const means = parsed.means;
|
|
167
|
+
if (typeof means !== "object" || means === null)
|
|
168
|
+
return false;
|
|
169
|
+
return Array.isArray(means.files);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* SOG / SOG-LOD detection from the asset's own files.
|
|
173
|
+
*
|
|
174
|
+
* Only files directly AT the asset root count: a SOG-LOD's per-node
|
|
175
|
+
* `meta.json` files live one level down and must not make the parent look
|
|
176
|
+
* like a plain SOG, and a library that merely happens to contain a
|
|
177
|
+
* `meta.json` somewhere deep is not a splat.
|
|
178
|
+
*/
|
|
179
|
+
function detectSplatContainer(srcDir, assetRoot, files) {
|
|
180
|
+
const prefix = assetRoot === "" ? "" : `${assetRoot}/`;
|
|
181
|
+
const atRoot = new Set();
|
|
182
|
+
for (const f of files) {
|
|
183
|
+
if (!f.startsWith(prefix))
|
|
184
|
+
continue;
|
|
185
|
+
const rel = f.slice(prefix.length);
|
|
186
|
+
if (!rel.includes("/"))
|
|
187
|
+
atRoot.add(rel);
|
|
188
|
+
}
|
|
189
|
+
// LOD first: an LOD root also holds no planes of its own, and its manifest
|
|
190
|
+
// name is distinctive enough to take at face value.
|
|
191
|
+
if (atRoot.has(SOG_LOD_META)) {
|
|
192
|
+
return { kind: "splat", format: "lod", entry: `${prefix}${SOG_LOD_META}` };
|
|
193
|
+
}
|
|
194
|
+
if (!atRoot.has(SOG_META))
|
|
195
|
+
return null;
|
|
196
|
+
if (!SOG_REQUIRED_PLANES.every((p) => atRoot.has(p)))
|
|
197
|
+
return null;
|
|
198
|
+
if (!looksLikeSogMeta(path.join(srcDir, `${prefix}${SOG_META}`)))
|
|
199
|
+
return null;
|
|
200
|
+
return { kind: "splat", format: "sog", entry: `${prefix}${SOG_META}` };
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Kind, entry and (for MJCF) entryPoints from the files alone.
|
|
204
|
+
*
|
|
205
|
+
* The MJCF heuristics mirror the Python importer's:
|
|
206
|
+
* - an `.xml` whose head contains `<mujoco` is an MJCF model;
|
|
207
|
+
* - entryPoints = every ASSET-ROOT-level MJCF that also looks standalone-
|
|
208
|
+
* compilable (a `<worldbody` or `<include` in the body), kind `scene`
|
|
209
|
+
* when the stem starts with "scene", else `robot`;
|
|
210
|
+
* - entry prefers a scene* file, then falls back to the first model xml.
|
|
211
|
+
*
|
|
212
|
+
* Compressed splats are recognized as DIRECTORIES (see
|
|
213
|
+
* `detectSplatContainer`) before the single-file rules run — a SOG asset has
|
|
214
|
+
* no one "model" file for those rules to elect.
|
|
215
|
+
*
|
|
216
|
+
* `assetRoot` is the asset's directory prefix relative to the source root
|
|
217
|
+
* ("" for a loose single-file asset); `files` are source-root-relative.
|
|
218
|
+
*/
|
|
219
|
+
export function detectAssetShape(srcDir, assetRoot, files) {
|
|
220
|
+
const xmls = files.filter((f) => ext(f) === "xml");
|
|
221
|
+
const heads = new Map();
|
|
222
|
+
const head = (f) => {
|
|
223
|
+
let h = heads.get(f);
|
|
224
|
+
if (h === undefined) {
|
|
225
|
+
try {
|
|
226
|
+
h = readSlice(path.join(srcDir, f), SNIFF_HEAD_BYTES);
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
h = "";
|
|
230
|
+
}
|
|
231
|
+
heads.set(f, h);
|
|
232
|
+
}
|
|
233
|
+
return h;
|
|
234
|
+
};
|
|
235
|
+
const mjcf = xmls.filter((f) => head(f).includes("<mujoco"));
|
|
236
|
+
if (mjcf.length > 0) {
|
|
237
|
+
const prefix = assetRoot === "" ? "" : `${assetRoot}/`;
|
|
238
|
+
const topLevel = mjcf.filter((f) => f.startsWith(prefix) && !f.slice(prefix.length).includes("/"));
|
|
239
|
+
const entryPoints = {};
|
|
240
|
+
for (const f of topLevel) {
|
|
241
|
+
let body;
|
|
242
|
+
try {
|
|
243
|
+
body = readSlice(path.join(srcDir, f), SNIFF_BODY_BYTES);
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
if (!body.includes("<worldbody") && !body.includes("<include"))
|
|
249
|
+
continue;
|
|
250
|
+
entryPoints[stem(f)] = {
|
|
251
|
+
kind: stem(f).startsWith("scene") ? "scene" : "robot",
|
|
252
|
+
file: f,
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
// Entry: a scene among the compilable top-level files first, then any
|
|
256
|
+
// scene-named model xml, then the first model xml.
|
|
257
|
+
const compilable = Object.values(entryPoints).map((ep) => ep.file);
|
|
258
|
+
const pool = compilable.length > 0 ? compilable : mjcf;
|
|
259
|
+
const entry = pool.find((f) => stem(f).startsWith("scene")) ?? pool[0];
|
|
260
|
+
return {
|
|
261
|
+
kind: "mjcf",
|
|
262
|
+
entry,
|
|
263
|
+
...(Object.keys(entryPoints).length > 0 ? { entryPoints } : {}),
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
const urdfs = files.filter((f) => ext(f) === "urdf");
|
|
267
|
+
const robotXml = urdfs.length === 0 ? xmls.find((f) => head(f).includes("<robot")) : undefined;
|
|
268
|
+
if (urdfs.length > 0 || robotXml) {
|
|
269
|
+
return { kind: "urdf", entry: urdfs[0] ?? robotXml };
|
|
270
|
+
}
|
|
271
|
+
// Multi-file splat directories (SOG / SOG-LOD): before `single()`, which by
|
|
272
|
+
// construction cannot match a set of WebP planes.
|
|
273
|
+
const splatDir = detectSplatContainer(srcDir, assetRoot, files);
|
|
274
|
+
if (splatDir)
|
|
275
|
+
return splatDir;
|
|
276
|
+
// Note on the single-file rules: the ext sets are disjoint, and each is
|
|
277
|
+
// counted on its own, so a shipped thumbnail/preview image never spoils a
|
|
278
|
+
// model's count (one .ply + thumbnail.png is still a splat). Only two files
|
|
279
|
+
// of the SAME family leave the entry ambiguous.
|
|
280
|
+
const single = (exts) => {
|
|
281
|
+
const hits = files.filter((f) => exts.has(ext(f)));
|
|
282
|
+
return hits.length === 1 ? hits[0] : null;
|
|
283
|
+
};
|
|
284
|
+
const mesh = single(MESH_EXTS);
|
|
285
|
+
if (mesh)
|
|
286
|
+
return { kind: "mesh", entry: mesh };
|
|
287
|
+
const splat = single(SPLAT_EXTS);
|
|
288
|
+
if (splat)
|
|
289
|
+
return { kind: "splat", entry: splat };
|
|
290
|
+
const image = single(IMAGE_EXTS);
|
|
291
|
+
if (image)
|
|
292
|
+
return { kind: "image", entry: image };
|
|
293
|
+
return { kind: "file" };
|
|
294
|
+
}
|
|
295
|
+
// ─── shipped thumbnails ───────────────────────────────────────────────
|
|
296
|
+
// A thumbnail the user made alongside the model: an image at the asset's
|
|
297
|
+
// ROOT directory named thumbnail.<ext> or preview.<ext>. Priority is
|
|
298
|
+
// name-major, extension-minor, exactly this order; matching is
|
|
299
|
+
// case-insensitive.
|
|
300
|
+
const SHIPPED_THUMBNAIL_STEMS = ["thumbnail", "preview"];
|
|
301
|
+
const SHIPPED_THUMBNAIL_EXTS = ["png", "jpg", "jpeg", "webp"];
|
|
302
|
+
/**
|
|
303
|
+
* The asset's shipped thumbnail, if it ships one: the first (by the priority
|
|
304
|
+
* order above) of the asset's OWN files that sits directly at `assetRoot`
|
|
305
|
+
* and is named `thumbnail.<ext>` / `preview.<ext>`, case-insensitively.
|
|
306
|
+
*
|
|
307
|
+
* Only `files` — the asset's closure — is consulted, never the directory
|
|
308
|
+
* itself: a single-file asset or an explicit yml `files:` set only gets a
|
|
309
|
+
* shipped thumbnail it actually contains.
|
|
310
|
+
*/
|
|
311
|
+
export function findShippedThumbnail(assetRoot, files) {
|
|
312
|
+
const prefix = assetRoot === "" ? "" : `${assetRoot}/`;
|
|
313
|
+
const atRoot = files.filter((f) => f.startsWith(prefix) && !f.slice(prefix.length).includes("/"));
|
|
314
|
+
for (const stemName of SHIPPED_THUMBNAIL_STEMS) {
|
|
315
|
+
for (const e of SHIPPED_THUMBNAIL_EXTS) {
|
|
316
|
+
const want = `${stemName}.${e}`;
|
|
317
|
+
const hit = atRoot.find((f) => f.slice(prefix.length).toLowerCase() === want);
|
|
318
|
+
if (hit !== undefined)
|
|
319
|
+
return hit;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return undefined;
|
|
323
|
+
}
|
|
324
|
+
function idError(id, from) {
|
|
325
|
+
throw new Error(`asset id '${id}' (from ${from}) is not a valid id — ids must match ` +
|
|
326
|
+
`^[a-zA-Z0-9][a-zA-Z0-9._-]{0,127}$. Rename it, or declare the asset ` +
|
|
327
|
+
`under a valid id in ${DREAMLAKE_YML} with an explicit files list.`);
|
|
328
|
+
}
|
|
329
|
+
/** Resolve one yml `files:` entry (glob or exact path) against the walked
|
|
330
|
+
* universe. An exact path that matches nothing is a typo and refused. */
|
|
331
|
+
function resolveFileSpecs(id, specs, universe) {
|
|
332
|
+
const picked = new Set();
|
|
333
|
+
for (const spec of specs) {
|
|
334
|
+
if (spec.includes("*")) {
|
|
335
|
+
for (const f of universe) {
|
|
336
|
+
if (matchLibraryGlob(spec, f))
|
|
337
|
+
picked.add(f);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
const clean = spec.replace(/^\.\//, "");
|
|
342
|
+
if (!universe.includes(clean)) {
|
|
343
|
+
throw new Error(`${DREAMLAKE_YML}: assets['${id}'].files names '${spec}' but no such file exists ` +
|
|
344
|
+
`in the source directory (or it is excluded)`);
|
|
345
|
+
}
|
|
346
|
+
picked.add(clean);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (picked.size === 0) {
|
|
350
|
+
throw new Error(`${DREAMLAKE_YML}: assets['${id}'].files matched no files`);
|
|
351
|
+
}
|
|
352
|
+
return [...picked].sort();
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* The full discovery pass: conventions/globs → yml overlay → detection.
|
|
356
|
+
* Returns assets sorted by id. Throws with actionable messages on bad ids,
|
|
357
|
+
* duplicate ids, empty matches and dangling references.
|
|
358
|
+
*/
|
|
359
|
+
export function discoverAssets(srcDir, yml) {
|
|
360
|
+
const exclude = yml?.discover?.exclude ?? [];
|
|
361
|
+
const universe = walkUserFiles(srcDir, exclude);
|
|
362
|
+
// 1) asset roots. Map id → {root, files} where root "" means a loose file.
|
|
363
|
+
const roots = new Map();
|
|
364
|
+
const claim = (id, from, root, files) => {
|
|
365
|
+
if (!ASSET_ID_RE.test(id))
|
|
366
|
+
idError(id, from);
|
|
367
|
+
const prev = roots.get(id);
|
|
368
|
+
if (prev) {
|
|
369
|
+
throw new Error(`duplicate asset id '${id}' (${from}) — declare distinct ids in ${DREAMLAKE_YML}`);
|
|
370
|
+
}
|
|
371
|
+
roots.set(id, { root, files });
|
|
372
|
+
};
|
|
373
|
+
const dirPatterns = yml?.discover?.assets;
|
|
374
|
+
if (dirPatterns && dirPatterns.length > 0) {
|
|
375
|
+
// Explicit discovery: each glob names asset ROOT DIRECTORIES.
|
|
376
|
+
const dirs = new Set();
|
|
377
|
+
for (const f of universe) {
|
|
378
|
+
const segs = f.split("/");
|
|
379
|
+
for (let end = 1; end < segs.length; end++) {
|
|
380
|
+
dirs.add(segs.slice(0, end).join("/"));
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
const matchedDirs = new Set();
|
|
384
|
+
for (const pattern of dirPatterns) {
|
|
385
|
+
const matched = [...dirs].filter((d) => matchLibraryGlob(pattern, d));
|
|
386
|
+
if (matched.length === 0) {
|
|
387
|
+
throw new Error(`${DREAMLAKE_YML}: discover.assets pattern '${pattern}' matched no directories`);
|
|
388
|
+
}
|
|
389
|
+
for (const d of matched)
|
|
390
|
+
matchedDirs.add(d); // two patterns may overlap — one asset per DIR
|
|
391
|
+
}
|
|
392
|
+
for (const dir of [...matchedDirs].sort()) {
|
|
393
|
+
const files = universe.filter((f) => f.startsWith(`${dir}/`));
|
|
394
|
+
if (files.length === 0)
|
|
395
|
+
continue;
|
|
396
|
+
const id = dir.slice(dir.lastIndexOf("/") + 1);
|
|
397
|
+
claim(id, `directory ${dir}/`, dir, files);
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
// Conventions: each top-level directory = one asset; each loose
|
|
402
|
+
// top-level file (dreamlake.yml excepted — already skipped) = one
|
|
403
|
+
// single-file asset named by its stem.
|
|
404
|
+
const topDirs = new Map();
|
|
405
|
+
const loose = [];
|
|
406
|
+
for (const f of universe) {
|
|
407
|
+
const slash = f.indexOf("/");
|
|
408
|
+
if (slash < 0) {
|
|
409
|
+
loose.push(f);
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
const top = f.slice(0, slash);
|
|
413
|
+
const list = topDirs.get(top);
|
|
414
|
+
if (list)
|
|
415
|
+
list.push(f);
|
|
416
|
+
else
|
|
417
|
+
topDirs.set(top, [f]);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
for (const [dir, files] of [...topDirs.entries()].sort((a, b) => (a[0] < b[0] ? -1 : 1))) {
|
|
421
|
+
claim(dir, `directory ${dir}/`, dir, files);
|
|
422
|
+
}
|
|
423
|
+
for (const f of loose) {
|
|
424
|
+
claim(stem(f), `file ${f}`, "", [f]);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
// 2) yml overlay: explicit file sets override a discovered asset's files
|
|
428
|
+
// or add an asset discovery never saw; metadata merges over defaults.
|
|
429
|
+
const ymlAssets = yml?.assets ?? {};
|
|
430
|
+
for (const [id, spec] of Object.entries(ymlAssets)) {
|
|
431
|
+
if (spec.files && spec.files.length > 0) {
|
|
432
|
+
const files = resolveFileSpecs(id, spec.files, universe);
|
|
433
|
+
if (!ASSET_ID_RE.test(id))
|
|
434
|
+
idError(id, DREAMLAKE_YML);
|
|
435
|
+
const common = commonRoot(files);
|
|
436
|
+
roots.delete(id); // override, not duplicate
|
|
437
|
+
roots.set(id, { root: common, files });
|
|
438
|
+
}
|
|
439
|
+
else if (!roots.has(id)) {
|
|
440
|
+
throw new Error(`${DREAMLAKE_YML}: assets['${id}'] declares metadata but no such asset was ` +
|
|
441
|
+
`discovered — rename the directory/file, or give the asset an explicit files list`);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
if (roots.size === 0) {
|
|
445
|
+
throw new Error(`no assets discovered in ${srcDir} — add files (each top-level directory or loose ` +
|
|
446
|
+
`file becomes an asset), or declare assets in ${DREAMLAKE_YML}`);
|
|
447
|
+
}
|
|
448
|
+
// 3) detection + metadata merge, per asset.
|
|
449
|
+
const defaults = yml?.defaults ?? {};
|
|
450
|
+
const out = [];
|
|
451
|
+
for (const [id, { root, files }] of [...roots.entries()].sort((a, b) => (a[0] < b[0] ? -1 : 1))) {
|
|
452
|
+
const spec = ymlAssets[id] ?? {};
|
|
453
|
+
const fileSet = new Set(files);
|
|
454
|
+
// The user's thumbnail: an explicit yml `thumbnail:` wins; otherwise a
|
|
455
|
+
// shipped thumbnail.<ext>/preview.<ext> at the asset root is picked up
|
|
456
|
+
// automatically. A yml thumbnail may live outside the discovered set (a
|
|
457
|
+
// shared cover image); the server requires membership, so it joins the
|
|
458
|
+
// asset's files. A shipped one is one of the files by construction.
|
|
459
|
+
let thumbnail;
|
|
460
|
+
if (spec.thumbnail) {
|
|
461
|
+
const clean = spec.thumbnail.replace(/^\.\//, "");
|
|
462
|
+
if (!universe.includes(clean)) {
|
|
463
|
+
throw new Error(`${DREAMLAKE_YML}: assets['${id}'].thumbnail '${spec.thumbnail}' is not a file ` +
|
|
464
|
+
`in the source directory`);
|
|
465
|
+
}
|
|
466
|
+
fileSet.add(clean);
|
|
467
|
+
thumbnail = clean;
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
thumbnail = findShippedThumbnail(root, files);
|
|
471
|
+
}
|
|
472
|
+
const finalFiles = [...fileSet].sort();
|
|
473
|
+
const detected = detectAssetShape(srcDir, root, files);
|
|
474
|
+
const entry = spec.entry ? spec.entry.replace(/^\.\//, "") : detected.entry;
|
|
475
|
+
if (entry !== undefined && !fileSet.has(entry)) {
|
|
476
|
+
throw new Error(`${DREAMLAKE_YML}: assets['${id}'].entry '${entry}' is not one of the asset's files`);
|
|
477
|
+
}
|
|
478
|
+
const entryPoints = spec.entryPoints ?? detected.entryPoints;
|
|
479
|
+
if (entryPoints) {
|
|
480
|
+
for (const [name, ep] of Object.entries(entryPoints)) {
|
|
481
|
+
if (!fileSet.has(ep.file)) {
|
|
482
|
+
throw new Error(`${DREAMLAKE_YML}: assets['${id}'].entryPoints['${name}'].file '${ep.file}' ` +
|
|
483
|
+
`is not one of the asset's files`);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
const tags = mergeTags(defaults.tags, spec.tags);
|
|
488
|
+
out.push({
|
|
489
|
+
id,
|
|
490
|
+
files: finalFiles,
|
|
491
|
+
kind: spec.kind ?? detected.kind,
|
|
492
|
+
...(entry !== undefined ? { entry } : {}),
|
|
493
|
+
...(entryPoints && Object.keys(entryPoints).length > 0 ? { entryPoints } : {}),
|
|
494
|
+
...(thumbnail !== undefined ? { thumbnail } : {}),
|
|
495
|
+
...(spec.title ? { title: spec.title } : {}),
|
|
496
|
+
...(spec.description ? { description: spec.description } : {}),
|
|
497
|
+
...(spec.category ?? defaults.category
|
|
498
|
+
? { category: spec.category ?? defaults.category }
|
|
499
|
+
: {}),
|
|
500
|
+
...(tags.length > 0 ? { tags } : {}),
|
|
501
|
+
// yml wins; otherwise the detected sub-format (sog / lod) — the viewer
|
|
502
|
+
// dispatches on it, so it must not stop at discovery.
|
|
503
|
+
...(spec.format ?? detected.format ? { format: spec.format ?? detected.format } : {}),
|
|
504
|
+
...(spec.license ?? defaults.license ? { license: spec.license ?? defaults.license } : {}),
|
|
505
|
+
...(spec.attribution ? { attribution: spec.attribution } : {}),
|
|
506
|
+
...(spec.upstream ? { upstream: spec.upstream } : {}),
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
return out;
|
|
510
|
+
}
|
|
511
|
+
function mergeTags(defaults, own) {
|
|
512
|
+
const out = [];
|
|
513
|
+
for (const t of [...(defaults ?? []), ...(own ?? [])]) {
|
|
514
|
+
if (!out.includes(t))
|
|
515
|
+
out.push(t);
|
|
516
|
+
}
|
|
517
|
+
return out;
|
|
518
|
+
}
|
|
519
|
+
/** Longest shared directory prefix of a file set ("" when none). */
|
|
520
|
+
function commonRoot(files) {
|
|
521
|
+
if (files.length === 0)
|
|
522
|
+
return "";
|
|
523
|
+
let prefix = files[0].split("/").slice(0, -1);
|
|
524
|
+
for (const f of files.slice(1)) {
|
|
525
|
+
const segs = f.split("/").slice(0, -1);
|
|
526
|
+
let i = 0;
|
|
527
|
+
while (i < prefix.length && i < segs.length && prefix[i] === segs[i])
|
|
528
|
+
i++;
|
|
529
|
+
prefix = prefix.slice(0, i);
|
|
530
|
+
if (prefix.length === 0)
|
|
531
|
+
break;
|
|
532
|
+
}
|
|
533
|
+
return prefix.join("/");
|
|
534
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type LibraryManifest } from "./manifest.js";
|
|
2
|
+
export interface RevisionMarker {
|
|
3
|
+
revision: number;
|
|
4
|
+
library: string;
|
|
5
|
+
}
|
|
6
|
+
/** The revision this directory last registered/pulled against, or null. The
|
|
7
|
+
* marker is disposable cache state — corrupt or absent reads as null. */
|
|
8
|
+
export declare function readLastRegisteredRevision(srcDirAbs: string): RevisionMarker | null;
|
|
9
|
+
export declare function writeLastRegisteredRevision(srcDirAbs: string, library: string, revision: number): void;
|
|
10
|
+
export interface StatReport {
|
|
11
|
+
state: "up-to-date" | "stale" | "absent";
|
|
12
|
+
/** Wanted paths with no local file. */
|
|
13
|
+
missing: string[];
|
|
14
|
+
/** Wanted paths present locally with a different sha256. */
|
|
15
|
+
changed: string[];
|
|
16
|
+
/** Bytes a pull would transfer (manifest sizes of missing + changed). */
|
|
17
|
+
bytesNeeded: number;
|
|
18
|
+
/** The wanted closure — count and total manifest bytes. */
|
|
19
|
+
files: {
|
|
20
|
+
count: number;
|
|
21
|
+
bytes: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export interface DiffAgainstManifestArgs {
|
|
25
|
+
manifest: LibraryManifest;
|
|
26
|
+
/** Local directory to compare (a pull output dir). May not exist. */
|
|
27
|
+
rootDir: string;
|
|
28
|
+
/** Restrict to one asset's files[]; unknown id throws, naming the first
|
|
29
|
+
* 20 available ids. */
|
|
30
|
+
assetId?: string;
|
|
31
|
+
/** Bypass the (mtime, size) hash cache and re-hash everything. */
|
|
32
|
+
verify?: boolean;
|
|
33
|
+
cacheFile?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function diffAgainstManifest(args: DiffAgainstManifestArgs): Promise<StatReport>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
// Freshness primitives for `dreamlake library` — the consumer-side twin of
|
|
2
|
+
// the push diff (RFC 0008 §5.5).
|
|
3
|
+
//
|
|
4
|
+
// `diffAgainstManifest` answers "is my local copy current?" with the REMOTE
|
|
5
|
+
// manifest as the source of truth: `missing`/`changed` describe what a pull
|
|
6
|
+
// would fetch. Extra local files are ignored — pull never deletes. This is
|
|
7
|
+
// the same (path, sha256) comparison push makes, pointed the other way.
|
|
8
|
+
//
|
|
9
|
+
// `readLastRegisteredRevision`/`writeLastRegisteredRevision` are the
|
|
10
|
+
// wholesale-push drift guard's marker (RFC 0008 §5.7): push and pull record
|
|
11
|
+
// the revision a source/output directory last agreed with, so a later push
|
|
12
|
+
// can notice the remote moved underneath it before it deletes anything.
|
|
13
|
+
import { existsSync, readFileSync, statSync, writeFileSync, mkdirSync, renameSync } from "node:fs";
|
|
14
|
+
import path from "node:path";
|
|
15
|
+
import { hashFiles, pushCacheDir } from "./cache.js";
|
|
16
|
+
import { isGeneratedPath } from "./pull.js";
|
|
17
|
+
import { manifestFileMap } from "./manifest.js";
|
|
18
|
+
// ─── last-registered-revision marker ─────────────────────────────────────────
|
|
19
|
+
const REVISION_FILE = "revision.json";
|
|
20
|
+
/** The revision this directory last registered/pulled against, or null. The
|
|
21
|
+
* marker is disposable cache state — corrupt or absent reads as null. */
|
|
22
|
+
export function readLastRegisteredRevision(srcDirAbs) {
|
|
23
|
+
try {
|
|
24
|
+
const raw = JSON.parse(readFileSync(path.join(pushCacheDir(srcDirAbs), REVISION_FILE), "utf8"));
|
|
25
|
+
if (typeof raw.revision === "number" &&
|
|
26
|
+
Number.isSafeInteger(raw.revision) &&
|
|
27
|
+
typeof raw.library === "string") {
|
|
28
|
+
return { revision: raw.revision, library: raw.library };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
/* absent or corrupt — the marker is disposable */
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
export function writeLastRegisteredRevision(srcDirAbs, library, revision) {
|
|
37
|
+
const dir = pushCacheDir(srcDirAbs);
|
|
38
|
+
mkdirSync(dir, { recursive: true });
|
|
39
|
+
const file = path.join(dir, REVISION_FILE);
|
|
40
|
+
const tmp = `${file}.${process.pid}.tmp`;
|
|
41
|
+
writeFileSync(tmp, JSON.stringify({ library, revision, at: new Date().toISOString() }));
|
|
42
|
+
renameSync(tmp, file);
|
|
43
|
+
}
|
|
44
|
+
export async function diffAgainstManifest(args) {
|
|
45
|
+
// The wanted closure: user files only — platform artifacts (.dreamlake/**,
|
|
46
|
+
// legacy assets.json trio) are never part of the freshness question.
|
|
47
|
+
const wanted = new Map();
|
|
48
|
+
if (args.assetId !== undefined) {
|
|
49
|
+
const asset = args.manifest.assets.find((a) => a.id === args.assetId);
|
|
50
|
+
if (!asset) {
|
|
51
|
+
const known = args.manifest.assets.map((a) => a.id);
|
|
52
|
+
const shown = known.slice(0, 20).join(", ");
|
|
53
|
+
throw new Error(`asset '${args.assetId}' not found — ` +
|
|
54
|
+
`available: ${shown}${known.length > 20 ? `, … (${known.length} total)` : ""}`);
|
|
55
|
+
}
|
|
56
|
+
for (const f of asset.files)
|
|
57
|
+
wanted.set(f.path, { size: f.size, sha256: f.sha256.toLowerCase() });
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
for (const [p, stat] of manifestFileMap(args.manifest)) {
|
|
61
|
+
if (isGeneratedPath(p))
|
|
62
|
+
continue;
|
|
63
|
+
wanted.set(p, stat);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const missing = [];
|
|
67
|
+
const present = [];
|
|
68
|
+
for (const rel of wanted.keys()) {
|
|
69
|
+
const abs = path.join(args.rootDir, rel);
|
|
70
|
+
let isFile = false;
|
|
71
|
+
try {
|
|
72
|
+
isFile = existsSync(abs) && statSync(abs).isFile();
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
isFile = false;
|
|
76
|
+
}
|
|
77
|
+
(isFile ? present : missing).push(rel);
|
|
78
|
+
}
|
|
79
|
+
const changed = [];
|
|
80
|
+
if (present.length > 0) {
|
|
81
|
+
const local = await hashFiles(args.rootDir, present, {
|
|
82
|
+
verify: args.verify,
|
|
83
|
+
cacheFile: args.cacheFile,
|
|
84
|
+
});
|
|
85
|
+
for (const rel of present) {
|
|
86
|
+
if (local.get(rel).sha256 !== wanted.get(rel).sha256)
|
|
87
|
+
changed.push(rel);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
missing.sort();
|
|
91
|
+
changed.sort();
|
|
92
|
+
let totalBytes = 0;
|
|
93
|
+
for (const stat of wanted.values())
|
|
94
|
+
totalBytes += stat.size;
|
|
95
|
+
const bytesNeeded = missing.reduce((s, p) => s + wanted.get(p).size, 0) +
|
|
96
|
+
changed.reduce((s, p) => s + wanted.get(p).size, 0);
|
|
97
|
+
const state = missing.length === 0 && changed.length === 0
|
|
98
|
+
? "up-to-date"
|
|
99
|
+
: missing.length === wanted.size
|
|
100
|
+
? "absent"
|
|
101
|
+
: "stale";
|
|
102
|
+
return {
|
|
103
|
+
state,
|
|
104
|
+
missing,
|
|
105
|
+
changed,
|
|
106
|
+
bytesNeeded,
|
|
107
|
+
files: { count: wanted.size, bytes: totalBytes },
|
|
108
|
+
};
|
|
109
|
+
}
|