@bevel-software/platform-core-backend 0.25.2 → 0.27.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/access-control.md +251 -0
- package/agent-guide/conventions.md +35 -0
- package/agent-guide/directory-structure.md +145 -0
- package/agent-guide/finding-things.md +7 -0
- package/agent-guide/html-views.md +83 -0
- package/agent-guide/introduction.md +27 -0
- package/agent-guide/new-knowledge-base.md +24 -0
- package/agent-guide/skills.md +47 -0
- package/agent-guide/tool-manuals.md +227 -0
- package/agent-guide/where-a-new-file-goes.md +36 -0
- package/dist/assets.d.ts +26 -0
- package/dist/assets.d.ts.map +1 -1
- package/dist/assets.js +35 -2
- package/dist/assets.js.map +1 -1
- package/dist/core/catalog-revision.d.ts +19 -1
- package/dist/core/catalog-revision.d.ts.map +1 -1
- package/dist/core/catalog-revision.js +14 -3
- package/dist/core/catalog-revision.js.map +1 -1
- package/dist/core/core-ports.d.ts +11 -0
- 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 +5 -0
- package/dist/core/create-core-server.d.ts.map +1 -1
- package/dist/core/create-core-server.js +65 -3
- package/dist/core/create-core-server.js.map +1 -1
- package/dist/core/create-core-services.d.ts +35 -0
- package/dist/core/create-core-services.d.ts.map +1 -1
- package/dist/core/create-core-services.js +114 -12
- package/dist/core/create-core-services.js.map +1 -1
- package/dist/core/lifecycle.d.ts +16 -1
- package/dist/core/lifecycle.d.ts.map +1 -1
- package/dist/core/lifecycle.js +18 -1
- package/dist/core/lifecycle.js.map +1 -1
- package/dist/core-config.d.ts +21 -0
- package/dist/core-config.d.ts.map +1 -1
- package/dist/core-config.js +22 -1
- package/dist/core-config.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/access/access-control.interface.d.ts +17 -0
- package/dist/modules/access/access-control.interface.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.d.ts +2 -0
- package/dist/modules/access/access-control.service.d.ts.map +1 -1
- package/dist/modules/access/access-control.service.js +27 -0
- package/dist/modules/access/access-control.service.js.map +1 -1
- package/dist/modules/access/directory-sync-bot.js +1 -1
- package/dist/modules/access/directory-sync-bot.js.map +1 -1
- package/dist/modules/agent-guide/agent-guide.d.ts +145 -0
- package/dist/modules/agent-guide/agent-guide.d.ts.map +1 -0
- package/dist/modules/agent-guide/agent-guide.js +199 -0
- package/dist/modules/agent-guide/agent-guide.js.map +1 -0
- package/dist/modules/agent-guide/agent-guide.tools.d.ts +24 -0
- package/dist/modules/agent-guide/agent-guide.tools.d.ts.map +1 -0
- package/dist/modules/agent-guide/agent-guide.tools.js +100 -0
- package/dist/modules/agent-guide/agent-guide.tools.js.map +1 -0
- package/dist/modules/agent-guide/index.d.ts +4 -0
- package/dist/modules/agent-guide/index.d.ts.map +1 -0
- package/dist/modules/agent-guide/index.js +4 -0
- package/dist/modules/agent-guide/index.js.map +1 -0
- package/dist/modules/agent-instructions/agent-instructions.routes.d.ts +3 -2
- package/dist/modules/agent-instructions/agent-instructions.routes.d.ts.map +1 -1
- package/dist/modules/agent-instructions/agent-instructions.routes.js +3 -2
- package/dist/modules/agent-instructions/agent-instructions.routes.js.map +1 -1
- package/dist/modules/agent-instructions/compose.d.ts +14 -6
- package/dist/modules/agent-instructions/compose.d.ts.map +1 -1
- package/dist/modules/agent-instructions/compose.js +28 -8
- package/dist/modules/agent-instructions/compose.js.map +1 -1
- package/dist/modules/agent-instructions/index.d.ts +1 -1
- package/dist/modules/agent-instructions/index.d.ts.map +1 -1
- package/dist/modules/agent-instructions/index.js +1 -1
- package/dist/modules/agent-instructions/index.js.map +1 -1
- package/dist/modules/agent-instructions/shared-file-rules.d.ts +10 -50
- package/dist/modules/agent-instructions/shared-file-rules.d.ts.map +1 -1
- package/dist/modules/agent-instructions/shared-file-rules.js +51 -104
- package/dist/modules/agent-instructions/shared-file-rules.js.map +1 -1
- package/dist/modules/audit/agent-audit.service.d.ts +21 -2
- package/dist/modules/audit/agent-audit.service.d.ts.map +1 -1
- package/dist/modules/audit/agent-audit.service.js +43 -2
- package/dist/modules/audit/agent-audit.service.js.map +1 -1
- package/dist/modules/audit/agent-connection.routes.d.ts +34 -0
- package/dist/modules/audit/agent-connection.routes.d.ts.map +1 -0
- package/dist/modules/audit/agent-connection.routes.js +38 -0
- package/dist/modules/audit/agent-connection.routes.js.map +1 -0
- package/dist/modules/audit/audit.contract.d.ts +24 -0
- package/dist/modules/audit/audit.contract.d.ts.map +1 -1
- package/dist/modules/audit/audit.contract.js.map +1 -1
- package/dist/modules/audit/index.d.ts +1 -0
- package/dist/modules/audit/index.d.ts.map +1 -1
- package/dist/modules/audit/index.js +1 -0
- package/dist/modules/audit/index.js.map +1 -1
- package/dist/modules/auth/account.routes.d.ts.map +1 -1
- package/dist/modules/auth/account.routes.js +10 -3
- package/dist/modules/auth/account.routes.js.map +1 -1
- package/dist/modules/auth/auth.middleware.d.ts +7 -0
- package/dist/modules/auth/auth.middleware.d.ts.map +1 -1
- package/dist/modules/auth/auth.middleware.js +1 -1
- package/dist/modules/auth/auth.middleware.js.map +1 -1
- package/dist/modules/code-mode/code-mode.tool.d.ts.map +1 -1
- package/dist/modules/code-mode/code-mode.tool.js +11 -3
- package/dist/modules/code-mode/code-mode.tool.js.map +1 -1
- package/dist/modules/database/core-schema.d.ts +96 -0
- package/dist/modules/database/core-schema.d.ts.map +1 -1
- package/dist/modules/database/core-schema.js +32 -3
- package/dist/modules/database/core-schema.js.map +1 -1
- package/dist/modules/embed/account-link.service.d.ts +42 -0
- package/dist/modules/embed/account-link.service.d.ts.map +1 -0
- package/dist/modules/embed/account-link.service.js +50 -0
- package/dist/modules/embed/account-link.service.js.map +1 -0
- package/dist/modules/embed/embed-link.d.ts +58 -0
- package/dist/modules/embed/embed-link.d.ts.map +1 -0
- package/dist/modules/embed/embed-link.js +160 -0
- package/dist/modules/embed/embed-link.js.map +1 -0
- package/dist/modules/embed/embed.errors.d.ts +30 -0
- package/dist/modules/embed/embed.errors.d.ts.map +1 -0
- package/dist/modules/embed/embed.errors.js +42 -0
- package/dist/modules/embed/embed.errors.js.map +1 -0
- package/dist/modules/embed/embed.interface.d.ts +204 -0
- package/dist/modules/embed/embed.interface.d.ts.map +1 -0
- package/dist/modules/embed/embed.interface.js +2 -0
- package/dist/modules/embed/embed.interface.js.map +1 -0
- package/dist/modules/embed/embed.routes.d.ts +59 -0
- package/dist/modules/embed/embed.routes.d.ts.map +1 -0
- package/dist/modules/embed/embed.routes.js +343 -0
- package/dist/modules/embed/embed.routes.js.map +1 -0
- package/dist/modules/embed/embed.service.d.ts +169 -0
- package/dist/modules/embed/embed.service.d.ts.map +1 -0
- package/dist/modules/embed/embed.service.js +627 -0
- package/dist/modules/embed/embed.service.js.map +1 -0
- package/dist/modules/embed/embed.tools.d.ts +51 -0
- package/dist/modules/embed/embed.tools.d.ts.map +1 -0
- package/dist/modules/embed/embed.tools.js +170 -0
- package/dist/modules/embed/embed.tools.js.map +1 -0
- package/dist/modules/embed/mcp-app.d.ts +64 -0
- package/dist/modules/embed/mcp-app.d.ts.map +1 -0
- package/dist/modules/embed/mcp-app.js +147 -0
- package/dist/modules/embed/mcp-app.js.map +1 -0
- package/dist/modules/embed/mcp-app.routes.d.ts +21 -0
- package/dist/modules/embed/mcp-app.routes.d.ts.map +1 -0
- package/dist/modules/embed/mcp-app.routes.js +36 -0
- package/dist/modules/embed/mcp-app.routes.js.map +1 -0
- package/dist/modules/github-app/github-app.connection.d.ts +15 -0
- package/dist/modules/github-app/github-app.connection.d.ts.map +1 -1
- package/dist/modules/github-app/github-app.connection.js +34 -3
- package/dist/modules/github-app/github-app.connection.js.map +1 -1
- package/dist/modules/kb-fs/locking-filesystem.d.ts +65 -0
- package/dist/modules/kb-fs/locking-filesystem.d.ts.map +1 -1
- package/dist/modules/kb-fs/locking-filesystem.js +300 -0
- package/dist/modules/kb-fs/locking-filesystem.js.map +1 -1
- package/dist/modules/kb-sync/kb-sync.interface.d.ts +5 -0
- package/dist/modules/kb-sync/kb-sync.interface.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.service.d.ts.map +1 -1
- package/dist/modules/kb-sync/kb-sync.service.js +6 -0
- package/dist/modules/kb-sync/kb-sync.service.js.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.d.ts.map +1 -1
- package/dist/modules/mcp/mcp-auth.middleware.js +2 -1
- package/dist/modules/mcp/mcp-auth.middleware.js.map +1 -1
- package/dist/modules/mcp/mcp.service.d.ts +57 -3
- package/dist/modules/mcp/mcp.service.d.ts.map +1 -1
- package/dist/modules/mcp/mcp.service.js +177 -24
- package/dist/modules/mcp/mcp.service.js.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts +24 -0
- package/dist/modules/mcp/oauth/bevel-oauth-provider.d.ts.map +1 -1
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js +32 -4
- package/dist/modules/mcp/oauth/bevel-oauth-provider.js.map +1 -1
- package/dist/modules/mcp/tool-schema-guard.d.ts +105 -0
- package/dist/modules/mcp/tool-schema-guard.d.ts.map +1 -0
- package/dist/modules/mcp/tool-schema-guard.js +171 -0
- package/dist/modules/mcp/tool-schema-guard.js.map +1 -0
- package/dist/modules/onboarding/onboarding.contract.d.ts +80 -0
- package/dist/modules/onboarding/onboarding.contract.d.ts.map +1 -0
- package/dist/modules/onboarding/onboarding.contract.js +7 -0
- package/dist/modules/onboarding/onboarding.contract.js.map +1 -0
- package/dist/modules/onboarding/onboarding.routes.d.ts +18 -0
- package/dist/modules/onboarding/onboarding.routes.d.ts.map +1 -0
- package/dist/modules/onboarding/onboarding.routes.js +81 -0
- package/dist/modules/onboarding/onboarding.routes.js.map +1 -0
- package/dist/modules/onboarding/starter-pack.service.d.ts +213 -0
- package/dist/modules/onboarding/starter-pack.service.d.ts.map +1 -0
- package/dist/modules/onboarding/starter-pack.service.js +492 -0
- package/dist/modules/onboarding/starter-pack.service.js.map +1 -0
- package/dist/modules/onboarding/starter-packs.d.ts +78 -0
- package/dist/modules/onboarding/starter-packs.d.ts.map +1 -0
- package/dist/modules/onboarding/starter-packs.js +156 -0
- package/dist/modules/onboarding/starter-packs.js.map +1 -0
- package/dist/modules/plugins/index.d.ts +1 -1
- package/dist/modules/plugins/index.d.ts.map +1 -1
- package/dist/modules/plugins/index.js +1 -1
- package/dist/modules/plugins/index.js.map +1 -1
- package/dist/modules/plugins/plugin-provision.service.d.ts +19 -0
- package/dist/modules/plugins/plugin-provision.service.d.ts.map +1 -1
- package/dist/modules/plugins/plugin-provision.service.js +18 -1
- package/dist/modules/plugins/plugin-provision.service.js.map +1 -1
- package/dist/modules/plugins/plugins.routes.d.ts +0 -36
- package/dist/modules/plugins/plugins.routes.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.routes.js +31 -0
- package/dist/modules/plugins/plugins.routes.js.map +1 -1
- package/dist/modules/plugins/plugins.tools.d.ts +36 -2
- package/dist/modules/plugins/plugins.tools.d.ts.map +1 -1
- package/dist/modules/plugins/plugins.tools.js +71 -14
- package/dist/modules/plugins/plugins.tools.js.map +1 -1
- package/dist/modules/settings/deployment-settings.service.d.ts +34 -7
- package/dist/modules/settings/deployment-settings.service.d.ts.map +1 -1
- package/dist/modules/settings/deployment-settings.service.js +148 -54
- package/dist/modules/settings/deployment-settings.service.js.map +1 -1
- package/dist/modules/settings/repository-source.d.ts +1 -0
- package/dist/modules/settings/repository-source.d.ts.map +1 -1
- package/dist/modules/settings/repository-source.js +3 -3
- package/dist/modules/settings/repository-source.js.map +1 -1
- package/dist/modules/settings/setup.routes.d.ts.map +1 -1
- package/dist/modules/settings/setup.routes.js +3 -6
- package/dist/modules/settings/setup.routes.js.map +1 -1
- package/dist/modules/skills/skills.tools.d.ts.map +1 -1
- package/dist/modules/skills/skills.tools.js +103 -43
- package/dist/modules/skills/skills.tools.js.map +1 -1
- package/dist/modules/tool-auth/connection-key-rejection.d.ts +10 -1
- package/dist/modules/tool-auth/connection-key-rejection.d.ts.map +1 -1
- package/dist/modules/tool-auth/connection-key-rejection.js +11 -3
- package/dist/modules/tool-auth/connection-key-rejection.js.map +1 -1
- package/dist/modules/tool-auth/external-api-key.interface.d.ts +8 -0
- package/dist/modules/tool-auth/external-api-key.interface.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.d.ts +24 -2
- package/dist/modules/tool-auth/external-api-key.service.d.ts.map +1 -1
- package/dist/modules/tool-auth/external-api-key.service.js +59 -2
- package/dist/modules/tool-auth/external-api-key.service.js.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.d.ts.map +1 -1
- package/dist/modules/tool-auth/tool-auth.middleware.js +9 -4
- package/dist/modules/tool-auth/tool-auth.middleware.js.map +1 -1
- package/dist/modules/tool-helpers/index.d.ts +28 -1
- package/dist/modules/tool-helpers/index.d.ts.map +1 -1
- package/dist/modules/tool-helpers/index.js +28 -1
- package/dist/modules/tool-helpers/index.js.map +1 -1
- package/dist/modules/tool-helpers/route-argument-check.d.ts +10 -0
- package/dist/modules/tool-helpers/route-argument-check.d.ts.map +1 -0
- package/dist/modules/tool-helpers/route-argument-check.js +132 -0
- package/dist/modules/tool-helpers/route-argument-check.js.map +1 -0
- package/dist/modules/tool-helpers/route-tool-schemas.d.ts +89 -0
- package/dist/modules/tool-helpers/route-tool-schemas.d.ts.map +1 -0
- package/dist/modules/tool-helpers/route-tool-schemas.js +113 -0
- package/dist/modules/tool-helpers/route-tool-schemas.js.map +1 -0
- package/dist/modules/tool-helpers/tool-def.d.ts +71 -0
- package/dist/modules/tool-helpers/tool-def.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool-def.js +70 -6
- package/dist/modules/tool-helpers/tool-def.js.map +1 -1
- package/dist/modules/tool-helpers/tool-handler.d.ts +46 -6
- package/dist/modules/tool-helpers/tool-handler.d.ts.map +1 -1
- package/dist/modules/tool-helpers/tool-handler.js +157 -8
- package/dist/modules/tool-helpers/tool-handler.js.map +1 -1
- package/dist/modules/tool-helpers/tool.contract.d.ts +9 -0
- 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-manuals/tool-manuals.contract.d.ts +23 -4
- package/dist/modules/tool-manuals/tool-manuals.contract.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.contract.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts +4 -0
- package/dist/modules/tool-manuals/tool-manuals.service.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.service.js +14 -0
- package/dist/modules/tool-manuals/tool-manuals.service.js.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts +7 -0
- package/dist/modules/tool-manuals/tool-manuals.tools.d.ts.map +1 -1
- package/dist/modules/tool-manuals/tool-manuals.tools.js +77 -38
- package/dist/modules/tool-manuals/tool-manuals.tools.js.map +1 -1
- package/dist/modules/tool-registry/description-length.d.ts +20 -16
- package/dist/modules/tool-registry/description-length.d.ts.map +1 -1
- package/dist/modules/tool-registry/description-length.js +50 -30
- package/dist/modules/tool-registry/description-length.js.map +1 -1
- package/dist/modules/tool-registry/guide-first.d.ts +27 -0
- package/dist/modules/tool-registry/guide-first.d.ts.map +1 -0
- package/dist/modules/tool-registry/guide-first.js +40 -0
- package/dist/modules/tool-registry/guide-first.js.map +1 -0
- package/dist/modules/tool-registry/tool-registry.d.ts +6 -0
- package/dist/modules/tool-registry/tool-registry.d.ts.map +1 -1
- package/dist/modules/tool-registry/tool-registry.js +9 -2
- package/dist/modules/tool-registry/tool-registry.js.map +1 -1
- package/dist/modules/workflow/agent-tools/change-request-read-shape.d.ts +449 -0
- package/dist/modules/workflow/agent-tools/change-request-read-shape.d.ts.map +1 -0
- package/dist/modules/workflow/agent-tools/change-request-read-shape.js +481 -0
- package/dist/modules/workflow/agent-tools/change-request-read-shape.js.map +1 -0
- package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts +126 -0
- package/dist/modules/workflow/agent-tools/change-request-read.tools.d.ts.map +1 -0
- package/dist/modules/workflow/agent-tools/change-request-read.tools.js +611 -0
- package/dist/modules/workflow/agent-tools/change-request-read.tools.js.map +1 -0
- package/dist/modules/workflow/agent-tools/change-request-summary.d.ts +12 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.d.ts.map +1 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.js +5 -1
- package/dist/modules/workflow/agent-tools/change-request-summary.js.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts +8 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.d.ts.map +1 -1
- package/dist/modules/workflow/agent-tools/workflow.tools.js +133 -37
- package/dist/modules/workflow/agent-tools/workflow.tools.js.map +1 -1
- package/dist/modules/workflow/file-lock.service.d.ts +29 -5
- package/dist/modules/workflow/file-lock.service.d.ts.map +1 -1
- package/dist/modules/workflow/file-lock.service.js +62 -5
- package/dist/modules/workflow/file-lock.service.js.map +1 -1
- package/dist/modules/workflow/git/git.service.d.ts +282 -14
- package/dist/modules/workflow/git/git.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/git.service.js +627 -126
- package/dist/modules/workflow/git/git.service.js.map +1 -1
- package/dist/modules/workflow/git/merge-commit.d.ts +73 -0
- package/dist/modules/workflow/git/merge-commit.d.ts.map +1 -0
- package/dist/modules/workflow/git/merge-commit.js +89 -0
- package/dist/modules/workflow/git/merge-commit.js.map +1 -0
- package/dist/modules/workflow/git/node-git-runner.d.ts +15 -0
- package/dist/modules/workflow/git/node-git-runner.d.ts.map +1 -1
- package/dist/modules/workflow/git/node-git-runner.js +78 -6
- package/dist/modules/workflow/git/node-git-runner.js.map +1 -1
- package/dist/modules/workflow/git/pull-request.service.d.ts +94 -1
- package/dist/modules/workflow/git/pull-request.service.d.ts.map +1 -1
- package/dist/modules/workflow/git/pull-request.service.js +332 -37
- package/dist/modules/workflow/git/pull-request.service.js.map +1 -1
- package/dist/modules/workflow/pending-commits.service.d.ts +15 -0
- package/dist/modules/workflow/pending-commits.service.d.ts.map +1 -1
- package/dist/modules/workflow/pending-commits.service.js +25 -1
- package/dist/modules/workflow/pending-commits.service.js.map +1 -1
- package/dist/modules/workflow/pending-commits.worker.d.ts +6 -1
- package/dist/modules/workflow/pending-commits.worker.d.ts.map +1 -1
- package/dist/modules/workflow/pending-commits.worker.js +23 -6
- package/dist/modules/workflow/pending-commits.worker.js.map +1 -1
- package/dist/modules/workflow/recovery-bot.js +1 -1
- package/dist/modules/workflow/recovery-bot.js.map +1 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts +35 -0
- package/dist/modules/workflow/review-workflow/review-workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/review-workflow/review-workflow.service.js +180 -13
- package/dist/modules/workflow/review-workflow/review-workflow.service.js.map +1 -1
- package/dist/modules/workflow/sanitize-error.d.ts +16 -0
- package/dist/modules/workflow/sanitize-error.d.ts.map +1 -1
- package/dist/modules/workflow/sanitize-error.js +45 -0
- package/dist/modules/workflow/sanitize-error.js.map +1 -1
- package/dist/modules/workflow/workflow.routes.d.ts +6 -2
- package/dist/modules/workflow/workflow.routes.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.routes.js +7 -2
- package/dist/modules/workflow/workflow.routes.js.map +1 -1
- package/dist/modules/workflow/workflow.service.d.ts +187 -15
- package/dist/modules/workflow/workflow.service.d.ts.map +1 -1
- package/dist/modules/workflow/workflow.service.js +808 -106
- package/dist/modules/workflow/workflow.service.js.map +1 -1
- package/dist/modules/workspace/agent-download.builder.d.ts +105 -0
- package/dist/modules/workspace/agent-download.builder.d.ts.map +1 -0
- package/dist/modules/workspace/agent-download.builder.js +238 -0
- package/dist/modules/workspace/agent-download.builder.js.map +1 -0
- package/dist/modules/workspace/agent-download.routes.d.ts +77 -0
- package/dist/modules/workspace/agent-download.routes.d.ts.map +1 -0
- package/dist/modules/workspace/agent-download.routes.js +156 -0
- package/dist/modules/workspace/agent-download.routes.js.map +1 -0
- package/dist/modules/workspace/agent-download.store.d.ts +225 -0
- package/dist/modules/workspace/agent-download.store.d.ts.map +1 -0
- package/dist/modules/workspace/agent-download.store.js +423 -0
- package/dist/modules/workspace/agent-download.store.js.map +1 -0
- package/dist/modules/workspace/agent-upload.store.d.ts +10 -1
- package/dist/modules/workspace/agent-upload.store.d.ts.map +1 -1
- package/dist/modules/workspace/agent-upload.store.js +16 -6
- package/dist/modules/workspace/agent-upload.store.js.map +1 -1
- package/dist/modules/workspace/file-readers/raw-mime.d.ts +6 -0
- package/dist/modules/workspace/file-readers/raw-mime.d.ts.map +1 -0
- package/dist/modules/workspace/file-readers/raw-mime.js +38 -0
- package/dist/modules/workspace/file-readers/raw-mime.js.map +1 -0
- package/dist/modules/workspace/file-readers/text-reader.d.ts +5 -5
- package/dist/modules/workspace/file-readers/text-reader.d.ts.map +1 -1
- package/dist/modules/workspace/file-readers/text-reader.js +5 -8
- package/dist/modules/workspace/file-readers/text-reader.js.map +1 -1
- package/dist/modules/workspace/first-run.d.ts +111 -0
- package/dist/modules/workspace/first-run.d.ts.map +1 -0
- package/dist/modules/workspace/first-run.js +181 -0
- package/dist/modules/workspace/first-run.js.map +1 -0
- package/dist/modules/workspace/move-links.d.ts +92 -0
- package/dist/modules/workspace/move-links.d.ts.map +1 -0
- package/dist/modules/workspace/move-links.js +173 -0
- package/dist/modules/workspace/move-links.js.map +1 -0
- package/dist/modules/workspace/startup/steps/seed-tree.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/seed-tree.js +24 -39
- package/dist/modules/workspace/startup/steps/seed-tree.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts +58 -52
- package/dist/modules/workspace/startup/steps/template-files.step.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-files.step.js +209 -223
- package/dist/modules/workspace/startup/steps/template-files.step.js.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.d.ts +5 -3
- package/dist/modules/workspace/startup/steps/template-source.d.ts.map +1 -1
- package/dist/modules/workspace/startup/steps/template-source.js +5 -3
- package/dist/modules/workspace/startup/steps/template-source.js.map +1 -1
- package/dist/modules/workspace/workspace.routes.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.routes.js +63 -22
- package/dist/modules/workspace/workspace.routes.js.map +1 -1
- package/dist/modules/workspace/workspace.service.d.ts +75 -2
- package/dist/modules/workspace/workspace.service.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.service.js +197 -24
- package/dist/modules/workspace/workspace.service.js.map +1 -1
- package/dist/modules/workspace/workspace.tools.d.ts +68 -1
- package/dist/modules/workspace/workspace.tools.d.ts.map +1 -1
- package/dist/modules/workspace/workspace.tools.js +642 -71
- package/dist/modules/workspace/workspace.tools.js.map +1 -1
- package/dist/modules/write-access/write-access.d.ts.map +1 -1
- package/dist/modules/write-access/write-access.js +9 -0
- package/dist/modules/write-access/write-access.js.map +1 -1
- package/dist/shared/domain-errors.d.ts +84 -1
- package/dist/shared/domain-errors.d.ts.map +1 -1
- package/dist/shared/domain-errors.js +100 -12
- package/dist/shared/domain-errors.js.map +1 -1
- package/dist/shared/git.contract.d.ts +10 -1
- package/dist/shared/git.contract.d.ts.map +1 -1
- package/dist/shared/git.contract.js.map +1 -1
- package/dist/shared/hidden-tools.d.ts +44 -0
- package/dist/shared/hidden-tools.d.ts.map +1 -0
- package/dist/shared/hidden-tools.js +13 -0
- package/dist/shared/hidden-tools.js.map +1 -0
- package/dist/shared/utf8-text.d.ts +15 -0
- package/dist/shared/utf8-text.d.ts.map +1 -0
- package/dist/shared/utf8-text.js +20 -0
- package/dist/shared/utf8-text.js.map +1 -0
- package/dist/tenancy/static-tenant-source.d.ts +2 -1
- package/dist/tenancy/static-tenant-source.d.ts.map +1 -1
- package/dist/tenancy/static-tenant-source.js +9 -2
- package/dist/tenancy/static-tenant-source.js.map +1 -1
- package/kb-template/.bevelignore +0 -5
- package/mcp-app/page.html +349 -0
- package/migrations/0017_atlassian_account_links.sql +37 -0
- package/migrations/meta/0017_snapshot.json +2396 -0
- package/migrations/meta/_journal.json +8 -1
- package/package.json +6 -3
- package/src/__tests__/kb-layout-config.test.ts +10 -100
- package/src/__tests__/packaged-assets-ship.test.ts +66 -0
- package/src/assets.ts +38 -2
- package/src/core/__tests__/catalog-revision.test.ts +40 -0
- package/src/core/__tests__/gated-boot.test.ts +1 -0
- package/src/core/__tests__/lifecycle.test.ts +14 -0
- package/src/core/catalog-revision.ts +15 -2
- package/src/core/core-ports.ts +11 -0
- package/src/core/create-core-server.ts +78 -3
- package/src/core/create-core-services.ts +168 -10
- package/src/core/lifecycle.ts +28 -2
- package/src/core-config.ts +24 -1
- package/src/index.ts +2 -2
- package/src/modules/access/__tests__/access-control.atref-batch.test.ts +58 -0
- package/src/modules/access/__tests__/access-control.platform-restore.test.ts +8 -7
- package/src/modules/access/__tests__/access-control.service.test.ts +19 -0
- package/src/modules/access/__tests__/access-personal-plugin.test.ts +1 -18
- package/src/modules/access/access-control.interface.ts +28 -0
- package/src/modules/access/access-control.service.ts +37 -0
- package/src/modules/access/directory-sync-bot.ts +1 -1
- package/src/modules/agent-guide/__tests__/agent-guide.test.ts +386 -0
- package/src/modules/agent-guide/__tests__/agent-guide.tools.test.ts +207 -0
- package/src/modules/agent-guide/agent-guide.tools.ts +122 -0
- package/src/modules/agent-guide/agent-guide.ts +300 -0
- package/src/modules/agent-guide/index.ts +22 -0
- package/src/modules/agent-instructions/__tests__/shared-file-rules.test.ts +39 -118
- package/src/modules/agent-instructions/agent-instructions.routes.ts +3 -2
- package/src/modules/agent-instructions/compose.ts +26 -8
- package/src/modules/agent-instructions/index.ts +0 -3
- package/src/modules/agent-instructions/shared-file-rules.ts +50 -112
- package/src/modules/audit/__tests__/agent-audit.service.test.ts +64 -4
- package/src/modules/audit/__tests__/agent-connection.routes.test.ts +102 -0
- package/src/modules/audit/agent-audit.service.ts +58 -3
- package/src/modules/audit/agent-connection.routes.ts +56 -0
- package/src/modules/audit/audit.contract.ts +26 -0
- package/src/modules/audit/index.ts +1 -0
- package/src/modules/auth/__tests__/account.routes.test.ts +5 -3
- package/src/modules/auth/account.routes.ts +10 -3
- package/src/modules/auth/auth.middleware.ts +1 -1
- package/src/modules/code-mode/__tests__/code-mode.tool.test.ts +18 -2
- package/src/modules/code-mode/code-mode.tool.ts +13 -2
- package/src/modules/database/core-schema.ts +33 -3
- package/src/modules/embed/__tests__/account-links.migration.test.ts +98 -0
- package/src/modules/embed/__tests__/embed-link.test.ts +122 -0
- package/src/modules/embed/__tests__/embed.routes.test.ts +362 -0
- package/src/modules/embed/__tests__/embed.service.lock.test.ts +193 -0
- package/src/modules/embed/__tests__/embed.service.test.ts +805 -0
- package/src/modules/embed/__tests__/embed.tools.test.ts +304 -0
- package/src/modules/embed/__tests__/mcp-app.test.ts +207 -0
- package/src/modules/embed/account-link.service.ts +76 -0
- package/src/modules/embed/embed-link.ts +180 -0
- package/src/modules/embed/embed.errors.ts +43 -0
- package/src/modules/embed/embed.interface.ts +203 -0
- package/src/modules/embed/embed.routes.ts +363 -0
- package/src/modules/embed/embed.service.ts +705 -0
- package/src/modules/embed/embed.tools.ts +206 -0
- package/src/modules/embed/mcp-app.routes.ts +41 -0
- package/src/modules/embed/mcp-app.ts +173 -0
- package/src/modules/github-app/__tests__/github-app.test.ts +76 -0
- package/src/modules/github-app/github-app.connection.ts +38 -4
- package/src/modules/kb-fs/__tests__/move-with-edits.test.ts +304 -0
- package/src/modules/kb-fs/locking-filesystem.ts +287 -0
- package/src/modules/kb-sync/__tests__/kb-sync.service.test.ts +35 -0
- package/src/modules/kb-sync/kb-sync.interface.ts +2 -0
- package/src/modules/kb-sync/kb-sync.service.ts +6 -0
- package/src/modules/mcp/__tests__/bevel-oauth-provider.test.ts +68 -11
- package/src/modules/mcp/__tests__/fake-downstream-mcp-server.ts +14 -3
- package/src/modules/mcp/__tests__/mcp-proxy-helpers.test.ts +37 -2
- package/src/modules/mcp/__tests__/mcp.app.e2e.test.ts +200 -0
- package/src/modules/mcp/__tests__/mcp.e2e.test.ts +252 -0
- package/src/modules/mcp/__tests__/mcp.service.test.ts +42 -24
- package/src/modules/mcp/__tests__/tool-call-interface.e2e.test.ts +499 -0
- package/src/modules/mcp/__tests__/tool-schema-guard.test.ts +266 -0
- package/src/modules/mcp/mcp-auth.middleware.ts +2 -1
- package/src/modules/mcp/mcp.service.ts +218 -31
- package/src/modules/mcp/oauth/bevel-oauth-provider.ts +42 -4
- package/src/modules/mcp/tool-schema-guard.ts +196 -0
- package/src/modules/onboarding/__tests__/onboarding.routes.test.ts +163 -0
- package/src/modules/onboarding/__tests__/starter-pack.service.test.ts +635 -0
- package/src/modules/onboarding/__tests__/starter-packs.test.ts +169 -0
- package/src/modules/onboarding/onboarding.contract.ts +85 -0
- package/src/modules/onboarding/onboarding.routes.ts +85 -0
- package/src/modules/onboarding/starter-pack.service.ts +580 -0
- package/src/modules/onboarding/starter-packs.ts +182 -0
- package/src/modules/plugins/__tests__/plugins.tools.test.ts +177 -4
- package/src/modules/plugins/index.ts +1 -0
- package/src/modules/plugins/plugin-provision.service.ts +22 -1
- package/src/modules/plugins/plugins.routes.ts +29 -0
- package/src/modules/plugins/plugins.tools.ts +75 -15
- package/src/modules/settings/__tests__/deployment-settings.service.test.ts +176 -56
- package/src/modules/settings/__tests__/repository-source.test.ts +9 -0
- package/src/modules/settings/deployment-settings.service.ts +144 -55
- package/src/modules/settings/repository-source.ts +4 -4
- package/src/modules/settings/setup.routes.ts +3 -6
- package/src/modules/skills/__tests__/skills.tools.description.test.ts +95 -0
- package/src/modules/skills/skills.tools.ts +112 -46
- package/src/modules/tool-auth/__tests__/connection-key-rejection.test.ts +32 -0
- package/src/modules/tool-auth/__tests__/external-api-key.service.test.ts +65 -0
- package/src/modules/tool-auth/connection-key-rejection.ts +13 -3
- package/src/modules/tool-auth/external-api-key.interface.ts +9 -0
- package/src/modules/tool-auth/external-api-key.service.ts +61 -4
- package/src/modules/tool-auth/tool-auth.middleware.ts +13 -4
- package/src/modules/tool-helpers/__tests__/branch-declaration.test.ts +502 -0
- package/src/modules/tool-helpers/__tests__/route-argument-check.test.ts +337 -0
- package/src/modules/tool-helpers/index.ts +34 -1
- package/src/modules/tool-helpers/route-argument-check.ts +149 -0
- package/src/modules/tool-helpers/route-tool-schemas.ts +171 -0
- package/src/modules/tool-helpers/tool-def.ts +132 -7
- package/src/modules/tool-helpers/tool-handler.ts +196 -8
- package/src/modules/tool-helpers/tool.contract.ts +9 -0
- package/src/modules/tool-manuals/__tests__/tool-manuals.detail.route.test.ts +57 -0
- package/src/modules/tool-manuals/__tests__/tool-manuals.tools.test.ts +73 -4
- package/src/modules/tool-manuals/tool-manuals.contract.ts +24 -4
- package/src/modules/tool-manuals/tool-manuals.service.ts +17 -0
- package/src/modules/tool-manuals/tool-manuals.tools.ts +86 -38
- package/src/modules/tool-registry/__tests__/own-tool-schemas.test.ts +173 -0
- package/src/modules/tool-registry/__tests__/tool-description-length.test.ts +81 -66
- package/src/modules/tool-registry/description-length.ts +57 -32
- package/src/modules/tool-registry/guide-first.ts +41 -0
- package/src/modules/tool-registry/tool-registry.ts +9 -2
- package/src/modules/workflow/__tests__/apply-failure.test.ts +6 -1
- package/src/modules/workflow/__tests__/file-lock.service.deletion-gate.test.ts +104 -0
- package/src/modules/workflow/__tests__/pending-commits.repository-replaced.test.ts +66 -0
- package/src/modules/workflow/__tests__/pending-commits.worker.test.ts +31 -2
- package/src/modules/workflow/__tests__/preserve-roles-yaml.test.ts +110 -6
- package/src/modules/workflow/__tests__/sanitize-error.test.ts +89 -1
- package/src/modules/workflow/__tests__/workflow.routes.push-refused.test.ts +202 -0
- package/src/modules/workflow/__tests__/workflow.service.branch-in-use.test.ts +6 -6
- package/src/modules/workflow/__tests__/workflow.service.delete-branch.test.ts +1026 -0
- package/src/modules/workflow/__tests__/workflow.service.facade.test.ts +468 -10
- package/src/modules/workflow/__tests__/workflow.service.folder-proposals.test.ts +4 -0
- package/src/modules/workflow/__tests__/workflow.service.releaseLock.test.ts +5 -4
- package/src/modules/workflow/__tests__/workflow.service.update-from-target.test.ts +54 -2
- package/src/modules/workflow/agent-tools/__tests__/change-request-read-shape.test.ts +705 -0
- package/src/modules/workflow/agent-tools/__tests__/change-request-read.tools.test.ts +1554 -0
- package/src/modules/workflow/agent-tools/__tests__/workflow.tools.test.ts +150 -4
- package/src/modules/workflow/agent-tools/change-request-read-shape.ts +712 -0
- package/src/modules/workflow/agent-tools/change-request-read.tools.ts +759 -0
- package/src/modules/workflow/agent-tools/change-request-summary.ts +5 -1
- package/src/modules/workflow/agent-tools/workflow.tools.ts +137 -35
- package/src/modules/workflow/file-lock.service.ts +67 -5
- package/src/modules/workflow/git/__tests__/git.service.appliedChange.test.ts +285 -0
- package/src/modules/workflow/git/__tests__/git.service.changedFilesForPr.test.ts +124 -0
- package/src/modules/workflow/git/__tests__/git.service.deleteBranch.test.ts +164 -0
- package/src/modules/workflow/git/__tests__/git.service.mergeChangeRequest.test.ts +334 -0
- package/src/modules/workflow/git/__tests__/git.service.pull.test.ts +48 -1
- package/src/modules/workflow/git/__tests__/node-git-runner.test.ts +231 -2
- package/src/modules/workflow/git/__tests__/pull-request.service.list-fetch.test.ts +72 -2
- package/src/modules/workflow/git/__tests__/pull-request.service.placeholder.test.ts +24 -2
- package/src/modules/workflow/git/__tests__/pull-request.service.test.ts +620 -1
- package/src/modules/workflow/git/git.service.ts +714 -133
- package/src/modules/workflow/git/merge-commit.ts +88 -0
- package/src/modules/workflow/git/node-git-runner.ts +82 -7
- package/src/modules/workflow/git/pull-request.service.ts +380 -54
- package/src/modules/workflow/pending-commits.service.ts +29 -1
- package/src/modules/workflow/pending-commits.worker.ts +24 -6
- package/src/modules/workflow/recovery-bot.ts +1 -1
- package/src/modules/workflow/review-workflow/__tests__/approval-states.test.ts +7 -1
- package/src/modules/workflow/review-workflow/__tests__/merge-records-own-commit.test.ts +407 -0
- package/src/modules/workflow/review-workflow/review-workflow.service.ts +191 -12
- package/src/modules/workflow/sanitize-error.ts +50 -0
- package/src/modules/workflow/workflow.routes.ts +7 -2
- package/src/modules/workflow/workflow.service.ts +886 -112
- package/src/modules/workspace/__tests__/agent-downloads.test.ts +823 -0
- package/src/modules/workspace/__tests__/escape-sequences.routes.test.ts +4 -3
- package/src/modules/workspace/__tests__/first-run.test.ts +234 -0
- package/src/modules/workspace/__tests__/git-internals.security.test.ts +5 -2
- package/src/modules/workspace/__tests__/md-links.test.ts +353 -0
- package/src/modules/workspace/__tests__/move-links.test.ts +261 -0
- package/src/modules/workspace/__tests__/rest-tool-arguments.test.ts +219 -0
- package/src/modules/workspace/__tests__/workspace-paths-inside-the-repo.test.ts +3 -0
- package/src/modules/workspace/__tests__/workspace.routes.delete.test.ts +102 -0
- package/src/modules/workspace/__tests__/workspace.routes.download.test.ts +52 -5
- package/src/modules/workspace/__tests__/workspace.routes.folder-zip-access.test.ts +190 -0
- package/src/modules/workspace/__tests__/workspace.routes.move-platform-files.test.ts +21 -10
- package/src/modules/workspace/__tests__/workspace.service.forget-clone-races.test.ts +8 -4
- package/src/modules/workspace/__tests__/workspace.service.test.ts +50 -8
- package/src/modules/workspace/__tests__/workspace.tools.agents-file.test.ts +33 -55
- package/src/modules/workspace/__tests__/workspace.tools.branch-errors.test.ts +44 -1
- package/src/modules/workspace/__tests__/workspace.tools.test.ts +664 -34
- package/src/modules/workspace/agent-download.builder.ts +308 -0
- package/src/modules/workspace/agent-download.routes.ts +183 -0
- package/src/modules/workspace/agent-download.store.ts +533 -0
- package/src/modules/workspace/agent-upload.store.ts +23 -7
- package/src/modules/workspace/file-readers/raw-mime.ts +40 -0
- package/src/modules/workspace/file-readers/text-reader.ts +5 -8
- package/src/modules/workspace/first-run.ts +222 -0
- package/src/modules/workspace/move-links.ts +237 -0
- package/src/modules/workspace/startup/steps/__tests__/steps.test.ts +191 -489
- package/src/modules/workspace/startup/steps/seed-tree.ts +23 -38
- package/src/modules/workspace/startup/steps/template-files.step.ts +217 -249
- package/src/modules/workspace/startup/steps/template-source.ts +5 -3
- package/src/modules/workspace/workspace.routes.ts +64 -22
- package/src/modules/workspace/workspace.service.ts +202 -25
- package/src/modules/workspace/workspace.tools.ts +707 -68
- package/src/modules/write-access/__tests__/write-access.test.ts +13 -0
- package/src/modules/write-access/write-access.ts +9 -0
- package/src/shared/domain-errors.ts +123 -11
- package/src/shared/git.contract.ts +8 -1
- package/src/shared/hidden-tools.ts +45 -0
- package/src/shared/utf8-text.ts +21 -0
- package/src/tenancy/__tests__/static-tenant-source.test.ts +1 -0
- package/src/tenancy/static-tenant-source.ts +10 -2
- package/starter-packs/README.md +103 -0
- package/starter-packs/engineering/KnowledgeBase/About us.md +9 -0
- package/starter-packs/engineering/KnowledgeBase/Architecture.md +9 -0
- package/starter-packs/engineering/KnowledgeBase/Glossary.md +9 -0
- package/starter-packs/engineering/KnowledgeBase/How we ship.md +9 -0
- package/starter-packs/engineering/Plugins/engineering-starter/LICENSE +21 -0
- package/starter-packs/engineering/Plugins/engineering-starter/SOURCE.md +20 -0
- package/starter-packs/engineering/Plugins/engineering-starter/access.md +19 -0
- package/starter-packs/engineering/Plugins/engineering-starter/plugin.json +10 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/SKILL.md +171 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/sections/phase-2a-startup-diagnostic.md +157 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/office-hours/sections/phase-2b-builder-brainstorm.md +39 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/plan-ceo-review/SKILL.md +144 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/plan-eng-review/SKILL.md +144 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/review/SKILL.md +80 -0
- package/starter-packs/engineering/Plugins/engineering-starter/skills/review/checklist.md +184 -0
- package/starter-packs/engineering/pack.yaml +11 -0
- package/starter-packs/general/KnowledgeBase/About us.md +9 -0
- package/starter-packs/general/KnowledgeBase/Glossary.md +9 -0
- package/starter-packs/general/KnowledgeBase/How we work.md +9 -0
- package/starter-packs/general/Plugins/general-starter/LICENSE +202 -0
- package/starter-packs/general/Plugins/general-starter/SOURCE.md +10 -0
- package/starter-packs/general/Plugins/general-starter/access.md +19 -0
- package/starter-packs/general/Plugins/general-starter/plugin.json +10 -0
- package/starter-packs/general/Plugins/general-starter/skills/memory-management/SKILL.md +332 -0
- package/starter-packs/general/Plugins/general-starter/skills/productivity-start/SKILL.md +163 -0
- package/starter-packs/general/Plugins/general-starter/skills/productivity-update/SKILL.md +167 -0
- package/starter-packs/general/Plugins/general-starter/skills/task-management/SKILL.md +83 -0
- package/starter-packs/general/pack.yaml +10 -0
- package/starter-packs/operations/KnowledgeBase/Glossary.md +9 -0
- package/starter-packs/operations/KnowledgeBase/How we work.md +9 -0
- package/starter-packs/operations/KnowledgeBase/Processes.md +9 -0
- package/starter-packs/operations/KnowledgeBase/Tools we use.md +9 -0
- package/starter-packs/operations/KnowledgeBase/Vendors.md +9 -0
- package/starter-packs/operations/Plugins/operations-starter/LICENSE +202 -0
- package/starter-packs/operations/Plugins/operations-starter/SOURCE.md +10 -0
- package/starter-packs/operations/Plugins/operations-starter/access.md +19 -0
- package/starter-packs/operations/Plugins/operations-starter/plugin.json +10 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/capacity-plan/SKILL.md +111 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/change-request/SKILL.md +119 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/compliance-tracking/SKILL.md +44 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/process-doc/SKILL.md +80 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/process-optimization/SKILL.md +39 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/risk-assessment/SKILL.md +40 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/runbook/SKILL.md +85 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/status-report/SKILL.md +75 -0
- package/starter-packs/operations/Plugins/operations-starter/skills/vendor-review/SKILL.md +102 -0
- package/starter-packs/operations/pack.yaml +12 -0
- package/starter-packs/sales/KnowledgeBase/About us.md +9 -0
- package/starter-packs/sales/KnowledgeBase/Customers.md +9 -0
- package/starter-packs/sales/KnowledgeBase/Glossary.md +9 -0
- package/starter-packs/sales/KnowledgeBase/How we sell.md +9 -0
- package/starter-packs/sales/KnowledgeBase/Objections.md +9 -0
- package/starter-packs/sales/KnowledgeBase/Pricing.md +9 -0
- package/starter-packs/sales/Plugins/sales-starter/LICENSE +202 -0
- package/starter-packs/sales/Plugins/sales-starter/SOURCE.md +10 -0
- package/starter-packs/sales/Plugins/sales-starter/access.md +19 -0
- package/starter-packs/sales/Plugins/sales-starter/plugin.json +10 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/account-context/SKILL.md +94 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/account-plan/SKILL.md +95 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/account-research/SKILL.md +99 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/account-tiering/SKILL.md +101 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/call-prep/SKILL.md +111 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/call-summary/SKILL.md +111 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/close-plan/SKILL.md +106 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/competitive-intelligence/SKILL.md +102 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/create-an-asset/SKILL.md +105 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/crm-hygiene-check/SKILL.md +103 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/customer-health/SKILL.md +108 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/customer-voice/SKILL.md +94 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/daily-briefing/SKILL.md +61 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/deal-advance-gap/SKILL.md +102 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/deal-review/SKILL.md +105 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/deal-signals/SKILL.md +96 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/deal-slip-scenario/SKILL.md +104 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/draft-outreach/SKILL.md +116 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/end-of-day/SKILL.md +114 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/expansion-whitespace/SKILL.md +97 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/forecast/SKILL.md +100 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/handle-objection/SKILL.md +93 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/inbox-sweep/SKILL.md +114 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/lead-triage/SKILL.md +106 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/log-activity/SKILL.md +111 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/pipeline-review/SKILL.md +97 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/renewal-radar/SKILL.md +95 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/rep-context/SKILL.md +90 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/route-lead/SKILL.md +111 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/sales-setup/SKILL.md +200 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/schedule-meeting/SKILL.md +99 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/stakeholder-map/SKILL.md +107 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/team-pipeline/SKILL.md +105 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/update-opportunity/SKILL.md +112 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/weekly-wrap/SKILL.md +90 -0
- package/starter-packs/sales/Plugins/sales-starter/skills/win-loss-review/SKILL.md +88 -0
- package/starter-packs/sales/pack.yaml +13 -0
- package/starter-packs/support/KnowledgeBase/Escalations.md +9 -0
- package/starter-packs/support/KnowledgeBase/Glossary.md +9 -0
- package/starter-packs/support/KnowledgeBase/Known issues.md +9 -0
- package/starter-packs/support/KnowledgeBase/Products.md +9 -0
- package/starter-packs/support/KnowledgeBase/Tone of voice.md +9 -0
- package/starter-packs/support/Plugins/support-starter/LICENSE +202 -0
- package/starter-packs/support/Plugins/support-starter/SOURCE.md +10 -0
- package/starter-packs/support/Plugins/support-starter/access.md +19 -0
- package/starter-packs/support/Plugins/support-starter/plugin.json +10 -0
- package/starter-packs/support/Plugins/support-starter/skills/customer-escalation/SKILL.md +246 -0
- package/starter-packs/support/Plugins/support-starter/skills/customer-research/SKILL.md +250 -0
- package/starter-packs/support/Plugins/support-starter/skills/draft-response/SKILL.md +416 -0
- package/starter-packs/support/Plugins/support-starter/skills/kb-article/SKILL.md +350 -0
- package/starter-packs/support/Plugins/support-starter/skills/ticket-triage/SKILL.md +273 -0
- package/starter-packs/support/pack.yaml +12 -0
- package/kb-template/AGENTS.md +0 -730
|
@@ -0,0 +1,705 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import type {
|
|
3
|
+
ChangeRequest,
|
|
4
|
+
ChangeRequestDetail,
|
|
5
|
+
FileApproval,
|
|
6
|
+
} from '@bevel-software/platform-shared';
|
|
7
|
+
import { hashEmail } from '../../../../shared/email-identity.js';
|
|
8
|
+
import {
|
|
9
|
+
authorsDescription,
|
|
10
|
+
fileIsReadable,
|
|
11
|
+
isAuthor,
|
|
12
|
+
loginFor,
|
|
13
|
+
matchesAuthor,
|
|
14
|
+
maySeeChangeRequest,
|
|
15
|
+
pageOf,
|
|
16
|
+
pagingOf,
|
|
17
|
+
pathsOf,
|
|
18
|
+
statesFor,
|
|
19
|
+
toCrViewer,
|
|
20
|
+
toCrSummary,
|
|
21
|
+
APPLY_FAILURE_REASON_WITHHELD,
|
|
22
|
+
visibleComments,
|
|
23
|
+
toCrComment,
|
|
24
|
+
toCrFile,
|
|
25
|
+
toCrReviews,
|
|
26
|
+
visibleBlockers,
|
|
27
|
+
} from '../change-request-read-shape.js';
|
|
28
|
+
|
|
29
|
+
const AUTHOR = 'juan@bevel.software';
|
|
30
|
+
|
|
31
|
+
function summary(over: Partial<ChangeRequest> = {}): ChangeRequest {
|
|
32
|
+
return {
|
|
33
|
+
number: 12,
|
|
34
|
+
title: 'Rework the onboarding note',
|
|
35
|
+
authorId: hashEmail(AUTHOR),
|
|
36
|
+
author: { login: loginFor(AUTHOR), name: 'Juan' },
|
|
37
|
+
appAuthor: { name: 'Juan' },
|
|
38
|
+
branch: 'juan/my-draft',
|
|
39
|
+
base: 'main',
|
|
40
|
+
state: 'open',
|
|
41
|
+
createdAt: '2026-09-28T10:00:00.000Z',
|
|
42
|
+
updatedAt: '2026-09-28T10:00:00.000Z',
|
|
43
|
+
touchedNodePaths: ['Knowledge/A.md'],
|
|
44
|
+
review: { approvals: 0, changesRequested: 0, pendingLogins: [] },
|
|
45
|
+
url: 'https://hexis.example.com/change-requests/12',
|
|
46
|
+
...over,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function approval(over: Partial<FileApproval> = {}): FileApproval {
|
|
51
|
+
return {
|
|
52
|
+
path: 'Knowledge/A.md',
|
|
53
|
+
eligibleApprovers: { roles: ['Engineering'], users: [] },
|
|
54
|
+
approvedBy: [],
|
|
55
|
+
eligibilityResolved: true,
|
|
56
|
+
isApproved: false,
|
|
57
|
+
inMergeGate: true,
|
|
58
|
+
viewerCanApprove: false,
|
|
59
|
+
...over,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
describe("state is Hexis's own, and only the filter speaks GitHub's", () => {
|
|
64
|
+
// Scenario: WHEN the request is merged THEN `state` says `merged`. GitHub
|
|
65
|
+
// would say `closed` with a `merged` flag beside it; Hexis has the word, so
|
|
66
|
+
// it uses it, and no answer carries the flag (Razvan, 2026-10-02).
|
|
67
|
+
it('reports each of the three states as itself, with no flag to cross-read', () => {
|
|
68
|
+
for (const state of ['open', 'merged', 'closed'] as const) {
|
|
69
|
+
const answer = toCrSummary(summary({ state }), { readable: 1, withheld: 0 });
|
|
70
|
+
expect(answer.state).toBe(state);
|
|
71
|
+
expect(answer).not.toHaveProperty('merged');
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('the `closed` filter covers applied and declined alike; `all` covers everything', () => {
|
|
76
|
+
expect(statesFor('open')).toEqual(['open']);
|
|
77
|
+
expect(statesFor('closed').sort()).toEqual(['closed', 'merged']);
|
|
78
|
+
expect(statesFor('all').sort()).toEqual(['closed', 'merged', 'open']);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe('summary mapping', () => {
|
|
83
|
+
it("uses the field names `open_change_request` answers in, `url` first", () => {
|
|
84
|
+
const answer = toCrSummary(summary(), { readable: 1, withheld: 0 });
|
|
85
|
+
expect(answer).toEqual({
|
|
86
|
+
url: 'https://hexis.example.com/change-requests/12',
|
|
87
|
+
number: 12,
|
|
88
|
+
title: 'Rework the onboarding note',
|
|
89
|
+
state: 'open',
|
|
90
|
+
author: { login: loginFor(AUTHOR), name: 'Juan' },
|
|
91
|
+
sourceBranch: 'juan/my-draft',
|
|
92
|
+
targetBranch: 'main',
|
|
93
|
+
createdAt: '2026-09-28T10:00:00.000Z',
|
|
94
|
+
updatedAt: '2026-09-28T10:00:00.000Z',
|
|
95
|
+
changedFiles: 1,
|
|
96
|
+
withheldFiles: 0,
|
|
97
|
+
});
|
|
98
|
+
// `url` first on purpose: it is the field an agent must hand a person, so a
|
|
99
|
+
// truncation of the answer cannot take it. `toEqual` above pins the set of
|
|
100
|
+
// keys; this pins the order.
|
|
101
|
+
expect(Object.keys(answer)[0]).toBe('url');
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('carries the note through when the deployment has no public address', () => {
|
|
105
|
+
const cr = summary({ url: '/change-requests/12', urlNote: 'Configure a public address.' });
|
|
106
|
+
expect(toCrSummary(cr, { readable: 1, withheld: 0 })).toMatchObject({
|
|
107
|
+
url: '/change-requests/12',
|
|
108
|
+
urlNote: 'Configure a public address.',
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('falls back to the creation time when the row records no later moment', () => {
|
|
113
|
+
const cr = summary();
|
|
114
|
+
delete cr.updatedAt;
|
|
115
|
+
expect(toCrSummary(cr, { readable: 1, withheld: 0 }).updatedAt).toBe(cr.createdAt);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("carries the last apply failure, its reason only for a caller who may read every file of a request that has some", () => {
|
|
119
|
+
const failure = { reason: 'Conflicts in Payroll/Rates.md', conflicts: true, at: '2026-09-29T09:00:00.000Z' };
|
|
120
|
+
const cr = summary({ lastApplyFailure: failure });
|
|
121
|
+
// Every file readable — one is enough: the author's words.
|
|
122
|
+
expect(toCrSummary(cr, { readable: 1, withheld: 0 }).lastApplyFailure).toEqual(failure);
|
|
123
|
+
// One file withheld: the reason could name it, so it is the app's
|
|
124
|
+
// withheld line — the time and the kind are still the caller's to see.
|
|
125
|
+
expect(toCrSummary(cr, { readable: 1, withheld: 1 }).lastApplyFailure).toEqual({
|
|
126
|
+
reason: APPLY_FAILURE_REASON_WITHHELD,
|
|
127
|
+
conflicts: true,
|
|
128
|
+
at: failure.at,
|
|
129
|
+
});
|
|
130
|
+
// No file at all proves nothing, so it grants nothing.
|
|
131
|
+
expect(toCrSummary(cr, { readable: 0, withheld: 0 }).lastApplyFailure?.reason).toBe(APPLY_FAILURE_REASON_WITHHELD);
|
|
132
|
+
// Nothing to report: the key is absent, not null.
|
|
133
|
+
expect(toCrSummary(summary({ lastApplyFailure: null }), { readable: 1, withheld: 0 })).not.toHaveProperty('lastApplyFailure');
|
|
134
|
+
expect(toCrSummary(summary(), { readable: 1, withheld: 0 })).not.toHaveProperty('lastApplyFailure');
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
describe('the author filter', () => {
|
|
139
|
+
it('matches an email through the stored author hash', () => {
|
|
140
|
+
expect(matchesAuthor(summary(), AUTHOR)).toBe(true);
|
|
141
|
+
expect(matchesAuthor(summary(), ' JUAN@Bevel.Software ')).toBe(true);
|
|
142
|
+
expect(matchesAuthor(summary(), 'mia@bevel.software')).toBe(false);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('matches a login by name', () => {
|
|
146
|
+
expect(matchesAuthor(summary(), loginFor(AUTHOR))).toBe(true);
|
|
147
|
+
expect(matchesAuthor(summary(), 'user-000000000000')).toBe(false);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it('matches nothing on an empty needle, and nothing on a request with no author hash', () => {
|
|
151
|
+
expect(matchesAuthor(summary(), ' ')).toBe(false);
|
|
152
|
+
expect(matchesAuthor(summary({ authorId: undefined }), AUTHOR)).toBe(false);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('knows the viewer is the author only when the hashes agree', () => {
|
|
156
|
+
expect(isAuthor(summary(), AUTHOR)).toBe(true);
|
|
157
|
+
expect(isAuthor(summary(), 'mia@bevel.software')).toBe(false);
|
|
158
|
+
expect(isAuthor(summary(), undefined)).toBe(false);
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
describe('visibility', () => {
|
|
163
|
+
it('shows a request with at least one readable file', () => {
|
|
164
|
+
expect(maySeeChangeRequest({ readableFiles: 1, isAuthor: false })).toBe(true);
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// Scenario: WHEN the caller may read none of the request's files and is not
|
|
168
|
+
// its author THEN `get_change_request` answers 404.
|
|
169
|
+
it('hides a request whose every file is closed to a caller who is not its author', () => {
|
|
170
|
+
expect(maySeeChangeRequest({ readableFiles: 0, isAuthor: false })).toBe(false);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
it('shows the author their own request even when they may read none of it', () => {
|
|
174
|
+
expect(maySeeChangeRequest({ readableFiles: 0, isAuthor: true })).toBe(true);
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
describe('paging', () => {
|
|
179
|
+
it("reads GitHub's defaults and clamps what is out of range", () => {
|
|
180
|
+
expect(pagingOf({})).toEqual({ perPage: 30, page: 1 });
|
|
181
|
+
expect(pagingOf({ per_page: 100, page: 3 })).toEqual({ perPage: 100, page: 3 });
|
|
182
|
+
expect(pagingOf({ per_page: 500 })).toEqual({ perPage: 100, page: 1 });
|
|
183
|
+
expect(pagingOf({ per_page: 0, page: 0 })).toEqual({ perPage: 1, page: 1 });
|
|
184
|
+
expect(pagingOf({ per_page: 'lots', page: null })).toEqual({ perPage: 30, page: 1 });
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// Scenario: WHEN the request has 40 files THEN the first page holds 30 and
|
|
188
|
+
// says there is a second.
|
|
189
|
+
it('a first page of 40 holds 30 and says there is a second', () => {
|
|
190
|
+
const all = Array.from({ length: 40 }, (_, i) => i);
|
|
191
|
+
const first = pageOf(all, 30, 1);
|
|
192
|
+
expect(first.items).toHaveLength(30);
|
|
193
|
+
expect(first).toMatchObject({ totalCount: 40, page: 1, perPage: 30, hasNextPage: true });
|
|
194
|
+
const second = pageOf(all, 30, 2);
|
|
195
|
+
expect(second.items).toHaveLength(10);
|
|
196
|
+
expect(second.hasNextPage).toBe(false);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('a page past the end is empty rather than an error', () => {
|
|
200
|
+
expect(pageOf([1, 2], 30, 9)).toMatchObject({ items: [], totalCount: 2, hasNextPage: false });
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
describe('files', () => {
|
|
205
|
+
it("names the path `path`, the kind of change `change`, and the old name `previousPath`", () => {
|
|
206
|
+
const file = {
|
|
207
|
+
path: 'Knowledge/A.md',
|
|
208
|
+
previousPath: 'Knowledge/Old.md',
|
|
209
|
+
status: 'renamed' as const,
|
|
210
|
+
additions: 3,
|
|
211
|
+
deletions: 1,
|
|
212
|
+
isBinary: false,
|
|
213
|
+
sha: 'blob-1',
|
|
214
|
+
rawUrl: '',
|
|
215
|
+
patch: '@@ -1 +1 @@',
|
|
216
|
+
};
|
|
217
|
+
const approved = approval({
|
|
218
|
+
approvedBy: [
|
|
219
|
+
{ email: 'mia@bevel.software', name: 'Mia', approvedAt: '2026-09-29T08:00:00.000Z', isStale: false, isSelfApproval: false },
|
|
220
|
+
],
|
|
221
|
+
isApproved: true,
|
|
222
|
+
viewerCanApprove: true,
|
|
223
|
+
});
|
|
224
|
+
expect(toCrFile(file, approved, { patches: false, open: true })).toEqual({
|
|
225
|
+
path: 'Knowledge/A.md',
|
|
226
|
+
previousPath: 'Knowledge/Old.md',
|
|
227
|
+
// git's `renamed` through `open_change_request`'s own `changeKindOf`.
|
|
228
|
+
change: 'moved',
|
|
229
|
+
additions: 3,
|
|
230
|
+
deletions: 1,
|
|
231
|
+
// No `sha`: nothing in Hexis populates a blob sha, so answering one would
|
|
232
|
+
// answer `""` for every file. See `toCrFile`.
|
|
233
|
+
isBinary: false,
|
|
234
|
+
requiredApprovers: { roles: ['Engineering'], users: [] },
|
|
235
|
+
approvedBy: [
|
|
236
|
+
{
|
|
237
|
+
user: { login: loginFor('mia@bevel.software'), name: 'Mia', email: 'mia@bevel.software' },
|
|
238
|
+
approvedAt: '2026-09-29T08:00:00.000Z',
|
|
239
|
+
stale: false,
|
|
240
|
+
selfApproval: false,
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
approved: true,
|
|
244
|
+
inMergeGate: true,
|
|
245
|
+
viewerMayApprove: true,
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
it('never says the viewer may approve a file of a request that is no longer open', () => {
|
|
250
|
+
// A write grant on the file outlives the request: `viewerCanApprove` is
|
|
251
|
+
// still true on a merged or declined request's approval entry, and
|
|
252
|
+
// answering it would offer an approval nothing accepts.
|
|
253
|
+
const file = { path: 'A.md', status: 'modified' as const, additions: 1, deletions: 0, isBinary: false, sha: 's', rawUrl: '' };
|
|
254
|
+
const grant = approval({ viewerCanApprove: true });
|
|
255
|
+
expect(toCrFile(file, grant, { patches: false, open: true }).viewerMayApprove).toBe(true);
|
|
256
|
+
expect(toCrFile(file, grant, { patches: false, open: false }).viewerMayApprove).toBe(false);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('returns a patch only when one was asked for', () => {
|
|
260
|
+
const file = { path: 'A.md', status: 'modified' as const, additions: 1, deletions: 0, isBinary: false, sha: 's', rawUrl: '', patch: '@@' };
|
|
261
|
+
expect(toCrFile(file, undefined, { patches: false, open: true }).patch).toBeUndefined();
|
|
262
|
+
expect(toCrFile(file, undefined, { patches: true, open: true }).patch).toBe('@@');
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// `approversUnknown` is PRESENT or absent, never `false` — the same shape
|
|
266
|
+
// `open_change_request` answers in, so the fail-closed reading ("empty means
|
|
267
|
+
// not known") is the one a caller gets by default rather than one they have to
|
|
268
|
+
// look for.
|
|
269
|
+
it('says the approver set is unknown when nothing could answer for the file', () => {
|
|
270
|
+
const file = { path: 'A.md', status: 'modified' as const, additions: 1, deletions: 0, isBinary: false, sha: 's', rawUrl: '' };
|
|
271
|
+
expect(toCrFile(file, undefined, { patches: false, open: true })).toMatchObject({
|
|
272
|
+
requiredApprovers: { roles: [], users: [] },
|
|
273
|
+
approversUnknown: true,
|
|
274
|
+
approved: false,
|
|
275
|
+
inMergeGate: false,
|
|
276
|
+
viewerMayApprove: false,
|
|
277
|
+
});
|
|
278
|
+
expect(toCrFile(file, approval({ eligibilityResolved: false }), { patches: false, open: true })
|
|
279
|
+
.approversUnknown).toBe(true);
|
|
280
|
+
// Resolved: the key is absent, not false.
|
|
281
|
+
expect(toCrFile(file, approval(), { patches: false, open: true })).not.toHaveProperty('approversUnknown');
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
it('reads each of git\'s statuses as one of the four words', () => {
|
|
285
|
+
const kind = (status: 'added' | 'removed' | 'renamed' | 'copied' | 'modified' | 'changed' | 'unchanged') =>
|
|
286
|
+
toCrFile(
|
|
287
|
+
{ path: 'A.md', status, additions: 0, deletions: 0, isBinary: false, sha: 's', rawUrl: '' },
|
|
288
|
+
undefined,
|
|
289
|
+
{ patches: false, open: true },
|
|
290
|
+
).change;
|
|
291
|
+
expect(kind('added')).toBe('added');
|
|
292
|
+
expect(kind('removed')).toBe('deleted');
|
|
293
|
+
expect(kind('renamed')).toBe('moved');
|
|
294
|
+
expect(kind('copied')).toBe('moved');
|
|
295
|
+
expect(kind('modified')).toBe('changed');
|
|
296
|
+
expect(kind('unchanged')).toBe('changed');
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
describe('reviews, gathered out of the per-file approvals', () => {
|
|
301
|
+
// Scenario: WHEN a reviewer approved two of three files THEN
|
|
302
|
+
// `list_change_request_reviews` names the reviewer and the two files.
|
|
303
|
+
it('names a reviewer once with the files they approved and the latest time', () => {
|
|
304
|
+
const mia = (at: string, isStale = false) => ({
|
|
305
|
+
email: 'mia@bevel.software',
|
|
306
|
+
name: 'Mia',
|
|
307
|
+
approvedAt: at,
|
|
308
|
+
isStale,
|
|
309
|
+
isSelfApproval: false,
|
|
310
|
+
});
|
|
311
|
+
const { reviews, withheldReviews } = toCrReviews([
|
|
312
|
+
approval({ path: 'A.md', approvedBy: [mia('2026-09-29T08:00:00.000Z')] }),
|
|
313
|
+
approval({ path: 'B.md', approvedBy: [mia('2026-09-29T09:00:00.000Z')] }),
|
|
314
|
+
approval({ path: 'C.md', approvedBy: [] }),
|
|
315
|
+
]);
|
|
316
|
+
expect(reviews).toEqual([
|
|
317
|
+
{
|
|
318
|
+
id: `${loginFor('mia@bevel.software')}:current`,
|
|
319
|
+
reviewer: { login: loginFor('mia@bevel.software'), name: 'Mia', email: 'mia@bevel.software' },
|
|
320
|
+
stale: false,
|
|
321
|
+
submittedAt: '2026-09-29T09:00:00.000Z',
|
|
322
|
+
files: ['A.md', 'B.md'],
|
|
323
|
+
withheldFiles: 0,
|
|
324
|
+
},
|
|
325
|
+
]);
|
|
326
|
+
expect(withheldReviews).toBe(0);
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
// GitHub's word for this is `DISMISSED`; Hexis's is `isStale`, and the answer
|
|
330
|
+
// uses Hexis's.
|
|
331
|
+
it("reports an approval a later push invalidated as `stale`, separately", () => {
|
|
332
|
+
const mia = (at: string, isStale: boolean) => ({ email: 'mia@x', name: 'Mia', approvedAt: at, isStale, isSelfApproval: false });
|
|
333
|
+
const { reviews } = toCrReviews([
|
|
334
|
+
approval({ path: 'A.md', approvedBy: [mia('2026-09-29T08:00:00.000Z', false)] }),
|
|
335
|
+
approval({ path: 'B.md', approvedBy: [mia('2026-09-28T08:00:00.000Z', true)] }),
|
|
336
|
+
]);
|
|
337
|
+
expect(reviews.map((r) => [r.stale, r.files])).toEqual([
|
|
338
|
+
[true, ['B.md']],
|
|
339
|
+
[false, ['A.md']],
|
|
340
|
+
]);
|
|
341
|
+
expect(JSON.stringify(reviews)).not.toContain('DISMISSED');
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
it("keeps a review's readable files and counts the rest, naming none of them", () => {
|
|
345
|
+
const entry = (at: string) => ({ email: 'mia@x', name: 'Mia', approvedAt: at, isStale: false, isSelfApproval: false });
|
|
346
|
+
const { reviews, withheldReviews } = toCrReviews(
|
|
347
|
+
[
|
|
348
|
+
approval({ path: 'Knowledge/A.md', approvedBy: [entry('2026-09-29T08:00:00.000Z')] }),
|
|
349
|
+
approval({ path: 'Secret/Pay.md', approvedBy: [entry('2026-09-29T10:00:00.000Z')] }),
|
|
350
|
+
],
|
|
351
|
+
(path) => path === 'Knowledge/A.md',
|
|
352
|
+
);
|
|
353
|
+
expect(reviews).toHaveLength(1);
|
|
354
|
+
expect(reviews[0]).toMatchObject({ files: ['Knowledge/A.md'], withheldFiles: 1 });
|
|
355
|
+
// Neither the path nor the moment it was approved leaks out.
|
|
356
|
+
expect(JSON.stringify(reviews)).not.toContain('Secret');
|
|
357
|
+
expect(JSON.stringify(reviews)).not.toContain('10:00:00');
|
|
358
|
+
expect(withheldReviews).toBe(0);
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
it('drops a review whose every file is withheld, and counts it instead', () => {
|
|
362
|
+
const entry = { email: 'mia@x', name: 'Mia', approvedAt: '2026-09-29T08:00:00.000Z', isStale: false, isSelfApproval: false };
|
|
363
|
+
const { reviews, withheldReviews } = toCrReviews(
|
|
364
|
+
[approval({ path: 'Secret/Pay.md', approvedBy: [entry] })],
|
|
365
|
+
() => false,
|
|
366
|
+
);
|
|
367
|
+
expect(reviews).toEqual([]);
|
|
368
|
+
expect(withheldReviews).toBe(1);
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
it('answers with no reviews when nobody has approved anything', () => {
|
|
372
|
+
expect(toCrReviews([approval({ path: 'A.md' })])).toEqual({ reviews: [], withheldReviews: 0 });
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
describe('comments', () => {
|
|
377
|
+
// Scenario: WHEN a reviewer left an inline comment and a reply followed THEN
|
|
378
|
+
// `list_change_request_comments` returns both, the reply with `parentId`.
|
|
379
|
+
it('maps an inline comment and a reply, the reply carrying `parentId`', () => {
|
|
380
|
+
const inline = toCrComment({
|
|
381
|
+
id: 'c-1',
|
|
382
|
+
author: { email: 'mia@bevel.software', name: 'Mia' },
|
|
383
|
+
body: 'This line is out of date.',
|
|
384
|
+
path: 'Knowledge/A.md',
|
|
385
|
+
line: 14,
|
|
386
|
+
headSha: 'head-1',
|
|
387
|
+
createdAt: '2026-09-29T08:00:00.000Z',
|
|
388
|
+
});
|
|
389
|
+
expect(inline).toEqual({
|
|
390
|
+
id: 'c-1',
|
|
391
|
+
author: { login: loginFor('mia@bevel.software'), name: 'Mia', email: 'mia@bevel.software' },
|
|
392
|
+
body: 'This line is out of date.',
|
|
393
|
+
path: 'Knowledge/A.md',
|
|
394
|
+
line: 14,
|
|
395
|
+
headSha: 'head-1',
|
|
396
|
+
createdAt: '2026-09-29T08:00:00.000Z',
|
|
397
|
+
});
|
|
398
|
+
const reply = toCrComment({
|
|
399
|
+
id: 'c-2',
|
|
400
|
+
author: { email: AUTHOR, name: 'Juan' },
|
|
401
|
+
body: 'Fixed.',
|
|
402
|
+
path: 'Knowledge/A.md',
|
|
403
|
+
line: 14,
|
|
404
|
+
headSha: 'head-1',
|
|
405
|
+
parentId: 'c-1',
|
|
406
|
+
createdAt: '2026-09-29T09:00:00.000Z',
|
|
407
|
+
updatedAt: '2026-09-29T09:05:00.000Z',
|
|
408
|
+
});
|
|
409
|
+
expect(reply).toMatchObject({ parentId: 'c-1', updatedAt: '2026-09-29T09:05:00.000Z' });
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it('leaves `path`, `line` and `parentId` off a general comment', () => {
|
|
413
|
+
const general = toCrComment({
|
|
414
|
+
id: 'c-3',
|
|
415
|
+
author: { email: AUTHOR, name: 'Juan' },
|
|
416
|
+
body: 'Ready for review.',
|
|
417
|
+
headSha: 'head-1',
|
|
418
|
+
createdAt: '2026-09-29T07:00:00.000Z',
|
|
419
|
+
});
|
|
420
|
+
expect(general.path).toBeUndefined();
|
|
421
|
+
expect(general.line).toBeUndefined();
|
|
422
|
+
expect(general.parentId).toBeUndefined();
|
|
423
|
+
});
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
describe('the viewer block — what this caller may do', () => {
|
|
427
|
+
const detail = (over: Partial<ChangeRequestDetail> = {}) =>
|
|
428
|
+
({
|
|
429
|
+
state: 'open',
|
|
430
|
+
mergeBlockedReasons: [],
|
|
431
|
+
mergeWarnings: [],
|
|
432
|
+
viewerCanBypassMerge: false,
|
|
433
|
+
approvals: [],
|
|
434
|
+
...over,
|
|
435
|
+
}) as ChangeRequestDetail;
|
|
436
|
+
|
|
437
|
+
it('mayMerge is true when the gate waits on nothing', () => {
|
|
438
|
+
// Only the three verbs. The blockers live beside it on the answer, under
|
|
439
|
+
// `open_change_request`'s own `mergeBlockedReasons`, so this block holds
|
|
440
|
+
// exactly what is about the CALLER and nothing about the request.
|
|
441
|
+
expect(toCrViewer(detail(), false, [])).toEqual({
|
|
442
|
+
mayApprove: false,
|
|
443
|
+
mayMerge: true,
|
|
444
|
+
isAuthor: false,
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
it('mayMerge is false on a missing approval, and true for an admin who may bypass it', () => {
|
|
449
|
+
const waiting = ['Waiting on approval for A.md from Engineering.'];
|
|
450
|
+
expect(
|
|
451
|
+
toCrViewer(detail({ mergeBlockedReasons: waiting, mergeWarnings: waiting }), false, []).mayMerge,
|
|
452
|
+
).toBe(false);
|
|
453
|
+
expect(
|
|
454
|
+
toCrViewer(
|
|
455
|
+
detail({ mergeBlockedReasons: waiting, mergeWarnings: waiting, viewerCanBypassMerge: true }),
|
|
456
|
+
false,
|
|
457
|
+
[],
|
|
458
|
+
).mayMerge,
|
|
459
|
+
).toBe(true);
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
it('mayMerge is false on a hard block, bypass or not', () => {
|
|
463
|
+
const hard = ['This pull request is closed.'];
|
|
464
|
+
expect(
|
|
465
|
+
toCrViewer(detail({ state: 'closed', mergeBlockedReasons: hard, viewerCanBypassMerge: true }), false, []).mayMerge,
|
|
466
|
+
).toBe(false);
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
it('mayApprove is true when the caller may approve any one file they are shown', () => {
|
|
470
|
+
expect(
|
|
471
|
+
toCrViewer(detail(), false, [
|
|
472
|
+
approval(),
|
|
473
|
+
approval({ path: 'B.md', viewerCanApprove: true }),
|
|
474
|
+
]).mayApprove,
|
|
475
|
+
).toBe(true);
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('mayApprove is false on a merged or declined request, whatever grant the caller holds', () => {
|
|
479
|
+
const grant = [approval({ viewerCanApprove: true })];
|
|
480
|
+
for (const state of ['merged', 'closed'] as const) {
|
|
481
|
+
expect(toCrViewer(detail({ state }), false, grant).mayApprove, state).toBe(false);
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
|
|
485
|
+
it('mayApprove follows exactly the approval set it is given', () => {
|
|
486
|
+
// What this pins is the narrow thing the signature can pin: the answer is a
|
|
487
|
+
// function of the SHOWN approvals and of nothing else. The leak it exists to
|
|
488
|
+
// prevent — a write grant outliving a read refusal, so the only approvable
|
|
489
|
+
// file is one the caller is not shown — cannot be staged here at all, since
|
|
490
|
+
// `toCrViewer` no longer receives the request's whole approval set (its
|
|
491
|
+
// `Pick` excludes `approvals` for exactly that reason). That case is driven
|
|
492
|
+
// end to end by 'answers mayApprove false when the only approvable file is
|
|
493
|
+
// the withheld one' in change-request-read.tools.test.ts.
|
|
494
|
+
const shown = [approval({ path: 'Knowledge/A.md' })];
|
|
495
|
+
expect(toCrViewer(detail(), false, shown).mayApprove).toBe(false);
|
|
496
|
+
expect(
|
|
497
|
+
toCrViewer(detail(), false, [
|
|
498
|
+
...shown,
|
|
499
|
+
approval({ path: 'Knowledge/A.md', viewerCanApprove: true }),
|
|
500
|
+
]).mayApprove,
|
|
501
|
+
).toBe(true);
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
describe('merge blockers never name a file the caller may not read', () => {
|
|
506
|
+
it('withholds and counts a blocker that quotes a withheld path', () => {
|
|
507
|
+
const reasons = [
|
|
508
|
+
'Waiting on approval for Knowledge/Open.md from Engineering.',
|
|
509
|
+
'Waiting on approval for Secret/Pay.md from Finance.',
|
|
510
|
+
];
|
|
511
|
+
const scoped = visibleBlockers(reasons, ['Secret/Pay.md']);
|
|
512
|
+
expect(scoped).toEqual({ visible: [reasons[0]], withheld: 1 });
|
|
513
|
+
expect(JSON.stringify(scoped)).not.toContain('Secret/Pay.md');
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
it('keeps every blocker when nothing is withheld', () => {
|
|
517
|
+
const reasons = ['This pull request has no file changes to approve.'];
|
|
518
|
+
expect(visibleBlockers(reasons, [])).toEqual({ visible: reasons, withheld: 0 });
|
|
519
|
+
});
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* The leak Local Testing caught on the first attempt: `openChangeRequest`
|
|
524
|
+
* appends a generated `## Affected owners` block to the body, naming every
|
|
525
|
+
* changed path and its approvers, and the detail returned the body verbatim.
|
|
526
|
+
*/
|
|
527
|
+
describe('the body a caller is handed is the author\'s, not the machine\'s', () => {
|
|
528
|
+
const GENERATED = [
|
|
529
|
+
'## Affected owners',
|
|
530
|
+
'',
|
|
531
|
+
'- `KnowledgeBase/Engineering/Knowledge/Avi-Checkin.md` — Admin',
|
|
532
|
+
'- `KnowledgeBase/GTM/Notes.md` — GTM Team',
|
|
533
|
+
].join('\n');
|
|
534
|
+
|
|
535
|
+
it('drops the generated owners block, keeping what the author typed', () => {
|
|
536
|
+
expect(authorsDescription(`Please take a look.\n\n${GENERATED}`)).toBe('Please take a look.');
|
|
537
|
+
expect(authorsDescription(GENERATED)).toBe('');
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
it('names no path of the generated block, readable or not', () => {
|
|
541
|
+
const out = authorsDescription(`Why this is needed.\n\n${GENERATED}`);
|
|
542
|
+
expect(out).not.toContain('Avi-Checkin');
|
|
543
|
+
expect(out).not.toContain('KnowledgeBase');
|
|
544
|
+
expect(out).not.toContain('Affected owners');
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
it("strips the hidden identity markers older bodies carry, and only those — an author's own HTML comment is prose", () => {
|
|
548
|
+
expect(authorsDescription('<!-- bevel:author:abc123 -->\nMy reason.')).toBe('My reason.');
|
|
549
|
+
expect(authorsDescription('<!--hexis:access-request-level:write-->\nMy reason.')).toBe('My reason.');
|
|
550
|
+
expect(authorsDescription('My reason.\n<!-- TODO: ask Mia about the title -->')).toBe(
|
|
551
|
+
'My reason.\n<!-- TODO: ask Mia about the title -->',
|
|
552
|
+
);
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
it('leaves a body that is only the author\'s prose alone', () => {
|
|
556
|
+
expect(authorsDescription(' A multi-line\nreason. ')).toBe('A multi-line\nreason.');
|
|
557
|
+
expect(authorsDescription('')).toBe('');
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
// Razvan's review (2026-10-02): the first cut copied the app's dialog, which
|
|
561
|
+
// drops everything from the first `##` heading on. An author who writes their
|
|
562
|
+
// description in sections lost it from that heading onwards, and was never
|
|
563
|
+
// told. The cut is now the generated block and nothing else.
|
|
564
|
+
it("keeps the author's own headings, and everything under them", () => {
|
|
565
|
+
expect(authorsDescription('Lead.\n\n## My own heading\n\nmore')).toBe(
|
|
566
|
+
'Lead.\n\n## My own heading\n\nmore',
|
|
567
|
+
);
|
|
568
|
+
expect(authorsDescription(`Lead.\n\n## Why now\n\nBecause.\n\n${GENERATED}`)).toBe(
|
|
569
|
+
'Lead.\n\n## Why now\n\nBecause.',
|
|
570
|
+
);
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
// Hexis appends the block LAST, so the last such line is always the generated
|
|
574
|
+
// one — which is what makes an author who happens to use that heading
|
|
575
|
+
// themselves no worse off than before.
|
|
576
|
+
it('cuts the LAST such heading, so an author may use the words too', () => {
|
|
577
|
+
const out = authorsDescription(`Lead.\n\n## Affected owners\n\nI mean the GTM ones.\n\n${GENERATED}`);
|
|
578
|
+
expect(out).toBe('Lead.\n\n## Affected owners\n\nI mean the GTM ones.');
|
|
579
|
+
// Their sentence is kept; not one path of the generated block is.
|
|
580
|
+
expect(out).not.toContain('Avi-Checkin');
|
|
581
|
+
expect(out).not.toContain('KnowledgeBase');
|
|
582
|
+
});
|
|
583
|
+
|
|
584
|
+
it('cuts an author\'s own owners heading when there is no generated block', () => {
|
|
585
|
+
// Indistinguishable from the generated one with nothing after it, so it is
|
|
586
|
+
// cut — the safe direction, and the only way this can err.
|
|
587
|
+
expect(authorsDescription('Lead.\n\n## Affected owners\n\nI mean the GTM ones.')).toBe('Lead.');
|
|
588
|
+
});
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* A rename names TWO paths. The diff of a rename shows the content that was at
|
|
593
|
+
* the old one, so a file renamed out of a folder the caller may not read must
|
|
594
|
+
* not be listed under its new name either.
|
|
595
|
+
*/
|
|
596
|
+
describe('a renamed file is judged on both of its names', () => {
|
|
597
|
+
const renamed = {
|
|
598
|
+
path: 'Knowledge/Open.md',
|
|
599
|
+
previousPath: 'Payroll/Rates.md',
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
it('is readable only when both of its names are', () => {
|
|
603
|
+
expect(fileIsReadable(renamed, () => true)).toBe(true);
|
|
604
|
+
expect(fileIsReadable(renamed, (p) => p === 'Knowledge/Open.md')).toBe(false);
|
|
605
|
+
expect(fileIsReadable(renamed, (p) => p === 'Payroll/Rates.md')).toBe(false);
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
it('judges a file that was not renamed on its one name', () => {
|
|
609
|
+
expect(fileIsReadable({ path: 'A.md' }, (p) => p === 'A.md')).toBe(true);
|
|
610
|
+
expect(fileIsReadable({ path: 'A.md' }, () => false)).toBe(false);
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
it('offers both names for the access lookup, and one for a plain file', () => {
|
|
614
|
+
expect(pathsOf(renamed)).toEqual(['Knowledge/Open.md', 'Payroll/Rates.md']);
|
|
615
|
+
expect(pathsOf({ path: 'A.md' })).toEqual(['A.md']);
|
|
616
|
+
});
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* A reply is shown only when the comment it replies to is (Razvan's review,
|
|
621
|
+
* 2026-10-02, finding 3). A reply posted without a path of its own — which
|
|
622
|
+
* `post_change_request_comment` accepts, taking `parentId` without `path` — read
|
|
623
|
+
* as a general comment when judged on itself, so a reply to a comment on a
|
|
624
|
+
* withheld file came back with its body and a `parentId` naming a comment the
|
|
625
|
+
* caller cannot see.
|
|
626
|
+
*/
|
|
627
|
+
describe('a reply takes its parent\'s verdict, up the chain', () => {
|
|
628
|
+
const c = (id: string, over: { path?: string; parentId?: string } = {}) => ({ id, ...over });
|
|
629
|
+
const mayShow = (path: string) => path.startsWith('Open/');
|
|
630
|
+
|
|
631
|
+
it('withholds a pathless reply to a comment on a file the caller may not read', () => {
|
|
632
|
+
const { visible, withheld } = visibleComments(
|
|
633
|
+
[c('c-1', { path: 'Secret/Pay.md' }), c('c-2', { parentId: 'c-1' })],
|
|
634
|
+
mayShow,
|
|
635
|
+
);
|
|
636
|
+
expect(visible).toEqual([]);
|
|
637
|
+
expect(withheld).toBe(2);
|
|
638
|
+
});
|
|
639
|
+
|
|
640
|
+
it('withholds a reply to that reply, however deep the thread goes', () => {
|
|
641
|
+
const { visible, withheld } = visibleComments(
|
|
642
|
+
[
|
|
643
|
+
c('c-1', { path: 'Secret/Pay.md' }),
|
|
644
|
+
c('c-2', { parentId: 'c-1' }),
|
|
645
|
+
c('c-3', { parentId: 'c-2' }),
|
|
646
|
+
c('c-4', { parentId: 'c-3' }),
|
|
647
|
+
],
|
|
648
|
+
mayShow,
|
|
649
|
+
);
|
|
650
|
+
expect(visible).toEqual([]);
|
|
651
|
+
expect(withheld).toBe(4);
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
it('keeps a reply whose whole chain is readable', () => {
|
|
655
|
+
const { visible, withheld } = visibleComments(
|
|
656
|
+
[c('c-1', { path: 'Open/A.md' }), c('c-2', { parentId: 'c-1' }), c('c-3', { parentId: 'c-2' })],
|
|
657
|
+
mayShow,
|
|
658
|
+
);
|
|
659
|
+
expect(visible.map((v) => v.id)).toEqual(['c-1', 'c-2', 'c-3']);
|
|
660
|
+
expect(withheld).toBe(0);
|
|
661
|
+
});
|
|
662
|
+
|
|
663
|
+
// Both halves of the rule are needed, and this is the half the inheritance
|
|
664
|
+
// alone would miss: the reply names a withheld file itself.
|
|
665
|
+
it('withholds a reply that names a withheld file under a readable parent', () => {
|
|
666
|
+
const { visible } = visibleComments(
|
|
667
|
+
[c('c-1', { path: 'Open/A.md' }), c('c-2', { path: 'Secret/Pay.md', parentId: 'c-1' })],
|
|
668
|
+
mayShow,
|
|
669
|
+
);
|
|
670
|
+
expect(visible.map((v) => v.id)).toEqual(['c-1']);
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
it('keeps a general comment and a reply to one — neither is about a file', () => {
|
|
674
|
+
const { visible, withheld } = visibleComments([c('c-1'), c('c-2', { parentId: 'c-1' })], mayShow);
|
|
675
|
+
expect(visible.map((v) => v.id)).toEqual(['c-1', 'c-2']);
|
|
676
|
+
expect(withheld).toBe(0);
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
it('withholds a reply whose parent is not in the list at all', () => {
|
|
680
|
+
// Not provably pathless, so it goes: the parent may have been anchored to
|
|
681
|
+
// anything, including a file this caller was refused.
|
|
682
|
+
const { visible, withheld } = visibleComments([c('c-2', { parentId: 'gone' })], mayShow);
|
|
683
|
+
expect(visible).toEqual([]);
|
|
684
|
+
expect(withheld).toBe(1);
|
|
685
|
+
});
|
|
686
|
+
|
|
687
|
+
it('withholds a cycle rather than looping on it', () => {
|
|
688
|
+
const { visible, withheld } = visibleComments(
|
|
689
|
+
[c('c-1', { parentId: 'c-2' }), c('c-2', { parentId: 'c-1' })],
|
|
690
|
+
mayShow,
|
|
691
|
+
);
|
|
692
|
+
expect(visible).toEqual([]);
|
|
693
|
+
expect(withheld).toBe(2);
|
|
694
|
+
});
|
|
695
|
+
|
|
696
|
+
it('resolves a long thread without re-walking it per reply', () => {
|
|
697
|
+
// 500 replies in one chain: memoised, this is linear; unmemoised it is
|
|
698
|
+
// quadratic and the suite would feel it.
|
|
699
|
+
const chain = [c('c-0', { path: 'Open/A.md' })];
|
|
700
|
+
for (let i = 1; i <= 500; i++) chain.push(c(`c-${i}`, { parentId: `c-${i - 1}` }));
|
|
701
|
+
const { visible, withheld } = visibleComments(chain, mayShow);
|
|
702
|
+
expect(visible).toHaveLength(501);
|
|
703
|
+
expect(withheld).toBe(0);
|
|
704
|
+
});
|
|
705
|
+
});
|