primitive-admin 1.1.0-alpha.9 → 1.1.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 +523 -109
- package/assets/skill/skills/primitive-platform/SKILL.md +289 -0
- package/dist/bin/primitive.d.ts +2 -0
- package/dist/bin/primitive.js +372 -21
- package/dist/bin/primitive.js.map +1 -1
- package/dist/src/commands/admins.d.ts +2 -0
- package/dist/src/commands/admins.js +136 -30
- package/dist/src/commands/admins.js.map +1 -1
- package/dist/src/commands/analytics.d.ts +2 -0
- package/dist/src/commands/analytics.js +713 -55
- package/dist/src/commands/analytics.js.map +1 -1
- package/dist/src/commands/apps.d.ts +2 -0
- package/dist/src/commands/apps.js +65 -100
- package/dist/src/commands/apps.js.map +1 -1
- package/dist/src/commands/auth-sessions.d.ts +7 -0
- package/dist/src/commands/auth-sessions.js +144 -0
- package/dist/src/commands/auth-sessions.js.map +1 -0
- package/dist/src/commands/auth.d.ts +2 -0
- package/dist/src/commands/auth.js +238 -108
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/blob-buckets.d.ts +2 -0
- package/dist/src/commands/blob-buckets.js +331 -0
- package/dist/src/commands/blob-buckets.js.map +1 -0
- package/dist/src/commands/catalog.d.ts +2 -0
- package/dist/src/commands/catalog.js +63 -48
- package/dist/src/commands/catalog.js.map +1 -1
- package/dist/src/commands/collection-type-configs.d.ts +2 -0
- package/dist/src/commands/collection-type-configs.js +85 -0
- package/dist/src/commands/collection-type-configs.js.map +1 -0
- package/dist/src/commands/collections.d.ts +2 -0
- package/dist/src/commands/collections.js +1282 -0
- package/dist/src/commands/collections.js.map +1 -0
- package/dist/src/commands/comparisons.d.ts +2 -0
- package/dist/src/commands/comparisons.js +6 -6
- package/dist/src/commands/comparisons.js.map +1 -1
- package/dist/src/commands/config.d.ts +46 -0
- package/dist/src/commands/config.js +465 -0
- package/dist/src/commands/config.js.map +1 -0
- package/dist/src/commands/connections.d.ts +2 -0
- package/dist/src/commands/connections.js +99 -0
- package/dist/src/commands/connections.js.map +1 -0
- package/dist/src/commands/cron-triggers.d.ts +2 -0
- package/dist/src/commands/cron-triggers.js +266 -0
- package/dist/src/commands/cron-triggers.js.map +1 -0
- package/dist/src/commands/database-type-configs.d.ts +2 -0
- package/dist/src/commands/database-type-configs.js +164 -0
- package/dist/src/commands/database-type-configs.js.map +1 -0
- package/dist/src/commands/database-types.d.ts +2 -0
- package/dist/src/commands/database-types.js +471 -0
- package/dist/src/commands/database-types.js.map +1 -0
- package/dist/src/commands/databases.d.ts +65 -0
- package/dist/src/commands/databases.js +1887 -243
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.d.ts +60 -0
- package/dist/src/commands/documents.js +2888 -22
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/email-templates.d.ts +2 -0
- package/dist/src/commands/email-templates.js +175 -0
- package/dist/src/commands/email-templates.js.map +1 -0
- package/dist/src/commands/env.d.ts +23 -0
- package/dist/src/commands/env.js +395 -0
- package/dist/src/commands/env.js.map +1 -0
- package/dist/src/commands/feature-flags.d.ts +14 -0
- package/dist/src/commands/feature-flags.js +117 -0
- package/dist/src/commands/feature-flags.js.map +1 -0
- package/dist/src/commands/functions.d.ts +20 -0
- package/dist/src/commands/functions.js +1630 -0
- package/dist/src/commands/functions.js.map +1 -0
- package/dist/src/commands/group-type-configs.d.ts +2 -0
- package/dist/src/commands/group-type-configs.js +87 -0
- package/dist/src/commands/group-type-configs.js.map +1 -0
- package/dist/src/commands/groups.d.ts +2 -0
- package/dist/src/commands/groups.js +65 -113
- package/dist/src/commands/groups.js.map +1 -1
- package/dist/src/commands/guides.d.ts +223 -0
- package/dist/src/commands/guides.js +627 -69
- package/dist/src/commands/guides.js.map +1 -1
- package/dist/src/commands/init.d.ts +37 -0
- package/dist/src/commands/init.js +1693 -208
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/integrations.d.ts +2 -0
- package/dist/src/commands/integrations.js +428 -187
- package/dist/src/commands/integrations.js.map +1 -1
- package/dist/src/commands/llm.d.ts +2 -0
- package/dist/src/commands/llm.js +4 -2
- package/dist/src/commands/llm.js.map +1 -1
- package/dist/src/commands/locks.d.ts +8 -0
- package/dist/src/commands/locks.js +175 -0
- package/dist/src/commands/locks.js.map +1 -0
- package/dist/src/commands/metadata-category-configs.d.ts +12 -0
- package/dist/src/commands/metadata-category-configs.js +113 -0
- package/dist/src/commands/metadata-category-configs.js.map +1 -0
- package/dist/src/commands/metadata.d.ts +2 -0
- package/dist/src/commands/metadata.js +288 -0
- package/dist/src/commands/metadata.js.map +1 -0
- package/dist/src/commands/prompts.d.ts +2 -0
- package/dist/src/commands/prompts.js +322 -634
- package/dist/src/commands/prompts.js.map +1 -1
- package/dist/src/commands/rule-sets.d.ts +3 -0
- package/dist/src/commands/rule-sets.js +139 -148
- package/dist/src/commands/rule-sets.js.map +1 -1
- package/dist/src/commands/scripts.d.ts +30 -0
- package/dist/src/commands/scripts.js +688 -0
- package/dist/src/commands/scripts.js.map +1 -0
- package/dist/src/commands/secrets.d.ts +2 -0
- package/dist/src/commands/secrets.js +109 -0
- package/dist/src/commands/secrets.js.map +1 -0
- package/dist/src/commands/sessions.d.ts +2 -0
- package/dist/src/commands/sessions.js +76 -0
- package/dist/src/commands/sessions.js.map +1 -0
- package/dist/src/commands/skill.d.ts +2 -0
- package/dist/src/commands/skill.js +29 -0
- package/dist/src/commands/skill.js.map +1 -0
- package/dist/src/commands/sync-app-settings.d.ts +158 -0
- package/dist/src/commands/sync-app-settings.js +328 -0
- package/dist/src/commands/sync-app-settings.js.map +1 -0
- package/dist/src/commands/sync.d.ts +2670 -0
- package/dist/src/commands/sync.js +17144 -834
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/commands/tokens.d.ts +2 -0
- package/dist/src/commands/tokens.js +132 -22
- package/dist/src/commands/tokens.js.map +1 -1
- package/dist/src/commands/users.d.ts +2 -0
- package/dist/src/commands/users.js +542 -24
- package/dist/src/commands/users.js.map +1 -1
- package/dist/src/commands/vars.d.ts +8 -0
- package/dist/src/commands/vars.js +97 -0
- package/dist/src/commands/vars.js.map +1 -0
- package/dist/src/commands/waitlist.d.ts +2 -0
- package/dist/src/commands/waitlist.js +12 -11
- package/dist/src/commands/waitlist.js.map +1 -1
- package/dist/src/commands/webhooks.d.ts +31 -0
- package/dist/src/commands/webhooks.js +633 -0
- package/dist/src/commands/webhooks.js.map +1 -0
- package/dist/src/commands/workflows.d.ts +88 -0
- package/dist/src/commands/workflows.js +1568 -742
- package/dist/src/commands/workflows.js.map +1 -1
- package/dist/src/lib/access-rule-display.d.ts +21 -0
- package/dist/src/lib/access-rule-display.js +34 -0
- package/dist/src/lib/access-rule-display.js.map +1 -0
- package/dist/src/lib/api-client.d.ts +2550 -0
- package/dist/src/lib/api-client.js +2503 -160
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +263 -0
- package/dist/src/lib/app-settings-descriptor.js +583 -0
- package/dist/src/lib/app-settings-descriptor.js.map +1 -0
- package/dist/src/lib/auth-flow.d.ts +8 -0
- package/dist/src/lib/batch.d.ts +26 -0
- package/dist/src/lib/batch.js +32 -0
- package/dist/src/lib/batch.js.map +1 -0
- package/dist/src/lib/block-layout.d.ts +160 -0
- package/dist/src/lib/block-layout.js +451 -0
- package/dist/src/lib/block-layout.js.map +1 -0
- package/dist/src/lib/block-selector.d.ts +58 -0
- package/dist/src/lib/block-selector.js +92 -0
- package/dist/src/lib/block-selector.js.map +1 -0
- package/dist/src/lib/canonical-json.d.ts +12 -0
- package/dist/src/lib/canonical-json.js +35 -0
- package/dist/src/lib/canonical-json.js.map +1 -0
- package/dist/src/lib/channel.d.ts +30 -0
- package/dist/src/lib/channel.js +68 -0
- package/dist/src/lib/channel.js.map +1 -0
- package/dist/src/lib/cli-manifest.d.ts +68 -0
- package/dist/src/lib/cli-manifest.js +71 -0
- package/dist/src/lib/cli-manifest.js.map +1 -0
- package/dist/src/lib/codegen-shared/generatedFiles.d.ts +101 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js +191 -0
- package/dist/src/lib/codegen-shared/generatedFiles.js.map +1 -0
- package/dist/src/lib/codegen-shared/prettierStable.d.ts +262 -0
- package/dist/src/lib/codegen-shared/prettierStable.js +610 -0
- package/dist/src/lib/codegen-shared/prettierStable.js.map +1 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.d.ts +38 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js +46 -0
- package/dist/src/lib/codegen-shared/resolveCodegenSourceDir.js.map +1 -0
- package/dist/src/lib/collection-export.d.ts +184 -0
- package/dist/src/lib/collection-export.js +252 -0
- package/dist/src/lib/collection-export.js.map +1 -0
- package/dist/src/lib/config-json-field.d.ts +28 -0
- package/dist/src/lib/config-json-field.js +56 -0
- package/dist/src/lib/config-json-field.js.map +1 -0
- package/dist/src/lib/config-object-descriptor.d.ts +127 -0
- package/dist/src/lib/config-object-descriptor.js +740 -0
- package/dist/src/lib/config-object-descriptor.js.map +1 -0
- package/dist/src/lib/config-payload.d.ts +92 -0
- package/dist/src/lib/config-payload.js +161 -0
- package/dist/src/lib/config-payload.js.map +1 -0
- package/dist/src/lib/config-surface.d.ts +141 -0
- package/dist/src/lib/config-surface.js +368 -0
- package/dist/src/lib/config-surface.js.map +1 -0
- package/dist/src/lib/config-toml.d.ts +10 -0
- package/dist/src/lib/config-toml.js +42 -0
- package/dist/src/lib/config-toml.js.map +1 -0
- package/dist/src/lib/config.d.ts +71 -0
- package/dist/src/lib/config.js +71 -68
- package/dist/src/lib/config.js.map +1 -1
- package/dist/src/lib/confirm-prompt.d.ts +83 -0
- package/dist/src/lib/confirm-prompt.js +110 -0
- package/dist/src/lib/confirm-prompt.js.map +1 -0
- package/dist/src/lib/constants.d.ts +11 -0
- package/dist/src/lib/constants.js +12 -0
- package/dist/src/lib/constants.js.map +1 -0
- package/dist/src/lib/crash-handlers.d.ts +20 -0
- package/dist/src/lib/crash-handlers.js +49 -0
- package/dist/src/lib/crash-handlers.js.map +1 -0
- package/dist/src/lib/credentials-store.d.ts +104 -0
- package/dist/src/lib/credentials-store.js +336 -0
- package/dist/src/lib/credentials-store.js.map +1 -0
- package/dist/src/lib/csv.d.ts +47 -0
- package/dist/src/lib/csv.js +172 -0
- package/dist/src/lib/csv.js.map +1 -0
- package/dist/src/lib/data-input.d.ts +23 -0
- package/dist/src/lib/data-input.js +50 -0
- package/dist/src/lib/data-input.js.map +1 -0
- package/dist/src/lib/db-codegen/dbFingerprint.d.ts +10 -0
- package/dist/src/lib/db-codegen/dbFingerprint.js +17 -0
- package/dist/src/lib/db-codegen/dbFingerprint.js.map +1 -0
- package/dist/src/lib/db-codegen/dbGenerator.d.ts +67 -0
- package/dist/src/lib/db-codegen/dbGenerator.js +170 -0
- package/dist/src/lib/db-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/db-codegen/dbNaming.d.ts +87 -0
- package/dist/src/lib/db-codegen/dbNaming.js +180 -0
- package/dist/src/lib/db-codegen/dbNaming.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTemplates.d.ts +272 -0
- package/dist/src/lib/db-codegen/dbTemplates.js +480 -0
- package/dist/src/lib/db-codegen/dbTemplates.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTsTypes.d.ts +73 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js +139 -0
- package/dist/src/lib/db-codegen/dbTsTypes.js.map +1 -0
- package/dist/src/lib/db-codegen/dbTypeIR.d.ts +146 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js +525 -0
- package/dist/src/lib/db-codegen/dbTypeIR.js.map +1 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.d.ts +112 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js +211 -0
- package/dist/src/lib/db-codegen/generated-operation-def-descriptor.js.map +1 -0
- package/dist/src/lib/deprecation.d.ts +22 -0
- package/dist/src/lib/deprecation.js +43 -0
- package/dist/src/lib/deprecation.js.map +1 -0
- package/dist/src/lib/document-export-permissions.d.ts +30 -0
- package/dist/src/lib/document-export-permissions.js +54 -0
- package/dist/src/lib/document-export-permissions.js.map +1 -0
- package/dist/src/lib/document-ingest-artifact.d.ts +120 -0
- package/dist/src/lib/document-ingest-artifact.js +505 -0
- package/dist/src/lib/document-ingest-artifact.js.map +1 -0
- package/dist/src/lib/document-ingest-input.d.ts +51 -0
- package/dist/src/lib/document-ingest-input.js +132 -0
- package/dist/src/lib/document-ingest-input.js.map +1 -0
- package/dist/src/lib/document-ingest-rows.d.ts +137 -0
- package/dist/src/lib/document-ingest-rows.js +181 -0
- package/dist/src/lib/document-ingest-rows.js.map +1 -0
- package/dist/src/lib/document-ingest.d.ts +101 -0
- package/dist/src/lib/document-ingest.js +384 -0
- package/dist/src/lib/document-ingest.js.map +1 -0
- package/dist/src/lib/env-resolver-core.d.ts +258 -0
- package/dist/src/lib/env-resolver-core.js +447 -0
- package/dist/src/lib/env-resolver-core.js.map +1 -0
- package/dist/src/lib/env-resolver.d.ts +99 -0
- package/dist/src/lib/env-resolver.js +153 -0
- package/dist/src/lib/env-resolver.js.map +1 -0
- package/dist/src/lib/fetch.d.ts +5 -0
- package/dist/src/lib/function-bundle.d.ts +147 -0
- package/dist/src/lib/function-bundle.js +341 -0
- package/dist/src/lib/function-bundle.js.map +1 -0
- package/dist/src/lib/function-collect.d.ts +123 -0
- package/dist/src/lib/function-collect.js +610 -0
- package/dist/src/lib/function-collect.js.map +1 -0
- package/dist/src/lib/function-db-types.d.ts +202 -0
- package/dist/src/lib/function-db-types.js +870 -0
- package/dist/src/lib/function-db-types.js.map +1 -0
- package/dist/src/lib/function-document-types.d.ts +144 -0
- package/dist/src/lib/function-document-types.js +370 -0
- package/dist/src/lib/function-document-types.js.map +1 -0
- package/dist/src/lib/function-grants-preflight.d.ts +64 -0
- package/dist/src/lib/function-grants-preflight.js +105 -0
- package/dist/src/lib/function-grants-preflight.js.map +1 -0
- package/dist/src/lib/function-log-lines.d.ts +76 -0
- package/dist/src/lib/function-log-lines.js +160 -0
- package/dist/src/lib/function-log-lines.js.map +1 -0
- package/dist/src/lib/function-log-row.d.ts +29 -0
- package/dist/src/lib/function-log-row.js +73 -0
- package/dist/src/lib/function-log-row.js.map +1 -0
- package/dist/src/lib/function-log-tail.d.ts +132 -0
- package/dist/src/lib/function-log-tail.js +262 -0
- package/dist/src/lib/function-log-tail.js.map +1 -0
- package/dist/src/lib/function-run.d.ts +289 -0
- package/dist/src/lib/function-run.js +389 -0
- package/dist/src/lib/function-run.js.map +1 -0
- package/dist/src/lib/function-schema-codegen.d.ts +143 -0
- package/dist/src/lib/function-schema-codegen.js +420 -0
- package/dist/src/lib/function-schema-codegen.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +459 -0
- package/dist/src/lib/function-sync.js +1258 -0
- package/dist/src/lib/function-sync.js.map +1 -0
- package/dist/src/lib/function-trigger-listing.d.ts +27 -0
- package/dist/src/lib/function-trigger-listing.js +70 -0
- package/dist/src/lib/function-trigger-listing.js.map +1 -0
- package/dist/src/lib/function-typecheck.d.ts +86 -0
- package/dist/src/lib/function-typecheck.js +370 -0
- package/dist/src/lib/function-typecheck.js.map +1 -0
- package/dist/src/lib/function-versions.d.ts +122 -0
- package/dist/src/lib/function-versions.js +182 -0
- package/dist/src/lib/function-versions.js.map +1 -0
- package/dist/src/lib/generated-allowlist.d.ts +28 -0
- package/dist/src/lib/generated-allowlist.js +281 -0
- package/dist/src/lib/generated-allowlist.js.map +1 -0
- package/dist/src/lib/generated-config-surfaces.d.ts +2936 -0
- package/dist/src/lib/generated-config-surfaces.js +10569 -0
- package/dist/src/lib/generated-config-surfaces.js.map +1 -0
- package/dist/src/lib/generated-sdk-types.d.ts +12 -0
- package/dist/src/lib/generated-sdk-types.js +13 -0
- package/dist/src/lib/generated-sdk-types.js.map +1 -0
- package/dist/src/lib/generated-template-lint.d.ts +212 -0
- package/dist/src/lib/generated-template-lint.js +624 -0
- package/dist/src/lib/generated-template-lint.js.map +1 -0
- package/dist/src/lib/init-adopt.d.ts +16 -0
- package/dist/src/lib/init-adopt.js +34 -0
- package/dist/src/lib/init-adopt.js.map +1 -0
- package/dist/src/lib/init-assets.d.ts +39 -0
- package/dist/src/lib/init-assets.js +97 -0
- package/dist/src/lib/init-assets.js.map +1 -0
- package/dist/src/lib/init-client-platforms.d.ts +14 -0
- package/dist/src/lib/init-client-platforms.js +71 -0
- package/dist/src/lib/init-client-platforms.js.map +1 -0
- package/dist/src/lib/init-config.d.ts +98 -0
- package/dist/src/lib/init-config.js +186 -0
- package/dist/src/lib/init-config.js.map +1 -0
- package/dist/src/lib/init-email-redirect-uris.d.ts +37 -0
- package/dist/src/lib/init-email-redirect-uris.js +46 -0
- package/dist/src/lib/init-email-redirect-uris.js.map +1 -0
- package/dist/src/lib/init-ios-links.d.ts +91 -0
- package/dist/src/lib/init-ios-links.js +219 -0
- package/dist/src/lib/init-ios-links.js.map +1 -0
- package/dist/src/lib/init-plan.d.ts +80 -0
- package/dist/src/lib/init-plan.js +95 -0
- package/dist/src/lib/init-plan.js.map +1 -0
- package/dist/src/lib/init-production-env.d.ts +48 -0
- package/dist/src/lib/init-production-env.js +59 -0
- package/dist/src/lib/init-production-env.js.map +1 -0
- package/dist/src/lib/init-schema.d.ts +74 -0
- package/dist/src/lib/init-schema.js +358 -0
- package/dist/src/lib/init-schema.js.map +1 -0
- package/dist/src/lib/init-xcode.d.ts +34 -0
- package/dist/src/lib/init-xcode.js +138 -0
- package/dist/src/lib/init-xcode.js.map +1 -0
- package/dist/src/lib/integration-request-config.d.ts +30 -0
- package/dist/src/lib/integration-request-config.js +145 -0
- package/dist/src/lib/integration-request-config.js.map +1 -0
- package/dist/src/lib/integration-selector.d.ts +42 -0
- package/dist/src/lib/integration-selector.js +46 -0
- package/dist/src/lib/integration-selector.js.map +1 -0
- package/dist/src/lib/ios-app-id.d.ts +34 -0
- package/dist/src/lib/ios-app-id.js +69 -0
- package/dist/src/lib/ios-app-id.js.map +1 -0
- package/dist/src/lib/list-options.d.ts +68 -0
- package/dist/src/lib/list-options.js +89 -0
- package/dist/src/lib/list-options.js.map +1 -0
- package/dist/src/lib/local-state.d.ts +55 -0
- package/dist/src/lib/local-state.js +167 -0
- package/dist/src/lib/local-state.js.map +1 -0
- package/dist/src/lib/local-test-cases.d.ts +63 -0
- package/dist/src/lib/local-test-cases.js +136 -0
- package/dist/src/lib/local-test-cases.js.map +1 -0
- package/dist/src/lib/log-inspection.d.ts +715 -0
- package/dist/src/lib/log-inspection.js +816 -0
- package/dist/src/lib/log-inspection.js.map +1 -0
- package/dist/src/lib/logout-admin-session.d.ts +33 -0
- package/dist/src/lib/logout-admin-session.js +70 -0
- package/dist/src/lib/logout-admin-session.js.map +1 -0
- package/dist/src/lib/migration-nag.d.ts +49 -0
- package/dist/src/lib/migration-nag.js +163 -0
- package/dist/src/lib/migration-nag.js.map +1 -0
- package/dist/src/lib/object-status-filter.d.ts +22 -0
- package/dist/src/lib/object-status-filter.js +45 -0
- package/dist/src/lib/object-status-filter.js.map +1 -0
- package/dist/src/lib/output.d.ts +124 -0
- package/dist/src/lib/output.js +219 -8
- package/dist/src/lib/output.js.map +1 -1
- package/dist/src/lib/package-manager.d.ts +140 -0
- package/dist/src/lib/package-manager.js +305 -0
- package/dist/src/lib/package-manager.js.map +1 -0
- package/dist/src/lib/paginate.d.ts +98 -0
- package/dist/src/lib/paginate.js +112 -0
- package/dist/src/lib/paginate.js.map +1 -0
- package/dist/src/lib/platform-owned.d.ts +63 -0
- package/dist/src/lib/platform-owned.js +85 -0
- package/dist/src/lib/platform-owned.js.map +1 -0
- package/dist/src/lib/project-config.d.ts +122 -0
- package/dist/src/lib/project-config.js +244 -0
- package/dist/src/lib/project-config.js.map +1 -0
- package/dist/src/lib/prompt-cost-format.d.ts +11 -0
- package/dist/src/lib/prompt-cost-format.js +41 -0
- package/dist/src/lib/prompt-cost-format.js.map +1 -0
- package/dist/src/lib/prompt-schema-codegen.d.ts +147 -0
- package/dist/src/lib/prompt-schema-codegen.js +462 -0
- package/dist/src/lib/prompt-schema-codegen.js.map +1 -0
- package/dist/src/lib/query-operators.d.ts +43 -0
- package/dist/src/lib/query-operators.js +80 -0
- package/dist/src/lib/query-operators.js.map +1 -0
- package/dist/src/lib/record-filter.d.ts +18 -0
- package/dist/src/lib/record-filter.js +55 -0
- package/dist/src/lib/record-filter.js.map +1 -0
- package/dist/src/lib/refresh-admin-credentials.d.ts +73 -0
- package/dist/src/lib/refresh-admin-credentials.js +123 -0
- package/dist/src/lib/refresh-admin-credentials.js.map +1 -0
- package/dist/src/lib/resolve-init-dev-port.d.ts +56 -0
- package/dist/src/lib/resolve-init-dev-port.js +55 -0
- package/dist/src/lib/resolve-init-dev-port.js.map +1 -0
- package/dist/src/lib/resolve-init-server.d.ts +64 -0
- package/dist/src/lib/resolve-init-server.js +77 -0
- package/dist/src/lib/resolve-init-server.js.map +1 -0
- package/dist/src/lib/resolve-owner.d.ts +19 -0
- package/dist/src/lib/resolve-owner.js +20 -0
- package/dist/src/lib/resolve-owner.js.map +1 -0
- package/dist/src/lib/resolve-platform.d.ts +74 -0
- package/dist/src/lib/resolve-platform.js +105 -0
- package/dist/src/lib/resolve-platform.js.map +1 -0
- package/dist/src/lib/run-status.d.ts +19 -0
- package/dist/src/lib/run-status.generated.d.ts +39 -0
- package/dist/src/lib/run-status.generated.js +66 -0
- package/dist/src/lib/run-status.generated.js.map +1 -0
- package/dist/src/lib/run-status.js +19 -0
- package/dist/src/lib/run-status.js.map +1 -0
- package/dist/src/lib/server-text-normalization.d.ts +51 -0
- package/dist/src/lib/server-text-normalization.js +90 -0
- package/dist/src/lib/server-text-normalization.js.map +1 -0
- package/dist/src/lib/server-url.d.ts +22 -0
- package/dist/src/lib/server-url.js +33 -0
- package/dist/src/lib/server-url.js.map +1 -0
- package/dist/src/lib/signing-secret-status.d.ts +81 -0
- package/dist/src/lib/signing-secret-status.js +116 -0
- package/dist/src/lib/signing-secret-status.js.map +1 -0
- package/dist/src/lib/skill-installer.d.ts +71 -0
- package/dist/src/lib/skill-installer.js +441 -0
- package/dist/src/lib/skill-installer.js.map +1 -0
- package/dist/src/lib/snapshot-audit-source.d.ts +45 -0
- package/dist/src/lib/snapshot-audit-source.js +58 -0
- package/dist/src/lib/snapshot-audit-source.js.map +1 -0
- package/dist/src/lib/snapshot-audit-store.d.ts +52 -0
- package/dist/src/lib/snapshot-audit-store.js +196 -0
- package/dist/src/lib/snapshot-audit-store.js.map +1 -0
- package/dist/src/lib/snapshot-audit.d.ts +207 -0
- package/dist/src/lib/snapshot-audit.js +431 -0
- package/dist/src/lib/snapshot-audit.js.map +1 -0
- package/dist/src/lib/snapshot-build-rows.d.ts +60 -0
- package/dist/src/lib/snapshot-build-rows.js +87 -0
- package/dist/src/lib/snapshot-build-rows.js.map +1 -0
- package/dist/src/lib/snapshot-build.d.ts +50 -0
- package/dist/src/lib/snapshot-build.js +111 -0
- package/dist/src/lib/snapshot-build.js.map +1 -0
- package/dist/src/lib/snapshot-manifest-layout.d.ts +61 -0
- package/dist/src/lib/snapshot-manifest-layout.js +70 -0
- package/dist/src/lib/snapshot-manifest-layout.js.map +1 -0
- package/dist/src/lib/snapshots.d.ts +98 -0
- package/dist/src/lib/snapshots.js +294 -0
- package/dist/src/lib/snapshots.js.map +1 -0
- package/dist/src/lib/step-run-table.d.ts +43 -0
- package/dist/src/lib/step-run-table.js +129 -0
- package/dist/src/lib/step-run-table.js.map +1 -0
- package/dist/src/lib/storage-pending-retry.d.ts +26 -0
- package/dist/src/lib/storage-pending-retry.js +42 -0
- package/dist/src/lib/storage-pending-retry.js.map +1 -0
- package/dist/src/lib/swift-codegen/agentGenerator.d.ts +42 -0
- package/dist/src/lib/swift-codegen/agentGenerator.js +118 -0
- package/dist/src/lib/swift-codegen/agentGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/banners.d.ts +24 -0
- package/dist/src/lib/swift-codegen/banners.js +25 -0
- package/dist/src/lib/swift-codegen/banners.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbGenerator.d.ts +113 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js +926 -0
- package/dist/src/lib/swift-codegen/dbGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.d.ts +42 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js +100 -0
- package/dist/src/lib/swift-codegen/dbSwiftTypes.js.map +1 -0
- package/dist/src/lib/swift-codegen/functionGenerator.d.ts +139 -0
- package/dist/src/lib/swift-codegen/functionGenerator.js +462 -0
- package/dist/src/lib/swift-codegen/functionGenerator.js.map +1 -0
- package/dist/src/lib/swift-codegen/generator.d.ts +100 -0
- package/dist/src/lib/swift-codegen/generator.js +457 -0
- package/dist/src/lib/swift-codegen/generator.js.map +1 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.d.ts +87 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js +661 -0
- package/dist/src/lib/swift-codegen/schemaToSwift.js.map +1 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.d.ts +94 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js +155 -0
- package/dist/src/lib/swift-codegen/siblingSymbols.js.map +1 -0
- package/dist/src/lib/swift-codegen/swiftNaming.d.ts +85 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js +198 -0
- package/dist/src/lib/swift-codegen/swiftNaming.js.map +1 -0
- package/dist/src/lib/sync-dir-selector.d.ts +21 -0
- package/dist/src/lib/sync-dir-selector.js +30 -0
- package/dist/src/lib/sync-dir-selector.js.map +1 -0
- package/dist/src/lib/sync-paths.d.ts +128 -0
- package/dist/src/lib/sync-paths.js +195 -0
- package/dist/src/lib/sync-paths.js.map +1 -0
- package/dist/src/lib/sync-resource-types.d.ts +563 -0
- package/dist/src/lib/sync-resource-types.js +1073 -0
- package/dist/src/lib/sync-resource-types.js.map +1 -0
- package/dist/src/lib/sync-selectors.d.ts +138 -0
- package/dist/src/lib/sync-selectors.js +289 -0
- package/dist/src/lib/sync-selectors.js.map +1 -0
- package/dist/src/lib/template.d.ts +170 -0
- package/dist/src/lib/template.js +484 -68
- package/dist/src/lib/template.js.map +1 -1
- package/dist/src/lib/test-case-file-names.d.ts +40 -0
- package/dist/src/lib/test-case-file-names.js +91 -0
- package/dist/src/lib/test-case-file-names.js.map +1 -0
- package/dist/src/lib/test-case-keys.d.ts +29 -0
- package/dist/src/lib/test-case-keys.js +55 -0
- package/dist/src/lib/test-case-keys.js.map +1 -0
- package/dist/src/lib/test-case-variables.d.ts +29 -0
- package/dist/src/lib/test-case-variables.js +71 -0
- package/dist/src/lib/test-case-variables.js.map +1 -0
- package/dist/src/lib/token-inject.d.ts +56 -0
- package/dist/src/lib/token-inject.js +204 -0
- package/dist/src/lib/token-inject.js.map +1 -0
- package/dist/src/lib/toml-database-config.d.ts +123 -0
- package/dist/src/lib/toml-database-config.js +544 -0
- package/dist/src/lib/toml-database-config.js.map +1 -0
- package/dist/src/lib/toml-metadata-config.d.ts +151 -0
- package/dist/src/lib/toml-metadata-config.js +476 -0
- package/dist/src/lib/toml-metadata-config.js.map +1 -0
- package/dist/src/lib/toml-native-form.d.ts +46 -0
- package/dist/src/lib/toml-native-form.js +78 -0
- package/dist/src/lib/toml-native-form.js.map +1 -0
- package/dist/src/lib/toml-params-validator.d.ts +129 -0
- package/dist/src/lib/toml-params-validator.js +298 -0
- package/dist/src/lib/toml-params-validator.js.map +1 -0
- package/dist/src/lib/toml-scalar-edit.d.ts +43 -0
- package/dist/src/lib/toml-scalar-edit.js +283 -0
- package/dist/src/lib/toml-scalar-edit.js.map +1 -0
- package/dist/src/lib/user-selector.d.ts +24 -0
- package/dist/src/lib/user-selector.js +33 -0
- package/dist/src/lib/user-selector.js.map +1 -0
- package/dist/src/lib/version-check.d.ts +35 -0
- package/dist/src/lib/version-check.js +241 -0
- package/dist/src/lib/version-check.js.map +1 -0
- package/dist/src/lib/watch.d.ts +121 -0
- package/dist/src/lib/watch.js +169 -0
- package/dist/src/lib/watch.js.map +1 -0
- package/dist/src/lib/web-url.d.ts +40 -0
- package/dist/src/lib/web-url.js +76 -0
- package/dist/src/lib/web-url.js.map +1 -0
- package/dist/src/lib/webhook-deliver.d.ts +209 -0
- package/dist/src/lib/webhook-deliver.js +519 -0
- package/dist/src/lib/webhook-deliver.js.map +1 -0
- package/dist/src/lib/workflow-apply.d.ts +110 -0
- package/dist/src/lib/workflow-apply.js +164 -0
- package/dist/src/lib/workflow-apply.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.d.ts +129 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js +269 -0
- package/dist/src/lib/workflow-codegen/generated-schema-descriptor.js.map +1 -0
- package/dist/src/lib/workflow-codegen/generator.d.ts +96 -0
- package/dist/src/lib/workflow-codegen/generator.js +361 -0
- package/dist/src/lib/workflow-codegen/generator.js.map +1 -0
- package/dist/src/lib/workflow-codegen/invokerIR.d.ts +94 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js +76 -0
- package/dist/src/lib/workflow-codegen/invokerIR.js.map +1 -0
- package/dist/src/lib/workflow-codegen/naming.d.ts +33 -0
- package/dist/src/lib/workflow-codegen/naming.js +81 -0
- package/dist/src/lib/workflow-codegen/naming.js.map +1 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.d.ts +80 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js +303 -0
- package/dist/src/lib/workflow-codegen/schemaToTs.js.map +1 -0
- package/dist/src/lib/workflow-config-apply.d.ts +70 -0
- package/dist/src/lib/workflow-config-apply.js +137 -0
- package/dist/src/lib/workflow-config-apply.js.map +1 -0
- package/dist/src/lib/workflow-config-sidecar.d.ts +63 -0
- package/dist/src/lib/workflow-config-sidecar.js +96 -0
- package/dist/src/lib/workflow-config-sidecar.js.map +1 -0
- package/dist/src/lib/workflow-defaults.d.ts +29 -0
- package/dist/src/lib/workflow-defaults.js +41 -0
- package/dist/src/lib/workflow-defaults.js.map +1 -0
- package/dist/src/lib/workflow-fragments.d.ts +64 -0
- package/dist/src/lib/workflow-fragments.js +342 -0
- package/dist/src/lib/workflow-fragments.js.map +1 -0
- package/dist/src/lib/workflow-include-preserve.d.ts +76 -0
- package/dist/src/lib/workflow-include-preserve.js +286 -0
- package/dist/src/lib/workflow-include-preserve.js.map +1 -0
- package/dist/src/lib/workflow-payload.d.ts +98 -0
- package/dist/src/lib/workflow-payload.js +178 -0
- package/dist/src/lib/workflow-payload.js.map +1 -0
- package/dist/src/lib/workflow-toml-validator.d.ts +211 -0
- package/dist/src/lib/workflow-toml-validator.js +770 -0
- package/dist/src/lib/workflow-toml-validator.js.map +1 -0
- package/dist/src/lib/workflow-usage.d.ts +196 -0
- package/dist/src/lib/workflow-usage.js +310 -0
- package/dist/src/lib/workflow-usage.js.map +1 -0
- package/dist/src/types/index.d.ts +591 -0
- package/dist/src/validators.d.ts +65 -0
- package/dist/src/validators.js +64 -0
- package/dist/src/validators.js.map +1 -0
- package/package.json +34 -9
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from "fs";
|
|
2
|
+
import { readFile } from "fs/promises";
|
|
3
|
+
import { createHash } from "crypto";
|
|
4
|
+
import { homedir } from "os";
|
|
5
|
+
import { join, dirname } from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import chalk from "chalk";
|
|
8
|
+
/**
|
|
9
|
+
* `~/.claude`, or `PRIMITIVE_CLAUDE_DIR` when set. The override exists for the
|
|
10
|
+
* unit tests: `os.homedir()` reads the real process environment, which a
|
|
11
|
+
* vitest worker's `process.env` does not reach, so a test cannot stage a
|
|
12
|
+
* home directory by moving HOME.
|
|
13
|
+
*/
|
|
14
|
+
function claudeDir() {
|
|
15
|
+
return process.env.PRIMITIVE_CLAUDE_DIR || join(homedir(), ".claude");
|
|
16
|
+
}
|
|
17
|
+
function skillsDir() {
|
|
18
|
+
return join(claudeDir(), "skills");
|
|
19
|
+
}
|
|
20
|
+
// The public skill, bundled with the CLI.
|
|
21
|
+
const PUBLIC_SKILL_NAME = "primitive-platform";
|
|
22
|
+
function publicSkillDir() {
|
|
23
|
+
return join(skillsDir(), PUBLIC_SKILL_NAME);
|
|
24
|
+
}
|
|
25
|
+
function publicSkillFile() {
|
|
26
|
+
return join(publicSkillDir(), "SKILL.md");
|
|
27
|
+
}
|
|
28
|
+
function publicHashFile() {
|
|
29
|
+
return join(publicSkillDir(), ".version");
|
|
30
|
+
}
|
|
31
|
+
const INTERNAL_SKILL_NAME = "primitive-platform-internal";
|
|
32
|
+
const FILE_ISSUE_SKILL_NAME = "file-issue";
|
|
33
|
+
// file-issue runs `_shared` scripts and reads `_shared` templates. In the
|
|
34
|
+
// repo `_shared` is a sibling of the skill (.claude/skills/_shared); in user
|
|
35
|
+
// space it is installed inside the skill directory, which the skill's own
|
|
36
|
+
// `$SHARED` resolution expects. check-filing.sh carries its section lists
|
|
37
|
+
// inline (it does not read the templates), but the skill drafts from the
|
|
38
|
+
// templates, so they ship too. linked-issue.sh sources closing-refs.sh.
|
|
39
|
+
const SHARED = ".claude/skills/_shared";
|
|
40
|
+
const FILE_ISSUE_SHARED_FILES = [
|
|
41
|
+
"check-filing.sh",
|
|
42
|
+
"resolve-sponsor.sh",
|
|
43
|
+
"linked-issue.sh",
|
|
44
|
+
"closing-refs.sh",
|
|
45
|
+
"filing-conventions.md",
|
|
46
|
+
"templates/bug-filing.md",
|
|
47
|
+
"templates/feature-filing.md",
|
|
48
|
+
"templates/docs-filing.md",
|
|
49
|
+
];
|
|
50
|
+
export const FETCHED_SKILLS = [
|
|
51
|
+
{
|
|
52
|
+
name: INTERNAL_SKILL_NAME,
|
|
53
|
+
files: [
|
|
54
|
+
{
|
|
55
|
+
repoPath: `internal-skills/${INTERNAL_SKILL_NAME}/SKILL.md`,
|
|
56
|
+
localPath: "SKILL.md",
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: FILE_ISSUE_SKILL_NAME,
|
|
62
|
+
files: [
|
|
63
|
+
{ repoPath: `.claude/skills/${FILE_ISSUE_SKILL_NAME}/SKILL.md`, localPath: "SKILL.md" },
|
|
64
|
+
...FILE_ISSUE_SHARED_FILES.map((f) => ({
|
|
65
|
+
repoPath: `${SHARED}/${f}`,
|
|
66
|
+
localPath: `_shared/${f}`,
|
|
67
|
+
})),
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
function fetchedSkillDir(skill) {
|
|
72
|
+
return join(skillsDir(), skill.name);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* One stamp for all fetched skills, kept where the first fetched skill's
|
|
76
|
+
* stamp has always lived (`primitive-platform-internal/.version`) so installs
|
|
77
|
+
* made before file-issue was added upgrade in place: an old-format stamp has
|
|
78
|
+
* no `skills` map, and the next per-version refresh fills it in.
|
|
79
|
+
*/
|
|
80
|
+
function membersStampFile() {
|
|
81
|
+
return join(skillsDir(), INTERNAL_SKILL_NAME, ".version");
|
|
82
|
+
}
|
|
83
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
84
|
+
function getBundledSkillPath() {
|
|
85
|
+
// In dist: dist/src/lib/skill-installer.js -> ../../../assets/...
|
|
86
|
+
// In source (tsx): src/lib/skill-installer.ts -> ../../assets/...
|
|
87
|
+
const distPath = fileURLToPath(new URL("../../../assets/skill/skills/primitive-platform/SKILL.md", import.meta.url));
|
|
88
|
+
if (existsSync(distPath))
|
|
89
|
+
return distPath;
|
|
90
|
+
return fileURLToPath(new URL("../../assets/skill/skills/primitive-platform/SKILL.md", import.meta.url));
|
|
91
|
+
}
|
|
92
|
+
export function getCliVersion() {
|
|
93
|
+
// Same dual-path layout as getBundledSkillPath: dist/src/lib -> package root
|
|
94
|
+
// is three levels up; src/lib (tsx) -> two levels up.
|
|
95
|
+
// Both candidates can exist (from source, ../../../ is the repo root), so
|
|
96
|
+
// require the CLI's package name to pick the right one.
|
|
97
|
+
for (const rel of ["../../../package.json", "../../package.json"]) {
|
|
98
|
+
try {
|
|
99
|
+
const path = fileURLToPath(new URL(rel, import.meta.url));
|
|
100
|
+
if (!existsSync(path))
|
|
101
|
+
continue;
|
|
102
|
+
const pkg = JSON.parse(readFileSync(path, "utf-8"));
|
|
103
|
+
if (pkg.name === "primitive-admin" && typeof pkg.version === "string") {
|
|
104
|
+
return pkg.version;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
// try next path
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
function computeHash(content) {
|
|
114
|
+
return createHash("sha256").update(content).digest("hex").slice(0, 12);
|
|
115
|
+
}
|
|
116
|
+
function getInstalledHash() {
|
|
117
|
+
try {
|
|
118
|
+
if (!existsSync(publicHashFile()))
|
|
119
|
+
return null;
|
|
120
|
+
return readFileSync(publicHashFile(), "utf-8").trim();
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Returns true if the skill is currently installed.
|
|
128
|
+
*/
|
|
129
|
+
export function isSkillInstalled() {
|
|
130
|
+
return getInstalledHash() !== null;
|
|
131
|
+
}
|
|
132
|
+
function getMembersStamp() {
|
|
133
|
+
try {
|
|
134
|
+
const file = membersStampFile();
|
|
135
|
+
if (!existsSync(file))
|
|
136
|
+
return null;
|
|
137
|
+
const stamp = JSON.parse(readFileSync(file, "utf-8"));
|
|
138
|
+
if (typeof stamp.cliVersion === "string" && typeof stamp.hash === "string") {
|
|
139
|
+
return stamp;
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function writeMembersStamp(stamp) {
|
|
148
|
+
mkdirSync(dirname(membersStampFile()), { recursive: true });
|
|
149
|
+
writeFileSync(membersStampFile(), JSON.stringify(stamp, null, 2));
|
|
150
|
+
}
|
|
151
|
+
/** The installed hash of a fetched skill, from the stamp; null when absent. */
|
|
152
|
+
function installedFetchedHash(skill, stamp) {
|
|
153
|
+
if (!stamp)
|
|
154
|
+
return null;
|
|
155
|
+
if (!existsSync(join(fetchedSkillDir(skill), "SKILL.md")))
|
|
156
|
+
return null;
|
|
157
|
+
if (skill.name === INTERNAL_SKILL_NAME && !stamp.skills)
|
|
158
|
+
return stamp.hash;
|
|
159
|
+
return stamp.skills?.[skill.name] ?? null;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Read one file of the private js-bao-wss repo (main branch) via the GitHub
|
|
163
|
+
* contents API through `gh`. Returns null if gh is missing, unauthenticated,
|
|
164
|
+
* or the caller lacks access to the repo — access failure is how non-members
|
|
165
|
+
* are gated.
|
|
166
|
+
*
|
|
167
|
+
* `PRIMITIVE_SKILL_SOURCE_DIR` reads the same repo paths from a local
|
|
168
|
+
* checkout instead, to try a skill edit before it is merged (and for the
|
|
169
|
+
* unit tests, which install from this repo's own files).
|
|
170
|
+
*/
|
|
171
|
+
export async function fetchRepoFile(repoPath) {
|
|
172
|
+
const sourceDir = process.env.PRIMITIVE_SKILL_SOURCE_DIR;
|
|
173
|
+
if (sourceDir) {
|
|
174
|
+
try {
|
|
175
|
+
return await readFile(join(sourceDir, repoPath), "utf-8");
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
const { execFile } = await import("child_process");
|
|
183
|
+
const { promisify } = await import("util");
|
|
184
|
+
const { stdout } = await promisify(execFile)("gh", ["api", "-H", "Accept: application/vnd.github.raw", `repos/Primitive-Labs/js-bao-wss/contents/${repoPath}`], { timeout: 15000, maxBuffer: 4 * 1024 * 1024 });
|
|
185
|
+
return stdout;
|
|
186
|
+
}
|
|
187
|
+
catch {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Fetch every file of a members' skill. Null if any file is unavailable, so
|
|
193
|
+
* a partial skill is never written over a complete one.
|
|
194
|
+
*/
|
|
195
|
+
async function fetchSkill(skill) {
|
|
196
|
+
const files = new Map();
|
|
197
|
+
for (const file of skill.files) {
|
|
198
|
+
const content = await fetchRepoFile(file.repoPath);
|
|
199
|
+
if (content === null || content.length === 0)
|
|
200
|
+
return null;
|
|
201
|
+
// Sanity check the skill file itself: must be a skill, not an error payload.
|
|
202
|
+
if (file.localPath === "SKILL.md" && (!content.startsWith("---") || !content.includes(`name: ${skill.name}`))) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
files.set(file.localPath, content);
|
|
206
|
+
}
|
|
207
|
+
return files;
|
|
208
|
+
}
|
|
209
|
+
/** Hash of a fetched skill: every file's path and content, in manifest order. */
|
|
210
|
+
function hashSkillFiles(skill, files) {
|
|
211
|
+
const h = createHash("sha256");
|
|
212
|
+
for (const file of skill.files) {
|
|
213
|
+
h.update(file.localPath).update("\0").update(files.get(file.localPath) ?? "").update("\0");
|
|
214
|
+
}
|
|
215
|
+
return h.digest("hex").slice(0, 12);
|
|
216
|
+
}
|
|
217
|
+
function writeFetchedSkill(skill, files) {
|
|
218
|
+
const dir = fetchedSkillDir(skill);
|
|
219
|
+
for (const [localPath, content] of files) {
|
|
220
|
+
const target = join(dir, localPath);
|
|
221
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
222
|
+
writeFileSync(target, content);
|
|
223
|
+
}
|
|
224
|
+
return hashSkillFiles(skill, files);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Fetch and write every members' skill. Returns the per-skill hash of what
|
|
228
|
+
* is now installed (a skill whose fetch failed keeps its previous hash, or
|
|
229
|
+
* is absent from the result when it was never installed).
|
|
230
|
+
*/
|
|
231
|
+
async function installFetchedSkills(previous) {
|
|
232
|
+
const installed = {};
|
|
233
|
+
const fetched = [];
|
|
234
|
+
const failed = [];
|
|
235
|
+
for (const skill of FETCHED_SKILLS) {
|
|
236
|
+
const files = await fetchSkill(skill);
|
|
237
|
+
if (files) {
|
|
238
|
+
installed[skill.name] = writeFetchedSkill(skill, files);
|
|
239
|
+
fetched.push(skill.name);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
const kept = installedFetchedHash(skill, previous);
|
|
243
|
+
if (kept)
|
|
244
|
+
installed[skill.name] = kept;
|
|
245
|
+
failed.push(skill.name);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return { installed, fetched, failed };
|
|
249
|
+
}
|
|
250
|
+
function stampFrom(cliVersion, installed) {
|
|
251
|
+
return {
|
|
252
|
+
cliVersion,
|
|
253
|
+
hash: installed[INTERNAL_SKILL_NAME] ?? "",
|
|
254
|
+
skills: installed,
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Refresh the members' skills if the CLI version changed since the last
|
|
259
|
+
* attempt. One fetch per CLI release: the stamp is advanced even when the
|
|
260
|
+
* fetch fails, so an offline or revoked user isn't retried on every command
|
|
261
|
+
* (an explicit `primitive skill install` always refetches). Only runs when
|
|
262
|
+
* a members' skill is already installed — a first install is explicit only.
|
|
263
|
+
*/
|
|
264
|
+
async function refreshFetchedSkills() {
|
|
265
|
+
const stamp = getMembersStamp();
|
|
266
|
+
if (!stamp)
|
|
267
|
+
return; // not installed — explicit install only
|
|
268
|
+
const cliVersion = getCliVersion();
|
|
269
|
+
if (!cliVersion || stamp.cliVersion === cliVersion)
|
|
270
|
+
return;
|
|
271
|
+
const { installed, fetched } = await installFetchedSkills(stamp);
|
|
272
|
+
if (fetched.length === 0) {
|
|
273
|
+
writeMembersStamp({ ...stamp, cliVersion });
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
const changed = fetched.filter((name) => installed[name] !== installedFetchedHash(FETCHED_SKILLS.find((s) => s.name === name), stamp));
|
|
277
|
+
writeMembersStamp(stampFrom(cliVersion, installed));
|
|
278
|
+
if (changed.length > 0) {
|
|
279
|
+
// Diagnostic, not payload: post-command notices must stay off stdout so
|
|
280
|
+
// `primitive <verb> --json | jq .` parses (#2357). Same stream choice as
|
|
281
|
+
// the update banner in version-check.ts.
|
|
282
|
+
console.error(chalk.dim(`Updated Primitive members' skills for Claude Code (${changed.join(", ")})`));
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Auto-update an already-installed skill if a newer version is bundled.
|
|
287
|
+
* Called after command execution for non-init, non-skill commands.
|
|
288
|
+
* If the skill is not installed, shows a non-blocking hint instead.
|
|
289
|
+
* Never throws — fails silently like version-check.
|
|
290
|
+
*/
|
|
291
|
+
export async function checkSkillStatus() {
|
|
292
|
+
try {
|
|
293
|
+
const bundledPath = getBundledSkillPath();
|
|
294
|
+
if (!existsSync(bundledPath))
|
|
295
|
+
return;
|
|
296
|
+
if (!existsSync(claudeDir()))
|
|
297
|
+
return;
|
|
298
|
+
const bundledContent = await readFile(bundledPath, "utf-8");
|
|
299
|
+
const bundledHash = computeHash(bundledContent);
|
|
300
|
+
const installedHash = getInstalledHash();
|
|
301
|
+
if (installedHash) {
|
|
302
|
+
// Already installed — silently auto-update if needed
|
|
303
|
+
if (installedHash !== bundledHash) {
|
|
304
|
+
mkdirSync(publicSkillDir(), { recursive: true });
|
|
305
|
+
writeFileSync(publicSkillFile(), bundledContent);
|
|
306
|
+
writeFileSync(publicHashFile(), bundledHash);
|
|
307
|
+
console.error(chalk.dim("Updated Primitive platform skill for Claude Code"));
|
|
308
|
+
}
|
|
309
|
+
// Members' skills (if installed) refresh from the private repo, at
|
|
310
|
+
// most once per CLI release.
|
|
311
|
+
await refreshFetchedSkills();
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
// Not installed — show a non-blocking hint
|
|
315
|
+
console.error(chalk.dim(`Claude Code skill available — run ${chalk.cyan("primitive skill install")} to set up`));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
// Never let skill check affect CLI operation
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Explicitly install or reinstall the skill. Shows output.
|
|
324
|
+
* Also installs the members' skills (primitive-platform-internal and
|
|
325
|
+
* file-issue) when the caller has access to the private repo
|
|
326
|
+
* (Primitive-Labs members); silently skipped otherwise.
|
|
327
|
+
*/
|
|
328
|
+
export async function installSkillExplicit() {
|
|
329
|
+
const bundledPath = getBundledSkillPath();
|
|
330
|
+
if (!existsSync(bundledPath)) {
|
|
331
|
+
console.error(chalk.red("Skill assets not found. Reinstall the CLI."));
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
if (!existsSync(claudeDir())) {
|
|
335
|
+
console.error(chalk.red("Claude Code not found (~/.claude does not exist)."));
|
|
336
|
+
console.error(chalk.dim("Install Claude Code first: https://claude.ai/code"));
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
const bundledContent = readFileSync(bundledPath, "utf-8");
|
|
340
|
+
const bundledHash = computeHash(bundledContent);
|
|
341
|
+
mkdirSync(publicSkillDir(), { recursive: true });
|
|
342
|
+
writeFileSync(publicSkillFile(), bundledContent);
|
|
343
|
+
writeFileSync(publicHashFile(), bundledHash);
|
|
344
|
+
console.log(chalk.green("Primitive platform skill installed for Claude Code."));
|
|
345
|
+
console.log(chalk.dim(`Location: ${publicSkillFile()}`));
|
|
346
|
+
console.log(chalk.dim(`Version: ${bundledHash}`));
|
|
347
|
+
const previous = getMembersStamp();
|
|
348
|
+
const { installed, fetched, failed } = await installFetchedSkills(previous);
|
|
349
|
+
if (Object.keys(installed).length > 0) {
|
|
350
|
+
writeMembersStamp(stampFrom(getCliVersion() ?? "unknown", installed));
|
|
351
|
+
}
|
|
352
|
+
for (const skill of FETCHED_SKILLS) {
|
|
353
|
+
if (fetched.includes(skill.name)) {
|
|
354
|
+
console.log(chalk.green(`Primitive ${skill.name} skill installed (Primitive-Labs members).`));
|
|
355
|
+
console.log(chalk.dim(`Location: ${fetchedSkillDir(skill)}`));
|
|
356
|
+
console.log(chalk.dim(`Version: ${installed[skill.name]}`));
|
|
357
|
+
}
|
|
358
|
+
else if (installed[skill.name]) {
|
|
359
|
+
// Keep the existing copy; just tell the user the refresh didn't happen.
|
|
360
|
+
console.log(chalk.yellow(`Could not refresh the ${skill.name} skill (gh unavailable or no repo access); keeping the installed copy.`));
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
// A member with one skill installed and another that failed to fetch
|
|
364
|
+
// (a transient error) is told; a non-member (nothing fetched, nothing
|
|
365
|
+
// installed) is told nothing.
|
|
366
|
+
if (fetched.length > 0 && failed.length > 0) {
|
|
367
|
+
console.log(chalk.yellow(`Could not fetch: ${failed.join(", ")}. Run primitive skill install again to retry.`));
|
|
368
|
+
}
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Uninstall the skill (and the members' skills, if present).
|
|
373
|
+
*/
|
|
374
|
+
export function uninstallSkill() {
|
|
375
|
+
const fetchedDirs = FETCHED_SKILLS.map((skill) => ({ skill, dir: fetchedSkillDir(skill) }));
|
|
376
|
+
if (!existsSync(publicSkillDir()) && !fetchedDirs.some(({ dir }) => existsSync(dir))) {
|
|
377
|
+
console.log(chalk.dim("Skill is not installed."));
|
|
378
|
+
return true;
|
|
379
|
+
}
|
|
380
|
+
if (existsSync(publicSkillDir())) {
|
|
381
|
+
rmSync(publicSkillDir(), { recursive: true });
|
|
382
|
+
console.log(chalk.green("Primitive platform skill uninstalled."));
|
|
383
|
+
}
|
|
384
|
+
for (const { skill, dir } of fetchedDirs) {
|
|
385
|
+
if (existsSync(dir)) {
|
|
386
|
+
rmSync(dir, { recursive: true });
|
|
387
|
+
console.log(chalk.green(`Primitive ${skill.name} skill uninstalled.`));
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
/** The data `skillStatus()` prints; exported so tests can read it directly. */
|
|
393
|
+
export function getSkillStatus() {
|
|
394
|
+
const bundledPath = getBundledSkillPath();
|
|
395
|
+
const stamp = getMembersStamp();
|
|
396
|
+
const fetched = {};
|
|
397
|
+
for (const skill of FETCHED_SKILLS) {
|
|
398
|
+
const hash = installedFetchedHash(skill, stamp);
|
|
399
|
+
fetched[skill.name] = hash && stamp
|
|
400
|
+
? { hash, cliVersion: stamp.cliVersion, location: fetchedSkillDir(skill) }
|
|
401
|
+
: null;
|
|
402
|
+
}
|
|
403
|
+
return {
|
|
404
|
+
installedHash: getInstalledHash(),
|
|
405
|
+
bundledHash: existsSync(bundledPath) ? computeHash(readFileSync(bundledPath, "utf-8")) : null,
|
|
406
|
+
location: publicSkillFile(),
|
|
407
|
+
fetched,
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Show current skill installation status.
|
|
412
|
+
*/
|
|
413
|
+
export function skillStatus() {
|
|
414
|
+
const status = getSkillStatus();
|
|
415
|
+
if (!status.installedHash) {
|
|
416
|
+
console.log(chalk.yellow("Skill is not installed."));
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
console.log(chalk.green("Skill is installed."));
|
|
420
|
+
console.log(chalk.dim(` Location: ${status.location}`));
|
|
421
|
+
console.log(chalk.dim(` Version: ${status.installedHash}`));
|
|
422
|
+
}
|
|
423
|
+
if (status.bundledHash) {
|
|
424
|
+
console.log(chalk.dim(` Bundled: ${status.bundledHash}`));
|
|
425
|
+
if (status.installedHash && status.installedHash !== status.bundledHash) {
|
|
426
|
+
console.log(chalk.yellow(" Update available — run: primitive skill install"));
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
for (const skill of FETCHED_SKILLS) {
|
|
430
|
+
const entry = status.fetched[skill.name];
|
|
431
|
+
if (entry) {
|
|
432
|
+
console.log(chalk.green(`${skill.name} skill is installed (Primitive-Labs members).`));
|
|
433
|
+
console.log(chalk.dim(` Location: ${entry.location}`));
|
|
434
|
+
console.log(chalk.dim(` Version: ${entry.hash} (fetched for CLI ${entry.cliVersion})`));
|
|
435
|
+
}
|
|
436
|
+
else {
|
|
437
|
+
console.log(chalk.dim(`${skill.name} skill is not installed (Primitive-Labs members: primitive skill install).`));
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
//# sourceMappingURL=skill-installer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-installer.js","sourceRoot":"","sources":["../../../src/lib/skill-installer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;GAKG;AACH,SAAS,SAAS;IAChB,OAAO,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC,CAAC;AACxE,CAAC;AACD,SAAS,SAAS;IAChB,OAAO,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,CAAC,CAAC;AACrC,CAAC;AAED,0CAA0C;AAC1C,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAC/C,SAAS,cAAc;IACrB,OAAO,IAAI,CAAC,SAAS,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAC9C,CAAC;AACD,SAAS,eAAe;IACtB,OAAO,IAAI,CAAC,cAAc,EAAE,EAAE,UAAU,CAAC,CAAC;AAC5C,CAAC;AACD,SAAS,cAAc;IACrB,OAAO,IAAI,CAAC,cAAc,EAAE,EAAE,U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AAC,CAAC;QACzC,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,+CAA+C,CAAC,CAAC,CAAC;YACvF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;YACxD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,KAAK,CAAC,IAAI,qBAAqB,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;QAC5F,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,4EAA4E,CAAC,CAAC,CAAC;QACpH,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The audit's source, wired to the app API (#3433, criterion 10).
|
|
3
|
+
*
|
|
4
|
+
* `auditSnapshotChain` takes its reads as a port so its decision — the fence,
|
|
5
|
+
* the model union, the comparison — is gradeable against a source a test can
|
|
6
|
+
* move between calls. This is the one the command runs: four routes, and one
|
|
7
|
+
* rule about how often each is asked.
|
|
8
|
+
*
|
|
9
|
+
* ## Why nothing is remembered between attempts (3433-C09)
|
|
10
|
+
*
|
|
11
|
+
* The schema answers two of the audit's questions — which models the table
|
|
12
|
+
* holds, and which of their fields are stringsets — and remembering its answer
|
|
13
|
+
* for the whole run made both of them statements about the FIRST attempt. A
|
|
14
|
+
* field declared while an attempt was running is exactly what moves the fence
|
|
15
|
+
* and discards it, so the remembered answer would be read on the one attempt
|
|
16
|
+
* that needed a fresh one: both sides hold the same members, the declaration
|
|
17
|
+
* that says they are a set is on the server, and the audit reports corruption.
|
|
18
|
+
* Each attempt asks again. Two extra reads of a bounded route are nothing
|
|
19
|
+
* beside the chain the same attempt downloads.
|
|
20
|
+
*
|
|
21
|
+
* The declarations are read AFTER the chain is captured, so they cover the
|
|
22
|
+
* state being compared; the table's model list is read BEFORE it, because that
|
|
23
|
+
* read is also the permission check that refuses a caller who could not finish
|
|
24
|
+
* (3433-C08). A model that appears between the two is in the captured overlay
|
|
25
|
+
* and therefore in the reconstruction, which the union takes the other half
|
|
26
|
+
* from; one that appears after it moves the fence and the attempt is retried.
|
|
27
|
+
*/
|
|
28
|
+
import { type AuditSource } from "./snapshot-audit.js";
|
|
29
|
+
/** The four reads the audit makes of the server, as `ApiClient` answers them. */
|
|
30
|
+
export interface AuditApiClient {
|
|
31
|
+
exportDocumentChain(appId: string, documentId: string): Promise<any>;
|
|
32
|
+
downloadDocumentArtifact(appId: string, path: string): Promise<Uint8Array>;
|
|
33
|
+
getDocumentSchema(appId: string, documentId: string): Promise<any>;
|
|
34
|
+
queryDocumentRecords(appId: string, documentId: string, model: string, options: {
|
|
35
|
+
limit?: number;
|
|
36
|
+
cursor?: string;
|
|
37
|
+
}): Promise<any>;
|
|
38
|
+
}
|
|
39
|
+
export interface AuditApiSourceOptions {
|
|
40
|
+
appId: string;
|
|
41
|
+
documentId: string;
|
|
42
|
+
/** Records per page. One page is the audit's whole server-side working set. */
|
|
43
|
+
pageSize: number;
|
|
44
|
+
}
|
|
45
|
+
export declare function createAuditApiSource(client: AuditApiClient, options: AuditApiSourceOptions): AuditSource;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The audit's source, wired to the app API (#3433, criterion 10).
|
|
3
|
+
*
|
|
4
|
+
* `auditSnapshotChain` takes its reads as a port so its decision — the fence,
|
|
5
|
+
* the model union, the comparison — is gradeable against a source a test can
|
|
6
|
+
* move between calls. This is the one the command runs: four routes, and one
|
|
7
|
+
* rule about how often each is asked.
|
|
8
|
+
*
|
|
9
|
+
* ## Why nothing is remembered between attempts (3433-C09)
|
|
10
|
+
*
|
|
11
|
+
* The schema answers two of the audit's questions — which models the table
|
|
12
|
+
* holds, and which of their fields are stringsets — and remembering its answer
|
|
13
|
+
* for the whole run made both of them statements about the FIRST attempt. A
|
|
14
|
+
* field declared while an attempt was running is exactly what moves the fence
|
|
15
|
+
* and discards it, so the remembered answer would be read on the one attempt
|
|
16
|
+
* that needed a fresh one: both sides hold the same members, the declaration
|
|
17
|
+
* that says they are a set is on the server, and the audit reports corruption.
|
|
18
|
+
* Each attempt asks again. Two extra reads of a bounded route are nothing
|
|
19
|
+
* beside the chain the same attempt downloads.
|
|
20
|
+
*
|
|
21
|
+
* The declarations are read AFTER the chain is captured, so they cover the
|
|
22
|
+
* state being compared; the table's model list is read BEFORE it, because that
|
|
23
|
+
* read is also the permission check that refuses a caller who could not finish
|
|
24
|
+
* (3433-C08). A model that appears between the two is in the captured overlay
|
|
25
|
+
* and therefore in the reconstruction, which the union takes the other half
|
|
26
|
+
* from; one that appears after it moves the fence and the attempt is retried.
|
|
27
|
+
*/
|
|
28
|
+
import { stringSetFieldsFromSchema, } from "./snapshot-audit.js";
|
|
29
|
+
export function createAuditApiSource(client, options) {
|
|
30
|
+
const { appId, documentId, pageSize } = options;
|
|
31
|
+
return {
|
|
32
|
+
async chain() {
|
|
33
|
+
return await client.exportDocumentChain(appId, documentId);
|
|
34
|
+
},
|
|
35
|
+
async download(grantedPath) {
|
|
36
|
+
const body = await client.downloadDocumentArtifact(appId, grantedPath);
|
|
37
|
+
return new Uint8Array(body.buffer, body.byteOffset, body.byteLength);
|
|
38
|
+
},
|
|
39
|
+
async tableModels() {
|
|
40
|
+
const answer = await client.getDocumentSchema(appId, documentId);
|
|
41
|
+
return Array.isArray(answer?.tableModels) ? answer.tableModels : [];
|
|
42
|
+
},
|
|
43
|
+
async stringSetFields() {
|
|
44
|
+
return stringSetFieldsFromSchema(await client.getDocumentSchema(appId, documentId));
|
|
45
|
+
},
|
|
46
|
+
async readPage(model, cursor) {
|
|
47
|
+
const page = await client.queryDocumentRecords(appId, documentId, model, {
|
|
48
|
+
limit: pageSize,
|
|
49
|
+
...(cursor ? { cursor } : {}),
|
|
50
|
+
});
|
|
51
|
+
return {
|
|
52
|
+
items: (page?.items ?? []),
|
|
53
|
+
nextCursor: page?.nextCursor ?? null,
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=snapshot-audit-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot-audit-source.js","sourceRoot":"","sources":["../../../src/lib/snapshot-audit-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EACL,yBAAyB,GAG1B,MAAM,qBAAqB,CAAC;AAsB7B,MAAM,UAAU,oBAAoB,CAClC,MAAsB,EACtB,OAA8B;IAE9B,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAChD,OAAO;QACL,KAAK,CAAC,KAAK;YACT,OAAO,MAAM,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAC7D,CAAC;QAED,KAAK,CAAC,QAAQ,CAAC,WAAmB;YAChC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;YACvE,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACvE,CAAC;QAED,KAAK,CAAC,WAAW;YACf,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;YACjE,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;QACtE,CAAC;QAED,KAAK,CAAC,eAAe;YACnB,OAAO,yBAAyB,CAC9B,MAAM,MAAM,CAAC,iBAAiB,CAAC,KAAK,EAAE,UAAU,CAAC,CAClD,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,QAAQ,CAAC,KAAa,EAAE,MAAe;YAC3C,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE;gBACvE,KAAK,EAAE,QAAQ;gBACf,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9B,CAAC,CAAC;YACH,OAAO;gBACL,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAmC;gBAC5D,UAAU,EAAE,IAAI,EAAE,UAAU,IAAI,IAAI;aACrC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The audit's local reconstruction, over js-bao's own Node SQLite store
|
|
3
|
+
* (#3433, criterion 10).
|
|
4
|
+
*
|
|
5
|
+
* This is the half of the audit that must NOT be a reimplementation: the base
|
|
6
|
+
* is materialised by the checked-in loader and the overlays are folded by the
|
|
7
|
+
* client's own fold, so what the audit compares with the table is what a
|
|
8
|
+
* browser would have computed from the same artifacts. A hand-rolled fold here
|
|
9
|
+
* would make the audit agree with itself rather than with a client.
|
|
10
|
+
*
|
|
11
|
+
* Everything lives in one throwaway SQLite file, removed when the audit ends —
|
|
12
|
+
* including the `audit_seen` table, which is what keeps memory to one page
|
|
13
|
+
* plus the store: the ids the table has already shown are marked rather than
|
|
14
|
+
* held.
|
|
15
|
+
*/
|
|
16
|
+
import type { AuditLocalStore } from "./snapshot-audit.js";
|
|
17
|
+
import type { ManifestLike } from "./snapshot-manifest-layout.js";
|
|
18
|
+
/**
|
|
19
|
+
* The fence's reader: how far one overlay update has got, deletions included.
|
|
20
|
+
*
|
|
21
|
+
* A state vector alone is NOT that. It carries one clock per client and a Yjs
|
|
22
|
+
* deletion creates no struct, so removing a key leaves it exactly where it
|
|
23
|
+
* was — and a legacy nested-map record deleted between the audit's capture and
|
|
24
|
+
* its comparison would then pass the fence and be reported as a record only
|
|
25
|
+
* the recomputed chain holds, which is corruption's own signature (finding
|
|
26
|
+
* 3433-C05; the deletion shape is pinned by `large-document-snapshot-verify`'s
|
|
27
|
+
* E4 case). So the fingerprint is the state vector AND a digest of the
|
|
28
|
+
* update's delete set: every client's deleted ranges, in a fixed order.
|
|
29
|
+
*
|
|
30
|
+
* Yjs is loaded once and handed back as a synchronous function, so the audit's
|
|
31
|
+
* fence stays a plain comparison rather than an awaited one — and so the
|
|
32
|
+
* library itself never has to import Yjs.
|
|
33
|
+
*/
|
|
34
|
+
export declare function createChainFingerprintReader(): Promise<(update: Uint8Array) => string>;
|
|
35
|
+
/**
|
|
36
|
+
* The stringset fields a base manifest records, per model.
|
|
37
|
+
*
|
|
38
|
+
* A Map rather than an object because a model's name is data: an undeclared
|
|
39
|
+
* model is whatever `_type` the records route was handed, so `constructor` and
|
|
40
|
+
* `toString` are names this can be asked for, and on a plain object either
|
|
41
|
+
* answers a function off the prototype rather than nothing at all (3433-C11).
|
|
42
|
+
* The manifest is the only record of what a model declares for a model no
|
|
43
|
+
* later overlay touched, which is exactly where these have to come from.
|
|
44
|
+
*/
|
|
45
|
+
export declare function stringSetFieldsFromManifest(manifest: ManifestLike): Map<string, Set<string>>;
|
|
46
|
+
/**
|
|
47
|
+
* Build a local store for one audit attempt.
|
|
48
|
+
*
|
|
49
|
+
* A fresh database per attempt by design: an attempt the fence discards must
|
|
50
|
+
* leave nothing behind for the next one to read.
|
|
51
|
+
*/
|
|
52
|
+
export declare function createAuditLocalStore(documentId: string): Promise<AuditLocalStore>;
|