@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,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render the difference between two Markdown documents as a Notes body whose
|
|
3
|
+
* changes are suggested edits (`:insert[…]`, `:delete[…]`, `:replace[…]{with=…}`),
|
|
4
|
+
* so a reviewer can read the new text in place and accept or reject each change.
|
|
5
|
+
*
|
|
6
|
+
* Suggestion tags do not render inside code, so changed fenced code blocks become
|
|
7
|
+
* ```diff fences instead. A tag never spans a line break: Notes keeps the bracket
|
|
8
|
+
* body on one line.
|
|
9
|
+
*/
|
|
10
|
+
import { readFileSync } from "node:fs";
|
|
11
|
+
import { emitJson, fail } from "../helpers.js";
|
|
12
|
+
export class SuggestDiffError extends Error {
|
|
13
|
+
}
|
|
14
|
+
/** Split Markdown into frontmatter, fenced code blocks, and blank-line-separated prose blocks. */
|
|
15
|
+
export function splitBlocks(md) {
|
|
16
|
+
const lines = md.replace(/\r\n?/g, "\n").split("\n");
|
|
17
|
+
const blocks = [];
|
|
18
|
+
let i = 0;
|
|
19
|
+
if (lines[0] === "---") {
|
|
20
|
+
const end = lines.indexOf("---", 1);
|
|
21
|
+
if (end > 0) {
|
|
22
|
+
blocks.push({ kind: "frontmatter", text: lines.slice(0, end + 1).join("\n") });
|
|
23
|
+
i = end + 1;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
let prose = [];
|
|
27
|
+
const flush = () => {
|
|
28
|
+
if (prose.length)
|
|
29
|
+
blocks.push({ kind: "prose", text: prose.join("\n") });
|
|
30
|
+
prose = [];
|
|
31
|
+
};
|
|
32
|
+
while (i < lines.length) {
|
|
33
|
+
const line = lines[i];
|
|
34
|
+
const fence = /^(\s*)(`{3,}|~{3,})/.exec(line);
|
|
35
|
+
if (fence) {
|
|
36
|
+
flush();
|
|
37
|
+
const marker = fence[2];
|
|
38
|
+
let j = i + 1;
|
|
39
|
+
while (j < lines.length && !lines[j].trimStart().startsWith(marker))
|
|
40
|
+
j++;
|
|
41
|
+
blocks.push({ kind: "code", text: lines.slice(i, Math.min(j + 1, lines.length)).join("\n") });
|
|
42
|
+
i = j + 1;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
if (line.trim() === "")
|
|
46
|
+
flush();
|
|
47
|
+
else
|
|
48
|
+
prose.push(line);
|
|
49
|
+
i++;
|
|
50
|
+
}
|
|
51
|
+
flush();
|
|
52
|
+
return blocks;
|
|
53
|
+
}
|
|
54
|
+
/** Longest-common-subsequence alignment; inputs here are paragraphs or blocks, so O(n·m) is fine. */
|
|
55
|
+
function align(a, b, eq) {
|
|
56
|
+
const n = a.length, m = b.length;
|
|
57
|
+
const dp = Array.from({ length: n + 1 }, () => new Uint32Array(m + 1));
|
|
58
|
+
for (let i = n - 1; i >= 0; i--) {
|
|
59
|
+
for (let j = m - 1; j >= 0; j--) {
|
|
60
|
+
dp[i][j] = eq(a[i], b[j]) ? dp[i + 1][j + 1] + 1 : Math.max(dp[i + 1][j], dp[i][j + 1]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const ops = [];
|
|
64
|
+
let i = 0, j = 0;
|
|
65
|
+
while (i < n && j < m) {
|
|
66
|
+
if (eq(a[i], b[j])) {
|
|
67
|
+
ops.push({ op: "equal", a: a[i], b: b[j] });
|
|
68
|
+
i++;
|
|
69
|
+
j++;
|
|
70
|
+
}
|
|
71
|
+
else if (dp[i + 1][j] >= dp[i][j + 1])
|
|
72
|
+
ops.push({ op: "delete", a: a[i++] });
|
|
73
|
+
else
|
|
74
|
+
ops.push({ op: "insert", b: b[j++] });
|
|
75
|
+
}
|
|
76
|
+
while (i < n)
|
|
77
|
+
ops.push({ op: "delete", a: a[i++] });
|
|
78
|
+
while (j < m)
|
|
79
|
+
ops.push({ op: "insert", b: b[j++] });
|
|
80
|
+
return ops;
|
|
81
|
+
}
|
|
82
|
+
// Existing note tags (`:comment[…]{…}`, suggestions) are single tokens so a diff never splits one.
|
|
83
|
+
const TOKEN = /:(?:comment|insert|delete|replace)\[(?:\\.|[^\]\\\n])*\](?:\{(?:"(?:\\.|[^"\\\n])*"|[^}"\n])*\})?|\[[^\]\n]*\]\([^)\n]*\)|`[^`\n]*`|<\/?[A-Za-z][^>\n]*>|[\p{L}\p{N}_]+|[ \t]+|\n|[^]/gu;
|
|
84
|
+
export function tokenize(text) {
|
|
85
|
+
return text.match(TOKEN) ?? [];
|
|
86
|
+
}
|
|
87
|
+
function similarity(a, b) {
|
|
88
|
+
const ta = tokenize(a), tb = tokenize(b);
|
|
89
|
+
if (!ta.length && !tb.length)
|
|
90
|
+
return 1;
|
|
91
|
+
const same = align(ta, tb, (x, y) => x === y).filter((o) => o.op === "equal").length;
|
|
92
|
+
return (2 * same) / (ta.length + tb.length);
|
|
93
|
+
}
|
|
94
|
+
/** MDX component tags would be sanitized or misparsed in a note; show them as code. */
|
|
95
|
+
// DreamLake Notes renders a `<Lead>` / `</Lead>` marker line itself, so those
|
|
96
|
+
// lines stay source. Every other component tag still shows as inline code.
|
|
97
|
+
const NOTES_COMPONENT_LINE = /^<\/?Lead>[ \t]*$/;
|
|
98
|
+
function protectComponents(text) {
|
|
99
|
+
return text.replace(/(`[^`\n]*`)|<\/?[A-Z][^>\n]*>/g, (m, code, offset, all) => {
|
|
100
|
+
if (code)
|
|
101
|
+
return code;
|
|
102
|
+
const start = all.lastIndexOf("\n", offset - 1) + 1;
|
|
103
|
+
const end = all.indexOf("\n", offset);
|
|
104
|
+
return NOTES_COMPONENT_LINE.test(all.slice(start, end < 0 ? all.length : end)) ? m : "`" + m + "`";
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function escapeBody(text) {
|
|
108
|
+
return text.replace(/[\\[\]]/g, (c) => "\\" + c);
|
|
109
|
+
}
|
|
110
|
+
class Writer {
|
|
111
|
+
opts;
|
|
112
|
+
stats = { inserts: 0, deletes: 0, replaces: 0, codeBlocks: 0 };
|
|
113
|
+
constructor(opts) {
|
|
114
|
+
this.opts = opts;
|
|
115
|
+
}
|
|
116
|
+
show(text) {
|
|
117
|
+
return this.opts.mdx ? protectComponents(text) : text;
|
|
118
|
+
}
|
|
119
|
+
attrs(extra = {}) {
|
|
120
|
+
const all = { ...extra, ...(this.opts.user ? { user: this.opts.user } : {}) };
|
|
121
|
+
const parts = Object.entries(all).map(([k, v]) => `${k}=${JSON.stringify(v)}`);
|
|
122
|
+
return parts.length ? `{${parts.join(" ")}}` : "";
|
|
123
|
+
}
|
|
124
|
+
tag(kind, text) {
|
|
125
|
+
// A tag body stays on one line, so a multi-line change is tagged line by
|
|
126
|
+
// line. Block markers (quote, list, heading) go inside the tag: accepting a
|
|
127
|
+
// deleted list item then leaves no empty bullet behind, and rejecting an
|
|
128
|
+
// inserted one leaves nothing at all.
|
|
129
|
+
return text.split("\n").map((line) => {
|
|
130
|
+
if (!line.trim())
|
|
131
|
+
return line;
|
|
132
|
+
this.stats[kind === "insert" ? "inserts" : "deletes"]++;
|
|
133
|
+
return `:${kind}[${escapeBody(this.show(line))}]${this.attrs()}`;
|
|
134
|
+
}).join("\n");
|
|
135
|
+
}
|
|
136
|
+
/** `wholeLines`: the change starts at a line start and ends at a line end. */
|
|
137
|
+
change(del, ins, wholeLines = false) {
|
|
138
|
+
if (del && ins && !del.includes("\n") && !ins.includes("\n")) {
|
|
139
|
+
this.stats.replaces++;
|
|
140
|
+
return `:replace[${escapeBody(this.show(del))}]${this.attrs({ with: this.show(ins) })}`;
|
|
141
|
+
}
|
|
142
|
+
const d = this.tag("delete", del), i = this.tag("insert", ins);
|
|
143
|
+
if (!d || !i)
|
|
144
|
+
return d || i;
|
|
145
|
+
// Whole lines read best as old lines above new ones. Mid-line, the first
|
|
146
|
+
// inserted line has to continue the line the deletion sits on, or accepting
|
|
147
|
+
// it would break that line in two.
|
|
148
|
+
return wholeLines ? `${d}\n${i.replace(/^\n/, "")}` : d + i;
|
|
149
|
+
}
|
|
150
|
+
codeDiff(before, after, frontmatter = false) {
|
|
151
|
+
this.stats.codeBlocks++;
|
|
152
|
+
const body = (s) => (s ? s.split("\n").slice(1, -1) : []);
|
|
153
|
+
const label = (s) => (s?.split("\n")[0].replace(/^\s*(`{3,}|~{3,})/, "").trim() || "");
|
|
154
|
+
const lines = align(body(before), body(after), (x, y) => x === y).map((o) => o.op === "equal" ? " " + o.a : o.op === "delete" ? "-" + o.a : "+" + o.b);
|
|
155
|
+
const info = frontmatter ? "frontmatter" : label(after) || label(before);
|
|
156
|
+
const fence = "`".repeat(Math.max(3, ...lines.map((l) => (l.match(/`+/g) ?? []).reduce((n, r) => Math.max(n, r.length + 1), 0))));
|
|
157
|
+
return [`${fence}diff${info ? ` title=${JSON.stringify(info)}` : ""}`, ...lines, fence].join("\n");
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** Word-level diff of two prose paragraphs, with short unchanged runs between edits absorbed into them. */
|
|
161
|
+
function proseDiff(w, before, after) {
|
|
162
|
+
const ops = align(tokenize(before), tokenize(after), (x, y) => x === y);
|
|
163
|
+
const segs = [];
|
|
164
|
+
for (const o of ops) {
|
|
165
|
+
const equal = o.op === "equal";
|
|
166
|
+
const last = segs[segs.length - 1];
|
|
167
|
+
if (last && last.equal === equal) {
|
|
168
|
+
last.a += o.a ?? "";
|
|
169
|
+
last.b += o.b ?? "";
|
|
170
|
+
}
|
|
171
|
+
else
|
|
172
|
+
segs.push({ equal, a: o.a ?? "", b: o.b ?? "" });
|
|
173
|
+
}
|
|
174
|
+
// Absorb tiny unchanged runs ("a", "the", punctuation) between two edits so a
|
|
175
|
+
// rewritten sentence reads as one replacement rather than many fragments.
|
|
176
|
+
for (let i = 1; i < segs.length - 1; i++) {
|
|
177
|
+
const s = segs[i];
|
|
178
|
+
if (s.equal && !segs[i - 1].equal && !segs[i + 1].equal && s.a.replace(/\s/g, "").length <= 3 && !s.a.includes("\n")) {
|
|
179
|
+
const prev = segs[i - 1], next = segs[i + 1];
|
|
180
|
+
prev.a += s.a + next.a;
|
|
181
|
+
prev.b += s.b + next.b;
|
|
182
|
+
segs.splice(i, 2);
|
|
183
|
+
i--;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
let out = "";
|
|
187
|
+
for (const [k, s] of segs.entries()) {
|
|
188
|
+
if (s.equal) {
|
|
189
|
+
out += w.show(s.a);
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
// Keep surrounding spaces outside the tag so accepted text joins cleanly.
|
|
193
|
+
const lead = /^[ \t]*/.exec(s.a)[0] === /^[ \t]*/.exec(s.b)[0] ? /^[ \t]*/.exec(s.a)[0] : "";
|
|
194
|
+
const trail = /[ \t]*$/.exec(s.a)[0] === /[ \t]*$/.exec(s.b)[0] ? /[ \t]*$/.exec(s.a)[0] : "";
|
|
195
|
+
const strip = (t) => t.slice(lead.length, Math.max(lead.length, t.length - trail.length));
|
|
196
|
+
let del = strip(s.a), ins = strip(s.b);
|
|
197
|
+
// Notes ignores a tag that directly follows "/" or "\" (`and/:insert[or]`),
|
|
198
|
+
// so a change that starts right after one takes that character with it.
|
|
199
|
+
if (!lead && /[\\/]$/.test(out)) {
|
|
200
|
+
const c = out.slice(-1);
|
|
201
|
+
out = out.slice(0, -1);
|
|
202
|
+
del = c + del;
|
|
203
|
+
ins = c + ins;
|
|
204
|
+
}
|
|
205
|
+
const next = segs[k + 1]?.a ?? "";
|
|
206
|
+
const wholeLines = !lead && !trail && (out === "" || out.endsWith("\n")) && (next === "" || next.startsWith("\n"));
|
|
207
|
+
out += lead + w.change(del, ins, wholeLines) + trail;
|
|
208
|
+
}
|
|
209
|
+
return out;
|
|
210
|
+
}
|
|
211
|
+
const MIN_WORD_DIFF_SIMILARITY = 0.45;
|
|
212
|
+
function renderHunk(w, dels, ins) {
|
|
213
|
+
// Pair each deleted block with the most similar inserted block of the same
|
|
214
|
+
// kind, in order, so a revised paragraph diffs against its previous version.
|
|
215
|
+
const pairs = align(dels, ins, (x, y) => x.kind === y.kind && (x.kind !== "prose" || similarity(x.text, y.text) >= MIN_WORD_DIFF_SIMILARITY));
|
|
216
|
+
return pairs.map((p) => {
|
|
217
|
+
const kind = (p.a ?? p.b).kind;
|
|
218
|
+
if (kind !== "prose")
|
|
219
|
+
return w.codeDiff(p.a?.text, p.b?.text, kind === "frontmatter");
|
|
220
|
+
if (p.op === "equal")
|
|
221
|
+
return proseDiff(w, p.a.text, p.b.text);
|
|
222
|
+
return p.op === "delete" ? w.tag("delete", p.a.text) : w.tag("insert", p.b.text);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
export function suggestDiff(before, after, opts = {}) {
|
|
226
|
+
if (opts.inPlace) {
|
|
227
|
+
if (/:(?:insert|delete|replace)[\[{]/.test(before)) {
|
|
228
|
+
throw new SuggestDiffError("the earlier text already contains suggested edits; accept or reject them before proposing more");
|
|
229
|
+
}
|
|
230
|
+
opts = { ...opts, fullCode: true, mdx: false };
|
|
231
|
+
}
|
|
232
|
+
const w = new Writer(opts);
|
|
233
|
+
const ops = align(splitBlocks(before), splitBlocks(after), (x, y) => x.kind === y.kind && x.text === y.text);
|
|
234
|
+
const out = [];
|
|
235
|
+
let dels = [], ins = [];
|
|
236
|
+
const flush = () => { if (dels.length || ins.length)
|
|
237
|
+
out.push(...renderHunk(w, dels, ins)); dels = []; ins = []; };
|
|
238
|
+
for (const o of ops) {
|
|
239
|
+
if (o.op === "delete") {
|
|
240
|
+
dels.push(o.a);
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
if (o.op === "insert") {
|
|
244
|
+
ins.push(o.b);
|
|
245
|
+
continue;
|
|
246
|
+
}
|
|
247
|
+
flush();
|
|
248
|
+
const b = o.a;
|
|
249
|
+
if (b.kind === "prose")
|
|
250
|
+
out.push(w.show(b.text));
|
|
251
|
+
else if (opts.fullCode)
|
|
252
|
+
out.push(b.text);
|
|
253
|
+
else
|
|
254
|
+
out.push(`*⋯ unchanged ${b.kind === "frontmatter" ? "frontmatter" : "code block"} (${b.text.split("\n").length} lines) ⋯*`);
|
|
255
|
+
}
|
|
256
|
+
flush();
|
|
257
|
+
if (opts.inPlace && w.stats.codeBlocks) {
|
|
258
|
+
throw new SuggestDiffError(`${w.stats.codeBlocks} code or frontmatter block(s) changed; suggested edits cannot express a code change, so --in-place output would not resolve to the later text`);
|
|
259
|
+
}
|
|
260
|
+
return { markdown: out.join("\n\n") + "\n", stats: w.stats };
|
|
261
|
+
}
|
|
262
|
+
/** Local only: reads two files and prints a Notes body; nothing is sent anywhere. */
|
|
263
|
+
export function runNotesSuggestDiff(before, after, opts) {
|
|
264
|
+
if (before === "-" && after === "-") {
|
|
265
|
+
fail("only one of <before> and <after> can be '-' (stdin)");
|
|
266
|
+
return 1;
|
|
267
|
+
}
|
|
268
|
+
// Notes ignores a tag whose user attribution is empty or longer than 128 characters.
|
|
269
|
+
if (opts.user !== undefined && (!opts.user || opts.user.length > 128)) {
|
|
270
|
+
fail("--user must be 1 to 128 characters");
|
|
271
|
+
return 1;
|
|
272
|
+
}
|
|
273
|
+
let texts;
|
|
274
|
+
try {
|
|
275
|
+
texts = [before, after].map((p) => readFileSync(p === "-" ? 0 : p, "utf8"));
|
|
276
|
+
}
|
|
277
|
+
catch (err) {
|
|
278
|
+
fail(`could not read input: ${err.message}`);
|
|
279
|
+
return 1;
|
|
280
|
+
}
|
|
281
|
+
// MDX display defaults on for .mdx inputs and never applies to --in-place output.
|
|
282
|
+
const mdx = opts.mdx ?? [before, after].some((p) => p.endsWith(".mdx"));
|
|
283
|
+
let result;
|
|
284
|
+
try {
|
|
285
|
+
result = suggestDiff(texts[0], texts[1], { user: opts.user, fullCode: opts.fullCode, mdx, inPlace: opts.inPlace });
|
|
286
|
+
}
|
|
287
|
+
catch (err) {
|
|
288
|
+
if (!(err instanceof SuggestDiffError))
|
|
289
|
+
throw err;
|
|
290
|
+
fail(err.message);
|
|
291
|
+
return 2;
|
|
292
|
+
}
|
|
293
|
+
if (opts.json)
|
|
294
|
+
emitJson(result);
|
|
295
|
+
else
|
|
296
|
+
process.stdout.write(result.markdown);
|
|
297
|
+
return 0;
|
|
298
|
+
}
|
|
299
|
+
export function registerSuggestDiffCommand(notes) {
|
|
300
|
+
notes.command("suggest-diff").allowExcessArguments(false)
|
|
301
|
+
.description("render two Markdown versions as a note body of suggested edits (local; pipe to `notes create --file -`)")
|
|
302
|
+
.argument("<before>", "earlier version ('-' for stdin)")
|
|
303
|
+
.argument("<after>", "later version ('-' for stdin)")
|
|
304
|
+
.option("--user <name>", "attribution shown on every suggestion")
|
|
305
|
+
.option("--full-code", "keep unchanged code blocks instead of collapsing them")
|
|
306
|
+
.option("--mdx", "show MDX component tags as inline code (default for .mdx inputs)")
|
|
307
|
+
.option("--no-mdx", "leave component tags as written")
|
|
308
|
+
.option("--in-place", "output to replace <before> in the same note: verbatim unchanged blocks; exit 2 if code changed")
|
|
309
|
+
.option("--json", "emit { markdown, stats } as JSON")
|
|
310
|
+
.action((before, after, opts) => { process.exitCode = runNotesSuggestDiff(before, after, opts); });
|
|
311
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outlines, with both kinds of range.
|
|
3
|
+
*
|
|
4
|
+
* The third implementation of one rule — dreamlake-server has it in
|
|
5
|
+
* `services/notesSections.ts`, the Python SDK in `api/_toc.py`, and this is
|
|
6
|
+
* the CLI's. An anchor is an ADDRESS: if these disagree about what `## Setup`
|
|
7
|
+
* is called, then a TOC entry and `read --section setup` point at different
|
|
8
|
+
* text and neither output says so.
|
|
9
|
+
*
|
|
10
|
+
* So the anchors here are checked against a fixture recorded from the server,
|
|
11
|
+
* the same fixture the Python suite reads. Prose about "these match" is not a
|
|
12
|
+
* check; the fixture is.
|
|
13
|
+
*
|
|
14
|
+
* Ranges come in both units the API uses: 1-based inclusive lines, and 0-based
|
|
15
|
+
* end-exclusive Unicode CODE POINTS — not UTF-16 units, which is what
|
|
16
|
+
* JavaScript string offsets are natively.
|
|
17
|
+
*/
|
|
18
|
+
export declare const PREAMBLE_ANCHOR = "preamble";
|
|
19
|
+
export interface TocEntry {
|
|
20
|
+
anchor: string;
|
|
21
|
+
title: string;
|
|
22
|
+
level: number;
|
|
23
|
+
/** 1-based, inclusive. */
|
|
24
|
+
line: [number, number];
|
|
25
|
+
/** 0-based, end-exclusive code points. */
|
|
26
|
+
ind: [number, number];
|
|
27
|
+
}
|
|
28
|
+
/** GitHub-style slug. Empty or all-punctuation titles fall back to 'section'. */
|
|
29
|
+
export declare function slugify(title: string): string;
|
|
30
|
+
export declare function markdownToc(md: string): TocEntry[];
|
|
31
|
+
/**
|
|
32
|
+
* Headings and where they are in the source.
|
|
33
|
+
*
|
|
34
|
+
* Deliberately NOT Markdown's subtree rule: an `<h2>` does not own the markup
|
|
35
|
+
* that follows it, and inventing a section boundary would let an agent replace
|
|
36
|
+
* a "section" that no element corresponds to.
|
|
37
|
+
*/
|
|
38
|
+
export declare function htmlToc(html: string): TocEntry[];
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outlines, with both kinds of range.
|
|
3
|
+
*
|
|
4
|
+
* The third implementation of one rule — dreamlake-server has it in
|
|
5
|
+
* `services/notesSections.ts`, the Python SDK in `api/_toc.py`, and this is
|
|
6
|
+
* the CLI's. An anchor is an ADDRESS: if these disagree about what `## Setup`
|
|
7
|
+
* is called, then a TOC entry and `read --section setup` point at different
|
|
8
|
+
* text and neither output says so.
|
|
9
|
+
*
|
|
10
|
+
* So the anchors here are checked against a fixture recorded from the server,
|
|
11
|
+
* the same fixture the Python suite reads. Prose about "these match" is not a
|
|
12
|
+
* check; the fixture is.
|
|
13
|
+
*
|
|
14
|
+
* Ranges come in both units the API uses: 1-based inclusive lines, and 0-based
|
|
15
|
+
* end-exclusive Unicode CODE POINTS — not UTF-16 units, which is what
|
|
16
|
+
* JavaScript string offsets are natively.
|
|
17
|
+
*/
|
|
18
|
+
import { lineOf, cpLength } from "./editing.js";
|
|
19
|
+
export const PREAMBLE_ANCHOR = "preamble";
|
|
20
|
+
const INLINE = [
|
|
21
|
+
[/`([^`]+)`/g, "$1"],
|
|
22
|
+
[/\*\*([^*]+)\*\*/g, "$1"],
|
|
23
|
+
[/\*([^*]+)\*/g, "$1"],
|
|
24
|
+
[/__([^_]+)__/g, "$1"],
|
|
25
|
+
[/_([^_]+)_/g, "$1"],
|
|
26
|
+
[/~~([^~]+)~~/g, "$1"],
|
|
27
|
+
[/\[([^\]]+)\]\([^)]*\)/g, "$1"],
|
|
28
|
+
[/\\([\\`*_{}[\]()#+\-.!~])/g, "$1"],
|
|
29
|
+
];
|
|
30
|
+
/** Read a title as plain text, so it slugs the way the server slugs it. */
|
|
31
|
+
function stripInline(s) {
|
|
32
|
+
let out = s;
|
|
33
|
+
for (const [rx, repl] of INLINE)
|
|
34
|
+
out = out.replace(rx, repl);
|
|
35
|
+
return out.trim();
|
|
36
|
+
}
|
|
37
|
+
/** GitHub-style slug. Empty or all-punctuation titles fall back to 'section'. */
|
|
38
|
+
export function slugify(title) {
|
|
39
|
+
const kept = [...title.toLowerCase()]
|
|
40
|
+
.filter((ch) => /\p{L}|\p{N}/u.test(ch) || ch === " " || ch === "-")
|
|
41
|
+
.join("");
|
|
42
|
+
const s = kept.trim().replace(/\s+/g, "-");
|
|
43
|
+
return s || "section";
|
|
44
|
+
}
|
|
45
|
+
const ATX = /^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/;
|
|
46
|
+
const FENCE = /^(```|~~~)/;
|
|
47
|
+
const BULLET = /^[-*+]\s/;
|
|
48
|
+
function headings(md) {
|
|
49
|
+
const out = [];
|
|
50
|
+
const lines = md.split("\n");
|
|
51
|
+
let off = 0;
|
|
52
|
+
let inFence = false;
|
|
53
|
+
for (let i = 0; i < lines.length; i++) {
|
|
54
|
+
const line = lines[i];
|
|
55
|
+
const trimmed = line.trim();
|
|
56
|
+
if (FENCE.test(trimmed)) {
|
|
57
|
+
// A `#` inside a shell example is not a heading, and treating it as one
|
|
58
|
+
// would let an agent address — and overwrite — part of someone's script.
|
|
59
|
+
inFence = !inFence;
|
|
60
|
+
off += cpLength(line) + 1;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (!inFence) {
|
|
64
|
+
const atx = ATX.exec(line);
|
|
65
|
+
if (atx) {
|
|
66
|
+
out.push({ level: atx[1].length, text: stripInline(atx[2]), ind: off });
|
|
67
|
+
}
|
|
68
|
+
else if (trimmed && !BULLET.test(trimmed)) {
|
|
69
|
+
const next = (lines[i + 1] ?? "").trim();
|
|
70
|
+
if (/^=+$/.test(next))
|
|
71
|
+
out.push({ level: 1, text: stripInline(trimmed), ind: off });
|
|
72
|
+
else if (/^-+$/.test(next) && next.length >= 2)
|
|
73
|
+
out.push({ level: 2, text: stripInline(trimmed), ind: off });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
off += cpLength(line) + 1;
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
function entry(md, anchor, title, level, start, end) {
|
|
81
|
+
// `end` is exclusive; the last line of the section holds the final
|
|
82
|
+
// character, not the one after it.
|
|
83
|
+
const last = end > start ? lineOf(md, end - 1) : lineOf(md, start);
|
|
84
|
+
return { anchor, title, level, line: [lineOf(md, start), last], ind: [start, end] };
|
|
85
|
+
}
|
|
86
|
+
export function markdownToc(md) {
|
|
87
|
+
const heads = headings(md);
|
|
88
|
+
const out = [];
|
|
89
|
+
const total = cpLength(md);
|
|
90
|
+
if (heads.length === 0) {
|
|
91
|
+
if (md)
|
|
92
|
+
out.push(entry(md, PREAMBLE_ANCHOR, "", 0, 0, total));
|
|
93
|
+
return out;
|
|
94
|
+
}
|
|
95
|
+
// Text before the first heading is addressable; otherwise the top of a
|
|
96
|
+
// document is the one part with no name.
|
|
97
|
+
if (heads[0].ind > 0)
|
|
98
|
+
out.push(entry(md, PREAMBLE_ANCHOR, "", 0, 0, heads[0].ind));
|
|
99
|
+
const seen = new Map();
|
|
100
|
+
for (let i = 0; i < heads.length; i++) {
|
|
101
|
+
const h = heads[i];
|
|
102
|
+
// A section owns its SUBTREE: it ends at the next heading of the same
|
|
103
|
+
// level or shallower, because "replace this section" means the part a
|
|
104
|
+
// reader would point at.
|
|
105
|
+
let end = total;
|
|
106
|
+
for (const later of heads.slice(i + 1)) {
|
|
107
|
+
if (later.level <= h.level) {
|
|
108
|
+
end = later.ind;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const base = slugify(h.text);
|
|
113
|
+
const n = (seen.get(base) ?? 0) + 1;
|
|
114
|
+
seen.set(base, n);
|
|
115
|
+
out.push(entry(md, n === 1 ? base : `${base}-${n}`, h.text, h.level, h.ind, end));
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
const HTML_HEADING = /<(h[1-6])(\s[^>]*)?>([\s\S]*?)<\/\1\s*>/gi;
|
|
120
|
+
const TAGS = /<[^>]+>/g;
|
|
121
|
+
/**
|
|
122
|
+
* Headings and where they are in the source.
|
|
123
|
+
*
|
|
124
|
+
* Deliberately NOT Markdown's subtree rule: an `<h2>` does not own the markup
|
|
125
|
+
* that follows it, and inventing a section boundary would let an agent replace
|
|
126
|
+
* a "section" that no element corresponds to.
|
|
127
|
+
*/
|
|
128
|
+
export function htmlToc(html) {
|
|
129
|
+
const out = [];
|
|
130
|
+
const seen = new Map();
|
|
131
|
+
HTML_HEADING.lastIndex = 0;
|
|
132
|
+
let m;
|
|
133
|
+
while ((m = HTML_HEADING.exec(html)) !== null) {
|
|
134
|
+
const level = Number(m[1][1]);
|
|
135
|
+
const title = stripInline(m[3].replace(TAGS, "")).trim();
|
|
136
|
+
const base = slugify(title);
|
|
137
|
+
const n = (seen.get(base) ?? 0) + 1;
|
|
138
|
+
seen.set(base, n);
|
|
139
|
+
const start = cpLength(html.slice(0, m.index));
|
|
140
|
+
const end = start + cpLength(m[0]);
|
|
141
|
+
out.push(entry(html, n === 1 ? base : `${base}-${n}`, title, level, start, end));
|
|
142
|
+
}
|
|
143
|
+
return out;
|
|
144
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { type MetadataTransferOptions } from '../ownership/metadata-transfer.js';
|
|
3
|
+
export type NoteTransferOptions = MetadataTransferOptions;
|
|
4
|
+
/** The Note convenience command uses the same capability-bound metadata protocol. */
|
|
5
|
+
export declare function runNotesTransfer(noteId: string, opts: NoteTransferOptions): Promise<number>;
|
|
6
|
+
export declare function registerTransferCommand(notes: Command): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { metadataTransferFlags, runMetadataTransfer } from '../ownership/metadata-transfer.js';
|
|
2
|
+
/** The Note convenience command uses the same capability-bound metadata protocol. */
|
|
3
|
+
export function runNotesTransfer(noteId, opts) {
|
|
4
|
+
return runMetadataTransfer('note', noteId, opts);
|
|
5
|
+
}
|
|
6
|
+
export function registerTransferCommand(notes) {
|
|
7
|
+
metadataTransferFlags(notes.command('transfer <note-id>').description('Request a recipient-accepted, metadata-only Note ownership transfer'))
|
|
8
|
+
.action(async (noteId, opts) => { process.exitCode = await runNotesTransfer(noteId, opts); });
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
import { type DocumentReadOptions } from "./document.js";
|
|
3
|
+
import { type ConnOpts } from "./index.js";
|
|
4
|
+
interface Options extends ConnOpts {
|
|
5
|
+
json?: boolean;
|
|
6
|
+
hash?: string;
|
|
7
|
+
tag?: string;
|
|
8
|
+
summary?: string;
|
|
9
|
+
parent?: string;
|
|
10
|
+
before?: string;
|
|
11
|
+
dryRun?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function runVersionCreate(ref: string, opts: Options): Promise<number>;
|
|
14
|
+
export declare function runVersionList(ref: string, opts: Options): Promise<number>;
|
|
15
|
+
export declare function runVersionRead(ref: string, id: string, opts: Options): Promise<number>;
|
|
16
|
+
/** Saved reads cannot silently fall back to live, partial or collaborative reads. */
|
|
17
|
+
export declare function runSavedVersionRead(ref: string | undefined, opts: DocumentReadOptions): Promise<number>;
|
|
18
|
+
export declare function registerVersionCommands(notes: Command): void;
|
|
19
|
+
export {};
|