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,447 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shared Primitive environment resolver (#2873).
|
|
3
|
+
*
|
|
4
|
+
* Three surfaces have to agree on which backend/app a project is pointed at:
|
|
5
|
+
* the CLI, the Vue build (`primitive-app`'s `primitiveEnv()` plugin), and the
|
|
6
|
+
* Swift template's pre-build script. This module is the single algorithm they
|
|
7
|
+
* share. The CLI owns it; `packages/primitive-app` carries a byte-identical
|
|
8
|
+
* GENERATED copy (`cli/scripts/gen-primitive-env-resolver.mjs`, checked for
|
|
9
|
+
* freshness by `cli/tests/unit/env-resolver-copy-drift-guard.test.ts`); the
|
|
10
|
+
* Swift script is an independent bash+python3 port pinned by a parity test.
|
|
11
|
+
*
|
|
12
|
+
* ── COPYABILITY (load-bearing) ────────────────────────────────────────────
|
|
13
|
+
* This file MUST stay self-contained: node builtins only, ZERO relative
|
|
14
|
+
* imports. The generator copies it verbatim into a package that cannot depend
|
|
15
|
+
* on the CLI, so any `./x.js` import here would break that copy at runtime.
|
|
16
|
+
* The drift guard asserts this.
|
|
17
|
+
*
|
|
18
|
+
* Scope: config discovery, the schema `version` check, structural validation,
|
|
19
|
+
* the local selection, the precedence, and the http→ws scheme swap. It
|
|
20
|
+
* deliberately does NOT duplicate the CLI's full field-level validation
|
|
21
|
+
* (`validateProjectConfig` in `project-config.ts`) — the CLI wrapper runs that
|
|
22
|
+
* first, and the other readers only need "version understood, shape sane, fail
|
|
23
|
+
* loudly otherwise".
|
|
24
|
+
*
|
|
25
|
+
* Precedence (one order, everywhere):
|
|
26
|
+
* 1. an explicit name (`--env` / `--primitive-env`)
|
|
27
|
+
* 2. PRIMITIVE_ENV (per-invocation intent, keeps CI working)
|
|
28
|
+
* 3. .primitive/local.json (this machine's `primitive env use`)
|
|
29
|
+
* 4. defaultEnvironment (the committed team default)
|
|
30
|
+
* 5. the sole environment, if there is exactly one
|
|
31
|
+
*/
|
|
32
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
33
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
34
|
+
/** Schema version of `primitive/config.json` this core understands. */
|
|
35
|
+
export const PRIMITIVE_CONFIG_VERSION = 1;
|
|
36
|
+
/** Schema version of `.primitive/local.json` this core writes and reads. */
|
|
37
|
+
export const PRIMITIVE_LOCAL_STATE_VERSION = 1;
|
|
38
|
+
/**
|
|
39
|
+
* The two directories, split apart by #3153 so one name never means two
|
|
40
|
+
* things: `primitive/` is the COMMITTED tree (the config and every
|
|
41
|
+
* environment's TOML), `.primitive/` is MACHINE-LOCAL state (credentials, this
|
|
42
|
+
* machine's selection, snapshot backups) and is gitignored whole.
|
|
43
|
+
*/
|
|
44
|
+
export const PROJECT_TREE_DIR = "primitive";
|
|
45
|
+
export const PROJECT_LOCAL_STATE_DIR = ".primitive";
|
|
46
|
+
export const PROJECT_CONFIG_FILENAME = "config.json";
|
|
47
|
+
export const LOCAL_STATE_FILENAME = "local.json";
|
|
48
|
+
export const PROJECT_CONFIG_DISPLAY_NAME = "primitive/config.json";
|
|
49
|
+
export const LOCAL_STATE_DISPLAY_NAME = ".primitive/local.json";
|
|
50
|
+
/**
|
|
51
|
+
* The one refusal for a project that never migrated off the pre-#3153 layout:
|
|
52
|
+
* a `.primitive/config.json` with no `primitive/config.json` beside it.
|
|
53
|
+
*
|
|
54
|
+
* That shape is refused rather than walked past because the walk's next stop
|
|
55
|
+
* is the parent directory, and in a nested checkout the parent may be a
|
|
56
|
+
* DIFFERENT project — a command run in the unmigrated one would silently act
|
|
57
|
+
* on the other's app. Nothing else is refused (#3392): anything left under
|
|
58
|
+
* `.primitive/` beside a migrated tree is machine-local junk, not signal.
|
|
59
|
+
*
|
|
60
|
+
* One sentence, naming both halves — the file that was found and the file
|
|
61
|
+
* that is expected — and no document. The migration page this once pointed
|
|
62
|
+
* at was never published (#3155, won't-fix), and every reader that shares
|
|
63
|
+
* this refusal — this core, the generated Vite-plugin copy, the Swift
|
|
64
|
+
* pre-build script, the Vue template's deploy script — says the same thing.
|
|
65
|
+
*/
|
|
66
|
+
export function unmigratedProjectMessage(found, expected) {
|
|
67
|
+
return (`Found ${found} but no ${expected}: this project still uses the retired ` +
|
|
68
|
+
`layout under ${PROJECT_LOCAL_STATE_DIR}/, which is never read.`);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The one refusal for a command run outside a Primitive project (#3154,
|
|
72
|
+
* intent criterion 5).
|
|
73
|
+
*
|
|
74
|
+
* There is exactly one way to resolve the configuration tree, the credentials
|
|
75
|
+
* and the app: the environment named by `primitive/config.json`. Outside a
|
|
76
|
+
* project there is no such thing, and the CLI says so once, in these words,
|
|
77
|
+
* wherever the question is asked — the resolver core, the CLI's
|
|
78
|
+
* `requireCurrentEnvironment()`, and the credentials store.
|
|
79
|
+
*
|
|
80
|
+
* Two constraints on the wording, both test-asserted:
|
|
81
|
+
*
|
|
82
|
+
* - it names `primitive init`, the one command that creates what is missing;
|
|
83
|
+
* - it never names `primitive env add`, which after this change also fails
|
|
84
|
+
* outside a project — an error may only offer an invocation it does not
|
|
85
|
+
* itself block.
|
|
86
|
+
*/
|
|
87
|
+
export function missingConfigMessage(where) {
|
|
88
|
+
return (`No ${PROJECT_CONFIG_DISPLAY_NAME} found in ${where} or any parent directory. ` +
|
|
89
|
+
`Primitive commands run inside a Primitive project: it is where the CLI reads ` +
|
|
90
|
+
`the environment, the app that environment names, and the configuration tree ` +
|
|
91
|
+
`from. Run 'primitive init' to create one.`);
|
|
92
|
+
}
|
|
93
|
+
export class PrimitiveEnvError extends Error {
|
|
94
|
+
kind;
|
|
95
|
+
path;
|
|
96
|
+
constructor(kind, message, path) {
|
|
97
|
+
super(message);
|
|
98
|
+
this.name = "PrimitiveEnvError";
|
|
99
|
+
this.kind = kind;
|
|
100
|
+
this.path = path;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* The app's web counterpart as a normalized ORIGIN, or undefined when the
|
|
105
|
+
* value cannot be one (#2982).
|
|
106
|
+
*
|
|
107
|
+
* Unlike `appId`/`appName`, a typed read is not enough. This value is not
|
|
108
|
+
* merely carried: the Swift app points its emailed sign-in link at
|
|
109
|
+
* `<webUrl>/oauth/callback` and trusts incoming universal links from the same
|
|
110
|
+
* origin, and BOTH jobs need an origin —
|
|
111
|
+
*
|
|
112
|
+
* - https except loopback, the rule the server applies to every redirect URI
|
|
113
|
+
* (`src/auth/redirect-uri.ts`): an origin that cannot be allow-listed turns
|
|
114
|
+
* every sign-in request into a 400, and a plain-http link would carry the
|
|
115
|
+
* magic token in clear;
|
|
116
|
+
* - no path, query or fragment: the web client serves its callback on its own
|
|
117
|
+
* origin plus `/oauth/callback`, which is also the exact path the
|
|
118
|
+
* `apple-app-site-association` component claims;
|
|
119
|
+
* - no credentials, which have no business in a link that goes out by email.
|
|
120
|
+
*
|
|
121
|
+
* `primitive env add --web-url` and the project-config validation reject those
|
|
122
|
+
* shapes with a field-named error, but neither is on the path from a
|
|
123
|
+
* hand-edited `primitive/config.json` to an Xcode build: the Swift template's
|
|
124
|
+
* pre-build script reads the file directly. So every reader that feeds
|
|
125
|
+
* `primitive.json` applies the contract, and a value that misses it is read as
|
|
126
|
+
* "this environment has no web counterpart" — code-only email, no trusted
|
|
127
|
+
* origin, nothing silently pointed at the wrong URL.
|
|
128
|
+
*
|
|
129
|
+
* The message-producing twin of this rule lives in `cli/src/lib/web-url.ts`;
|
|
130
|
+
* this file cannot import it (see COPYABILITY above), and a test pins that the
|
|
131
|
+
* two agree.
|
|
132
|
+
*/
|
|
133
|
+
export function normalizeWebOrigin(value) {
|
|
134
|
+
if (typeof value !== "string")
|
|
135
|
+
return undefined;
|
|
136
|
+
const trimmed = value.trim();
|
|
137
|
+
if (!trimmed)
|
|
138
|
+
return undefined;
|
|
139
|
+
let url;
|
|
140
|
+
try {
|
|
141
|
+
url = new URL(trimmed);
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
if (url.protocol !== "https:" && url.protocol !== "http:")
|
|
147
|
+
return undefined;
|
|
148
|
+
if (url.protocol === "http:" &&
|
|
149
|
+
url.hostname !== "localhost" &&
|
|
150
|
+
url.hostname !== "127.0.0.1") {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
if (url.username || url.password)
|
|
154
|
+
return undefined;
|
|
155
|
+
if (url.pathname !== "/" && url.pathname !== "")
|
|
156
|
+
return undefined;
|
|
157
|
+
if (url.search || url.hash)
|
|
158
|
+
return undefined;
|
|
159
|
+
return url.origin;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The one remedy for an environment that names no app (#3152), shared by every
|
|
163
|
+
* reader that can hit it: this core, the CLI's `validateProjectConfig`, the
|
|
164
|
+
* Swift template's pre-build script, and the Vue template's cf-deploy.
|
|
165
|
+
*
|
|
166
|
+
* Two constraints on the wording, both test-asserted:
|
|
167
|
+
*
|
|
168
|
+
* - it never says `primitive env add <name>`, which REFUSES an environment
|
|
169
|
+
* name that already exists — the shape this error is always about;
|
|
170
|
+
* - it names no command the failure itself blocks. The CLI validates the
|
|
171
|
+
* project config before any command parses, so every `primitive` command
|
|
172
|
+
* run inside the broken project fails with this same error. The only
|
|
173
|
+
* invocation it may offer is one it says out loud to run elsewhere.
|
|
174
|
+
*/
|
|
175
|
+
export function missingAppIdMessage(name, configPath) {
|
|
176
|
+
const where = configPath
|
|
177
|
+
? `${PROJECT_CONFIG_DISPLAY_NAME} (${configPath})`
|
|
178
|
+
: PROJECT_CONFIG_DISPLAY_NAME;
|
|
179
|
+
return (`Environment "${name}" in ${where} has no "appId". ` +
|
|
180
|
+
`Every environment names exactly one app — add "appId": "<app-id>" to that environment in ${PROJECT_CONFIG_DISPLAY_NAME}. ` +
|
|
181
|
+
`Find the app id in the Primitive admin UI, with 'primitive apps list' run from another Primitive project, ` +
|
|
182
|
+
`or as the residual "currentAppId" in .primitive/credentials.json if this environment was ever pointed at an app by the retired per-machine app selection.`);
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* An environment's `appId` as a usable string, or undefined when the value
|
|
186
|
+
* cannot be one. Non-string and blank-after-trim are both "no app named": a
|
|
187
|
+
* numeric or whitespace appId reaches a consumer as an app id it cannot use,
|
|
188
|
+
* which is the silent version of the failure this field exists to prevent.
|
|
189
|
+
*/
|
|
190
|
+
function readAppId(value) {
|
|
191
|
+
if (typeof value !== "string")
|
|
192
|
+
return undefined;
|
|
193
|
+
const trimmed = value.trim();
|
|
194
|
+
return trimmed || undefined;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Derives the WebSocket URL from the API URL. Every apiUrl/wsUrl pair in
|
|
198
|
+
* practice is the same host with the scheme swapped, so it is derived rather
|
|
199
|
+
* than authored — one less thing to get out of sync.
|
|
200
|
+
*/
|
|
201
|
+
export function deriveWsUrl(apiUrl) {
|
|
202
|
+
if (apiUrl.startsWith("https://"))
|
|
203
|
+
return "wss://" + apiUrl.slice("https://".length);
|
|
204
|
+
if (apiUrl.startsWith("http://"))
|
|
205
|
+
return "ws://" + apiUrl.slice("http://".length);
|
|
206
|
+
return apiUrl;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Finds `primitive/config.json` by walking up from `cwd`, or returns the
|
|
210
|
+
* PRIMITIVE_PROJECT_CONFIG override when it is set (and exists).
|
|
211
|
+
*
|
|
212
|
+
* The override is checked for provenance BEFORE the file is read (#3153, F2):
|
|
213
|
+
* it bypasses the walk, so without this an old-layout config could be handed
|
|
214
|
+
* straight to a reader and defeat the cutover. An override that points inside
|
|
215
|
+
* a `.primitive/` directory IS the old layout, named explicitly.
|
|
216
|
+
*
|
|
217
|
+
* This is the one function every reader goes through — `resolvePrimitiveEnv`
|
|
218
|
+
* and the CLI's own `loadProjectConfig`/`findProjectRoot` alike — so the
|
|
219
|
+
* unmigrated-project refusal lives HERE, in the walk, or the commands that
|
|
220
|
+
* never call `resolvePrimitiveEnv` would walk past the old anchor into the
|
|
221
|
+
* parent directory's project.
|
|
222
|
+
*/
|
|
223
|
+
export function findPrimitiveConfigPath(options = {}) {
|
|
224
|
+
const env = options.env ?? process.env;
|
|
225
|
+
const override = env.PRIMITIVE_PROJECT_CONFIG;
|
|
226
|
+
if (override) {
|
|
227
|
+
const forced = resolve(override);
|
|
228
|
+
if (basename(dirname(forced)) === PROJECT_LOCAL_STATE_DIR) {
|
|
229
|
+
throw new PrimitiveEnvError("stale-layout", unmigratedProjectMessage(forced, join(dirname(dirname(forced)), PROJECT_TREE_DIR, PROJECT_CONFIG_FILENAME)), forced);
|
|
230
|
+
}
|
|
231
|
+
return existsSync(forced) ? forced : null;
|
|
232
|
+
}
|
|
233
|
+
let current = resolve(options.cwd ?? process.cwd());
|
|
234
|
+
while (true) {
|
|
235
|
+
const candidate = join(current, PROJECT_TREE_DIR, PROJECT_CONFIG_FILENAME);
|
|
236
|
+
if (existsSync(candidate))
|
|
237
|
+
return candidate;
|
|
238
|
+
// No anchor here. The old one means this directory IS a project — one
|
|
239
|
+
// that never migrated — and the walk stops rather than resolving whatever
|
|
240
|
+
// project the parent turns out to be (#3392). Checked only when the new
|
|
241
|
+
// anchor is absent: beside a migrated tree the old file is a leftover.
|
|
242
|
+
const unmigrated = join(current, PROJECT_LOCAL_STATE_DIR, PROJECT_CONFIG_FILENAME);
|
|
243
|
+
if (existsSync(unmigrated)) {
|
|
244
|
+
throw new PrimitiveEnvError("stale-layout", unmigratedProjectMessage(unmigrated, candidate), unmigrated);
|
|
245
|
+
}
|
|
246
|
+
const parent = dirname(current);
|
|
247
|
+
if (parent === current)
|
|
248
|
+
return null;
|
|
249
|
+
current = parent;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* The project root for a config path: the parent of `primitive/`, or the
|
|
254
|
+
* containing directory when the config was pointed at directly (a fixture via
|
|
255
|
+
* PRIMITIVE_PROJECT_CONFIG, which is not inside a `primitive/` directory).
|
|
256
|
+
*/
|
|
257
|
+
export function projectRootForConfigPath(configPath) {
|
|
258
|
+
const dir = dirname(configPath);
|
|
259
|
+
return basename(dir) === PROJECT_TREE_DIR ? dirname(dir) : dir;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Machine-local state lives under the project root's `.primitive/`, not beside
|
|
263
|
+
* the config — the config is committed now, and the two must not share a
|
|
264
|
+
* directory. A fixture-pointed bare config still gets its own `.primitive/`
|
|
265
|
+
* in its own directory, so it never picks up a real project's selection.
|
|
266
|
+
*/
|
|
267
|
+
export function localStatePathForConfigPath(configPath) {
|
|
268
|
+
return join(projectRootForConfigPath(configPath), PROJECT_LOCAL_STATE_DIR, LOCAL_STATE_FILENAME);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* The message of a caught value. A catch binding is `unknown` under the
|
|
272
|
+
* strict config primitive-app compiles this copy with, so narrow first.
|
|
273
|
+
*/
|
|
274
|
+
function errorMessage(err) {
|
|
275
|
+
return err instanceof Error ? err.message : String(err);
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Reads and structurally validates `primitive/config.json`. Throws rather
|
|
279
|
+
* than guessing: a config that cannot be understood is always louder than a
|
|
280
|
+
* silent fallback to the wrong backend.
|
|
281
|
+
*/
|
|
282
|
+
export function readCoreProjectConfig(configPath) {
|
|
283
|
+
if (!existsSync(configPath)) {
|
|
284
|
+
throw new PrimitiveEnvError("missing-config", missingConfigMessage(dirname(configPath)), configPath);
|
|
285
|
+
}
|
|
286
|
+
let raw;
|
|
287
|
+
try {
|
|
288
|
+
raw = readFileSync(configPath, "utf-8");
|
|
289
|
+
}
|
|
290
|
+
catch (err) {
|
|
291
|
+
throw new PrimitiveEnvError("malformed-config", `Failed to read ${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}): ${errorMessage(err)}`, configPath);
|
|
292
|
+
}
|
|
293
|
+
let parsed;
|
|
294
|
+
try {
|
|
295
|
+
parsed = JSON.parse(raw);
|
|
296
|
+
}
|
|
297
|
+
catch (err) {
|
|
298
|
+
throw new PrimitiveEnvError("malformed-config", `Failed to parse ${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}): ${errorMessage(err)}`, configPath);
|
|
299
|
+
}
|
|
300
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
301
|
+
throw new PrimitiveEnvError("malformed-config", `${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}) must contain a JSON object at the top level.`, configPath);
|
|
302
|
+
}
|
|
303
|
+
const obj = parsed;
|
|
304
|
+
if (typeof obj.version !== "number" || !Number.isInteger(obj.version)) {
|
|
305
|
+
throw new PrimitiveEnvError("malformed-config", `${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}) is missing required integer field "version".`, configPath);
|
|
306
|
+
}
|
|
307
|
+
if (obj.version !== PRIMITIVE_CONFIG_VERSION) {
|
|
308
|
+
throw new PrimitiveEnvError("unsupported-version", `${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}) has version ${obj.version}, but this tool understands version ${PRIMITIVE_CONFIG_VERSION}.`, configPath);
|
|
309
|
+
}
|
|
310
|
+
if (!obj.environments || typeof obj.environments !== "object" || Array.isArray(obj.environments)) {
|
|
311
|
+
throw new PrimitiveEnvError("malformed-config", `${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}) is missing required "environments" object.`, configPath);
|
|
312
|
+
}
|
|
313
|
+
const environments = {};
|
|
314
|
+
for (const [name, entry] of Object.entries(obj.environments)) {
|
|
315
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) {
|
|
316
|
+
throw new PrimitiveEnvError("malformed-config", `Environment "${name}" must be an object in ${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}).`, configPath);
|
|
317
|
+
}
|
|
318
|
+
const e = entry;
|
|
319
|
+
if (typeof e.apiUrl !== "string" || !e.apiUrl) {
|
|
320
|
+
throw new PrimitiveEnvError("malformed-config", `Environment "${name}" must have a non-empty "apiUrl" string in ${PROJECT_CONFIG_DISPLAY_NAME} (${configPath}).`, configPath);
|
|
321
|
+
}
|
|
322
|
+
// Every environment names one app, checked here rather than after the
|
|
323
|
+
// selection: the criterion is about the FILE, and a second reader (the
|
|
324
|
+
// Vite plugin, cf-deploy, the Swift pre-build script) may land on a
|
|
325
|
+
// different environment than the CLI did.
|
|
326
|
+
const appId = readAppId(e.appId);
|
|
327
|
+
if (!appId) {
|
|
328
|
+
throw new PrimitiveEnvError("missing-app-id", missingAppIdMessage(name, configPath), configPath);
|
|
329
|
+
}
|
|
330
|
+
environments[name] = {
|
|
331
|
+
apiUrl: e.apiUrl.replace(/\/$/, ""),
|
|
332
|
+
appId,
|
|
333
|
+
appName: typeof e.appName === "string" ? e.appName : undefined,
|
|
334
|
+
webUrl: normalizeWebOrigin(e.webUrl),
|
|
335
|
+
description: typeof e.description === "string" ? e.description : undefined,
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
return {
|
|
339
|
+
version: obj.version,
|
|
340
|
+
defaultEnvironment: typeof obj.defaultEnvironment === "string" && obj.defaultEnvironment
|
|
341
|
+
? obj.defaultEnvironment
|
|
342
|
+
: undefined,
|
|
343
|
+
environments,
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Reads this machine's selection from `.primitive/local.json`. Returns null
|
|
348
|
+
* when there is no file or no selection in it; throws when the file exists but
|
|
349
|
+
* cannot be read as the shape `primitive env use` writes.
|
|
350
|
+
*/
|
|
351
|
+
export function readLocalSelection(configPath) {
|
|
352
|
+
const path = localStatePathForConfigPath(configPath);
|
|
353
|
+
if (!existsSync(path))
|
|
354
|
+
return null;
|
|
355
|
+
const corrupt = (detail) => {
|
|
356
|
+
throw new PrimitiveEnvError("corrupt-local-state", `${LOCAL_STATE_DISPLAY_NAME} (${path}) is unreadable: ${detail}. Delete the file or re-run 'primitive env use <name>'.`, path);
|
|
357
|
+
};
|
|
358
|
+
let parsed;
|
|
359
|
+
try {
|
|
360
|
+
parsed = JSON.parse(readFileSync(path, "utf-8"));
|
|
361
|
+
}
|
|
362
|
+
catch (err) {
|
|
363
|
+
return corrupt(errorMessage(err));
|
|
364
|
+
}
|
|
365
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
366
|
+
return corrupt("expected a JSON object");
|
|
367
|
+
}
|
|
368
|
+
const obj = parsed;
|
|
369
|
+
const selected = obj.selectedEnvironment;
|
|
370
|
+
if (selected === undefined || selected === null || selected === "")
|
|
371
|
+
return null;
|
|
372
|
+
if (typeof selected !== "string") {
|
|
373
|
+
return corrupt(`"selectedEnvironment" must be a string`);
|
|
374
|
+
}
|
|
375
|
+
return selected;
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Applies the precedence to an already-loaded config. Exposed separately so
|
|
379
|
+
* the CLI wrapper can run its own field-level validation first and still share
|
|
380
|
+
* one ordering with every other reader.
|
|
381
|
+
*/
|
|
382
|
+
export function selectEnvironmentName(config, options) {
|
|
383
|
+
const available = Object.keys(config.environments);
|
|
384
|
+
const list = available.join(", ") || "(none)";
|
|
385
|
+
const where = options.configPath
|
|
386
|
+
? `${PROJECT_CONFIG_DISPLAY_NAME} (${options.configPath})`
|
|
387
|
+
: PROJECT_CONFIG_DISPLAY_NAME;
|
|
388
|
+
const requireKnown = (name, source, origin) => {
|
|
389
|
+
if (!config.environments[name]) {
|
|
390
|
+
throw new PrimitiveEnvError("unknown-environment", `Environment "${name}" is not defined in ${where} (selected ${origin}). Available: ${list}`, options.configPath);
|
|
391
|
+
}
|
|
392
|
+
return { name, source };
|
|
393
|
+
};
|
|
394
|
+
if (options.explicitEnvName) {
|
|
395
|
+
return requireKnown(options.explicitEnvName, "explicit", "explicitly");
|
|
396
|
+
}
|
|
397
|
+
if (options.envVarName) {
|
|
398
|
+
return requireKnown(options.envVarName, "env-var", "via PRIMITIVE_ENV");
|
|
399
|
+
}
|
|
400
|
+
if (options.localSelection) {
|
|
401
|
+
return requireKnown(options.localSelection, "local", `in ${LOCAL_STATE_DISPLAY_NAME}`);
|
|
402
|
+
}
|
|
403
|
+
if (config.defaultEnvironment) {
|
|
404
|
+
return requireKnown(config.defaultEnvironment, "default", `as "defaultEnvironment"`);
|
|
405
|
+
}
|
|
406
|
+
if (available.length === 1) {
|
|
407
|
+
return { name: available[0], source: "sole" };
|
|
408
|
+
}
|
|
409
|
+
if (available.length === 0) {
|
|
410
|
+
throw new PrimitiveEnvError("no-selection", `${where} has no environments defined. Run 'primitive env add <name>' or 'primitive init'.`, options.configPath);
|
|
411
|
+
}
|
|
412
|
+
throw new PrimitiveEnvError("no-selection", `No environment selected. Run 'primitive env use <name>', set "defaultEnvironment" in ${where}, or export PRIMITIVE_ENV. Available: ${list}`, options.configPath);
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* The whole algorithm end to end: discover the config, read the selection,
|
|
416
|
+
* apply the precedence, derive the WebSocket URL.
|
|
417
|
+
*/
|
|
418
|
+
export function resolvePrimitiveEnv(options = {}) {
|
|
419
|
+
const env = options.env ?? process.env;
|
|
420
|
+
const configPath = options.configPath ?? findPrimitiveConfigPath({ cwd: options.cwd, env });
|
|
421
|
+
if (!configPath) {
|
|
422
|
+
throw new PrimitiveEnvError("missing-config", missingConfigMessage(options.cwd ?? process.cwd()));
|
|
423
|
+
}
|
|
424
|
+
const projectRoot = projectRootForConfigPath(configPath);
|
|
425
|
+
const config = readCoreProjectConfig(configPath);
|
|
426
|
+
const { name, source } = selectEnvironmentName(config, {
|
|
427
|
+
explicitEnvName: options.explicitEnvName || null,
|
|
428
|
+
envVarName: env.PRIMITIVE_ENV || null,
|
|
429
|
+
localSelection: readLocalSelection(configPath),
|
|
430
|
+
configPath,
|
|
431
|
+
});
|
|
432
|
+
const entry = config.environments[name];
|
|
433
|
+
return {
|
|
434
|
+
name,
|
|
435
|
+
apiUrl: entry.apiUrl,
|
|
436
|
+
wsUrl: deriveWsUrl(entry.apiUrl),
|
|
437
|
+
appId: entry.appId,
|
|
438
|
+
appName: entry.appName,
|
|
439
|
+
webUrl: entry.webUrl,
|
|
440
|
+
description: entry.description,
|
|
441
|
+
source,
|
|
442
|
+
configPath,
|
|
443
|
+
localStatePath: localStatePathForConfigPath(configPath),
|
|
444
|
+
projectRoot,
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
//# sourceMappingURL=env-resolver-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-resolver-core.js","sourceRoot":"","sources":["../../../src/lib/env-resolver-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7D,uEAAuE;AACvE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAC1C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,CAAC,MAA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
/**
|
|
2
|
+
* Environment resolution (CLI side).
|
|
3
|
+
*
|
|
4
|
+
* The algorithm itself lives in `env-resolver-core.ts` — the one copy the Vite
|
|
5
|
+
* plugin and the Swift pre-build script also run (#2873). This module is the
|
|
6
|
+
* CLI's thin wrapper around it: process-lifetime caching, the `--env` override
|
|
7
|
+
* commander sets, and — load-bearing — the CLI's own FULL field-level
|
|
8
|
+
* validation via `validateProjectConfig()`. The core carries only the version
|
|
9
|
+
* and structural checks the other readers need; running the CLI's validation
|
|
10
|
+
* first is what keeps `getProjectConfig()` and `getCurrentEnvironment()` from
|
|
11
|
+
* ever disagreeing about the same file.
|
|
12
|
+
*
|
|
13
|
+
* The resolution order is:
|
|
14
|
+
*
|
|
15
|
+
* 1. Explicit --env <name> flag (set via setCurrentEnvName from bin/primitive.ts)
|
|
16
|
+
* 2. PRIMITIVE_ENV environment variable
|
|
17
|
+
* 3. The per-machine selection in .primitive/local.json (`primitive env use`)
|
|
18
|
+
* 4. The project config's committed defaultEnvironment
|
|
19
|
+
* 5. If the project has exactly one environment, that one
|
|
20
|
+
* 6. null (legacy mode — fall back to ~/.primitive/credentials.json)
|
|
21
|
+
*
|
|
22
|
+
* Commands read the resolved environment once via getCurrentEnvironment().
|
|
23
|
+
* The resolution is cached for the lifetime of the process.
|
|
24
|
+
*/
|
|
25
|
+
import { type ProjectConfig, type ProjectEnvironment } from "./project-config.js";
|
|
26
|
+
import { PrimitiveEnvError, type PrimitiveEnvSource } from "./env-resolver-core.js";
|
|
27
|
+
export interface ResolvedEnvironment {
|
|
28
|
+
/** The environment name (e.g. "dev", "prod"). */
|
|
29
|
+
name: string;
|
|
30
|
+
/** The config entry for this environment. */
|
|
31
|
+
config: ProjectEnvironment;
|
|
32
|
+
/** Absolute path to primitive/config.json. */
|
|
33
|
+
projectConfigPath: string;
|
|
34
|
+
/** Absolute path to the project root (the parent of .primitive/). */
|
|
35
|
+
projectRoot: string;
|
|
36
|
+
/** Which precedence step chose this environment. */
|
|
37
|
+
source: PrimitiveEnvSource;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Called by bin/primitive.ts when the user passes --env <name> on the command
|
|
41
|
+
* line. Must be called before any command code runs so subsequent calls to
|
|
42
|
+
* getCurrentEnvironment() see the override.
|
|
43
|
+
*/
|
|
44
|
+
export declare function setCurrentEnvName(name: string | null): void;
|
|
45
|
+
/**
|
|
46
|
+
* Forces the resolver to re-read the project config on the next call.
|
|
47
|
+
* Used by tests and by commands that mutate the project config.
|
|
48
|
+
*/
|
|
49
|
+
export declare function resetEnvResolver(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Loads and caches the project config. Returns null if no
|
|
52
|
+
* primitive/config.json is present. Throws ProjectConfigError on a broken config.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getProjectConfig(): ProjectConfig | null;
|
|
55
|
+
/**
|
|
56
|
+
* Reads this machine's environment selection (`primitive env use`), or null
|
|
57
|
+
* when nothing is selected. Throws PrimitiveEnvError on corrupt local state —
|
|
58
|
+
* `env list` / `env show` surface that distinctly instead of quietly falling
|
|
59
|
+
* back to the committed default.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getLocalSelection(): string | null;
|
|
62
|
+
/** Absolute path of the local-state file for the current project, if any. */
|
|
63
|
+
export declare function getLocalStatePath(): string | null;
|
|
64
|
+
/**
|
|
65
|
+
* Resolves the current environment, or returns null if we're running in
|
|
66
|
+
* legacy mode (no primitive/config.json present).
|
|
67
|
+
*
|
|
68
|
+
* This never throws for a missing project config — that's legitimate
|
|
69
|
+
* "legacy mode" usage. It DOES throw if the project config exists but the
|
|
70
|
+
* requested environment doesn't.
|
|
71
|
+
*/
|
|
72
|
+
export declare function getCurrentEnvironment(): ResolvedEnvironment | null;
|
|
73
|
+
/**
|
|
74
|
+
* The resolved environment, or the one refusal (#3154, intent criterion 5).
|
|
75
|
+
*
|
|
76
|
+
* `getCurrentEnvironment()` answers `null` outside a project, which used to
|
|
77
|
+
* mean "legacy mode — fall back to `./config` and `~/.primitive/`". There is
|
|
78
|
+
* no such mode any more: the environment is the ONLY thing that names the
|
|
79
|
+
* configuration tree, the app and the server, so a caller that needs one asks
|
|
80
|
+
* here and gets an error naming what is missing instead of a second answer.
|
|
81
|
+
*
|
|
82
|
+
* Everything else propagates untouched. `no-selection`, `unknown-environment`,
|
|
83
|
+
* `corrupt-local-state` and `stale-layout` are real answers about a real
|
|
84
|
+
* project, and the old `safeEnv()` swallowing them is exactly how a typo in
|
|
85
|
+
* `--env` used to end up writing into `./config`.
|
|
86
|
+
*/
|
|
87
|
+
export declare function requireCurrentEnvironment(): ResolvedEnvironment;
|
|
88
|
+
/**
|
|
89
|
+
* Returns the current environment name for display purposes (e.g. in status
|
|
90
|
+
* headers). Returns null in legacy mode. Swallows resolution errors so the
|
|
91
|
+
* header never crashes the CLI.
|
|
92
|
+
*/
|
|
93
|
+
export declare function getCurrentEnvNameSafe(): string | null;
|
|
94
|
+
/**
|
|
95
|
+
* Returns the explicit name set via setCurrentEnvName(), for commands that
|
|
96
|
+
* need to know whether the user passed --env vs. relying on defaults.
|
|
97
|
+
*/
|
|
98
|
+
export declare function getExplicitEnvName(): string | null;
|
|
99
|
+
export { PrimitiveEnvError };
|