@treeseed/sdk 0.12.62 → 0.13.0-rc.10
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/LICENSE +13 -0
- package/README.md +33 -359
- package/dist/accounts/account-contracts.d.ts +170 -0
- package/dist/accounts/account-contracts.js +33 -0
- package/dist/agent-capacity/allocation.d.ts +186 -0
- package/dist/agent-capacity/allocation.js +226 -0
- package/dist/agent-capacity/artifact-mutation-receipt.d.ts +49 -0
- package/dist/agent-capacity/artifact-mutation-receipt.js +36 -0
- package/dist/agent-capacity/artifacts.d.ts +107 -0
- package/dist/agent-capacity/artifacts.js +39 -0
- package/dist/agent-capacity/authority/agent-authority-presets.d.ts +13 -0
- package/dist/agent-capacity/authority/agent-authority-presets.js +106 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +269 -0
- package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.js +10 -0
- package/dist/agent-capacity/contracts/capacity/communication/communication-records.d.ts +101 -0
- package/dist/agent-capacity/contracts/capacity/communication/communication-records.js +9 -0
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.d.ts +36 -0
- package/dist/agent-capacity/contracts/capacity/providers/supply-policy.js +4 -0
- package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +188 -0
- package/dist/agent-capacity/contracts/configuration/configuration.d.ts +11 -0
- package/dist/agent-capacity/contracts/configuration/configuration.js +20 -0
- package/dist/agent-capacity/contracts/operations/research-workflow.d.ts +59 -0
- package/dist/agent-capacity/contracts/operations/research-workflow.js +16 -0
- package/dist/agent-capacity/contracts/operations/workflow-promotion.d.ts +24 -0
- package/dist/agent-capacity/contracts/projects/agents/project-agent-class.d.ts +37 -0
- package/dist/agent-capacity/contracts/runtime/runtime-observability.d.ts +335 -0
- package/dist/agent-capacity/contracts/support/agent-atlas.d.ts +185 -0
- package/dist/agent-capacity/contracts/support/agent-atlas.js +47 -0
- package/dist/agent-capacity/contracts/support/agent-lab-monitoring.d.ts +96 -0
- package/dist/agent-capacity/contracts/support/agent-lab-monitoring.js +14 -0
- package/dist/agent-capacity/contracts/support/authority/execution-mode.d.ts +10 -0
- package/dist/agent-capacity/contracts/support/authority/execution-mode.js +17 -0
- package/dist/agent-capacity/contracts/support/decision-work.d.ts +251 -0
- package/dist/agent-capacity/contracts/support/failure-records.d.ts +9 -0
- package/dist/agent-capacity/contracts/support/failure-records.js +0 -0
- package/dist/agent-capacity/contracts/support/financial-records.d.ts +124 -0
- package/dist/agent-capacity/contracts/support/financial-records.js +0 -0
- package/dist/agent-capacity/contracts/support/planning-records.d.ts +121 -0
- package/dist/agent-capacity/contracts/support/planning-records.js +0 -0
- package/dist/agent-capacity/contracts/support/research-citation.d.ts +15 -0
- package/dist/agent-capacity/contracts/support/research-citation.js +0 -0
- package/dist/agent-capacity/contracts/support/research-source-policy.d.ts +8 -0
- package/dist/agent-capacity/contracts/support/research-source-policy.js +0 -0
- package/dist/agent-capacity/contracts/support/time-capacity.d.ts +163 -0
- package/dist/agent-capacity/contracts/support/time-capacity.js +63 -0
- package/dist/agent-capacity/policy/capacity/allocations/allocation-hierarchy.d.ts +29 -0
- package/dist/agent-capacity/policy/capacity/allocations/allocation-hierarchy.js +110 -0
- package/dist/agent-capacity/validation/activity-profile.d.ts +12 -0
- package/dist/agent-capacity/validation/activity-profile.js +264 -0
- package/dist/agent-capacity/validation/agent-definition-schema.d.ts +9140 -0
- package/dist/agent-capacity/validation/agent-definition-schema.js +198 -0
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +234 -0
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.js +104 -0
- package/dist/agent-capacity/validation/agent-signal.d.ts +30 -0
- package/dist/agent-capacity/validation/agent-signal.js +31 -0
- package/dist/agent-capacity/validation/allocation.d.ts +12 -0
- package/dist/agent-capacity/validation/allocation.js +115 -0
- package/dist/agent-capacity/validation/assignment-records.d.ts +16 -0
- package/dist/agent-capacity/validation/assignment-records.js +92 -0
- package/dist/agent-capacity/validation/configuration.d.ts +14 -0
- package/dist/agent-capacity/validation/configuration.js +23 -0
- package/dist/agent-capacity/validation/index.d.ts +11 -0
- package/dist/agent-capacity/validation/index.js +11 -0
- package/dist/agent-capacity/validation/proposal-type.d.ts +22 -0
- package/dist/agent-capacity/validation/proposal-type.js +21 -0
- package/dist/agent-capacity/validation/research/citation.d.ts +16 -0
- package/dist/agent-capacity/validation/research/citation.js +47 -0
- package/dist/agent-capacity/validation/research/source-policy.d.ts +11 -0
- package/dist/agent-capacity/validation/research/source-policy.js +26 -0
- package/dist/agent-capacity/validation/research/workflow.d.ts +10 -0
- package/dist/agent-capacity/validation/research/workflow.js +31 -0
- package/dist/agent-capacity/validation/workflow-promotion.d.ts +2 -0
- package/dist/agent-capacity/validation/workflow-promotion.js +34 -0
- package/dist/agent-capacity/workday.d.ts +52 -0
- package/dist/agent-capacity/workday.js +105 -0
- package/dist/ai-appliance/contracts.d.ts +90 -0
- package/dist/ai-appliance/contracts.js +16 -0
- package/dist/ai-appliance/validation.d.ts +4 -0
- package/dist/ai-appliance/validation.js +62 -0
- package/dist/capacity/agents/agent-capacity.d.ts +21 -0
- package/dist/capacity/agents/agent-capacity.js +20 -0
- package/dist/capacity/capacity-core/capacity-pagination.d.ts +18 -0
- package/dist/capacity/capacity-core/capacity-pagination.js +33 -0
- package/dist/capacity/providers/capacity-provider.d.ts +1 -0
- package/dist/capacity/providers/capacity-provider.js +1 -0
- package/dist/capacity-provider/client.d.ts +56 -0
- package/dist/capacity-provider/client.js +163 -0
- package/dist/capacity-provider/contracts/capacity-facts.d.ts +64 -0
- package/dist/capacity-provider/contracts/capacity-facts.js +0 -0
- package/dist/capacity-provider/contracts/governance.d.ts +399 -0
- package/dist/capacity-provider/contracts/governance.js +18 -0
- package/dist/capacity-provider/contracts/index.d.ts +2 -0
- package/dist/capacity-provider/contracts/index.js +2 -0
- package/dist/capacity-provider/index.d.ts +3 -0
- package/dist/capacity-provider/index.js +3 -0
- package/dist/capacity-provider/validation.d.ts +27 -0
- package/dist/capacity-provider/validation.js +184 -0
- package/dist/configuration/secrets-capability.d.ts +4 -0
- package/dist/configuration/secrets-capability.js +4 -0
- package/dist/content/contracts.d.ts +12 -0
- package/dist/content/contracts.js +0 -0
- package/dist/content/validation/agent-operational-content-schemas.d.ts +1351 -0
- package/dist/content/validation/agent-operational-content-schemas.js +146 -0
- package/dist/content/validation/auxiliary-content-schemas.d.ts +1715 -0
- package/dist/content/validation/auxiliary-content-schemas.js +173 -0
- package/dist/content/validation/content-model-schemas.d.ts +21728 -0
- package/dist/content/validation/content-model-schemas.js +271 -0
- package/dist/content/validation/index.d.ts +3 -0
- package/dist/content/validation/index.js +3 -0
- package/dist/content/validation/portable-content-data.d.ts +2101 -0
- package/dist/content/validation/portable-content-data.js +49 -0
- package/dist/entrypoints/clients/control-plane-client.d.ts +112 -0
- package/dist/entrypoints/clients/control-plane-client.js +180 -0
- package/dist/entrypoints/models/field-aliases.d.ts +11 -0
- package/dist/entrypoints/models/model-registry.d.ts +3 -0
- package/dist/entrypoints/models/model-registry.js +3 -0
- package/dist/entrypoints/models/sdk-fields.d.ts +11 -0
- package/dist/entrypoints/models/sdk-types.d.ts +10 -0
- package/dist/entrypoints/models/sdk-types.js +10 -0
- package/dist/feedback/contracts.d.ts +142 -0
- package/dist/feedback/contracts.js +18 -0
- package/dist/feedback/index.d.ts +1 -0
- package/dist/feedback/index.js +1 -0
- package/dist/governance/groups/contracts.d.ts +102 -0
- package/dist/governance/groups/contracts.js +6 -0
- package/dist/graph/context-query-contracts.d.ts +19 -1
- package/dist/graph/context-query-contracts.js +49 -8
- package/dist/knowledge/contracts.d.ts +173 -0
- package/dist/knowledge/contracts.js +16 -0
- package/dist/knowledge/index.d.ts +1 -0
- package/dist/knowledge/index.js +1 -0
- package/dist/model-registry/agent-operational-models.d.ts +4 -0
- package/dist/model-registry/agent-operational-models.js +38 -0
- package/dist/model-registry/build-builtin-model-registry.d.ts +2 -0
- package/dist/model-registry/build-builtin-model-registry.js +426 -0
- package/dist/model-registry/content-root.d.ts +9 -0
- package/dist/model-registry/content-root.js +33 -0
- package/dist/model-registry/discussion-models.d.ts +4 -0
- package/dist/model-registry/discussion-models.js +84 -0
- package/dist/model-registry/group-models.d.ts +2 -0
- package/dist/model-registry/group-models.js +52 -0
- package/dist/model-registry/knowledge-models.d.ts +2 -0
- package/dist/model-registry/knowledge-models.js +89 -0
- package/dist/model-registry/normalize-definition.d.ts +8 -0
- package/dist/model-registry/normalize-definition.js +69 -0
- package/dist/operator-contracts/canonical-command-tree.d.ts +3 -0
- package/dist/operator-contracts/canonical-command-tree.js +81 -0
- package/dist/operator-contracts/command-tree.d.ts +79 -0
- package/dist/operator-contracts/command-tree.js +53 -0
- package/dist/operator-contracts/control-plane-operation.d.ts +80 -0
- package/dist/operator-contracts/control-plane-operation.js +75 -0
- package/dist/operator-contracts/control-plane-operations.d.ts +546 -0
- package/dist/operator-contracts/control-plane-operations.js +352 -0
- package/dist/operator-contracts/index.d.ts +8 -0
- package/dist/operator-contracts/index.js +8 -0
- package/dist/operator-contracts/mcp.d.ts +78 -0
- package/dist/operator-contracts/mcp.js +23 -0
- package/dist/operator-contracts/oauth.d.ts +46 -0
- package/dist/operator-contracts/oauth.js +0 -0
- package/dist/operator-contracts/workday-lifecycle.d.ts +157 -0
- package/dist/operator-contracts/workday-lifecycle.js +65 -0
- package/dist/operator-contracts/workday-profile.d.ts +72 -0
- package/dist/operator-contracts/workday-profile.js +106 -0
- package/dist/projects/projects-core/project-workflow.d.ts +179 -0
- package/dist/projects/projects-core/project-workflow.js +66 -0
- package/dist/sdk-types/configuration/sdk-dispatch-credential-source.d.ts +201 -0
- package/dist/sdk-types/configuration/sdk-dispatch-credential-source.js +0 -0
- package/dist/sdk-types/control-plane/resource-requests.d.ts +124 -0
- package/dist/sdk-types/control-plane/resource-requests.js +0 -0
- package/dist/sdk-types/governance/commons/commons-question-input.d.ts +61 -0
- package/dist/sdk-types/governance/commons/commons-question-input.js +0 -0
- package/dist/sdk-types/support/planning-policy.d.ts +210 -0
- package/dist/sdk-types/support/planning-policy.js +0 -0
- package/dist/sdk-types/support/platform-contracts.d.ts +178 -0
- package/dist/sdk-types/support/platform-contracts.js +15 -0
- package/dist/sdk-types/support/sdk-model-names.d.ts +44 -0
- package/dist/sdk-types/support/sdk-model-names.js +80 -0
- package/dist/sdk-types/support/sdk-search-request.d.ts +182 -0
- package/dist/sdk-types/support/sdk-search-request.js +0 -0
- package/dist/sdk-types/support/task-planning.d.ts +189 -0
- package/dist/sdk-types/support/task-planning.js +0 -0
- package/dist/sdk-types/treedx/graph/sdk-graph-query-request.d.ts +157 -0
- package/dist/sdk-types/treedx/graph/sdk-graph-query-request.js +0 -0
- package/dist/secrets-capability/provider-operation-contracts.d.ts +90 -0
- package/dist/secrets-capability/provider-operation-contracts.js +10 -0
- package/dist/secrets-capability/service-provider-contracts.d.ts +92 -0
- package/dist/secrets-capability/service-provider-contracts.js +183 -0
- package/dist/secrets-capability/service-vault-contracts.d.ts +61 -0
- package/dist/secrets-capability/service-vault-contracts.js +39 -0
- package/dist/secrets-capability/workflow-operation-contracts.d.ts +95 -0
- package/dist/secrets-capability/workflow-operation-contracts.js +0 -0
- package/dist/standards/canonicalize.d.ts +10 -0
- package/dist/standards/canonicalize.js +43 -0
- package/dist/standards/compatibility-attestation.d.ts +23 -0
- package/dist/standards/compatibility-attestation.js +40 -0
- package/dist/standards/composition.d.ts +15 -0
- package/dist/standards/composition.js +14 -0
- package/dist/standards/contract-bundle.d.ts +8 -0
- package/dist/standards/contract-bundle.js +23 -0
- package/dist/standards/contracts.d.ts +39 -0
- package/dist/standards/contracts.js +0 -0
- package/dist/standards/errors.d.ts +6 -0
- package/dist/standards/errors.js +13 -0
- package/dist/standards/index.d.ts +8 -0
- package/dist/standards/index.js +8 -0
- package/dist/standards/mcp/compare.d.ts +2 -0
- package/dist/standards/mcp/compare.js +38 -0
- package/dist/standards/mcp/contracts.d.ts +34 -0
- package/dist/standards/mcp/contracts.js +0 -0
- package/dist/standards/mcp/index.d.ts +3 -0
- package/dist/standards/mcp/index.js +3 -0
- package/dist/standards/mcp/normalize.d.ts +4 -0
- package/dist/standards/mcp/normalize.js +30 -0
- package/dist/standards/openapi/compare.d.ts +2 -0
- package/dist/standards/openapi/compare.js +112 -0
- package/dist/standards/openapi/contracts.d.ts +24 -0
- package/dist/standards/openapi/contracts.js +0 -0
- package/dist/standards/openapi/index.d.ts +3 -0
- package/dist/standards/openapi/index.js +3 -0
- package/dist/standards/openapi/normalize.d.ts +2 -0
- package/dist/standards/openapi/normalize.js +57 -0
- package/dist/standards/package-manifest.d.ts +37 -0
- package/dist/standards/package-manifest.js +89 -0
- package/dist/standards/portfolio-entry.d.ts +12 -0
- package/dist/standards/portfolio-entry.js +11 -0
- package/dist/standards/typescript/compare.d.ts +2 -0
- package/dist/standards/typescript/compare.js +88 -0
- package/dist/standards/typescript/contracts.d.ts +44 -0
- package/dist/standards/typescript/contracts.js +0 -0
- package/dist/standards/typescript/extract.d.ts +10 -0
- package/dist/standards/typescript/extract.js +244 -0
- package/dist/standards/typescript/index.d.ts +3 -0
- package/dist/standards/typescript/index.js +3 -0
- package/dist/treedx/accounts/auth.d.ts +17 -0
- package/dist/treedx/accounts/auth.js +48 -0
- package/dist/treedx/client/accounts/contracts/auth-mode.d.ts +3 -0
- package/dist/treedx/client/accounts/contracts/auth-mode.js +6 -0
- package/dist/treedx/client/build/creation/build-context.d.ts +3 -0
- package/dist/treedx/client/build/creation/build-context.js +7 -0
- package/dist/treedx/client/build/creation/build-snapshot.d.ts +3 -0
- package/dist/treedx/client/build/creation/build-snapshot.js +8 -0
- package/dist/treedx/client/capacity/allocations/contracts/put-capability-grant.d.ts +3 -0
- package/dist/treedx/client/capacity/allocations/contracts/put-capability-grant.js +7 -0
- package/dist/treedx/client/capacity/allocations/queries/list-capability-grants.d.ts +6 -0
- package/dist/treedx/client/capacity/allocations/queries/list-capability-grants.js +10 -0
- package/dist/treedx/client/methods.d.ts +102 -0
- package/dist/treedx/client/methods.js +209 -0
- package/dist/treedx/client/persistence/contracts/restore-storage.d.ts +3 -0
- package/dist/treedx/client/persistence/contracts/restore-storage.js +6 -0
- package/dist/treedx/client/persistence/lifecycle/verify-storage-restore.d.ts +3 -0
- package/dist/treedx/client/persistence/lifecycle/verify-storage-restore.js +6 -0
- package/dist/treedx/client/repositories/creation/register-repository.d.ts +3 -0
- package/dist/treedx/client/repositories/creation/register-repository.js +7 -0
- package/dist/treedx/client/repositories/queries/get-repository.d.ts +3 -0
- package/dist/treedx/client/repositories/queries/get-repository.js +7 -0
- package/dist/treedx/client/repositories/queries/list-repository-paths.d.ts +3 -0
- package/dist/treedx/client/repositories/queries/list-repository-paths.js +7 -0
- package/dist/treedx/client/repositories/queries/list-repository-refs.d.ts +3 -0
- package/dist/treedx/client/repositories/queries/list-repository-refs.js +12 -0
- package/dist/treedx/client/repositories/queries/query-repository.d.ts +3 -0
- package/dist/treedx/client/repositories/queries/query-repository.js +7 -0
- package/dist/treedx/client/repositories/queries/read-repository-file.d.ts +3 -0
- package/dist/treedx/client/repositories/queries/read-repository-file.js +6 -0
- package/dist/treedx/client/repositories/queries/read-repository-files.d.ts +3 -0
- package/dist/treedx/client/repositories/queries/read-repository-files.js +7 -0
- package/dist/treedx/client/repositories/queries/search-repository-files.d.ts +3 -0
- package/dist/treedx/client/repositories/queries/search-repository-files.js +7 -0
- package/dist/treedx/client/support/contracts/treedx/artifacts/contracts/download-artifact.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/artifacts/contracts/download-artifact.js +9 -0
- package/dist/treedx/client/support/contracts/treedx/authorization/contracts/whoami.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/authorization/contracts/whoami.js +6 -0
- package/dist/treedx/client/support/contracts/treedx/graph/contracts/parse-context-dsl.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/graph/contracts/parse-context-dsl.js +7 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/deep-health.d.ts +5 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/deep-health.js +7 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/health.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/health.js +6 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/metrics.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/metrics.js +7 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/prometheus-metrics.d.ts +2 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/prometheus-metrics.js +19 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/ready.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/ready.js +7 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/status.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/health/contracts/status.js +6 -0
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/commit.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/commit.js +7 -0
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/diff.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/diff.js +6 -0
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/fetch-remote.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/fetch-remote.js +7 -0
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/push.d.ts +6 -0
- package/dist/treedx/client/support/contracts/treedx/repositories/contracts/push.js +23 -0
- package/dist/treedx/client/support/contracts/treedx/search/contracts/compact-search-index.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/search/contracts/compact-search-index.js +8 -0
- package/dist/treedx/client/support/contracts/treedx/search/contracts/search.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/search/contracts/search.js +7 -0
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/backup-storage.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/backup-storage.js +8 -0
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/compact-storage.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/storage/contracts/compact-storage.js +8 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/assert-binary-ok.d.ts +2 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/assert-binary-ok.js +15 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/fetch-with-timeout.d.ts +2 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/fetch-with-timeout.js +38 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/headers.d.ts +2 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/headers.js +15 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/parse-json-response.d.ts +2 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/parse-json-response.js +15 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/query.d.ts +2 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/query.js +14 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/repo-id.d.ts +2 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/repo-id.js +14 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/request.d.ts +6 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/request.js +41 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/throw-api-error.d.ts +2 -0
- package/dist/treedx/client/support/contracts/treedx/transport/contracts/throw-api-error.js +14 -0
- package/dist/treedx/client/support/contracts/treedx/workspaces/contracts/exec.d.ts +3 -0
- package/dist/treedx/client/support/contracts/treedx/workspaces/contracts/exec.js +7 -0
- package/dist/treedx/client/support/creation/apply-changeset.d.ts +3 -0
- package/dist/treedx/client/support/creation/apply-changeset.js +10 -0
- package/dist/treedx/client/support/creation/apply-storage-migration.d.ts +3 -0
- package/dist/treedx/client/support/creation/apply-storage-migration.js +7 -0
- package/dist/treedx/client/support/creation/create-migration.d.ts +6 -0
- package/dist/treedx/client/support/creation/create-migration.js +7 -0
- package/dist/treedx/client/support/creation/export-artifact.d.ts +3 -0
- package/dist/treedx/client/support/creation/export-artifact.js +8 -0
- package/dist/treedx/client/support/creation/plan-storage-migration.d.ts +3 -0
- package/dist/treedx/client/support/creation/plan-storage-migration.js +7 -0
- package/dist/treedx/client/support/creation/request-binary.d.ts +6 -0
- package/dist/treedx/client/support/creation/request-binary.js +42 -0
- package/dist/treedx/client/support/creation/write-file.d.ts +3 -0
- package/dist/treedx/client/support/creation/write-file.js +10 -0
- package/dist/treedx/client/support/creation/write-files.d.ts +3 -0
- package/dist/treedx/client/support/creation/write-files.js +12 -0
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/get-artifact.d.ts +3 -0
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/get-artifact.js +7 -0
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/list-artifacts.d.ts +3 -0
- package/dist/treedx/client/support/queries/treedx/artifacts/queries/list-artifacts.js +7 -0
- package/dist/treedx/client/support/queries/treedx/authorization/queries/effective-scope.d.ts +3 -0
- package/dist/treedx/client/support/queries/treedx/authorization/queries/effective-scope.js +9 -0
- package/dist/treedx/client/support/queries/treedx/authorization/queries/list-capabilities.d.ts +4 -0
- package/dist/treedx/client/support/queries/treedx/authorization/queries/list-capabilities.js +6 -0
- package/dist/treedx/client/support/queries/treedx/federation/queries/get-placement.d.ts +3 -0
- package/dist/treedx/client/support/queries/treedx/federation/queries/get-placement.js +7 -0
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-node.d.ts +3 -0
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-node.js +7 -0
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-related.d.ts +3 -0
- package/dist/treedx/client/support/queries/treedx/graph/queries/get-related.js +7 -0
- package/dist/treedx/client/support/queries/treedx/graph/queries/list-nodes.d.ts +3 -0
- package/dist/treedx/client/support/queries/treedx/graph/queries/list-nodes.js +7 -0
- package/dist/treedx/client/support/queries/treedx/repositories/queries/list-tree.d.ts +3 -0
- package/dist/treedx/client/support/queries/treedx/repositories/queries/list-tree.js +10 -0
- package/dist/treedx/client/support/queries/treedx/repositories/queries/read-file.d.ts +3 -0
- package/dist/treedx/client/support/queries/treedx/repositories/queries/read-file.js +9 -0
- package/dist/treedx/client/support/queries/treedx/search/queries/get-search-index-status.d.ts +3 -0
- package/dist/treedx/client/support/queries/treedx/search/queries/get-search-index-status.js +7 -0
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-migration.d.ts +6 -0
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-migration.js +7 -0
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-snapshot.d.ts +6 -0
- package/dist/treedx/client/support/queries/treedx/storage/queries/get-snapshot.js +7 -0
- package/dist/treedx/client/support/queries/treedx/storage/queries/list-storage-migrations.d.ts +6 -0
- package/dist/treedx/client/support/queries/treedx/storage/queries/list-storage-migrations.js +6 -0
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-audit-events.d.ts +15 -0
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-audit-events.js +6 -0
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-repositories.d.ts +3 -0
- package/dist/treedx/client/support/queries/treedx/transport/queries/list-repositories.js +7 -0
- package/dist/treedx/client/support/retirement/cleanup-artifacts.d.ts +3 -0
- package/dist/treedx/client/support/retirement/cleanup-artifacts.js +7 -0
- package/dist/treedx/client/support/retirement/delete-artifact.d.ts +3 -0
- package/dist/treedx/client/support/retirement/delete-artifact.js +7 -0
- package/dist/treedx/client/support/retirement/delete-file.d.ts +3 -0
- package/dist/treedx/client/support/retirement/delete-file.js +10 -0
- package/dist/treedx/client/support/retirement/rollback-storage-migration.d.ts +3 -0
- package/dist/treedx/client/support/retirement/rollback-storage-migration.js +7 -0
- package/dist/treedx/client/support/updates/patch-file.d.ts +3 -0
- package/dist/treedx/client/support/updates/patch-file.js +10 -0
- package/dist/treedx/client/support/updates/refresh-search-index.d.ts +3 -0
- package/dist/treedx/client/support/updates/refresh-search-index.js +8 -0
- package/dist/treedx/client/treedx/blobs/contracts/download-blob.d.ts +3 -0
- package/dist/treedx/client/treedx/blobs/contracts/download-blob.js +6 -0
- package/dist/treedx/client/treedx/blobs/creation/create-blob-upload.d.ts +3 -0
- package/dist/treedx/client/treedx/blobs/creation/create-blob-upload.js +8 -0
- package/dist/treedx/client/treedx/blobs/creation/request-blob-download.d.ts +3 -0
- package/dist/treedx/client/treedx/blobs/creation/request-blob-download.js +27 -0
- package/dist/treedx/client/treedx/blobs/creation/request-blob-upload.d.ts +3 -0
- package/dist/treedx/client/treedx/blobs/creation/request-blob-upload.js +41 -0
- package/dist/treedx/client/treedx/blobs/creation/upload-blob-part.d.ts +3 -0
- package/dist/treedx/client/treedx/blobs/creation/upload-blob-part.js +27 -0
- package/dist/treedx/client/treedx/blobs/creation/upload-blob.d.ts +3 -0
- package/dist/treedx/client/treedx/blobs/creation/upload-blob.js +6 -0
- package/dist/treedx/client/treedx/blobs/creation/write-blob.d.ts +3 -0
- package/dist/treedx/client/treedx/blobs/creation/write-blob.js +8 -0
- package/dist/treedx/client/treedx/blobs/lifecycle/complete-blob-upload.d.ts +3 -0
- package/dist/treedx/client/treedx/blobs/lifecycle/complete-blob-upload.js +8 -0
- package/dist/treedx/client/treedx/blobs/queries/read-blob.d.ts +3 -0
- package/dist/treedx/client/treedx/blobs/queries/read-blob.js +10 -0
- package/dist/treedx/client/treedx/blobs/retirement/abort-blob-upload.d.ts +3 -0
- package/dist/treedx/client/treedx/blobs/retirement/abort-blob-upload.js +7 -0
- package/dist/treedx/client/treedx/blobs/retirement/delete-blob.d.ts +3 -0
- package/dist/treedx/client/treedx/blobs/retirement/delete-blob.js +8 -0
- package/dist/treedx/client/treedx/federation/contracts/federated-query.d.ts +3 -0
- package/dist/treedx/client/treedx/federation/contracts/federated-query.js +7 -0
- package/dist/treedx/client/treedx/federation/creation/plan-federated-query.d.ts +3 -0
- package/dist/treedx/client/treedx/federation/creation/plan-federated-query.js +6 -0
- package/dist/treedx/client/treedx/federation/queries/check-mirror-health.d.ts +3 -0
- package/dist/treedx/client/treedx/federation/queries/check-mirror-health.js +7 -0
- package/dist/treedx/client/treedx/federation/updates/promote-mirror.d.ts +3 -0
- package/dist/treedx/client/treedx/federation/updates/promote-mirror.js +7 -0
- package/dist/treedx/client/treedx/federation/updates/sync-mirror.d.ts +3 -0
- package/dist/treedx/client/treedx/federation/updates/sync-mirror.js +7 -0
- package/dist/treedx/client/treedx/graph/contracts/federated-context.d.ts +3 -0
- package/dist/treedx/client/treedx/graph/contracts/federated-context.js +7 -0
- package/dist/treedx/client/treedx/graph/contracts/federated-graph.d.ts +3 -0
- package/dist/treedx/client/treedx/graph/contracts/federated-graph.js +7 -0
- package/dist/treedx/client/treedx/graph/contracts/graph-search.d.ts +3 -0
- package/dist/treedx/client/treedx/graph/contracts/graph-search.js +8 -0
- package/dist/treedx/client/treedx/graph/queries/get-graph-node.d.ts +3 -0
- package/dist/treedx/client/treedx/graph/queries/get-graph-node.js +10 -0
- package/dist/treedx/client/treedx/graph/queries/get-graph-refresh-job.d.ts +3 -0
- package/dist/treedx/client/treedx/graph/queries/get-graph-refresh-job.js +7 -0
- package/dist/treedx/client/treedx/graph/queries/get-subgraph.d.ts +3 -0
- package/dist/treedx/client/treedx/graph/queries/get-subgraph.js +7 -0
- package/dist/treedx/client/treedx/graph/queries/query-graph.d.ts +3 -0
- package/dist/treedx/client/treedx/graph/queries/query-graph.js +7 -0
- package/dist/treedx/client/treedx/graph/queries/search-graph-entities.d.ts +3 -0
- package/dist/treedx/client/treedx/graph/queries/search-graph-entities.js +6 -0
- package/dist/treedx/client/treedx/graph/queries/search-graph-files.d.ts +3 -0
- package/dist/treedx/client/treedx/graph/queries/search-graph-files.js +6 -0
- package/dist/treedx/client/treedx/graph/queries/search-graph-sections.d.ts +3 -0
- package/dist/treedx/client/treedx/graph/queries/search-graph-sections.js +6 -0
- package/dist/treedx/client/treedx/graph/updates/refresh-graph.d.ts +3 -0
- package/dist/treedx/client/treedx/graph/updates/refresh-graph.js +7 -0
- package/dist/treedx/client/treedx/search/contracts/federated-search.d.ts +3 -0
- package/dist/treedx/client/treedx/search/contracts/federated-search.js +7 -0
- package/dist/treedx/client/treedx/workspaces/creation/create-workspace.d.ts +3 -0
- package/dist/treedx/client/treedx/workspaces/creation/create-workspace.js +7 -0
- package/dist/treedx/client/treedx/workspaces/retirement/abandon-workspace.d.ts +3 -0
- package/dist/treedx/client/treedx/workspaces/retirement/abandon-workspace.js +12 -0
- package/dist/treedx/client/treedx/workspaces/retirement/close-workspace.d.ts +2 -0
- package/dist/treedx/client/treedx/workspaces/retirement/close-workspace.js +6 -0
- package/dist/treedx/generated/openapi-types.d.ts +104 -0
- package/dist/treedx/support/client.d.ts +251 -0
- package/dist/treedx/support/client.js +252 -0
- package/dist/treedx/support/errors.d.ts +13 -0
- package/dist/treedx/types/tree-dx-actor.d.ts +209 -0
- package/dist/treedx/types/tree-dx-actor.js +8 -0
- package/dist/treedx/types/tree-dx-artifact-list-response.d.ts +13 -0
- package/dist/treedx/types/tree-dx-artifact-list-response.js +0 -0
- package/dist/treedx/types/tree-dx-changeset.d.ts +51 -0
- package/dist/treedx/types/tree-dx-changeset.js +6 -0
- package/dist/treedx/types/tree-dx-context-request.d.ts +245 -0
- package/dist/treedx/types/tree-dx-context-request.js +0 -0
- package/dist/treedx/types/tree-dx-exec-result.d.ts +249 -0
- package/dist/treedx/types/tree-dx-exec-result.js +0 -0
- package/dist/treedx/types/tree-dx-list-tree-request.d.ts +222 -0
- package/dist/treedx/types/tree-dx-list-tree-request.js +0 -0
- package/dist/treedx/types/tree-dx-push-request.d.ts +229 -0
- package/dist/treedx/types/tree-dx-push-request.js +0 -0
- package/dist/treedx/types.d.ts +7 -1084
- package/dist/treedx/types.js +7 -8
- package/dist/types/agents/agent-activity-profile.d.ts +267 -0
- package/dist/types/agents/agent-activity-profile.js +0 -0
- package/dist/types/agents/agent-trigger-kinds.d.ts +189 -0
- package/dist/types/agents/agent-trigger-kinds.js +107 -0
- package/dist/types/agents/execution-run-ref.d.ts +136 -0
- package/dist/types/agents/execution-run-ref.js +0 -0
- package/dist/types/agents.d.ts +3 -493
- package/dist/types/agents.js +3 -95
- package/package.json +77 -362
- package/dist/agent-capacity.d.ts +0 -1100
- package/dist/agent-capacity.js +0 -1822
- package/dist/agent-tools.d.ts +0 -37
- package/dist/agent-tools.js +0 -301
- package/dist/api/app.d.ts +0 -8
- package/dist/api/app.js +0 -404
- package/dist/api/auth/d1-database.d.ts +0 -3
- package/dist/api/auth/d1-database.js +0 -20
- package/dist/api/auth/d1-provider.d.ts +0 -85
- package/dist/api/auth/d1-provider.js +0 -95
- package/dist/api/auth/d1-store.d.ts +0 -121
- package/dist/api/auth/d1-store.js +0 -990
- package/dist/api/auth/memory-provider.d.ts +0 -82
- package/dist/api/auth/memory-provider.js +0 -297
- package/dist/api/auth/rbac.d.ts +0 -22
- package/dist/api/auth/rbac.js +0 -162
- package/dist/api/auth/tokens.d.ts +0 -18
- package/dist/api/auth/tokens.js +0 -56
- package/dist/api/config.d.ts +0 -4
- package/dist/api/config.js +0 -149
- package/dist/api/http.d.ts +0 -28
- package/dist/api/http.js +0 -51
- package/dist/api/index.d.ts +0 -10
- package/dist/api/index.js +0 -29
- package/dist/api/operations-routes.d.ts +0 -11
- package/dist/api/operations-routes.js +0 -39
- package/dist/api/operations.d.ts +0 -3
- package/dist/api/operations.js +0 -26
- package/dist/api/providers.d.ts +0 -2
- package/dist/api/providers.js +0 -85
- package/dist/api/railway.d.ts +0 -53
- package/dist/api/railway.js +0 -71
- package/dist/api/sdk-dispatch.d.ts +0 -6
- package/dist/api/sdk-dispatch.js +0 -14
- package/dist/api/sdk-routes.d.ts +0 -11
- package/dist/api/sdk-routes.js +0 -29
- package/dist/api/templates.d.ts +0 -3
- package/dist/api/templates.js +0 -31
- package/dist/api/types.d.ts +0 -238
- package/dist/capacity-provider.d.ts +0 -494
- package/dist/capacity-provider.js +0 -727
- package/dist/capacity.d.ts +0 -483
- package/dist/capacity.js +0 -2331
- package/dist/cli-tools.d.ts +0 -3
- package/dist/cli-tools.js +0 -46
- package/dist/content-operations.d.ts +0 -97
- package/dist/content-operations.js +0 -250
- package/dist/content-store.d.ts +0 -25
- package/dist/content-store.js +0 -269
- package/dist/control-plane-client.d.ts +0 -203
- package/dist/control-plane-client.js +0 -540
- package/dist/control-plane.d.ts +0 -101
- package/dist/control-plane.js +0 -201
- package/dist/copilot.d.ts +0 -18
- package/dist/copilot.js +0 -90
- package/dist/d1-http.d.ts +0 -38
- package/dist/d1-http.js +0 -95
- package/dist/d1-store.d.ts +0 -336
- package/dist/d1-store.js +0 -1431
- package/dist/db/d1.d.ts +0 -246
- package/dist/db/d1.js +0 -8
- package/dist/db/index.d.ts +0 -3
- package/dist/db/index.js +0 -3
- package/dist/db/market-schema.d.ts +0 -83651
- package/dist/db/market-schema.js +0 -3725
- package/dist/db/node-sqlite.d.ts +0 -297
- package/dist/db/node-sqlite.js +0 -133
- package/dist/db/schema.d.ts +0 -483
- package/dist/db/schema.js +0 -29
- package/dist/dispatch.d.ts +0 -4
- package/dist/dispatch.js +0 -174
- package/dist/field-aliases.d.ts +0 -11
- package/dist/fixture-support.d.ts +0 -24
- package/dist/fixture-support.js +0 -385
- package/dist/frontmatter.d.ts +0 -6
- package/dist/frontmatter.js +0 -33
- package/dist/git-runtime.d.ts +0 -16
- package/dist/git-runtime.js +0 -69
- package/dist/governance.d.ts +0 -133
- package/dist/governance.js +0 -285
- package/dist/graph/build.d.ts +0 -19
- package/dist/graph/build.js +0 -949
- package/dist/graph/dsl.d.ts +0 -2
- package/dist/graph/dsl.js +0 -243
- package/dist/graph/query.d.ts +0 -47
- package/dist/graph/query.js +0 -447
- package/dist/graph/ranking.d.ts +0 -3
- package/dist/graph/ranking.js +0 -483
- package/dist/graph/schema.d.ts +0 -142
- package/dist/graph/schema.js +0 -137
- package/dist/graph.d.ts +0 -52
- package/dist/graph.js +0 -133
- package/dist/guarantees/index.d.ts +0 -512
- package/dist/guarantees/index.js +0 -1782
- package/dist/hosting/apps.d.ts +0 -12
- package/dist/hosting/apps.js +0 -107
- package/dist/hosting/builtins.d.ts +0 -25
- package/dist/hosting/builtins.js +0 -685
- package/dist/hosting/contracts.d.ts +0 -190
- package/dist/hosting/graph.d.ts +0 -110
- package/dist/hosting/graph.js +0 -993
- package/dist/hosting/index.d.ts +0 -4
- package/dist/hosting/index.js +0 -4
- package/dist/index.d.ts +0 -88
- package/dist/index.js +0 -757
- package/dist/local-dev/managed-dev.d.ts +0 -85
- package/dist/local-dev/managed-dev.js +0 -431
- package/dist/managed-dependencies.d.ts +0 -91
- package/dist/managed-dependencies.js +0 -1186
- package/dist/market-client.d.ts +0 -831
- package/dist/market-client.js +0 -1219
- package/dist/model-registry.d.ts +0 -8
- package/dist/model-registry.js +0 -674
- package/dist/operations/agent-tools.d.ts +0 -105
- package/dist/operations/agent-tools.js +0 -171
- package/dist/operations/providers/default.d.ts +0 -10
- package/dist/operations/providers/default.js +0 -1245
- package/dist/operations/repository-operations.d.ts +0 -158
- package/dist/operations/repository-operations.js +0 -851
- package/dist/operations/runtime.d.ts +0 -7
- package/dist/operations/runtime.js +0 -61
- package/dist/operations/services/bootstrap-runner.d.ts +0 -39
- package/dist/operations/services/bootstrap-runner.js +0 -191
- package/dist/operations/services/build-warning-policy.d.ts +0 -34
- package/dist/operations/services/build-warning-policy.js +0 -91
- package/dist/operations/services/commit-message-provider.d.ts +0 -65
- package/dist/operations/services/commit-message-provider.js +0 -496
- package/dist/operations/services/config-runtime.d.ts +0 -558
- package/dist/operations/services/config-runtime.js +0 -3494
- package/dist/operations/services/d1-migration.d.ts +0 -6
- package/dist/operations/services/d1-migration.js +0 -120
- package/dist/operations/services/deploy.d.ts +0 -645
- package/dist/operations/services/deploy.js +0 -3826
- package/dist/operations/services/deployment-readiness.d.ts +0 -30
- package/dist/operations/services/deployment-readiness.js +0 -217
- package/dist/operations/services/export-runtime.d.ts +0 -18
- package/dist/operations/services/export-runtime.js +0 -140
- package/dist/operations/services/git-remote-policy.d.ts +0 -9
- package/dist/operations/services/git-remote-policy.js +0 -63
- package/dist/operations/services/git-runner.d.ts +0 -68
- package/dist/operations/services/git-runner.js +0 -500
- package/dist/operations/services/git-workflow.d.ts +0 -255
- package/dist/operations/services/git-workflow.js +0 -845
- package/dist/operations/services/github-actions-verification.d.ts +0 -148
- package/dist/operations/services/github-actions-verification.js +0 -589
- package/dist/operations/services/github-api.d.ts +0 -279
- package/dist/operations/services/github-api.js +0 -936
- package/dist/operations/services/github-automation.d.ts +0 -230
- package/dist/operations/services/github-automation.js +0 -520
- package/dist/operations/services/github-credentials.d.ts +0 -13
- package/dist/operations/services/github-credentials.js +0 -59
- package/dist/operations/services/hosted-service-checks.d.ts +0 -82
- package/dist/operations/services/hosted-service-checks.js +0 -527
- package/dist/operations/services/hosting-audit.d.ts +0 -69
- package/dist/operations/services/hosting-audit.js +0 -638
- package/dist/operations/services/hub-launch.d.ts +0 -182
- package/dist/operations/services/hub-launch.js +0 -309
- package/dist/operations/services/hub-provider-launch.d.ts +0 -160
- package/dist/operations/services/hub-provider-launch.js +0 -1056
- package/dist/operations/services/key-agent.d.ts +0 -137
- package/dist/operations/services/key-agent.js +0 -641
- package/dist/operations/services/live-hosted-service-checks.d.ts +0 -30
- package/dist/operations/services/live-hosted-service-checks.js +0 -611
- package/dist/operations/services/local-cleanup.d.ts +0 -30
- package/dist/operations/services/local-cleanup.js +0 -77
- package/dist/operations/services/local-dev.d.ts +0 -8
- package/dist/operations/services/local-dev.js +0 -97
- package/dist/operations/services/managed-host-security.d.ts +0 -13
- package/dist/operations/services/managed-host-security.js +0 -56
- package/dist/operations/services/managed-repositories.d.ts +0 -37
- package/dist/operations/services/managed-repositories.js +0 -177
- package/dist/operations/services/market-packaging.d.ts +0 -59
- package/dist/operations/services/market-packaging.js +0 -234
- package/dist/operations/services/operations-runner-smoke.d.ts +0 -31
- package/dist/operations/services/operations-runner-smoke.js +0 -212
- package/dist/operations/services/package-adapters.d.ts +0 -184
- package/dist/operations/services/package-adapters.js +0 -912
- package/dist/operations/services/package-artifacts.d.ts +0 -37
- package/dist/operations/services/package-artifacts.js +0 -99
- package/dist/operations/services/package-reference-policy.d.ts +0 -64
- package/dist/operations/services/package-reference-policy.js +0 -364
- package/dist/operations/services/project-host-operations.d.ts +0 -153
- package/dist/operations/services/project-host-operations.js +0 -365
- package/dist/operations/services/project-platform.d.ts +0 -727
- package/dist/operations/services/project-platform.js +0 -1603
- package/dist/operations/services/project-web-monitor.d.ts +0 -15
- package/dist/operations/services/project-web-monitor.js +0 -377
- package/dist/operations/services/railway-api.d.ts +0 -494
- package/dist/operations/services/railway-api.js +0 -1874
- package/dist/operations/services/railway-cli.d.ts +0 -47
- package/dist/operations/services/railway-cli.js +0 -142
- package/dist/operations/services/railway-deploy.d.ts +0 -161
- package/dist/operations/services/railway-deploy.js +0 -1808
- package/dist/operations/services/railway-source-policy.d.ts +0 -25
- package/dist/operations/services/railway-source-policy.js +0 -111
- package/dist/operations/services/release-history.d.ts +0 -59
- package/dist/operations/services/release-history.js +0 -158
- package/dist/operations/services/release-proof-ledger.d.ts +0 -13
- package/dist/operations/services/release-proof-ledger.js +0 -81
- package/dist/operations/services/release-proof-planner.d.ts +0 -48
- package/dist/operations/services/release-proof-planner.js +0 -195
- package/dist/operations/services/release-proof-runner.d.ts +0 -16
- package/dist/operations/services/release-proof-runner.js +0 -169
- package/dist/operations/services/release-proof.d.ts +0 -81
- package/dist/operations/services/release-proof.js +0 -79
- package/dist/operations/services/repository-save-orchestrator.d.ts +0 -193
- package/dist/operations/services/repository-save-orchestrator.js +0 -2110
- package/dist/operations/services/runtime-paths.d.ts +0 -19
- package/dist/operations/services/runtime-paths.js +0 -54
- package/dist/operations/services/runtime-tools.d.ts +0 -35
- package/dist/operations/services/runtime-tools.js +0 -212
- package/dist/operations/services/save-deploy-preflight.d.ts +0 -32
- package/dist/operations/services/save-deploy-preflight.js +0 -82
- package/dist/operations/services/template-host-bindings.d.ts +0 -68
- package/dist/operations/services/template-host-bindings.js +0 -401
- package/dist/operations/services/template-registry.d.ts +0 -110
- package/dist/operations/services/template-registry.js +0 -595
- package/dist/operations/services/template-secret-sync.d.ts +0 -97
- package/dist/operations/services/template-secret-sync.js +0 -292
- package/dist/operations/services/verification-cache.d.ts +0 -25
- package/dist/operations/services/verification-cache.js +0 -71
- package/dist/operations/services/watch-dev.d.ts +0 -21
- package/dist/operations/services/watch-dev.js +0 -282
- package/dist/operations/services/workflow-timing.d.ts +0 -25
- package/dist/operations/services/workflow-timing.js +0 -79
- package/dist/operations/services/workspace-dependency-mode.d.ts +0 -74
- package/dist/operations/services/workspace-dependency-mode.js +0 -478
- package/dist/operations/services/workspace-preflight.d.ts +0 -40
- package/dist/operations/services/workspace-preflight.js +0 -172
- package/dist/operations/services/workspace-save-script.d.ts +0 -26
- package/dist/operations/services/workspace-save-script.js +0 -50
- package/dist/operations/services/workspace-save.d.ts +0 -76
- package/dist/operations/services/workspace-save.js +0 -453
- package/dist/operations/services/workspace-tools.d.ts +0 -17
- package/dist/operations/services/workspace-tools.js +0 -320
- package/dist/operations-registry.d.ts +0 -5
- package/dist/operations-registry.js +0 -98
- package/dist/operations-types.d.ts +0 -75
- package/dist/operations-types.js +0 -17
- package/dist/operations.d.ts +0 -17
- package/dist/operations.js +0 -114
- package/dist/platform/book-export.d.ts +0 -78
- package/dist/platform/book-export.js +0 -451
- package/dist/platform/books-data.d.ts +0 -28
- package/dist/platform/books-data.js +0 -111
- package/dist/platform/config.d.ts +0 -27
- package/dist/platform/config.js +0 -100
- package/dist/platform/content-runtime-source.d.ts +0 -54
- package/dist/platform/content-runtime-source.js +0 -169
- package/dist/platform/contracts.d.ts +0 -361
- package/dist/platform/deploy-config.d.ts +0 -17
- package/dist/platform/deploy-config.js +0 -731
- package/dist/platform/deploy-runtime.d.ts +0 -22
- package/dist/platform/deploy-runtime.js +0 -93
- package/dist/platform/desired-state.d.ts +0 -66
- package/dist/platform/desired-state.js +0 -1071
- package/dist/platform/env.yaml +0 -1126
- package/dist/platform/environment.d.ts +0 -159
- package/dist/platform/environment.js +0 -778
- package/dist/platform/local-content-materialization.d.ts +0 -9
- package/dist/platform/local-content-materialization.js +0 -212
- package/dist/platform/plugin.d.ts +0 -103
- package/dist/platform/plugin.js +0 -6
- package/dist/platform/plugins/constants.d.ts +0 -26
- package/dist/platform/plugins/constants.js +0 -33
- package/dist/platform/plugins/runtime.d.ts +0 -41
- package/dist/platform/plugins/runtime.js +0 -257
- package/dist/platform/plugins.d.ts +0 -6
- package/dist/platform/plugins.js +0 -42
- package/dist/platform/published-content-pipeline.d.ts +0 -84
- package/dist/platform/published-content-pipeline.js +0 -547
- package/dist/platform/published-content.d.ts +0 -224
- package/dist/platform/published-content.js +0 -611
- package/dist/platform/site-config-schema.d.ts +0 -1
- package/dist/platform/site-config-schema.js +0 -4
- package/dist/platform/tenant/runtime-config.d.ts +0 -154
- package/dist/platform/tenant/runtime-config.js +0 -69
- package/dist/platform/tenant-config.d.ts +0 -8
- package/dist/platform/tenant-config.js +0 -207
- package/dist/platform/utils/site-config-schema.d.ts +0 -154
- package/dist/platform/utils/site-config-schema.js +0 -450
- package/dist/platform-operation-store.d.ts +0 -94
- package/dist/platform-operation-store.js +0 -531
- package/dist/platform-operations.d.ts +0 -273
- package/dist/platform-operations.js +0 -440
- package/dist/plugin-default.d.ts +0 -28
- package/dist/plugin-default.js +0 -55
- package/dist/project-import.d.ts +0 -91
- package/dist/project-import.js +0 -257
- package/dist/project-workflow.d.ts +0 -233
- package/dist/project-workflow.js +0 -82
- package/dist/reconcile/bootstrap-systems.d.ts +0 -32
- package/dist/reconcile/bootstrap-systems.js +0 -175
- package/dist/reconcile/builtin-adapters.d.ts +0 -9
- package/dist/reconcile/builtin-adapters.js +0 -5545
- package/dist/reconcile/contracts.d.ts +0 -172
- package/dist/reconcile/desired-state.d.ts +0 -10
- package/dist/reconcile/desired-state.js +0 -322
- package/dist/reconcile/engine.d.ts +0 -118
- package/dist/reconcile/engine.js +0 -645
- package/dist/reconcile/errors.d.ts +0 -5
- package/dist/reconcile/errors.js +0 -13
- package/dist/reconcile/index.d.ts +0 -10
- package/dist/reconcile/index.js +0 -10
- package/dist/reconcile/live-acceptance.d.ts +0 -100
- package/dist/reconcile/live-acceptance.js +0 -2018
- package/dist/reconcile/platform.d.ts +0 -104
- package/dist/reconcile/platform.js +0 -100
- package/dist/reconcile/providers/docker-private.d.ts +0 -54
- package/dist/reconcile/providers/docker-private.js +0 -101
- package/dist/reconcile/providers/github-private.d.ts +0 -69
- package/dist/reconcile/providers/github-private.js +0 -145
- package/dist/reconcile/providers/local-private.d.ts +0 -28
- package/dist/reconcile/providers/local-private.js +0 -75
- package/dist/reconcile/providers/railway-iac.d.ts +0 -220
- package/dist/reconcile/providers/railway-iac.js +0 -621
- package/dist/reconcile/providers/release-private.d.ts +0 -89
- package/dist/reconcile/providers/release-private.js +0 -140
- package/dist/reconcile/registry.d.ts +0 -7
- package/dist/reconcile/registry.js +0 -79
- package/dist/reconcile/state.d.ts +0 -7
- package/dist/reconcile/state.js +0 -270
- package/dist/reconcile/units.d.ts +0 -6
- package/dist/reconcile/units.js +0 -72
- package/dist/remote.d.ts +0 -244
- package/dist/remote.js +0 -284
- package/dist/scenes/artifacts.d.ts +0 -16
- package/dist/scenes/artifacts.js +0 -61
- package/dist/scenes/auth.d.ts +0 -2
- package/dist/scenes/auth.js +0 -28
- package/dist/scenes/base-url.d.ts +0 -12
- package/dist/scenes/base-url.js +0 -123
- package/dist/scenes/builtin-plugins.d.ts +0 -2
- package/dist/scenes/builtin-plugins.js +0 -499
- package/dist/scenes/checkpoints.d.ts +0 -14
- package/dist/scenes/checkpoints.js +0 -33
- package/dist/scenes/device-matrix.d.ts +0 -2
- package/dist/scenes/device-matrix.js +0 -100
- package/dist/scenes/devices.d.ts +0 -11
- package/dist/scenes/devices.js +0 -40
- package/dist/scenes/diagnostics.d.ts +0 -5
- package/dist/scenes/diagnostics.js +0 -22
- package/dist/scenes/diagram-providers.d.ts +0 -2
- package/dist/scenes/diagram-providers.js +0 -181
- package/dist/scenes/diagram-validation.d.ts +0 -22
- package/dist/scenes/diagram-validation.js +0 -74
- package/dist/scenes/environment.d.ts +0 -2
- package/dist/scenes/environment.js +0 -65
- package/dist/scenes/evidence-bundle.d.ts +0 -5
- package/dist/scenes/evidence-bundle.js +0 -42
- package/dist/scenes/evidence-report.d.ts +0 -10
- package/dist/scenes/evidence-report.js +0 -73
- package/dist/scenes/evidence.d.ts +0 -16
- package/dist/scenes/evidence.js +0 -277
- package/dist/scenes/index.d.ts +0 -48
- package/dist/scenes/index.js +0 -312
- package/dist/scenes/inspect.d.ts +0 -9
- package/dist/scenes/inspect.js +0 -64
- package/dist/scenes/loader.d.ts +0 -3
- package/dist/scenes/loader.js +0 -38
- package/dist/scenes/logs.d.ts +0 -2
- package/dist/scenes/logs.js +0 -47
- package/dist/scenes/operations.d.ts +0 -3
- package/dist/scenes/operations.js +0 -128
- package/dist/scenes/phase0.d.ts +0 -9
- package/dist/scenes/phase0.js +0 -637
- package/dist/scenes/planner.d.ts +0 -12
- package/dist/scenes/planner.js +0 -166
- package/dist/scenes/playwright-adapter.d.ts +0 -2
- package/dist/scenes/playwright-adapter.js +0 -63
- package/dist/scenes/plugins.d.ts +0 -5
- package/dist/scenes/plugins.js +0 -115
- package/dist/scenes/progress.d.ts +0 -17
- package/dist/scenes/progress.js +0 -24
- package/dist/scenes/publish-destinations.d.ts +0 -12
- package/dist/scenes/publish-destinations.js +0 -99
- package/dist/scenes/publish-plan-report.d.ts +0 -10
- package/dist/scenes/publish-plan-report.js +0 -70
- package/dist/scenes/publish-plan.d.ts +0 -15
- package/dist/scenes/publish-plan.js +0 -248
- package/dist/scenes/publish-redaction.d.ts +0 -16
- package/dist/scenes/publish-redaction.js +0 -148
- package/dist/scenes/publish-release-record.d.ts +0 -13
- package/dist/scenes/publish-release-record.js +0 -34
- package/dist/scenes/publish-report.d.ts +0 -10
- package/dist/scenes/publish-report.js +0 -67
- package/dist/scenes/publish.d.ts +0 -16
- package/dist/scenes/publish.js +0 -298
- package/dist/scenes/registry.d.ts +0 -12
- package/dist/scenes/registry.js +0 -65
- package/dist/scenes/remotion-adapter.d.ts +0 -3
- package/dist/scenes/remotion-adapter.js +0 -94
- package/dist/scenes/remotion-composition-registry.d.ts +0 -2
- package/dist/scenes/remotion-composition-registry.js +0 -12
- package/dist/scenes/remotion-compositions.d.ts +0 -15
- package/dist/scenes/remotion-compositions.js +0 -464
- package/dist/scenes/remotion-diagrams.d.ts +0 -9
- package/dist/scenes/remotion-diagrams.js +0 -188
- package/dist/scenes/remotion-input.d.ts +0 -13
- package/dist/scenes/remotion-input.js +0 -291
- package/dist/scenes/remotion-visuals.d.ts +0 -29
- package/dist/scenes/remotion-visuals.js +0 -198
- package/dist/scenes/render-media-assets.d.ts +0 -9
- package/dist/scenes/render-media-assets.js +0 -117
- package/dist/scenes/render-report.d.ts +0 -10
- package/dist/scenes/render-report.js +0 -27
- package/dist/scenes/render.d.ts +0 -2
- package/dist/scenes/render.js +0 -218
- package/dist/scenes/reporter.d.ts +0 -3
- package/dist/scenes/reporter.js +0 -101
- package/dist/scenes/resume.d.ts +0 -2
- package/dist/scenes/resume.js +0 -79
- package/dist/scenes/runner.d.ts +0 -2
- package/dist/scenes/runner.js +0 -687
- package/dist/scenes/schema.d.ts +0 -6
- package/dist/scenes/schema.js +0 -1023
- package/dist/scenes/seed.d.ts +0 -2
- package/dist/scenes/seed.js +0 -83
- package/dist/scenes/segments.d.ts +0 -15
- package/dist/scenes/segments.js +0 -79
- package/dist/scenes/selectors.d.ts +0 -3
- package/dist/scenes/selectors.js +0 -21
- package/dist/scenes/timeline.d.ts +0 -11
- package/dist/scenes/timeline.js +0 -26
- package/dist/scenes/timeouts.d.ts +0 -6
- package/dist/scenes/timeouts.js +0 -17
- package/dist/scenes/training-captions.d.ts +0 -14
- package/dist/scenes/training-captions.js +0 -98
- package/dist/scenes/training-report.d.ts +0 -10
- package/dist/scenes/training-report.js +0 -78
- package/dist/scenes/training-transcript.d.ts +0 -24
- package/dist/scenes/training-transcript.js +0 -204
- package/dist/scenes/training.d.ts +0 -10
- package/dist/scenes/training.js +0 -134
- package/dist/scenes/types.d.ts +0 -1900
- package/dist/scenes/types.js +0 -8
- package/dist/scenes/visual-audit-contact-sheets.d.ts +0 -6
- package/dist/scenes/visual-audit-contact-sheets.js +0 -119
- package/dist/scenes/visual-audit-fixtures.d.ts +0 -25
- package/dist/scenes/visual-audit-fixtures.js +0 -247
- package/dist/scenes/visual-audit-report.d.ts +0 -11
- package/dist/scenes/visual-audit-report.js +0 -85
- package/dist/scenes/visual-audit-review.d.ts +0 -23
- package/dist/scenes/visual-audit-review.js +0 -829
- package/dist/scenes/visual-audit-routes.d.ts +0 -13
- package/dist/scenes/visual-audit-routes.js +0 -308
- package/dist/scenes/visual-audit.d.ts +0 -3
- package/dist/scenes/visual-audit.js +0 -596
- package/dist/scripts/aggregate-book.js +0 -16
- package/dist/scripts/assert-release-tag-version.js +0 -23
- package/dist/scripts/build-dist.js +0 -294
- package/dist/scripts/build-tenant-worker.js +0 -36
- package/dist/scripts/check-build-warnings.js +0 -51
- package/dist/scripts/cleanup-markdown.js +0 -377
- package/dist/scripts/cli-test-fixtures.js +0 -44
- package/dist/scripts/config-treeseed.js +0 -131
- package/dist/scripts/deployment-readiness.js +0 -20
- package/dist/scripts/generate-treedx-openapi-types.js +0 -186
- package/dist/scripts/install-managed-dependencies.js +0 -12
- package/dist/scripts/key-agent.js +0 -165
- package/dist/scripts/local-dev.js +0 -129
- package/dist/scripts/migrate-journey-csv-to-guarantees.js +0 -140
- package/dist/scripts/operations-runner-smoke.js +0 -16
- package/dist/scripts/package-tools.js +0 -85
- package/dist/scripts/patch-starlight-content-path.js +0 -173
- package/dist/scripts/prepare.js +0 -10
- package/dist/scripts/publish-package.js +0 -29
- package/dist/scripts/release-verify.js +0 -105
- package/dist/scripts/run-fixture-astro-command.js +0 -18
- package/dist/scripts/scaffold-site.js +0 -66
- package/dist/scripts/sync-template.js +0 -20
- package/dist/scripts/template-catalog.test.js +0 -86
- package/dist/scripts/template-command.js +0 -31
- package/dist/scripts/tenant-astro-command.js +0 -3
- package/dist/scripts/tenant-build.js +0 -48
- package/dist/scripts/tenant-check.js +0 -10
- package/dist/scripts/tenant-d1-migrate-local.js +0 -15
- package/dist/scripts/tenant-deploy.js +0 -220
- package/dist/scripts/tenant-destroy.js +0 -112
- package/dist/scripts/tenant-dev.js +0 -160
- package/dist/scripts/tenant-lint.js +0 -4
- package/dist/scripts/tenant-test.js +0 -4
- package/dist/scripts/tenant-workflow-action.js +0 -101
- package/dist/scripts/test-cloudflare-local.js +0 -209
- package/dist/scripts/test-scaffold.js +0 -300
- package/dist/scripts/test-smoke.js +0 -137
- package/dist/scripts/treeseed-assert-release-tag-version.js +0 -21
- package/dist/scripts/treeseed-build-dist.js +0 -131
- package/dist/scripts/treeseed-publish-package.js +0 -19
- package/dist/scripts/treeseed-release-verify.js +0 -131
- package/dist/scripts/validate-templates.js +0 -6
- package/dist/scripts/verify-driver.js +0 -45
- package/dist/scripts/workflow-commands.test.js +0 -31
- package/dist/scripts/workspace-command-e2e.js +0 -718
- package/dist/scripts/workspace-lint.js +0 -15
- package/dist/scripts/workspace-preflight.js +0 -22
- package/dist/scripts/workspace-publish-changed-packages.js +0 -16
- package/dist/scripts/workspace-release-test.js +0 -104
- package/dist/scripts/workspace-release-verify.js +0 -81
- package/dist/scripts/workspace-save.js +0 -64
- package/dist/scripts/workspace-start-warning.js +0 -3
- package/dist/scripts/workspace-test-unit.js +0 -4
- package/dist/scripts/workspace-test.js +0 -17
- package/dist/sdk-dispatch.d.ts +0 -12
- package/dist/sdk-dispatch.js +0 -126
- package/dist/sdk-fields.d.ts +0 -11
- package/dist/sdk-filters.d.ts +0 -4
- package/dist/sdk-filters.js +0 -74
- package/dist/sdk-types.d.ts +0 -3868
- package/dist/sdk-types.js +0 -542
- package/dist/sdk-version.d.ts +0 -2
- package/dist/sdk-version.js +0 -42
- package/dist/sdk.d.ts +0 -266
- package/dist/sdk.js +0 -825
- package/dist/secrets-capability.d.ts +0 -421
- package/dist/secrets-capability.js +0 -530
- package/dist/seeds/errors.d.ts +0 -5
- package/dist/seeds/errors.js +0 -22
- package/dist/seeds/index.d.ts +0 -20
- package/dist/seeds/index.js +0 -53
- package/dist/seeds/loader.d.ts +0 -8
- package/dist/seeds/loader.js +0 -32
- package/dist/seeds/normalize.d.ts +0 -13
- package/dist/seeds/normalize.js +0 -282
- package/dist/seeds/planner.d.ts +0 -10
- package/dist/seeds/planner.js +0 -149
- package/dist/seeds/schema.d.ts +0 -2
- package/dist/seeds/schema.js +0 -893
- package/dist/seeds/types.d.ts +0 -312
- package/dist/seeds/types.js +0 -12
- package/dist/service-credentials.d.ts +0 -54
- package/dist/service-credentials.js +0 -112
- package/dist/stores/cursor-store.d.ts +0 -10
- package/dist/stores/cursor-store.js +0 -164
- package/dist/stores/envelopes.d.ts +0 -116
- package/dist/stores/envelopes.js +0 -219
- package/dist/stores/helpers.d.ts +0 -12
- package/dist/stores/helpers.js +0 -42
- package/dist/stores/lease-store.d.ts +0 -18
- package/dist/stores/lease-store.js +0 -189
- package/dist/stores/message-store.d.ts +0 -12
- package/dist/stores/message-store.js +0 -273
- package/dist/stores/operational-store.d.ts +0 -55
- package/dist/stores/operational-store.js +0 -861
- package/dist/stores/project-workflow-store.d.ts +0 -56
- package/dist/stores/project-workflow-store.js +0 -482
- package/dist/stores/run-store.d.ts +0 -9
- package/dist/stores/run-store.js +0 -75
- package/dist/stores/subscription-store.d.ts +0 -8
- package/dist/stores/subscription-store.js +0 -73
- package/dist/template-catalog.d.ts +0 -13
- package/dist/template-catalog.js +0 -151
- package/dist/template-launch-requirements.d.ts +0 -118
- package/dist/template-launch-requirements.js +0 -768
- package/dist/template-launch-ui.d.ts +0 -85
- package/dist/template-launch-ui.js +0 -189
- package/dist/timing.d.ts +0 -20
- package/dist/timing.js +0 -73
- package/dist/treedx/adapters.d.ts +0 -6
- package/dist/treedx/adapters.js +0 -36
- package/dist/treedx/client.d.ts +0 -222
- package/dist/treedx/client.js +0 -871
- package/dist/treedx/errors.d.ts +0 -13
- package/dist/treedx/federated-client.d.ts +0 -27
- package/dist/treedx/federated-client.js +0 -158
- package/dist/treedx/graph-adapter.d.ts +0 -33
- package/dist/treedx/graph-adapter.js +0 -156
- package/dist/treedx/index.d.ts +0 -14
- package/dist/treedx/index.js +0 -48
- package/dist/treedx/market-integration.d.ts +0 -27
- package/dist/treedx/market-integration.js +0 -131
- package/dist/treedx/ports.d.ts +0 -166
- package/dist/treedx/ports.js +0 -231
- package/dist/treedx/query-adapter.d.ts +0 -19
- package/dist/treedx/query-adapter.js +0 -62
- package/dist/treedx/registry-client.d.ts +0 -11
- package/dist/treedx/registry-client.js +0 -19
- package/dist/treedx/repository-adapter.d.ts +0 -45
- package/dist/treedx/repository-adapter.js +0 -319
- package/dist/treedx/sdk-integration.d.ts +0 -27
- package/dist/treedx/sdk-integration.js +0 -63
- package/dist/treedx/workspace-adapter.d.ts +0 -27
- package/dist/treedx/workspace-adapter.js +0 -65
- package/dist/treedx-backends.d.ts +0 -220
- package/dist/treedx-backends.js +0 -634
- package/dist/treedx-client.d.ts +0 -89
- package/dist/treedx-client.js +0 -184
- package/dist/treeseed/services/compose.yml +0 -6
- package/dist/treeseed/template-catalog/catalog.fixture.json +0 -707
- package/dist/types/cloudflare.d.ts +0 -54
- package/dist/verification.d.ts +0 -31
- package/dist/verification.js +0 -430
- package/dist/workflow/operations.d.ts +0 -1516
- package/dist/workflow/operations.js +0 -7001
- package/dist/workflow/policy.d.ts +0 -12
- package/dist/workflow/policy.js +0 -70
- package/dist/workflow/runs.d.ts +0 -143
- package/dist/workflow/runs.js +0 -720
- package/dist/workflow/session.d.ts +0 -34
- package/dist/workflow/session.js +0 -160
- package/dist/workflow/worktrees.d.ts +0 -43
- package/dist/workflow/worktrees.js +0 -307
- package/dist/workflow-state.d.ts +0 -250
- package/dist/workflow-state.js +0 -844
- package/dist/workflow-support.d.ts +0 -28
- package/dist/workflow-support.js +0 -390
- package/dist/workflow.d.ts +0 -327
- package/dist/workflow.js +0 -140
- package/drizzle/d1/0000_treeseed_d1.sql +0 -19
- package/drizzle/market/0000_market_control_plane.sql +0 -3223
- package/drizzle/market/0001_capacity_budget_mode_default.sql +0 -4
- package/drizzle/market/0002_user_email_addresses.sql +0 -26
- package/drizzle/market/0003_project_team_slug_unique.sql +0 -4
- package/drizzle/market/0004_treedx_market_integration.sql +0 -99
- package/drizzle/market/0005_agent_capacity_coordination.sql +0 -145
- package/drizzle/market/0006_provider_assignment_lifecycle.sql +0 -9
- package/drizzle/market/0007_agent_architecture_gap_closure.sql +0 -157
- package/drizzle/market/0008_agent_capacity_operational_closure.sql +0 -27
- package/drizzle/market/0009_agent_capacity_runtime_hardening.sql +0 -29
- package/drizzle/market/0010_secrets_capability_persistence.sql +0 -130
- package/drizzle/market/0011_github_app_adapter.sql +0 -47
- package/drizzle/market/0012_workday_test_runs.sql +0 -44
- package/drizzle/market/0013_runtime_task_lifecycle.sql +0 -39
- package/drizzle/market/0014_governance_pipeline.sql +0 -189
- package/drizzle/market/0015_agent_decision_assignment_graphs.sql +0 -60
- package/scripts/verify-driver.ts +0 -51
- package/templates/github/deploy-web.workflow.yml +0 -168
- package/templates/github/hosted-project.workflow.yml +0 -76
- /package/dist/{api/types.js → agent-capacity/contracts/capacity/workdays/workday-records.js} +0 -0
- /package/dist/{hosting/contracts.js → agent-capacity/contracts/operations/workflow-promotion.js} +0 -0
- /package/dist/{platform/contracts.js → agent-capacity/contracts/projects/agents/project-agent-class.js} +0 -0
- /package/dist/{reconcile/contracts.js → agent-capacity/contracts/runtime/runtime-observability.js} +0 -0
- /package/dist/{types/cloudflare.js → agent-capacity/contracts/support/decision-work.js} +0 -0
- /package/dist/{field-aliases.js → entrypoints/models/field-aliases.js} +0 -0
- /package/dist/{sdk-fields.js → entrypoints/models/sdk-fields.js} +0 -0
- /package/dist/{runtime.d.ts → runtime/runtime.d.ts} +0 -0
- /package/dist/{runtime.js → runtime/runtime.js} +0 -0
- /package/dist/treedx/{errors.js → support/errors.js} +0 -0
|
@@ -1,2110 +0,0 @@
|
|
|
1
|
-
import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
-
import { basename, resolve, relative } from "node:path";
|
|
3
|
-
import { spawn, spawnSync } from "node:child_process";
|
|
4
|
-
import { tmpdir } from "node:os";
|
|
5
|
-
import { classifyTreeseedGitMode, runTreeseedGitText } from "./git-runner.js";
|
|
6
|
-
import {
|
|
7
|
-
ensureSshPushUrlForOrigin,
|
|
8
|
-
remoteWriteUrl,
|
|
9
|
-
sshPushUrlForRemote
|
|
10
|
-
} from "./git-remote-policy.js";
|
|
11
|
-
import {
|
|
12
|
-
generateRepositoryCommitMessage
|
|
13
|
-
} from "./commit-message-provider.js";
|
|
14
|
-
import {
|
|
15
|
-
createPackageDependencyReference,
|
|
16
|
-
normalizeGitRemoteForDependency,
|
|
17
|
-
updateInternalDependencySpecs
|
|
18
|
-
} from "./package-reference-policy.js";
|
|
19
|
-
import {
|
|
20
|
-
PRODUCTION_BRANCH,
|
|
21
|
-
branchExists,
|
|
22
|
-
headCommit,
|
|
23
|
-
remoteBranchExists,
|
|
24
|
-
STAGING_BRANCH
|
|
25
|
-
} from "./git-workflow.js";
|
|
26
|
-
import {
|
|
27
|
-
collectMergeConflictReport,
|
|
28
|
-
currentBranch,
|
|
29
|
-
formatMergeConflictReport,
|
|
30
|
-
hasMeaningfulChanges,
|
|
31
|
-
incrementVersion,
|
|
32
|
-
originRemoteUrl,
|
|
33
|
-
repoRoot
|
|
34
|
-
} from "./workspace-save.js";
|
|
35
|
-
import {
|
|
36
|
-
hasCompleteTreeseedPackageCheckout,
|
|
37
|
-
sortWorkspacePackages,
|
|
38
|
-
workspacePackages
|
|
39
|
-
} from "./workspace-tools.js";
|
|
40
|
-
import { collectDeploymentLockfileWorkspaceIssues, ensureLocalWorkspaceLinks } from "./workspace-dependency-mode.js";
|
|
41
|
-
import {
|
|
42
|
-
createBuildWarningSummary,
|
|
43
|
-
formatAllowedBuildWarnings
|
|
44
|
-
} from "./build-warning-policy.js";
|
|
45
|
-
import {
|
|
46
|
-
readTreeseedVerificationCache,
|
|
47
|
-
writeTreeseedVerificationCache
|
|
48
|
-
} from "./verification-cache.js";
|
|
49
|
-
import {
|
|
50
|
-
discoverTreeseedPackageAdapters
|
|
51
|
-
} from "./package-adapters.js";
|
|
52
|
-
import {
|
|
53
|
-
discoverTreeseedManagedRepositories,
|
|
54
|
-
parseGitmodulesPaths,
|
|
55
|
-
readTreeseedTemplateRepositoryManifest
|
|
56
|
-
} from "./managed-repositories.js";
|
|
57
|
-
function runGit(args, options) {
|
|
58
|
-
return runTreeseedGitText(args, {
|
|
59
|
-
cwd: options.cwd,
|
|
60
|
-
mode: classifyTreeseedGitMode(args),
|
|
61
|
-
timeoutMs: options.timeoutMs,
|
|
62
|
-
maxBuffer: options.maxBuffer
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
function sleepMs(durationMs) {
|
|
66
|
-
return new Promise((resolvePromise) => {
|
|
67
|
-
setTimeout(resolvePromise, durationMs);
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
class RepositorySaveError extends Error {
|
|
71
|
-
exitCode;
|
|
72
|
-
details;
|
|
73
|
-
constructor(message, options = {}) {
|
|
74
|
-
super(message);
|
|
75
|
-
this.name = "RepositorySaveError";
|
|
76
|
-
this.exitCode = options.exitCode;
|
|
77
|
-
this.details = options.details;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function readJson(filePath) {
|
|
81
|
-
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
82
|
-
}
|
|
83
|
-
function writeJson(filePath, value) {
|
|
84
|
-
writeFileSync(filePath, `${JSON.stringify(value, null, 2)}
|
|
85
|
-
`, "utf8");
|
|
86
|
-
}
|
|
87
|
-
function progressPrefix(node, phase) {
|
|
88
|
-
return `[${node.name}][${phase}]`;
|
|
89
|
-
}
|
|
90
|
-
function emitProgress(options, node, phase, message, stream = "stdout") {
|
|
91
|
-
const lines = String(message ?? "").split(/\r?\n/u).map((line) => line.trimEnd()).filter(Boolean);
|
|
92
|
-
for (const line of lines) {
|
|
93
|
-
options.onProgress?.(`${progressPrefix(node, phase)} ${line}`, stream);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
function prefixedOutput(node, phase, output) {
|
|
97
|
-
return String(output ?? "").split(/\r?\n/u).map((line) => line.trimEnd()).filter(Boolean).map((line) => `${progressPrefix(node, phase)} ${line}`).join("\n");
|
|
98
|
-
}
|
|
99
|
-
function withShortProcessTempEnv(env = {}) {
|
|
100
|
-
const merged = { ...process.env, ...env };
|
|
101
|
-
if (process.platform === "win32") {
|
|
102
|
-
return merged;
|
|
103
|
-
}
|
|
104
|
-
const shortTemp = tmpdir();
|
|
105
|
-
const tempKeys = ["TMPDIR", "TMP", "TEMP"];
|
|
106
|
-
for (const key of tempKeys) {
|
|
107
|
-
const value = merged[key];
|
|
108
|
-
if (value && value.length > shortTemp.length) {
|
|
109
|
-
merged[key] = shortTemp;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return merged;
|
|
113
|
-
}
|
|
114
|
-
function npmCacheForCwd(cwd) {
|
|
115
|
-
const cacheDir = resolve(cwd, ".treeseed", "cache", "npm");
|
|
116
|
-
mkdirSync(cacheDir, { recursive: true });
|
|
117
|
-
return cacheDir;
|
|
118
|
-
}
|
|
119
|
-
function npmWorkflowEnv(env = {}, cwd = process.cwd()) {
|
|
120
|
-
const npmCache = env.npm_config_cache ?? env.NPM_CONFIG_CACHE ?? npmCacheForCwd(cwd);
|
|
121
|
-
return withShortProcessTempEnv({
|
|
122
|
-
...env,
|
|
123
|
-
NPM_CONFIG_CACHE: npmCache,
|
|
124
|
-
npm_config_audit: env.npm_config_audit ?? process.env.npm_config_audit ?? "false",
|
|
125
|
-
npm_config_cache: npmCache,
|
|
126
|
-
npm_config_fetch_retries: env.npm_config_fetch_retries ?? process.env.npm_config_fetch_retries ?? "2",
|
|
127
|
-
npm_config_fund: env.npm_config_fund ?? process.env.npm_config_fund ?? "false",
|
|
128
|
-
npm_config_foreground_scripts: env.npm_config_foreground_scripts ?? process.env.npm_config_foreground_scripts ?? "true",
|
|
129
|
-
npm_config_loglevel: env.npm_config_loglevel ?? process.env.npm_config_loglevel ?? "warn",
|
|
130
|
-
npm_config_maxsockets: env.npm_config_maxsockets ?? process.env.npm_config_maxsockets ?? "4",
|
|
131
|
-
npm_config_prefer_offline: env.npm_config_prefer_offline ?? process.env.npm_config_prefer_offline ?? "true",
|
|
132
|
-
npm_config_progress: env.npm_config_progress ?? process.env.npm_config_progress ?? "false"
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
function npmCommandForSpawn(args) {
|
|
136
|
-
if (process.platform === "win32") {
|
|
137
|
-
return { command: "npm", args };
|
|
138
|
-
}
|
|
139
|
-
return {
|
|
140
|
-
command: "bash",
|
|
141
|
-
args: [
|
|
142
|
-
"-lc",
|
|
143
|
-
'ulimit -n 65535 2>/dev/null || ulimit -n 32768 2>/dev/null || ulimit -n 16384 2>/dev/null || true; exec npm "$@"',
|
|
144
|
-
"npm-fd-guard",
|
|
145
|
-
...args
|
|
146
|
-
]
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
function displayCommand(command, args) {
|
|
150
|
-
return command === "npm" ? `npm ${args.join(" ")}` : `${command} ${args.join(" ")}`;
|
|
151
|
-
}
|
|
152
|
-
function runCapturedCommand(node, options, phase, command, args, commandOptions = {}) {
|
|
153
|
-
const cwd = commandOptions.cwd ?? node.path;
|
|
154
|
-
const spawnCommand = command === "npm" ? npmCommandForSpawn(args) : { command, args };
|
|
155
|
-
emitProgress(options, node, phase, `$ ${displayCommand(command, args)}`);
|
|
156
|
-
const result = spawnSync(spawnCommand.command, spawnCommand.args, {
|
|
157
|
-
cwd,
|
|
158
|
-
env: command === "npm" ? npmWorkflowEnv(commandOptions.env, cwd) : withShortProcessTempEnv(commandOptions.env),
|
|
159
|
-
stdio: "pipe",
|
|
160
|
-
encoding: "utf8",
|
|
161
|
-
timeout: commandOptions.timeoutMs
|
|
162
|
-
});
|
|
163
|
-
const stdout = result.stdout?.trim() ?? "";
|
|
164
|
-
const stderr = result.stderr?.trim() ?? "";
|
|
165
|
-
if (commandOptions.emitOutputOnSuccess !== false) {
|
|
166
|
-
if (stdout) emitProgress(options, node, phase, stdout);
|
|
167
|
-
if (stderr) emitProgress(options, node, phase, stderr, "stderr");
|
|
168
|
-
}
|
|
169
|
-
if (result.status !== 0) {
|
|
170
|
-
const message = (result.error?.message ? `${result.error.message}
|
|
171
|
-
` : "") + (prefixedOutput(node, phase, stderr) || prefixedOutput(node, phase, stdout) || `${progressPrefix(node, phase)} ${displayCommand(command, args)} failed`);
|
|
172
|
-
throw new RepositorySaveError(message, {
|
|
173
|
-
details: {
|
|
174
|
-
failingRepo: node.name,
|
|
175
|
-
phase,
|
|
176
|
-
command: displayCommand(command, args)
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
return stdout;
|
|
181
|
-
}
|
|
182
|
-
function npmLockfilePackageCount(repoDir) {
|
|
183
|
-
try {
|
|
184
|
-
const lockfile = readJson(resolve(repoDir, "package-lock.json"));
|
|
185
|
-
const packages = lockfile.packages;
|
|
186
|
-
if (packages && typeof packages === "object" && !Array.isArray(packages)) {
|
|
187
|
-
return Math.max(0, Object.keys(packages).filter((entry) => entry !== "").length);
|
|
188
|
-
}
|
|
189
|
-
const dependencies = lockfile.dependencies;
|
|
190
|
-
if (dependencies && typeof dependencies === "object" && !Array.isArray(dependencies)) {
|
|
191
|
-
return Object.keys(dependencies).length;
|
|
192
|
-
}
|
|
193
|
-
} catch {
|
|
194
|
-
}
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
function isNoOpGitCommitError(error) {
|
|
198
|
-
if (!(error instanceof RepositorySaveError)) return false;
|
|
199
|
-
const command = typeof error.details?.command === "string" ? error.details.command : "";
|
|
200
|
-
if (!command.startsWith("git commit ")) return false;
|
|
201
|
-
return /nothing to commit|no changes added to commit/u.test(error.message);
|
|
202
|
-
}
|
|
203
|
-
function runQuietCommand(node, phase, command, args, commandOptions = {}) {
|
|
204
|
-
const cwd = commandOptions.cwd ?? node.path;
|
|
205
|
-
const spawnCommand = command === "npm" ? npmCommandForSpawn(args) : { command, args };
|
|
206
|
-
const result = spawnSync(spawnCommand.command, spawnCommand.args, {
|
|
207
|
-
cwd,
|
|
208
|
-
env: command === "npm" ? npmWorkflowEnv(commandOptions.env, cwd) : withShortProcessTempEnv(commandOptions.env),
|
|
209
|
-
stdio: "pipe",
|
|
210
|
-
encoding: "utf8",
|
|
211
|
-
timeout: commandOptions.timeoutMs
|
|
212
|
-
});
|
|
213
|
-
const stdout = result.stdout?.trim() ?? "";
|
|
214
|
-
const stderr = result.stderr?.trim() ?? "";
|
|
215
|
-
if (result.status !== 0) {
|
|
216
|
-
throw new RepositorySaveError(
|
|
217
|
-
[
|
|
218
|
-
`${progressPrefix(node, phase)} ${displayCommand(command, args)} failed`,
|
|
219
|
-
stderr || stdout
|
|
220
|
-
].filter(Boolean).join("\n"),
|
|
221
|
-
{
|
|
222
|
-
details: {
|
|
223
|
-
failingRepo: node.name,
|
|
224
|
-
phase,
|
|
225
|
-
command: displayCommand(command, args)
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
return stdout;
|
|
231
|
-
}
|
|
232
|
-
async function runStreamingCommand(node, options, phase, command, args, commandOptions = {}) {
|
|
233
|
-
const cwd = commandOptions.cwd ?? node.path;
|
|
234
|
-
const spawnCommand = command === "npm" ? npmCommandForSpawn(args) : { command, args };
|
|
235
|
-
emitProgress(options, node, phase, `$ ${displayCommand(command, args)}`);
|
|
236
|
-
return await new Promise((resolvePromise, reject) => {
|
|
237
|
-
const child = spawn(spawnCommand.command, spawnCommand.args, {
|
|
238
|
-
cwd,
|
|
239
|
-
env: command === "npm" ? npmWorkflowEnv(commandOptions.env, cwd) : withShortProcessTempEnv(commandOptions.env),
|
|
240
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
241
|
-
});
|
|
242
|
-
let stdout = "";
|
|
243
|
-
let stderr = "";
|
|
244
|
-
let stdoutRemainder = "";
|
|
245
|
-
let stderrRemainder = "";
|
|
246
|
-
let settled = false;
|
|
247
|
-
const warningSummary = commandOptions.buildWarningPolicy === false ? null : createBuildWarningSummary();
|
|
248
|
-
const flush = (chunk, stream) => {
|
|
249
|
-
const combined = stream === "stdout" ? stdoutRemainder + chunk : stderrRemainder + chunk;
|
|
250
|
-
const parts = combined.split(/\r?\n/u);
|
|
251
|
-
const complete = parts.slice(0, -1);
|
|
252
|
-
if (stream === "stdout") stdoutRemainder = parts.at(-1) ?? "";
|
|
253
|
-
else stderrRemainder = parts.at(-1) ?? "";
|
|
254
|
-
for (const line of complete) {
|
|
255
|
-
const classified = warningSummary?.record(line, commandOptions.buildWarningPolicy || void 0);
|
|
256
|
-
if (classified?.kind === "allowed") {
|
|
257
|
-
continue;
|
|
258
|
-
}
|
|
259
|
-
emitProgress(options, node, phase, line, stream);
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
const timeout = commandOptions.timeoutMs ? setTimeout(() => {
|
|
263
|
-
if (settled) return;
|
|
264
|
-
settled = true;
|
|
265
|
-
child.kill("SIGTERM");
|
|
266
|
-
reject(new Error(`${progressPrefix(node, phase)} ${displayCommand(command, args)} timed out after ${commandOptions.timeoutMs}ms`));
|
|
267
|
-
}, commandOptions.timeoutMs) : null;
|
|
268
|
-
child.stdout?.on("data", (chunk) => {
|
|
269
|
-
const text = chunk.toString();
|
|
270
|
-
stdout += text;
|
|
271
|
-
flush(text, "stdout");
|
|
272
|
-
});
|
|
273
|
-
child.stderr?.on("data", (chunk) => {
|
|
274
|
-
const text = chunk.toString();
|
|
275
|
-
stderr += text;
|
|
276
|
-
flush(text, "stderr");
|
|
277
|
-
});
|
|
278
|
-
child.on("error", (error) => {
|
|
279
|
-
if (settled) return;
|
|
280
|
-
settled = true;
|
|
281
|
-
if (timeout) clearTimeout(timeout);
|
|
282
|
-
reject(error);
|
|
283
|
-
});
|
|
284
|
-
child.on("close", (code) => {
|
|
285
|
-
if (settled) return;
|
|
286
|
-
settled = true;
|
|
287
|
-
if (timeout) clearTimeout(timeout);
|
|
288
|
-
if (stdoutRemainder) {
|
|
289
|
-
const classified = warningSummary?.record(stdoutRemainder, commandOptions.buildWarningPolicy || void 0);
|
|
290
|
-
if (classified?.kind !== "allowed") emitProgress(options, node, phase, stdoutRemainder);
|
|
291
|
-
}
|
|
292
|
-
if (stderrRemainder) {
|
|
293
|
-
const classified = warningSummary?.record(stderrRemainder, commandOptions.buildWarningPolicy || void 0);
|
|
294
|
-
if (classified?.kind !== "allowed") emitProgress(options, node, phase, stderrRemainder, "stderr");
|
|
295
|
-
}
|
|
296
|
-
if (code === 0) {
|
|
297
|
-
if (warningSummary) {
|
|
298
|
-
for (const line of formatAllowedBuildWarnings(warningSummary.allowedWarnings)) {
|
|
299
|
-
emitProgress(options, node, phase, line);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
resolvePromise({ stdout, stderr });
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
reject(new RepositorySaveError(
|
|
306
|
-
prefixedOutput(node, phase, stderr) || prefixedOutput(node, phase, stdout) || `${progressPrefix(node, phase)} ${displayCommand(command, args)} failed with exit code ${code ?? "unknown"}`,
|
|
307
|
-
{
|
|
308
|
-
details: {
|
|
309
|
-
failingRepo: node.name,
|
|
310
|
-
phase,
|
|
311
|
-
command: displayCommand(command, args)
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
));
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
function packageScripts(packageJson) {
|
|
319
|
-
const scripts = packageJson?.scripts;
|
|
320
|
-
return scripts && typeof scripts === "object" && !Array.isArray(scripts) ? Object.fromEntries(Object.entries(scripts).map(([key, value]) => [key, String(value)])) : {};
|
|
321
|
-
}
|
|
322
|
-
function classifyRepoKind(packageJson, managedKind) {
|
|
323
|
-
if (managedKind === "template") return "template";
|
|
324
|
-
if (managedKind === "fixture") return "fixture";
|
|
325
|
-
if (typeof packageJson?.name !== "string" || typeof packageJson?.version !== "string") {
|
|
326
|
-
return "project";
|
|
327
|
-
}
|
|
328
|
-
if (packageJson.private === true) {
|
|
329
|
-
return "project";
|
|
330
|
-
}
|
|
331
|
-
const scripts = packageScripts(packageJson);
|
|
332
|
-
const publishConfig = packageJson.publishConfig;
|
|
333
|
-
return typeof scripts["release:publish"] === "string" || publishConfig !== null && typeof publishConfig === "object" && !Array.isArray(publishConfig) ? "package" : "project";
|
|
334
|
-
}
|
|
335
|
-
function dependencyFields(packageJson) {
|
|
336
|
-
if (!packageJson) return [];
|
|
337
|
-
return ["dependencies", "optionalDependencies", "peerDependencies", "devDependencies"].filter((field) => packageJson[field] && typeof packageJson[field] === "object" && !Array.isArray(packageJson[field]));
|
|
338
|
-
}
|
|
339
|
-
function repoIdForPath(root, repoDir) {
|
|
340
|
-
return relative(root, repoDir).replaceAll("\\", "/") || ".";
|
|
341
|
-
}
|
|
342
|
-
function isGitRepo(repoDir) {
|
|
343
|
-
try {
|
|
344
|
-
runGit(["rev-parse", "--is-inside-work-tree"], { cwd: repoDir, capture: true });
|
|
345
|
-
return true;
|
|
346
|
-
} catch {
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
function isIndependentGitRepo(repoDir) {
|
|
351
|
-
try {
|
|
352
|
-
return resolve(repoRoot(repoDir)) === resolve(repoDir);
|
|
353
|
-
} catch {
|
|
354
|
-
return false;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
function originRemoteUrlSafe(repoDir) {
|
|
358
|
-
try {
|
|
359
|
-
return originRemoteUrl(repoDir);
|
|
360
|
-
} catch {
|
|
361
|
-
return null;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
function ensureWritableRemote(node, options) {
|
|
365
|
-
if (!node.remoteUrl || (options.gitRemoteWriteMode ?? "ssh-pushurl") === "off") return;
|
|
366
|
-
const result = ensureSshPushUrlForOrigin(node.path, node.remoteUrl, options.gitRemoteWriteMode ?? "ssh-pushurl");
|
|
367
|
-
if (result.changed && result.pushUrl) {
|
|
368
|
-
emitProgress(options, node, "remote", `Configured origin push URL ${result.pushUrl}; keeping ${node.remoteUrl} for reads.`);
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
function repoDisplayName(repoDir, packageJson) {
|
|
372
|
-
return typeof packageJson?.name === "string" && packageJson.name.length > 0 ? packageJson.name : basename(repoDir);
|
|
373
|
-
}
|
|
374
|
-
function emptyManifestVerifyCommands() {
|
|
375
|
-
return { fast: null, local: null, release: null };
|
|
376
|
-
}
|
|
377
|
-
function verifyCommandFromString(repoDir, label, command) {
|
|
378
|
-
return command ? { label, command: "bash", args: ["-lc", command], cwd: repoDir } : null;
|
|
379
|
-
}
|
|
380
|
-
function templateVerifyCommands(repoDir) {
|
|
381
|
-
const manifest = readTreeseedTemplateRepositoryManifest(repoDir);
|
|
382
|
-
if (!manifest) return null;
|
|
383
|
-
return {
|
|
384
|
-
fast: verifyCommandFromString(repoDir, "fast", manifest.verify.fast),
|
|
385
|
-
local: verifyCommandFromString(repoDir, "local", manifest.verify.local),
|
|
386
|
-
release: verifyCommandFromString(repoDir, "release", manifest.verify.release)
|
|
387
|
-
};
|
|
388
|
-
}
|
|
389
|
-
function parseGitmodules(root) {
|
|
390
|
-
return parseGitmodulesPaths(root);
|
|
391
|
-
}
|
|
392
|
-
function slugBranch(branch) {
|
|
393
|
-
return branch.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 40) || "dev";
|
|
394
|
-
}
|
|
395
|
-
function timestampLabel(date = /* @__PURE__ */ new Date()) {
|
|
396
|
-
return date.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/u, "Z");
|
|
397
|
-
}
|
|
398
|
-
function nextDevVersion(version, branch, date = /* @__PURE__ */ new Date()) {
|
|
399
|
-
return `${incrementVersion(version, "patch")}-dev.${slugBranch(branch)}.${timestampLabel(date)}`;
|
|
400
|
-
}
|
|
401
|
-
function escapeRegExp(value) {
|
|
402
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
403
|
-
}
|
|
404
|
-
function isStableSemverVersion(version) {
|
|
405
|
-
return /^\d+\.\d+\.\d+$/u.test(version);
|
|
406
|
-
}
|
|
407
|
-
function isDevVersionForBranch(version, branch) {
|
|
408
|
-
const branchSlug = escapeRegExp(slugBranch(branch));
|
|
409
|
-
return new RegExp(`^\\d+\\.\\d+\\.\\d+-dev\\.${branchSlug}\\.\\d{8}T\\d{6}Z$`, "u").test(version);
|
|
410
|
-
}
|
|
411
|
-
function packageVersionAtHead(node) {
|
|
412
|
-
if (!node.packageJsonPath) return null;
|
|
413
|
-
try {
|
|
414
|
-
const source = runGit(["show", "HEAD:package.json"], { cwd: node.path, capture: true });
|
|
415
|
-
const packageJson = JSON.parse(source);
|
|
416
|
-
return typeof packageJson.version === "string" ? packageJson.version : null;
|
|
417
|
-
} catch {
|
|
418
|
-
return null;
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
function headCommitOrPlanPlaceholder(cwd) {
|
|
422
|
-
try {
|
|
423
|
-
return headCommit(cwd);
|
|
424
|
-
} catch {
|
|
425
|
-
return "HEAD";
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
function remoteBranchCommitSafe(cwd, branch) {
|
|
429
|
-
try {
|
|
430
|
-
const output = runGit(["ls-remote", "origin", `refs/heads/${branch}`], { cwd, capture: true });
|
|
431
|
-
const [sha] = output.trim().split(/\s+/u);
|
|
432
|
-
return /^[a-f0-9]{40}$/u.test(sha ?? "") ? sha : null;
|
|
433
|
-
} catch {
|
|
434
|
-
return null;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
function canManagePackageJsonVersion(node) {
|
|
438
|
-
return node.kind === "package" && Boolean(node.packageJsonPath) && typeof node.packageJson?.version === "string";
|
|
439
|
-
}
|
|
440
|
-
function packageVersionEligibleForBranch(node, version, options) {
|
|
441
|
-
return node.branchMode === "package-release-main" ? isStableSemverVersion(version) : isDevVersionForBranch(version, node.branch || options.branch);
|
|
442
|
-
}
|
|
443
|
-
function packageVersionTagConflictsWithHead(node, options) {
|
|
444
|
-
if (node.kind !== "package") return false;
|
|
445
|
-
if (node.branchMode === "package-dev-save" && (options.devDependencyReferenceMode ?? "git-commit") === "git-commit") return false;
|
|
446
|
-
const version = typeof node.packageJson?.version === "string" ? node.packageJson.version : null;
|
|
447
|
-
if (!version || !packageVersionEligibleForBranch(node, version, options)) return false;
|
|
448
|
-
const head = headCommit(node.path);
|
|
449
|
-
const state = tagState(node.path, version);
|
|
450
|
-
return state.localCommit != null && state.localCommit !== head || state.remoteCommit != null && state.remoteCommit !== head;
|
|
451
|
-
}
|
|
452
|
-
function selectPackageVersion(node, options) {
|
|
453
|
-
const current = String(node.packageJson?.version ?? "0.0.0");
|
|
454
|
-
if (node.branchMode === "package-dev-save" && isDevVersionForBranch(current, node.branch || options.branch) && ((options.devDependencyReferenceMode ?? "git-commit") === "git-commit" || !tagExists(node.path, current))) {
|
|
455
|
-
return { version: current, reused: true };
|
|
456
|
-
}
|
|
457
|
-
if (node.branchMode === "package-release-main") {
|
|
458
|
-
const headVersion = packageVersionAtHead(node);
|
|
459
|
-
if (headVersion && current === incrementVersion(headVersion, options.bump ?? "patch") && !tagExists(node.path, current)) {
|
|
460
|
-
return { version: current, reused: true };
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
return { version: planPackageVersion(node, options), reused: false };
|
|
464
|
-
}
|
|
465
|
-
function createReport(node) {
|
|
466
|
-
return {
|
|
467
|
-
name: node.name,
|
|
468
|
-
path: node.path,
|
|
469
|
-
branch: node.branch,
|
|
470
|
-
dirty: hasMeaningfulChanges(node.path),
|
|
471
|
-
created: false,
|
|
472
|
-
resumed: false,
|
|
473
|
-
merged: false,
|
|
474
|
-
verified: false,
|
|
475
|
-
committed: false,
|
|
476
|
-
pushed: false,
|
|
477
|
-
deletedLocal: false,
|
|
478
|
-
deletedRemote: false,
|
|
479
|
-
tagName: null,
|
|
480
|
-
commitSha: node.branch ? headCommit(node.path) : null,
|
|
481
|
-
skippedReason: null,
|
|
482
|
-
publishWait: null,
|
|
483
|
-
version: typeof node.packageJson?.version === "string" ? node.packageJson.version : null,
|
|
484
|
-
dependencySpec: node.plannedDependencySpec,
|
|
485
|
-
branchMode: node.branchMode,
|
|
486
|
-
verification: null,
|
|
487
|
-
install: null,
|
|
488
|
-
lockfileValidation: null,
|
|
489
|
-
commitMessage: null,
|
|
490
|
-
commitMessageProvider: null,
|
|
491
|
-
commitMessageFallbackUsed: false,
|
|
492
|
-
commitMessageError: null
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
function discoverRepositorySaveNodes(root, gitRoot = repoRoot(root), branch = currentBranch(gitRoot), options = {}) {
|
|
496
|
-
const repoDirs = /* @__PURE__ */ new Map();
|
|
497
|
-
const packageAdaptersByDir = new Map(discoverTreeseedPackageAdapters(root).map((adapter) => [resolve(adapter.dir), adapter]));
|
|
498
|
-
const managedRepositoriesByDir = new Map(discoverTreeseedManagedRepositories(root).map((repo) => [resolve(repo.dir), repo]));
|
|
499
|
-
for (const repo of managedRepositoriesByDir.values()) {
|
|
500
|
-
repoDirs.set(repo.relativeDir, repo.dir);
|
|
501
|
-
}
|
|
502
|
-
if (!repoDirs.has(".")) {
|
|
503
|
-
repoDirs.set(".", gitRoot);
|
|
504
|
-
}
|
|
505
|
-
if (hasCompleteTreeseedPackageCheckout(root)) {
|
|
506
|
-
for (const pkg of workspacePackages(root)) {
|
|
507
|
-
if (isIndependentGitRepo(pkg.dir)) {
|
|
508
|
-
repoDirs.set(pkg.relativeDir, pkg.dir);
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
for (const adapter of packageAdaptersByDir.values()) {
|
|
513
|
-
if (isIndependentGitRepo(adapter.dir)) {
|
|
514
|
-
repoDirs.set(adapter.relativeDir, adapter.dir);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
for (const submodulePath of parseGitmodules(root)) {
|
|
518
|
-
const dir = resolve(root, submodulePath);
|
|
519
|
-
if (existsSync(dir) && isIndependentGitRepo(dir)) {
|
|
520
|
-
repoDirs.set(submodulePath, dir);
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
const nodes = [...repoDirs.entries()].map(([relativePath, repoDir]) => {
|
|
524
|
-
const packageJsonPath = resolve(repoDir, "package.json");
|
|
525
|
-
const packageJson = existsSync(packageJsonPath) ? readJson(packageJsonPath) : null;
|
|
526
|
-
const adapter = packageAdaptersByDir.get(resolve(repoDir)) ?? null;
|
|
527
|
-
const managed = managedRepositoriesByDir.get(resolve(repoDir)) ?? null;
|
|
528
|
-
const kind = adapter && !packageJson ? "package" : classifyRepoKind(packageJson, managed?.kind);
|
|
529
|
-
const repoBranch = relativePath === "." ? currentBranch(repoDir) || branch || null : branch || currentBranch(repoDir) || null;
|
|
530
|
-
const branchMode = kind === "project" ? "project-save" : options.stablePackageRelease === true && repoBranch === PRODUCTION_BRANCH ? "package-release-main" : "package-dev-save";
|
|
531
|
-
return {
|
|
532
|
-
id: relativePath,
|
|
533
|
-
name: managed?.kind === "template" || managed?.kind === "fixture" ? managed.name : adapter?.id ?? repoDisplayName(repoDir, packageJson),
|
|
534
|
-
path: repoDir,
|
|
535
|
-
relativePath,
|
|
536
|
-
kind,
|
|
537
|
-
branch: repoBranch,
|
|
538
|
-
branchMode,
|
|
539
|
-
packageJsonPath: packageJson ? packageJsonPath : null,
|
|
540
|
-
packageJson,
|
|
541
|
-
scripts: packageScripts(packageJson),
|
|
542
|
-
manifestVerifyCommands: adapter?.verifyCommands ?? templateVerifyCommands(repoDir) ?? emptyManifestVerifyCommands(),
|
|
543
|
-
remoteUrl: originRemoteUrlSafe(repoDir),
|
|
544
|
-
dependencies: [],
|
|
545
|
-
dependents: [],
|
|
546
|
-
submoduleDependencies: [],
|
|
547
|
-
plannedVersion: null,
|
|
548
|
-
plannedTag: null,
|
|
549
|
-
plannedDependencySpec: null
|
|
550
|
-
};
|
|
551
|
-
});
|
|
552
|
-
return deriveRepositoryGraph(root, nodes);
|
|
553
|
-
}
|
|
554
|
-
function deriveRepositoryGraph(root, nodes) {
|
|
555
|
-
const byPackageName = new Map(nodes.filter((node) => node.kind === "package").map((node) => [String(node.packageJson?.name), node]));
|
|
556
|
-
const byId = new Map(nodes.map((node) => [node.id, node]));
|
|
557
|
-
const dependencies = new Map(nodes.map((node) => [node.id, /* @__PURE__ */ new Set()]));
|
|
558
|
-
const dependents = new Map(nodes.map((node) => [node.id, /* @__PURE__ */ new Set()]));
|
|
559
|
-
for (const node of nodes) {
|
|
560
|
-
for (const field of dependencyFields(node.packageJson)) {
|
|
561
|
-
const values = node.packageJson?.[field];
|
|
562
|
-
for (const depName of Object.keys(values)) {
|
|
563
|
-
const dependency = byPackageName.get(depName);
|
|
564
|
-
if (!dependency || dependency.id === node.id) continue;
|
|
565
|
-
dependencies.get(node.id)?.add(dependency.id);
|
|
566
|
-
dependents.get(dependency.id)?.add(node.id);
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
for (const submodulePath of parseGitmodules(node.path)) {
|
|
570
|
-
const absolute = resolve(node.path, submodulePath);
|
|
571
|
-
const relativeToRoot = repoIdForPath(root, absolute);
|
|
572
|
-
const dependency = byId.get(relativeToRoot);
|
|
573
|
-
if (!dependency || dependency.id === node.id) continue;
|
|
574
|
-
dependencies.get(node.id)?.add(dependency.id);
|
|
575
|
-
dependents.get(dependency.id)?.add(node.id);
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
return nodes.map((node) => ({
|
|
579
|
-
...node,
|
|
580
|
-
dependencies: [...dependencies.get(node.id) ?? []].sort(),
|
|
581
|
-
dependents: [...dependents.get(node.id) ?? []].sort(),
|
|
582
|
-
submoduleDependencies: [...dependencies.get(node.id) ?? []].filter((id) => node.id === "." || id.startsWith(`${node.id}/`)).sort()
|
|
583
|
-
}));
|
|
584
|
-
}
|
|
585
|
-
function repositorySaveWaves(nodes) {
|
|
586
|
-
const nodeIds = new Set(nodes.map((node) => node.id));
|
|
587
|
-
const dependencies = new Map(nodes.map((node) => [node.id, new Set(node.dependencies.filter((id) => nodeIds.has(id)))]));
|
|
588
|
-
const dependents = new Map(nodes.map((node) => [node.id, new Set(node.dependents.filter((id) => nodeIds.has(id)))]));
|
|
589
|
-
const ready = [...nodes].filter((node) => (dependencies.get(node.id)?.size ?? 0) === 0).sort(compareNodes);
|
|
590
|
-
const waves = [];
|
|
591
|
-
const processed = /* @__PURE__ */ new Set();
|
|
592
|
-
while (ready.length > 0) {
|
|
593
|
-
const wave = ready.splice(0).filter((node) => !processed.has(node.id));
|
|
594
|
-
if (wave.length === 0) continue;
|
|
595
|
-
waves.push(wave);
|
|
596
|
-
for (const node of wave) {
|
|
597
|
-
processed.add(node.id);
|
|
598
|
-
for (const dependentId of dependents.get(node.id) ?? []) {
|
|
599
|
-
const remaining = dependencies.get(dependentId);
|
|
600
|
-
remaining?.delete(node.id);
|
|
601
|
-
if (remaining && remaining.size === 0 && !processed.has(dependentId)) {
|
|
602
|
-
const dependent = nodes.find((candidate) => candidate.id === dependentId);
|
|
603
|
-
if (dependent) ready.push(dependent);
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
ready.sort(compareNodes);
|
|
608
|
-
}
|
|
609
|
-
if (processed.size !== nodes.length) {
|
|
610
|
-
const unresolved = nodes.filter((node) => !processed.has(node.id)).map((node) => `${node.name} depends on ${(dependencies.get(node.id) ? [...dependencies.get(node.id)] : []).join(", ")}`);
|
|
611
|
-
throw new RepositorySaveError(`Repository dependency cycle detected:
|
|
612
|
-
${unresolved.join("\n")}`, {
|
|
613
|
-
details: { unresolved }
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
return waves;
|
|
617
|
-
}
|
|
618
|
-
function compareNodes(left, right) {
|
|
619
|
-
if (left.id === ".") return 1;
|
|
620
|
-
if (right.id === ".") return -1;
|
|
621
|
-
const sorted = sortWorkspacePackages([
|
|
622
|
-
{ name: left.name, relativeDir: left.relativePath, dir: left.path, packageJson: left.packageJson ?? {} },
|
|
623
|
-
{ name: right.name, relativeDir: right.relativePath, dir: right.path, packageJson: right.packageJson ?? {} }
|
|
624
|
-
]);
|
|
625
|
-
return sorted[0]?.name === left.name ? -1 : 1;
|
|
626
|
-
}
|
|
627
|
-
function runLimited(items, limit, action) {
|
|
628
|
-
let index = 0;
|
|
629
|
-
const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {
|
|
630
|
-
while (index < items.length) {
|
|
631
|
-
const current = items[index++];
|
|
632
|
-
await action(current);
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
return Promise.all(workers);
|
|
636
|
-
}
|
|
637
|
-
function repositorySaveConcurrency(options) {
|
|
638
|
-
if (options.verifyMode && options.verifyMode !== "skip") {
|
|
639
|
-
return 1;
|
|
640
|
-
}
|
|
641
|
-
const configured = Number.parseInt(process.env.TREESEED_SAVE_REPOSITORY_CONCURRENCY ?? "", 10);
|
|
642
|
-
return Number.isFinite(configured) && configured > 0 ? configured : 3;
|
|
643
|
-
}
|
|
644
|
-
function remoteBranchExistsSafe(repoDir, branch) {
|
|
645
|
-
try {
|
|
646
|
-
runGit(["rev-parse", "--verify", `refs/remotes/origin/${branch}`], { cwd: repoDir, capture: true });
|
|
647
|
-
return true;
|
|
648
|
-
} catch {
|
|
649
|
-
}
|
|
650
|
-
try {
|
|
651
|
-
return remoteBranchExists(repoDir, branch);
|
|
652
|
-
} catch {
|
|
653
|
-
return false;
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
function checkoutCommandFor(repoDir, branch) {
|
|
657
|
-
if (currentBranch(repoDir) === branch) return `git checkout ${branch} # already current`;
|
|
658
|
-
if (branchExists(repoDir, branch)) return `git checkout ${branch}`;
|
|
659
|
-
if (remoteBranchExistsSafe(repoDir, branch)) return `git checkout -b ${branch} origin/${branch}`;
|
|
660
|
-
return `git checkout -b ${branch}`;
|
|
661
|
-
}
|
|
662
|
-
function checkoutOrCreateBranch(node, options, branch) {
|
|
663
|
-
if (currentBranch(node.path) === branch) {
|
|
664
|
-
emitProgress(options, node, "branch", `Already on ${branch}.`);
|
|
665
|
-
return;
|
|
666
|
-
}
|
|
667
|
-
if (branchExists(node.path, branch)) {
|
|
668
|
-
runCapturedCommand(node, options, "branch", "git", ["checkout", branch]);
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
if (remoteBranchExistsSafe(node.path, branch)) {
|
|
672
|
-
runCapturedCommand(node, options, "branch", "git", ["checkout", "-b", branch, `origin/${branch}`]);
|
|
673
|
-
return;
|
|
674
|
-
}
|
|
675
|
-
runCapturedCommand(node, options, "branch", "git", ["checkout", "-b", branch]);
|
|
676
|
-
}
|
|
677
|
-
async function commitMessageFor(node, options, context) {
|
|
678
|
-
return generateRepositoryCommitMessage({
|
|
679
|
-
repoName: node.name,
|
|
680
|
-
repoPath: node.path,
|
|
681
|
-
branch: node.branch || options.branch,
|
|
682
|
-
kind: node.kind,
|
|
683
|
-
branchMode: node.branchMode,
|
|
684
|
-
userMessage: options.message?.trim() || void 0,
|
|
685
|
-
...context
|
|
686
|
-
}, {
|
|
687
|
-
mode: options.commitMessageMode ?? "auto",
|
|
688
|
-
provider: options.commitMessageProvider
|
|
689
|
-
});
|
|
690
|
-
}
|
|
691
|
-
function commitSubject(message) {
|
|
692
|
-
return String(message ?? "").split(/\r?\n/u)[0]?.trim() || null;
|
|
693
|
-
}
|
|
694
|
-
function gitDiffSummary(repoDir) {
|
|
695
|
-
const changedFiles = runGit(["status", "--porcelain"], { cwd: repoDir, capture: true });
|
|
696
|
-
const rawDiff = runGit(["diff", "--cached"], { cwd: repoDir, capture: true, maxBuffer: 1024 * 1024 * 32 });
|
|
697
|
-
const maxDiffChars = 12e4;
|
|
698
|
-
const diff = rawDiff.length > maxDiffChars ? `${rawDiff.slice(0, maxDiffChars)}
|
|
699
|
-
|
|
700
|
-
[treeseed-save: diff truncated from ${rawDiff.length} characters for commit-message generation]
|
|
701
|
-
` : rawDiff;
|
|
702
|
-
return { changedFiles, diff };
|
|
703
|
-
}
|
|
704
|
-
function hasStagedChanges(repoDir) {
|
|
705
|
-
try {
|
|
706
|
-
return runGit(["diff", "--cached", "--name-only"], { cwd: repoDir, capture: true }).trim().length > 0;
|
|
707
|
-
} catch {
|
|
708
|
-
return false;
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
function updateDependencyReferences(node, finalizedReferences) {
|
|
712
|
-
if (!node.packageJson || !node.packageJsonPath) return [];
|
|
713
|
-
const changed = updateInternalDependencySpecs(node.packageJson, finalizedReferences);
|
|
714
|
-
if (changed.length > 0) {
|
|
715
|
-
writeJson(node.packageJsonPath, node.packageJson);
|
|
716
|
-
}
|
|
717
|
-
return changed;
|
|
718
|
-
}
|
|
719
|
-
function isRootWorkspaceRepository(node, options) {
|
|
720
|
-
const packageJson = node.packageJson ?? (existsSync(resolve(node.path, "package.json")) ? readJson(resolve(node.path, "package.json")) : null);
|
|
721
|
-
return node.path === options.root && Array.isArray(packageJson?.workspaces);
|
|
722
|
-
}
|
|
723
|
-
function syncDirectGitDependencyLockfileEntries(node, options, references) {
|
|
724
|
-
if (references.length === 0) return false;
|
|
725
|
-
const lockfilePath = resolve(node.path, "package-lock.json");
|
|
726
|
-
if (!existsSync(lockfilePath)) return false;
|
|
727
|
-
const lockfile = readJson(lockfilePath);
|
|
728
|
-
const rootPackage = lockfile.packages && typeof lockfile.packages === "object" && !Array.isArray(lockfile.packages) ? lockfile.packages[""] : null;
|
|
729
|
-
const packageEntries = lockfile.packages && typeof lockfile.packages === "object" && !Array.isArray(lockfile.packages) ? lockfile.packages : null;
|
|
730
|
-
if (!rootPackage || !packageEntries) return false;
|
|
731
|
-
let changed = false;
|
|
732
|
-
for (const reference of references) {
|
|
733
|
-
const manifestSpec = reference.manifestSpec ?? reference.spec;
|
|
734
|
-
const declaredSpec = ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"].map((field) => node.packageJson?.[field]).filter((value) => Boolean(value && typeof value === "object" && !Array.isArray(value))).map((dependencies) => dependencies[reference.packageName]).find((value) => typeof value === "string");
|
|
735
|
-
if (declaredSpec !== manifestSpec) continue;
|
|
736
|
-
const visitDependencyMaps = (value) => {
|
|
737
|
-
if (!value || typeof value !== "object") return;
|
|
738
|
-
if (Array.isArray(value)) {
|
|
739
|
-
for (const item of value) visitDependencyMaps(item);
|
|
740
|
-
return;
|
|
741
|
-
}
|
|
742
|
-
const record = value;
|
|
743
|
-
for (const field of ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"]) {
|
|
744
|
-
const dependencies = record[field];
|
|
745
|
-
if (!dependencies || typeof dependencies !== "object" || Array.isArray(dependencies)) continue;
|
|
746
|
-
const dependencyMap = dependencies;
|
|
747
|
-
const current = dependencyMap[reference.packageName];
|
|
748
|
-
if (typeof current === "string" && current !== manifestSpec) {
|
|
749
|
-
dependencyMap[reference.packageName] = manifestSpec;
|
|
750
|
-
changed = true;
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
for (const nested of Object.values(record)) visitDependencyMaps(nested);
|
|
754
|
-
};
|
|
755
|
-
visitDependencyMaps(lockfile);
|
|
756
|
-
for (const [entryKey, entry] of Object.entries(packageEntries)) {
|
|
757
|
-
if (entryKey !== `node_modules/${reference.packageName}` && !entryKey.endsWith(`/node_modules/${reference.packageName}`)) continue;
|
|
758
|
-
const nextResolved = normalizeGitRemoteForDependency(reference.remoteUrl ?? "", "ssh");
|
|
759
|
-
const resolved = nextResolved ? `${nextResolved}#${manifestSpec.slice(manifestSpec.lastIndexOf("#") + 1)}` : manifestSpec;
|
|
760
|
-
if (entry.resolved !== resolved) {
|
|
761
|
-
entry.resolved = resolved;
|
|
762
|
-
changed = true;
|
|
763
|
-
}
|
|
764
|
-
if (typeof reference.version === "string" && reference.version && entry.version !== reference.version) {
|
|
765
|
-
entry.version = reference.version;
|
|
766
|
-
changed = true;
|
|
767
|
-
}
|
|
768
|
-
if ("integrity" in entry) {
|
|
769
|
-
delete entry.integrity;
|
|
770
|
-
changed = true;
|
|
771
|
-
}
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
if (!changed) return false;
|
|
775
|
-
writeJson(lockfilePath, lockfile);
|
|
776
|
-
emitProgress(options, node, "lockfile", "Synchronized direct internal Git dependency lockfile entries without npm git preparation.");
|
|
777
|
-
return true;
|
|
778
|
-
}
|
|
779
|
-
function validateStandaloneGitDependencyLockfile(node, options) {
|
|
780
|
-
const lockfilePath = resolve(node.path, "package-lock.json");
|
|
781
|
-
const lockfileExists = existsSync(lockfilePath);
|
|
782
|
-
const previousLockfile = lockfileExists ? readFileSync(lockfilePath, "utf8") : null;
|
|
783
|
-
const isolatedRoot = mkdtempSync(resolve(tmpdir(), "treeseed-lockfile-"));
|
|
784
|
-
const validateArgs = [
|
|
785
|
-
"ci",
|
|
786
|
-
"--package-lock-only",
|
|
787
|
-
"--ignore-scripts",
|
|
788
|
-
"--workspaces=false",
|
|
789
|
-
"--no-audit",
|
|
790
|
-
"--no-fund"
|
|
791
|
-
];
|
|
792
|
-
try {
|
|
793
|
-
if (!lockfileExists) throw new Error("standalone lockfile missing");
|
|
794
|
-
copyFileSync(resolve(node.path, "package.json"), resolve(isolatedRoot, "package.json"));
|
|
795
|
-
copyFileSync(lockfilePath, resolve(isolatedRoot, "package-lock.json"));
|
|
796
|
-
runCapturedCommand(node, options, "lockfile", "npm", validateArgs, {
|
|
797
|
-
cwd: isolatedRoot,
|
|
798
|
-
timeoutMs: 5 * 6e4
|
|
799
|
-
});
|
|
800
|
-
} catch (validationError) {
|
|
801
|
-
try {
|
|
802
|
-
rmSync(isolatedRoot, { recursive: true, force: true });
|
|
803
|
-
mkdirSync(isolatedRoot, { recursive: true });
|
|
804
|
-
copyFileSync(resolve(node.path, "package.json"), resolve(isolatedRoot, "package.json"));
|
|
805
|
-
runCapturedCommand(node, options, "lockfile", "npm", [
|
|
806
|
-
"install",
|
|
807
|
-
"--package-lock-only",
|
|
808
|
-
"--ignore-scripts",
|
|
809
|
-
"--workspaces=false",
|
|
810
|
-
"--no-audit",
|
|
811
|
-
"--no-fund"
|
|
812
|
-
], {
|
|
813
|
-
cwd: isolatedRoot,
|
|
814
|
-
timeoutMs: 15 * 6e4
|
|
815
|
-
});
|
|
816
|
-
runCapturedCommand(node, options, "lockfile", "npm", validateArgs, {
|
|
817
|
-
cwd: isolatedRoot,
|
|
818
|
-
timeoutMs: 5 * 6e4
|
|
819
|
-
});
|
|
820
|
-
copyFileSync(resolve(isolatedRoot, "package-lock.json"), lockfilePath);
|
|
821
|
-
} catch (regenerationError) {
|
|
822
|
-
if (previousLockfile !== null) writeFileSync(lockfilePath, previousLockfile, "utf8");
|
|
823
|
-
throw regenerationError instanceof Error ? regenerationError : validationError;
|
|
824
|
-
}
|
|
825
|
-
} finally {
|
|
826
|
-
rmSync(isolatedRoot, { recursive: true, force: true });
|
|
827
|
-
}
|
|
828
|
-
emitProgress(options, node, "lockfile", "Validated the standalone lockfile against the committed package manifest.");
|
|
829
|
-
return true;
|
|
830
|
-
}
|
|
831
|
-
function planPackageVersion(node, options) {
|
|
832
|
-
if (!node.packageJson || !node.packageJsonPath) return null;
|
|
833
|
-
const current = String(node.packageJson.version ?? "0.0.0");
|
|
834
|
-
return node.branchMode === "package-release-main" ? incrementVersion(current, options.bump ?? "patch") : nextDevVersion(current, options.branch);
|
|
835
|
-
}
|
|
836
|
-
function applyPackageVersion(node, version) {
|
|
837
|
-
if (!node.packageJson || !node.packageJsonPath) return false;
|
|
838
|
-
let changed = false;
|
|
839
|
-
if (node.packageJson.version !== version) {
|
|
840
|
-
node.packageJson.version = version;
|
|
841
|
-
writeJson(node.packageJsonPath, node.packageJson);
|
|
842
|
-
changed = true;
|
|
843
|
-
}
|
|
844
|
-
const lockfilePath = resolve(node.path, "package-lock.json");
|
|
845
|
-
if (existsSync(lockfilePath)) {
|
|
846
|
-
const lockfile = readJson(lockfilePath);
|
|
847
|
-
const rootEntry = lockfile.packages && typeof lockfile.packages === "object" && !Array.isArray(lockfile.packages) ? lockfile.packages[""] : null;
|
|
848
|
-
const lockfileMatches = lockfile.version === version && rootEntry?.version === version && (typeof node.packageJson.name !== "string" || rootEntry?.name === node.packageJson.name);
|
|
849
|
-
if (lockfileMatches) return changed;
|
|
850
|
-
lockfile.version = version;
|
|
851
|
-
const packages = lockfile.packages && typeof lockfile.packages === "object" && !Array.isArray(lockfile.packages) ? lockfile.packages : {};
|
|
852
|
-
packages[""] = {
|
|
853
|
-
...packages[""] ?? {},
|
|
854
|
-
...typeof node.packageJson.name === "string" ? { name: node.packageJson.name } : {},
|
|
855
|
-
version
|
|
856
|
-
};
|
|
857
|
-
lockfile.packages = packages;
|
|
858
|
-
writeJson(lockfilePath, lockfile);
|
|
859
|
-
changed = true;
|
|
860
|
-
}
|
|
861
|
-
return changed;
|
|
862
|
-
}
|
|
863
|
-
function shouldSkipNetworkInstall() {
|
|
864
|
-
return process.env.TREESEED_SAVE_NPM_INSTALL_MODE !== "allow";
|
|
865
|
-
}
|
|
866
|
-
function shouldSkipGitDependencySmoke(options) {
|
|
867
|
-
return shouldSkipNetworkInstall() || process.env.TREESEED_GIT_DEPENDENCY_SMOKE === "skip" || options?.verifyMode === "skip";
|
|
868
|
-
}
|
|
869
|
-
function hasNpmLockfile(repoDir) {
|
|
870
|
-
return existsSync(resolve(repoDir, "package-lock.json")) || existsSync(resolve(repoDir, "npm-shrinkwrap.json"));
|
|
871
|
-
}
|
|
872
|
-
function syncRootWorkspaceLockfileMetadata(node, options) {
|
|
873
|
-
if (node.path !== options.root || !Array.isArray(node.packageJson?.workspaces)) return false;
|
|
874
|
-
const lockfilePath = resolve(node.path, "package-lock.json");
|
|
875
|
-
if (!existsSync(lockfilePath)) return false;
|
|
876
|
-
const lockfile = readJson(lockfilePath);
|
|
877
|
-
const packages = lockfile.packages;
|
|
878
|
-
if (!packages || typeof packages !== "object" || Array.isArray(packages)) return false;
|
|
879
|
-
let changed = false;
|
|
880
|
-
const packageEntries = packages;
|
|
881
|
-
const rootEntry = packageEntries[""] ?? {};
|
|
882
|
-
const workspacePackageList = workspacePackages(node.path);
|
|
883
|
-
const workspaceVersionByName = new Map(workspacePackageList.map((workspacePackage) => [String(workspacePackage.packageJson.name ?? ""), String(workspacePackage.packageJson.version ?? "")]).filter(([name, version]) => name.length > 0 && version.length > 0));
|
|
884
|
-
const rootDependencySpecs = /* @__PURE__ */ new Map();
|
|
885
|
-
for (const field of dependencyFields(node.packageJson)) {
|
|
886
|
-
const rootDeps = node.packageJson[field];
|
|
887
|
-
if (!rootDeps || typeof rootDeps !== "object" || Array.isArray(rootDeps)) continue;
|
|
888
|
-
for (const [dependencyName, dependencySpec] of Object.entries(rootDeps)) {
|
|
889
|
-
if (typeof dependencySpec === "string") {
|
|
890
|
-
rootDependencySpecs.set(dependencyName, dependencySpec);
|
|
891
|
-
}
|
|
892
|
-
}
|
|
893
|
-
}
|
|
894
|
-
const stableWorkspaceDependencySpec = (dependencyName) => rootDependencySpecs.get(dependencyName) ?? workspaceVersionByName.get(dependencyName) ?? null;
|
|
895
|
-
const normalizeWorkspaceDependencySpecs = (value) => Object.fromEntries(
|
|
896
|
-
Object.entries(value).map(([dependencyName, dependencySpec]) => [
|
|
897
|
-
dependencyName,
|
|
898
|
-
workspaceVersionByName.has(dependencyName) ? stableWorkspaceDependencySpec(dependencyName) : dependencySpec
|
|
899
|
-
])
|
|
900
|
-
);
|
|
901
|
-
if (JSON.stringify(rootEntry.workspaces ?? []) !== JSON.stringify(node.packageJson.workspaces)) {
|
|
902
|
-
rootEntry.workspaces = node.packageJson.workspaces;
|
|
903
|
-
packageEntries[""] = rootEntry;
|
|
904
|
-
changed = true;
|
|
905
|
-
}
|
|
906
|
-
for (const field of dependencyFields(node.packageJson)) {
|
|
907
|
-
const nextValue = node.packageJson[field];
|
|
908
|
-
if (nextValue && typeof nextValue === "object" && !Array.isArray(nextValue)) {
|
|
909
|
-
const currentValue = rootEntry[field];
|
|
910
|
-
const currentDeps = currentValue && typeof currentValue === "object" && !Array.isArray(currentValue) ? currentValue : {};
|
|
911
|
-
const mergedDeps = { ...currentDeps };
|
|
912
|
-
let fieldChanged = false;
|
|
913
|
-
for (const [dependencyName, dependencySpec] of Object.entries(nextValue)) {
|
|
914
|
-
if (mergedDeps[dependencyName] === dependencySpec) continue;
|
|
915
|
-
mergedDeps[dependencyName] = dependencySpec;
|
|
916
|
-
fieldChanged = true;
|
|
917
|
-
}
|
|
918
|
-
if (fieldChanged) {
|
|
919
|
-
rootEntry[field] = mergedDeps;
|
|
920
|
-
packageEntries[""] = rootEntry;
|
|
921
|
-
changed = true;
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
for (const workspacePackage of workspacePackageList) {
|
|
926
|
-
const relativeDir = workspacePackage.relativeDir.replace(/\\/gu, "/");
|
|
927
|
-
const packageJson = workspacePackage.packageJson;
|
|
928
|
-
const packageName = String(packageJson.name ?? "");
|
|
929
|
-
if (!packageName) continue;
|
|
930
|
-
const packageEntry = packageEntries[relativeDir] ?? {};
|
|
931
|
-
if (packageEntry.name !== packageName) {
|
|
932
|
-
packageEntry.name = packageName;
|
|
933
|
-
changed = true;
|
|
934
|
-
}
|
|
935
|
-
if (typeof packageJson.version === "string" && packageEntry.version !== packageJson.version) {
|
|
936
|
-
packageEntry.version = packageJson.version;
|
|
937
|
-
changed = true;
|
|
938
|
-
}
|
|
939
|
-
for (const field of dependencyFields(packageJson)) {
|
|
940
|
-
const nextValue = packageJson[field];
|
|
941
|
-
if (nextValue && typeof nextValue === "object" && !Array.isArray(nextValue)) {
|
|
942
|
-
const normalizedValue = normalizeWorkspaceDependencySpecs(nextValue);
|
|
943
|
-
if (JSON.stringify(packageEntry[field] ?? {}) !== JSON.stringify(normalizedValue)) {
|
|
944
|
-
packageEntry[field] = normalizedValue;
|
|
945
|
-
changed = true;
|
|
946
|
-
}
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
packageEntries[relativeDir] = packageEntry;
|
|
950
|
-
const linkKey = `node_modules/${packageName}`;
|
|
951
|
-
const linkEntry = packageEntries[linkKey] ?? {};
|
|
952
|
-
if (linkEntry.resolved !== relativeDir) {
|
|
953
|
-
linkEntry.resolved = relativeDir;
|
|
954
|
-
changed = true;
|
|
955
|
-
}
|
|
956
|
-
if (linkEntry.link !== true) {
|
|
957
|
-
linkEntry.link = true;
|
|
958
|
-
changed = true;
|
|
959
|
-
}
|
|
960
|
-
packageEntries[linkKey] = linkEntry;
|
|
961
|
-
}
|
|
962
|
-
if (!changed) return false;
|
|
963
|
-
lockfile.packages = packageEntries;
|
|
964
|
-
writeJson(lockfilePath, lockfile);
|
|
965
|
-
emitProgress(options, node, "lockfile", "Synchronized root workspace lockfile metadata before validation.");
|
|
966
|
-
return true;
|
|
967
|
-
}
|
|
968
|
-
async function runGitDependencySmoke(node, options, reference) {
|
|
969
|
-
void node;
|
|
970
|
-
void options;
|
|
971
|
-
void reference;
|
|
972
|
-
}
|
|
973
|
-
async function runNpmInstallWithRetry(node, options, gitDependencyRefreshSpecs = []) {
|
|
974
|
-
if (shouldSkipNetworkInstall() || options.deferPushUntilVerified === true) {
|
|
975
|
-
const reason = options.deferPushUntilVerified === true ? "atomic-save" : "disabled";
|
|
976
|
-
emitProgress(options, node, "install", `Skipped npm install because ${reason === "atomic-save" ? "atomic save validates local lock metadata before publishing commits" : "network install mode is disabled"}.`);
|
|
977
|
-
return { status: "skipped", attempts: 0, reason };
|
|
978
|
-
}
|
|
979
|
-
let lastError = null;
|
|
980
|
-
const packageJson = node.packageJson ?? (existsSync(resolve(node.path, "package.json")) ? readJson(resolve(node.path, "package.json")) : null);
|
|
981
|
-
const rootWorkspaceInstall = node.path === options.root && Array.isArray(packageJson?.workspaces);
|
|
982
|
-
if (!rootWorkspaceInstall && node.branchMode !== "project-save") {
|
|
983
|
-
validateStandaloneGitDependencyLockfile(node, options);
|
|
984
|
-
return { status: "completed", attempts: 1, reason: "isolated-lockfile-validation" };
|
|
985
|
-
}
|
|
986
|
-
const installFlags = rootWorkspaceInstall ? ["--package-lock-only", "--ignore-scripts"] : node.branchMode === "project-save" ? ["--ignore-scripts"] : ["--package-lock-only", "--ignore-scripts"];
|
|
987
|
-
const args = rootWorkspaceInstall ? gitDependencyRefreshSpecs.length > 0 ? ["install", ...gitDependencyRefreshSpecs, ...installFlags, "--force"] : ["install", ...installFlags] : gitDependencyRefreshSpecs.length > 0 ? ["install", ...gitDependencyRefreshSpecs, ...installFlags, "--force", "--workspaces=false"] : ["install", ...installFlags, "--workspaces=false"];
|
|
988
|
-
for (let attempt = 1; attempt <= 5; attempt += 1) {
|
|
989
|
-
emitProgress(options, node, "install", `npm ${args.join(" ")} attempt ${attempt}/5.`);
|
|
990
|
-
try {
|
|
991
|
-
await runStreamingCommand(node, options, "install", "npm", args);
|
|
992
|
-
return { status: "completed", attempts: attempt, reason: null };
|
|
993
|
-
} catch (error) {
|
|
994
|
-
lastError = error instanceof Error ? error.message : String(error);
|
|
995
|
-
}
|
|
996
|
-
if (attempt < 5) {
|
|
997
|
-
emitProgress(options, node, "install", "npm install failed; retrying in 60 seconds.", "stderr");
|
|
998
|
-
await sleepMs(6e4);
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
throw new RepositorySaveError(`npm install failed after 5 attempts.
|
|
1002
|
-
${lastError ?? ""}`);
|
|
1003
|
-
}
|
|
1004
|
-
async function runProjectVerificationInstallWithRetry(node, options) {
|
|
1005
|
-
if (!hasNpmLockfile(node.path)) return;
|
|
1006
|
-
if (shouldSkipNetworkInstall()) {
|
|
1007
|
-
emitProgress(options, node, "install", "Skipped project verification dependency install because network install mode is disabled.");
|
|
1008
|
-
return;
|
|
1009
|
-
}
|
|
1010
|
-
let lastError = null;
|
|
1011
|
-
const packageJson = node.packageJson ?? (existsSync(resolve(node.path, "package.json")) ? readJson(resolve(node.path, "package.json")) : null);
|
|
1012
|
-
const rootWorkspaceInstall = node.path === options.root && Array.isArray(packageJson?.workspaces);
|
|
1013
|
-
if (rootWorkspaceInstall) {
|
|
1014
|
-
emitProgress(options, node, "install", "Skipped root npm ci project verification install; lockfile plan and restored workspace links provide save-time dependency proof.");
|
|
1015
|
-
return;
|
|
1016
|
-
}
|
|
1017
|
-
const args = rootWorkspaceInstall ? ["ci"] : ["ci", "--workspaces=false"];
|
|
1018
|
-
for (let attempt = 1; attempt <= 5; attempt += 1) {
|
|
1019
|
-
emitProgress(options, node, "install", `npm ${args.join(" ")} for project verification attempt ${attempt}/5.`);
|
|
1020
|
-
try {
|
|
1021
|
-
await runStreamingCommand(node, options, "install", "npm", args);
|
|
1022
|
-
return;
|
|
1023
|
-
} catch (error) {
|
|
1024
|
-
lastError = error instanceof Error ? error.message : String(error);
|
|
1025
|
-
}
|
|
1026
|
-
if (attempt < 5) {
|
|
1027
|
-
emitProgress(options, node, "install", "npm ci for verification failed; retrying in 60 seconds.", "stderr");
|
|
1028
|
-
await sleepMs(6e4);
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
throw new RepositorySaveError(`Project verification dependency install failed after 5 attempts.
|
|
1032
|
-
${lastError ?? ""}`);
|
|
1033
|
-
}
|
|
1034
|
-
function lockfileValidationCommand(node, options) {
|
|
1035
|
-
const packageJson = node.packageJson ?? (existsSync(resolve(node.path, "package.json")) ? readJson(resolve(node.path, "package.json")) : null);
|
|
1036
|
-
const rootWorkspaceInstall = node.path === options.root && Array.isArray(packageJson?.workspaces);
|
|
1037
|
-
const args = rootWorkspaceInstall ? ["ci", "--ignore-scripts", "--plan"] : ["ci", "--ignore-scripts", "--plan", "--workspaces=false"];
|
|
1038
|
-
return { command: "npm", args };
|
|
1039
|
-
}
|
|
1040
|
-
function lockfileValidationTimeoutMs(node, options) {
|
|
1041
|
-
const packageJson = node.packageJson ?? (existsSync(resolve(node.path, "package.json")) ? readJson(resolve(node.path, "package.json")) : null);
|
|
1042
|
-
const rootWorkspaceInstall = node.path === options.root && Array.isArray(packageJson?.workspaces);
|
|
1043
|
-
return rootWorkspaceInstall ? 18e5 : 6e5;
|
|
1044
|
-
}
|
|
1045
|
-
async function validateRepositoryLockfile(node, options) {
|
|
1046
|
-
if (!hasNpmLockfile(node.path)) {
|
|
1047
|
-
return { status: "skipped", command: null, issues: [], error: "no npm lockfile" };
|
|
1048
|
-
}
|
|
1049
|
-
syncRootWorkspaceLockfileMetadata(node, options);
|
|
1050
|
-
const issues = collectDeploymentLockfileWorkspaceIssues(node.path).map((issue) => `${issue.filePath}: ${issue.packageName} ${issue.reason}`);
|
|
1051
|
-
if (issues.length > 0) {
|
|
1052
|
-
throw new RepositorySaveError([
|
|
1053
|
-
`Lockfile validation failed for ${node.name}.`,
|
|
1054
|
-
...issues
|
|
1055
|
-
].join("\n"), {
|
|
1056
|
-
details: {
|
|
1057
|
-
failingRepo: node.name,
|
|
1058
|
-
phase: "lockfile",
|
|
1059
|
-
issues
|
|
1060
|
-
}
|
|
1061
|
-
});
|
|
1062
|
-
}
|
|
1063
|
-
const { command, args } = lockfileValidationCommand(node, options);
|
|
1064
|
-
const commandText = `${command} ${args.join(" ")}`;
|
|
1065
|
-
if (shouldSkipNetworkInstall() || options.deferPushUntilVerified === true) {
|
|
1066
|
-
const reason = options.deferPushUntilVerified === true ? "atomic-save" : "disabled";
|
|
1067
|
-
emitProgress(options, node, "lockfile", `Validated lockfile structure without ${commandText} because ${reason === "atomic-save" ? "upstream commits are intentionally unpublished" : "network install mode is disabled"}.`);
|
|
1068
|
-
return { status: "passed", command: "treeseed structural lockfile validation", issues: [], error: null };
|
|
1069
|
-
}
|
|
1070
|
-
try {
|
|
1071
|
-
runCapturedCommand(node, options, "lockfile", command, args, { timeoutMs: lockfileValidationTimeoutMs(node, options), emitOutputOnSuccess: false });
|
|
1072
|
-
const packageCount = npmLockfilePackageCount(node.path);
|
|
1073
|
-
const countText = packageCount === null ? "package-lock entries" : `${packageCount} package${packageCount === 1 ? "" : "s"}`;
|
|
1074
|
-
emitProgress(options, node, "lockfile", `Lockfile validation passed: ${countText} checked, 0 issues.`);
|
|
1075
|
-
return { status: "passed", command: commandText, issues: [], error: null };
|
|
1076
|
-
} catch (error) {
|
|
1077
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
1078
|
-
const result = { status: "failed", command: commandText, issues: [message], error: message };
|
|
1079
|
-
throw new RepositorySaveError([
|
|
1080
|
-
`Lockfile validation failed for ${node.name}.`,
|
|
1081
|
-
`Command: ${commandText}`,
|
|
1082
|
-
message
|
|
1083
|
-
].join("\n"), {
|
|
1084
|
-
details: {
|
|
1085
|
-
failingRepo: node.name,
|
|
1086
|
-
phase: "lockfile",
|
|
1087
|
-
command: commandText,
|
|
1088
|
-
issues: result.issues
|
|
1089
|
-
}
|
|
1090
|
-
});
|
|
1091
|
-
}
|
|
1092
|
-
}
|
|
1093
|
-
function hasScript(node, scriptName) {
|
|
1094
|
-
return typeof node.scripts[scriptName] === "string" && node.scripts[scriptName].length > 0;
|
|
1095
|
-
}
|
|
1096
|
-
function manifestVerifyCommand(node, key) {
|
|
1097
|
-
return node.manifestVerifyCommands[key] ?? null;
|
|
1098
|
-
}
|
|
1099
|
-
function hasAnyVerificationCommand(node) {
|
|
1100
|
-
return hasScript(node, "verify:action") || hasScript(node, "verify:local") || hasScript(node, "verify") || Boolean(manifestVerifyCommand(node, "local")) || Boolean(manifestVerifyCommand(node, "fast"));
|
|
1101
|
-
}
|
|
1102
|
-
async function runScript(node, options, scriptName) {
|
|
1103
|
-
await runStreamingCommand(node, options, "verify", "npm", ["run", scriptName]);
|
|
1104
|
-
}
|
|
1105
|
-
async function runManifestVerifyCommand(node, options, verifyMode, key) {
|
|
1106
|
-
const manifestCommand = manifestVerifyCommand(node, key);
|
|
1107
|
-
if (!manifestCommand) {
|
|
1108
|
-
throw new RepositorySaveError(`${node.name} is missing a ${key} verification command in treeseed.package.yaml.`);
|
|
1109
|
-
}
|
|
1110
|
-
const command = `${manifestCommand.command} ${manifestCommand.args.join(" ")}`;
|
|
1111
|
-
const cacheInput = {
|
|
1112
|
-
workspaceRoot: options.root,
|
|
1113
|
-
repoName: node.name,
|
|
1114
|
-
repoPath: node.path,
|
|
1115
|
-
command,
|
|
1116
|
-
verifyMode,
|
|
1117
|
-
env: process.env
|
|
1118
|
-
};
|
|
1119
|
-
const cached = readTreeseedVerificationCache(cacheInput);
|
|
1120
|
-
if (cached) {
|
|
1121
|
-
emitProgress(options, node, "verify", `[verify][cache] Reused ${node.name} ${manifestCommand.label} for ${cached.headSha.slice(0, 12)}.`);
|
|
1122
|
-
return { cached: true };
|
|
1123
|
-
}
|
|
1124
|
-
const started = Date.now();
|
|
1125
|
-
await runStreamingCommand(node, options, "verify", manifestCommand.command, manifestCommand.args, { cwd: manifestCommand.cwd });
|
|
1126
|
-
writeTreeseedVerificationCache(cacheInput, Date.now() - started);
|
|
1127
|
-
return { cached: false };
|
|
1128
|
-
}
|
|
1129
|
-
async function runCachedScript(node, options, verifyMode, scriptName) {
|
|
1130
|
-
const command = `npm run ${scriptName}`;
|
|
1131
|
-
const cacheInput = {
|
|
1132
|
-
workspaceRoot: options.root,
|
|
1133
|
-
repoName: node.name,
|
|
1134
|
-
repoPath: node.path,
|
|
1135
|
-
command,
|
|
1136
|
-
verifyMode,
|
|
1137
|
-
env: process.env
|
|
1138
|
-
};
|
|
1139
|
-
const cached = readTreeseedVerificationCache(cacheInput);
|
|
1140
|
-
if (cached) {
|
|
1141
|
-
emitProgress(options, node, "verify", `[verify][cache] Reused ${node.name} ${scriptName} for ${cached.headSha.slice(0, 12)}.`);
|
|
1142
|
-
return { cached: true };
|
|
1143
|
-
}
|
|
1144
|
-
const started = Date.now();
|
|
1145
|
-
await runScript(node, options, scriptName);
|
|
1146
|
-
writeTreeseedVerificationCache(cacheInput, Date.now() - started);
|
|
1147
|
-
return { cached: false };
|
|
1148
|
-
}
|
|
1149
|
-
async function runRepoVerification(node, options, verifyMode) {
|
|
1150
|
-
if (verifyMode === "skip") {
|
|
1151
|
-
emitProgress(options, node, "verify", "Skipped verification by request.");
|
|
1152
|
-
return { mode: verifyMode, status: "skipped", primary: null, fallbackUsed: false, error: null };
|
|
1153
|
-
}
|
|
1154
|
-
if (node.kind !== "package" && !hasAnyVerificationCommand(node)) {
|
|
1155
|
-
emitProgress(options, node, "verify", "Skipped verification because project repository does not declare a Treeseed verify script.");
|
|
1156
|
-
return { mode: verifyMode, status: "skipped", primary: null, fallbackUsed: false, error: null };
|
|
1157
|
-
}
|
|
1158
|
-
await runProjectVerificationInstallWithRetry(node, options);
|
|
1159
|
-
if (verifyMode === "local-only") {
|
|
1160
|
-
if (hasScript(node, "verify:local")) {
|
|
1161
|
-
await runCachedScript(node, options, verifyMode, "verify:local");
|
|
1162
|
-
return { mode: verifyMode, status: "passed", primary: "verify:local", fallbackUsed: false, error: null };
|
|
1163
|
-
}
|
|
1164
|
-
if (manifestVerifyCommand(node, "local")) {
|
|
1165
|
-
await runManifestVerifyCommand(node, options, verifyMode, "local");
|
|
1166
|
-
return { mode: verifyMode, status: "passed", primary: "manifest:local", fallbackUsed: false, error: null };
|
|
1167
|
-
}
|
|
1168
|
-
if (manifestVerifyCommand(node, "fast")) {
|
|
1169
|
-
await runManifestVerifyCommand(node, options, verifyMode, "fast");
|
|
1170
|
-
return { mode: verifyMode, status: "passed", primary: "manifest:fast", fallbackUsed: false, error: null };
|
|
1171
|
-
}
|
|
1172
|
-
if (!hasScript(node, "verify:local")) {
|
|
1173
|
-
throw new RepositorySaveError(`${node.kind === "package" ? "Package" : "Project"} ${node.name} is missing required verify:local script.`);
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
if (!hasAnyVerificationCommand(node)) {
|
|
1177
|
-
throw new RepositorySaveError(`${node.kind === "package" ? "Package" : "Project"} ${node.name} is missing required verify:action, verify:local, or verify script.`);
|
|
1178
|
-
}
|
|
1179
|
-
if (hasScript(node, "verify:action")) {
|
|
1180
|
-
try {
|
|
1181
|
-
await runCachedScript(node, options, verifyMode, "verify:action");
|
|
1182
|
-
return { mode: verifyMode, status: "passed", primary: "verify:action", fallbackUsed: false, error: null };
|
|
1183
|
-
} catch (error) {
|
|
1184
|
-
if (!hasScript(node, "verify:local")) {
|
|
1185
|
-
throw error;
|
|
1186
|
-
}
|
|
1187
|
-
emitProgress(options, node, "verify", "verify:action failed; falling back to verify:local.", "stderr");
|
|
1188
|
-
await runCachedScript(node, options, verifyMode, "verify:local");
|
|
1189
|
-
return {
|
|
1190
|
-
mode: verifyMode,
|
|
1191
|
-
status: "passed",
|
|
1192
|
-
primary: "verify:action",
|
|
1193
|
-
fallbackUsed: true,
|
|
1194
|
-
error: error instanceof Error ? error.message : String(error)
|
|
1195
|
-
};
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
if (hasScript(node, "verify:local")) {
|
|
1199
|
-
await runCachedScript(node, options, verifyMode, "verify:local");
|
|
1200
|
-
return { mode: verifyMode, status: "passed", primary: "verify:local", fallbackUsed: true, error: null };
|
|
1201
|
-
}
|
|
1202
|
-
if (manifestVerifyCommand(node, "local")) {
|
|
1203
|
-
await runManifestVerifyCommand(node, options, verifyMode, "local");
|
|
1204
|
-
return { mode: verifyMode, status: "passed", primary: "manifest:local", fallbackUsed: true, error: null };
|
|
1205
|
-
}
|
|
1206
|
-
if (manifestVerifyCommand(node, "fast")) {
|
|
1207
|
-
await runManifestVerifyCommand(node, options, verifyMode, "fast");
|
|
1208
|
-
return { mode: verifyMode, status: "passed", primary: "manifest:fast", fallbackUsed: true, error: null };
|
|
1209
|
-
}
|
|
1210
|
-
await runCachedScript(node, options, verifyMode, "verify");
|
|
1211
|
-
return { mode: verifyMode, status: "passed", primary: "verify:local", fallbackUsed: true, error: null };
|
|
1212
|
-
}
|
|
1213
|
-
function pullRebaseFromOrigin(node, options, branch) {
|
|
1214
|
-
if (!remoteBranchExistsSafe(node.path, branch)) {
|
|
1215
|
-
emitProgress(options, node, "rebase", `Skipped pull --rebase because origin/${branch} does not exist.`);
|
|
1216
|
-
return {
|
|
1217
|
-
remoteBranchExisted: false,
|
|
1218
|
-
pulledRebase: false
|
|
1219
|
-
};
|
|
1220
|
-
}
|
|
1221
|
-
try {
|
|
1222
|
-
runCapturedCommand(node, options, "rebase", "git", ["fetch", "origin", `refs/heads/${branch}:refs/remotes/origin/${branch}`]);
|
|
1223
|
-
runCapturedCommand(node, options, "rebase", "git", ["rebase", `refs/remotes/origin/${branch}`]);
|
|
1224
|
-
return {
|
|
1225
|
-
remoteBranchExisted: true,
|
|
1226
|
-
pulledRebase: true
|
|
1227
|
-
};
|
|
1228
|
-
} catch (error) {
|
|
1229
|
-
const report = collectMergeConflictReport(node.path);
|
|
1230
|
-
throw new RepositorySaveError(formatMergeConflictReport(report, node.path, branch), {
|
|
1231
|
-
exitCode: 12,
|
|
1232
|
-
details: { branch, report, originalError: error instanceof Error ? error.message : String(error) }
|
|
1233
|
-
});
|
|
1234
|
-
}
|
|
1235
|
-
}
|
|
1236
|
-
function pushCurrentBranch(node, options, branch, tagName) {
|
|
1237
|
-
ensureWritableRemote(node, options);
|
|
1238
|
-
const remoteBranchExists2 = remoteBranchExistsSafe(node.path, branch);
|
|
1239
|
-
let pushedTag = false;
|
|
1240
|
-
const args = remoteBranchExists2 ? ["push", "origin", branch] : ["push", "-u", "origin", branch];
|
|
1241
|
-
if (tagName) {
|
|
1242
|
-
const state = tagState(node.path, tagName);
|
|
1243
|
-
assertTagStateMatchesHead(node, tagName, state, headCommit(node.path));
|
|
1244
|
-
if (!state.remoteExists) {
|
|
1245
|
-
args.push(tagName);
|
|
1246
|
-
pushedTag = true;
|
|
1247
|
-
}
|
|
1248
|
-
}
|
|
1249
|
-
runCapturedCommand(node, options, "push", "git", args);
|
|
1250
|
-
return {
|
|
1251
|
-
createdRemoteBranch: !remoteBranchExists2,
|
|
1252
|
-
pushed: true,
|
|
1253
|
-
pushedTag,
|
|
1254
|
-
combinedBranchAndTagPush: pushedTag
|
|
1255
|
-
};
|
|
1256
|
-
}
|
|
1257
|
-
async function finishRepositorySavePublish(node, options, state, report, input) {
|
|
1258
|
-
const reference = input.reference ?? null;
|
|
1259
|
-
const tagName = input.tagName ?? reference?.tagName ?? null;
|
|
1260
|
-
const shouldDeferPush = options.deferPushUntilVerified === true;
|
|
1261
|
-
if (shouldDeferPush) {
|
|
1262
|
-
state.deferredPushes.push({
|
|
1263
|
-
node,
|
|
1264
|
-
report,
|
|
1265
|
-
branch: input.branch,
|
|
1266
|
-
tagName,
|
|
1267
|
-
rebase: input.rebase,
|
|
1268
|
-
reference
|
|
1269
|
-
});
|
|
1270
|
-
report.pushed = false;
|
|
1271
|
-
report.publishWait = {
|
|
1272
|
-
...input.rebase,
|
|
1273
|
-
deferredPush: true
|
|
1274
|
-
};
|
|
1275
|
-
return;
|
|
1276
|
-
}
|
|
1277
|
-
const push = pushCurrentBranch(node, options, input.branch, tagName);
|
|
1278
|
-
if (reference) {
|
|
1279
|
-
await runGitDependencySmoke(node, options, reference);
|
|
1280
|
-
report.dependencySpec = reference.spec;
|
|
1281
|
-
}
|
|
1282
|
-
report.pushed = push.pushed;
|
|
1283
|
-
report.publishWait = {
|
|
1284
|
-
...input.rebase,
|
|
1285
|
-
...push
|
|
1286
|
-
};
|
|
1287
|
-
}
|
|
1288
|
-
async function publishDeferredRepositoryPushes(options, state) {
|
|
1289
|
-
if (state.deferredPushes.length === 0) return;
|
|
1290
|
-
for (const deferred of state.deferredPushes) {
|
|
1291
|
-
const push = pushCurrentBranch(deferred.node, options, deferred.branch, deferred.tagName);
|
|
1292
|
-
if (deferred.reference) {
|
|
1293
|
-
await runGitDependencySmoke(deferred.node, options, deferred.reference);
|
|
1294
|
-
deferred.report.dependencySpec = deferred.reference.spec;
|
|
1295
|
-
}
|
|
1296
|
-
deferred.report.pushed = push.pushed;
|
|
1297
|
-
deferred.report.publishWait = {
|
|
1298
|
-
...deferred.rebase,
|
|
1299
|
-
...push,
|
|
1300
|
-
deferredPush: true
|
|
1301
|
-
};
|
|
1302
|
-
}
|
|
1303
|
-
state.deferredPushes = [];
|
|
1304
|
-
}
|
|
1305
|
-
function tagExists(repoDir, tagName) {
|
|
1306
|
-
try {
|
|
1307
|
-
runGit(["rev-parse", "--verify", `refs/tags/${tagName}`], { cwd: repoDir, capture: true });
|
|
1308
|
-
return true;
|
|
1309
|
-
} catch {
|
|
1310
|
-
return false;
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
function localTagCommit(repoDir, tagName) {
|
|
1314
|
-
try {
|
|
1315
|
-
return runGit(["rev-list", "-n", "1", tagName], { cwd: repoDir, capture: true }).trim();
|
|
1316
|
-
} catch {
|
|
1317
|
-
return null;
|
|
1318
|
-
}
|
|
1319
|
-
}
|
|
1320
|
-
function remoteTagCommit(repoDir, tagName) {
|
|
1321
|
-
try {
|
|
1322
|
-
const output = runGit(["ls-remote", "--tags", "origin", `refs/tags/${tagName}*`], { cwd: repoDir, capture: true });
|
|
1323
|
-
const lines = output.split(/\r?\n/u).map((line) => line.trim()).filter(Boolean);
|
|
1324
|
-
const dereferenced = lines.find((line) => line.endsWith(`refs/tags/${tagName}^{}`));
|
|
1325
|
-
const exact = lines.find((line) => line.endsWith(`refs/tags/${tagName}`));
|
|
1326
|
-
const selected = dereferenced ?? exact;
|
|
1327
|
-
return selected ? selected.split(/\s+/u)[0] ?? null : null;
|
|
1328
|
-
} catch {
|
|
1329
|
-
return null;
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
function localTagMessage(repoDir, tagName) {
|
|
1333
|
-
try {
|
|
1334
|
-
return runGit(["tag", "-l", tagName, "--format=%(contents)"], { cwd: repoDir, capture: true }).trim();
|
|
1335
|
-
} catch {
|
|
1336
|
-
return null;
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
function tagState(repoDir, tagName) {
|
|
1340
|
-
const localCommit = localTagCommit(repoDir, tagName);
|
|
1341
|
-
const remoteCommit = remoteTagCommit(repoDir, tagName);
|
|
1342
|
-
return {
|
|
1343
|
-
tagName,
|
|
1344
|
-
localExists: localCommit != null,
|
|
1345
|
-
localCommit,
|
|
1346
|
-
remoteExists: remoteCommit != null,
|
|
1347
|
-
remoteCommit
|
|
1348
|
-
};
|
|
1349
|
-
}
|
|
1350
|
-
function assertTagStateMatchesHead(node, tagName, state, head) {
|
|
1351
|
-
if (state.localCommit && state.localCommit !== head) {
|
|
1352
|
-
throw new RepositorySaveError(`Package ${node.name} tag ${tagName} points to ${state.localCommit.slice(0, 12)}, but ${node.name} HEAD is ${head.slice(0, 12)}. Refusing to move an existing tag.`, {
|
|
1353
|
-
details: {
|
|
1354
|
-
failingRepo: node.name,
|
|
1355
|
-
phase: "tag",
|
|
1356
|
-
currentVersion: tagName,
|
|
1357
|
-
expectedTag: tagName,
|
|
1358
|
-
tagState: state
|
|
1359
|
-
}
|
|
1360
|
-
});
|
|
1361
|
-
}
|
|
1362
|
-
if (state.remoteCommit && state.remoteCommit !== head) {
|
|
1363
|
-
throw new RepositorySaveError(`Remote tag ${tagName} for ${node.name} points to ${state.remoteCommit.slice(0, 12)}, but ${node.name} HEAD is ${head.slice(0, 12)}. Refusing to move an existing tag.`, {
|
|
1364
|
-
details: {
|
|
1365
|
-
failingRepo: node.name,
|
|
1366
|
-
phase: "tag",
|
|
1367
|
-
currentVersion: tagName,
|
|
1368
|
-
expectedTag: tagName,
|
|
1369
|
-
tagState: state
|
|
1370
|
-
}
|
|
1371
|
-
});
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
function createPackageTagMessage(node, tagName, branch, workflowRunId) {
|
|
1375
|
-
void branch;
|
|
1376
|
-
void workflowRunId;
|
|
1377
|
-
return `release: ${tagName}`;
|
|
1378
|
-
}
|
|
1379
|
-
function ensureRemoteAccessBeforeVerification(node, options, state) {
|
|
1380
|
-
if (shouldSkipRemoteAccessPreflight()) return;
|
|
1381
|
-
if (state.remoteAccessChecked.has(node.path)) return;
|
|
1382
|
-
ensureWritableRemote(node, options);
|
|
1383
|
-
const writeUrl = remoteWriteUrl(node.path) ?? "origin";
|
|
1384
|
-
emitProgress(options, node, "preflight", `Checking write remote access before verification (${writeUrl}).`);
|
|
1385
|
-
try {
|
|
1386
|
-
runQuietCommand(node, "preflight", "git", ["ls-remote", "--heads", writeUrl], { timeoutMs: 3e4 });
|
|
1387
|
-
state.remoteAccessChecked.add(node.path);
|
|
1388
|
-
} catch (error) {
|
|
1389
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
1390
|
-
throw new RepositorySaveError([
|
|
1391
|
-
`Cannot access origin remote for ${node.name}; save would fail after verification when pushing branch or tags.`,
|
|
1392
|
-
"Fix Git authentication, then rerun `npx trsd save` to resume.",
|
|
1393
|
-
detail
|
|
1394
|
-
].join("\n"), {
|
|
1395
|
-
exitCode: 13,
|
|
1396
|
-
details: {
|
|
1397
|
-
failingRepo: node.name,
|
|
1398
|
-
phase: "preflight",
|
|
1399
|
-
originalError: detail
|
|
1400
|
-
}
|
|
1401
|
-
});
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
function shouldSkipRemoteAccessPreflight() {
|
|
1405
|
-
return process.env.TREESEED_SAVE_REMOTE_PREFLIGHT === "skip";
|
|
1406
|
-
}
|
|
1407
|
-
function ensurePackageTagReady(node, options, tagName, branch, workflowRunId) {
|
|
1408
|
-
let message = null;
|
|
1409
|
-
ensureWritableRemote(node, options);
|
|
1410
|
-
const head = headCommit(node.path);
|
|
1411
|
-
let state = tagState(node.path, tagName);
|
|
1412
|
-
assertTagStateMatchesHead(node, tagName, state, head);
|
|
1413
|
-
if (!state.localExists && state.remoteExists && state.remoteCommit === head) {
|
|
1414
|
-
runCapturedCommand(node, options, "tag", "git", ["fetch", "origin", `refs/tags/${tagName}:refs/tags/${tagName}`]);
|
|
1415
|
-
state = tagState(node.path, tagName);
|
|
1416
|
-
assertTagStateMatchesHead(node, tagName, state, head);
|
|
1417
|
-
}
|
|
1418
|
-
if (!state.localExists) {
|
|
1419
|
-
message = createPackageTagMessage(node, tagName, branch, workflowRunId);
|
|
1420
|
-
runCapturedCommand(node, options, "tag", "git", ["tag", "-a", tagName, "-m", message]);
|
|
1421
|
-
state = tagState(node.path, tagName);
|
|
1422
|
-
assertTagStateMatchesHead(node, tagName, state, head);
|
|
1423
|
-
}
|
|
1424
|
-
if (state.remoteExists) {
|
|
1425
|
-
emitProgress(options, node, "tag", `Remote tag ${tagName} already points at HEAD.`);
|
|
1426
|
-
}
|
|
1427
|
-
return message;
|
|
1428
|
-
}
|
|
1429
|
-
function treeCommitForPath(repoDir, ref, path) {
|
|
1430
|
-
try {
|
|
1431
|
-
const output = runGit(["ls-tree", ref, "--", path], { cwd: repoDir, capture: true }).trim();
|
|
1432
|
-
const match = output.match(/^\d+\s+commit\s+([0-9a-f]{40})\t/u);
|
|
1433
|
-
return match?.[1] ?? null;
|
|
1434
|
-
} catch {
|
|
1435
|
-
return null;
|
|
1436
|
-
}
|
|
1437
|
-
}
|
|
1438
|
-
function collectSubmodulePointerChanges(node, finalizedCommits) {
|
|
1439
|
-
const changes = [];
|
|
1440
|
-
for (const [repoName, finalizedCommit] of finalizedCommits.entries()) {
|
|
1441
|
-
const childRelativePath = node.id === "." ? repoName : repoName.startsWith(`${node.id}/`) ? repoName.slice(node.id.length + 1) : null;
|
|
1442
|
-
if (!childRelativePath) continue;
|
|
1443
|
-
const childPath = resolve(node.path, childRelativePath);
|
|
1444
|
-
if (!existsSync(childPath) || !isGitRepo(childPath)) continue;
|
|
1445
|
-
const status = runGit(["status", "--porcelain", "--", childRelativePath], { cwd: node.path, capture: true });
|
|
1446
|
-
const oldSha = treeCommitForPath(node.path, "HEAD", childRelativePath);
|
|
1447
|
-
const newSha = finalizedCommit || headCommit(childPath);
|
|
1448
|
-
if (status.trim().length > 0 || oldSha && newSha && oldSha !== newSha) {
|
|
1449
|
-
changes.push({
|
|
1450
|
-
path: childRelativePath,
|
|
1451
|
-
oldSha,
|
|
1452
|
-
newSha
|
|
1453
|
-
});
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
return changes;
|
|
1457
|
-
}
|
|
1458
|
-
function commitContextDependencyUpdates(updates) {
|
|
1459
|
-
return updates.map((update) => ({
|
|
1460
|
-
packageName: update.packageName,
|
|
1461
|
-
field: update.field,
|
|
1462
|
-
from: update.from,
|
|
1463
|
-
to: update.to,
|
|
1464
|
-
tagName: update.tagName
|
|
1465
|
-
}));
|
|
1466
|
-
}
|
|
1467
|
-
function commitContextPackageChanges(node, state, submodulePointers) {
|
|
1468
|
-
const pointersByPath = new Map(submodulePointers.map((pointer) => [pointer.path, pointer]));
|
|
1469
|
-
const changes = [];
|
|
1470
|
-
for (const [relativePath, report] of state.reports.entries()) {
|
|
1471
|
-
if (relativePath === node.id || relativePath === ".") continue;
|
|
1472
|
-
const childRelativePath = node.id === "." ? relativePath : relativePath.startsWith(`${node.id}/`) ? relativePath.slice(node.id.length + 1) : null;
|
|
1473
|
-
if (!childRelativePath) continue;
|
|
1474
|
-
const pointer = pointersByPath.get(childRelativePath);
|
|
1475
|
-
if (!pointer && !report.committed && !report.tagName && !report.dependencySpec) continue;
|
|
1476
|
-
changes.push({
|
|
1477
|
-
name: report.name,
|
|
1478
|
-
path: childRelativePath,
|
|
1479
|
-
oldSha: pointer?.oldSha ?? null,
|
|
1480
|
-
newSha: pointer?.newSha ?? report.commitSha,
|
|
1481
|
-
tagName: report.tagName,
|
|
1482
|
-
version: report.version,
|
|
1483
|
-
dependencySpec: report.dependencySpec,
|
|
1484
|
-
commitSubject: commitSubject(report.commitMessage)
|
|
1485
|
-
});
|
|
1486
|
-
if (pointer) {
|
|
1487
|
-
pointer.packageName = report.name;
|
|
1488
|
-
}
|
|
1489
|
-
}
|
|
1490
|
-
return changes;
|
|
1491
|
-
}
|
|
1492
|
-
function syncBranchBeforeSave(node, options, branch) {
|
|
1493
|
-
checkoutOrCreateBranch(node, options, branch);
|
|
1494
|
-
}
|
|
1495
|
-
function refreshRepositoryNodePackageMetadata(node) {
|
|
1496
|
-
const packageJsonPath = resolve(node.path, "package.json");
|
|
1497
|
-
const packageJson = existsSync(packageJsonPath) ? readJson(packageJsonPath) : null;
|
|
1498
|
-
node.packageJsonPath = packageJson ? packageJsonPath : null;
|
|
1499
|
-
node.packageJson = packageJson;
|
|
1500
|
-
node.scripts = packageScripts(packageJson);
|
|
1501
|
-
node.remoteUrl = originRemoteUrlSafe(node.path);
|
|
1502
|
-
if (node.kind === "package" && packageJson) {
|
|
1503
|
-
node.name = repoDisplayName(node.path, packageJson);
|
|
1504
|
-
}
|
|
1505
|
-
}
|
|
1506
|
-
function finalizePackageReference(node, version, options) {
|
|
1507
|
-
const reference = createPackageDependencyReference({
|
|
1508
|
-
packageName: node.name,
|
|
1509
|
-
version,
|
|
1510
|
-
branchMode: node.branchMode === "package-release-main" ? "package-release-main" : "package-dev-save",
|
|
1511
|
-
remoteUrl: node.remoteUrl,
|
|
1512
|
-
commitSha: headCommit(node.path),
|
|
1513
|
-
devDependencyReferenceMode: options.devDependencyReferenceMode ?? "git-commit",
|
|
1514
|
-
gitDependencyProtocol: options.gitDependencyProtocol ?? "preserve-origin"
|
|
1515
|
-
});
|
|
1516
|
-
node.plannedDependencySpec = reference.spec;
|
|
1517
|
-
return reference;
|
|
1518
|
-
}
|
|
1519
|
-
async function finalizeCleanPackageVersion(node, options, state, report, branch) {
|
|
1520
|
-
const version = typeof node.packageJson?.version === "string" ? node.packageJson.version : null;
|
|
1521
|
-
if (!version || !packageVersionEligibleForBranch(node, version, options)) {
|
|
1522
|
-
return false;
|
|
1523
|
-
}
|
|
1524
|
-
const head = headCommit(node.path);
|
|
1525
|
-
const reference = finalizePackageReference(node, version, options);
|
|
1526
|
-
const currentTagState = reference.tagName ? tagState(node.path, reference.tagName) : null;
|
|
1527
|
-
if (reference.tagName && currentTagState) {
|
|
1528
|
-
assertTagStateMatchesHead(node, reference.tagName, currentTagState, head);
|
|
1529
|
-
}
|
|
1530
|
-
const remoteBranchExists2 = remoteBranchExistsSafe(node.path, branch);
|
|
1531
|
-
const remoteBranchCommit = remoteBranchCommitSafe(node.path, branch);
|
|
1532
|
-
const finalizedRemotely = remoteBranchExists2 && remoteBranchCommit === head && (!reference.tagName || currentTagState?.localCommit === head && currentTagState?.remoteCommit === head);
|
|
1533
|
-
report.version = version;
|
|
1534
|
-
report.tagName = reference.tagName;
|
|
1535
|
-
report.commitSha = head;
|
|
1536
|
-
report.dependencySpec = reference.spec;
|
|
1537
|
-
state.finalizedVersions.set(node.name, version);
|
|
1538
|
-
state.finalizedReferences.set(node.name, reference);
|
|
1539
|
-
state.finalizedCommits.set(node.relativePath, head);
|
|
1540
|
-
if (finalizedRemotely) {
|
|
1541
|
-
report.pushed = true;
|
|
1542
|
-
report.skippedReason = "already-finalized";
|
|
1543
|
-
report.publishWait = { recoveredPartialSave: true, remoteBranchExisted: true, tagAlreadyPushed: Boolean(reference.tagName) };
|
|
1544
|
-
emitProgress(options, node, "finalize", `Using existing finalized package version ${version}.`);
|
|
1545
|
-
return true;
|
|
1546
|
-
}
|
|
1547
|
-
emitProgress(options, node, "finalize", `Finalizing interrupted package version ${version}.`);
|
|
1548
|
-
if (hasNpmLockfile(node.path)) {
|
|
1549
|
-
report.install = await runNpmInstallWithRetry(node, options);
|
|
1550
|
-
report.lockfileValidation = await validateRepositoryLockfile(node, options);
|
|
1551
|
-
}
|
|
1552
|
-
const rebase = pullRebaseFromOrigin(node, options, branch);
|
|
1553
|
-
ensureRemoteAccessBeforeVerification(node, options, state);
|
|
1554
|
-
report.verification = await runRepoVerification(node, options, options.verifyMode ?? "action-first");
|
|
1555
|
-
report.verified = report.verification.status === "passed";
|
|
1556
|
-
const tagMessage = reference.tagName ? ensurePackageTagReady(node, options, reference.tagName, branch, options.workflowRunId) : null;
|
|
1557
|
-
void tagMessage;
|
|
1558
|
-
report.dependencySpec = reference.spec;
|
|
1559
|
-
report.skippedReason = "finalized-partial-save";
|
|
1560
|
-
report.commitSha = headCommit(node.path);
|
|
1561
|
-
state.finalizedCommits.set(node.relativePath, report.commitSha);
|
|
1562
|
-
await finishRepositorySavePublish(node, options, state, report, {
|
|
1563
|
-
branch,
|
|
1564
|
-
rebase: {
|
|
1565
|
-
...rebase,
|
|
1566
|
-
recoveredPartialSave: true
|
|
1567
|
-
},
|
|
1568
|
-
reference,
|
|
1569
|
-
tagName: reference.tagName
|
|
1570
|
-
});
|
|
1571
|
-
return true;
|
|
1572
|
-
}
|
|
1573
|
-
function branchModeLabel(branchMode) {
|
|
1574
|
-
switch (branchMode) {
|
|
1575
|
-
case "package-release-main":
|
|
1576
|
-
return "stable package release";
|
|
1577
|
-
case "package-dev-save":
|
|
1578
|
-
return "dev package save";
|
|
1579
|
-
case "project-save":
|
|
1580
|
-
return "project save";
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
function repoPlanCommands(node, options, plannedVersion, plannedDependencySpec, dependencyUpdates) {
|
|
1584
|
-
const branch = node.branch || options.branch;
|
|
1585
|
-
const remoteExists = remoteBranchExistsSafe(node.path, branch);
|
|
1586
|
-
const commands = [
|
|
1587
|
-
checkoutCommandFor(node.path, branch)
|
|
1588
|
-
];
|
|
1589
|
-
const sshPushUrl = (options.gitRemoteWriteMode ?? "ssh-pushurl") === "off" ? null : sshPushUrlForRemote(node.remoteUrl);
|
|
1590
|
-
if (sshPushUrl) {
|
|
1591
|
-
commands.push(`git remote set-url --push origin ${sshPushUrl} # keep ${node.remoteUrl} for reads`);
|
|
1592
|
-
}
|
|
1593
|
-
if (dependencyUpdates.length > 0) {
|
|
1594
|
-
commands.push(`update package.json internal dependencies: ${dependencyUpdates.join(", ")}`);
|
|
1595
|
-
}
|
|
1596
|
-
if (node.submoduleDependencies.length > 0) {
|
|
1597
|
-
commands.push(`refresh submodule pointers: ${node.submoduleDependencies.join(", ")}`);
|
|
1598
|
-
}
|
|
1599
|
-
const packageJson = node.packageJson ?? (existsSync(resolve(node.path, "package.json")) ? readJson(resolve(node.path, "package.json")) : null);
|
|
1600
|
-
const rootWorkspaceInstall = node.path === options.root && Array.isArray(packageJson?.workspaces);
|
|
1601
|
-
if (node.kind === "package" && plannedVersion) {
|
|
1602
|
-
commands.push(`update package.json version to ${plannedVersion}`);
|
|
1603
|
-
commands.push("npm install --workspaces=false # explicitly refresh changed git commit dependencies with --force; retry up to 5 times with 60s delay");
|
|
1604
|
-
} else if (node.kind === "project" && (dependencyUpdates.length > 0 || rootWorkspaceInstall && node.submoduleDependencies.length > 0) && hasNpmLockfile(node.path)) {
|
|
1605
|
-
commands.push(rootWorkspaceInstall ? "npm install --package-lock-only --ignore-scripts # refresh root workspace lockfile without installing git dependencies" : "npm install --workspaces=false # refresh project lockfile after internal dependency updates");
|
|
1606
|
-
}
|
|
1607
|
-
if (hasNpmLockfile(node.path) && (node.kind === "project" || plannedVersion || dependencyUpdates.length > 0 || node.submoduleDependencies.length > 0)) {
|
|
1608
|
-
commands.push(rootWorkspaceInstall ? "npm ci --ignore-scripts --plan # validate root manifest, workspaces, and lockfile before commit" : "npm ci --ignore-scripts --plan --workspaces=false # validate deployment lockfile before commit");
|
|
1609
|
-
}
|
|
1610
|
-
commands.push("git add -A");
|
|
1611
|
-
commands.push("generate commit message # Cloudflare AI when configured, fallback otherwise");
|
|
1612
|
-
commands.push("git commit -m <generated-message>");
|
|
1613
|
-
commands.push(
|
|
1614
|
-
remoteExists ? `git pull --rebase --recurse-submodules=no origin ${branch}` : `skip pull --rebase # origin/${branch} does not exist yet`
|
|
1615
|
-
);
|
|
1616
|
-
const verifyMode = options.verifyMode ?? "action-first";
|
|
1617
|
-
if (verifyMode === "skip") {
|
|
1618
|
-
commands.push(node.kind === "package" ? "skip package verification" : "skip project verification");
|
|
1619
|
-
} else if (hasScript(node, "verify:action") || hasScript(node, "verify:local") || hasScript(node, "verify")) {
|
|
1620
|
-
if (verifyMode === "local-only") {
|
|
1621
|
-
commands.push("npm run verify:local");
|
|
1622
|
-
} else if (hasScript(node, "verify:action")) {
|
|
1623
|
-
commands.push("npm run verify:action # fallback to npm run verify:local on failure");
|
|
1624
|
-
} else if (hasScript(node, "verify:local")) {
|
|
1625
|
-
commands.push("npm run verify:local");
|
|
1626
|
-
} else {
|
|
1627
|
-
commands.push("npm run verify");
|
|
1628
|
-
}
|
|
1629
|
-
} else if (manifestVerifyCommand(node, "local") || manifestVerifyCommand(node, "fast")) {
|
|
1630
|
-
const command = verifyMode === "local-only" ? manifestVerifyCommand(node, "local") ?? manifestVerifyCommand(node, "fast") : manifestVerifyCommand(node, "local") ?? manifestVerifyCommand(node, "fast");
|
|
1631
|
-
if (command) commands.push(`${command.command} ${command.args.join(" ")} # treeseed.package.yaml verification`);
|
|
1632
|
-
} else if (node.kind !== "package") {
|
|
1633
|
-
commands.push("skip verification # project repository has no Treeseed verify script");
|
|
1634
|
-
}
|
|
1635
|
-
if (node.kind === "package") {
|
|
1636
|
-
const plansTag = plannedVersion && node.branchMode === "package-release-main";
|
|
1637
|
-
if (plannedVersion && plansTag) {
|
|
1638
|
-
commands.push(`git tag -a ${plannedVersion} -m <release>`);
|
|
1639
|
-
commands.push(remoteExists ? `git push origin ${branch} ${plannedVersion}` : `git push -u origin ${branch} ${plannedVersion}`);
|
|
1640
|
-
} else if (plannedVersion) {
|
|
1641
|
-
commands.push(remoteExists ? `git push origin ${branch}` : `git push -u origin ${branch}`);
|
|
1642
|
-
if (plannedDependencySpec && node.branchMode === "package-dev-save") {
|
|
1643
|
-
commands.push(`npm install ${node.name}@${plannedDependencySpec} --package-lock-only --ignore-scripts --force # validate dependency commit reachability`);
|
|
1644
|
-
}
|
|
1645
|
-
} else {
|
|
1646
|
-
commands.push(remoteExists ? `git push origin ${branch}` : `git push -u origin ${branch}`);
|
|
1647
|
-
}
|
|
1648
|
-
} else {
|
|
1649
|
-
commands.push(remoteExists ? `git push origin ${branch}` : `git push -u origin ${branch}`);
|
|
1650
|
-
}
|
|
1651
|
-
return commands;
|
|
1652
|
-
}
|
|
1653
|
-
function planRepositorySave(options) {
|
|
1654
|
-
const scope = options.branch === STAGING_BRANCH ? "staging" : options.branch === PRODUCTION_BRANCH ? "prod" : "local";
|
|
1655
|
-
const allNodes = discoverRepositorySaveNodes(options.root, options.gitRoot, options.branch, {
|
|
1656
|
-
stablePackageRelease: options.stablePackageRelease === true
|
|
1657
|
-
});
|
|
1658
|
-
const nodes = options.includeRoot === false ? allNodes.filter((node) => node.id !== ".") : allNodes;
|
|
1659
|
-
const mode = nodes.some((node) => node.id !== ".") ? "recursive-workspace" : "root-only";
|
|
1660
|
-
const waves = repositorySaveWaves(nodes);
|
|
1661
|
-
const plannedVersions = /* @__PURE__ */ new Map();
|
|
1662
|
-
const plannedReferences = /* @__PURE__ */ new Map();
|
|
1663
|
-
const plans = /* @__PURE__ */ new Map();
|
|
1664
|
-
for (const wave of waves) {
|
|
1665
|
-
for (const node of wave) {
|
|
1666
|
-
const dependencyUpdates = node.dependencies.map((id) => nodes.find((candidate) => candidate.id === id)).filter((candidate) => Boolean(candidate)).map((dependency) => {
|
|
1667
|
-
const reference = plannedReferences.get(dependency.name);
|
|
1668
|
-
return reference ? `${dependency.name} -> ${reference.spec}` : null;
|
|
1669
|
-
}).filter((value) => Boolean(value));
|
|
1670
|
-
const dependencyChanged = dependencyUpdates.length > 0;
|
|
1671
|
-
const submoduleChanged = node.submoduleDependencies.length > 0 && node.submoduleDependencies.some((id) => {
|
|
1672
|
-
const dependency = plans.get(id);
|
|
1673
|
-
return dependency?.dirty || Boolean(dependency?.plannedVersion);
|
|
1674
|
-
});
|
|
1675
|
-
const dirty = hasMeaningfulChanges(node.path);
|
|
1676
|
-
const packageNeedsVersion = canManagePackageJsonVersion(node) && (dirty || dependencyChanged || submoduleChanged);
|
|
1677
|
-
const currentVersion = typeof node.packageJson?.version === "string" ? node.packageJson.version : null;
|
|
1678
|
-
const plannedVersion = packageNeedsVersion ? selectPackageVersion(node, options).version : null;
|
|
1679
|
-
let plannedDependencySpec = null;
|
|
1680
|
-
if (node.kind === "package" && plannedVersion) {
|
|
1681
|
-
const reference = createPackageDependencyReference({
|
|
1682
|
-
packageName: node.name,
|
|
1683
|
-
version: plannedVersion,
|
|
1684
|
-
branchMode: node.branchMode === "package-release-main" ? "package-release-main" : "package-dev-save",
|
|
1685
|
-
remoteUrl: node.remoteUrl,
|
|
1686
|
-
commitSha: headCommitOrPlanPlaceholder(node.path),
|
|
1687
|
-
devDependencyReferenceMode: options.devDependencyReferenceMode ?? "git-commit",
|
|
1688
|
-
gitDependencyProtocol: options.gitDependencyProtocol ?? "preserve-origin"
|
|
1689
|
-
});
|
|
1690
|
-
plannedDependencySpec = reference.spec;
|
|
1691
|
-
plannedVersions.set(node.name, plannedVersion);
|
|
1692
|
-
plannedReferences.set(node.name, reference);
|
|
1693
|
-
}
|
|
1694
|
-
const current = currentBranch(node.path) || null;
|
|
1695
|
-
const branch = node.branch || options.branch;
|
|
1696
|
-
const notes = [
|
|
1697
|
-
`${branchModeLabel(node.branchMode)} on top-level ${options.branch}`,
|
|
1698
|
-
...current && current !== branch ? [`current branch ${current} will be switched to ${branch}`] : [],
|
|
1699
|
-
...node.kind === "package" && plannedVersion?.includes("-dev.") ? ["development and staging dependency refs use the package commit SHA; no Git tag is created"] : []
|
|
1700
|
-
];
|
|
1701
|
-
const repoPlan = {
|
|
1702
|
-
id: node.id,
|
|
1703
|
-
name: node.name,
|
|
1704
|
-
path: node.path,
|
|
1705
|
-
relativePath: node.relativePath,
|
|
1706
|
-
kind: node.kind,
|
|
1707
|
-
currentBranch: current,
|
|
1708
|
-
targetBranch: branch,
|
|
1709
|
-
branchMode: node.branchMode,
|
|
1710
|
-
dirty,
|
|
1711
|
-
dependencies: node.dependencies,
|
|
1712
|
-
dependents: node.dependents,
|
|
1713
|
-
submoduleDependencies: node.submoduleDependencies,
|
|
1714
|
-
currentVersion,
|
|
1715
|
-
plannedVersion,
|
|
1716
|
-
plannedTag: plannedReferences.get(node.name)?.tagName ?? null,
|
|
1717
|
-
plannedDependencySpec,
|
|
1718
|
-
remoteUrl: node.remoteUrl,
|
|
1719
|
-
commands: repoPlanCommands(node, options, plannedVersion, plannedDependencySpec, dependencyUpdates),
|
|
1720
|
-
notes
|
|
1721
|
-
};
|
|
1722
|
-
plans.set(node.id, repoPlan);
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1725
|
-
const rootNode = nodes.find((node) => node.id === ".") ?? allNodes.find((node) => node.id === ".");
|
|
1726
|
-
const rootRepo = rootNode ? plans.get(rootNode.id) : null;
|
|
1727
|
-
if (!rootRepo) {
|
|
1728
|
-
throw new RepositorySaveError("Unable to build repository save plan for root repository.");
|
|
1729
|
-
}
|
|
1730
|
-
const repoPlans = nodes.filter((node) => node.id !== ".").sort(compareNodes).map((node) => plans.get(node.id)).filter((plan) => Boolean(plan));
|
|
1731
|
-
const wavePlans = waves.map((wave, index) => ({
|
|
1732
|
-
index: index + 1,
|
|
1733
|
-
parallel: wave.length > 1,
|
|
1734
|
-
repos: wave.map((node) => node.name),
|
|
1735
|
-
commands: wave.map((node) => ({
|
|
1736
|
-
repo: node.name,
|
|
1737
|
-
commands: plans.get(node.id)?.commands ?? []
|
|
1738
|
-
}))
|
|
1739
|
-
}));
|
|
1740
|
-
return {
|
|
1741
|
-
mode,
|
|
1742
|
-
branch: options.branch,
|
|
1743
|
-
scope,
|
|
1744
|
-
devDependencyReferenceMode: options.devDependencyReferenceMode ?? "git-commit",
|
|
1745
|
-
gitDependencyProtocol: options.gitDependencyProtocol ?? "preserve-origin",
|
|
1746
|
-
verifyMode: options.verifyMode ?? "action-first",
|
|
1747
|
-
commitMessageMode: options.commitMessageMode ?? "auto",
|
|
1748
|
-
repos: repoPlans,
|
|
1749
|
-
rootRepo,
|
|
1750
|
-
waves: wavePlans,
|
|
1751
|
-
plannedVersions: Object.fromEntries(plannedVersions.entries()),
|
|
1752
|
-
plannedSteps: wavePlans.flatMap((wave) => wave.commands.map((entry) => ({
|
|
1753
|
-
id: `wave-${wave.index}-${entry.repo}`,
|
|
1754
|
-
description: `Wave ${wave.index}${wave.parallel ? " parallel" : ""}: ${entry.repo}`
|
|
1755
|
-
})))
|
|
1756
|
-
};
|
|
1757
|
-
}
|
|
1758
|
-
async function refreshAndValidateRootWorkspaceLockfileForSave(options) {
|
|
1759
|
-
const repoDir = options.gitRoot ?? options.root;
|
|
1760
|
-
const packageJsonPath = resolve(repoDir, "package.json");
|
|
1761
|
-
const packageJson = existsSync(packageJsonPath) ? readJson(packageJsonPath) : null;
|
|
1762
|
-
const node = {
|
|
1763
|
-
id: ".",
|
|
1764
|
-
name: repoDisplayName(repoDir, packageJson),
|
|
1765
|
-
path: repoDir,
|
|
1766
|
-
relativePath: ".",
|
|
1767
|
-
kind: "project",
|
|
1768
|
-
branch: options.branch ?? currentBranch(repoDir) ?? null,
|
|
1769
|
-
branchMode: "project-save",
|
|
1770
|
-
packageJsonPath: packageJson ? packageJsonPath : null,
|
|
1771
|
-
packageJson,
|
|
1772
|
-
scripts: packageScripts(packageJson),
|
|
1773
|
-
manifestVerifyCommands: emptyManifestVerifyCommands(),
|
|
1774
|
-
remoteUrl: originRemoteUrlSafe(repoDir),
|
|
1775
|
-
dependencies: [],
|
|
1776
|
-
dependents: [],
|
|
1777
|
-
submoduleDependencies: [],
|
|
1778
|
-
plannedVersion: null,
|
|
1779
|
-
plannedTag: null,
|
|
1780
|
-
plannedDependencySpec: null
|
|
1781
|
-
};
|
|
1782
|
-
if (!hasNpmLockfile(repoDir)) {
|
|
1783
|
-
return {
|
|
1784
|
-
install: null,
|
|
1785
|
-
lockfileValidation: { status: "skipped", command: null, issues: [], error: "no npm lockfile" }
|
|
1786
|
-
};
|
|
1787
|
-
}
|
|
1788
|
-
const install = await runNpmInstallWithRetry(node, { root: options.root, onProgress: options.onProgress });
|
|
1789
|
-
const lockfileValidation = await validateRepositoryLockfile(node, { root: options.root, onProgress: options.onProgress });
|
|
1790
|
-
return { install, lockfileValidation };
|
|
1791
|
-
}
|
|
1792
|
-
async function saveOneRepository(node, options, state) {
|
|
1793
|
-
const report = state.reports.get(node.id) ?? createReport(node);
|
|
1794
|
-
state.reports.set(node.id, report);
|
|
1795
|
-
const branch = node.branch || options.branch;
|
|
1796
|
-
emitProgress(options, node, "start", `Starting ${node.branchMode} on ${branch}.`);
|
|
1797
|
-
syncBranchBeforeSave(node, options, branch);
|
|
1798
|
-
node.branch = currentBranch(node.path) || branch;
|
|
1799
|
-
report.branch = node.branch;
|
|
1800
|
-
refreshRepositoryNodePackageMetadata(node);
|
|
1801
|
-
ensureWritableRemote(node, options);
|
|
1802
|
-
const dependencyUpdates = isRootWorkspaceRepository(node, options) ? [] : updateDependencyReferences(node, state.finalizedReferences);
|
|
1803
|
-
const dependencyChanged = dependencyUpdates.length > 0;
|
|
1804
|
-
const directDependencyNames = new Set(dependencyFields(node.packageJson ?? {}).flatMap((field) => {
|
|
1805
|
-
const value = node.packageJson?.[field];
|
|
1806
|
-
return value && typeof value === "object" && !Array.isArray(value) ? Object.keys(value) : [];
|
|
1807
|
-
}));
|
|
1808
|
-
const gitDependencyRefreshReferences = [...state.finalizedReferences.values()].filter((reference) => reference.mode === "dev-git-commit" && directDependencyNames.has(reference.packageName));
|
|
1809
|
-
const deferredGitDependencyValidation = options.deferPushUntilVerified === true && gitDependencyRefreshReferences.length > 0;
|
|
1810
|
-
const lockfileGitDependenciesSynced = syncDirectGitDependencyLockfileEntries(node, options, gitDependencyRefreshReferences);
|
|
1811
|
-
if (!isRootWorkspaceRepository(node, options) && (lockfileGitDependenciesSynced || gitDependencyRefreshReferences.length > 0 && !existsSync(resolve(node.path, "package-lock.json"))) && !deferredGitDependencyValidation) {
|
|
1812
|
-
validateStandaloneGitDependencyLockfile(node, options);
|
|
1813
|
-
}
|
|
1814
|
-
const gitDependencyRefreshSpecs = lockfileGitDependenciesSynced ? [] : gitDependencyRefreshReferences.map((reference) => `${reference.packageName}@${reference.installSpec ?? reference.spec}`);
|
|
1815
|
-
const submodulePointers = collectSubmodulePointerChanges(node, state.finalizedCommits);
|
|
1816
|
-
const submodulesChanged = submodulePointers.length > 0;
|
|
1817
|
-
const packageHasMeaningfulChanges = hasMeaningfulChanges(node.path);
|
|
1818
|
-
const packageNeedsVersion = canManagePackageJsonVersion(node) && (packageHasMeaningfulChanges || dependencyChanged || submodulesChanged || packageVersionTagConflictsWithHead(node, options));
|
|
1819
|
-
let plannedVersion = null;
|
|
1820
|
-
if (packageNeedsVersion) {
|
|
1821
|
-
const selection = selectPackageVersion(node, options);
|
|
1822
|
-
plannedVersion = selection.version;
|
|
1823
|
-
if (!plannedVersion) {
|
|
1824
|
-
throw new RepositorySaveError(`Unable to plan package version for ${node.name}.`);
|
|
1825
|
-
}
|
|
1826
|
-
if (selection.reused) {
|
|
1827
|
-
emitProgress(options, node, "version", `Reusing existing interrupted save version ${plannedVersion}.`);
|
|
1828
|
-
} else {
|
|
1829
|
-
emitProgress(options, node, "version", `Planned ${plannedVersion}.`);
|
|
1830
|
-
}
|
|
1831
|
-
applyPackageVersion(node, plannedVersion);
|
|
1832
|
-
node.plannedVersion = plannedVersion;
|
|
1833
|
-
report.version = plannedVersion;
|
|
1834
|
-
const reference = finalizePackageReference(node, plannedVersion, options);
|
|
1835
|
-
node.plannedTag = reference.tagName;
|
|
1836
|
-
report.tagName = reference.tagName;
|
|
1837
|
-
report.dependencySpec = reference.spec;
|
|
1838
|
-
report.install = await runNpmInstallWithRetry(node, options, gitDependencyRefreshSpecs);
|
|
1839
|
-
} else if (node.kind === "package") {
|
|
1840
|
-
report.version = String(node.packageJson?.version ?? report.version ?? "");
|
|
1841
|
-
} else if (node.kind === "project" && (dependencyChanged || node.path === options.root && submodulesChanged) && hasNpmLockfile(node.path)) {
|
|
1842
|
-
report.install = await runNpmInstallWithRetry(node, options, gitDependencyRefreshSpecs);
|
|
1843
|
-
}
|
|
1844
|
-
if (!isRootWorkspaceRepository(node, options) && hasNpmLockfile(node.path) && (packageNeedsVersion || dependencyChanged) && !deferredGitDependencyValidation) {
|
|
1845
|
-
validateStandaloneGitDependencyLockfile(node, options);
|
|
1846
|
-
}
|
|
1847
|
-
if (hasNpmLockfile(node.path) && (node.kind === "project" || packageNeedsVersion || dependencyChanged || submodulesChanged)) {
|
|
1848
|
-
const lockfileIssues = collectDeploymentLockfileWorkspaceIssues(node.path);
|
|
1849
|
-
if (node.kind === "project" && lockfileIssues.length > 0 && !shouldSkipNetworkInstall()) {
|
|
1850
|
-
emitProgress(options, node, "lockfile", "Refreshing package-lock.json before validation.");
|
|
1851
|
-
report.install = await runNpmInstallWithRetry(node, options, gitDependencyRefreshSpecs);
|
|
1852
|
-
}
|
|
1853
|
-
report.lockfileValidation = await validateRepositoryLockfile(node, options);
|
|
1854
|
-
}
|
|
1855
|
-
const dirty = hasMeaningfulChanges(node.path);
|
|
1856
|
-
report.dirty = dirty;
|
|
1857
|
-
if (!dirty) {
|
|
1858
|
-
report.skippedReason = "clean";
|
|
1859
|
-
report.commitSha = headCommit(node.path);
|
|
1860
|
-
emitProgress(options, node, "clean", "No meaningful changes to commit.");
|
|
1861
|
-
if (node.kind === "package") {
|
|
1862
|
-
const finalized = await finalizeCleanPackageVersion(node, options, state, report, branch);
|
|
1863
|
-
if (finalized) {
|
|
1864
|
-
return report;
|
|
1865
|
-
}
|
|
1866
|
-
}
|
|
1867
|
-
if (node.kind === "project" || node.kind === "package" && !canManagePackageJsonVersion(node)) {
|
|
1868
|
-
const rebase2 = pullRebaseFromOrigin(node, options, branch);
|
|
1869
|
-
await finishRepositorySavePublish(node, options, state, report, { branch, rebase: rebase2 });
|
|
1870
|
-
report.commitSha = headCommit(node.path);
|
|
1871
|
-
}
|
|
1872
|
-
state.finalizedCommits.set(node.relativePath, report.commitSha);
|
|
1873
|
-
return report;
|
|
1874
|
-
}
|
|
1875
|
-
runCapturedCommand(node, options, "commit", "git", ["add", "-A"]);
|
|
1876
|
-
if (!hasStagedChanges(node.path)) {
|
|
1877
|
-
report.dirty = false;
|
|
1878
|
-
report.skippedReason = "clean-after-add";
|
|
1879
|
-
report.commitSha = headCommit(node.path);
|
|
1880
|
-
emitProgress(options, node, "clean", "No staged changes to commit after refreshing the index.");
|
|
1881
|
-
if (node.kind === "package") {
|
|
1882
|
-
const finalized = await finalizeCleanPackageVersion(node, options, state, report, branch);
|
|
1883
|
-
if (finalized) {
|
|
1884
|
-
return report;
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
if (node.kind === "project" || node.kind === "package" && !canManagePackageJsonVersion(node)) {
|
|
1888
|
-
const rebase2 = pullRebaseFromOrigin(node, options, branch);
|
|
1889
|
-
await finishRepositorySavePublish(node, options, state, report, { branch, rebase: rebase2 });
|
|
1890
|
-
report.commitSha = headCommit(node.path);
|
|
1891
|
-
}
|
|
1892
|
-
state.finalizedCommits.set(node.relativePath, report.commitSha);
|
|
1893
|
-
return report;
|
|
1894
|
-
}
|
|
1895
|
-
const { changedFiles, diff } = gitDiffSummary(node.path);
|
|
1896
|
-
emitProgress(options, node, "message", "Generating commit message.");
|
|
1897
|
-
const messageResult = await commitMessageFor(node, options, {
|
|
1898
|
-
changedFiles,
|
|
1899
|
-
diff,
|
|
1900
|
-
plannedVersion: plannedVersion ?? report.version,
|
|
1901
|
-
plannedTag: node.plannedTag ?? report.tagName,
|
|
1902
|
-
dependencyUpdates: commitContextDependencyUpdates(dependencyUpdates),
|
|
1903
|
-
submodulePointers,
|
|
1904
|
-
packageChanges: commitContextPackageChanges(node, state, submodulePointers)
|
|
1905
|
-
});
|
|
1906
|
-
report.commitMessage = messageResult.message;
|
|
1907
|
-
report.commitMessageProvider = messageResult.provider;
|
|
1908
|
-
report.commitMessageFallbackUsed = messageResult.fallbackUsed;
|
|
1909
|
-
report.commitMessageError = messageResult.error;
|
|
1910
|
-
emitProgress(options, node, "message", `${messageResult.provider}${messageResult.fallbackUsed ? " fallback" : ""}: ${messageResult.message.split(/\r?\n/u)[0]}`);
|
|
1911
|
-
try {
|
|
1912
|
-
runCapturedCommand(node, options, "commit", "git", ["commit", "-m", messageResult.message]);
|
|
1913
|
-
} catch (error) {
|
|
1914
|
-
if (!isNoOpGitCommitError(error) || hasMeaningfulChanges(node.path) || hasStagedChanges(node.path)) {
|
|
1915
|
-
throw error;
|
|
1916
|
-
}
|
|
1917
|
-
report.dirty = false;
|
|
1918
|
-
report.skippedReason = "clean-at-commit";
|
|
1919
|
-
report.commitSha = headCommit(node.path);
|
|
1920
|
-
emitProgress(options, node, "clean", "No changes remained to commit after Git refreshed the index.");
|
|
1921
|
-
if (node.kind === "package") {
|
|
1922
|
-
const finalized = await finalizeCleanPackageVersion(node, options, state, report, branch);
|
|
1923
|
-
if (finalized) {
|
|
1924
|
-
return report;
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
if (node.kind === "project" || node.kind === "package" && !canManagePackageJsonVersion(node)) {
|
|
1928
|
-
const rebase2 = pullRebaseFromOrigin(node, options, branch);
|
|
1929
|
-
await finishRepositorySavePublish(node, options, state, report, { branch, rebase: rebase2 });
|
|
1930
|
-
report.commitSha = headCommit(node.path);
|
|
1931
|
-
}
|
|
1932
|
-
state.finalizedCommits.set(node.relativePath, report.commitSha);
|
|
1933
|
-
return report;
|
|
1934
|
-
}
|
|
1935
|
-
report.committed = true;
|
|
1936
|
-
report.commitSha = headCommit(node.path);
|
|
1937
|
-
const rebase = pullRebaseFromOrigin(node, options, branch);
|
|
1938
|
-
const verifyMode = options.verifyMode ?? "action-first";
|
|
1939
|
-
if (node.kind === "project" && node.path === options.root && Array.isArray(node.packageJson?.workspaces)) {
|
|
1940
|
-
const linkReport = ensureLocalWorkspaceLinks(options.root);
|
|
1941
|
-
const restoredLinks = Array.isArray(linkReport.created) ? linkReport.created.length : 0;
|
|
1942
|
-
if (restoredLinks > 0) {
|
|
1943
|
-
emitProgress(options, node, "install", `Restored ${restoredLinks} local workspace package link${restoredLinks === 1 ? "" : "s"} before project verification.`);
|
|
1944
|
-
}
|
|
1945
|
-
}
|
|
1946
|
-
if (node.kind === "package") {
|
|
1947
|
-
ensureRemoteAccessBeforeVerification(node, options, state);
|
|
1948
|
-
}
|
|
1949
|
-
report.verification = await runRepoVerification(node, options, verifyMode);
|
|
1950
|
-
report.verified = report.verification.status === "passed";
|
|
1951
|
-
if (canManagePackageJsonVersion(node)) {
|
|
1952
|
-
const version = plannedVersion ?? String(readJson(resolve(node.path, "package.json")).version ?? report.version ?? "");
|
|
1953
|
-
const reference = finalizePackageReference(node, version, options);
|
|
1954
|
-
const tagMessage = reference.tagName ? ensurePackageTagReady(node, options, reference.tagName, branch, options.workflowRunId) : null;
|
|
1955
|
-
void tagMessage;
|
|
1956
|
-
report.tagName = reference.tagName;
|
|
1957
|
-
report.version = version;
|
|
1958
|
-
report.dependencySpec = reference.spec;
|
|
1959
|
-
state.finalizedVersions.set(node.name, version);
|
|
1960
|
-
state.finalizedReferences.set(node.name, reference);
|
|
1961
|
-
await finishRepositorySavePublish(node, options, state, report, { branch, rebase, reference, tagName: reference.tagName });
|
|
1962
|
-
} else {
|
|
1963
|
-
await finishRepositorySavePublish(node, options, state, report, { branch, rebase });
|
|
1964
|
-
}
|
|
1965
|
-
report.commitSha = headCommit(node.path);
|
|
1966
|
-
report.skippedReason = null;
|
|
1967
|
-
state.finalizedCommits.set(node.relativePath, report.commitSha);
|
|
1968
|
-
emitProgress(options, node, "done", `Saved ${report.commitSha?.slice(0, 12) ?? "current HEAD"}.`);
|
|
1969
|
-
return report;
|
|
1970
|
-
}
|
|
1971
|
-
async function runRepositorySaveOrchestrator(options) {
|
|
1972
|
-
const root = options.root;
|
|
1973
|
-
const gitRoot = options.gitRoot;
|
|
1974
|
-
const branch = options.branch;
|
|
1975
|
-
const scope = branch === STAGING_BRANCH ? "staging" : branch === PRODUCTION_BRANCH ? "prod" : "local";
|
|
1976
|
-
const allNodes = discoverRepositorySaveNodes(root, gitRoot, branch, {
|
|
1977
|
-
stablePackageRelease: options.stablePackageRelease === true
|
|
1978
|
-
});
|
|
1979
|
-
const nodes = options.includeRoot === false ? allNodes.filter((node) => node.id !== ".") : allNodes;
|
|
1980
|
-
const mode = nodes.some((node) => node.id !== ".") ? "recursive-workspace" : "root-only";
|
|
1981
|
-
const waves = repositorySaveWaves(nodes);
|
|
1982
|
-
const state = {
|
|
1983
|
-
finalizedVersions: /* @__PURE__ */ new Map(),
|
|
1984
|
-
finalizedReferences: /* @__PURE__ */ new Map(),
|
|
1985
|
-
finalizedCommits: /* @__PURE__ */ new Map(),
|
|
1986
|
-
reports: new Map(nodes.map((node) => [node.id, createReport(node)])),
|
|
1987
|
-
remoteAccessChecked: /* @__PURE__ */ new Set(),
|
|
1988
|
-
workflowGates: [],
|
|
1989
|
-
deferredPushes: []
|
|
1990
|
-
};
|
|
1991
|
-
const concurrency = repositorySaveConcurrency(options);
|
|
1992
|
-
for (const [index, wave] of waves.entries()) {
|
|
1993
|
-
await runLimited(wave, concurrency, async (node) => {
|
|
1994
|
-
try {
|
|
1995
|
-
await saveOneRepository(node, options, state);
|
|
1996
|
-
} catch (error) {
|
|
1997
|
-
const existing = repositorySaveErrorDetails(error);
|
|
1998
|
-
throw new RepositorySaveError(error instanceof Error ? error.message : String(error), {
|
|
1999
|
-
exitCode: existing.exitCode,
|
|
2000
|
-
details: {
|
|
2001
|
-
...existing.details ?? {},
|
|
2002
|
-
partialFailure: {
|
|
2003
|
-
message: `Treeseed save stopped while saving ${node.name}.`,
|
|
2004
|
-
failingRepo: node.name,
|
|
2005
|
-
phase: typeof existing.details?.phase === "string" ? existing.details.phase : null,
|
|
2006
|
-
currentVersion: typeof node.packageJson?.version === "string" ? node.packageJson.version : null,
|
|
2007
|
-
expectedTag: node.plannedTag,
|
|
2008
|
-
tagState: node.plannedTag ? tagState(node.path, node.plannedTag) : null,
|
|
2009
|
-
nextCommand: `treeseed resume ${options.workflowRunId ?? "<run-id>"}`,
|
|
2010
|
-
repos: [...state.reports.entries()].filter(([id]) => id !== ".").map(([, report]) => report),
|
|
2011
|
-
rootRepo: state.reports.get(".") ?? null,
|
|
2012
|
-
error: error instanceof Error ? error.message : String(error)
|
|
2013
|
-
}
|
|
2014
|
-
}
|
|
2015
|
-
});
|
|
2016
|
-
}
|
|
2017
|
-
});
|
|
2018
|
-
const waveReports = wave.map((node) => state.reports.get(node.id) ?? createReport(node));
|
|
2019
|
-
const allReports = [...state.reports.values()];
|
|
2020
|
-
let waveGates;
|
|
2021
|
-
try {
|
|
2022
|
-
waveGates = await options.onWaveSaved?.({
|
|
2023
|
-
index: index + 1,
|
|
2024
|
-
nodes: wave,
|
|
2025
|
-
reports: waveReports,
|
|
2026
|
-
allReports,
|
|
2027
|
-
rootRepo: state.reports.get(".") ?? null
|
|
2028
|
-
});
|
|
2029
|
-
} catch (error) {
|
|
2030
|
-
const existing = repositorySaveErrorDetails(error);
|
|
2031
|
-
const errorDetails = existing.details ?? (error && typeof error === "object" && "details" in error && error.details && typeof error.details === "object" ? error.details : void 0);
|
|
2032
|
-
const errorExitCode = existing.exitCode ?? (error && typeof error === "object" && "exitCode" in error && typeof error.exitCode === "number" ? error.exitCode : void 0);
|
|
2033
|
-
const gate = errorDetails?.gate;
|
|
2034
|
-
const failingRepo = gate && typeof gate === "object" && "name" in gate && typeof gate.name === "string" ? gate.name : wave.map((node) => node.name).join(", ");
|
|
2035
|
-
throw new RepositorySaveError(error instanceof Error ? error.message : String(error), {
|
|
2036
|
-
exitCode: errorExitCode,
|
|
2037
|
-
details: {
|
|
2038
|
-
...errorDetails ?? {},
|
|
2039
|
-
partialFailure: {
|
|
2040
|
-
message: `Treeseed save stopped while waiting for hosted gates after wave ${index + 1}.`,
|
|
2041
|
-
failingRepo,
|
|
2042
|
-
nextCommand: `treeseed resume ${options.workflowRunId ?? "<run-id>"}`,
|
|
2043
|
-
repos: allReports.filter((report) => report.name !== "@treeseed/market"),
|
|
2044
|
-
rootRepo: state.reports.get(".") ?? null,
|
|
2045
|
-
error: error instanceof Error ? error.message : String(error)
|
|
2046
|
-
}
|
|
2047
|
-
}
|
|
2048
|
-
});
|
|
2049
|
-
}
|
|
2050
|
-
if (Array.isArray(waveGates)) {
|
|
2051
|
-
state.workflowGates.push(...waveGates);
|
|
2052
|
-
}
|
|
2053
|
-
}
|
|
2054
|
-
await publishDeferredRepositoryPushes(options, state);
|
|
2055
|
-
const rootNode = nodes.find((node) => node.id === ".") ?? allNodes.find((node) => node.id === ".");
|
|
2056
|
-
const rootReport = rootNode ? state.reports.get(rootNode.id) ?? createReport(rootNode) : createReport({
|
|
2057
|
-
id: ".",
|
|
2058
|
-
name: "@treeseed/market",
|
|
2059
|
-
path: gitRoot,
|
|
2060
|
-
relativePath: ".",
|
|
2061
|
-
kind: "project",
|
|
2062
|
-
branch,
|
|
2063
|
-
branchMode: "project-save",
|
|
2064
|
-
packageJsonPath: null,
|
|
2065
|
-
packageJson: null,
|
|
2066
|
-
scripts: {},
|
|
2067
|
-
remoteUrl: null,
|
|
2068
|
-
dependencies: [],
|
|
2069
|
-
dependents: [],
|
|
2070
|
-
submoduleDependencies: [],
|
|
2071
|
-
plannedVersion: null,
|
|
2072
|
-
plannedTag: null,
|
|
2073
|
-
plannedDependencySpec: null
|
|
2074
|
-
});
|
|
2075
|
-
const packageReports = nodes.filter((node) => node.id !== ".").sort(compareNodes).map((node) => state.reports.get(node.id) ?? createReport(node));
|
|
2076
|
-
return {
|
|
2077
|
-
mode,
|
|
2078
|
-
branch,
|
|
2079
|
-
scope,
|
|
2080
|
-
repos: packageReports,
|
|
2081
|
-
rootRepo: rootReport,
|
|
2082
|
-
waves: waves.map((wave) => wave.map((node) => node.name)),
|
|
2083
|
-
plannedVersions: Object.fromEntries(state.finalizedVersions.entries()),
|
|
2084
|
-
workflowGates: state.workflowGates
|
|
2085
|
-
};
|
|
2086
|
-
}
|
|
2087
|
-
function repositorySaveErrorDetails(error) {
|
|
2088
|
-
if (error instanceof RepositorySaveError) {
|
|
2089
|
-
return {
|
|
2090
|
-
exitCode: error.exitCode,
|
|
2091
|
-
details: error.details
|
|
2092
|
-
};
|
|
2093
|
-
}
|
|
2094
|
-
return {
|
|
2095
|
-
exitCode: void 0,
|
|
2096
|
-
details: void 0
|
|
2097
|
-
};
|
|
2098
|
-
}
|
|
2099
|
-
export {
|
|
2100
|
-
applyPackageVersion,
|
|
2101
|
-
discoverRepositorySaveNodes,
|
|
2102
|
-
nextDevVersion,
|
|
2103
|
-
planRepositorySave,
|
|
2104
|
-
refreshAndValidateRootWorkspaceLockfileForSave,
|
|
2105
|
-
repositorySaveErrorDetails,
|
|
2106
|
-
repositorySaveWaves,
|
|
2107
|
-
runRepositorySaveOrchestrator,
|
|
2108
|
-
runStreamingCommand,
|
|
2109
|
-
validateStandaloneGitDependencyLockfile
|
|
2110
|
-
};
|