@bevel-software/platform-core-backend 0.21.0 → 0.23.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/dist/core/core-ports.d.ts +11 -1
- 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 +3 -3
- package/dist/core/create-core-server.d.ts.map +1 -1
- package/dist/core/create-core-server.js +62 -13
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +22 -3
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +158 -23
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/core/lifecycle.d.ts +34 -1
- package/dist/core/lifecycle.d.ts.map +1 -1
- package/dist/core/lifecycle.js +89 -13
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core-config.d.ts +0 -12
- package/dist/core-config.d.ts.map +1 -1
- package/dist/core-config.js +11 -13
- package/dist/core-config.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/access/access-control.interface.d.ts +42 -12
- package/dist/modules/access/access-control.interface.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.d.ts +67 -10
- package/dist/modules/access/access-control.service.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.js +214 -35
- package/dist/modules/access/access-control.service.js.map +1 -1
- package/dist/modules/access/access-requests.contract.d.ts +75 -0
- package/dist/modules/access/access-requests.contract.d.ts.map +1 -0
- package/dist/modules/access/access-requests.contract.js +20 -0
- package/dist/modules/access/access-requests.contract.js.map +1 -0
- package/dist/modules/access/access-requests.routes.d.ts +35 -0
- package/dist/modules/access/access-requests.routes.d.ts.map +1 -0
- package/dist/modules/access/access-requests.routes.js +237 -0
- package/dist/modules/access/access-requests.routes.js.map +1 -0
- package/dist/modules/access/access-requests.service.d.ts +123 -0
- package/dist/modules/access/access-requests.service.d.ts.map +1 -0
- package/dist/modules/access/access-requests.service.js +337 -0
- package/dist/modules/access/access-requests.service.js.map +1 -0
- package/dist/modules/access/access.routes.d.ts.map +1 -1
- package/dist/modules/access/access.routes.js +13 -15
- package/dist/modules/access/access.routes.js.map +1 -1
- package/dist/modules/access-model/access-grammar.d.ts +12 -0
- package/dist/modules/access-model/access-grammar.d.ts.map +1 -1
- package/dist/modules/access-model/access-grammar.js +24 -0
- package/dist/modules/access-model/access-grammar.js.map +1 -1
- package/dist/modules/auth/account-admission.d.ts +58 -7
- package/dist/modules/auth/account-admission.d.ts.map +1 -1
- package/dist/modules/auth/account-admission.js +44 -1
- package/dist/modules/auth/account-admission.js.map +1 -1
- package/dist/modules/auth/account.routes.d.ts +1 -1
- package/dist/modules/auth/account.routes.d.ts.map +1 -1
- package/dist/modules/auth/account.routes.js +61 -5
- package/dist/modules/auth/account.routes.js.map +1 -1
- package/dist/modules/auth/auth.middleware.d.ts +1 -1
- package/dist/modules/auth/auth.middleware.d.ts.map +1 -1
- package/dist/modules/auth/auth.middleware.js +18 -7
- package/dist/modules/auth/auth.middleware.js.map +1 -1
- package/dist/modules/auth/auth.routes.d.ts.map +1 -1
- package/dist/modules/auth/auth.routes.js +8 -0
- package/dist/modules/auth/auth.routes.js.map +1 -1
- package/dist/modules/auth/auth.service.d.ts +96 -3
- package/dist/modules/auth/auth.service.d.ts.map +1 -1
- package/dist/modules/auth/auth.service.js +187 -9
- package/dist/modules/auth/auth.service.js.map +1 -1
- package/dist/modules/auth/oidc-auth-provider.d.ts.map +1 -1
- package/dist/modules/auth/oidc-auth-provider.js +7 -2
- package/dist/modules/auth/oidc-auth-provider.js.map +1 -1
- package/dist/modules/database/core-schema.d.ts +41 -24
- package/dist/modules/database/core-schema.d.ts.map +1 -1
- package/dist/modules/database/core-schema.js +35 -27
- package/dist/modules/database/core-schema.js.map +1 -1
- package/dist/modules/github-app/github-app.client.d.ts +101 -0
- package/dist/modules/github-app/github-app.client.d.ts.map +1 -0
- package/dist/modules/github-app/github-app.client.js +222 -0
- package/dist/modules/github-app/github-app.client.js.map +1 -0
- package/dist/modules/github-app/github-app.connection.d.ts +102 -0
- package/dist/modules/github-app/github-app.connection.d.ts.map +1 -0
- package/dist/modules/github-app/github-app.connection.js +185 -0
- package/dist/modules/github-app/github-app.connection.js.map +1 -0
- package/dist/modules/github-app/github-app.routes.d.ts +59 -0
- package/dist/modules/github-app/github-app.routes.d.ts.map +1 -0
- package/dist/modules/github-app/github-app.routes.js +323 -0
- package/dist/modules/github-app/github-app.routes.js.map +1 -0
- package/dist/modules/github-app/index.d.ts +4 -0
- package/dist/modules/github-app/index.d.ts.map +1 -0
- package/dist/modules/github-app/index.js +4 -0
- package/dist/modules/github-app/index.js.map +1 -0
- package/dist/modules/kb-fs/branch-name.d.ts.map +1 -1
- package/dist/modules/kb-fs/branch-name.js +12 -2
- package/dist/modules/kb-fs/branch-name.js.map +1 -1
- package/dist/modules/kb-fs/remote-url.d.ts +22 -0
- package/dist/modules/kb-fs/remote-url.d.ts.map +1 -0
- package/dist/modules/kb-fs/remote-url.js +35 -0
- package/dist/modules/kb-fs/remote-url.js.map +1 -0
- package/dist/modules/kb-fs/repo-path.d.ts +11 -16
- package/dist/modules/kb-fs/repo-path.d.ts.map +1 -1
- package/dist/modules/kb-fs/repo-path.js +79 -0
- package/dist/modules/kb-fs/repo-path.js.map +1 -1
- package/dist/modules/kb-sync/kb-sync.routes.d.ts +2 -2
- package/dist/modules/kb-sync/kb-sync.routes.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.routes.js +14 -3
- package/dist/modules/kb-sync/kb-sync.routes.js.map +1 -1
- package/dist/modules/kb-sync/sync-auth.d.ts +3 -1
- package/dist/modules/kb-sync/sync-auth.d.ts.map +1 -1
- package/dist/modules/kb-sync/sync-auth.js +1 -1
- package/dist/modules/kb-sync/sync-auth.js.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.js +21 -6
- package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js +3 -2
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
- package/dist/modules/plugins/join-proposals.d.ts +17 -5
- package/dist/modules/plugins/join-proposals.d.ts.map +1 -1
- package/dist/modules/plugins/join-proposals.js +76 -22
- package/dist/modules/plugins/join-proposals.js.map +1 -1
- package/dist/modules/plugins/join-requests.service.d.ts +111 -18
- package/dist/modules/plugins/join-requests.service.d.ts.map +1 -1
- package/dist/modules/plugins/join-requests.service.js +173 -29
- package/dist/modules/plugins/join-requests.service.js.map +1 -1
- package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.routes.js +3 -2
- package/dist/modules/plugins/plugins.routes.js.map +1 -1
- package/dist/modules/settings/deployment-settings.service.d.ts +22 -1
- package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +101 -7
- package/dist/modules/settings/deployment-settings.service.js.map +1 -1
- package/dist/modules/settings/managed-repository.d.ts +43 -0
- package/dist/modules/settings/managed-repository.d.ts.map +1 -0
- package/dist/modules/settings/managed-repository.js +60 -0
- package/dist/modules/settings/managed-repository.js.map +1 -0
- package/dist/modules/settings/repository-source.d.ts +128 -0
- package/dist/modules/settings/repository-source.d.ts.map +1 -0
- package/dist/modules/settings/repository-source.js +150 -0
- package/dist/modules/settings/repository-source.js.map +1 -0
- package/dist/modules/settings/setup.routes.d.ts +78 -4
- package/dist/modules/settings/setup.routes.d.ts.map +1 -1
- package/dist/modules/settings/setup.routes.js +379 -17
- package/dist/modules/settings/setup.routes.js.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.d.ts +6 -8
- package/dist/modules/skills/skill-access-requests.routes.d.ts.map +1 -1
- package/dist/modules/skills/skill-access-requests.routes.js +24 -63
- package/dist/modules/skills/skill-access-requests.routes.js.map +1 -1
- package/dist/modules/skills/skills.contract.d.ts +90 -18
- package/dist/modules/skills/skills.contract.d.ts.map +1 -1
- package/dist/modules/skills/skills.contract.js +4 -1
- package/dist/modules/skills/skills.contract.js.map +1 -1
- package/dist/modules/skills/skills.service.d.ts +98 -9
- package/dist/modules/skills/skills.service.d.ts.map +1 -1
- package/dist/modules/skills/skills.service.js +239 -37
- package/dist/modules/skills/skills.service.js.map +1 -1
- package/dist/modules/skills/skills.tools.d.ts +7 -0
- package/dist/modules/skills/skills.tools.d.ts.map +1 -1
- package/dist/modules/skills/skills.tools.js +71 -7
- package/dist/modules/skills/skills.tools.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.js +4 -2
- package/dist/modules/tool-auth/external-api-key.service.js.map +1 -1
- package/dist/modules/tool-auth/internal-token.service.d.ts +3 -3
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts +16 -7
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.js +34 -12
- package/dist/modules/tool-auth/tool-auth.middleware.js.map +1 -1
- package/dist/modules/tool-helpers/tool-context.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool-context.js +15 -0
- package/dist/modules/tool-helpers/tool-context.js.map +1 -1
- package/dist/modules/tool-helpers/tool-handler.d.ts +2 -1
- package/dist/modules/tool-helpers/tool-handler.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool-handler.js +25 -4
- package/dist/modules/tool-helpers/tool-handler.js.map +1 -1
- package/dist/modules/tool-helpers/tool.contract.d.ts +3 -2
- package/dist/modules/tool-helpers/tool.contract.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool.contract.js.map +1 -1
- package/dist/modules/tool-helpers/validate-token.js +1 -1
- package/dist/modules/tool-helpers/validate-token.js.map +1 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.d.ts +98 -0
- package/dist/modules/workflow/agent-tools/change-request-summary.d.ts.map +1 -0
- package/dist/modules/workflow/agent-tools/change-request-summary.js +81 -0
- package/dist/modules/workflow/agent-tools/change-request-summary.js.map +1 -0
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.js +113 -37
- package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
- package/dist/modules/workflow/file-lock.service.d.ts +24 -0
- package/dist/modules/workflow/file-lock.service.d.ts.map +1 -1
- package/dist/modules/workflow/file-lock.service.js +30 -0
- package/dist/modules/workflow/file-lock.service.js.map +1 -1
- package/dist/modules/workflow/git/git.service.d.ts +72 -1
- package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/git.service.js +170 -6
- package/dist/modules/workflow/git/git.service.js.map +1 -1
- package/dist/modules/workflow/git/node-git-runner.d.ts.map +1 -1
- package/dist/modules/workflow/git/node-git-runner.js +5 -0
- package/dist/modules/workflow/git/node-git-runner.js.map +1 -1
- package/dist/modules/workflow/git/pull-request.service.d.ts +45 -0
- package/dist/modules/workflow/git/pull-request.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/pull-request.service.js +99 -0
- package/dist/modules/workflow/git/pull-request.service.js.map +1 -1
- package/dist/modules/workflow/pending-commits.service.d.ts +38 -0
- package/dist/modules/workflow/pending-commits.service.d.ts.map +1 -1
- package/dist/modules/workflow/pending-commits.service.js +55 -0
- package/dist/modules/workflow/pending-commits.service.js.map +1 -1
- package/dist/modules/workflow/workflow-hooks.d.ts +54 -32
- package/dist/modules/workflow/workflow-hooks.d.ts.map +1 -1
- package/dist/modules/workflow/workflow-hooks.js +16 -1
- package/dist/modules/workflow/workflow-hooks.js.map +1 -1
- package/dist/modules/workflow/workflow.routes.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.routes.js +3 -1
- package/dist/modules/workflow/workflow.routes.js.map +1 -1
- package/dist/modules/workflow/workflow.service.d.ts +94 -13
- package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.service.js +258 -51
- package/dist/modules/workflow/workflow.service.js.map +1 -1
- package/dist/modules/workspace/agent-access.gate.d.ts +94 -0
- package/dist/modules/workspace/agent-access.gate.d.ts.map +1 -0
- package/dist/modules/workspace/agent-access.gate.js +123 -0
- package/dist/modules/workspace/agent-access.gate.js.map +1 -0
- package/dist/modules/workspace/routine-write-policy.d.ts +5 -6
- package/dist/modules/workspace/routine-write-policy.d.ts.map +1 -1
- package/dist/modules/workspace/routine-write-policy.js +5 -6
- package/dist/modules/workspace/routine-write-policy.js.map +1 -1
- package/dist/modules/workspace/session-sink.d.ts +5 -5
- package/dist/modules/workspace/set-aside-clone.d.ts +46 -0
- package/dist/modules/workspace/set-aside-clone.d.ts.map +1 -0
- package/dist/modules/workspace/set-aside-clone.js +92 -0
- package/dist/modules/workspace/set-aside-clone.js.map +1 -0
- package/dist/modules/workspace/startup/kb-startup-runner.d.ts +117 -1
- package/dist/modules/workspace/startup/kb-startup-runner.d.ts.map +1 -1
- package/dist/modules/workspace/startup/kb-startup-runner.js +190 -1
- package/dist/modules/workspace/startup/kb-startup-runner.js.map +1 -1
- package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.routes.js +92 -3
- package/dist/modules/workspace/workspace.routes.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +115 -5
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +272 -26
- package/dist/modules/workspace/workspace.service.js.map +1 -1
- package/dist/modules/workspace/workspace.tools.d.ts +2 -2
- package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.tools.js +337 -117
- package/dist/modules/workspace/workspace.tools.js.map +1 -1
- package/dist/modules/write-access/write-access.d.ts +60 -0
- package/dist/modules/write-access/write-access.d.ts.map +1 -0
- package/dist/modules/write-access/write-access.js +129 -0
- package/dist/modules/write-access/write-access.js.map +1 -0
- package/dist/shared/domain-errors.d.ts +64 -0
- package/dist/shared/domain-errors.d.ts.map +1 -1
- package/dist/shared/domain-errors.js +83 -0
- package/dist/shared/domain-errors.js.map +1 -1
- package/dist/shared/git.contract.d.ts +30 -0
- package/dist/shared/git.contract.d.ts.map +1 -1
- package/dist/shared/git.contract.js +26 -0
- package/dist/shared/git.contract.js.map +1 -1
- package/dist/tenancy/static-tenant-source.d.ts +0 -1
- package/dist/tenancy/static-tenant-source.d.ts.map +1 -1
- package/dist/tenancy/static-tenant-source.js +0 -2
- package/dist/tenancy/static-tenant-source.js.map +1 -1
- package/migrations/0014_change_request_closed_reason.sql +1 -0
- package/migrations/0015_account_deactivation.sql +3 -0
- package/migrations/meta/0014_snapshot.json +2265 -0
- package/migrations/meta/0015_snapshot.json +2271 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +3 -3
- package/src/__tests__/kb-layout-config.test.ts +0 -2
- package/src/__tests__/retired-settings.test.ts +96 -0
- package/src/core/__tests__/gated-boot.test.ts +132 -0
- package/src/core/__tests__/lifecycle.test.ts +170 -1
- package/src/core/__tests__/set-aside-root-is-one-place.test.ts +63 -0
- package/src/core/core-ports.ts +11 -1
- package/src/core/create-core-server.ts +69 -15
- package/src/core/create-core-services.ts +190 -27
- package/src/core/lifecycle.ts +98 -13
- package/src/core-config.ts +13 -14
- package/src/index.ts +12 -1
- package/src/modules/access/__tests__/access-control.preview-relocation.test.ts +385 -0
- package/src/modules/access/__tests__/access-control.prospective.test.ts +94 -18
- package/src/modules/access/__tests__/access-requests.recut.test.ts +134 -0
- package/src/modules/access/__tests__/access-requests.routes.test.ts +610 -0
- package/src/modules/access/__tests__/access.routes.prospective.test.ts +6 -7
- package/src/modules/access/access-control.interface.ts +43 -12
- package/src/modules/access/access-control.service.ts +234 -36
- package/src/modules/access/access-requests.contract.ts +93 -0
- package/src/modules/access/access-requests.routes.ts +286 -0
- package/src/modules/access/access-requests.service.ts +420 -0
- package/src/modules/access/access.routes.ts +13 -15
- package/src/modules/access-model/access-grammar.ts +22 -0
- package/src/modules/agent-instructions/__tests__/agent-instructions.route.test.ts +3 -1
- package/src/modules/auth/__tests__/account-deactivation.test.ts +252 -0
- package/src/modules/auth/__tests__/account.routes.test.ts +81 -3
- package/src/modules/auth/__tests__/auth.middleware.test.ts +45 -22
- package/src/modules/auth/__tests__/auth.service.test.ts +39 -1
- package/src/modules/auth/account-admission.ts +78 -9
- package/src/modules/auth/account.routes.ts +63 -7
- package/src/modules/auth/auth.middleware.ts +19 -8
- package/src/modules/auth/auth.routes.ts +8 -0
- package/src/modules/auth/auth.service.ts +207 -7
- package/src/modules/auth/oidc-auth-provider.ts +7 -2
- package/src/modules/database/core-schema.ts +35 -27
- package/src/modules/github-app/__tests__/github-app.test.ts +848 -0
- package/src/modules/github-app/github-app.client.ts +268 -0
- package/src/modules/github-app/github-app.connection.ts +204 -0
- package/src/modules/github-app/github-app.routes.ts +359 -0
- package/src/modules/github-app/index.ts +19 -0
- package/src/modules/kb-fs/__tests__/branch-name.test.ts +10 -0
- package/src/modules/kb-fs/__tests__/remote-url.test.ts +38 -0
- package/src/modules/kb-fs/__tests__/repo-path.test.ts +123 -0
- package/src/modules/kb-fs/branch-name.ts +14 -1
- package/src/modules/kb-fs/remote-url.ts +35 -0
- package/src/modules/kb-fs/repo-path.ts +85 -0
- package/src/modules/kb-sync/__tests__/kb-sync.routes.test.ts +26 -1
- package/src/modules/kb-sync/kb-sync.routes.ts +14 -4
- package/src/modules/kb-sync/sync-auth.ts +2 -2
- package/src/modules/mcp/__tests__/mcp-auth.middleware.test.ts +60 -3
- package/src/modules/mcp/__tests__/mcp.service.test.ts +68 -6
- package/src/modules/mcp/mcp-auth.middleware.ts +20 -6
- package/src/modules/mcp/oauth/bevel-oauth-provider.ts +3 -1
- package/src/modules/plugins/__tests__/join-proposals.test.ts +100 -19
- package/src/modules/plugins/__tests__/join-requests.service.test.ts +27 -11
- package/src/modules/plugins/__tests__/join-requests.settlement.test.ts +371 -0
- package/src/modules/plugins/__tests__/plugins.routes.test.ts +1 -1
- package/src/modules/plugins/__tests__/plugins.tools.test.ts +2 -1
- package/src/modules/plugins/join-proposals.ts +87 -19
- package/src/modules/plugins/join-requests.service.ts +199 -39
- package/src/modules/plugins/plugins.routes.ts +3 -2
- package/src/modules/settings/__tests__/deployment-settings.service.test.ts +16 -0
- package/src/modules/settings/__tests__/repository-source.test.ts +191 -0
- package/src/modules/settings/__tests__/setup.routes.git-mode.test.ts +386 -0
- package/src/modules/settings/__tests__/setup.routes.github-app.test.ts +299 -0
- package/src/modules/settings/__tests__/setup.routes.managed-phase.test.ts +236 -0
- package/src/modules/settings/__tests__/setup.routes.repository-change.test.ts +390 -0
- package/src/modules/settings/__tests__/setup.routes.test.ts +3 -0
- package/src/modules/settings/deployment-settings.service.ts +117 -6
- package/src/modules/settings/managed-repository.ts +68 -0
- package/src/modules/settings/repository-source.ts +197 -0
- package/src/modules/settings/setup.routes.ts +463 -15
- package/src/modules/skills/__tests__/allowed-tools-warn.tools.test.ts +2 -1
- package/src/modules/skills/__tests__/branch-skills.tools.test.ts +218 -0
- package/src/modules/skills/__tests__/skill-access-requests.routes.test.ts +5 -1
- package/src/modules/skills/__tests__/skills.service.test.ts +229 -5
- package/src/modules/skills/skill-access-requests.routes.ts +25 -75
- package/src/modules/skills/skills.contract.ts +91 -18
- package/src/modules/skills/skills.service.ts +278 -41
- package/src/modules/skills/skills.tools.ts +80 -8
- package/src/modules/tool-auth/__tests__/manual-auth.middleware.test.ts +14 -1
- package/src/modules/tool-auth/external-api-key.service.ts +4 -2
- package/src/modules/tool-auth/internal-token.service.ts +3 -3
- package/src/modules/tool-auth/tool-auth.middleware.ts +34 -11
- package/src/modules/tool-helpers/__tests__/agent-roles-write.test.ts +5 -3
- package/src/modules/tool-helpers/__tests__/phase4-tools.test.ts +3 -3
- package/src/modules/tool-helpers/__tests__/validate-token.test.ts +11 -1
- package/src/modules/tool-helpers/tool-context.ts +15 -0
- package/src/modules/tool-helpers/tool-handler.ts +24 -4
- package/src/modules/tool-helpers/tool.contract.ts +3 -2
- package/src/modules/tool-helpers/validate-token.ts +1 -1
- package/src/modules/workflow/__tests__/apply-failure.test.ts +9 -1
- package/src/modules/workflow/__tests__/pending-commits.repository-replaced.test.ts +111 -0
- package/src/modules/workflow/__tests__/workflow.routes.history-read-gate.test.ts +25 -0
- package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +159 -8
- package/src/modules/workflow/__tests__/workflow.service.repository-replaced.test.ts +249 -0
- package/src/modules/workflow/__tests__/workflow.service.update-from-target.test.ts +146 -40
- package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +405 -7
- package/src/modules/workflow/agent-tools/change-request-summary.ts +182 -0
- package/src/modules/workflow/agent-tools/workflow.tools.ts +135 -38
- package/src/modules/workflow/file-lock.service.ts +31 -0
- package/src/modules/workflow/git/__tests__/git.service.fileBytesAtCommit.test.ts +260 -0
- package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +121 -0
- package/src/modules/workflow/git/__tests__/pull-request.service.getPrDetail.test.ts +145 -2
- package/src/modules/workflow/git/__tests__/pull-request.service.viewer-can-delete.test.ts +166 -0
- package/src/modules/workflow/git/git.service.ts +193 -4
- package/src/modules/workflow/git/node-git-runner.ts +6 -0
- package/src/modules/workflow/git/pull-request.service.ts +119 -0
- package/src/modules/workflow/pending-commits.service.ts +59 -1
- package/src/modules/workflow/workflow-hooks.ts +64 -26
- package/src/modules/workflow/workflow.routes.ts +3 -1
- package/src/modules/workflow/workflow.service.ts +290 -55
- package/src/modules/workspace/__tests__/agent-access.gate.test.ts +208 -0
- package/src/modules/workspace/__tests__/escape-sequences.routes.test.ts +384 -0
- package/src/modules/workspace/__tests__/file-stat-access.test.ts +2 -1
- package/src/modules/workspace/__tests__/git-internals.security.test.ts +2 -1
- package/src/modules/workspace/__tests__/set-aside-clone.test.ts +52 -0
- package/src/modules/workspace/__tests__/workspace.routes.at-ref.test.ts +305 -0
- package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +2 -0
- package/src/modules/workspace/__tests__/workspace.service.forget-clone-races.test.ts +147 -0
- package/src/modules/workspace/__tests__/workspace.service.replaced-repository.test.ts +326 -0
- package/src/modules/workspace/__tests__/workspace.service.test.ts +20 -9
- package/src/modules/workspace/__tests__/workspace.service.unknown-branch.test.ts +43 -0
- package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +2 -3
- package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +235 -10
- package/src/modules/workspace/__tests__/workspace.tools.test.ts +720 -17
- package/src/modules/workspace/agent-access.gate.ts +164 -0
- package/src/modules/workspace/routine-write-policy.ts +5 -6
- package/src/modules/workspace/session-sink.ts +5 -5
- package/src/modules/workspace/set-aside-clone.ts +96 -0
- package/src/modules/workspace/startup/__tests__/kb-startup-runner.test.ts +297 -0
- package/src/modules/workspace/startup/kb-startup-runner.ts +242 -2
- package/src/modules/workspace/workspace.routes.ts +95 -3
- package/src/modules/workspace/workspace.service.ts +273 -25
- package/src/modules/workspace/workspace.tools.ts +373 -119
- package/src/modules/write-access/__tests__/write-access.test.ts +248 -0
- package/src/modules/write-access/write-access.ts +153 -0
- package/src/shared/domain-errors.ts +89 -0
- package/src/shared/git.contract.ts +37 -0
- package/src/tenancy/__tests__/static-tenant-source.test.ts +0 -1
- package/src/tenancy/static-tenant-source.ts +0 -3
- package/dist/modules/workflow/session-ontology.policy.d.ts +0 -52
- package/dist/modules/workflow/session-ontology.policy.d.ts.map +0 -1
- package/dist/modules/workflow/session-ontology.policy.js +0 -62
- package/dist/modules/workflow/session-ontology.policy.js.map +0 -1
- package/dist/modules/workflow/session-ontology.service.d.ts +0 -105
- package/dist/modules/workflow/session-ontology.service.d.ts.map +0 -1
- package/dist/modules/workflow/session-ontology.service.js +0 -147
- package/dist/modules/workflow/session-ontology.service.js.map +0 -1
- package/dist/modules/workspace/session-ontology.gate.d.ts +0 -114
- package/dist/modules/workspace/session-ontology.gate.d.ts.map +0 -1
- package/dist/modules/workspace/session-ontology.gate.js +0 -161
- package/dist/modules/workspace/session-ontology.gate.js.map +0 -1
- package/dist/shared/kb-layout.d.ts +0 -39
- package/dist/shared/kb-layout.d.ts.map +0 -1
- package/dist/shared/kb-layout.js +0 -103
- package/dist/shared/kb-layout.js.map +0 -1
- package/dist/shared/kb-layout.test.d.ts +0 -2
- package/dist/shared/kb-layout.test.d.ts.map +0 -1
- package/dist/shared/kb-layout.test.js +0 -75
- package/dist/shared/kb-layout.test.js.map +0 -1
- package/src/modules/workflow/__tests__/session-ontology.policy.test.ts +0 -62
- package/src/modules/workflow/__tests__/session-ontology.service.test.ts +0 -201
- package/src/modules/workflow/session-ontology.policy.ts +0 -70
- package/src/modules/workflow/session-ontology.service.ts +0 -183
- package/src/modules/workspace/__tests__/session-ontology.gate.test.ts +0 -239
- package/src/modules/workspace/session-ontology.gate.ts +0 -191
- package/src/shared/kb-layout.test.ts +0 -98
- package/src/shared/kb-layout.ts +0 -102
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.service.d.ts","sourceRoot":"","sources":["../../../../src/modules/workflow/git/git.service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAA2B,MAAM,sBAAsB,CAAC;AACnF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAUtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"git.service.d.ts","sour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AAa,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,EAAE,CAwBzD"}
|
|
@@ -8,8 +8,8 @@ import { isAbsence } from '../../../shared/fs.contract.js';
|
|
|
8
8
|
import { assertInsideRepo } from '../../kb-fs/repo-path.js';
|
|
9
9
|
import { cloneTrackingConfigArgs, SAFE_IMPLICIT_FETCH_ARGS } from '../../kb-fs/clone-config.js';
|
|
10
10
|
import { assertValidBranchName, assertValidRelativePath, isBranchAuthoredBy, isOwnSuggestionsBranch, } from '../../kb-fs/branch-name.js';
|
|
11
|
-
import { BranchAuthorshipError, WorkflowDomainError, WorkflowValidationError, ProtectedBranchError, PullRebaseConflictError, RemoteBranchGoneError, isMissingRemoteBranchFailure, } from '../../../shared/domain-errors.js';
|
|
12
|
-
import { GitRunError, isGitTimeout, redactGitToken, } from '../../../shared/git.contract.js';
|
|
11
|
+
import { BranchAuthorshipError, WorkflowDomainError, WorkflowValidationError, ProtectedBranchError, PullRebaseConflictError, RemoteBranchGoneError, VersionNotOnBranchError, isMissingRemoteBranchFailure, } from '../../../shared/domain-errors.js';
|
|
12
|
+
import { GitRunError, assertOneSpecPerLine, isGitTimeout, redactGitToken, } from '../../../shared/git.contract.js';
|
|
13
13
|
import { NodeGitRunner } from './node-git-runner.js';
|
|
14
14
|
import { printable } from '../../../shared/printable.js';
|
|
15
15
|
import { sanitizeError } from '../sanitize-error.js';
|
|
@@ -1515,7 +1515,7 @@ export class GitService {
|
|
|
1515
1515
|
* conflict into the typed error the workflow layer queues recovery for.
|
|
1516
1516
|
* Shared by `pull` and `syncFromRemote` so the two cannot drift.
|
|
1517
1517
|
*/
|
|
1518
|
-
async rebaseOntoRemote(cwd, branch, remoteRef) {
|
|
1518
|
+
async rebaseOntoRemote(cwd, branch, remoteRef, opts = {}) {
|
|
1519
1519
|
// An UNBORN HEAD (a clone of an upstream that was empty when cloned) has
|
|
1520
1520
|
// no commit to replay and `git rebase` refuses to start from it, so the
|
|
1521
1521
|
// branch is moved to the remote commit instead. That is only safe while
|
|
@@ -1549,7 +1549,20 @@ export class GitService {
|
|
|
1549
1549
|
// the local commits onto origin, then reapplies them, so the retry
|
|
1550
1550
|
// push can fast-forward. Untracked files don't block rebase and are
|
|
1551
1551
|
// left untouched.
|
|
1552
|
-
|
|
1552
|
+
// `--rebase-merges` is what keeps an unpushed MERGE a merge. Plain
|
|
1553
|
+
// rebase replays `--no-merges upstream..HEAD`, which turns a merge
|
|
1554
|
+
// commit the clone holds but origin has not seen into cherry-picks of
|
|
1555
|
+
// the commits it merged — the merged branch stops being a parent, so
|
|
1556
|
+
// "does the published head contain the target's head" answers no
|
|
1557
|
+
// however many times the update runs. Only the change-request update
|
|
1558
|
+
// asks for it; every other pull replays plain saves, where the two
|
|
1559
|
+
// spellings produce the same history.
|
|
1560
|
+
await this.git(cwd, [
|
|
1561
|
+
'rebase',
|
|
1562
|
+
'--autostash',
|
|
1563
|
+
...(opts.preserveMerges ? ['--rebase-merges'] : []),
|
|
1564
|
+
remoteRef,
|
|
1565
|
+
]);
|
|
1553
1566
|
}
|
|
1554
1567
|
catch (err) {
|
|
1555
1568
|
// Capture the contested paths BEFORE the abort wipes the rebase
|
|
@@ -1669,7 +1682,7 @@ export class GitService {
|
|
|
1669
1682
|
return { before, after, treeChanged, changedPaths };
|
|
1670
1683
|
});
|
|
1671
1684
|
}
|
|
1672
|
-
async pull(workspaceId) {
|
|
1685
|
+
async pull(workspaceId, opts = {}) {
|
|
1673
1686
|
return this.mutex.run(workspaceId, async () => {
|
|
1674
1687
|
const cwd = await this.repoDir(workspaceId);
|
|
1675
1688
|
const branch = await this.checkedOutBranch(cwd);
|
|
@@ -1682,7 +1695,7 @@ export class GitService {
|
|
|
1682
1695
|
// Refresh WITHOUT `git pull`, and without touching `FETCH_HEAD` — see
|
|
1683
1696
|
// `refreshRemoteBranchRef` for why both halves are load-bearing.
|
|
1684
1697
|
const remoteRef = await this.refreshRemoteBranchRef(cwd, branch);
|
|
1685
|
-
await this.rebaseOntoRemote(cwd, branch, remoteRef);
|
|
1698
|
+
await this.rebaseOntoRemote(cwd, branch, remoteRef, opts);
|
|
1686
1699
|
this.accessControl?.invalidate(workspaceId);
|
|
1687
1700
|
const treeAfter = (await this.revParseOrNull(cwd, 'HEAD^{tree}')) ?? '';
|
|
1688
1701
|
return { treeChanged: treeAfter !== treeBefore };
|
|
@@ -2006,6 +2019,10 @@ export class GitService {
|
|
|
2006
2019
|
const repoRelativePath = this.stripRepoPrefix(relativePath);
|
|
2007
2020
|
return this.mutex.run(workspaceId, async () => {
|
|
2008
2021
|
const cwd = await this.repoDir(workspaceId);
|
|
2022
|
+
// Branch-scoped, like the bytes route: a patch is a past version too,
|
|
2023
|
+
// and leaving this route open would let a sha refused there be read
|
|
2024
|
+
// here instead.
|
|
2025
|
+
await this.assertOnBranchHistory(cwd, sha);
|
|
2009
2026
|
// BOTH sides: at a commit that DELETES a directory the path is absent
|
|
2010
2027
|
// at `sha` but a tree at `sha^` — and the diff of that deletion is
|
|
2011
2028
|
// every child's content, exactly what the per-file gate never checked.
|
|
@@ -2050,6 +2067,10 @@ export class GitService {
|
|
|
2050
2067
|
const repoRelativePath = this.stripRepoPrefix(relativePath);
|
|
2051
2068
|
return this.mutex.run(workspaceId, async () => {
|
|
2052
2069
|
const cwd = await this.repoDir(workspaceId);
|
|
2070
|
+
// Same branch rule as the patch and the bytes: this route serves the
|
|
2071
|
+
// FULL text of both sides, so it is the most generous of the three and
|
|
2072
|
+
// the least safe one to leave ungated.
|
|
2073
|
+
await this.assertOnBranchHistory(cwd, sha);
|
|
2053
2074
|
await this.assertNotTreeAtRef(cwd, sha, repoRelativePath, relativePath);
|
|
2054
2075
|
await this.assertNotTreeAtRef(cwd, `${sha}^`, repoRelativePath, relativePath);
|
|
2055
2076
|
const current = await this.readFileAtRef(workspaceId, sha, repoRelativePath);
|
|
@@ -2819,6 +2840,133 @@ export class GitService {
|
|
|
2819
2840
|
throw err;
|
|
2820
2841
|
}
|
|
2821
2842
|
}
|
|
2843
|
+
/**
|
|
2844
|
+
* A repo-relative file's BYTES at an arbitrary git ref — the binary sibling
|
|
2845
|
+
* of {@link readFileAtRef}, with the blob's object id alongside them.
|
|
2846
|
+
*
|
|
2847
|
+
* `readFileAtRef` decodes stdout as UTF-8, which for a PNG or a PDF is not a
|
|
2848
|
+
* lossless round trip: every byte sequence that is not valid UTF-8 comes
|
|
2849
|
+
* back as U+FFFD and the file is ruined. A past version has to be delivered
|
|
2850
|
+
* byte for byte, so this reads through `cat-file --batch`, whose framing is
|
|
2851
|
+
* in BYTES (`<oid> <type> <size>\n<size bytes>\n`) rather than characters.
|
|
2852
|
+
*
|
|
2853
|
+
* One invocation, and absence is a PROTOCOL answer (`<spec> missing`) rather
|
|
2854
|
+
* than a parsed error message — which also covers `<sha>^` of a root commit,
|
|
2855
|
+
* where there is no "before" side at all. `null` therefore means exactly
|
|
2856
|
+
* "nothing is at that path on that side".
|
|
2857
|
+
*
|
|
2858
|
+
* The `oid` is the content's own hash, so it is what the HTTP route uses as
|
|
2859
|
+
* an ETag: cheaper than hashing the body again, and stable for a version
|
|
2860
|
+
* that by definition can never change.
|
|
2861
|
+
*/
|
|
2862
|
+
async blobAtRef(cwd, ref, repoRelativePath) {
|
|
2863
|
+
// The spec has to be ONE line: the path is refused a control character
|
|
2864
|
+
// twice over before it gets here (at the route's normaliser and again at
|
|
2865
|
+
// `assertValidRelativePath`), and this is the fence at the protocol —
|
|
2866
|
+
// `--batch` would otherwise read `<sha>:Docs/x.md\nzzz` as two object
|
|
2867
|
+
// names and answer about the first, under the gates of the second.
|
|
2868
|
+
const spec = `${ref}:${repoRelativePath}`;
|
|
2869
|
+
assertOneSpecPerLine([spec]);
|
|
2870
|
+
const { stdout } = await this.gitBytes(cwd, ['cat-file', '--batch'], {
|
|
2871
|
+
input: `${spec}\n`,
|
|
2872
|
+
});
|
|
2873
|
+
const nl = stdout.indexOf(0x0a);
|
|
2874
|
+
if (nl < 0)
|
|
2875
|
+
throw new Error('unexpected end of git cat-file output');
|
|
2876
|
+
// The spec may itself contain spaces (a KB file routinely does), hence the
|
|
2877
|
+
// endsWith checks rather than a split — same protocol reading as the
|
|
2878
|
+
// access resolver's `catFileBatch`.
|
|
2879
|
+
const header = stdout.subarray(0, nl).toString('utf-8');
|
|
2880
|
+
if (header.endsWith(' missing') || header.endsWith(' ambiguous'))
|
|
2881
|
+
return null;
|
|
2882
|
+
const [blobId, type, rawSize] = header.split(' ');
|
|
2883
|
+
// A tree here would be the per-file gate bypassed, and `assertNotTreeAtRef`
|
|
2884
|
+
// is what refuses it before this runs; anything else non-blob (a tag, a
|
|
2885
|
+
// commit) is not a file either. Nothing to serve in either case.
|
|
2886
|
+
if (type !== 'blob' || blobId === undefined)
|
|
2887
|
+
return null;
|
|
2888
|
+
const size = Number(rawSize);
|
|
2889
|
+
if (!Number.isSafeInteger(size) || size < 0) {
|
|
2890
|
+
throw new Error(`unexpected git cat-file header: ${header}`);
|
|
2891
|
+
}
|
|
2892
|
+
return { bytes: stdout.subarray(nl + 1, nl + 1 + size), blobId };
|
|
2893
|
+
}
|
|
2894
|
+
/**
|
|
2895
|
+
* Refuse a sha that is not in the history of the branch this workspace has
|
|
2896
|
+
* checked out.
|
|
2897
|
+
*
|
|
2898
|
+
* A file's past is served per BRANCH: the history panel lists what `git log`
|
|
2899
|
+
* on this workspace's own branch touched, and every read of a past save has
|
|
2900
|
+
* to stay inside that list. Without this, a sha lifted from another branch —
|
|
2901
|
+
* or from a change request nobody approved — would be readable through the
|
|
2902
|
+
* workspace of a branch whose history never contained it, which is the
|
|
2903
|
+
* access rules of the viewed branch bypassed by a query parameter.
|
|
2904
|
+
*
|
|
2905
|
+
* `merge-base --is-ancestor` is the exact question, and a commit is its own
|
|
2906
|
+
* ancestor, so the branch head passes. Exit 1 is git's answer for "resolved,
|
|
2907
|
+
* and not an ancestor". An unresolvable object name — a made-up id — gets
|
|
2908
|
+
* the SAME refusal on purpose (see {@link VersionNotOnBranchError}), but only
|
|
2909
|
+
* when git's complaint NAMES that id; every other failure propagates, a
|
|
2910
|
+
* broken repository included. A guard that fails open on its own errors is
|
|
2911
|
+
* not a guard, and one that reports them as a refusal is worse than no
|
|
2912
|
+
* message at all.
|
|
2913
|
+
*/
|
|
2914
|
+
async assertOnBranchHistory(cwd, sha) {
|
|
2915
|
+
try {
|
|
2916
|
+
await this.git(cwd, ['merge-base', '--is-ancestor', sha, 'HEAD']);
|
|
2917
|
+
}
|
|
2918
|
+
catch (err) {
|
|
2919
|
+
if (err instanceof GitRunError && !err.timedOut) {
|
|
2920
|
+
if (err.exitCode === 1)
|
|
2921
|
+
throw new VersionNotOnBranchError();
|
|
2922
|
+
const stderr = err.stderr ?? err.message;
|
|
2923
|
+
if (
|
|
2924
|
+
// The complaint has to be about THE SHA WE ASKED FOR. `HEAD` is the
|
|
2925
|
+
// other argument, and git spells its own failures the same way: a
|
|
2926
|
+
// repository with no commits answers "ambiguous argument 'HEAD'",
|
|
2927
|
+
// which is a broken workspace, not a version off the branch.
|
|
2928
|
+
// Refusing it as "not in this file's history" would hide an
|
|
2929
|
+
// infrastructure failure behind a sentence about access.
|
|
2930
|
+
stderr.toLowerCase().includes(sha.toLowerCase()) &&
|
|
2931
|
+
// git's wording for "I cannot resolve that" varies by subcommand and
|
|
2932
|
+
// by version — `merge-base` says "Not a valid commit name", others
|
|
2933
|
+
// "not a valid object name" / "unknown revision" — so every spelling
|
|
2934
|
+
// that means the same thing is listed rather than one guessed at.
|
|
2935
|
+
/not a valid (object|commit) name|no such commit|bad object|unknown revision|malformed object name|ambiguous argument/i.test(stderr)) {
|
|
2936
|
+
throw new VersionNotOnBranchError();
|
|
2937
|
+
}
|
|
2938
|
+
}
|
|
2939
|
+
throw err;
|
|
2940
|
+
}
|
|
2941
|
+
}
|
|
2942
|
+
/**
|
|
2943
|
+
* One file's BYTES at a save, exactly as they were — the `after` side of
|
|
2944
|
+
* `sha`, or the `before` side (`<sha>^`) for the save that deleted it.
|
|
2945
|
+
*
|
|
2946
|
+
* Every guard the text history surfaces apply, in the same order: the sha is
|
|
2947
|
+
* a sha, the save is on this branch, and the pathspec is not a directory at
|
|
2948
|
+
* that ref (a per-file gate upstream authorized one path, and a tree read
|
|
2949
|
+
* would hand over every child). `null` means the file was not there on the
|
|
2950
|
+
* side asked for.
|
|
2951
|
+
*
|
|
2952
|
+
* Runs inside the workspace's git turn — one turn for the whole read, so the
|
|
2953
|
+
* ancestry check and the bytes it authorizes cannot be separated by another
|
|
2954
|
+
* caller's checkout.
|
|
2955
|
+
*/
|
|
2956
|
+
async fileBytesAtCommit(workspaceId, relativePath, sha, side) {
|
|
2957
|
+
assertValidRelativePath(relativePath);
|
|
2958
|
+
if (!/^[a-f0-9]{7,40}$/i.test(sha)) {
|
|
2959
|
+
throw new WorkflowValidationError('invalid commit sha');
|
|
2960
|
+
}
|
|
2961
|
+
const repoRelativePath = this.stripRepoPrefix(relativePath);
|
|
2962
|
+
return this.mutex.run(workspaceId, async () => {
|
|
2963
|
+
const cwd = await this.repoDir(workspaceId);
|
|
2964
|
+
await this.assertOnBranchHistory(cwd, sha);
|
|
2965
|
+
const ref = side === 'before' ? `${sha}^` : sha;
|
|
2966
|
+
await this.assertNotTreeAtRef(cwd, ref, repoRelativePath, relativePath);
|
|
2967
|
+
return this.blobAtRef(cwd, ref, repoRelativePath);
|
|
2968
|
+
});
|
|
2969
|
+
}
|
|
2822
2970
|
/**
|
|
2823
2971
|
* The commits on `ref` that touched `repoRelativePath`, newest first, at
|
|
2824
2972
|
* most `limit` of them. What a skill's `version` is looked up through: each
|
|
@@ -2915,6 +3063,22 @@ export class GitService {
|
|
|
2915
3063
|
env: { GIT_LITERAL_PATHSPECS: '1', ...opts?.env },
|
|
2916
3064
|
});
|
|
2917
3065
|
}
|
|
3066
|
+
/**
|
|
3067
|
+
* {@link git}, with stdout as raw BYTES.
|
|
3068
|
+
*
|
|
3069
|
+
* A sibling rather than an `encoding` option on `git()` itself: every other
|
|
3070
|
+
* caller in this service reads text, and the two return types (`string` vs
|
|
3071
|
+
* `Buffer`) are not interchangeable at any call site. Same
|
|
3072
|
+
* `GIT_LITERAL_PATHSPECS` and same runner deadline — the only difference is
|
|
3073
|
+
* that the bytes are not decoded.
|
|
3074
|
+
*/
|
|
3075
|
+
gitBytes(cwd, args, opts) {
|
|
3076
|
+
return this.gitRunner.run(cwd, args, {
|
|
3077
|
+
...opts,
|
|
3078
|
+
encoding: 'buffer',
|
|
3079
|
+
env: { GIT_LITERAL_PATHSPECS: '1', ...opts?.env },
|
|
3080
|
+
});
|
|
3081
|
+
}
|
|
2918
3082
|
}
|
|
2919
3083
|
/** Map a git status letter (`git diff --name-status`) to the DTO's `PrFileStatus`. */
|
|
2920
3084
|
function mapGitStatus(letter) {
|