kardalum 0.19.0 → 0.20.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/README.md +7 -5
- package/dist/control/access/roles.js +3 -3
- package/dist/control/access/users.js +2 -2
- package/dist/control/assets/index.js +6 -6
- package/dist/control/completion/complete.d.ts +11 -0
- package/dist/control/completion/complete.js +65 -0
- package/dist/control/completion/emit.js +60 -6
- package/dist/control/completion/tree.d.ts +1 -1
- package/dist/control/completion/tree.js +5 -3
- package/dist/control/confirm.d.ts +2 -2
- package/dist/control/confirm.js +8 -7
- package/dist/control/content/destructive.js +10 -5
- package/dist/control/content/index.js +2 -2
- package/dist/control/content/read.js +7 -6
- package/dist/control/content/write.d.ts +1 -0
- package/dist/control/content/write.js +32 -8
- package/dist/control/context.d.ts +3 -1
- package/dist/control/context.js +3 -8
- package/dist/control/errors.d.ts +3 -0
- package/dist/control/errors.js +80 -13
- package/dist/control/media/files.js +6 -6
- package/dist/control/media/folders.js +3 -3
- package/dist/control/media/trash.js +4 -4
- package/dist/control/nouns.js +1 -1
- package/dist/control/output.d.ts +6 -2
- package/dist/control/output.js +13 -8
- package/dist/control/plugins/install.js +4 -4
- package/dist/control/plugins/lifecycle.js +30 -5
- package/dist/control/plugins/read.js +3 -3
- package/dist/control/profile.js +1 -1
- package/dist/control/redact.d.ts +16 -0
- package/dist/control/redact.js +223 -0
- package/dist/control/settings/settings.js +4 -4
- package/dist/control/settings/sites.js +3 -3
- package/dist/control/snapshots/index.js +3 -3
- package/dist/control/structure/datatypes.js +5 -5
- package/dist/control/structure/templates.js +8 -8
- package/dist/control/structure/types.js +5 -5
- package/dist/control/usage.d.ts +12 -7
- package/dist/control/usage.js +62 -2
- package/dist/control/whoami.js +1 -1
- package/dist/dev/config.d.ts +3 -1
- package/dist/dev/config.js +57 -12
- package/dist/dev/sandbox-env-policy.d.ts +20 -0
- package/dist/dev/sandbox-env-policy.js +120 -0
- package/dist/dev/sandbox.d.ts +63 -3
- package/dist/dev/sandbox.js +155 -37
- package/dist/dev/usage.d.ts +1 -1
- package/dist/dev/usage.js +13 -7
- package/dist/index.d.ts +6 -0
- package/dist/index.js +78 -9
- package/dist/mcp/index.d.ts +9 -0
- package/dist/mcp/index.js +98 -0
- package/dist/mcp/usage.d.ts +1 -0
- package/dist/mcp/usage.js +25 -0
- package/dist/plugin/build.d.ts +3 -1
- package/dist/plugin/build.js +21 -3
- package/dist/plugin/bundle-server-manifest.d.ts +5 -1
- package/dist/plugin/bundle-server-manifest.js +33 -2
- package/dist/plugin/checks/cli-commands.d.ts +4 -0
- package/dist/plugin/checks/cli-commands.js +43 -0
- package/dist/plugin/checks/cms-range.d.ts +4 -0
- package/dist/plugin/checks/cms-range.js +51 -0
- package/dist/plugin/checks/price.d.ts +4 -0
- package/dist/plugin/checks/price.js +22 -0
- package/dist/plugin/checks/templates.d.ts +0 -7
- package/dist/plugin/checks/templates.js +16 -3
- package/dist/plugin/cms-range.d.ts +7 -0
- package/dist/plugin/cms-range.js +40 -0
- package/dist/plugin/copy-package-contract.js +4 -0
- package/dist/plugin/index.d.ts +6 -0
- package/dist/plugin/index.js +30 -6
- package/dist/plugin/pack.d.ts +3 -1
- package/dist/plugin/pack.js +2 -2
- package/dist/plugin/publish.d.ts +3 -0
- package/dist/plugin/publish.js +4 -1
- package/dist/plugin/sandbox-package.js +3 -1
- package/dist/plugin/scramble.d.ts +12 -0
- package/dist/plugin/scramble.js +43 -0
- package/dist/plugin/usage.d.ts +1 -1
- package/dist/plugin/usage.js +2 -0
- package/dist/plugin/validate.d.ts +5 -0
- package/dist/plugin/validate.js +52 -2
- package/dist/plugin/write-manifest-json.d.ts +3 -1
- package/dist/plugin/write-manifest-json.js +233 -4
- package/dist/plugin-commands/discover.d.ts +73 -0
- package/dist/plugin-commands/discover.js +371 -0
- package/dist/plugin-commands/run.d.ts +18 -0
- package/dist/plugin-commands/run.js +265 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.d.ts +215 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-connections.schema.js +179 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/ai-context.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +5 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +7 -1
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +4 -2
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/built-in-editor-ids.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.d.ts +65 -0
- package/node_modules/@kardalum/api-schemas/dist/capability-detail.js +126 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +115 -3
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +58 -11
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +57 -2
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +137 -0
- package/node_modules/@kardalum/api-schemas/dist/content-path.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/content-search.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.d.ts +37 -0
- package/node_modules/@kardalum/api-schemas/dist/content-summary.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/content-unpublish.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.d.ts +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content.schema.js +10 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/contract-cancel.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +10 -5
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +7 -4
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.d.ts +35 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-issue.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +180 -15
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +41 -5
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.d.ts +24 -6
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +90 -5
- package/node_modules/@kardalum/api-schemas/dist/form-protection.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/form-protection.js +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/graphql-limits.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/held-embed-words.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +117 -41
- package/node_modules/@kardalum/api-schemas/dist/index.js +89 -26
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/install-sign-in-switched-off.schema.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/legal-anchors.js +9 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.d.ts +63 -0
- package/node_modules/@kardalum/api-schemas/dist/licensing.schema.js +54 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.d.ts +224 -0
- package/node_modules/@kardalum/api-schemas/dist/mail-rules.js +404 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-leaks.schema.js +154 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +312 -8
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +43 -3
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +15 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.d.ts +131 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-payouts.schema.js +272 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.d.ts +84 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-profile.schema.js +138 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.d.ts +20 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-revocation.schema.js +49 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.d.ts +211 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-sites.schema.js +424 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.d.ts +78 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-plugins.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.d.ts +70 -0
- package/node_modules/@kardalum/api-schemas/dist/mcp-tool-inputs.schema.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +22 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +13 -1
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.d.ts +75 -0
- package/node_modules/@kardalum/api-schemas/dist/media-move.schema.js +53 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-api.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/media-reference.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-fields.schema.js +370 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.d.ts +53 -0
- package/node_modules/@kardalum/api-schemas/dist/nested-validation.js +284 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +5 -5
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.d.ts +1 -2
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +1 -2
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.d.ts +145 -0
- package/node_modules/@kardalum/api-schemas/dist/notification-kinds.js +177 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +258 -7
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +96 -5
- package/node_modules/@kardalum/api-schemas/dist/page-address.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/page-address.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.d.ts +34 -0
- package/node_modules/@kardalum/api-schemas/dist/password-reset.schema.js +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +28 -3
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +55 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.d.ts +23 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-caller.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.d.ts +76 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-cli-commands.js +316 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.d.ts +42 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-content-access.js +74 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.d.ts +31 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-data-type-configs.js +131 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +26 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +26 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -5
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.d.ts +228 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-document-types.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-durable-hooks.js +55 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.d.ts +40 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-editor-extensions.js +124 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-field-info.js +51 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.d.ts +32 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-graphql-fields.js +102 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.d.ts +107 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-held-embeds.js +213 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-https-origin.js +21 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +44 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +38 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +237 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +205 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +29 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +32 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +120 -14
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +335 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +242 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +16 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +34 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.d.ts +40 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-ai.js +139 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +22 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +31 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.d.ts +25 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-media-access.js +43 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.d.ts +107 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-outbound.js +150 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-package-build.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.d.ts +310 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-providers.js +430 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-sealed-values.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.d.ts +68 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-secrets.js +114 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.d.ts +342 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-settings.js +400 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.d.ts +180 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-site-extensions.js +612 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +47 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.d.ts +45 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-tasks.js +197 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.d.ts +9 -0
- package/node_modules/@kardalum/api-schemas/dist/plural-rules.js +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +41 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +100 -12
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.d.ts +189 -0
- package/node_modules/@kardalum/api-schemas/dist/refund-request.schema.js +164 -0
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +7 -3
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-shape.js +82 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.d.ts +66 -0
- package/node_modules/@kardalum/api-schemas/dist/rich-text-text.js +497 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.d.ts +82 -0
- package/node_modules/@kardalum/api-schemas/dist/sale-conditions.schema.js +99 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +28 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +91 -1
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +90 -8
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +59 -1
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +110 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +34 -2
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.d.ts +384 -0
- package/node_modules/@kardalum/api-schemas/dist/sign-in.schema.js +616 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-duplicate-key.js +26 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.d.ts +66 -0
- package/node_modules/@kardalum/api-schemas/dist/structured-fields.schema.js +160 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/transaction-rolled-back.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-purge.schema.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +58 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +34 -3
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +5 -1
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +4 -3
- package/node_modules/@kardalum/api-schemas/package.json +1 -0
- package/node_modules/@kardalum/mcp-tools/LICENSE +202 -0
- package/node_modules/@kardalum/mcp-tools/dist/catalog.d.ts +19 -0
- package/node_modules/@kardalum/mcp-tools/dist/catalog.js +38 -0
- package/node_modules/@kardalum/mcp-tools/dist/env.d.ts +14 -0
- package/node_modules/@kardalum/mcp-tools/dist/env.js +1 -0
- package/node_modules/@kardalum/mcp-tools/dist/errors.d.ts +21 -0
- package/node_modules/@kardalum/mcp-tools/dist/errors.js +184 -0
- package/node_modules/@kardalum/mcp-tools/dist/guard.d.ts +20 -0
- package/node_modules/@kardalum/mcp-tools/dist/guard.js +194 -0
- package/node_modules/@kardalum/mcp-tools/dist/handlers.d.ts +2 -0
- package/node_modules/@kardalum/mcp-tools/dist/handlers.js +19 -0
- package/node_modules/@kardalum/mcp-tools/dist/index.d.ts +16 -0
- package/node_modules/@kardalum/mcp-tools/dist/index.js +19 -0
- package/node_modules/@kardalum/mcp-tools/dist/markdown-worker.mjs +11 -0
- package/node_modules/@kardalum/mcp-tools/dist/markdown.d.ts +16 -0
- package/node_modules/@kardalum/mcp-tools/dist/markdown.js +600 -0
- package/node_modules/@kardalum/mcp-tools/dist/media.d.ts +5 -0
- package/node_modules/@kardalum/mcp-tools/dist/media.js +133 -0
- package/node_modules/@kardalum/mcp-tools/dist/mime.d.ts +1 -0
- package/node_modules/@kardalum/mcp-tools/dist/mime.js +24 -0
- package/node_modules/@kardalum/mcp-tools/dist/pages-read.d.ts +11 -0
- package/node_modules/@kardalum/mcp-tools/dist/pages-read.js +193 -0
- package/node_modules/@kardalum/mcp-tools/dist/pages-write.d.ts +11 -0
- package/node_modules/@kardalum/mcp-tools/dist/pages-write.js +269 -0
- package/node_modules/@kardalum/mcp-tools/dist/patch.d.ts +2 -0
- package/node_modules/@kardalum/mcp-tools/dist/patch.js +20 -0
- package/node_modules/@kardalum/mcp-tools/dist/plugin-tools.d.ts +97 -0
- package/node_modules/@kardalum/mcp-tools/dist/plugin-tools.js +388 -0
- package/node_modules/@kardalum/mcp-tools/dist/resources.d.ts +2 -0
- package/node_modules/@kardalum/mcp-tools/dist/resources.js +29 -0
- package/node_modules/@kardalum/mcp-tools/dist/server.d.ts +32 -0
- package/node_modules/@kardalum/mcp-tools/dist/server.js +142 -0
- package/node_modules/@kardalum/mcp-tools/dist/site.d.ts +13 -0
- package/node_modules/@kardalum/mcp-tools/dist/site.js +62 -0
- package/node_modules/@kardalum/mcp-tools/dist/structure.d.ts +42 -0
- package/node_modules/@kardalum/mcp-tools/dist/structure.js +209 -0
- package/node_modules/@kardalum/mcp-tools/dist/text.d.ts +11 -0
- package/node_modules/@kardalum/mcp-tools/dist/text.js +71 -0
- package/node_modules/@kardalum/mcp-tools/package.json +59 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +21 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +8 -2
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +17 -10
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +355 -22
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +2 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/cms-range.js +353 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/ai-declarations.js +26 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +3 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/content-access.js +34 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/editor-extensions.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/graphql-fields.js +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +47 -5
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.d.ts +27 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/licence-check.js +95 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +9 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/plugin-settings.js +68 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/providers.js +298 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +25 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +91 -2
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/server-powers.js +140 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/site-extensions.js +36 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +21 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +10 -0
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +2 -1
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +75 -0
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +123 -0
- package/package.json +12 -5
package/README.md
CHANGED
|
@@ -31,8 +31,10 @@ npx kardalum plugin publish --token $KARDALUM_PUBLISH_TOKEN
|
|
|
31
31
|
(into `~/.kardalum/dev/server/<version>/`, cached after that), runs it on
|
|
32
32
|
SQLite, completes setup for you, and prints the admin's address with a login
|
|
33
33
|
and password. It runs your plugin's server hooks and routes as well as its
|
|
34
|
-
views. `--server-port`
|
|
35
|
-
`5273`), and
|
|
34
|
+
views. `--server-port` moves the server's port (default `3100`), `--plugin-port` moves a
|
|
35
|
+
plugin project's own dev server (default `5273`; `5474` in a checkout), and
|
|
36
|
+
`--server-version` pins the server. `--marketplace` uses the hosted marketplace
|
|
37
|
+
instead of running offline.
|
|
36
38
|
|
|
37
39
|
`kardalum plugin bundle-server` bundles only a plugin's server half, which
|
|
38
40
|
the sandbox uses itself. `publish` sends to `https://dev.kardalum.com`
|
|
@@ -85,10 +87,10 @@ or a marketplace plugin id. A listing's install questions are asked at a
|
|
|
85
87
|
terminal; a script writes them into an answers file first:
|
|
86
88
|
|
|
87
89
|
```bash
|
|
88
|
-
kardalum plugins install com.
|
|
89
|
-
kardalum plugins install com.
|
|
90
|
+
kardalum plugins install com.example.event-tickets --print-questions # reads the questions
|
|
91
|
+
kardalum plugins install com.example.event-tickets --print-questions --json | jq .answers > answers.json
|
|
90
92
|
# edit answers.json (every option starts at its default)
|
|
91
|
-
kardalum plugins install com.
|
|
93
|
+
kardalum plugins install com.example.event-tickets --answers answers.json
|
|
92
94
|
```
|
|
93
95
|
|
|
94
96
|
An update asks only what the recorded answers leave open (it reads the install
|
|
@@ -72,7 +72,7 @@ export const create = {
|
|
|
72
72
|
throw new UsageError("create needs --label <text>.");
|
|
73
73
|
const given = (await readActions(ctx, args)) ?? [];
|
|
74
74
|
const created = await (await client()).manage.roles.create({ id, label, actions: given });
|
|
75
|
-
ctx.out(flag(args, "json") ?
|
|
75
|
+
ctx.out(flag(args, "json") ? ctx.json(created) : `created role ${created.role.id} (${created.role.actions.length} actions)`);
|
|
76
76
|
return EXIT.ok;
|
|
77
77
|
},
|
|
78
78
|
};
|
|
@@ -89,7 +89,7 @@ export const update = {
|
|
|
89
89
|
throw new UsageError("update needs --label, --actions or --actions-file.");
|
|
90
90
|
const body = { ...(label !== undefined ? { label } : {}), ...(given !== undefined ? { actions: given } : {}) };
|
|
91
91
|
const updated = await (await client()).manage.roles.update(id, body);
|
|
92
|
-
ctx.out(flag(args, "json") ?
|
|
92
|
+
ctx.out(flag(args, "json") ? ctx.json(updated) : `updated role ${updated.role.id}`);
|
|
93
93
|
return EXIT.ok;
|
|
94
94
|
},
|
|
95
95
|
};
|
|
@@ -113,7 +113,7 @@ export const del = {
|
|
|
113
113
|
async run({ ctx, args, client }) {
|
|
114
114
|
const id = await roleId(args.positionals[0], "delete");
|
|
115
115
|
const result = await (await client()).manage.roles.delete(id);
|
|
116
|
-
ctx.out(flag(args, "json") ?
|
|
116
|
+
ctx.out(flag(args, "json") ? ctx.json(result) : `deleted role ${id}`);
|
|
117
117
|
return EXIT.ok;
|
|
118
118
|
},
|
|
119
119
|
};
|
|
@@ -60,7 +60,7 @@ export const setRole = {
|
|
|
60
60
|
const id = userId(args.positionals[0], "set-role");
|
|
61
61
|
const role = await roleArg(args.positionals[1]);
|
|
62
62
|
const result = await (await client()).manage.users.updateRole(id, { role });
|
|
63
|
-
ctx.out(flag(args, "json") ?
|
|
63
|
+
ctx.out(flag(args, "json") ? ctx.json(result) : `set the role of ${cell(result.user.email)} to ${cell(result.user.role)}`);
|
|
64
64
|
return EXIT.ok;
|
|
65
65
|
},
|
|
66
66
|
};
|
|
@@ -83,7 +83,7 @@ export const del = {
|
|
|
83
83
|
async run({ ctx, args, client }) {
|
|
84
84
|
const id = userId(args.positionals[0], "delete");
|
|
85
85
|
const result = await (await client()).manage.users.delete(id);
|
|
86
|
-
ctx.out(flag(args, "json") ?
|
|
86
|
+
ctx.out(flag(args, "json") ? ctx.json(result) : `deleted user ${id}`);
|
|
87
87
|
return EXIT.ok;
|
|
88
88
|
},
|
|
89
89
|
};
|
|
@@ -51,7 +51,7 @@ const list = {
|
|
|
51
51
|
const entries = folder === "" ? tree.entries : tree.entries.filter((entry) => entry.path.startsWith(`${folder}/`));
|
|
52
52
|
if (flag(args, "json")) {
|
|
53
53
|
for (const entry of entries)
|
|
54
|
-
ctx.out(
|
|
54
|
+
ctx.out(ctx.json(entry));
|
|
55
55
|
}
|
|
56
56
|
else {
|
|
57
57
|
printTable(ctx, ["path", "kind", "size", "registered", "plugin"], entries.map((e) => [e.path, e.kind, e.size, e.registered ? "yes" : "", e.pluginId]));
|
|
@@ -78,14 +78,14 @@ const get = {
|
|
|
78
78
|
const bytes = await api.manage.assets.raw(path);
|
|
79
79
|
await writeFile(out, bytes);
|
|
80
80
|
if (flag(args, "json"))
|
|
81
|
-
ctx.out(
|
|
81
|
+
ctx.out(ctx.json({ path, bytes: bytes.byteLength, out }));
|
|
82
82
|
else
|
|
83
83
|
ctx.out(`wrote ${bytes.byteLength} bytes of ${cell(path)} to ${out}`);
|
|
84
84
|
return EXIT.ok;
|
|
85
85
|
}
|
|
86
86
|
const result = await api.manage.assets.getContent(path);
|
|
87
87
|
if (flag(args, "json")) {
|
|
88
|
-
ctx.out(
|
|
88
|
+
ctx.out(ctx.json(result));
|
|
89
89
|
return EXIT.ok;
|
|
90
90
|
}
|
|
91
91
|
// Line by line, each through cell(), so a file's control characters never reach the terminal; --out keeps the bytes.
|
|
@@ -135,7 +135,7 @@ const version = {
|
|
|
135
135
|
const { path, version: number } = pathAndVersion(args, "version");
|
|
136
136
|
const result = await (await client()).manage.assets.getVersion(path, number);
|
|
137
137
|
if (flag(args, "json")) {
|
|
138
|
-
ctx.out(
|
|
138
|
+
ctx.out(ctx.json(result));
|
|
139
139
|
return EXIT.ok;
|
|
140
140
|
}
|
|
141
141
|
const v = result.version;
|
|
@@ -161,7 +161,7 @@ const makeCurrent = {
|
|
|
161
161
|
async run({ ctx, args, client }) {
|
|
162
162
|
const { path, version: number } = pathAndVersion(args, "make-current");
|
|
163
163
|
const result = await (await client()).manage.assets.makeCurrent(path, number);
|
|
164
|
-
ctx.out(flag(args, "json") ?
|
|
164
|
+
ctx.out(flag(args, "json") ? ctx.json(result) : `asset ${cell(path)} is at version ${result.version}`);
|
|
165
165
|
return EXIT.ok;
|
|
166
166
|
},
|
|
167
167
|
};
|
|
@@ -212,7 +212,7 @@ const restore = {
|
|
|
212
212
|
const api = await client();
|
|
213
213
|
const found = await trashedAt(api, path, stringOption(args, "id"));
|
|
214
214
|
const result = await api.manage.assets.restore({ path, id: found.id });
|
|
215
|
-
ctx.out(flag(args, "json") ?
|
|
215
|
+
ctx.out(flag(args, "json") ? ctx.json(result) : `restored asset ${cell(path)} (version ${result.version})`);
|
|
216
216
|
return EXIT.ok;
|
|
217
217
|
},
|
|
218
218
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Discovery } from "../../plugin-commands/discover.js";
|
|
2
|
+
/** The longest word printed. */
|
|
3
|
+
export declare const COMPLETION_WORD_MAX = 64;
|
|
4
|
+
/** Lower-case a to z, 0 to 9 and "-", 1 to 64 characters, not starting with "-"; a linear scan. */
|
|
5
|
+
export declare function isCompletionWord(word: string): boolean;
|
|
6
|
+
/** No word: the prefixes. One plugin prefix: its command names. Anything else: nothing. */
|
|
7
|
+
export declare function completionWords(discovery: Discovery | null, words: readonly string[]): string[];
|
|
8
|
+
/** Never prints a warning, never throws, always 0. `cwd` is for tests; the default is the working folder. */
|
|
9
|
+
export declare function runComplete(words: string[], out: (line: string) => void, options?: {
|
|
10
|
+
cwd?: string;
|
|
11
|
+
}): Promise<0>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// M32 F4e (E5): `kardalum __complete <words...>`, the hidden helper the completion scripts call on Tab
|
|
2
|
+
// to add the project's plugin words to the static ones. It reads discovery only (package.json files,
|
|
3
|
+
// no plugin module runs), prints one word a line, never a warning, and always answers 0. Bash's
|
|
4
|
+
// `compgen -W` expands each word it is given, and a word here comes from a package in node_modules,
|
|
5
|
+
// so only a word passing `isCompletionWord` is ever printed: a `$(...)`, a backtick, a quote or a
|
|
6
|
+
// space never reaches a shell.
|
|
7
|
+
/** The longest word printed. */
|
|
8
|
+
export const COMPLETION_WORD_MAX = 64;
|
|
9
|
+
/** Lower-case a to z, 0 to 9 and "-", 1 to 64 characters, not starting with "-"; a linear scan. */
|
|
10
|
+
export function isCompletionWord(word) {
|
|
11
|
+
if (typeof word !== "string")
|
|
12
|
+
return false;
|
|
13
|
+
if (word.length === 0 || word.length > COMPLETION_WORD_MAX)
|
|
14
|
+
return false;
|
|
15
|
+
for (let i = 0; i < word.length; i++) {
|
|
16
|
+
const code = word.charCodeAt(i);
|
|
17
|
+
const letter = code >= 0x61 && code <= 0x7a;
|
|
18
|
+
const digit = code >= 0x30 && code <= 0x39;
|
|
19
|
+
const dash = code === 0x2d;
|
|
20
|
+
if (!letter && !digit && !dash)
|
|
21
|
+
return false;
|
|
22
|
+
if (dash && i === 0)
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
function sortedSafe(words) {
|
|
28
|
+
return [...new Set([...words].filter(isCompletionWord))].sort();
|
|
29
|
+
}
|
|
30
|
+
/** No word: the prefixes. One plugin prefix: its command names. Anything else: nothing. */
|
|
31
|
+
export function completionWords(discovery, words) {
|
|
32
|
+
if (discovery === null)
|
|
33
|
+
return [];
|
|
34
|
+
if (words.length === 0)
|
|
35
|
+
return sortedSafe(discovery.byPrefix.keys());
|
|
36
|
+
if (words.length !== 1 || !isCompletionWord(words[0]))
|
|
37
|
+
return [];
|
|
38
|
+
const found = discovery.byPrefix.get(words[0]);
|
|
39
|
+
if (found === undefined)
|
|
40
|
+
return [];
|
|
41
|
+
return sortedSafe(found.commands.map((command) => command.name));
|
|
42
|
+
}
|
|
43
|
+
/** Never prints a warning, never throws, always 0. `cwd` is for tests; the default is the working folder. */
|
|
44
|
+
export async function runComplete(words, out, options = {}) {
|
|
45
|
+
try {
|
|
46
|
+
// A line no answer can come from does not pay for discovery: this runs on every Tab.
|
|
47
|
+
if (words.length > 1 || (words.length === 1 && !isCompletionWord(words[0])))
|
|
48
|
+
return 0;
|
|
49
|
+
const { discoverPluginCommands } = await import("../../plugin-commands/discover.js");
|
|
50
|
+
let discovery;
|
|
51
|
+
try {
|
|
52
|
+
discovery = await discoverPluginCommands({ cwd: options.cwd ?? process.cwd() });
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
discovery = null;
|
|
56
|
+
}
|
|
57
|
+
// The warnings are dropped on purpose: a Tab must never print into the user's line.
|
|
58
|
+
for (const word of completionWords(discovery, words))
|
|
59
|
+
out(word);
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// A closed stdout or anything else: the shell simply gets fewer words.
|
|
63
|
+
}
|
|
64
|
+
return 0;
|
|
65
|
+
}
|
|
@@ -36,7 +36,7 @@ function bashFunction(root) {
|
|
|
36
36
|
const valueFlags = valueFlagsOf(all);
|
|
37
37
|
return [
|
|
38
38
|
"_kardalum_complete() {",
|
|
39
|
-
' local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
39
|
+
' local cur="${COMP_WORDS[COMP_CWORD]}" at="" skip=0 i word n=0 first="" lost=0',
|
|
40
40
|
" for ((i = 1; i < COMP_CWORD; i++)); do",
|
|
41
41
|
' word="${COMP_WORDS[i]}"',
|
|
42
42
|
' if [ "$skip" = 1 ]; then skip=0; continue; fi',
|
|
@@ -44,18 +44,43 @@ function bashFunction(root) {
|
|
|
44
44
|
...(valueFlags.length > 0 ? [` ${valueFlags.join("|")}) skip=1; continue;;`] : []),
|
|
45
45
|
" -*) continue;;",
|
|
46
46
|
" esac",
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
" n=$((n + 1))",
|
|
48
|
+
' if [ "$n" = 1 ]; then first="$word"; fi',
|
|
49
|
+
// Once a word is off the tree (a plugin prefix, a value, a typo), no later word is read as a core one.
|
|
50
|
+
' if [ "$lost" = 1 ]; then continue; fi',
|
|
51
|
+
' case "$at $word" in',
|
|
52
|
+
` ${known.join("|")}) at="$at $word";;`,
|
|
53
|
+
" *) lost=1;;",
|
|
49
54
|
" esac",
|
|
50
55
|
" done",
|
|
51
56
|
' local kids="" flags=""',
|
|
52
|
-
' case "$
|
|
57
|
+
' case "$at" in',
|
|
53
58
|
...arms,
|
|
54
59
|
" esac",
|
|
60
|
+
// Off the tree there are no static words to offer.
|
|
61
|
+
' if [ "$lost" = 1 ]; then kids=""; fi',
|
|
55
62
|
' if [[ "$cur" == -* ]]; then',
|
|
56
63
|
' COMPREPLY=($(compgen -W "$flags" -- "$cur"))',
|
|
57
64
|
" else",
|
|
58
65
|
' COMPREPLY=($(compgen -W "$kids" -- "$cur"))',
|
|
66
|
+
// M32 F4e (E5): the project's plugin words, asked for only at the first word and after a plugin
|
|
67
|
+
// prefix. They never go through compgen (it expands its words) and never through eval: each line
|
|
68
|
+
// is read raw, checked again for plain lower-case letters, digits and "-", and matched literally.
|
|
69
|
+
// The typed first word gets the same check before it is passed: an unsafe one starts no kardalum.
|
|
70
|
+
' local ask=0 w',
|
|
71
|
+
' local -a args=()',
|
|
72
|
+
' if [ "$n" = 0 ]; then ask=1;',
|
|
73
|
+
' elif [ "$n" = 1 ] && [ -z "$at" ] && [ "${#first}" -le 64 ]; then',
|
|
74
|
+
' case "$first" in ""|-*|*[!abcdefghijklmnopqrstuvwxyz0123456789-]*) ;; *) ask=1; args=("$first");; esac',
|
|
75
|
+
" fi",
|
|
76
|
+
' if [ "$ask" = 1 ]; then',
|
|
77
|
+
" while IFS= read -r w; do",
|
|
78
|
+
' case "$w" in',
|
|
79
|
+
' ""|-*|*[!abcdefghijklmnopqrstuvwxyz0123456789-]*) continue;;',
|
|
80
|
+
" esac",
|
|
81
|
+
' if [[ "$w" == "$cur"* ]]; then COMPREPLY+=("$w"); fi',
|
|
82
|
+
' done < <(command kardalum __complete "${args[@]}" 2>/dev/null)',
|
|
83
|
+
" fi",
|
|
59
84
|
" fi",
|
|
60
85
|
"}",
|
|
61
86
|
"complete -F _kardalum_complete kardalum",
|
|
@@ -94,15 +119,44 @@ export function powershellScript(root) {
|
|
|
94
119
|
" if ($wordToComplete -ne '' -and $words.Count -gt 0) { $words.RemoveAt($words.Count - 1) }",
|
|
95
120
|
" $path = ''",
|
|
96
121
|
" $skip = $false",
|
|
122
|
+
" $lost = $false",
|
|
123
|
+
" $n = 0",
|
|
124
|
+
" $first = ''",
|
|
97
125
|
" foreach ($word in $words) {",
|
|
98
126
|
" if ($skip) { $skip = $false; continue }",
|
|
99
127
|
" if ($script:KardalumValueFlags -contains $word) { $skip = $true; continue }",
|
|
100
128
|
" if ($word.StartsWith('-')) { continue }",
|
|
129
|
+
" $n++",
|
|
130
|
+
" if ($n -eq 1) { $first = $word }",
|
|
131
|
+
// Once a word is off the tree (a plugin prefix, a value, a typo), no later word is read as a core one.
|
|
132
|
+
" if ($lost) { continue }",
|
|
101
133
|
' $next = if ($path -eq \'\') { $word } else { "$path $word" }',
|
|
102
|
-
" if ($script:KardalumTree.ContainsKey($next)) { $path = $next }",
|
|
134
|
+
" if ($script:KardalumTree.ContainsKey($next)) { $path = $next } else { $lost = $true }",
|
|
103
135
|
" }",
|
|
104
136
|
" $entry = $script:KardalumTree[$path]",
|
|
105
|
-
" $pool = if ($wordToComplete.StartsWith('-')) { $entry.flags }
|
|
137
|
+
" $pool = @(if ($wordToComplete.StartsWith('-')) { $entry.flags } elseif (-not $lost) { $entry.kids })",
|
|
138
|
+
// M32 F4e (E5): the project's plugin words, asked for only at the first word and after a plugin prefix.
|
|
139
|
+
// The arguments go as an array (never a command line), the output is only ever data, and each line is
|
|
140
|
+
// checked again for plain lower-case letters, digits and "-" before it is offered. The typed first word
|
|
141
|
+
// gets the same check before it is passed: a .cmd shim hands its arguments to cmd.exe, which would run
|
|
142
|
+
// an "&" in them, so an unsafe word starts no kardalum at all.
|
|
143
|
+
" $isWord = {",
|
|
144
|
+
" param([string]$w)",
|
|
145
|
+
" if ($w.Length -lt 1 -or $w.Length -gt 64 -or $w.StartsWith('-')) { return $false }",
|
|
146
|
+
" foreach ($c in $w.ToCharArray()) { if ('abcdefghijklmnopqrstuvwxyz0123456789-'.IndexOf($c) -lt 0) { return $false } }",
|
|
147
|
+
" return $true",
|
|
148
|
+
" }",
|
|
149
|
+
" if (-not $wordToComplete.StartsWith('-')) {",
|
|
150
|
+
" $ask = $null",
|
|
151
|
+
" if ($n -eq 0) { $ask = @() } elseif ($n -eq 1 -and $path -eq '' -and (& $isWord $first)) { $ask = @($first) }",
|
|
152
|
+
" if ($null -ne $ask) {",
|
|
153
|
+
" $lines = try { @(& kardalum __complete @ask 2>$null) } catch { @() }",
|
|
154
|
+
" foreach ($line in $lines) {",
|
|
155
|
+
" $w = [string]$line",
|
|
156
|
+
" if (& $isWord $w) { $pool += $w }",
|
|
157
|
+
" }",
|
|
158
|
+
" }",
|
|
159
|
+
" }",
|
|
106
160
|
" $pool | Where-Object { $_.StartsWith($wordToComplete, [StringComparison]::OrdinalIgnoreCase) } | ForEach-Object {",
|
|
107
161
|
" [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)",
|
|
108
162
|
" }",
|
|
@@ -10,7 +10,7 @@ export interface CommandNode {
|
|
|
10
10
|
/** A word is embedded in a script only if it is lower-case letters, digits and dashes (an optional leading "--"). */
|
|
11
11
|
export declare const SAFE_WORD: RegExp;
|
|
12
12
|
/**
|
|
13
|
-
* `dev` and `
|
|
13
|
+
* `dev`, `plugin` and `mcp` have their own parsers (src/dev/config.ts, src/plugin/index.ts, src/mcp/index.ts) and are not in the
|
|
14
14
|
* dispatcher's table, so their words are written here. The completion test checks every word against USAGE.
|
|
15
15
|
*/
|
|
16
16
|
export declare const HAND_COMMANDS: readonly CommandNode[];
|
|
@@ -36,16 +36,18 @@ function hand(name, subs) {
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
-
* `dev` and `
|
|
39
|
+
* `dev`, `plugin` and `mcp` have their own parsers (src/dev/config.ts, src/plugin/index.ts, src/mcp/index.ts) and are not in the
|
|
40
40
|
* dispatcher's table, so their words are written here. The completion test checks every word against USAGE.
|
|
41
41
|
*/
|
|
42
42
|
export const HAND_COMMANDS = [
|
|
43
|
-
hand("dev", [{ name: "start", flags: ["--db", "--server-port", "--plugin-port", "--server-version"], valueFlags: ["--db", "--server-port", "--plugin-port", "--server-version"] }]),
|
|
43
|
+
hand("dev", [{ name: "start", flags: ["--db", "--server-port", "--plugin-port", "--server-version", "--marketplace"], valueFlags: ["--db", "--server-port", "--plugin-port", "--server-version"] }]),
|
|
44
44
|
hand("plugin", ["validate", "build", "bundle-server", "pack", "publish"].map((name) => ({
|
|
45
45
|
name,
|
|
46
|
-
flags: ["--json", "--out", "--registry", "--token"],
|
|
46
|
+
flags: ["--json", "--out", "--scramble", "--registry", "--token"],
|
|
47
47
|
valueFlags: ["--out", "--registry", "--token"],
|
|
48
48
|
}))),
|
|
49
|
+
// `kardalum mcp` takes no subcommand: its flags are its own (src/mcp/index.ts).
|
|
50
|
+
{ name: "mcp", flags: ["--help", "--allow-production", "--allow-private-urls", "--profile"], valueFlags: ["--profile"], children: [] },
|
|
49
51
|
];
|
|
50
52
|
export function buildCompletionTree(nouns, handWritten = HAND_COMMANDS) {
|
|
51
53
|
const fromTable = Object.entries(nouns).map(([name, def]) => nounNode(name, def));
|
|
@@ -14,13 +14,13 @@ export declare function renderRequestEcho(request: {
|
|
|
14
14
|
path: string;
|
|
15
15
|
baseUrl: string;
|
|
16
16
|
body?: unknown;
|
|
17
|
-
}): string[];
|
|
17
|
+
}, secrets?: Iterable<string>): string[];
|
|
18
18
|
/**
|
|
19
19
|
* What a dry run prints (2026-10-21-s310-the-ci-mode-design.md section 5). Without --json, the prose of
|
|
20
20
|
* section 8 of the S305 design. With --json, exactly one line: {"dryRun":true,"request":{method,url,body}}
|
|
21
21
|
* or {"dryRun":true,"plan":"<text>", ...data} (S314c6: a text plan's data). The request shape has no header at all, so the key is not part of it.
|
|
22
22
|
*/
|
|
23
|
-
export declare function dryRunLines(dryRun: ConfirmPlan["dryRun"], json: boolean): string[];
|
|
23
|
+
export declare function dryRunLines(dryRun: ConfirmPlan["dryRun"], json: boolean, secrets?: Iterable<string>): string[];
|
|
24
24
|
export declare function guardAndConfirm(ctx: ControlContext, plan: ConfirmPlan, flags: {
|
|
25
25
|
yes: boolean;
|
|
26
26
|
dryRun: boolean;
|
package/dist/control/confirm.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { profileLine } from "./client.js";
|
|
2
|
+
import { jsonText } from "./redact.js";
|
|
2
3
|
import { EXIT } from "./errors.js";
|
|
3
4
|
import { isCi } from "./prompt.js";
|
|
4
5
|
/** The request a dry run would have sent: method, full url, the key masked, the body. Built from the plan alone, never from a client. */
|
|
5
|
-
export function renderRequestEcho(request) {
|
|
6
|
+
export function renderRequestEcho(request, secrets = []) {
|
|
6
7
|
const lines = ["Would send:", ` ${request.method} ${request.baseUrl}${request.path}`, " Authorization: Bearer ***"];
|
|
7
8
|
if (request.body !== undefined)
|
|
8
|
-
lines.push(` Body: ${
|
|
9
|
+
lines.push(` Body: ${jsonText(request.body, secrets)}`);
|
|
9
10
|
lines.push("Nothing sent.");
|
|
10
11
|
return lines;
|
|
11
12
|
}
|
|
@@ -14,14 +15,14 @@ export function renderRequestEcho(request) {
|
|
|
14
15
|
* section 8 of the S305 design. With --json, exactly one line: {"dryRun":true,"request":{method,url,body}}
|
|
15
16
|
* or {"dryRun":true,"plan":"<text>", ...data} (S314c6: a text plan's data). The request shape has no header at all, so the key is not part of it.
|
|
16
17
|
*/
|
|
17
|
-
export function dryRunLines(dryRun, json) {
|
|
18
|
+
export function dryRunLines(dryRun, json, secrets = []) {
|
|
18
19
|
if (json) {
|
|
19
20
|
const shape = dryRun.kind === "text"
|
|
20
21
|
? { dryRun: true, plan: dryRun.text, ...dryRun.data }
|
|
21
22
|
: { dryRun: true, request: { method: dryRun.method, url: `${dryRun.baseUrl}${dryRun.path}`, ...(dryRun.body !== undefined ? { body: dryRun.body } : {}) } };
|
|
22
|
-
return [
|
|
23
|
+
return [jsonText(shape, secrets)];
|
|
23
24
|
}
|
|
24
|
-
return dryRun.kind === "text" ? [dryRun.text] : renderRequestEcho(dryRun);
|
|
25
|
+
return dryRun.kind === "text" ? [dryRun.text] : renderRequestEcho(dryRun, secrets);
|
|
25
26
|
}
|
|
26
27
|
function cannotAsk(ctx, plan) {
|
|
27
28
|
ctx.err(`kardalum ${plan.noun}: confirmation needed and this terminal cannot ask.`);
|
|
@@ -32,12 +33,12 @@ export async function guardAndConfirm(ctx, plan, flags) {
|
|
|
32
33
|
// Nothing to do: no question, nothing sent, success, whatever the flags.
|
|
33
34
|
if (plan.nothing !== undefined) {
|
|
34
35
|
const data = plan.dryRun.kind === "text" ? plan.dryRun.data : undefined;
|
|
35
|
-
ctx.out(flags.json === true ?
|
|
36
|
+
ctx.out(flags.json === true ? ctx.json({ nothing: true, message: plan.nothing, ...data }) : plan.nothing);
|
|
36
37
|
return { proceed: false, code: EXIT.ok };
|
|
37
38
|
}
|
|
38
39
|
// Rule 4: a dry run sends nothing, never prompts, and needs no production flag.
|
|
39
40
|
if (flags.dryRun) {
|
|
40
|
-
for (const line of dryRunLines(plan.dryRun, flags.json === true))
|
|
41
|
+
for (const line of dryRunLines(plan.dryRun, flags.json === true, ctx.secrets))
|
|
41
42
|
ctx.out(line);
|
|
42
43
|
return { proceed: false, code: EXIT.ok };
|
|
43
44
|
}
|
|
@@ -35,7 +35,8 @@ export const del = {
|
|
|
35
35
|
// The name is the server's text: through cell(), so it cannot move the cursor or recolour the terminal.
|
|
36
36
|
const nodeName = cell(parsed.data.nodeName);
|
|
37
37
|
const where = profile.name ?? profile.url;
|
|
38
|
-
|
|
38
|
+
const below = pages(descendantCount);
|
|
39
|
+
return textPlan("content", profile, `Delete "${nodeName}" and ${below} below it? They go to the trash.`, `Would delete "${nodeName}" and ${below} below it on ${where} (${profile.url}). Nothing changed.`);
|
|
39
40
|
}
|
|
40
41
|
throw new CliError("the server deleted the page without asking for confirmation: the page and everything below it are in the trash.", EXIT.failure, `bring them back with \`kardalum content restore ${id}\`.`);
|
|
41
42
|
},
|
|
@@ -44,10 +45,14 @@ export const del = {
|
|
|
44
45
|
const api = await client();
|
|
45
46
|
const id = await resolveContent(api, ref);
|
|
46
47
|
const result = await api.manage.content.delete(id, { confirm: true });
|
|
47
|
-
ctx.out(flag(args, "json") ?
|
|
48
|
+
ctx.out(flag(args, "json") ? ctx.json(result) : `deleted content ${id} (${pages(result.trashedCount)} in the trash)`);
|
|
48
49
|
return EXIT.ok;
|
|
49
50
|
},
|
|
50
51
|
};
|
|
52
|
+
/** "1 page", "2 pages". */
|
|
53
|
+
function pages(count) {
|
|
54
|
+
return `${count} ${count === 1 ? "page" : "pages"}`;
|
|
55
|
+
}
|
|
51
56
|
const permissionsGet = {
|
|
52
57
|
remote: true,
|
|
53
58
|
options: { "rows-template": { type: "boolean" } },
|
|
@@ -61,11 +66,11 @@ const permissionsGet = {
|
|
|
61
66
|
const converted = toSaveBody(result);
|
|
62
67
|
for (const warning of converted.warnings)
|
|
63
68
|
ctx.err(`kardalum content permissions: ${warning}`);
|
|
64
|
-
ctx.out(
|
|
69
|
+
ctx.out(ctx.json(converted.body));
|
|
65
70
|
return EXIT.ok;
|
|
66
71
|
}
|
|
67
72
|
if (flag(args, "json")) {
|
|
68
|
-
ctx.out(
|
|
73
|
+
ctx.out(ctx.json(result));
|
|
69
74
|
return EXIT.ok;
|
|
70
75
|
}
|
|
71
76
|
// mode: this page's own entry, else "inherited" when an entry above restricts the action, else "none".
|
|
@@ -146,7 +151,7 @@ const permissionsSet = {
|
|
|
146
151
|
const api = await client();
|
|
147
152
|
const id = await resolveContent(api, ref);
|
|
148
153
|
const result = await api.manage.permissions.save(id, await rowsFor(ctx, args, id));
|
|
149
|
-
ctx.out(flag(args, "json") ?
|
|
154
|
+
ctx.out(flag(args, "json") ? ctx.json(result) : `saved permissions of content ${id}`);
|
|
150
155
|
return EXIT.ok;
|
|
151
156
|
},
|
|
152
157
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { CONTENT_USAGE } from "../usage.js";
|
|
2
2
|
import { del, permissions } from "./destructive.js";
|
|
3
3
|
import { get, list, trash, version, versions } from "./read.js";
|
|
4
|
-
import { copy, create, move, publish, restore, update } from "./write.js";
|
|
4
|
+
import { copy, create, move, publish, restore, unpublish, update } from "./write.js";
|
|
5
5
|
export const contentNoun = {
|
|
6
6
|
usage: CONTENT_USAGE,
|
|
7
|
-
verbs: { list, get, create, update, publish, move, copy, versions, version, trash, restore, delete: del, permissions },
|
|
7
|
+
verbs: { list, get, create, update, publish, unpublish, move, copy, versions, version, trash, restore, delete: del, permissions },
|
|
8
8
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { flag, stringOption } from "../args.js";
|
|
2
|
+
import { jsonText } from "../redact.js";
|
|
2
3
|
import { UsageError } from "../errors.js";
|
|
3
4
|
import { cell, printKeyValue } from "../output.js";
|
|
4
5
|
import { PAGE_MAX, runList } from "../paging.js";
|
|
@@ -11,11 +12,11 @@ function one(args, what) {
|
|
|
11
12
|
return args.positionals[0];
|
|
12
13
|
}
|
|
13
14
|
/** One stored value per line, each cut at 200 characters; the key and the value both come from the server. */
|
|
14
|
-
function printValues(out, data) {
|
|
15
|
+
function printValues(out, data, secrets) {
|
|
15
16
|
for (const [key, value] of Object.entries(data)) {
|
|
16
17
|
if (key === "_name")
|
|
17
18
|
continue;
|
|
18
|
-
out(` ${cell(key)} ${cell(
|
|
19
|
+
out(` ${cell(key)} ${cell(jsonText(value, secrets)?.slice(0, 200))}`);
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
22
|
export const list = {
|
|
@@ -44,7 +45,7 @@ export const get = {
|
|
|
44
45
|
const culture = stringOption(args, "culture");
|
|
45
46
|
const item = await api.manage.content.getById(id, culture === undefined ? undefined : { locale: culture });
|
|
46
47
|
if (flag(args, "json")) {
|
|
47
|
-
ctx.out(
|
|
48
|
+
ctx.out(ctx.json(item));
|
|
48
49
|
return 0;
|
|
49
50
|
}
|
|
50
51
|
const types = await typeLookup(api);
|
|
@@ -58,7 +59,7 @@ export const get = {
|
|
|
58
59
|
["Version", item.version.version],
|
|
59
60
|
["Published", item.node.publishedAt],
|
|
60
61
|
]);
|
|
61
|
-
printValues((line) => ctx.out(line), item.version.data);
|
|
62
|
+
printValues((line) => ctx.out(line), item.version.data, ctx.secrets);
|
|
62
63
|
return 0;
|
|
63
64
|
},
|
|
64
65
|
};
|
|
@@ -104,11 +105,11 @@ export const version = {
|
|
|
104
105
|
const culture = stringOption(args, "culture");
|
|
105
106
|
const result = await api.manage.content.getVersion(id, number, culture === undefined ? undefined : { locale: culture });
|
|
106
107
|
if (flag(args, "json")) {
|
|
107
|
-
ctx.out(
|
|
108
|
+
ctx.out(ctx.json(result));
|
|
108
109
|
return 0;
|
|
109
110
|
}
|
|
110
111
|
printKeyValue(ctx, [["Version", result.version.version], ["Created", result.version.createdAt], ["By", result.version.createdBy]]);
|
|
111
|
-
printValues((line) => ctx.out(line), result.version.data);
|
|
112
|
+
printValues((line) => ctx.out(line), result.version.data, ctx.secrets);
|
|
112
113
|
return 0;
|
|
113
114
|
},
|
|
114
115
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { VerbDef } from "../verbs.js";
|
|
2
2
|
export declare const create: VerbDef;
|
|
3
3
|
export declare const update: VerbDef;
|
|
4
|
+
export declare const unpublish: VerbDef;
|
|
4
5
|
export declare const publish: VerbDef;
|
|
5
6
|
export declare const move: VerbDef;
|
|
6
7
|
export declare const copy: VerbDef;
|
|
@@ -44,7 +44,7 @@ export const create = {
|
|
|
44
44
|
const parentRef = stringOption(args, "parent");
|
|
45
45
|
const parentId = parentRef === undefined ? null : await resolveTarget(api, parentRef);
|
|
46
46
|
const created = await api.manage.content.create({ documentTypeId, parentId, slug, sortOrder, data });
|
|
47
|
-
ctx.out(flag(args, "json") ?
|
|
47
|
+
ctx.out(flag(args, "json") ? ctx.json(created) : `created content ${created.node.id} (${cell(created.node.path)})`);
|
|
48
48
|
return EXIT.ok;
|
|
49
49
|
},
|
|
50
50
|
};
|
|
@@ -88,7 +88,27 @@ export const update = {
|
|
|
88
88
|
data = { ...base, ...given };
|
|
89
89
|
}
|
|
90
90
|
const saved = await api.manage.content.save(id, { data, ...(culture !== undefined ? { culture } : {}) });
|
|
91
|
-
ctx.out(flag(args, "json") ?
|
|
91
|
+
ctx.out(flag(args, "json") ? ctx.json(saved) : `updated content ${id} (version ${saved.version.version})`);
|
|
92
|
+
return EXIT.ok;
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
// M31.5 B (D10): takes a page off the site in one culture, or in every published one;
|
|
96
|
+
// pointers only, every version kept (the server's unpublishContent).
|
|
97
|
+
export const unpublish = {
|
|
98
|
+
remote: true,
|
|
99
|
+
options: { culture: { type: "string" } },
|
|
100
|
+
async run({ ctx, args, client }) {
|
|
101
|
+
const ref = exactlyOne(args, "unpublish");
|
|
102
|
+
const culture = stringOption(args, "culture");
|
|
103
|
+
const api = await client();
|
|
104
|
+
const id = await resolveContent(api, ref);
|
|
105
|
+
const result = await api.manage.content.unpublish(id, culture === undefined ? undefined : { culture });
|
|
106
|
+
if (flag(args, "json"))
|
|
107
|
+
ctx.out(ctx.json(result));
|
|
108
|
+
else if (result.unpublished.length === 0)
|
|
109
|
+
ctx.out(`content ${id} was not published${culture !== undefined ? ` in ${cell(culture)}` : ""}`);
|
|
110
|
+
else
|
|
111
|
+
ctx.out(`unpublished content ${id} (${result.unpublished.map(cell).join(", ")}); every version is kept`);
|
|
92
112
|
return EXIT.ok;
|
|
93
113
|
},
|
|
94
114
|
};
|
|
@@ -107,7 +127,7 @@ export const publish = {
|
|
|
107
127
|
if (all) {
|
|
108
128
|
const result = await api.manage.content.publishAll(id, version === undefined ? undefined : { version });
|
|
109
129
|
if (flag(args, "json"))
|
|
110
|
-
ctx.out(
|
|
130
|
+
ctx.out(ctx.json(result));
|
|
111
131
|
let incomplete = 0;
|
|
112
132
|
for (const entry of result.results) {
|
|
113
133
|
if (entry.status === "published") {
|
|
@@ -126,7 +146,7 @@ export const publish = {
|
|
|
126
146
|
const body = { ...(culture !== undefined ? { culture } : {}), ...(version !== undefined ? { version } : {}) };
|
|
127
147
|
const result = await api.manage.content.publish(id, Object.keys(body).length === 0 ? undefined : body);
|
|
128
148
|
ctx.out(flag(args, "json")
|
|
129
|
-
?
|
|
149
|
+
? ctx.json(result)
|
|
130
150
|
: version !== undefined
|
|
131
151
|
? `published version ${version} of content ${id} (a rollback if it was not the newest)`
|
|
132
152
|
: `published content ${id}`);
|
|
@@ -153,7 +173,7 @@ export const move = {
|
|
|
153
173
|
const sentence = lines.length === 0
|
|
154
174
|
? `Would move ${id} under ${cell(toRef)}. Nothing changed.`
|
|
155
175
|
: `Would move ${id} under ${cell(toRef)}. It changes who can reach it in ${lines.length} way(s) (${lines.join("; ")}). Nothing changed.`;
|
|
156
|
-
for (const line of dryRunLines({ kind: "text", text: sentence }, flag(args, "json")))
|
|
176
|
+
for (const line of dryRunLines({ kind: "text", text: sentence }, flag(args, "json"), ctx.secrets))
|
|
157
177
|
ctx.out(line);
|
|
158
178
|
return EXIT.ok;
|
|
159
179
|
}
|
|
@@ -174,7 +194,7 @@ export const move = {
|
|
|
174
194
|
return guard.code;
|
|
175
195
|
}
|
|
176
196
|
const moved = await api.manage.content.move(id, { targetParentId: target });
|
|
177
|
-
ctx.out(flag(args, "json") ?
|
|
197
|
+
ctx.out(flag(args, "json") ? ctx.json(moved) : `moved content ${id} to ${cell(moved.node.path)}`);
|
|
178
198
|
return EXIT.ok;
|
|
179
199
|
},
|
|
180
200
|
};
|
|
@@ -205,7 +225,11 @@ export const copy = {
|
|
|
205
225
|
const id = await resolveContent(api, ref);
|
|
206
226
|
const targetParentId = await resolveTarget(api, toRef);
|
|
207
227
|
const copied = await api.manage.content.copy(id, { targetParentId, includeChildren: flag(args, "include-children") });
|
|
208
|
-
|
|
228
|
+
// M32 I2 (A3): the copy leaves out the picked pages the caller cannot read, and says so.
|
|
229
|
+
const pruned = copied.prunedPicks > 0 ? `, leaving out ${copied.prunedPicks} picked ${copied.prunedPicks === 1 ? "page" : "pages"} you cannot read` : "";
|
|
230
|
+
// M32 I5 (D12): and the stored values no data type can read any more.
|
|
231
|
+
const untyped = copied.prunedUntyped > 0 ? `, leaving out ${copied.prunedUntyped} stored ${copied.prunedUntyped === 1 ? "value" : "values"} no data type can read` : "";
|
|
232
|
+
ctx.out(flag(args, "json") ? ctx.json(copied) : `copied content ${id} to ${copied.node.id} (${cell(copied.node.path)})${pruned}${untyped}`);
|
|
209
233
|
return EXIT.ok;
|
|
210
234
|
},
|
|
211
235
|
};
|
|
@@ -220,7 +244,7 @@ export const restore = {
|
|
|
220
244
|
const parentRef = stringOption(args, "parent");
|
|
221
245
|
const parentId = parentRef === undefined ? undefined : await resolveContent(api, parentRef);
|
|
222
246
|
const result = await api.manage.content.restore(id, parentId === undefined ? undefined : { parentId });
|
|
223
|
-
ctx.out(flag(args, "json") ?
|
|
247
|
+
ctx.out(flag(args, "json") ? ctx.json(result) : `restored content ${id} (${result.restoredCount} nodes)`);
|
|
224
248
|
return EXIT.ok;
|
|
225
249
|
},
|
|
226
250
|
};
|