@bevel-software/platform-core-backend 0.35.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-guide/directory-structure.md +1 -1
- package/agent-guide/onboarding.md +111 -0
- package/agent-guide/start-here.md +1 -0
- package/agent-guide/tool-manuals.md +1 -0
- package/dist/core/catalog-cache-invalidation.d.ts +2 -2
- package/dist/core/catalog-cache-invalidation.d.ts.map +1 -1
- package/dist/core/compose-embed.d.ts +2 -2
- package/dist/core/compose-embed.d.ts.map +1 -1
- package/dist/core/compose-embed.js +1 -1
- package/dist/core/compose-embed.js.map +1 -1
- package/dist/core/core-ports.d.ts +19 -4
- package/dist/core/core-ports.d.ts.map +1 -1
- package/dist/core/core-ports.js.map +1 -1
- package/dist/core/create-core-server.d.ts.map +1 -1
- package/dist/core/create-core-server.js +26 -24
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +19 -13
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +72 -57
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/core/lifecycle.d.ts +4 -4
- package/dist/core/lifecycle.d.ts.map +1 -1
- package/dist/core/lifecycle.js +5 -5
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core-config.d.ts +2 -2
- package/dist/core-config.js +3 -3
- package/dist/core-config.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/access/access-control.service.js +1 -1
- package/dist/modules/access/access-control.service.js.map +1 -1
- package/dist/modules/access/access-declarations.d.ts +2 -2
- package/dist/modules/access/access-declarations.d.ts.map +1 -1
- package/dist/modules/access/access-declarations.js +2 -2
- package/dist/modules/access/access-declarations.js.map +1 -1
- package/dist/modules/access/access-mutation.service.d.ts +2 -2
- package/dist/modules/access/access-mutation.service.d.ts.map +1 -1
- package/dist/modules/access/access-mutation.service.js +2 -2
- package/dist/modules/access/access-mutation.service.js.map +1 -1
- package/dist/modules/access/access-requests.routes.d.ts +2 -2
- package/dist/modules/access/access-requests.routes.d.ts.map +1 -1
- package/dist/modules/access/access-requests.routes.js +5 -5
- package/dist/modules/access/access-requests.routes.js.map +1 -1
- package/dist/modules/access/access-requests.service.d.ts +2 -2
- package/dist/modules/access/access-requests.service.d.ts.map +1 -1
- package/dist/modules/access/access-requests.service.js +11 -11
- package/dist/modules/access/access-requests.service.js.map +1 -1
- package/dist/modules/access/access.routes.d.ts +2 -2
- package/dist/modules/access/access.routes.d.ts.map +1 -1
- package/dist/modules/access/access.routes.js +9 -9
- package/dist/modules/access/access.routes.js.map +1 -1
- package/dist/modules/access/admin-locked-commit.d.ts +5 -5
- package/dist/modules/access/admin-locked-commit.d.ts.map +1 -1
- package/dist/modules/access/admin-locked-commit.js +7 -7
- package/dist/modules/access/admin-locked-commit.js.map +1 -1
- package/dist/modules/access/admin-route-helpers.d.ts +1 -1
- package/dist/modules/access/admin-route-helpers.js +5 -5
- package/dist/modules/access/admin-route-helpers.js.map +1 -1
- package/dist/modules/access/change-read-gate.d.ts +1 -1
- package/dist/modules/access/change-read-gate.js +1 -1
- package/dist/modules/access/groups-admin.service.d.ts +7 -7
- package/dist/modules/access/groups-admin.service.d.ts.map +1 -1
- package/dist/modules/access/groups-admin.service.js +6 -6
- package/dist/modules/access/groups-admin.service.js.map +1 -1
- package/dist/modules/access/reference-scan.d.ts +1 -1
- package/dist/modules/access/roles-admin.service.d.ts +7 -7
- package/dist/modules/access/roles-admin.service.d.ts.map +1 -1
- package/dist/modules/access/roles-admin.service.js +8 -8
- package/dist/modules/access/roles-admin.service.js.map +1 -1
- package/dist/modules/access/synced-groups-committer.d.ts +4 -4
- package/dist/modules/access/synced-groups-committer.d.ts.map +1 -1
- package/dist/modules/access/synced-groups-committer.js +7 -7
- package/dist/modules/access/synced-groups-committer.js.map +1 -1
- package/dist/modules/access/user-access-removal.service.d.ts +6 -6
- package/dist/modules/access/user-access-removal.service.d.ts.map +1 -1
- package/dist/modules/access/user-access-removal.service.js +4 -4
- package/dist/modules/access/user-access-removal.service.js.map +1 -1
- package/dist/modules/access-model/access-errors.d.ts +4 -4
- package/dist/modules/access-model/access-errors.d.ts.map +1 -1
- package/dist/modules/access-model/access-errors.js +4 -4
- package/dist/modules/access-model/access-errors.js.map +1 -1
- package/dist/modules/access-model/access-grammar.d.ts +1 -1
- package/dist/modules/access-model/access-grammar.js +4 -4
- package/dist/modules/access-model/change-gate.d.ts +1 -1
- package/dist/modules/access-model/change-gate.js +1 -1
- package/dist/modules/access-model/roles-yaml-guard.d.ts +4 -4
- package/dist/modules/access-model/roles-yaml-guard.d.ts.map +1 -1
- package/dist/modules/access-model/roles-yaml-guard.js +4 -4
- package/dist/modules/access-model/roles-yaml-guard.js.map +1 -1
- package/dist/modules/agent-guide/agent-guide.d.ts +19 -14
- package/dist/modules/agent-guide/agent-guide.d.ts.map +1 -1
- package/dist/modules/agent-guide/agent-guide.js +42 -18
- package/dist/modules/agent-guide/agent-guide.js.map +1 -1
- package/dist/modules/agent-guide/guide-budget.d.ts +5 -2
- package/dist/modules/agent-guide/guide-budget.d.ts.map +1 -1
- package/dist/modules/agent-guide/guide-budget.js +6 -2
- package/dist/modules/agent-guide/guide-budget.js.map +1 -1
- package/dist/modules/agent-instructions/agent-instructions.routes.d.ts +12 -5
- package/dist/modules/agent-instructions/agent-instructions.routes.d.ts.map +1 -1
- package/dist/modules/agent-instructions/agent-instructions.routes.js +13 -6
- package/dist/modules/agent-instructions/agent-instructions.routes.js.map +1 -1
- package/dist/modules/agent-instructions/compose.d.ts +15 -8
- package/dist/modules/agent-instructions/compose.d.ts.map +1 -1
- package/dist/modules/agent-instructions/compose.js +24 -10
- package/dist/modules/agent-instructions/compose.js.map +1 -1
- package/dist/modules/agent-instructions/shared-file-rules.d.ts +14 -6
- package/dist/modules/agent-instructions/shared-file-rules.d.ts.map +1 -1
- package/dist/modules/agent-instructions/shared-file-rules.js +51 -11
- package/dist/modules/agent-instructions/shared-file-rules.js.map +1 -1
- package/dist/modules/auth/account-erasure.service.d.ts +36 -7
- package/dist/modules/auth/account-erasure.service.d.ts.map +1 -1
- package/dist/modules/auth/account-erasure.service.js +30 -10
- package/dist/modules/auth/account-erasure.service.js.map +1 -1
- package/dist/modules/auth/account-hooks.d.ts +20 -0
- package/dist/modules/auth/account-hooks.d.ts.map +1 -1
- package/dist/modules/auth/account-hooks.js +10 -0
- package/dist/modules/auth/account-hooks.js.map +1 -1
- package/dist/modules/auth/account-switch-lock.js +2 -2
- package/dist/modules/auth/account-switch-lock.js.map +1 -1
- package/dist/modules/auth/account.routes.d.ts +7 -2
- package/dist/modules/auth/account.routes.d.ts.map +1 -1
- package/dist/modules/auth/account.routes.js +23 -4
- package/dist/modules/auth/account.routes.js.map +1 -1
- package/dist/modules/auth/auth.service.d.ts +1 -1
- package/dist/modules/auth/auth.service.js +4 -4
- package/dist/modules/auth/auth.service.js.map +1 -1
- package/dist/modules/auth/index.d.ts +1 -0
- package/dist/modules/auth/index.d.ts.map +1 -1
- package/dist/modules/database/connection.d.ts.map +1 -1
- package/dist/modules/database/connection.js +11 -0
- package/dist/modules/database/connection.js.map +1 -1
- package/dist/modules/database/core-schema.js +2 -2
- package/dist/modules/database/core-schema.js.map +1 -1
- package/dist/modules/diff/diff.routes.d.ts +3 -3
- package/dist/modules/diff/diff.routes.d.ts.map +1 -1
- package/dist/modules/diff/diff.routes.js +7 -7
- package/dist/modules/diff/diff.routes.js.map +1 -1
- package/dist/modules/embed/embed.routes.js +1 -1
- package/dist/modules/embed/embed.routes.js.map +1 -1
- package/dist/modules/embed/embed.service.d.ts +4 -4
- package/dist/modules/embed/embed.service.d.ts.map +1 -1
- package/dist/modules/embed/embed.service.js +18 -18
- package/dist/modules/embed/embed.service.js.map +1 -1
- package/dist/modules/kb-fs/branch-name.js +8 -8
- package/dist/modules/kb-fs/branch-name.js.map +1 -1
- package/dist/modules/kb-fs/file-change-notifier.d.ts +51 -26
- package/dist/modules/kb-fs/file-change-notifier.d.ts.map +1 -1
- package/dist/modules/kb-fs/file-change-notifier.js +6 -8
- package/dist/modules/kb-fs/file-change-notifier.js.map +1 -1
- package/dist/modules/kb-fs/locking-filesystem.d.ts +9 -16
- package/dist/modules/kb-fs/locking-filesystem.d.ts.map +1 -1
- package/dist/modules/kb-fs/locking-filesystem.js +31 -39
- package/dist/modules/kb-fs/locking-filesystem.js.map +1 -1
- package/dist/modules/kb-fs/repo-path.js +5 -5
- package/dist/modules/kb-fs/repo-path.js.map +1 -1
- package/dist/modules/kb-fs/tmp-ref.d.ts +2 -2
- package/dist/modules/kb-fs/tmp-ref.d.ts.map +1 -1
- package/dist/modules/kb-fs/tmp-ref.js +2 -2
- package/dist/modules/kb-fs/tmp-ref.js.map +1 -1
- package/dist/modules/kb-sync/index.d.ts +1 -1
- package/dist/modules/kb-sync/index.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.interface.d.ts +3 -3
- package/dist/modules/kb-sync/kb-sync.interface.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.service.d.ts +3 -3
- package/dist/modules/kb-sync/kb-sync.service.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.service.js +10 -10
- package/dist/modules/kb-sync/kb-sync.service.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +11 -4
- package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.service.js +75 -19
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/onboarding/onboarding.contract.d.ts +1 -1
- package/dist/modules/onboarding/onboarding.routes.js +2 -2
- package/dist/modules/onboarding/onboarding.routes.js.map +1 -1
- package/dist/modules/onboarding/starter-pack.service.d.ts +5 -7
- package/dist/modules/onboarding/starter-pack.service.d.ts.map +1 -1
- package/dist/modules/onboarding/starter-pack.service.js +4 -4
- package/dist/modules/onboarding/starter-pack.service.js.map +1 -1
- package/dist/modules/plugins/join-request-jobs.service.d.ts +2 -2
- package/dist/modules/plugins/join-request-jobs.service.d.ts.map +1 -1
- package/dist/modules/plugins/join-request-jobs.service.js +7 -7
- package/dist/modules/plugins/join-request-jobs.service.js.map +1 -1
- package/dist/modules/plugins/join-requests.service.d.ts +3 -3
- package/dist/modules/plugins/join-requests.service.d.ts.map +1 -1
- package/dist/modules/plugins/join-requests.service.js +5 -5
- package/dist/modules/plugins/join-requests.service.js.map +1 -1
- package/dist/modules/plugins/plugin-rename.service.js +1 -1
- package/dist/modules/plugins/plugin-rename.service.js.map +1 -1
- package/dist/modules/plugins/plugins.routes.d.ts +2 -2
- package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.routes.js +8 -8
- package/dist/modules/plugins/plugins.routes.js.map +1 -1
- package/dist/modules/secrets-vault/db-secrets-vault.service.d.ts +77 -2
- package/dist/modules/secrets-vault/db-secrets-vault.service.d.ts.map +1 -1
- package/dist/modules/secrets-vault/db-secrets-vault.service.js +479 -53
- package/dist/modules/secrets-vault/db-secrets-vault.service.js.map +1 -1
- package/dist/modules/secrets-vault/index.d.ts +2 -1
- package/dist/modules/secrets-vault/index.d.ts.map +1 -1
- package/dist/modules/secrets-vault/index.js +1 -0
- package/dist/modules/secrets-vault/index.js.map +1 -1
- package/dist/modules/secrets-vault/managed-sign-in-erasure.d.ts +36 -0
- package/dist/modules/secrets-vault/managed-sign-in-erasure.d.ts.map +1 -0
- package/dist/modules/secrets-vault/managed-sign-in-erasure.js +37 -0
- package/dist/modules/secrets-vault/managed-sign-in-erasure.js.map +1 -0
- package/dist/modules/secrets-vault/secrets-vault.contract.d.ts +152 -0
- package/dist/modules/secrets-vault/secrets-vault.contract.d.ts.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.contract.js.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.d.ts +7 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.d.ts.map +1 -1
- package/dist/modules/secrets-vault/secrets-vault.routes.js +125 -10
- package/dist/modules/secrets-vault/secrets-vault.routes.js.map +1 -1
- package/dist/modules/settings/connection-check.js +1 -1
- package/dist/modules/settings/connection-check.js.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +1 -1
- package/dist/modules/settings/git-root-folders.js +1 -1
- package/dist/modules/settings/git-root-folders.js.map +1 -1
- package/dist/modules/settings/setup.routes.d.ts +1 -1
- package/dist/modules/settings/setup.routes.js +1 -1
- package/dist/modules/skills/pending-skills.service.d.ts +3 -3
- package/dist/modules/skills/pending-skills.service.d.ts.map +1 -1
- package/dist/modules/skills/pending-skills.service.js +4 -4
- package/dist/modules/skills/pending-skills.service.js.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.d.ts +2 -2
- package/dist/modules/skills/skill-access-requests.routes.d.ts.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.js +5 -5
- package/dist/modules/skills/skill-access-requests.routes.js.map +1 -1
- package/dist/modules/tool-helpers/tool-context.d.ts +4 -4
- package/dist/modules/tool-helpers/tool-context.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool-context.js +2 -2
- package/dist/modules/tool-helpers/tool-context.js.map +1 -1
- package/dist/modules/tool-helpers/tool-handler.js +2 -2
- package/dist/modules/tool-helpers/tool-handler.js.map +1 -1
- package/dist/modules/tool-helpers/tool.contract.d.ts +4 -4
- package/dist/modules/tool-helpers/tool.contract.d.ts.map +1 -1
- package/dist/modules/tool-manuals/mcp-server-edit.service.js +1 -1
- package/dist/modules/tool-manuals/mcp-server-edit.service.js.map +1 -1
- package/dist/modules/tool-manuals/pending-tools.service.d.ts +3 -3
- package/dist/modules/tool-manuals/pending-tools.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/pending-tools.service.js +4 -4
- package/dist/modules/tool-manuals/pending-tools.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-delete.service.js +1 -1
- package/dist/modules/tool-manuals/tool-delete.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.contract.d.ts +43 -3
- package/dist/modules/tool-manuals/tool-manuals.contract.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts +6 -0
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.js +51 -5
- package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts +3 -0
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.js +36 -15
- package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -1
- package/dist/modules/version-control/agent-tools/change-request-read-shape.d.ts.map +1 -0
- package/dist/modules/version-control/agent-tools/change-request-read-shape.js.map +1 -0
- package/dist/modules/version-control/agent-tools/change-request-read.tools.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/agent-tools/change-request-read.tools.js +2 -2
- package/dist/modules/version-control/agent-tools/change-request-read.tools.js.map +1 -0
- package/dist/modules/version-control/agent-tools/change-request-summary.d.ts.map +1 -0
- package/dist/modules/version-control/agent-tools/change-request-summary.js.map +1 -0
- package/dist/modules/{workflow/agent-tools/workflow.tools.d.ts → version-control/agent-tools/version-control.tools.d.ts} +4 -4
- package/dist/modules/version-control/agent-tools/version-control.tools.d.ts.map +1 -0
- package/dist/modules/{workflow/agent-tools/workflow.tools.js → version-control/agent-tools/version-control.tools.js} +31 -31
- package/dist/modules/version-control/agent-tools/version-control.tools.js.map +1 -0
- package/dist/modules/{workflow → version-control}/change-request-hooks.d.ts +1 -1
- package/dist/modules/version-control/change-request-hooks.d.ts.map +1 -0
- package/dist/modules/version-control/change-request-hooks.js.map +1 -0
- package/dist/modules/version-control/change-request-review/approval-lock.d.ts.map +1 -0
- package/dist/modules/version-control/change-request-review/approval-lock.js.map +1 -0
- package/dist/modules/{workflow/review-workflow/review-workflow.interface.d.ts → version-control/change-request-review/change-request-review.interface.d.ts} +2 -2
- package/dist/modules/version-control/change-request-review/change-request-review.interface.d.ts.map +1 -0
- package/dist/modules/version-control/change-request-review/change-request-review.interface.js +2 -0
- package/dist/modules/version-control/change-request-review/change-request-review.interface.js.map +1 -0
- package/dist/modules/{workflow/review-workflow/review-workflow.service.d.ts → version-control/change-request-review/change-request-review.service.d.ts} +3 -3
- package/dist/modules/version-control/change-request-review/change-request-review.service.d.ts.map +1 -0
- package/dist/modules/{workflow/review-workflow/review-workflow.service.js → version-control/change-request-review/change-request-review.service.js} +26 -26
- package/dist/modules/version-control/change-request-review/change-request-review.service.js.map +1 -0
- package/dist/modules/{workflow → version-control}/event-bus.d.ts +8 -8
- package/dist/modules/version-control/event-bus.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/event-bus.js +4 -4
- package/dist/modules/version-control/event-bus.js.map +1 -0
- package/dist/modules/{workflow → version-control}/events-delivery.d.ts +4 -4
- package/dist/modules/version-control/events-delivery.d.ts.map +1 -0
- package/dist/modules/version-control/events-delivery.js.map +1 -0
- package/dist/modules/{workflow → version-control}/events.routes.d.ts +4 -4
- package/dist/modules/version-control/events.routes.d.ts.map +1 -0
- package/dist/modules/version-control/events.routes.js.map +1 -0
- package/dist/modules/{workflow → version-control}/file-lock.service.d.ts +2 -2
- package/dist/modules/version-control/file-lock.service.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/file-lock.service.js +6 -6
- package/dist/modules/version-control/file-lock.service.js.map +1 -0
- package/dist/modules/version-control/git/change-request-link.d.ts.map +1 -0
- package/dist/modules/version-control/git/change-request-link.js.map +1 -0
- package/dist/modules/version-control/git/git-version.d.ts.map +1 -0
- package/dist/modules/version-control/git/git-version.js.map +1 -0
- package/dist/modules/{workflow → version-control}/git/git.service.d.ts +26 -8
- package/dist/modules/version-control/git/git.service.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/git/git.service.js +106 -55
- package/dist/modules/version-control/git/git.service.js.map +1 -0
- package/dist/modules/version-control/git/merge-commit.d.ts.map +1 -0
- package/dist/modules/version-control/git/merge-commit.js.map +1 -0
- package/dist/modules/version-control/git/node-git-runner.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/git/node-git-runner.js +1 -1
- package/dist/modules/version-control/git/node-git-runner.js.map +1 -0
- package/dist/modules/{workflow → version-control}/git/pull-request.service.d.ts +5 -5
- package/dist/modules/version-control/git/pull-request.service.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/git/pull-request.service.js +10 -10
- package/dist/modules/version-control/git/pull-request.service.js.map +1 -0
- package/dist/modules/{workflow → version-control}/index.d.ts +6 -5
- package/dist/modules/version-control/index.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/index.js +3 -2
- package/dist/modules/version-control/index.js.map +1 -0
- package/dist/modules/{workflow → version-control}/pending-commits.service.d.ts +2 -2
- package/dist/modules/version-control/pending-commits.service.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/pending-commits.service.js +2 -2
- package/dist/modules/version-control/pending-commits.service.js.map +1 -0
- package/dist/modules/{workflow → version-control}/pending-commits.worker.d.ts +5 -5
- package/dist/modules/version-control/pending-commits.worker.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/pending-commits.worker.js +3 -3
- package/dist/modules/version-control/pending-commits.worker.js.map +1 -0
- package/dist/modules/{workflow → version-control}/read-on-branch.d.ts +2 -2
- package/dist/modules/version-control/read-on-branch.d.ts.map +1 -0
- package/dist/modules/{workflow → version-control}/read-on-branch.js +2 -2
- package/dist/modules/version-control/read-on-branch.js.map +1 -0
- package/dist/modules/version-control/recovery-bot.d.ts.map +1 -0
- package/dist/modules/version-control/recovery-bot.js.map +1 -0
- package/dist/modules/version-control/sanitize-error.d.ts.map +1 -0
- package/dist/modules/version-control/sanitize-error.js.map +1 -0
- package/dist/modules/{workflow/workflow-hooks.d.ts → version-control/version-control-hooks.d.ts} +33 -6
- package/dist/modules/version-control/version-control-hooks.d.ts.map +1 -0
- package/dist/modules/{workflow/workflow-hooks.js → version-control/version-control-hooks.js} +20 -3
- package/dist/modules/version-control/version-control-hooks.js.map +1 -0
- package/dist/modules/{workflow/workflow.routes.d.ts → version-control/version-control.routes.d.ts} +6 -5
- package/dist/modules/version-control/version-control.routes.d.ts.map +1 -0
- package/dist/modules/{workflow/workflow.routes.js → version-control/version-control.routes.js} +61 -60
- package/dist/modules/version-control/version-control.routes.js.map +1 -0
- package/dist/modules/{workflow/workflow.service.d.ts → version-control/version-control.service.d.ts} +26 -46
- package/dist/modules/version-control/version-control.service.d.ts.map +1 -0
- package/dist/modules/{workflow/workflow.service.js → version-control/version-control.service.js} +93 -107
- package/dist/modules/version-control/version-control.service.js.map +1 -0
- package/dist/modules/workspace/agent-access.gate.d.ts +5 -5
- package/dist/modules/workspace/agent-access.gate.d.ts.map +1 -1
- package/dist/modules/workspace/agent-access.gate.js +1 -1
- package/dist/modules/workspace/git-internals.middleware.d.ts +1 -1
- package/dist/modules/workspace/git-internals.middleware.js +2 -2
- package/dist/modules/workspace/kb-repository.js +1 -1
- package/dist/modules/workspace/kb-repository.js.map +1 -1
- package/dist/modules/workspace/startup/kb-git.d.ts +1 -1
- package/dist/modules/workspace/startup/kb-git.d.ts.map +1 -1
- package/dist/modules/workspace/startup/kb-git.js +1 -1
- package/dist/modules/workspace/startup/kb-git.js.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts +2 -2
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.js +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts +2 -2
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.js +2 -2
- package/dist/modules/workspace/startup/steps/template-files.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.d.ts +17 -4
- package/dist/modules/workspace/startup/steps/template-source.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.js +8 -5
- package/dist/modules/workspace/startup/steps/template-source.js.map +1 -1
- package/dist/modules/workspace/workspace-tmp.js +3 -3
- package/dist/modules/workspace/workspace-tmp.js.map +1 -1
- package/dist/modules/workspace/workspace.routes.d.ts +4 -4
- package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.routes.js +22 -22
- package/dist/modules/workspace/workspace.routes.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +6 -6
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +11 -11
- package/dist/modules/workspace/workspace.service.js.map +1 -1
- package/dist/modules/workspace/workspace.tools.d.ts +2 -1
- package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.tools.js +15 -10
- package/dist/modules/workspace/workspace.tools.js.map +1 -1
- package/dist/shared/canonical-file-identity.d.ts +2 -2
- package/dist/shared/canonical-file-identity.js +5 -5
- package/dist/shared/canonical-file-identity.js.map +1 -1
- package/dist/shared/domain-errors.d.ts +39 -39
- package/dist/shared/domain-errors.d.ts.map +1 -1
- package/dist/shared/domain-errors.js +44 -44
- package/dist/shared/domain-errors.js.map +1 -1
- package/dist/shared/fire-and-forget.d.ts +14 -0
- package/dist/shared/fire-and-forget.d.ts.map +1 -0
- package/dist/shared/fire-and-forget.js +23 -0
- package/dist/shared/fire-and-forget.js.map +1 -0
- package/dist/shared/git.contract.d.ts +1 -1
- package/dist/shared/git.contract.js +1 -1
- package/dist/shared/http-errors.d.ts +3 -3
- package/dist/shared/http-errors.d.ts.map +1 -1
- package/dist/shared/http-errors.js +1 -1
- package/dist/shared/http-errors.js.map +1 -1
- package/dist/shared/pending-proposals.d.ts +3 -3
- package/dist/shared/pending-proposals.d.ts.map +1 -1
- package/dist/shared/pending-proposals.js +2 -2
- package/dist/shared/pending-proposals.js.map +1 -1
- package/dist/tenancy/static-tenant-source.js +1 -1
- package/dist/tenancy/static-tenant-source.js.map +1 -1
- package/migrations/0012_agent_audit.sql +40 -40
- package/migrations/0013_agent_identity_and_key_soft_delete.sql +29 -29
- package/migrations/meta/0012_snapshot.json +2246 -2246
- package/migrations/meta/0013_snapshot.json +2258 -2258
- package/package.json +4 -4
- package/src/__tests__/account-admin.ts +27 -0
- package/src/__tests__/capturing-logger.ts +36 -0
- package/src/__tests__/hexis-catalog.ts +4 -4
- package/src/__tests__/kb-context.ts +30 -30
- package/src/__tests__/kb-layout-config.test.ts +21 -0
- package/src/__tests__/open-change-gate.ts +1 -1
- package/src/__tests__/real-access.ts +16 -0
- package/src/__tests__/real-auth.ts +13 -0
- package/src/__tests__/real-readers.ts +27 -0
- package/src/__tests__/real-version-control.ts +22 -0
- package/src/__tests__/tool-handler.ts +15 -0
- package/src/__tests__/tool-wiring.ts +10 -4
- package/src/__tests__/workspace-service.ts +1 -1
- package/src/core/__tests__/catalog-cache-invalidation.test.ts +3 -3
- package/src/core/__tests__/commit-announcements-wired-once.test.ts +53 -0
- package/src/core/__tests__/compose-embed.test.ts +1 -1
- package/src/core/__tests__/damaged-document.tools.test.ts +3 -3
- package/src/core/__tests__/erasure-slices-wired-once.test.ts +46 -0
- package/src/core/__tests__/gated-boot.test.ts +2 -2
- package/src/core/__tests__/lifecycle.test.ts +9 -9
- package/src/core/catalog-cache-invalidation.ts +2 -2
- package/src/core/compose-embed.ts +3 -3
- package/src/core/core-ports.ts +19 -4
- package/src/core/create-core-server.ts +39 -25
- package/src/core/create-core-services.ts +83 -65
- package/src/core/lifecycle.ts +9 -9
- package/src/core-config.ts +3 -3
- package/src/index.ts +5 -5
- package/src/modules/access/__tests__/access-control.admin-root-floor.test.ts +4 -4
- package/src/modules/access/__tests__/access-own-read-grant.test.ts +14 -14
- package/src/modules/access/__tests__/access-requests.routes.test.ts +23 -23
- package/src/modules/access/__tests__/access.routes.admins.test.ts +4 -4
- package/src/modules/access/__tests__/access.routes.batch.test.ts +4 -4
- package/src/modules/access/__tests__/access.routes.folder-governs.test.ts +6 -6
- package/src/modules/access/__tests__/access.routes.group-grant.test.ts +6 -6
- package/src/modules/access/__tests__/access.routes.overrides.test.ts +5 -5
- package/src/modules/access/__tests__/access.routes.proposal-branch.test.ts +6 -6
- package/src/modules/access/__tests__/access.routes.prospective.test.ts +3 -3
- package/src/modules/access/__tests__/access.routes.revoke.test.ts +6 -6
- package/src/modules/access/__tests__/access.routes.unknown-email.test.ts +6 -6
- package/src/modules/access/__tests__/admin-locked-commit.test.ts +6 -6
- package/src/modules/access/__tests__/admin-route-helpers.test.ts +5 -5
- package/src/modules/access/__tests__/groups-admin.service.test.ts +44 -44
- package/src/modules/access/__tests__/roles-admin.security.test.ts +14 -13
- package/src/modules/access/__tests__/roles-admin.service.test.ts +34 -34
- package/src/modules/access/__tests__/roles-capabilities.test.ts +29 -29
- package/src/modules/access/__tests__/roles.routes.test.ts +11 -11
- package/src/modules/access/__tests__/synced-groups-committer.test.ts +14 -14
- package/src/modules/access/__tests__/user-access-removal.service.test.ts +33 -33
- package/src/modules/access/access-control.service.ts +1 -1
- package/src/modules/access/access-declarations.ts +2 -2
- package/src/modules/access/access-mutation.service.ts +2 -2
- package/src/modules/access/access-requests.routes.ts +7 -7
- package/src/modules/access/access-requests.service.ts +13 -13
- package/src/modules/access/access.routes.ts +11 -11
- package/src/modules/access/admin-locked-commit.ts +11 -11
- package/src/modules/access/admin-route-helpers.ts +5 -5
- package/src/modules/access/change-read-gate.ts +1 -1
- package/src/modules/access/groups-admin.service.ts +7 -7
- package/src/modules/access/reference-scan.ts +1 -1
- package/src/modules/access/roles-admin.service.ts +9 -9
- package/src/modules/access/synced-groups-committer.ts +11 -11
- package/src/modules/access/user-access-removal.service.ts +7 -7
- package/src/modules/access-model/__tests__/access-grammar.test.ts +2 -2
- package/src/modules/access-model/access-errors.ts +4 -4
- package/src/modules/access-model/access-grammar.ts +4 -4
- package/src/modules/access-model/change-gate.ts +1 -1
- package/src/modules/access-model/roles-yaml-guard.ts +4 -4
- package/src/modules/agent-guide/__tests__/agent-guide.test.ts +19 -4
- package/src/modules/agent-guide/__tests__/agent-guide.tools.test.ts +1 -1
- package/src/modules/agent-guide/__tests__/guide-matches-code.test.ts +2 -2
- package/src/modules/agent-guide/agent-guide.ts +48 -22
- package/src/modules/agent-guide/guide-budget.ts +6 -2
- package/src/modules/agent-instructions/__tests__/agent-instructions.route.test.ts +4 -5
- package/src/modules/agent-instructions/__tests__/compose.test.ts +1 -1
- package/src/modules/agent-instructions/__tests__/shared-file-rules.test.ts +113 -7
- package/src/modules/agent-instructions/agent-instructions.routes.ts +12 -5
- package/src/modules/agent-instructions/compose.ts +24 -9
- package/src/modules/agent-instructions/shared-file-rules.ts +53 -11
- package/src/modules/agent-scope/__tests__/agent-surfaces.connect-as.test.ts +1 -1
- package/src/modules/audit/__tests__/agent-rest-audit.middleware.test.ts +113 -113
- package/src/modules/audit/__tests__/event-classifier.test.ts +121 -121
- package/src/modules/audit/event-classifier.ts +155 -155
- package/src/modules/auth/__tests__/account-deactivation.test.ts +1 -1
- package/src/modules/auth/__tests__/account-erasure.approval-gate.test.ts +4 -4
- package/src/modules/auth/__tests__/account-erasure.participants.test.ts +56 -0
- package/src/modules/auth/__tests__/account-switch-lock.pg.test.ts +2 -2
- package/src/modules/auth/__tests__/account-switch-lock.test.ts +2 -2
- package/src/modules/auth/__tests__/account.routes.test.ts +73 -11
- package/src/modules/auth/__tests__/auth.service.test.ts +1 -1
- package/src/modules/auth/account-erasure.service.ts +27 -9
- package/src/modules/auth/account-hooks.ts +34 -0
- package/src/modules/auth/account-switch-lock.ts +2 -2
- package/src/modules/auth/account.routes.ts +23 -5
- package/src/modules/auth/auth.service.ts +4 -4
- package/src/modules/auth/index.ts +1 -0
- package/src/modules/database/__tests__/advisory-lock.test.ts +169 -169
- package/src/modules/database/__tests__/connection.pg.test.ts +55 -0
- package/src/modules/database/__tests__/connection.test.ts +30 -0
- package/src/modules/database/__tests__/migrations-unqualified.test.ts +32 -32
- package/src/modules/database/connection.ts +12 -0
- package/src/modules/database/core-schema.ts +2 -2
- package/src/modules/diff/__tests__/diff.routes.read-gate.test.ts +2 -2
- package/src/modules/diff/__tests__/diff.routes.rejectPathsLocked.test.ts +12 -12
- package/src/modules/diff/diff.routes.ts +8 -8
- package/src/modules/embed/__tests__/embed.service.lock.test.ts +7 -7
- package/src/modules/embed/__tests__/embed.service.test.ts +48 -62
- package/src/modules/embed/__tests__/embed.tools.test.ts +1 -1
- package/src/modules/embed/embed.routes.ts +1 -1
- package/src/modules/embed/embed.service.ts +17 -17
- package/src/modules/kb-fs/__tests__/branch-name.test.ts +2 -2
- package/src/modules/kb-fs/__tests__/file-change-notifier.test.ts +23 -4
- package/src/modules/kb-fs/__tests__/locking-filesystem.test.ts +264 -305
- package/src/modules/kb-fs/__tests__/move-with-edits.test.ts +103 -40
- package/src/modules/kb-fs/__tests__/repo-path.test.ts +8 -8
- package/src/modules/kb-fs/branch-name.ts +8 -8
- package/src/modules/kb-fs/file-change-notifier.ts +55 -32
- package/src/modules/kb-fs/locking-filesystem.ts +34 -48
- package/src/modules/kb-fs/repo-path.ts +5 -5
- package/src/modules/kb-fs/tmp-ref.ts +3 -3
- package/src/modules/kb-sync/__tests__/kb-sync.service.test.ts +36 -36
- package/src/modules/kb-sync/index.ts +1 -1
- package/src/modules/kb-sync/kb-sync.interface.ts +3 -3
- package/src/modules/kb-sync/kb-sync.service.ts +9 -9
- package/src/modules/marketplace/__tests__/github-facade.test.ts +1 -1
- package/src/modules/marketplace/__tests__/marketplace-git.test.ts +1 -1
- package/src/modules/mcp/__tests__/mcp-proxy-helpers.test.ts +4 -2
- package/src/modules/mcp/__tests__/mcp.e2e.test.ts +69 -8
- package/src/modules/mcp/__tests__/mcp.service.test.ts +91 -13
- package/src/modules/mcp/__tests__/read-only-hint.pg.test.ts +194 -0
- package/src/modules/mcp/mcp.service.ts +89 -28
- package/src/modules/onboarding/__tests__/starter-pack.service.test.ts +59 -59
- package/src/modules/onboarding/onboarding.contract.ts +1 -1
- package/src/modules/onboarding/onboarding.routes.ts +2 -2
- package/src/modules/onboarding/starter-pack.service.ts +7 -9
- package/src/modules/plugins/__tests__/bundle-dialect.e2e.test.ts +1 -1
- package/src/modules/plugins/__tests__/compile-marketplace.test.ts +1 -1
- package/src/modules/plugins/__tests__/join-request-jobs.service.test.ts +43 -43
- package/src/modules/plugins/__tests__/join-requests.service.test.ts +19 -19
- package/src/modules/plugins/__tests__/join-requests.settlement.test.ts +26 -26
- package/src/modules/plugins/__tests__/plugin-rename.service.test.ts +46 -21
- package/src/modules/plugins/__tests__/plugins.routes.test.ts +31 -31
- package/src/modules/plugins/join-request-jobs.service.ts +10 -10
- package/src/modules/plugins/join-requests.service.ts +4 -4
- package/src/modules/plugins/plugin-rename.service.ts +1 -1
- package/src/modules/plugins/plugins.routes.ts +9 -9
- package/src/modules/secrets-vault/__tests__/db-secrets-vault.managed.test.ts +773 -0
- package/src/modules/secrets-vault/__tests__/db-secrets-vault.oauth.test.ts +28 -1
- package/src/modules/secrets-vault/__tests__/managed-sign-in.route.test.ts +351 -0
- package/src/modules/secrets-vault/db-secrets-vault.service.ts +562 -95
- package/src/modules/secrets-vault/index.ts +7 -0
- package/src/modules/secrets-vault/managed-sign-in-erasure.ts +41 -0
- package/src/modules/secrets-vault/secrets-variable-loader.ts +134 -134
- package/src/modules/secrets-vault/secrets-vault.contract.ts +152 -0
- package/src/modules/secrets-vault/secrets-vault.routes.ts +157 -10
- package/src/modules/settings/__tests__/repository-source.test.ts +1 -1
- package/src/modules/settings/__tests__/setup.routes.layout-phase.test.ts +1 -1
- package/src/modules/settings/__tests__/setup.routes.managed-phase.test.ts +1 -1
- package/src/modules/settings/connection-check.ts +1 -1
- package/src/modules/settings/deployment-settings.service.ts +1 -1
- package/src/modules/settings/git-root-folders.ts +1 -1
- package/src/modules/settings/setup.routes.ts +1 -1
- package/src/modules/skills/__tests__/allowed-tools-warn.tools.test.ts +3 -3
- package/src/modules/skills/__tests__/branch-skills.tools.test.ts +1 -1
- package/src/modules/skills/__tests__/pending-skills.service.test.ts +8 -8
- package/src/modules/skills/__tests__/skill-access-requests.routes.test.ts +18 -18
- package/src/modules/skills/__tests__/skills.service.test.ts +3 -3
- package/src/modules/skills/pending-skills.service.ts +3 -3
- package/src/modules/skills/skill-access-requests.routes.ts +7 -7
- package/src/modules/tool-helpers/__tests__/agent-roles-write.test.ts +4 -4
- package/src/modules/tool-helpers/__tests__/branch-declaration.test.ts +3 -3
- package/src/modules/tool-helpers/__tests__/can-write.tools.test.ts +3 -3
- package/src/modules/tool-helpers/__tests__/phase4-tools.test.ts +4 -4
- package/src/modules/tool-helpers/__tests__/tools-surface.test.ts +3 -3
- package/src/modules/tool-helpers/__tests__/validate-token.test.ts +1 -1
- package/src/modules/tool-helpers/tool-context.ts +6 -6
- package/src/modules/tool-helpers/tool-handler.ts +2 -2
- package/src/modules/tool-helpers/tool.contract.ts +4 -4
- package/src/modules/tool-manuals/__tests__/pending-tools.service.test.ts +9 -9
- package/src/modules/tool-manuals/__tests__/tool-manuals.managed-sign-in.test.ts +89 -0
- package/src/modules/tool-manuals/__tests__/tool-manuals.restart.test.ts +1 -1
- package/src/modules/tool-manuals/__tests__/tool-manuals.tools.test.ts +36 -1
- package/src/modules/tool-manuals/mcp-server-edit.service.ts +1 -1
- package/src/modules/tool-manuals/pending-tools.service.ts +3 -3
- package/src/modules/tool-manuals/tool-delete.service.ts +1 -1
- package/src/modules/tool-manuals/tool-manuals.contract.ts +41 -3
- package/src/modules/tool-manuals/tool-manuals.service.ts +53 -5
- package/src/modules/tool-manuals/tool-manuals.tools.ts +41 -15
- package/src/modules/tool-registry/__tests__/own-tool-schemas.test.ts +4 -4
- package/src/modules/tool-registry/__tests__/read-only-hints.test.ts +3 -3
- package/src/modules/tool-registry/__tests__/tool-description-length.test.ts +6 -6
- package/src/modules/{workflow → version-control}/__tests__/apply-failure.test.ts +54 -54
- package/src/modules/{workflow → version-control}/__tests__/event-bus.test.ts +27 -27
- package/src/modules/{workflow → version-control}/__tests__/events-delivery.test.ts +37 -37
- package/src/modules/{workflow → version-control}/__tests__/file-lock.service.deletion-gate.test.ts +2 -2
- package/src/modules/{workflow → version-control}/__tests__/file-lock.service.path-identity.test.ts +8 -8
- package/src/modules/{workflow → version-control}/__tests__/merge-announces-tree.test.ts +11 -11
- package/src/modules/{workflow → version-control}/__tests__/pending-commits.worker.concurrency.test.ts +9 -9
- package/src/modules/{workflow → version-control}/__tests__/pending-commits.worker.test.ts +25 -25
- package/src/modules/{workflow → version-control}/__tests__/preserve-roles-yaml.test.ts +42 -42
- package/src/modules/version-control/__tests__/public-surface.test.ts +114 -0
- package/src/modules/{workflow/__tests__/workflow.routes.folder-proposals.test.ts → version-control/__tests__/version-control.routes.folder-proposals.test.ts} +18 -18
- package/src/modules/{workflow/__tests__/workflow.routes.fork-point-file.test.ts → version-control/__tests__/version-control.routes.fork-point-file.test.ts} +19 -19
- package/src/modules/{workflow/__tests__/workflow.routes.history-read-gate.test.ts → version-control/__tests__/version-control.routes.history-read-gate.test.ts} +13 -13
- package/src/modules/{workflow/__tests__/workflow.routes.lock-path.test.ts → version-control/__tests__/version-control.routes.lock-path.test.ts} +18 -18
- package/src/modules/{workflow/__tests__/workflow.routes.open-change-request.test.ts → version-control/__tests__/version-control.routes.open-change-request.test.ts} +7 -7
- package/src/modules/{workflow/__tests__/workflow.routes.push-refused.test.ts → version-control/__tests__/version-control.routes.push-refused.test.ts} +14 -14
- package/src/modules/{workflow/__tests__/workflow.service.branch-in-use.test.ts → version-control/__tests__/version-control.service.branch-in-use.test.ts} +6 -6
- package/src/modules/{workflow/__tests__/workflow.service.commitFileWhileLocked.test.ts → version-control/__tests__/version-control.service.commitFileWhileLocked.test.ts} +14 -14
- package/src/modules/{workflow/__tests__/workflow.service.delete-branch.test.ts → version-control/__tests__/version-control.service.delete-branch.test.ts} +14 -14
- package/src/modules/{workflow/__tests__/workflow.service.deleted-branch-sweep.test.ts → version-control/__tests__/version-control.service.deleted-branch-sweep.test.ts} +4 -4
- package/src/modules/{workflow/__tests__/workflow.service.facade.test.ts → version-control/__tests__/version-control.service.facade.test.ts} +100 -102
- package/src/modules/{workflow/__tests__/workflow.service.folder-proposals.test.ts → version-control/__tests__/version-control.service.folder-proposals.test.ts} +7 -7
- package/src/modules/{workflow/__tests__/workflow.service.platform-restore.test.ts → version-control/__tests__/version-control.service.platform-restore.test.ts} +6 -6
- package/src/modules/{workflow/__tests__/workflow.service.read-gate.test.ts → version-control/__tests__/version-control.service.read-gate.test.ts} +9 -9
- package/src/modules/{workflow/__tests__/workflow.service.releaseLock.test.ts → version-control/__tests__/version-control.service.releaseLock.test.ts} +85 -75
- package/src/modules/{workflow/__tests__/workflow.service.repository-replaced.test.ts → version-control/__tests__/version-control.service.repository-replaced.test.ts} +4 -4
- package/src/modules/{workflow/__tests__/workflow.service.sync.test.ts → version-control/__tests__/version-control.service.sync.test.ts} +17 -17
- package/src/modules/{workflow/__tests__/workflow.service.update-change-request.pg.test.ts → version-control/__tests__/version-control.service.update-change-request.pg.test.ts} +6 -6
- package/src/modules/{workflow/__tests__/workflow.service.update-change-request.test.ts → version-control/__tests__/version-control.service.update-change-request.test.ts} +11 -11
- package/src/modules/{workflow/__tests__/workflow.service.update-from-target.test.ts → version-control/__tests__/version-control.service.update-from-target.test.ts} +22 -22
- package/src/modules/{workflow → version-control}/agent-tools/__tests__/change-request-read.tools.test.ts +3 -3
- package/src/modules/{workflow → version-control}/agent-tools/__tests__/update-change-request.parity.test.ts +16 -16
- package/src/modules/{workflow/agent-tools/__tests__/workflow.tools.test.ts → version-control/agent-tools/__tests__/version-control.tools.test.ts} +9 -9
- package/src/modules/{workflow → version-control}/agent-tools/change-request-read.tools.ts +2 -2
- package/src/modules/{workflow/agent-tools/workflow.tools.ts → version-control/agent-tools/version-control.tools.ts} +30 -30
- package/src/modules/{workflow → version-control}/change-request-hooks.ts +1 -1
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/approval-states.test.ts +5 -5
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/cancel-pr.test.ts +8 -8
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/carry-approvals-forward.test.ts +6 -6
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/erase-approver.test.ts +5 -5
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/merge-gate.test.ts +3 -3
- package/src/modules/{workflow/review-workflow → version-control/change-request-review}/__tests__/merge-records-own-commit.test.ts +3 -3
- package/src/modules/{workflow/review-workflow/review-workflow.interface.ts → version-control/change-request-review/change-request-review.interface.ts} +1 -1
- package/src/modules/{workflow/review-workflow/review-workflow.service.ts → version-control/change-request-review/change-request-review.service.ts} +28 -28
- package/src/modules/{workflow → version-control}/event-bus.ts +14 -14
- package/src/modules/{workflow → version-control}/events-delivery.ts +11 -11
- package/src/modules/{workflow → version-control}/events.routes.ts +5 -5
- package/src/modules/{workflow → version-control}/file-lock.service.ts +6 -6
- package/src/modules/{workflow → version-control}/git/__tests__/git-test-helpers.ts +3 -3
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.accessGating.test.ts +5 -5
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.appliedChange.test.ts +4 -4
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.changedFilesForPr.test.ts +16 -16
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.changedPathsMemo.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.commitChanges.test.ts +3 -3
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.commitFile.strayPath.test.ts +10 -10
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.commitFile.test.ts +3 -3
- package/src/modules/version-control/git/__tests__/git.service.commitLanded.test.ts +199 -0
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.createBranch.test.ts +3 -3
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.deleteBranch.test.ts +7 -7
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.diffFileAtCommit.test.ts +9 -9
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.diffFileBetweenBranches.test.ts +23 -23
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.fileBytesAtCommit.test.ts +7 -7
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.fileContentsAtCommit.test.ts +3 -3
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.forkPoint.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.history-guards.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.list-branches.test.ts +12 -12
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.listTrackedFiles.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.logForFile.test.ts +6 -6
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.mergeChangeRequest.test.ts +99 -22
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.mergeIntoBranch.test.ts +16 -16
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.pendingChanges.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.postMergePull.test.ts +5 -5
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.prFetchFailure.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.pull.test.ts +12 -12
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.readFileAtRef.test.ts +3 -3
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.revertPathsAndPush.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.status.test.ts +4 -4
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.syncFromRemote.test.ts +8 -8
- package/src/modules/{workflow → version-control}/git/__tests__/git.service.worktrees.test.ts +4 -4
- package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.list-fetch.test.ts +2 -2
- package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.test.ts +6 -6
- package/src/modules/{workflow → version-control}/git/git.service.ts +112 -59
- package/src/modules/{workflow → version-control}/git/node-git-runner.ts +1 -1
- package/src/modules/{workflow → version-control}/git/pull-request.service.ts +12 -12
- package/src/modules/{workflow → version-control}/index.ts +6 -5
- package/src/modules/{workflow → version-control}/pending-commits.service.ts +2 -2
- package/src/modules/{workflow → version-control}/pending-commits.worker.ts +8 -8
- package/src/modules/{workflow → version-control}/read-on-branch.ts +2 -2
- package/src/modules/{workflow/workflow-hooks.ts → version-control/version-control-hooks.ts} +44 -5
- package/src/modules/{workflow/workflow.routes.ts → version-control/version-control.routes.ts} +64 -63
- package/src/modules/{workflow/workflow.service.ts → version-control/version-control.service.ts} +96 -109
- package/src/modules/workspace/__tests__/agent-access.gate.test.ts +8 -8
- package/src/modules/workspace/__tests__/agent-downloads.test.ts +13 -16
- package/src/modules/workspace/__tests__/agent-uploads.test.ts +11 -12
- package/src/modules/workspace/__tests__/escape-sequences.routes.test.ts +11 -16
- package/src/modules/workspace/__tests__/file-stat-access.test.ts +3 -3
- package/src/modules/workspace/__tests__/git-internals.security.test.ts +27 -27
- package/src/modules/workspace/__tests__/kb-repository.test.ts +1 -1
- package/src/modules/workspace/__tests__/rest-tool-arguments.test.ts +3 -3
- package/src/modules/workspace/__tests__/start-session.default-branch.test.ts +152 -0
- package/src/modules/workspace/__tests__/workspace-paths-inside-the-repo.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace-tmp.tools.test.ts +13 -14
- package/src/modules/workspace/__tests__/workspace.routes.at-ref.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace.routes.branch-errors.test.ts +4 -4
- package/src/modules/workspace/__tests__/workspace.routes.create-grant.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace.routes.delete.test.ts +8 -8
- package/src/modules/workspace/__tests__/workspace.routes.download-implies-read.test.ts +4 -4
- package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace.routes.file-writes.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace.routes.folder-zip-access.test.ts +4 -4
- package/src/modules/workspace/__tests__/workspace.routes.folders.test.ts +6 -6
- package/src/modules/workspace/__tests__/workspace.routes.move-platform-files.test.ts +7 -7
- package/src/modules/workspace/__tests__/workspace.routes.read-gate.test.ts +13 -13
- package/src/modules/workspace/__tests__/workspace.service.any-workspace-credentials.test.ts +1 -1
- package/src/modules/workspace/__tests__/workspace.service.replaced-repository.test.ts +1 -1
- package/src/modules/workspace/__tests__/workspace.service.worktrees.test.ts +1 -1
- package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +5 -5
- package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +5 -5
- package/src/modules/workspace/__tests__/workspace.tools.test.ts +27 -27
- package/src/modules/workspace/agent-access.gate.ts +5 -5
- package/src/modules/workspace/git-internals.middleware.ts +2 -2
- package/src/modules/workspace/kb-repository.ts +1 -1
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.degraded.test.ts +1 -1
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.test.ts +1 -1
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.worktrees.test.ts +1 -1
- package/src/modules/workspace/startup/kb-git.ts +1 -1
- package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +94 -70
- package/src/modules/workspace/startup/steps/seed-tree.ts +4 -5
- package/src/modules/workspace/startup/steps/template-files.step.ts +4 -5
- package/src/modules/workspace/startup/steps/template-source.ts +21 -6
- package/src/modules/workspace/workspace-tmp.ts +4 -4
- package/src/modules/workspace/workspace.routes.ts +26 -26
- package/src/modules/workspace/workspace.service.ts +11 -11
- package/src/modules/workspace/workspace.tools.ts +17 -10
- package/src/shared/__tests__/canonical-file-identity.test.ts +5 -5
- package/src/shared/__tests__/fire-and-forget.test.ts +39 -0
- package/src/shared/__tests__/http-errors.test.ts +4 -4
- package/src/shared/canonical-file-identity.ts +5 -5
- package/src/shared/domain-errors.ts +44 -44
- package/src/shared/fire-and-forget.ts +26 -0
- package/src/shared/git.contract.ts +1 -1
- package/src/shared/http-errors.ts +3 -3
- package/src/shared/kb-context.ts +130 -130
- package/src/shared/pending-proposals.ts +4 -4
- package/src/tenancy/__tests__/tenant-host.test.ts +372 -372
- package/src/tenancy/__tests__/tenant-runtime.test.ts +221 -221
- package/src/tenancy/__tests__/tenant-secrets.test.ts +35 -35
- package/src/tenancy/index.ts +35 -35
- package/src/tenancy/static-tenant-source.ts +1 -1
- package/src/tenancy/tenant-host.ts +261 -261
- package/src/tenancy/tenant-runtime.ts +208 -208
- package/src/tenancy/tenant-source.contract.ts +59 -59
- package/dist/modules/workflow/agent-tools/change-request-read-shape.d.ts.map +0 -1
- package/dist/modules/workflow/agent-tools/change-request-read-shape.js.map +0 -1
- package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts.map +0 -1
- package/dist/modules/workflow/agent-tools/change-request-read.tools.js.map +0 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.d.ts.map +0 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.js.map +0 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +0 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.js.map +0 -1
- package/dist/modules/workflow/change-request-hooks.d.ts.map +0 -1
- package/dist/modules/workflow/change-request-hooks.js.map +0 -1
- package/dist/modules/workflow/event-bus.d.ts.map +0 -1
- package/dist/modules/workflow/event-bus.js.map +0 -1
- package/dist/modules/workflow/events-delivery.d.ts.map +0 -1
- package/dist/modules/workflow/events-delivery.js.map +0 -1
- package/dist/modules/workflow/events.routes.d.ts.map +0 -1
- package/dist/modules/workflow/events.routes.js.map +0 -1
- package/dist/modules/workflow/file-lock.service.d.ts.map +0 -1
- package/dist/modules/workflow/file-lock.service.js.map +0 -1
- package/dist/modules/workflow/git/change-request-link.d.ts.map +0 -1
- package/dist/modules/workflow/git/change-request-link.js.map +0 -1
- package/dist/modules/workflow/git/git-version.d.ts.map +0 -1
- package/dist/modules/workflow/git/git-version.js.map +0 -1
- package/dist/modules/workflow/git/git.service.d.ts.map +0 -1
- package/dist/modules/workflow/git/git.service.js.map +0 -1
- package/dist/modules/workflow/git/merge-commit.d.ts.map +0 -1
- package/dist/modules/workflow/git/merge-commit.js.map +0 -1
- package/dist/modules/workflow/git/node-git-runner.d.ts.map +0 -1
- package/dist/modules/workflow/git/node-git-runner.js.map +0 -1
- package/dist/modules/workflow/git/pull-request.service.d.ts.map +0 -1
- package/dist/modules/workflow/git/pull-request.service.js.map +0 -1
- package/dist/modules/workflow/index.d.ts.map +0 -1
- package/dist/modules/workflow/index.js.map +0 -1
- package/dist/modules/workflow/pending-commits.service.d.ts.map +0 -1
- package/dist/modules/workflow/pending-commits.service.js.map +0 -1
- package/dist/modules/workflow/pending-commits.worker.d.ts.map +0 -1
- package/dist/modules/workflow/pending-commits.worker.js.map +0 -1
- package/dist/modules/workflow/read-on-branch.d.ts.map +0 -1
- package/dist/modules/workflow/read-on-branch.js.map +0 -1
- package/dist/modules/workflow/recovery-bot.d.ts.map +0 -1
- package/dist/modules/workflow/recovery-bot.js.map +0 -1
- package/dist/modules/workflow/review-workflow/approval-lock.d.ts.map +0 -1
- package/dist/modules/workflow/review-workflow/approval-lock.js.map +0 -1
- package/dist/modules/workflow/review-workflow/review-workflow.interface.d.ts.map +0 -1
- package/dist/modules/workflow/review-workflow/review-workflow.interface.js +0 -2
- package/dist/modules/workflow/review-workflow/review-workflow.interface.js.map +0 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts.map +0 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +0 -1
- package/dist/modules/workflow/sanitize-error.d.ts.map +0 -1
- package/dist/modules/workflow/sanitize-error.js.map +0 -1
- package/dist/modules/workflow/workflow-hooks.d.ts.map +0 -1
- package/dist/modules/workflow/workflow-hooks.js.map +0 -1
- package/dist/modules/workflow/workflow.routes.d.ts.map +0 -1
- package/dist/modules/workflow/workflow.routes.js.map +0 -1
- package/dist/modules/workflow/workflow.service.d.ts.map +0 -1
- package/dist/modules/workflow/workflow.service.js.map +0 -1
- package/src/modules/mcp/__tests__/read-only-hint.e2e.test.ts +0 -213
- /package/dist/modules/{workflow → version-control}/agent-tools/change-request-read-shape.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/agent-tools/change-request-read-shape.js +0 -0
- /package/dist/modules/{workflow → version-control}/agent-tools/change-request-read.tools.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/agent-tools/change-request-summary.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/agent-tools/change-request-summary.js +0 -0
- /package/dist/modules/{workflow → version-control}/change-request-hooks.js +0 -0
- /package/dist/modules/{workflow/review-workflow → version-control/change-request-review}/approval-lock.d.ts +0 -0
- /package/dist/modules/{workflow/review-workflow → version-control/change-request-review}/approval-lock.js +0 -0
- /package/dist/modules/{workflow → version-control}/events-delivery.js +0 -0
- /package/dist/modules/{workflow → version-control}/events.routes.js +0 -0
- /package/dist/modules/{workflow → version-control}/git/change-request-link.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/git/change-request-link.js +0 -0
- /package/dist/modules/{workflow → version-control}/git/git-version.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/git/git-version.js +0 -0
- /package/dist/modules/{workflow → version-control}/git/merge-commit.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/git/merge-commit.js +0 -0
- /package/dist/modules/{workflow → version-control}/git/node-git-runner.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/recovery-bot.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/recovery-bot.js +0 -0
- /package/dist/modules/{workflow → version-control}/sanitize-error.d.ts +0 -0
- /package/dist/modules/{workflow → version-control}/sanitize-error.js +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/change-request-hooks.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/fake-file-lock-db.ts +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/pending-commits.canonical.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/pending-commits.enqueue-if-absent.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/pending-commits.repository-replaced.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/__tests__/sanitize-error.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/agent-tools/__tests__/change-request-read-shape.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/agent-tools/change-request-read-shape.ts +0 -0
- /package/src/modules/{workflow → version-control}/agent-tools/change-request-summary.ts +0 -0
- /package/src/modules/{workflow/review-workflow → version-control/change-request-review}/approval-lock.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/branchAuthor.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/change-request-link.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/git-version.failure.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/git-version.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/node-git-runner.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.getPrDetail.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.placeholder.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.viewer-can-cancel.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.viewer-can-delete.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/__tests__/pull-request.service.viewer-can-update.test.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/change-request-link.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/git-version.ts +0 -0
- /package/src/modules/{workflow → version-control}/git/merge-commit.ts +0 -0
- /package/src/modules/{workflow → version-control}/recovery-bot.ts +0 -0
- /package/src/modules/{workflow → version-control}/sanitize-error.ts +0 -0
package/src/modules/{workflow/workflow.service.ts → version-control/version-control.service.ts}
RENAMED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Version-control facade — the only thing app callers (routes, agent tools, tests)
|
|
3
3
|
* should reach for. Today it delegates to the existing git / PR /
|
|
4
|
-
* review
|
|
4
|
+
* change-request-review services; over PLAN steps 2–5 the implementations migrate
|
|
5
5
|
* here directly and the underlying services either disappear or move
|
|
6
6
|
* underneath this module.
|
|
7
7
|
*
|
|
8
8
|
* The facade does no caching, no validation, no policy of its own — it
|
|
9
9
|
* exists to:
|
|
10
|
-
* 1. Lock in the
|
|
11
|
-
* 2. Concentrate every call into git/PR/review
|
|
10
|
+
* 1. Lock in the version-control vocabulary on the consumer side.
|
|
11
|
+
* 2. Concentrate every call into git/PR/change-request-review into one place
|
|
12
12
|
* so the agent prompt can stop knowing about `git` / `gh`.
|
|
13
|
-
*
|
|
14
|
-
* Methods backed by services that don't exist yet (locks, openChangeRequest,
|
|
15
|
-
* updateFromTarget) throw `NotImplementedWorkflowError`. The interface
|
|
16
|
-
* defines them so frontend / agent code can wire to the final surface while
|
|
17
|
-
* those backings land.
|
|
18
13
|
*/
|
|
19
14
|
|
|
20
15
|
import path from 'node:path';
|
|
@@ -55,7 +50,7 @@ import type {
|
|
|
55
50
|
FileLock,
|
|
56
51
|
FolderChangeRequest,
|
|
57
52
|
FolderChangeRequestRemoval,
|
|
58
|
-
|
|
53
|
+
IVersionControlService,
|
|
59
54
|
MergeBranchOutcome,
|
|
60
55
|
MergeChangeRequestOutcome,
|
|
61
56
|
MergeResolution,
|
|
@@ -79,17 +74,16 @@ import { changeRequests, pgErrorCode } from '../database/index.js';
|
|
|
79
74
|
import type { GitService } from './git/git.service.js';
|
|
80
75
|
import { redactSecret } from '../../shared/redact-secret.js';
|
|
81
76
|
import type { PullRequestService } from './git/pull-request.service.js';
|
|
82
|
-
import type {
|
|
77
|
+
import type { IChangeRequestReviewService } from './change-request-review/change-request-review.interface.js';
|
|
83
78
|
import type { WorkspaceService } from '../workspace/index.js';
|
|
84
79
|
import { workspaceIdForBranch, branchForWorkspaceId } from '../../shared/workspace-id.js';
|
|
85
80
|
import type { IAccessControl } from '../access/index.js';
|
|
86
81
|
import type { FileLockService } from './file-lock.service.js';
|
|
87
82
|
import { canonicalFileIdentity } from '../../shared/canonical-file-identity.js';
|
|
88
83
|
import type { PendingCommitsService } from './pending-commits.service.js';
|
|
89
|
-
import type {
|
|
84
|
+
import type { VersionControlEventBus } from './event-bus.js';
|
|
90
85
|
import { describeSyncFailure, sanitizeError } from './sanitize-error.js';
|
|
91
|
-
import
|
|
92
|
-
import { WorkflowHooks } from './workflow-hooks.js';
|
|
86
|
+
import { VersionControlHooks } from './version-control-hooks.js';
|
|
93
87
|
import {
|
|
94
88
|
ChangeRequestHooks,
|
|
95
89
|
type ChangeRequestPerson,
|
|
@@ -109,8 +103,8 @@ import {
|
|
|
109
103
|
PullRebaseConflictError,
|
|
110
104
|
PushNeedsAgentResolutionError,
|
|
111
105
|
RemoteBranchGoneError,
|
|
112
|
-
|
|
113
|
-
|
|
106
|
+
VersionControlDomainError,
|
|
107
|
+
VersionControlValidationError,
|
|
114
108
|
} from '../../shared/domain-errors.js';
|
|
115
109
|
import { RECOVERY_BOT_EMAIL, RECOVERY_BOT_NAME } from './recovery-bot.js';
|
|
116
110
|
import { AccessDeniedError, EVERYONE_CANONICAL, type IChangeReadGate } from '../access-model/index.js';
|
|
@@ -196,7 +190,7 @@ function redactTokens(msg: string, token: string | null | undefined): string {
|
|
|
196
190
|
*/
|
|
197
191
|
function assertDescriptionFits(description: string | undefined): void {
|
|
198
192
|
if (description !== undefined && description.length > CHANGE_REQUEST_DESCRIPTION_MAX) {
|
|
199
|
-
throw new
|
|
193
|
+
throw new VersionControlValidationError(
|
|
200
194
|
`A change request's description is at most ${CHANGE_REQUEST_DESCRIPTION_MAX} characters; this one would have ${description.length}.`,
|
|
201
195
|
);
|
|
202
196
|
}
|
|
@@ -204,13 +198,13 @@ function assertDescriptionFits(description: string | undefined): void {
|
|
|
204
198
|
|
|
205
199
|
function assertEditable(state: string): void {
|
|
206
200
|
if (state === 'merged') {
|
|
207
|
-
throw new
|
|
201
|
+
throw new VersionControlDomainError(
|
|
208
202
|
'This change request has already been applied; its title and description can no longer be changed.',
|
|
209
203
|
409,
|
|
210
204
|
);
|
|
211
205
|
}
|
|
212
206
|
if (state !== 'open') {
|
|
213
|
-
throw new
|
|
207
|
+
throw new VersionControlDomainError(
|
|
214
208
|
'This change request is closed; its title and description can no longer be changed.',
|
|
215
209
|
409,
|
|
216
210
|
);
|
|
@@ -223,7 +217,7 @@ type EligibleWritersAtRef = Awaited<ReturnType<IAccessControl['eligibleWritersFo
|
|
|
223
217
|
/**
|
|
224
218
|
* The one question the open asks of accounts: which of these addresses have
|
|
225
219
|
* a live account. `AuthService.findActiveAccountsByEmail` answers it in a
|
|
226
|
-
* single indexed read; the shape is spelled here so the
|
|
220
|
+
* single indexed read; the shape is spelled here so the version-control module
|
|
227
221
|
* imports nothing of auth's. Keyed by the canonical address asked for.
|
|
228
222
|
*/
|
|
229
223
|
export interface ApproverAccounts {
|
|
@@ -254,13 +248,13 @@ function folderPrefix(folder: string): string {
|
|
|
254
248
|
return `${folder.replace(/\/+$/, '')}/`;
|
|
255
249
|
}
|
|
256
250
|
|
|
257
|
-
export class
|
|
251
|
+
export class VersionControlService implements IVersionControlService {
|
|
258
252
|
/**
|
|
259
253
|
* Concrete `PullRequestService` (not the interface) so the facade can call
|
|
260
254
|
* `invalidateDetailCache` after a mutation lands — the legacy routes do
|
|
261
|
-
* this inline, and the
|
|
255
|
+
* this inline, and the version-control facade absorbs that responsibility so its
|
|
262
256
|
* own routes stay free of cache plumbing. Replaceable later when the PR
|
|
263
|
-
* detail cache moves into the
|
|
257
|
+
* detail cache moves into the version-control module proper (PLAN step 5).
|
|
264
258
|
*
|
|
265
259
|
* `db` + `workspaceService` + `kbDirName` back `openChangeRequest`, which
|
|
266
260
|
* inserts a change_requests row and runs the local auto-merge — no provider
|
|
@@ -268,10 +262,10 @@ export class WorkflowService implements IWorkflowService {
|
|
|
268
262
|
*/
|
|
269
263
|
/**
|
|
270
264
|
* Concrete `GitService` (not the interface) so the facade can reach
|
|
271
|
-
* `mergeFromOrigin` — the local auto-merge primitive the
|
|
265
|
+
* `mergeFromOrigin` — the local auto-merge primitive the version-control service needs
|
|
272
266
|
* for `openChangeRequest` + `updateFromTarget` (PLAN §1). The interface
|
|
273
267
|
* intentionally doesn't surface that method because it's an internal
|
|
274
|
-
* implementation detail of the
|
|
268
|
+
* implementation detail of the version-control auto-merge story; nothing outside
|
|
275
269
|
* the facade should call it directly.
|
|
276
270
|
*/
|
|
277
271
|
private get kbDirName(): string {
|
|
@@ -282,7 +276,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
282
276
|
private readonly db: Database,
|
|
283
277
|
private readonly git: GitService,
|
|
284
278
|
private readonly prs: PullRequestService,
|
|
285
|
-
private readonly
|
|
279
|
+
private readonly changeRequestReview: IChangeRequestReviewService,
|
|
286
280
|
private readonly workspaceService: WorkspaceService,
|
|
287
281
|
private readonly accessControl: IAccessControl,
|
|
288
282
|
private readonly fileLocks: FileLockService,
|
|
@@ -308,24 +302,17 @@ export class WorkflowService implements IWorkflowService {
|
|
|
308
302
|
* become no-ops in that case (we null-guard each call). In a real
|
|
309
303
|
* boot the composition root always wires one.
|
|
310
304
|
*/
|
|
311
|
-
private readonly events?:
|
|
312
|
-
/**
|
|
313
|
-
* In-process post-commit hook (distinct from the SSE `events` bus): fires
|
|
314
|
-
* after a file's change is committed + pushed so backend services (catalog
|
|
315
|
-
* invalidation, id-repair) react without the per-file TTL wait. Optional,
|
|
316
|
-
* like `events`.
|
|
317
|
-
*/
|
|
318
|
-
private readonly fileChanges?: FileChangeNotifier,
|
|
305
|
+
private readonly events?: VersionControlEventBus,
|
|
319
306
|
/**
|
|
320
|
-
*
|
|
307
|
+
* Version-control lifecycle-hook registry (see `version-control-hooks.ts`). PUBLIC so
|
|
321
308
|
* the composition root registers module-owned behavior against it
|
|
322
|
-
* (`core.
|
|
309
|
+
* (`core.versionControlService.hooks.onCommitValidation(…)` /
|
|
323
310
|
* `.onPreWrite(…)`) after `createCoreServices` returns. The composition
|
|
324
311
|
* root passes the SAME instance `GitService` and the agent-access gate
|
|
325
312
|
* consult; the default keeps test constructions (which don't exercise
|
|
326
313
|
* hooks) unchanged.
|
|
327
314
|
*/
|
|
328
|
-
public readonly hooks:
|
|
315
|
+
public readonly hooks: VersionControlHooks = new VersionControlHooks(),
|
|
329
316
|
/**
|
|
330
317
|
* The seam a deployment's notification extends when a request is opened
|
|
331
318
|
* (see `change-request-hooks.ts`). The composition root passes the SAME
|
|
@@ -343,7 +330,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
343
330
|
// The type already requires it; this holds for a caller the compiler did
|
|
344
331
|
// not see (plain JavaScript, a positional slip in a harness).
|
|
345
332
|
if (!changeGate || typeof changeGate.assertMayChange !== 'function') {
|
|
346
|
-
throw new Error('
|
|
333
|
+
throw new Error('VersionControlService requires a read-before-write gate (IChangeReadGate)');
|
|
347
334
|
}
|
|
348
335
|
}
|
|
349
336
|
|
|
@@ -518,7 +505,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
518
505
|
// this branch is the deleter's own to withdraw; a request INTO it
|
|
519
506
|
// belongs to someone else, and telling the branch owner to
|
|
520
507
|
// "withdraw" it points them at a verb they cannot use.
|
|
521
|
-
throw new
|
|
508
|
+
throw new VersionControlValidationError(
|
|
522
509
|
open.end === 'source'
|
|
523
510
|
? `Branch "${name}" has an open change request (#${open.number}). ` +
|
|
524
511
|
`Withdraw or decline it before deleting the branch.`
|
|
@@ -926,7 +913,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
926
913
|
// operation, which was the only place the legacy DirtyWorkingTreeError
|
|
927
914
|
// could surface as a user-facing 409.
|
|
928
915
|
|
|
929
|
-
// `forkCurrentToDraft` removed (see
|
|
916
|
+
// `forkCurrentToDraft` removed (see IVersionControlService): per-branch workspaces
|
|
930
917
|
// make the dirty-tree-carry-along escape hatch impossible by construction.
|
|
931
918
|
|
|
932
919
|
branchStatus(workspaceId: string): Promise<BranchWorkspaceStatus> {
|
|
@@ -1140,7 +1127,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
1140
1127
|
// this sync's — never a save that landed alongside. Capped: a bulk
|
|
1141
1128
|
// import would otherwise fan hundreds of events out to say what one
|
|
1142
1129
|
// refresh says.
|
|
1143
|
-
if (announce.changedPaths.length <=
|
|
1130
|
+
if (announce.changedPaths.length <= VersionControlService.SYNC_FILE_EVENT_CAP) {
|
|
1144
1131
|
for (const p of announce.changedPaths) {
|
|
1145
1132
|
this.events?.emit({
|
|
1146
1133
|
kind: 'file-changed',
|
|
@@ -1549,7 +1536,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
1549
1536
|
const targetPath = canonicalFileIdentity(rawPath);
|
|
1550
1537
|
const lock = await this.fileLocks.get(workspaceId, branch, targetPath);
|
|
1551
1538
|
if (!lock || lock.holderUserId !== user.id) {
|
|
1552
|
-
throw new
|
|
1539
|
+
throw new VersionControlValidationError(
|
|
1553
1540
|
`Cannot commit "${targetPath}": you don't hold the lock.`,
|
|
1554
1541
|
{ kind: 'lock-not-held', branch, path: targetPath },
|
|
1555
1542
|
);
|
|
@@ -1560,7 +1547,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
1560
1547
|
// holder checkpoint bytes onto a path — machine-owned files included —
|
|
1561
1548
|
// whose write rule they never passed.
|
|
1562
1549
|
if (lock.mode === 'coordination') {
|
|
1563
|
-
throw new
|
|
1550
|
+
throw new VersionControlValidationError(
|
|
1564
1551
|
`Cannot commit "${targetPath}": the lock is a coordination hold, which grants no write authority.`,
|
|
1565
1552
|
{ kind: 'coordination-hold', branch, path: targetPath },
|
|
1566
1553
|
);
|
|
@@ -1683,7 +1670,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
1683
1670
|
lockLog.warn(
|
|
1684
1671
|
`RELEASE refused ws=${workspaceId} branch=${branch} path=${targetPath} user=${user.id} → ${lock ? `held by ${lock.holderUserId}` : 'no lock row'}`,
|
|
1685
1672
|
);
|
|
1686
|
-
throw new
|
|
1673
|
+
throw new VersionControlValidationError(
|
|
1687
1674
|
`Cannot release lock on "${targetPath}": not held by you (or no longer exists).`,
|
|
1688
1675
|
{ kind: 'lock-not-held', branch, path: targetPath },
|
|
1689
1676
|
);
|
|
@@ -1701,7 +1688,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
1701
1688
|
lockLog.warn(
|
|
1702
1689
|
`RELEASE refused ws=${workspaceId} branch=${branch} path=${targetPath} user=${user.id} → coordination hold (no commit may be enqueued)`,
|
|
1703
1690
|
);
|
|
1704
|
-
throw new
|
|
1691
|
+
throw new VersionControlValidationError(
|
|
1705
1692
|
`Cannot release lock on "${targetPath}" with a commit: it is a coordination hold. Use releaseLockNoCommit.`,
|
|
1706
1693
|
{ kind: 'coordination-hold', branch, path: targetPath },
|
|
1707
1694
|
);
|
|
@@ -1782,11 +1769,14 @@ export class WorkflowService implements IWorkflowService {
|
|
|
1782
1769
|
// which is exactly how a diverged workspace ends up stuck forever.
|
|
1783
1770
|
// So: if the branch is ahead of its remote-tracking ref, push (with
|
|
1784
1771
|
// the same cooperative recovery, so a conflicting divergence throws
|
|
1785
|
-
// and the worker's ladder takes over).
|
|
1772
|
+
// and the worker's ladder takes over). No `file-changed` either way —
|
|
1786
1773
|
// there's no new sha.
|
|
1787
1774
|
if (await this.git.hasUnpushedCommits(workspaceId)) {
|
|
1788
1775
|
await this.pushWithRecovery(workspaceId, branch, targetPath, user, opts);
|
|
1789
1776
|
}
|
|
1777
|
+
// Nothing landed here, so nothing is announced: the git layer reports
|
|
1778
|
+
// each commit as it lands (an autosave checkpoint, a batch whose push
|
|
1779
|
+
// retry this row is), and this row made none.
|
|
1790
1780
|
return;
|
|
1791
1781
|
}
|
|
1792
1782
|
await this.pushWithRecovery(workspaceId, branch, targetPath, user, opts);
|
|
@@ -1799,9 +1789,6 @@ export class WorkflowService implements IWorkflowService {
|
|
|
1799
1789
|
byUserId: user.id,
|
|
1800
1790
|
byUserName: user.name,
|
|
1801
1791
|
});
|
|
1802
|
-
// Post-commit, post-lock-release: the one chokepoint every single-file write
|
|
1803
|
-
// converges on. Backend reactors (catalog invalidation, id-repair) hook here.
|
|
1804
|
-
this.fileChanges?.emit({ workspaceId, branch, paths: [targetPath], byUser: user });
|
|
1805
1792
|
}
|
|
1806
1793
|
|
|
1807
1794
|
/**
|
|
@@ -1896,7 +1883,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
1896
1883
|
* still fails." The full rationale lives at the call site in
|
|
1897
1884
|
* `releaseLock`; this method is the de-duplicated body.
|
|
1898
1885
|
*
|
|
1899
|
-
* EVERY
|
|
1886
|
+
* EVERY version-control push goes through here — saves, sharing a branch, opening
|
|
1900
1887
|
* a request, update-from-target, the decline revert, the roles.yaml
|
|
1901
1888
|
* restore — so a push the host refuses answers one way everywhere: the
|
|
1902
1889
|
* commit stays local, the sync banner goes up, and the caller gets the
|
|
@@ -2061,7 +2048,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2061
2048
|
//
|
|
2062
2049
|
// One refinement for COORDINATION holds: the holder never legitimately
|
|
2063
2050
|
// wrote the path (the write paths refuse coordination possession), so
|
|
2064
|
-
// anything dirty there is either bytes smuggled in around
|
|
2051
|
+
// anything dirty there is either bytes smuggled in around version control —
|
|
2065
2052
|
// which the discard rightly wipes — or a PRIOR save's work whose commit
|
|
2066
2053
|
// is still queued. Only the queue can tell those apart: when a live
|
|
2067
2054
|
// pending-commit row exists for the path, the dirty bytes are that
|
|
@@ -2279,15 +2266,15 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2279
2266
|
user: AuthUser,
|
|
2280
2267
|
input: OpenChangeRequestInput,
|
|
2281
2268
|
): Promise<ChangeRequestDetail & { notified: string[] }> {
|
|
2282
|
-
if (!input.sourceBranch) throw new
|
|
2283
|
-
if (!input.targetBranch) throw new
|
|
2269
|
+
if (!input.sourceBranch) throw new VersionControlValidationError('sourceBranch is required');
|
|
2270
|
+
if (!input.targetBranch) throw new VersionControlValidationError('targetBranch is required');
|
|
2284
2271
|
if (input.sourceBranch === input.targetBranch) {
|
|
2285
|
-
throw new
|
|
2272
|
+
throw new VersionControlValidationError('source and target branches must differ');
|
|
2286
2273
|
}
|
|
2287
|
-
if (!input.title?.trim()) throw new
|
|
2274
|
+
if (!input.title?.trim()) throw new VersionControlValidationError('title is required');
|
|
2288
2275
|
assertDescriptionFits(input.description?.trim());
|
|
2289
2276
|
if (this.kb.isProtectedBranch(input.sourceBranch)) {
|
|
2290
|
-
throw new
|
|
2277
|
+
throw new VersionControlValidationError(
|
|
2291
2278
|
`Cannot open a change request *from* a protected branch ("${input.sourceBranch}").`,
|
|
2292
2279
|
{ kind: 'source-is-protected', sourceBranch: input.sourceBranch },
|
|
2293
2280
|
);
|
|
@@ -2334,7 +2321,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2334
2321
|
|
|
2335
2322
|
// Auto-merge target → source. `mergeFromOrigin` enforces "current
|
|
2336
2323
|
// branch == source" and "clean working tree" before attempting; both
|
|
2337
|
-
// failures surface as structured
|
|
2324
|
+
// failures surface as structured version-control errors that pass straight
|
|
2338
2325
|
// through to the caller.
|
|
2339
2326
|
const mergeOutcome = await this.git.mergeFromOrigin(
|
|
2340
2327
|
workspaceId,
|
|
@@ -2428,7 +2415,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2428
2415
|
// rival was merged/closed in the microsecond between the conflict and
|
|
2429
2416
|
// this re-query), don't fabricate a #0 — report it as a transient race.
|
|
2430
2417
|
if (!existing) {
|
|
2431
|
-
throw new
|
|
2418
|
+
throw new VersionControlValidationError(
|
|
2432
2419
|
`Change request for "${input.sourceBranch}" → "${input.targetBranch}" ` +
|
|
2433
2420
|
'raced with a concurrent open/close; retry.',
|
|
2434
2421
|
{ kind: 'open-change-request-failed' },
|
|
@@ -2446,7 +2433,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2446
2433
|
// openChangeRequest finds no duplicate, re-runs the (idempotent, already
|
|
2447
2434
|
// up-to-date) auto-merge, and inserts the row.
|
|
2448
2435
|
const rawMsg = err instanceof Error ? err.message : String(err);
|
|
2449
|
-
throw new
|
|
2436
|
+
throw new VersionControlValidationError(
|
|
2450
2437
|
`Failed to open change request: ${redactTokens(rawMsg, this.git.credentials?.token())}`,
|
|
2451
2438
|
{ kind: 'open-change-request-failed' },
|
|
2452
2439
|
);
|
|
@@ -2492,7 +2479,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2492
2479
|
detail: null,
|
|
2493
2480
|
pushRefused: null,
|
|
2494
2481
|
detailError:
|
|
2495
|
-
detailError ?? new
|
|
2482
|
+
detailError ?? new VersionControlValidationError(`Created change request #${prNumber} but could not fetch its detail`),
|
|
2496
2483
|
};
|
|
2497
2484
|
});
|
|
2498
2485
|
|
|
@@ -2622,19 +2609,19 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2622
2609
|
patches: false,
|
|
2623
2610
|
});
|
|
2624
2611
|
if (!detail) {
|
|
2625
|
-
throw new
|
|
2612
|
+
throw new VersionControlValidationError(
|
|
2626
2613
|
`Change request #${number} not found.`,
|
|
2627
2614
|
{ kind: 'change-request-not-found', number },
|
|
2628
2615
|
);
|
|
2629
2616
|
}
|
|
2630
2617
|
if (detail.state !== 'open') {
|
|
2631
|
-
throw new
|
|
2618
|
+
throw new VersionControlValidationError(
|
|
2632
2619
|
`Change request #${number} is ${detail.state} — only open requests can refresh from target.`,
|
|
2633
2620
|
{ kind: 'change-request-not-open', state: detail.state },
|
|
2634
2621
|
);
|
|
2635
2622
|
}
|
|
2636
2623
|
if (!detail.viewerCanUpdate) {
|
|
2637
|
-
throw new
|
|
2624
|
+
throw new VersionControlDomainError(
|
|
2638
2625
|
'Only the author of this change request, or someone who may apply it, can update it.',
|
|
2639
2626
|
403,
|
|
2640
2627
|
);
|
|
@@ -2780,7 +2767,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2780
2767
|
headBeforeMerge,
|
|
2781
2768
|
headAfterMerge,
|
|
2782
2769
|
);
|
|
2783
|
-
await this.
|
|
2770
|
+
await this.changeRequestReview.carryApprovalsForward(
|
|
2784
2771
|
number,
|
|
2785
2772
|
headBeforeMerge,
|
|
2786
2773
|
headAfterMerge,
|
|
@@ -2806,7 +2793,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2806
2793
|
viewerEmail: user.email,
|
|
2807
2794
|
});
|
|
2808
2795
|
if (!refreshed) {
|
|
2809
|
-
throw new
|
|
2796
|
+
throw new VersionControlValidationError(
|
|
2810
2797
|
`Refreshed change request #${number} but could not re-fetch its detail.`,
|
|
2811
2798
|
);
|
|
2812
2799
|
}
|
|
@@ -2825,7 +2812,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2825
2812
|
): Promise<FileApproval[]> {
|
|
2826
2813
|
// Taken BEFORE the approval lands (see `clearApplyFailure`).
|
|
2827
2814
|
const approvedAfter = new Date();
|
|
2828
|
-
const approvals = await this.
|
|
2815
|
+
const approvals = await this.changeRequestReview.approveFile(
|
|
2829
2816
|
number,
|
|
2830
2817
|
path,
|
|
2831
2818
|
user,
|
|
@@ -2865,7 +2852,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2865
2852
|
authorIdHash: string | null,
|
|
2866
2853
|
workspaceId: string,
|
|
2867
2854
|
): Promise<FileApproval[]> {
|
|
2868
|
-
const approvals = await this.
|
|
2855
|
+
const approvals = await this.changeRequestReview.unapproveFile(
|
|
2869
2856
|
number,
|
|
2870
2857
|
path,
|
|
2871
2858
|
user,
|
|
@@ -2933,9 +2920,9 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2933
2920
|
repoRelPath: string,
|
|
2934
2921
|
): Promise<{ closed: boolean; remainingPaths: string[] }> {
|
|
2935
2922
|
const summary = await this.prs.getPr(number);
|
|
2936
|
-
if (!summary) throw new
|
|
2923
|
+
if (!summary) throw new VersionControlDomainError('change request not found', 404);
|
|
2937
2924
|
if (summary.state !== 'open') {
|
|
2938
|
-
throw new
|
|
2925
|
+
throw new VersionControlDomainError('This change request is no longer open.', 422);
|
|
2939
2926
|
}
|
|
2940
2927
|
const baseBranch = summary.base;
|
|
2941
2928
|
const headBranch = summary.branch;
|
|
@@ -2954,7 +2941,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2954
2941
|
// The verb acts on the request as it is NOW — never a cached file list.
|
|
2955
2942
|
const paths = await this.git.changedPathsForPr(ws.id, baseBranch, headBranch);
|
|
2956
2943
|
if (!paths.includes(repoRelPath)) {
|
|
2957
|
-
throw new
|
|
2944
|
+
throw new VersionControlDomainError('That file is not part of this change request.', 422);
|
|
2958
2945
|
}
|
|
2959
2946
|
|
|
2960
2947
|
const canApprove = await this.accessControl.canWriteAtRef(
|
|
@@ -2964,7 +2951,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2964
2951
|
repoRelPath,
|
|
2965
2952
|
);
|
|
2966
2953
|
if (canApprove !== true) {
|
|
2967
|
-
throw new
|
|
2954
|
+
throw new VersionControlDomainError(
|
|
2968
2955
|
'Only an eligible approver of this file can revert it — declining takes the same permission as accepting.',
|
|
2969
2956
|
403,
|
|
2970
2957
|
);
|
|
@@ -2972,7 +2959,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2972
2959
|
|
|
2973
2960
|
const mergeBase = await this.git.mergeBaseForPr(ws.id, baseBranch, headBranch);
|
|
2974
2961
|
if (!mergeBase) {
|
|
2975
|
-
throw new
|
|
2962
|
+
throw new VersionControlDomainError('These branches share no history to revert to.', 422);
|
|
2976
2963
|
}
|
|
2977
2964
|
|
|
2978
2965
|
const placeholder = await this.placeholderRevertedWith(ws.id, mergeBase, repoRelPath, paths);
|
|
@@ -2991,7 +2978,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
2991
2978
|
const lockPath = `${this.kbDirName}/${p}`;
|
|
2992
2979
|
const lock = await this.fileLocks.acquire(ws.id, headBranch, lockPath, user);
|
|
2993
2980
|
if (!lock.acquired) {
|
|
2994
|
-
throw new
|
|
2981
|
+
throw new VersionControlDomainError(
|
|
2995
2982
|
p === repoRelPath
|
|
2996
2983
|
? `${repoRelPath} is being edited by ${lock.lock.holderName} — try again once the edit settles.`
|
|
2997
2984
|
: `The folder of ${repoRelPath} is being changed by ${lock.lock.holderName} — try again once the edit settles.`,
|
|
@@ -3079,7 +3066,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3079
3066
|
log.warn(
|
|
3080
3067
|
`changedPathsForPr failed for #${cr.number} under folder ${printable(folder)}: ${printable(sanitizeError(err))}`,
|
|
3081
3068
|
);
|
|
3082
|
-
throw new
|
|
3069
|
+
throw new VersionControlDomainError(
|
|
3083
3070
|
`Couldn't read what change request #${cr.number} proposes — try again in a moment.`,
|
|
3084
3071
|
500,
|
|
3085
3072
|
);
|
|
@@ -3159,7 +3146,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3159
3146
|
const requests = await this.changeRequestsUnderFolder(folder, user);
|
|
3160
3147
|
const refused = requests.filter((r) => !r.mayRemove);
|
|
3161
3148
|
if (refused.length > 0) {
|
|
3162
|
-
throw new
|
|
3149
|
+
throw new VersionControlDomainError(
|
|
3163
3150
|
`You can't remove proposed changes from ${refused.map((r) => `#${r.number}`).join(', ')} — only the author, an admin or someone who can write every file it proposes here can.`,
|
|
3164
3151
|
403,
|
|
3165
3152
|
);
|
|
@@ -3185,7 +3172,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3185
3172
|
log.warn(
|
|
3186
3173
|
`pull failed for #${summary.number} before removing folder ${printable(folder)}: ${printable(sanitizeError(err))}`,
|
|
3187
3174
|
);
|
|
3188
|
-
throw new
|
|
3175
|
+
throw new VersionControlDomainError(
|
|
3189
3176
|
`#${summary.number} could not be brought up to date, so nothing was removed — try again in a moment.`,
|
|
3190
3177
|
409,
|
|
3191
3178
|
);
|
|
@@ -3198,7 +3185,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3198
3185
|
// file need not be one of it — so the request has to be asked about again.
|
|
3199
3186
|
const unjudged = paths.filter((p) => !request.paths.includes(p));
|
|
3200
3187
|
if (unjudged.length > 0) {
|
|
3201
|
-
throw new
|
|
3188
|
+
throw new VersionControlDomainError(
|
|
3202
3189
|
`#${summary.number} changed while the folder was being deleted (${unjudged.length === 1 ? unjudged[0] :`${unjudged.length} new files`}), so no proposed changes were removed — try again.`,
|
|
3203
3190
|
409,
|
|
3204
3191
|
);
|
|
@@ -3207,7 +3194,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3207
3194
|
if (paths.length > 0) {
|
|
3208
3195
|
mergeBase = await this.git.mergeBaseForPr(ws.id, summary.base, summary.branch);
|
|
3209
3196
|
if (!mergeBase) {
|
|
3210
|
-
throw new
|
|
3197
|
+
throw new VersionControlDomainError(`#${summary.number} shares no history with its target to revert to.`, 422);
|
|
3211
3198
|
}
|
|
3212
3199
|
}
|
|
3213
3200
|
plans.push({ number: summary.number, branch: summary.branch, wsId: ws.id, paths, mergeBase });
|
|
@@ -3237,7 +3224,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3237
3224
|
group.paths.push({ path: repoRelPath, mergeBase: plan.mergeBase! });
|
|
3238
3225
|
} else if (seen.mergeBase !== plan.mergeBase) {
|
|
3239
3226
|
const sharing = group.plans.map((other) => `#${other.number}`).join(', ');
|
|
3240
|
-
throw new
|
|
3227
|
+
throw new VersionControlDomainError(
|
|
3241
3228
|
`${sharing} propose ${repoRelPath} from the same branch against different targets, so it can't be taken out of both at once. Decline it in each request instead.`,
|
|
3242
3229
|
422,
|
|
3243
3230
|
);
|
|
@@ -3267,7 +3254,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3267
3254
|
const lockPath = `${this.kbDirName}/${repoRelPath}`;
|
|
3268
3255
|
const lock = await this.fileLocks.acquire(group.wsId, group.branch, lockPath, user);
|
|
3269
3256
|
if (!lock.acquired) {
|
|
3270
|
-
throw new
|
|
3257
|
+
throw new VersionControlDomainError(
|
|
3271
3258
|
`${repoRelPath} is being edited by ${lock.lock.holderName} — try again once the edit settles.`,
|
|
3272
3259
|
409,
|
|
3273
3260
|
);
|
|
@@ -3350,7 +3337,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3350
3337
|
log.warn(
|
|
3351
3338
|
`push failed for ${failed} removing folder ${printable(folder)}: ${printable(sanitizeError(pushFailure.err))}`,
|
|
3352
3339
|
);
|
|
3353
|
-
throw new
|
|
3340
|
+
throw new VersionControlDomainError(
|
|
3354
3341
|
`The folder's files were removed from ${finished.map((plan) => `#${plan.number}`).join(', ')}, but ${failed} could not be updated and it and any later requests were left as they were. Run the delete again to finish.`,
|
|
3355
3342
|
500,
|
|
3356
3343
|
);
|
|
@@ -3374,9 +3361,9 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3374
3361
|
*/
|
|
3375
3362
|
async deleteChangeRequest(number: number, user: AuthUser): Promise<void> {
|
|
3376
3363
|
const summary = await this.prs.getPr(number);
|
|
3377
|
-
if (!summary) throw new
|
|
3364
|
+
if (!summary) throw new VersionControlDomainError('change request not found', 404);
|
|
3378
3365
|
if (summary.state === 'merged') {
|
|
3379
|
-
throw new
|
|
3366
|
+
throw new VersionControlDomainError('This change request has already been applied.', 422);
|
|
3380
3367
|
}
|
|
3381
3368
|
|
|
3382
3369
|
// Which `roles.yaml` authorizes this? The base branch's, exactly as every
|
|
@@ -3401,7 +3388,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3401
3388
|
try {
|
|
3402
3389
|
await this.workspaceService.ensureRemotesFetched(ws.id, { strict: true });
|
|
3403
3390
|
} catch {
|
|
3404
|
-
throw new
|
|
3391
|
+
throw new VersionControlDomainError(
|
|
3405
3392
|
`Could not verify the base branch "${summary.base}" — origin was unreachable. Retry in a moment.`,
|
|
3406
3393
|
409,
|
|
3407
3394
|
);
|
|
@@ -3424,7 +3411,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3424
3411
|
// attempt the sweep has either closed the row or shown the base alive.
|
|
3425
3412
|
if (isAdmin === null) {
|
|
3426
3413
|
this.kickDeletedBranchSweep();
|
|
3427
|
-
throw new
|
|
3414
|
+
throw new VersionControlDomainError(
|
|
3428
3415
|
`The base branch "${summary.base}" could not be resolved — it may have been deleted, or origin was unreachable. A background check is running; retry in a moment.`,
|
|
3429
3416
|
409,
|
|
3430
3417
|
);
|
|
@@ -3439,7 +3426,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3439
3426
|
// stay honest.
|
|
3440
3427
|
const callerIsAuthor = !!(summary.authorId && summary.authorId === hashEmail(user.email));
|
|
3441
3428
|
if (!callerIsAuthor && isAdmin !== true) {
|
|
3442
|
-
throw new
|
|
3429
|
+
throw new VersionControlDomainError("Only the request's author or an admin can delete it.", 403);
|
|
3443
3430
|
}
|
|
3444
3431
|
|
|
3445
3432
|
// Close first (idempotent: an already-closed request just skips to the
|
|
@@ -3456,7 +3443,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3456
3443
|
} else {
|
|
3457
3444
|
const fresh = await this.prs.getPr(number);
|
|
3458
3445
|
if (fresh?.state === 'merged') {
|
|
3459
|
-
throw new
|
|
3446
|
+
throw new VersionControlDomainError('This change request has already been applied.', 422);
|
|
3460
3447
|
}
|
|
3461
3448
|
}
|
|
3462
3449
|
await this.retireMergedSourceBranch(number, summary.base, user);
|
|
@@ -3495,7 +3482,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3495
3482
|
await this.workspaceService.ensureRemotesFetched(workspaceId, { strict: true, force: true });
|
|
3496
3483
|
} catch {
|
|
3497
3484
|
this.kickDeletedBranchSweep();
|
|
3498
|
-
throw new
|
|
3485
|
+
throw new VersionControlDomainError(
|
|
3499
3486
|
`Could not verify the base branch "${baseBranch}" — origin was unreachable. Retry in a moment.`,
|
|
3500
3487
|
409,
|
|
3501
3488
|
);
|
|
@@ -3512,7 +3499,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3512
3499
|
// read and a batch lookup done for nothing.
|
|
3513
3500
|
if (isAdmin === null) {
|
|
3514
3501
|
this.kickDeletedBranchSweep();
|
|
3515
|
-
throw new
|
|
3502
|
+
throw new VersionControlDomainError(
|
|
3516
3503
|
`The base branch "${baseBranch}" could not be resolved — it may have been deleted, or origin was unreachable. A background check is running; retry in a moment.`,
|
|
3517
3504
|
409,
|
|
3518
3505
|
);
|
|
@@ -3561,16 +3548,16 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3561
3548
|
const description = input.description === undefined ? undefined : input.description.trim();
|
|
3562
3549
|
const appended = input.appendDescription === undefined ? undefined : input.appendDescription.trim();
|
|
3563
3550
|
if (title === undefined && description === undefined && appended === undefined) {
|
|
3564
|
-
throw new
|
|
3551
|
+
throw new VersionControlValidationError('Give a new title, a new description, or both.');
|
|
3565
3552
|
}
|
|
3566
3553
|
if (description !== undefined && appended !== undefined) {
|
|
3567
|
-
throw new
|
|
3554
|
+
throw new VersionControlValidationError('Give either a new description or text to append to it, not both.');
|
|
3568
3555
|
}
|
|
3569
3556
|
if (title !== undefined && title.length === 0) {
|
|
3570
|
-
throw new
|
|
3557
|
+
throw new VersionControlValidationError('A change request needs a title; it cannot be empty.');
|
|
3571
3558
|
}
|
|
3572
3559
|
if (title !== undefined && title.length > CHANGE_REQUEST_TITLE_MAX) {
|
|
3573
|
-
throw new
|
|
3560
|
+
throw new VersionControlValidationError(
|
|
3574
3561
|
`A change request's title is at most ${CHANGE_REQUEST_TITLE_MAX} characters; this one has ${title.length}.`,
|
|
3575
3562
|
);
|
|
3576
3563
|
}
|
|
@@ -3579,7 +3566,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3579
3566
|
// stored.
|
|
3580
3567
|
assertDescriptionFits(description);
|
|
3581
3568
|
const summary = await this.prs.getPr(number);
|
|
3582
|
-
if (!summary) throw new
|
|
3569
|
+
if (!summary) throw new VersionControlDomainError('change request not found', 404);
|
|
3583
3570
|
assertEditable(summary.state);
|
|
3584
3571
|
|
|
3585
3572
|
// The grants beyond authorship are read in the base branch's own workspace,
|
|
@@ -3601,7 +3588,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3601
3588
|
},
|
|
3602
3589
|
);
|
|
3603
3590
|
if (grant === null) {
|
|
3604
|
-
throw new
|
|
3591
|
+
throw new VersionControlDomainError(
|
|
3605
3592
|
"Only the request's author, an admin, or someone who may approve every file it changes can edit its title and description.",
|
|
3606
3593
|
403,
|
|
3607
3594
|
);
|
|
@@ -3649,14 +3636,14 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3649
3636
|
this.prs.invalidateDetailCache(number);
|
|
3650
3637
|
if (!updated) {
|
|
3651
3638
|
const fresh = await this.prs.getPr(number);
|
|
3652
|
-
if (!fresh) throw new
|
|
3639
|
+
if (!fresh) throw new VersionControlDomainError('change request not found', 404);
|
|
3653
3640
|
assertEditable(fresh.state);
|
|
3654
|
-
throw new
|
|
3641
|
+
throw new VersionControlDomainError('This change request changed while it was being edited. Retry in a moment.', 409);
|
|
3655
3642
|
}
|
|
3656
3643
|
crLog.info(`#${number} title/description edited`);
|
|
3657
3644
|
this.events?.emit({ kind: 'change-request-edited', number });
|
|
3658
3645
|
const fresh = await this.prs.getPr(number);
|
|
3659
|
-
if (!fresh) throw new
|
|
3646
|
+
if (!fresh) throw new VersionControlDomainError('change request not found', 404);
|
|
3660
3647
|
return fresh;
|
|
3661
3648
|
}
|
|
3662
3649
|
|
|
@@ -3734,7 +3721,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
3734
3721
|
* branch is gone. Closing takes it out of every open list (which is the
|
|
3735
3722
|
* whole visible problem) while a `state = 'closed'` row can still be read,
|
|
3736
3723
|
* counted, and reopened by hand. Deleting would make this sweep the one
|
|
3737
|
-
* operation in
|
|
3724
|
+
* operation in version control that destroys history without a human asking.
|
|
3738
3725
|
*
|
|
3739
3726
|
* ONE fetch, then a set lookup. The freshness matters more than the cost:
|
|
3740
3727
|
* `changedPathsForPr` fails when a branch is missing from THAT
|
|
@@ -4202,7 +4189,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
4202
4189
|
}
|
|
4203
4190
|
}
|
|
4204
4191
|
|
|
4205
|
-
const result = await this.
|
|
4192
|
+
const result = await this.changeRequestReview.cancelPr(
|
|
4206
4193
|
number,
|
|
4207
4194
|
user,
|
|
4208
4195
|
state,
|
|
@@ -4280,7 +4267,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
4280
4267
|
|
|
4281
4268
|
let result;
|
|
4282
4269
|
try {
|
|
4283
|
-
result = await this.
|
|
4270
|
+
result = await this.changeRequestReview.mergePr(
|
|
4284
4271
|
number,
|
|
4285
4272
|
user,
|
|
4286
4273
|
mergeHeadSha,
|
|
@@ -4430,7 +4417,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
4430
4417
|
|
|
4431
4418
|
async mergeBranch(user: AuthUser, sourceBranch: string, targetBranch: string): Promise<MergeBranchOutcome> {
|
|
4432
4419
|
if (sourceBranch === targetBranch) {
|
|
4433
|
-
throw new
|
|
4420
|
+
throw new VersionControlValidationError(`\`source\` and \`target\` are both "${sourceBranch}" — name two different branches.`);
|
|
4434
4421
|
}
|
|
4435
4422
|
|
|
4436
4423
|
// Asked once BEFORE waiting, so a merge the open request forbids is refused
|
|
@@ -4481,7 +4468,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
4481
4468
|
// The merge runs in the target's own workspace, like a change request's.
|
|
4482
4469
|
const targetWorkspaceId = (await this.workspaceService.getOrCreateForBranch(targetBranch)).id;
|
|
4483
4470
|
if (!(await this.git.remoteBranchExists(targetWorkspaceId, sourceBranch))) {
|
|
4484
|
-
throw new
|
|
4471
|
+
throw new VersionControlValidationError(`No branch named "${sourceBranch}" on the shared remote.`);
|
|
4485
4472
|
}
|
|
4486
4473
|
|
|
4487
4474
|
const result = await this.git.mergeChangeRequest(
|
|
@@ -4525,7 +4512,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
4525
4512
|
// roles.yaml would bypass both, on the one file the access
|
|
4526
4513
|
// model cannot survive being wrong.
|
|
4527
4514
|
if (changedPaths.includes('roles.yaml')) {
|
|
4528
|
-
throw new
|
|
4515
|
+
throw new VersionControlDomainError(
|
|
4529
4516
|
`"${targetBranch}" is protected and this merge would change its roles.yaml. ` +
|
|
4530
4517
|
`Roles never change through a merge: restore roles.yaml on "${sourceBranch}" to the version on ` +
|
|
4531
4518
|
`"${targetBranch}" and merge again, and ask the user to change roles in the app.`,
|
|
@@ -4541,7 +4528,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
4541
4528
|
);
|
|
4542
4529
|
const denied = allowed ? changedPaths.filter((p) => !allowed.get(p)) : [];
|
|
4543
4530
|
if (denied.length === 0) return;
|
|
4544
|
-
throw new
|
|
4531
|
+
throw new VersionControlDomainError(
|
|
4545
4532
|
`"${targetBranch}" is protected and you cannot commit directly to it: ` +
|
|
4546
4533
|
`${denied.length} changed file(s) are outside your write access (${denied.join(', ')}). ` +
|
|
4547
4534
|
`Open a change request from "${sourceBranch}" into "${targetBranch}" and ask the user to review it in the app.`,
|
|
@@ -4657,7 +4644,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
4657
4644
|
*/
|
|
4658
4645
|
private gateWouldPass(number: number, approvals: FileApproval[]): boolean {
|
|
4659
4646
|
try {
|
|
4660
|
-
const gate = this.
|
|
4647
|
+
const gate = this.changeRequestReview.evaluateMergeGate({ prNumber: number, state: 'open', approvals });
|
|
4661
4648
|
return gate?.mergeable === true && gate.warnings.length === 0;
|
|
4662
4649
|
} catch (err) {
|
|
4663
4650
|
crLog.warn(`could not re-evaluate the merge gate of change request #${number}; keeping its refusal:`, { err });
|
|
@@ -4978,7 +4965,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
4978
4965
|
throw new Error('updateBranch: resolutions need a `validateWrite` to be asked before the merge');
|
|
4979
4966
|
}
|
|
4980
4967
|
if (this.kb.isProtectedBranch(branch)) {
|
|
4981
|
-
throw new
|
|
4968
|
+
throw new VersionControlDomainError(
|
|
4982
4969
|
`"${branch}" is protected: it is changed through change requests, never merged into directly.`,
|
|
4983
4970
|
403,
|
|
4984
4971
|
{ kind: 'protected-update-target', branch },
|
|
@@ -5026,7 +5013,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
5026
5013
|
if (open !== null) throw new OpenChangeRequestBlocksMergeError(from, branch, open);
|
|
5027
5014
|
}
|
|
5028
5015
|
if (!(await this.git.remoteBranchExists(workspaceId, from))) {
|
|
5029
|
-
throw new
|
|
5016
|
+
throw new VersionControlValidationError(`No branch named "${from}" on the shared repository.`);
|
|
5030
5017
|
}
|
|
5031
5018
|
const resolutions = opts.resolutions ?? [];
|
|
5032
5019
|
const subject = from === branch ? `Merge the shared ${branch} into the local one` : `Merge ${from} into ${branch}`;
|
|
@@ -5038,7 +5025,7 @@ export class WorkflowService implements IWorkflowService {
|
|
|
5038
5025
|
? ` Conflicts resolved by ${user.name} <${user.email}> in: ${resolutions.map((r) => r.path).join(', ')}.`
|
|
5039
5026
|
: '');
|
|
5040
5027
|
// Published inside the merge's own reservation: nothing lands between
|
|
5041
|
-
// the merge commit and its push, and the push is EVERY
|
|
5028
|
+
// the merge commit and its push, and the push is EVERY version-control push's
|
|
5042
5029
|
// `pushWithRecovery`, run over the merge's own unlocked moves — a
|
|
5043
5030
|
// rejection replays the merge (kept as a merge) onto the moved branch
|
|
5044
5031
|
// and pushes again; a replay that conflicts or a host that refuses
|