@treeseed/sdk 0.10.28 → 0.12.4
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 +213 -7
- package/dist/agent-capacity.d.ts +916 -0
- package/dist/agent-capacity.js +1600 -0
- package/dist/agent-tools.d.ts +37 -0
- package/dist/agent-tools.js +301 -0
- package/dist/api/app.d.ts +1 -1
- package/dist/api/auth/d1-database.d.ts +2 -2
- package/dist/api/auth/d1-provider.d.ts +4 -4
- package/dist/api/auth/d1-store.d.ts +2 -2
- package/dist/api/auth/memory-provider.d.ts +1 -1
- package/dist/api/auth/tokens.d.ts +1 -1
- package/dist/api/config.d.ts +3 -1
- package/dist/api/config.js +34 -10
- package/dist/api/http.d.ts +2 -2
- package/dist/api/index.d.ts +10 -10
- package/dist/api/index.js +4 -2
- package/dist/api/operations-routes.d.ts +3 -3
- package/dist/api/operations.d.ts +1 -1
- package/dist/api/providers.d.ts +1 -1
- package/dist/api/providers.js +21 -4
- package/dist/api/railway.d.ts +3 -2
- package/dist/api/sdk-dispatch.d.ts +4 -4
- package/dist/api/sdk-routes.d.ts +2 -2
- package/dist/api/templates.d.ts +2 -2
- package/dist/api/types.d.ts +3 -2
- package/dist/capacity-provider.d.ts +118 -59
- package/dist/capacity-provider.js +235 -43
- package/dist/capacity.d.ts +2 -2
- package/dist/cli-tools.d.ts +1 -1
- package/dist/content-operations.d.ts +97 -0
- package/dist/content-operations.js +250 -0
- package/dist/content-store.d.ts +4 -4
- package/dist/control-plane-client.d.ts +13 -18
- package/dist/control-plane-client.js +8 -86
- package/dist/control-plane.d.ts +3 -2
- package/dist/control-plane.js +38 -13
- package/dist/copilot.d.ts +3 -0
- package/dist/copilot.js +16 -1
- package/dist/d1-http.d.ts +1 -1
- package/dist/d1-store.d.ts +32 -57
- package/dist/d1-store.js +115 -318
- package/dist/db/d1.d.ts +1 -232
- package/dist/db/index.d.ts +3 -3
- package/dist/db/market-schema.d.ts +50900 -11018
- package/dist/db/market-schema.js +2313 -467
- package/dist/db/node-sqlite.d.ts +1 -232
- package/dist/db/node-sqlite.js +7 -2
- package/dist/db/schema.d.ts +0 -462
- package/dist/db/schema.js +2 -22
- package/dist/dispatch.d.ts +1 -1
- package/dist/dispatch.js +0 -11
- package/dist/fixture-support.js +52 -4
- package/dist/governance.d.ts +133 -0
- package/dist/governance.js +285 -0
- package/dist/graph/build.d.ts +2 -2
- package/dist/graph/context-query-contracts.d.ts +1 -1
- package/dist/graph/dsl.d.ts +1 -1
- package/dist/graph/query.d.ts +4 -4
- package/dist/graph/ranking.d.ts +1 -1
- package/dist/graph/schema.d.ts +1 -1
- package/dist/graph.d.ts +11 -11
- package/dist/guarantees/index.d.ts +425 -0
- package/dist/guarantees/index.js +1146 -0
- package/dist/hosting/apps.d.ts +12 -0
- package/dist/hosting/apps.js +107 -0
- package/dist/hosting/builtins.d.ts +25 -0
- package/dist/hosting/builtins.js +602 -0
- package/dist/hosting/contracts.d.ts +208 -0
- package/dist/hosting/contracts.js +0 -0
- package/dist/hosting/graph.d.ts +195 -0
- package/dist/hosting/graph.js +1092 -0
- package/dist/hosting/index.d.ts +4 -0
- package/dist/hosting/index.js +4 -0
- package/dist/index.d.ts +88 -67
- package/dist/index.js +142 -14
- package/dist/local-dev/managed-dev.d.ts +85 -0
- package/dist/local-dev/managed-dev.js +368 -0
- package/dist/managed-dependencies.d.ts +9 -0
- package/dist/managed-dependencies.js +10 -9
- package/dist/market-client.d.ts +327 -9
- package/dist/market-client.js +464 -20
- package/dist/model-registry.d.ts +1 -1
- package/dist/model-registry.js +19 -19
- package/dist/operations/agent-tools.d.ts +2 -11
- package/dist/operations/agent-tools.js +2 -14
- package/dist/operations/providers/default.d.ts +1 -1
- package/dist/operations/providers/default.js +20 -37
- package/dist/operations/repository-operations.d.ts +26 -2
- package/dist/operations/repository-operations.js +159 -1
- package/dist/operations/runtime.d.ts +3 -3
- package/dist/operations/services/bootstrap-runner.d.ts +4 -2
- package/dist/operations/services/bootstrap-runner.js +22 -2
- package/dist/operations/services/build-warning-policy.d.ts +34 -0
- package/dist/operations/services/build-warning-policy.js +81 -82
- package/dist/operations/services/commit-message-provider.js +4 -4
- package/dist/operations/services/config-runtime.d.ts +83 -24
- package/dist/operations/services/config-runtime.js +449 -130
- package/dist/operations/services/deploy.d.ts +106 -624
- package/dist/operations/services/deploy.js +746 -263
- package/dist/operations/services/deployment-readiness.d.ts +30 -0
- package/dist/operations/services/deployment-readiness.js +206 -0
- package/dist/operations/services/git-remote-policy.js +12 -4
- package/dist/operations/services/git-runner.d.ts +66 -0
- package/dist/operations/services/git-runner.js +479 -0
- package/dist/operations/services/git-workflow.d.ts +45 -6
- package/dist/operations/services/git-workflow.js +251 -23
- package/dist/operations/services/github-actions-verification.d.ts +4 -1
- package/dist/operations/services/github-actions-verification.js +12 -3
- package/dist/operations/services/github-api.js +22 -6
- package/dist/operations/services/github-automation.d.ts +4 -4
- package/dist/operations/services/github-automation.js +19 -21
- package/dist/operations/services/github-credentials.d.ts +13 -0
- package/dist/operations/services/github-credentials.js +59 -0
- package/dist/operations/services/hosted-service-checks.d.ts +81 -0
- package/dist/operations/services/hosted-service-checks.js +478 -0
- package/dist/operations/services/hosting-audit.d.ts +2 -2
- package/dist/operations/services/hosting-audit.js +7 -7
- package/dist/operations/services/hub-launch.d.ts +1 -1
- package/dist/operations/services/hub-provider-launch.d.ts +5 -5
- package/dist/operations/services/hub-provider-launch.js +22 -17
- package/dist/operations/services/live-hosted-service-checks.d.ts +26 -0
- package/dist/operations/services/live-hosted-service-checks.js +463 -0
- package/dist/operations/services/local-dev.js +0 -1
- package/dist/operations/services/managed-host-security.d.ts +1 -1
- package/dist/operations/services/managed-host-security.js +1 -1
- package/dist/operations/services/managed-repositories.d.ts +37 -0
- package/dist/operations/services/managed-repositories.js +177 -0
- package/dist/operations/services/operations-runner-smoke.d.ts +31 -0
- package/dist/operations/services/operations-runner-smoke.js +198 -0
- package/dist/operations/services/package-adapters.d.ts +170 -0
- package/dist/operations/services/package-adapters.js +859 -0
- package/dist/operations/services/package-reference-policy.d.ts +13 -88
- package/dist/operations/services/package-reference-policy.js +96 -215
- package/dist/operations/services/project-host-operations.d.ts +4 -4
- package/dist/operations/services/project-platform.d.ts +57 -173
- package/dist/operations/services/project-platform.js +80 -111
- package/dist/operations/services/project-web-monitor.d.ts +2 -2
- package/dist/operations/services/project-web-monitor.js +122 -5
- package/dist/operations/services/railway-api.d.ts +117 -5
- package/dist/operations/services/railway-api.js +915 -93
- package/dist/operations/services/railway-deploy.d.ts +30 -112
- package/dist/operations/services/railway-deploy.js +521 -961
- package/dist/operations/services/release-history.js +3 -4
- package/dist/operations/services/release-proof-ledger.d.ts +13 -0
- package/dist/operations/services/release-proof-ledger.js +81 -0
- package/dist/operations/services/release-proof-planner.d.ts +48 -0
- package/dist/operations/services/release-proof-planner.js +195 -0
- package/dist/operations/services/release-proof-runner.d.ts +16 -0
- package/dist/operations/services/release-proof-runner.js +169 -0
- package/dist/operations/services/release-proof.d.ts +81 -0
- package/dist/operations/services/release-proof.js +79 -0
- package/dist/operations/services/repository-save-orchestrator.d.ts +8 -7
- package/dist/operations/services/repository-save-orchestrator.js +604 -212
- package/dist/operations/services/runtime-paths.d.ts +1 -3
- package/dist/operations/services/runtime-paths.js +0 -4
- package/dist/operations/services/runtime-tools.d.ts +1 -191
- package/dist/operations/services/runtime-tools.js +4 -443
- package/dist/operations/services/save-deploy-preflight.js +9 -1
- package/dist/operations/services/template-host-bindings.d.ts +2 -2
- package/dist/operations/services/template-host-bindings.js +3 -2
- package/dist/operations/services/template-registry.d.ts +6 -6
- package/dist/operations/services/template-registry.js +33 -14
- package/dist/operations/services/template-secret-sync.d.ts +3 -3
- package/dist/operations/services/verification-cache.d.ts +25 -0
- package/dist/operations/services/verification-cache.js +71 -0
- package/dist/operations/services/workflow-timing.d.ts +25 -0
- package/dist/operations/services/workflow-timing.js +79 -0
- package/dist/operations/services/workspace-dependency-mode.js +50 -5
- package/dist/operations/services/workspace-preflight.js +8 -8
- package/dist/operations/services/workspace-save-script.d.ts +4 -4
- package/dist/operations/services/workspace-save.d.ts +1 -0
- package/dist/operations/services/workspace-save.js +42 -19
- package/dist/operations/services/workspace-tools.js +42 -7
- package/dist/operations-registry.d.ts +1 -1
- package/dist/operations-registry.js +5 -6
- package/dist/operations-types.d.ts +1 -1
- package/dist/operations.d.ts +17 -11
- package/dist/operations.js +57 -3
- package/dist/platform/book-export.js +2 -0
- package/dist/platform/books-data.d.ts +1 -1
- package/dist/platform/config.d.ts +27 -0
- package/dist/platform/config.js +100 -0
- package/dist/platform/content-runtime-source.d.ts +54 -0
- package/dist/platform/content-runtime-source.js +169 -0
- package/dist/platform/contracts.d.ts +38 -2
- package/dist/platform/deploy-config.d.ts +1 -1
- package/dist/platform/deploy-config.js +80 -9
- package/dist/platform/deploy-runtime.d.ts +1 -1
- package/dist/platform/desired-state.d.ts +63 -0
- package/dist/platform/desired-state.js +1021 -0
- package/dist/platform/env.yaml +568 -45
- package/dist/platform/environment.d.ts +3 -2
- package/dist/platform/environment.js +122 -21
- package/dist/platform/local-content-materialization.d.ts +9 -0
- package/dist/platform/local-content-materialization.js +212 -0
- package/dist/platform/plugin.d.ts +13 -4
- package/dist/platform/plugins/runtime.d.ts +3 -3
- package/dist/platform/plugins/runtime.js +62 -1
- package/dist/platform/plugins.d.ts +6 -6
- package/dist/platform/published-content-pipeline.d.ts +3 -3
- package/dist/platform/published-content-pipeline.js +5 -1
- package/dist/platform/published-content.d.ts +4 -3
- package/dist/platform/site-config-schema.d.ts +1 -0
- package/dist/platform/site-config-schema.js +4 -1
- package/dist/platform/tenant/runtime-config.d.ts +152 -2
- package/dist/platform/tenant-config.d.ts +1 -1
- package/dist/platform/utils/site-config-schema.d.ts +154 -0
- package/dist/platform/utils/site-config-schema.js +400 -461
- package/dist/platform-operation-store.d.ts +1 -1
- package/dist/platform-operation-store.js +2 -2
- package/dist/platform-operations.js +1 -1
- package/dist/plugin-default.d.ts +1 -1
- package/dist/plugin-default.js +27 -12
- package/dist/project-import.d.ts +91 -0
- package/dist/project-import.js +257 -0
- package/dist/project-workflow.d.ts +1 -1
- package/dist/reconcile/bootstrap-systems.d.ts +2 -2
- package/dist/reconcile/bootstrap-systems.js +5 -5
- package/dist/reconcile/builtin-adapters.d.ts +7 -1
- package/dist/reconcile/builtin-adapters.js +3190 -429
- package/dist/reconcile/contracts.d.ts +23 -6
- package/dist/reconcile/desired-state.d.ts +2 -192
- package/dist/reconcile/desired-state.js +29 -38
- package/dist/reconcile/engine.d.ts +61 -395
- package/dist/reconcile/engine.js +229 -44
- package/dist/reconcile/index.d.ts +10 -8
- package/dist/reconcile/index.js +2 -0
- package/dist/reconcile/live-acceptance.d.ts +100 -0
- package/dist/reconcile/live-acceptance.js +2027 -0
- package/dist/reconcile/platform.d.ts +104 -0
- package/dist/reconcile/platform.js +100 -0
- package/dist/reconcile/providers/docker-private.d.ts +54 -0
- package/dist/reconcile/providers/docker-private.js +101 -0
- package/dist/reconcile/providers/github-private.d.ts +65 -0
- package/dist/reconcile/providers/github-private.js +119 -0
- package/dist/reconcile/providers/local-private.d.ts +28 -0
- package/dist/reconcile/providers/local-private.js +75 -0
- package/dist/reconcile/providers/railway-iac.d.ts +66 -0
- package/dist/reconcile/providers/railway-iac.js +275 -0
- package/dist/reconcile/providers/release-private.d.ts +92 -0
- package/dist/reconcile/providers/release-private.js +152 -0
- package/dist/reconcile/registry.d.ts +2 -2
- package/dist/reconcile/registry.js +16 -1
- package/dist/reconcile/state.d.ts +1 -1
- package/dist/reconcile/state.js +7 -44
- package/dist/reconcile/units.d.ts +1 -1
- package/dist/reconcile/units.js +9 -3
- package/dist/remote.d.ts +6 -6
- package/dist/scenes/artifacts.d.ts +16 -0
- package/dist/scenes/artifacts.js +61 -0
- package/dist/scenes/auth.d.ts +2 -0
- package/dist/scenes/auth.js +28 -0
- package/dist/scenes/base-url.d.ts +12 -0
- package/dist/scenes/base-url.js +123 -0
- package/dist/scenes/builtin-plugins.d.ts +2 -0
- package/dist/scenes/builtin-plugins.js +447 -0
- package/dist/scenes/checkpoints.d.ts +14 -0
- package/dist/scenes/checkpoints.js +33 -0
- package/dist/scenes/device-matrix.d.ts +2 -0
- package/dist/scenes/device-matrix.js +97 -0
- package/dist/scenes/devices.d.ts +11 -0
- package/dist/scenes/devices.js +22 -0
- package/dist/scenes/diagnostics.d.ts +5 -0
- package/dist/scenes/diagnostics.js +22 -0
- package/dist/scenes/diagram-providers.d.ts +2 -0
- package/dist/scenes/diagram-providers.js +181 -0
- package/dist/scenes/diagram-validation.d.ts +22 -0
- package/dist/scenes/diagram-validation.js +74 -0
- package/dist/scenes/environment.d.ts +2 -0
- package/dist/scenes/environment.js +65 -0
- package/dist/scenes/evidence-bundle.d.ts +5 -0
- package/dist/scenes/evidence-bundle.js +42 -0
- package/dist/scenes/evidence-report.d.ts +10 -0
- package/dist/scenes/evidence-report.js +73 -0
- package/dist/scenes/evidence.d.ts +16 -0
- package/dist/scenes/evidence.js +277 -0
- package/dist/scenes/index.d.ts +48 -0
- package/dist/scenes/index.js +312 -0
- package/dist/scenes/inspect.d.ts +9 -0
- package/dist/scenes/inspect.js +64 -0
- package/dist/scenes/loader.d.ts +3 -0
- package/dist/scenes/loader.js +38 -0
- package/dist/scenes/logs.d.ts +2 -0
- package/dist/scenes/logs.js +47 -0
- package/dist/scenes/operations.d.ts +3 -0
- package/dist/scenes/operations.js +128 -0
- package/dist/scenes/phase0.d.ts +9 -0
- package/dist/scenes/phase0.js +637 -0
- package/dist/scenes/planner.d.ts +12 -0
- package/dist/scenes/planner.js +166 -0
- package/dist/scenes/playwright-adapter.d.ts +2 -0
- package/dist/scenes/playwright-adapter.js +63 -0
- package/dist/scenes/plugins.d.ts +5 -0
- package/dist/scenes/plugins.js +115 -0
- package/dist/scenes/progress.d.ts +17 -0
- package/dist/scenes/progress.js +24 -0
- package/dist/scenes/publish-destinations.d.ts +12 -0
- package/dist/scenes/publish-destinations.js +99 -0
- package/dist/scenes/publish-plan-report.d.ts +10 -0
- package/dist/scenes/publish-plan-report.js +70 -0
- package/dist/scenes/publish-plan.d.ts +15 -0
- package/dist/scenes/publish-plan.js +248 -0
- package/dist/scenes/publish-redaction.d.ts +16 -0
- package/dist/scenes/publish-redaction.js +148 -0
- package/dist/scenes/publish-release-record.d.ts +13 -0
- package/dist/scenes/publish-release-record.js +34 -0
- package/dist/scenes/publish-report.d.ts +10 -0
- package/dist/scenes/publish-report.js +67 -0
- package/dist/scenes/publish.d.ts +16 -0
- package/dist/scenes/publish.js +298 -0
- package/dist/scenes/registry.d.ts +12 -0
- package/dist/scenes/registry.js +65 -0
- package/dist/scenes/remotion-adapter.d.ts +3 -0
- package/dist/scenes/remotion-adapter.js +94 -0
- package/dist/scenes/remotion-composition-registry.d.ts +2 -0
- package/dist/scenes/remotion-composition-registry.js +12 -0
- package/dist/scenes/remotion-compositions.d.ts +15 -0
- package/dist/scenes/remotion-compositions.js +464 -0
- package/dist/scenes/remotion-diagrams.d.ts +9 -0
- package/dist/scenes/remotion-diagrams.js +188 -0
- package/dist/scenes/remotion-input.d.ts +13 -0
- package/dist/scenes/remotion-input.js +291 -0
- package/dist/scenes/remotion-visuals.d.ts +29 -0
- package/dist/scenes/remotion-visuals.js +198 -0
- package/dist/scenes/render-media-assets.d.ts +9 -0
- package/dist/scenes/render-media-assets.js +117 -0
- package/dist/scenes/render-report.d.ts +10 -0
- package/dist/scenes/render-report.js +27 -0
- package/dist/scenes/render.d.ts +2 -0
- package/dist/scenes/render.js +218 -0
- package/dist/scenes/reporter.d.ts +3 -0
- package/dist/scenes/reporter.js +101 -0
- package/dist/scenes/resume.d.ts +2 -0
- package/dist/scenes/resume.js +79 -0
- package/dist/scenes/runner.d.ts +2 -0
- package/dist/scenes/runner.js +674 -0
- package/dist/scenes/schema.d.ts +6 -0
- package/dist/scenes/schema.js +994 -0
- package/dist/scenes/seed.d.ts +2 -0
- package/dist/scenes/seed.js +83 -0
- package/dist/scenes/segments.d.ts +15 -0
- package/dist/scenes/segments.js +79 -0
- package/dist/scenes/selectors.d.ts +3 -0
- package/dist/scenes/selectors.js +21 -0
- package/dist/scenes/timeline.d.ts +11 -0
- package/dist/scenes/timeline.js +26 -0
- package/dist/scenes/timeouts.d.ts +6 -0
- package/dist/scenes/timeouts.js +17 -0
- package/dist/scenes/training-captions.d.ts +14 -0
- package/dist/scenes/training-captions.js +98 -0
- package/dist/scenes/training-report.d.ts +10 -0
- package/dist/scenes/training-report.js +78 -0
- package/dist/scenes/training-transcript.d.ts +24 -0
- package/dist/scenes/training-transcript.js +204 -0
- package/dist/scenes/training.d.ts +10 -0
- package/dist/scenes/training.js +134 -0
- package/dist/scenes/types.d.ts +1872 -0
- package/dist/scenes/types.js +8 -0
- package/dist/scenes/visual-audit-contact-sheets.d.ts +6 -0
- package/dist/scenes/visual-audit-contact-sheets.js +119 -0
- package/dist/scenes/visual-audit-fixtures.d.ts +25 -0
- package/dist/scenes/visual-audit-fixtures.js +210 -0
- package/dist/scenes/visual-audit-report.d.ts +11 -0
- package/dist/scenes/visual-audit-report.js +85 -0
- package/dist/scenes/visual-audit-review.d.ts +23 -0
- package/dist/scenes/visual-audit-review.js +829 -0
- package/dist/scenes/visual-audit-routes.d.ts +13 -0
- package/dist/scenes/visual-audit-routes.js +308 -0
- package/dist/scenes/visual-audit.d.ts +3 -0
- package/dist/scenes/visual-audit.js +596 -0
- package/dist/scripts/build-dist.js +154 -40
- package/dist/scripts/check-build-warnings.js +42 -53
- package/dist/scripts/cleanup-markdown.js +1 -1
- package/dist/scripts/cli-test-fixtures.js +24 -28
- package/dist/scripts/deployment-readiness.js +20 -0
- package/dist/scripts/generate-treedx-openapi-types.js +186 -0
- package/dist/scripts/migrate-journey-csv-to-guarantees.js +140 -0
- package/dist/scripts/operations-runner-smoke.js +16 -0
- package/dist/scripts/package-tools.js +12 -1
- package/dist/scripts/prepare.js +3 -7
- package/dist/scripts/release-verify.js +6 -6
- package/dist/scripts/run-fixture-astro-command.js +1 -1
- package/dist/scripts/template-catalog.test.js +68 -82
- package/dist/scripts/tenant-dev.js +0 -10
- package/dist/scripts/tenant-workflow-action.js +10 -1
- package/dist/scripts/test-cloudflare-local.js +1 -1
- package/dist/scripts/test-scaffold.js +0 -1
- package/dist/scripts/test-smoke.js +3 -3
- package/dist/scripts/treeseed-build-dist.js +4 -7
- package/dist/scripts/treeseed-release-verify.js +1 -1
- package/dist/scripts/verify-driver.js +30 -21
- package/dist/scripts/workflow-commands.test.js +18 -27
- package/dist/scripts/workspace-command-e2e.js +1 -1
- package/dist/scripts/workspace-lint.js +6 -0
- package/dist/scripts/workspace-release-test.js +90 -1
- package/dist/scripts/workspace-test.js +6 -0
- package/dist/sdk-dispatch.d.ts +1 -1
- package/dist/sdk-dispatch.js +0 -16
- package/dist/sdk-fields.d.ts +1 -1
- package/dist/sdk-filters.d.ts +1 -1
- package/dist/sdk-types.d.ts +1352 -116
- package/dist/sdk-types.js +413 -2
- package/dist/sdk.d.ts +106 -100
- package/dist/sdk.js +211 -51
- package/dist/secrets-capability.d.ts +421 -0
- package/dist/secrets-capability.js +530 -0
- package/dist/seeds/normalize.js +1 -0
- package/dist/seeds/planner.js +38 -0
- package/dist/seeds/schema.js +293 -4
- package/dist/seeds/types.d.ts +60 -0
- package/dist/seeds/types.js +9 -1
- package/dist/service-credentials.d.ts +54 -0
- package/dist/service-credentials.js +112 -0
- package/dist/stores/cursor-store.d.ts +2 -2
- package/dist/stores/envelopes.d.ts +1 -1
- package/dist/stores/helpers.d.ts +1 -1
- package/dist/stores/lease-store.d.ts +2 -2
- package/dist/stores/message-store.d.ts +2 -2
- package/dist/stores/operational-store.d.ts +3 -26
- package/dist/stores/operational-store.js +0 -225
- package/dist/stores/project-workflow-store.d.ts +2 -2
- package/dist/stores/run-store.d.ts +2 -3
- package/dist/stores/run-store.js +0 -98
- package/dist/stores/subscription-store.d.ts +2 -3
- package/dist/stores/subscription-store.js +0 -100
- package/dist/template-catalog.d.ts +1 -1
- package/dist/template-launch-requirements.d.ts +2 -2
- package/dist/template-launch-requirements.js +9 -0
- package/dist/template-launch-ui.d.ts +2 -2
- package/dist/treedx/adapters.d.ts +6 -0
- package/dist/treedx/adapters.js +36 -0
- package/dist/treedx/client.d.ts +222 -0
- package/dist/treedx/client.js +871 -0
- package/dist/treedx/errors.d.ts +13 -0
- package/dist/treedx/errors.js +17 -0
- package/dist/treedx/federated-client.d.ts +27 -0
- package/dist/treedx/federated-client.js +158 -0
- package/dist/treedx/generated/openapi-types.d.ts +3558 -0
- package/dist/treedx/generated/openapi-types.js +0 -0
- package/dist/treedx/graph-adapter.d.ts +33 -0
- package/dist/treedx/graph-adapter.js +156 -0
- package/dist/treedx/index.d.ts +14 -0
- package/dist/treedx/index.js +48 -0
- package/dist/treedx/market-integration.d.ts +27 -0
- package/dist/treedx/market-integration.js +131 -0
- package/dist/treedx/ports.d.ts +166 -0
- package/dist/treedx/ports.js +231 -0
- package/dist/treedx/query-adapter.d.ts +19 -0
- package/dist/treedx/query-adapter.js +62 -0
- package/dist/treedx/registry-client.d.ts +11 -0
- package/dist/treedx/registry-client.js +19 -0
- package/dist/treedx/repository-adapter.d.ts +45 -0
- package/dist/treedx/repository-adapter.js +319 -0
- package/dist/treedx/sdk-integration.d.ts +27 -0
- package/dist/treedx/sdk-integration.js +63 -0
- package/dist/treedx/types.d.ts +1084 -0
- package/dist/treedx/types.js +8 -0
- package/dist/treedx/workspace-adapter.d.ts +27 -0
- package/dist/treedx/workspace-adapter.js +65 -0
- package/dist/treedx-backends.d.ts +220 -0
- package/dist/treedx-backends.js +634 -0
- package/dist/treedx-client.d.ts +89 -0
- package/dist/treedx-client.js +184 -0
- package/dist/treeseed/services/compose.yml +2 -3
- package/dist/treeseed/template-catalog/catalog.fixture.json +27 -27
- package/dist/types/agents.d.ts +256 -0
- package/dist/types/agents.js +42 -1
- package/dist/verification.d.ts +1 -0
- package/dist/verification.js +143 -14
- package/dist/workflow/operations.d.ts +580 -523
- package/dist/workflow/operations.js +2084 -1279
- package/dist/workflow/policy.js +19 -7
- package/dist/workflow/runs.d.ts +9 -3
- package/dist/workflow/runs.js +66 -26
- package/dist/workflow/session.d.ts +4 -1
- package/dist/workflow/session.js +50 -10
- package/dist/workflow/worktrees.d.ts +6 -2
- package/dist/workflow/worktrees.js +98 -15
- package/dist/workflow-state.d.ts +17 -4
- package/dist/workflow-state.js +68 -41
- package/dist/workflow-support.d.ts +26 -17
- package/dist/workflow-support.js +84 -24
- package/dist/workflow.d.ts +51 -16
- package/dist/workflow.js +19 -7
- package/drizzle/d1/0000_treeseed_d1.sql +0 -18
- package/drizzle/market/0000_market_control_plane.sql +1793 -1499
- package/drizzle/market/0004_treedx_market_integration.sql +99 -0
- package/drizzle/market/0005_agent_capacity_coordination.sql +145 -0
- package/drizzle/market/0006_provider_assignment_lifecycle.sql +9 -0
- package/drizzle/market/0007_agent_architecture_gap_closure.sql +157 -0
- package/drizzle/market/0008_agent_capacity_operational_closure.sql +27 -0
- package/drizzle/market/0009_agent_capacity_runtime_hardening.sql +29 -0
- package/drizzle/market/0010_secrets_capability_persistence.sql +130 -0
- package/drizzle/market/0011_github_app_adapter.sql +47 -0
- package/drizzle/market/0012_workday_test_runs.sql +44 -0
- package/drizzle/market/0013_runtime_task_lifecycle.sql +39 -0
- package/drizzle/market/0014_governance_pipeline.sql +189 -0
- package/package.json +106 -18
- package/scripts/{verify-driver.mjs → verify-driver.ts} +19 -4
- package/templates/github/deploy-web.workflow.yml +49 -12
- package/dist/operations/services/mailpit-runtime.d.ts +0 -20
- package/dist/operations/services/mailpit-runtime.js +0 -67
- package/dist/operations/services/release-candidate.d.ts +0 -41
- package/dist/operations/services/release-candidate.js +0 -616
- package/dist/scripts/ensure-mailpit.js +0 -48
- package/dist/scripts/logs-mailpit.js +0 -2
- package/dist/scripts/run-ts.js +0 -45
- package/dist/scripts/stop-mailpit.js +0 -5
- package/dist/scripts/treeseed-run-ts.js +0 -45
|
@@ -1,616 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
import { spawnSync } from "node:child_process";
|
|
3
|
-
import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { tmpdir } from "node:os";
|
|
5
|
-
import { dirname, join, relative, resolve } from "node:path";
|
|
6
|
-
import { isTreeseedEnvironmentEntryRelevant, isTreeseedEnvironmentEntryRequired } from "../../platform/environment.js";
|
|
7
|
-
import { maybeResolveGitHubRepositorySlug } from "./github-automation.js";
|
|
8
|
-
import { createGitHubApiClient, listGitHubEnvironmentSecretNames, listGitHubEnvironmentVariableNames } from "./github-api.js";
|
|
9
|
-
import { collectInternalDevReferenceIssues, normalizeGitRemoteForManifest } from "./package-reference-policy.js";
|
|
10
|
-
import { collectTreeseedEnvironmentContext, resolveTreeseedMachineEnvironmentValues, validateTreeseedCommandEnvironment } from "./config-runtime.js";
|
|
11
|
-
import { loadDeployState } from "./deploy.js";
|
|
12
|
-
import { loadCliDeployConfig } from "./runtime-tools.js";
|
|
13
|
-
import { packagesWithScript, run, workspacePackages } from "./workspace-tools.js";
|
|
14
|
-
import { createBuildWarningSummary, formatAllowedBuildWarnings } from "./build-warning-policy.js";
|
|
15
|
-
const RELEASE_CANDIDATE_CACHE_DIR = ".treeseed/workflow/release-candidates";
|
|
16
|
-
const RELEASE_CANDIDATE_POLICY_VERSION = "strict-output-v1";
|
|
17
|
-
const STABLE_SEMVER = /^\d+\.\d+\.\d+$/u;
|
|
18
|
-
const REHEARSAL_IGNORED_SEGMENTS = /* @__PURE__ */ new Set([
|
|
19
|
-
".git",
|
|
20
|
-
".treeseed",
|
|
21
|
-
".wrangler",
|
|
22
|
-
".astro",
|
|
23
|
-
"coverage",
|
|
24
|
-
"dist",
|
|
25
|
-
"node_modules"
|
|
26
|
-
]);
|
|
27
|
-
function nowIso() {
|
|
28
|
-
return (/* @__PURE__ */ new Date()).toISOString();
|
|
29
|
-
}
|
|
30
|
-
function sortedRecord(record) {
|
|
31
|
-
return Object.fromEntries(Object.entries(record).sort(([left], [right]) => left.localeCompare(right)));
|
|
32
|
-
}
|
|
33
|
-
function sha256(value) {
|
|
34
|
-
return createHash("sha256").update(value).digest("hex");
|
|
35
|
-
}
|
|
36
|
-
function fileSha256(filePath) {
|
|
37
|
-
if (!existsSync(filePath)) return null;
|
|
38
|
-
return createHash("sha256").update(readFileSync(filePath)).digest("hex");
|
|
39
|
-
}
|
|
40
|
-
function safeGitHead(repoDir) {
|
|
41
|
-
try {
|
|
42
|
-
return run("git", ["rev-parse", "HEAD"], { cwd: repoDir, capture: true }).trim();
|
|
43
|
-
} catch {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function safePackageJson(filePath) {
|
|
48
|
-
try {
|
|
49
|
-
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
50
|
-
} catch {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function writeJsonFile(filePath, value) {
|
|
55
|
-
writeFileSync(filePath, `${JSON.stringify(value, null, 2)}
|
|
56
|
-
`, "utf8");
|
|
57
|
-
}
|
|
58
|
-
function packageScripts(filePath) {
|
|
59
|
-
const packageJson = safePackageJson(filePath);
|
|
60
|
-
return packageJson?.scripts && typeof packageJson.scripts === "object" && !Array.isArray(packageJson.scripts) ? packageJson.scripts : {};
|
|
61
|
-
}
|
|
62
|
-
function releaseCandidateCachePath(root, key) {
|
|
63
|
-
return resolve(root, RELEASE_CANDIDATE_CACHE_DIR, `${key}.json`);
|
|
64
|
-
}
|
|
65
|
-
function ensureReleaseCandidateCacheDir(root) {
|
|
66
|
-
const dir = resolve(root, RELEASE_CANDIDATE_CACHE_DIR);
|
|
67
|
-
mkdirSync(dir, { recursive: true });
|
|
68
|
-
const gitignorePath = resolve(root, ".treeseed", "workflow", ".gitignore");
|
|
69
|
-
mkdirSync(dirname(gitignorePath), { recursive: true });
|
|
70
|
-
if (!existsSync(gitignorePath)) {
|
|
71
|
-
writeFileSync(gitignorePath, "*\n!.gitignore\n!runs/\nruns/*\n!runs/.gitignore\n", "utf8");
|
|
72
|
-
}
|
|
73
|
-
return dir;
|
|
74
|
-
}
|
|
75
|
-
function buildReleaseCandidateFingerprint(input) {
|
|
76
|
-
const selectedPackages = [...new Set((input.selectedPackageNames ?? []).map(String))].sort();
|
|
77
|
-
const selectedPackageSet = new Set(selectedPackages);
|
|
78
|
-
const packages = workspacePackages(input.root).filter((pkg) => typeof pkg.name === "string" && pkg.name.startsWith("@treeseed/"));
|
|
79
|
-
const packageShas = sortedRecord(Object.fromEntries(
|
|
80
|
-
packages.map((pkg) => [pkg.name, safeGitHead(pkg.dir)])
|
|
81
|
-
));
|
|
82
|
-
const plannedVersions = sortedRecord(Object.fromEntries(
|
|
83
|
-
Object.entries(input.plannedVersions).filter(([name]) => name === "@treeseed/market" || selectedPackageSet.has(name)).map(([name, version]) => [name, String(version)])
|
|
84
|
-
));
|
|
85
|
-
const lockfiles = sortedRecord({
|
|
86
|
-
"@treeseed/market": fileSha256(resolve(input.root, "package-lock.json")),
|
|
87
|
-
...Object.fromEntries(packages.map((pkg) => [pkg.name, fileSha256(resolve(pkg.dir, "package-lock.json"))]))
|
|
88
|
-
});
|
|
89
|
-
const base = {
|
|
90
|
-
policyVersion: RELEASE_CANDIDATE_POLICY_VERSION,
|
|
91
|
-
rootSha: safeGitHead(input.root),
|
|
92
|
-
packageShas,
|
|
93
|
-
plannedVersions,
|
|
94
|
-
lockfiles,
|
|
95
|
-
selectedPackages
|
|
96
|
-
};
|
|
97
|
-
return {
|
|
98
|
-
...base,
|
|
99
|
-
key: sha256(JSON.stringify(base))
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function readCachedReleaseCandidateReport(root, key) {
|
|
103
|
-
const cachePath = releaseCandidateCachePath(root, key);
|
|
104
|
-
if (!existsSync(cachePath)) return null;
|
|
105
|
-
try {
|
|
106
|
-
return JSON.parse(readFileSync(cachePath, "utf8"));
|
|
107
|
-
} catch {
|
|
108
|
-
return null;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
function writeReleaseCandidateReport(root, report) {
|
|
112
|
-
ensureReleaseCandidateCacheDir(root);
|
|
113
|
-
writeFileSync(releaseCandidateCachePath(root, report.fingerprint.key), `${JSON.stringify(report, null, 2)}
|
|
114
|
-
`, "utf8");
|
|
115
|
-
return report;
|
|
116
|
-
}
|
|
117
|
-
function addFailure(failures, failure) {
|
|
118
|
-
failures.push({
|
|
119
|
-
...failure,
|
|
120
|
-
details: failure.details ?? null,
|
|
121
|
-
provider: failure.provider ?? null
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
function packageReadinessChecks(root, selectedPackageNames, failures) {
|
|
125
|
-
if (selectedPackageNames.length === 0) {
|
|
126
|
-
return { name: "package-release-readiness", status: "skipped", detail: "No packages are selected for this release." };
|
|
127
|
-
}
|
|
128
|
-
const selected = new Set(selectedPackageNames);
|
|
129
|
-
const packages = workspacePackages(root).filter((pkg) => selected.has(pkg.name));
|
|
130
|
-
for (const pkg of packages) {
|
|
131
|
-
const packageJson = safePackageJson(resolve(pkg.dir, "package.json"));
|
|
132
|
-
const scripts = packageJson?.scripts && typeof packageJson.scripts === "object" && !Array.isArray(packageJson.scripts) ? packageJson.scripts : {};
|
|
133
|
-
if (!existsSync(resolve(pkg.dir, ".github", "workflows", "publish.yml"))) {
|
|
134
|
-
addFailure(failures, {
|
|
135
|
-
code: "missing_publish_workflow",
|
|
136
|
-
scope: pkg.name,
|
|
137
|
-
provider: "github",
|
|
138
|
-
message: `${pkg.name} is missing .github/workflows/publish.yml.`
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
if (typeof scripts["release:publish"] !== "string") {
|
|
142
|
-
addFailure(failures, {
|
|
143
|
-
code: "missing_publish_script",
|
|
144
|
-
scope: pkg.name,
|
|
145
|
-
message: `${pkg.name} is missing a release:publish script.`
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
if (typeof scripts["verify:local"] !== "string" && typeof scripts["verify"] !== "string" && typeof scripts["verify:action"] !== "string") {
|
|
149
|
-
addFailure(failures, {
|
|
150
|
-
code: "missing_verify_script",
|
|
151
|
-
scope: pkg.name,
|
|
152
|
-
message: `${pkg.name} is missing a release-ready verify script.`
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
try {
|
|
156
|
-
run("npm", ["pack", "--dry-run"], { cwd: pkg.dir, capture: true, timeoutMs: 12e4 });
|
|
157
|
-
} catch (error) {
|
|
158
|
-
addFailure(failures, {
|
|
159
|
-
code: "npm_pack_dry_run_failed",
|
|
160
|
-
scope: pkg.name,
|
|
161
|
-
message: `${pkg.name} failed npm pack --dry-run.`,
|
|
162
|
-
details: { error: error instanceof Error ? error.message : String(error) }
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
name: "package-release-readiness",
|
|
168
|
-
status: failures.some((failure) => failure.code.startsWith("missing_") || failure.code === "npm_pack_dry_run_failed") ? "failed" : "passed",
|
|
169
|
-
detail: `Checked ${packages.length} selected package${packages.length === 1 ? "" : "s"}.`
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
function copyWorkspaceForProductionRehearsal(root) {
|
|
173
|
-
const tempParent = mkdtempSync(join(tmpdir(), "treeseed-release-candidate-"));
|
|
174
|
-
const tempRoot = join(tempParent, "workspace");
|
|
175
|
-
cpSync(root, tempRoot, {
|
|
176
|
-
recursive: true,
|
|
177
|
-
filter: (source) => {
|
|
178
|
-
const rel = relative(root, source);
|
|
179
|
-
if (!rel) return true;
|
|
180
|
-
const segments = rel.split(/[\\/]+/u);
|
|
181
|
-
return !segments.some((segment) => REHEARSAL_IGNORED_SEGMENTS.has(segment));
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
return { tempParent, tempRoot };
|
|
185
|
-
}
|
|
186
|
-
function applyPlannedStableMetadata(root, plannedVersions) {
|
|
187
|
-
const stableVersions = new Map(
|
|
188
|
-
Object.entries(plannedVersions).filter(([, version]) => STABLE_SEMVER.test(version))
|
|
189
|
-
);
|
|
190
|
-
const stableGitReferences = stablePackageGitReferences(root, stableVersions);
|
|
191
|
-
const targets = [
|
|
192
|
-
{ name: "@treeseed/market", dir: root },
|
|
193
|
-
...workspacePackages(root).map((pkg) => ({ name: pkg.name, dir: pkg.dir }))
|
|
194
|
-
];
|
|
195
|
-
for (const target of targets) {
|
|
196
|
-
const packageJsonPath = resolve(target.dir, "package.json");
|
|
197
|
-
const packageJson = safePackageJson(packageJsonPath);
|
|
198
|
-
if (!packageJson) continue;
|
|
199
|
-
let changed = false;
|
|
200
|
-
const plannedVersion = stableVersions.get(target.name);
|
|
201
|
-
if (plannedVersion && packageJson.version !== plannedVersion) {
|
|
202
|
-
packageJson.version = plannedVersion;
|
|
203
|
-
changed = true;
|
|
204
|
-
}
|
|
205
|
-
for (const field of ["dependencies", "optionalDependencies", "peerDependencies", "devDependencies"]) {
|
|
206
|
-
const values = packageJson[field];
|
|
207
|
-
if (!values || typeof values !== "object" || Array.isArray(values)) continue;
|
|
208
|
-
for (const [dependencyName, version] of stableVersions.entries()) {
|
|
209
|
-
if (!(dependencyName in values)) continue;
|
|
210
|
-
const dependencySpec = stableGitReferences.get(dependencyName) ?? version;
|
|
211
|
-
if (String(values[dependencyName]) === dependencySpec) continue;
|
|
212
|
-
values[dependencyName] = dependencySpec;
|
|
213
|
-
changed = true;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
if (changed) {
|
|
217
|
-
writeJsonFile(packageJsonPath, packageJson);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
function stablePackageGitReferences(root, versions) {
|
|
222
|
-
return new Map(workspacePackages(root).map((pkg) => {
|
|
223
|
-
const version = versions.get(pkg.name);
|
|
224
|
-
if (!version) return null;
|
|
225
|
-
let remote = null;
|
|
226
|
-
try {
|
|
227
|
-
remote = run("git", ["remote", "get-url", "origin"], { cwd: pkg.dir, capture: true }).trim();
|
|
228
|
-
} catch {
|
|
229
|
-
remote = null;
|
|
230
|
-
}
|
|
231
|
-
const manifestRemote = normalizeGitRemoteForManifest(remote ?? "", "preserve-origin");
|
|
232
|
-
return manifestRemote ? [pkg.name, `${manifestRemote}#${version}`] : null;
|
|
233
|
-
}).filter((entry) => Boolean(entry)));
|
|
234
|
-
}
|
|
235
|
-
function rehearsalVerifyScript(root) {
|
|
236
|
-
const scripts = packageScripts(resolve(root, "package.json"));
|
|
237
|
-
for (const scriptName of ["verify:direct", "verify:local", "verify", "build"]) {
|
|
238
|
-
if (typeof scripts[scriptName] === "string") {
|
|
239
|
-
return scriptName;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
return null;
|
|
243
|
-
}
|
|
244
|
-
function runNpmRehearsalCommand(args, options) {
|
|
245
|
-
const result = spawnSync("npm", args, {
|
|
246
|
-
cwd: options.cwd,
|
|
247
|
-
env: options.env ?? process.env,
|
|
248
|
-
stdio: "pipe",
|
|
249
|
-
encoding: "utf8",
|
|
250
|
-
timeout: options.timeoutMs
|
|
251
|
-
});
|
|
252
|
-
const stdout = result.stdout ?? "";
|
|
253
|
-
const stderr = result.stderr ?? "";
|
|
254
|
-
if (result.status !== 0) {
|
|
255
|
-
if (stdout) process.stdout.write(stdout);
|
|
256
|
-
if (stderr) process.stderr.write(stderr);
|
|
257
|
-
const message = (result.error?.message ? `${result.error.message}
|
|
258
|
-
` : "") + (stderr.trim() || stdout.trim() || `npm ${args.join(" ")} failed`);
|
|
259
|
-
throw new Error(message);
|
|
260
|
-
}
|
|
261
|
-
const warningSummary = createBuildWarningSummary();
|
|
262
|
-
const outputFailures = [];
|
|
263
|
-
const emitFiltered = (text, stream) => {
|
|
264
|
-
for (const line of text.split(/\r?\n/u)) {
|
|
265
|
-
if (!line) continue;
|
|
266
|
-
const classified = warningSummary.record(line);
|
|
267
|
-
if (classified.kind === "allowed") continue;
|
|
268
|
-
for (const failure of collectReleaseCandidateOutputFailures(line)) {
|
|
269
|
-
outputFailures.push(failure);
|
|
270
|
-
}
|
|
271
|
-
stream.write(`${line}
|
|
272
|
-
`);
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
|
-
emitFiltered(stdout, process.stdout);
|
|
276
|
-
emitFiltered(stderr, process.stderr);
|
|
277
|
-
for (const line of formatAllowedBuildWarnings(warningSummary.allowedWarnings)) {
|
|
278
|
-
process.stdout.write(`${line}
|
|
279
|
-
`);
|
|
280
|
-
}
|
|
281
|
-
if (outputFailures.length > 0) {
|
|
282
|
-
throw new Error([
|
|
283
|
-
`npm ${args.join(" ")} completed with error output despite exit code 0.`,
|
|
284
|
-
...outputFailures.slice(0, 12)
|
|
285
|
-
].join("\n"));
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
function collectReleaseCandidateOutputFailures(line) {
|
|
289
|
-
const value = String(line ?? "").trim();
|
|
290
|
-
if (!value) return [];
|
|
291
|
-
const failures = [];
|
|
292
|
-
if (/^stderr\s+\|\s+/u.test(value)) {
|
|
293
|
-
failures.push(`Captured test stderr: ${value}`);
|
|
294
|
-
}
|
|
295
|
-
if (/(^|\s)ERROR(?:\s|\[|:)/u.test(value)) {
|
|
296
|
-
failures.push(`Error output: ${value}`);
|
|
297
|
-
}
|
|
298
|
-
if (/\bFailed to run background task\b/u.test(value)) {
|
|
299
|
-
failures.push(`Background task failure output: ${value}`);
|
|
300
|
-
}
|
|
301
|
-
return failures;
|
|
302
|
-
}
|
|
303
|
-
function buildRehearsalWorkspacePackageArtifacts(root) {
|
|
304
|
-
for (const pkg of packagesWithScript("build:dist", root)) {
|
|
305
|
-
runNpmRehearsalCommand(["--prefix", pkg.dir, "run", "build:dist"], { cwd: root, timeoutMs: 3e5 });
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
function runProductionDependencyRehearsal(root, plannedVersions, selectedPackageNames, failures) {
|
|
309
|
-
if (process.env.TREESEED_RELEASE_CANDIDATE_REHEARSAL_MODE === "skip") {
|
|
310
|
-
return "Skipped clean install rehearsal by request.";
|
|
311
|
-
}
|
|
312
|
-
const selectedPackageSet = new Set(selectedPackageNames);
|
|
313
|
-
let tempParent = null;
|
|
314
|
-
try {
|
|
315
|
-
const copied = copyWorkspaceForProductionRehearsal(root);
|
|
316
|
-
tempParent = copied.tempParent;
|
|
317
|
-
applyPlannedStableMetadata(copied.tempRoot, plannedVersions);
|
|
318
|
-
runNpmRehearsalCommand(["install", "--package-lock-only", "--ignore-scripts"], { cwd: copied.tempRoot, timeoutMs: 3e5 });
|
|
319
|
-
runNpmRehearsalCommand(["ci", "--ignore-scripts"], { cwd: copied.tempRoot, timeoutMs: 6e5 });
|
|
320
|
-
buildRehearsalWorkspacePackageArtifacts(copied.tempRoot);
|
|
321
|
-
const scriptName = rehearsalVerifyScript(copied.tempRoot);
|
|
322
|
-
if (scriptName) {
|
|
323
|
-
const packageJson = safePackageJson(resolve(copied.tempRoot, "package.json"));
|
|
324
|
-
const parallelMarketVerify = packageJson?.name === "@treeseed/market" && (scriptName === "verify:direct" || scriptName === "verify:local" || scriptName === "verify");
|
|
325
|
-
runNpmRehearsalCommand(["run", scriptName], {
|
|
326
|
-
cwd: copied.tempRoot,
|
|
327
|
-
timeoutMs: 9e5,
|
|
328
|
-
env: parallelMarketVerify ? { ...process.env, TREESEED_VERIFY_PARALLEL: "1" } : process.env
|
|
329
|
-
});
|
|
330
|
-
}
|
|
331
|
-
const postInstallIssues = collectInternalDevReferenceIssues(copied.tempRoot, selectedPackageSet);
|
|
332
|
-
if (postInstallIssues.length > 0) {
|
|
333
|
-
addFailure(failures, {
|
|
334
|
-
code: "internal_dev_references_after_rehearsal",
|
|
335
|
-
scope: "@treeseed/market",
|
|
336
|
-
message: "Production dependency rehearsal still found internal dev references after clean install.",
|
|
337
|
-
details: {
|
|
338
|
-
references: postInstallIssues.map((issue) => ({
|
|
339
|
-
filePath: issue.filePath,
|
|
340
|
-
field: issue.field,
|
|
341
|
-
dependencyName: issue.dependencyName,
|
|
342
|
-
spec: issue.spec,
|
|
343
|
-
reason: issue.reason
|
|
344
|
-
}))
|
|
345
|
-
}
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
return scriptName ? `Ran clean install and npm run ${scriptName} in a temporary production rehearsal workspace.` : "Ran clean install in a temporary production rehearsal workspace.";
|
|
349
|
-
} catch (error) {
|
|
350
|
-
addFailure(failures, {
|
|
351
|
-
code: "production_dependency_rehearsal_failed",
|
|
352
|
-
scope: "@treeseed/market",
|
|
353
|
-
message: "Production dependency rehearsal failed in the temporary workspace.",
|
|
354
|
-
details: { error: error instanceof Error ? error.message : String(error) }
|
|
355
|
-
});
|
|
356
|
-
return "Production dependency rehearsal failed.";
|
|
357
|
-
} finally {
|
|
358
|
-
if (tempParent) {
|
|
359
|
-
rmSync(tempParent, { recursive: true, force: true });
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
function dependencyRehearsalChecks(root, plannedVersions, selectedPackageNames, failures) {
|
|
364
|
-
const before = failures.length;
|
|
365
|
-
for (const [name, version] of Object.entries(plannedVersions)) {
|
|
366
|
-
if ((name === "@treeseed/market" || selectedPackageNames.includes(name)) && !STABLE_SEMVER.test(version)) {
|
|
367
|
-
addFailure(failures, {
|
|
368
|
-
code: "unstable_planned_version",
|
|
369
|
-
scope: name,
|
|
370
|
-
message: `${name} planned release version is not stable semver: ${version}.`
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
const devReferenceIssues = collectInternalDevReferenceIssues(root);
|
|
375
|
-
const unrehearsableDevReferences = devReferenceIssues.filter((issue) => {
|
|
376
|
-
const dependencyName = issue.dependencyName ?? "";
|
|
377
|
-
const planned = plannedVersions[dependencyName];
|
|
378
|
-
return !planned || !STABLE_SEMVER.test(planned);
|
|
379
|
-
});
|
|
380
|
-
if (unrehearsableDevReferences.length > 0) {
|
|
381
|
-
addFailure(failures, {
|
|
382
|
-
code: "internal_dev_references",
|
|
383
|
-
scope: "@treeseed/market",
|
|
384
|
-
message: "Production dependency rehearsal found internal dev references without a stable planned replacement.",
|
|
385
|
-
details: {
|
|
386
|
-
references: unrehearsableDevReferences.map((issue) => ({
|
|
387
|
-
filePath: issue.filePath,
|
|
388
|
-
field: issue.field,
|
|
389
|
-
dependencyName: issue.dependencyName,
|
|
390
|
-
spec: issue.spec,
|
|
391
|
-
reason: issue.reason
|
|
392
|
-
}))
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
const rehearsalDetail = unrehearsableDevReferences.length === 0 && failures.length === before ? runProductionDependencyRehearsal(root, plannedVersions, selectedPackageNames, failures) : "Skipped clean install rehearsal because stable dependency metadata is incomplete.";
|
|
397
|
-
return {
|
|
398
|
-
name: "production-dependency-rehearsal",
|
|
399
|
-
status: failures.length > before ? "failed" : "passed",
|
|
400
|
-
detail: `${devReferenceIssues.length > 0 ? `Rehearsed stable replacements for ${devReferenceIssues.length} internal dev reference${devReferenceIssues.length === 1 ? "" : "s"}.` : "Checked planned stable versions and internal dependency references."} ${rehearsalDetail}`
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
function localConfigCheck(root, scope, failures) {
|
|
404
|
-
try {
|
|
405
|
-
const report = validateTreeseedCommandEnvironment({ tenantRoot: root, scope, purpose: "deploy" });
|
|
406
|
-
const problems = [...report.validation.missing, ...report.validation.invalid];
|
|
407
|
-
for (const problem of problems) {
|
|
408
|
-
addFailure(failures, {
|
|
409
|
-
code: "missing_local_config",
|
|
410
|
-
scope,
|
|
411
|
-
provider: problem.entry.group ?? "config",
|
|
412
|
-
message: `${scope} deploy config is missing or invalid: ${problem.id}.`,
|
|
413
|
-
details: { key: problem.id, provider: problem.entry.group ?? null }
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
} catch (error) {
|
|
417
|
-
addFailure(failures, {
|
|
418
|
-
code: "config_validation_failed",
|
|
419
|
-
scope,
|
|
420
|
-
provider: "config",
|
|
421
|
-
message: `${scope} deploy config could not be validated.`,
|
|
422
|
-
details: { error: error instanceof Error ? error.message : String(error) }
|
|
423
|
-
});
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
async function githubRemoteConfigCheck(root, scope, failures) {
|
|
427
|
-
const repository = maybeResolveGitHubRepositorySlug(root);
|
|
428
|
-
if (!repository) {
|
|
429
|
-
addFailure(failures, {
|
|
430
|
-
code: "missing_github_repository",
|
|
431
|
-
scope,
|
|
432
|
-
provider: "github",
|
|
433
|
-
message: `${scope} GitHub config parity could not determine the repository from origin.`
|
|
434
|
-
});
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
try {
|
|
438
|
-
const environment = scope === "prod" ? "production" : scope;
|
|
439
|
-
const expected = expectedGitHubDeployEnvironment(root, scope);
|
|
440
|
-
const client = createGitHubApiClient();
|
|
441
|
-
const [secretNames, variableNames] = await Promise.all([
|
|
442
|
-
listGitHubEnvironmentSecretNames(repository, environment, { client }),
|
|
443
|
-
listGitHubEnvironmentVariableNames(repository, environment, { client })
|
|
444
|
-
]);
|
|
445
|
-
const missingSecrets = expected.secrets.filter((key) => !secretNames.has(key));
|
|
446
|
-
const missingVariables = expected.variables.filter((key) => !variableNames.has(key));
|
|
447
|
-
for (const key of missingSecrets) {
|
|
448
|
-
addFailure(failures, {
|
|
449
|
-
code: "missing_remote_config",
|
|
450
|
-
scope,
|
|
451
|
-
provider: "github-secret",
|
|
452
|
-
message: `${scope} GitHub secret is missing: ${key}.`,
|
|
453
|
-
details: { key, provider: "github-secret", repository, environment }
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
for (const key of missingVariables) {
|
|
457
|
-
addFailure(failures, {
|
|
458
|
-
code: "missing_remote_config",
|
|
459
|
-
scope,
|
|
460
|
-
provider: "github-variable",
|
|
461
|
-
message: `${scope} GitHub variable is missing: ${key}.`,
|
|
462
|
-
details: { key, provider: "github-variable", repository, environment }
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
} catch (error) {
|
|
466
|
-
addFailure(failures, {
|
|
467
|
-
code: "remote_config_check_failed",
|
|
468
|
-
scope,
|
|
469
|
-
provider: "github",
|
|
470
|
-
message: `${scope} GitHub config parity check failed.`,
|
|
471
|
-
details: { error: error instanceof Error ? error.message : String(error) }
|
|
472
|
-
});
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
function expectedGitHubDeployEnvironment(root, scope) {
|
|
476
|
-
const registry = collectTreeseedEnvironmentContext(root);
|
|
477
|
-
const values = resolveTreeseedMachineEnvironmentValues(root, scope);
|
|
478
|
-
const expectedEntries = registry.entries.filter((entry) => {
|
|
479
|
-
if (!isTreeseedEnvironmentEntryRelevant(entry, registry.context, scope, "deploy")) return false;
|
|
480
|
-
if (isTreeseedEnvironmentEntryRequired(entry, registry.context, scope, "deploy")) return true;
|
|
481
|
-
return typeof values[entry.id] === "string" && values[entry.id].trim().length > 0;
|
|
482
|
-
});
|
|
483
|
-
return {
|
|
484
|
-
secrets: [...new Set(expectedEntries.filter((entry) => entry.targets.includes("github-secret")).map((entry) => entry.id))],
|
|
485
|
-
variables: [...new Set(expectedEntries.filter((entry) => entry.targets.includes("github-variable")).map((entry) => entry.id))]
|
|
486
|
-
};
|
|
487
|
-
}
|
|
488
|
-
function providerResourceIdentifierCheck(root, scope, failures) {
|
|
489
|
-
try {
|
|
490
|
-
const deployConfig = loadCliDeployConfig(root);
|
|
491
|
-
const state = loadDeployState(root, deployConfig, { scope });
|
|
492
|
-
const siteDataDb = state.d1Databases?.SITE_DATA_DB;
|
|
493
|
-
if (!siteDataDb?.databaseName || !siteDataDb?.databaseId) {
|
|
494
|
-
addFailure(failures, {
|
|
495
|
-
code: "missing_remote_resource_identifier",
|
|
496
|
-
scope,
|
|
497
|
-
provider: "cloudflare-d1",
|
|
498
|
-
message: `${scope} Cloudflare D1 SITE_DATA_DB is missing a database name or id.`,
|
|
499
|
-
details: { resource: "SITE_DATA_DB", required: ["databaseName", "databaseId"] }
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
const services = state.services && typeof state.services === "object" && !Array.isArray(state.services) ? state.services : {};
|
|
503
|
-
for (const [serviceKey, service] of Object.entries(services)) {
|
|
504
|
-
if ((service.provider ?? "railway") !== "railway") continue;
|
|
505
|
-
if (!service.projectName && !service.projectId) {
|
|
506
|
-
addFailure(failures, {
|
|
507
|
-
code: "missing_remote_resource_identifier",
|
|
508
|
-
scope,
|
|
509
|
-
provider: "railway",
|
|
510
|
-
message: `${scope} Railway service ${serviceKey} is missing a project name or id.`,
|
|
511
|
-
details: { service: serviceKey, required: ["projectName", "projectId"] }
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
|
-
if (!service.serviceName && !service.serviceId) {
|
|
515
|
-
addFailure(failures, {
|
|
516
|
-
code: "missing_remote_resource_identifier",
|
|
517
|
-
scope,
|
|
518
|
-
provider: "railway",
|
|
519
|
-
message: `${scope} Railway service ${serviceKey} is missing a service name or id.`,
|
|
520
|
-
details: { service: serviceKey, required: ["serviceName", "serviceId"] }
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
} catch (error) {
|
|
525
|
-
addFailure(failures, {
|
|
526
|
-
code: "provider_resource_check_failed",
|
|
527
|
-
scope,
|
|
528
|
-
provider: "deployment-state",
|
|
529
|
-
message: `${scope} provider resource identifiers could not be validated.`,
|
|
530
|
-
details: { error: error instanceof Error ? error.message : String(error) }
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
async function configParityChecks(root, failures) {
|
|
535
|
-
if (process.env.TREESEED_RELEASE_CANDIDATE_CONFIG_PARITY_MODE === "skip") {
|
|
536
|
-
return { name: "config-parity", status: "skipped", detail: "Remote config parity skipped by request." };
|
|
537
|
-
}
|
|
538
|
-
const before = failures.length;
|
|
539
|
-
localConfigCheck(root, "staging", failures);
|
|
540
|
-
localConfigCheck(root, "prod", failures);
|
|
541
|
-
await githubRemoteConfigCheck(root, "staging", failures);
|
|
542
|
-
await githubRemoteConfigCheck(root, "prod", failures);
|
|
543
|
-
providerResourceIdentifierCheck(root, "staging", failures);
|
|
544
|
-
providerResourceIdentifierCheck(root, "prod", failures);
|
|
545
|
-
return {
|
|
546
|
-
name: "config-parity",
|
|
547
|
-
status: failures.length > before ? "failed" : "passed",
|
|
548
|
-
detail: "Checked staging and production config, GitHub names, Railway service identifiers, and D1 identifiers without reading secret values."
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
function migrationCompatibilityChecks(root, failures) {
|
|
552
|
-
if (!existsSync(resolve(root, "packages/sdk/package.json"))) {
|
|
553
|
-
return {
|
|
554
|
-
name: "migration-compatibility",
|
|
555
|
-
status: "skipped",
|
|
556
|
-
detail: "No SDK package checkout is present in this workspace."
|
|
557
|
-
};
|
|
558
|
-
}
|
|
559
|
-
const requiredArtifacts = [
|
|
560
|
-
"packages/sdk/drizzle/d1/0000_treeseed_d1.sql",
|
|
561
|
-
"packages/sdk/drizzle/market/0000_market_control_plane.sql"
|
|
562
|
-
];
|
|
563
|
-
const missing = requiredArtifacts.filter((path) => !existsSync(resolve(root, path)));
|
|
564
|
-
for (const path of missing) {
|
|
565
|
-
addFailure(failures, {
|
|
566
|
-
code: "missing_drizzle_migration_artifact",
|
|
567
|
-
scope: "@treeseed/market",
|
|
568
|
-
message: `Drizzle migration compatibility check is missing ${path}.`,
|
|
569
|
-
details: { path }
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
return {
|
|
573
|
-
name: "migration-compatibility",
|
|
574
|
-
status: missing.length > 0 ? "failed" : "passed",
|
|
575
|
-
detail: "Checked required Drizzle migration artifacts for Market PostgreSQL and SDK D1."
|
|
576
|
-
};
|
|
577
|
-
}
|
|
578
|
-
async function runReleaseCandidateGate(input) {
|
|
579
|
-
const fingerprint = buildReleaseCandidateFingerprint(input);
|
|
580
|
-
if (input.allowReuse !== false) {
|
|
581
|
-
const cached = readCachedReleaseCandidateReport(input.root, fingerprint.key);
|
|
582
|
-
if (cached?.status === "passed") {
|
|
583
|
-
return {
|
|
584
|
-
...cached,
|
|
585
|
-
reused: true
|
|
586
|
-
};
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
const selectedPackageNames = [...new Set((input.selectedPackageNames ?? []).map(String))].sort();
|
|
590
|
-
const plannedVersions = Object.fromEntries(
|
|
591
|
-
Object.entries(input.plannedVersions).map(([name, version]) => [name, String(version)])
|
|
592
|
-
);
|
|
593
|
-
const failures = [];
|
|
594
|
-
const checks = [];
|
|
595
|
-
checks.push(dependencyRehearsalChecks(input.root, plannedVersions, selectedPackageNames, failures));
|
|
596
|
-
checks.push(packageReadinessChecks(input.root, selectedPackageNames, failures));
|
|
597
|
-
checks.push(await configParityChecks(input.root, failures));
|
|
598
|
-
checks.push(migrationCompatibilityChecks(input.root, failures));
|
|
599
|
-
const report = {
|
|
600
|
-
status: failures.length === 0 ? "passed" : "failed",
|
|
601
|
-
fingerprint,
|
|
602
|
-
reused: false,
|
|
603
|
-
checkedAt: nowIso(),
|
|
604
|
-
failures,
|
|
605
|
-
checks
|
|
606
|
-
};
|
|
607
|
-
writeReleaseCandidateReport(input.root, report);
|
|
608
|
-
return report;
|
|
609
|
-
}
|
|
610
|
-
export {
|
|
611
|
-
buildReleaseCandidateFingerprint,
|
|
612
|
-
collectReleaseCandidateOutputFailures,
|
|
613
|
-
readCachedReleaseCandidateReport,
|
|
614
|
-
runReleaseCandidateGate,
|
|
615
|
-
writeReleaseCandidateReport
|
|
616
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from 'node:child_process';
|
|
2
|
-
import { dockerIsAvailable, findRunningMailpitContainer } from '../operations/services/mailpit-runtime.js';
|
|
3
|
-
import { packageRoot } from '../operations/services/runtime-paths.js';
|
|
4
|
-
function mailpitConfig() {
|
|
5
|
-
return {
|
|
6
|
-
containerName: process.env.TREESEED_MAILPIT_CONTAINER_NAME?.trim() || 'treeseed_mailpit',
|
|
7
|
-
smtpPort: process.env.TREESEED_MAILPIT_SMTP_PORT?.trim() || '1025',
|
|
8
|
-
uiPort: process.env.TREESEED_MAILPIT_UI_PORT?.trim() || '8025',
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
if (!dockerIsAvailable()) {
|
|
12
|
-
console.error('Docker is required for Treeseed form email testing. Start Docker and rerun the Mailpit command.');
|
|
13
|
-
process.exit(1);
|
|
14
|
-
}
|
|
15
|
-
const existingMailpit = findRunningMailpitContainer();
|
|
16
|
-
const config = mailpitConfig();
|
|
17
|
-
if (existingMailpit) {
|
|
18
|
-
console.log(`Reusing existing Mailpit container "${existingMailpit.name}" on ports ${config.smtpPort} and ${config.uiPort}.`);
|
|
19
|
-
process.exit(0);
|
|
20
|
-
}
|
|
21
|
-
spawnSync('docker', ['rm', '-f', config.containerName], { encoding: 'utf8', cwd: packageRoot, env: { ...process.env } });
|
|
22
|
-
const result = spawnSync('docker', [
|
|
23
|
-
'run',
|
|
24
|
-
'-d',
|
|
25
|
-
'--name',
|
|
26
|
-
config.containerName,
|
|
27
|
-
'-p',
|
|
28
|
-
`127.0.0.1:${config.smtpPort}:1025`,
|
|
29
|
-
'-p',
|
|
30
|
-
`127.0.0.1:${config.uiPort}:8025`,
|
|
31
|
-
'axllent/mailpit:latest',
|
|
32
|
-
], {
|
|
33
|
-
encoding: 'utf8',
|
|
34
|
-
cwd: packageRoot,
|
|
35
|
-
env: { ...process.env },
|
|
36
|
-
});
|
|
37
|
-
if (result.status !== 0) {
|
|
38
|
-
const reusedMailpit = findRunningMailpitContainer();
|
|
39
|
-
if (reusedMailpit) {
|
|
40
|
-
console.log(`Reusing existing Mailpit container "${reusedMailpit.name}" on ports ${config.smtpPort} and ${config.uiPort}.`);
|
|
41
|
-
process.exit(0);
|
|
42
|
-
}
|
|
43
|
-
if (result.stdout)
|
|
44
|
-
process.stdout.write(result.stdout);
|
|
45
|
-
if (result.stderr)
|
|
46
|
-
process.stderr.write(result.stderr);
|
|
47
|
-
}
|
|
48
|
-
process.exit(result.status ?? 1);
|