@mastra/factory 0.28.0-alpha.1 → 0.28.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +363 -162
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +12 -6
- package/dist/auth.js.map +1 -1
- package/dist/boards/board-events.d.ts +23 -3
- package/dist/boards/board-events.d.ts.map +1 -1
- package/dist/boards/board-events.js +44 -7
- package/dist/boards/board-events.js.map +1 -1
- package/dist/boards/board-writes.d.ts +2 -2
- package/dist/boards/board-writes.d.ts.map +1 -1
- package/dist/boards/board-writes.js +23 -9
- package/dist/boards/board-writes.js.map +1 -1
- package/dist/boards/card-facts.d.ts +3 -1
- package/dist/boards/card-facts.d.ts.map +1 -1
- package/dist/boards/card-facts.js +30 -4
- package/dist/boards/card-facts.js.map +1 -1
- package/dist/boards/default-board.d.ts +7 -0
- package/dist/boards/default-board.d.ts.map +1 -0
- package/dist/boards/default-board.js +10 -0
- package/dist/boards/default-board.js.map +1 -0
- package/dist/boards/define-board.d.ts +40 -18
- package/dist/boards/define-board.d.ts.map +1 -1
- package/dist/boards/define-board.js +64 -42
- package/dist/boards/define-board.js.map +1 -1
- package/dist/boards/index.d.ts +6 -9
- package/dist/boards/index.d.ts.map +1 -1
- package/dist/boards/index.js +6 -20
- package/dist/boards/intake-routing.d.ts +29 -9
- package/dist/boards/intake-routing.d.ts.map +1 -1
- package/dist/boards/intake-routing.js +72 -20
- package/dist/boards/intake-routing.js.map +1 -1
- package/dist/boards/legacy-plan-role.d.ts.map +1 -1
- package/dist/boards/legacy-plan-role.js +7 -2
- package/dist/boards/legacy-plan-role.js.map +1 -1
- package/dist/boards/phase-automation.d.ts +7 -0
- package/dist/boards/phase-automation.d.ts.map +1 -1
- package/dist/boards/phase-automation.js +16 -5
- package/dist/boards/phase-automation.js.map +1 -1
- package/dist/boards/phase-runner.d.ts +18 -10
- package/dist/boards/phase-runner.d.ts.map +1 -1
- package/dist/boards/phase-runner.js +39 -34
- package/dist/boards/phase-runner.js.map +1 -1
- package/dist/boards/project-boards.d.ts +57 -11
- package/dist/boards/project-boards.d.ts.map +1 -1
- package/dist/boards/project-boards.js +161 -34
- package/dist/boards/project-boards.js.map +1 -1
- package/dist/boards/registry.d.ts +7 -1
- package/dist/boards/registry.d.ts.map +1 -1
- package/dist/boards/registry.js +19 -4
- package/dist/boards/registry.js.map +1 -1
- package/dist/boards/relocate.d.ts +1 -1
- package/dist/boards/relocate.d.ts.map +1 -1
- package/dist/boards/relocate.js +3 -2
- package/dist/boards/relocate.js.map +1 -1
- package/dist/boards/review.d.ts +5 -2
- package/dist/boards/review.d.ts.map +1 -1
- package/dist/boards/review.js +12 -11
- package/dist/boards/review.js.map +1 -1
- package/dist/boards/semantics.d.ts +160 -20
- package/dist/boards/semantics.d.ts.map +1 -1
- package/dist/boards/semantics.js +255 -23
- package/dist/boards/semantics.js.map +1 -1
- package/dist/boards/stored-board.d.ts +32 -18
- package/dist/boards/stored-board.d.ts.map +1 -1
- package/dist/boards/stored-board.js +31 -97
- package/dist/boards/stored-board.js.map +1 -1
- package/dist/boards/work-migrations.d.ts +43 -0
- package/dist/boards/work-migrations.d.ts.map +1 -0
- package/dist/boards/work-migrations.js +353 -0
- package/dist/boards/work-migrations.js.map +1 -0
- package/dist/boards/work-routes.d.ts +58 -0
- package/dist/boards/work-routes.d.ts.map +1 -0
- package/dist/boards/work-routes.js +270 -0
- package/dist/boards/work-routes.js.map +1 -0
- package/dist/boards/work-seeds.d.ts +9 -0
- package/dist/boards/work-seeds.d.ts.map +1 -0
- package/dist/boards/work-seeds.js +56 -0
- package/dist/boards/work-seeds.js.map +1 -0
- package/dist/boards/work.d.ts +8 -19
- package/dist/boards/work.d.ts.map +1 -1
- package/dist/boards/work.js +33 -281
- package/dist/boards/work.js.map +1 -1
- package/dist/capabilities/version-control.d.ts +6 -1
- package/dist/capabilities/version-control.d.ts.map +1 -1
- package/dist/environment/build-runner.d.ts.map +1 -1
- package/dist/environment/build-runner.js +2 -2
- package/dist/environment/build-runner.js.map +1 -1
- package/dist/environment/build-schedule.js +1 -1
- package/dist/environment/build-schedule.js.map +1 -1
- package/dist/environment/build-workflow.d.ts.map +1 -1
- package/dist/environment/build-workflow.js +6 -5
- package/dist/environment/build-workflow.js.map +1 -1
- package/dist/environment/build.d.ts +17 -4
- package/dist/environment/build.d.ts.map +1 -1
- package/dist/environment/build.js +35 -10
- package/dist/environment/build.js.map +1 -1
- package/dist/environment/heads.d.ts +1 -1
- package/dist/environment/heads.d.ts.map +1 -1
- package/dist/environment/heads.js +4 -1
- package/dist/environment/heads.js.map +1 -1
- package/dist/environment/repository-access.d.ts +13 -0
- package/dist/environment/repository-access.d.ts.map +1 -0
- package/dist/environment/repository-access.js +55 -0
- package/dist/environment/repository-access.js.map +1 -0
- package/dist/factory.d.ts +34 -7
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +161 -133
- package/dist/factory.js.map +1 -1
- package/dist/feed-events.d.ts +4 -4
- package/dist/feed-events.d.ts.map +1 -1
- package/dist/feed-events.js +6 -6
- package/dist/feed-events.js.map +1 -1
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/integrations/base.d.ts +6 -13
- package/dist/integrations/base.d.ts.map +1 -1
- package/dist/integrations/closing-references.d.ts +15 -0
- package/dist/integrations/closing-references.d.ts.map +1 -0
- package/dist/integrations/closing-references.js +69 -0
- package/dist/integrations/closing-references.js.map +1 -0
- package/dist/integrations/github/default-rules.d.ts +15 -66
- package/dist/integrations/github/default-rules.d.ts.map +1 -1
- package/dist/integrations/github/default-rules.js +129 -73
- package/dist/integrations/github/default-rules.js.map +1 -1
- package/dist/integrations/github/integration.d.ts.map +1 -1
- package/dist/integrations/github/integration.js +7 -3
- package/dist/integrations/github/integration.js.map +1 -1
- package/dist/integrations/github/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/github/issue-reconciler.js +5 -3
- package/dist/integrations/github/issue-reconciler.js.map +1 -1
- package/dist/integrations/github/provenance.js +1 -1
- package/dist/integrations/github/provenance.js.map +1 -1
- package/dist/integrations/github/pull-request-source.d.ts +8 -0
- package/dist/integrations/github/pull-request-source.d.ts.map +1 -0
- package/dist/integrations/github/pull-request-source.js +17 -0
- package/dist/integrations/github/pull-request-source.js.map +1 -0
- package/dist/integrations/github/reconcile-worker.d.ts +5 -1
- package/dist/integrations/github/reconcile-worker.d.ts.map +1 -1
- package/dist/integrations/github/reconcile-worker.js +39 -6
- package/dist/integrations/github/reconcile-worker.js.map +1 -1
- package/dist/integrations/github/review-status-reporter.d.ts.map +1 -1
- package/dist/integrations/github/review-status-reporter.js +7 -3
- package/dist/integrations/github/review-status-reporter.js.map +1 -1
- package/dist/integrations/github/routes.d.ts +4 -3
- package/dist/integrations/github/routes.d.ts.map +1 -1
- package/dist/integrations/github/routes.js +10 -87
- package/dist/integrations/github/routes.js.map +1 -1
- package/dist/integrations/github/rules.d.ts +79 -7
- package/dist/integrations/github/rules.d.ts.map +1 -1
- package/dist/integrations/github/rules.js +426 -102
- package/dist/integrations/github/rules.js.map +1 -1
- package/dist/integrations/github/sandbox.d.ts +10 -2
- package/dist/integrations/github/sandbox.d.ts.map +1 -1
- package/dist/integrations/github/sandbox.js +20 -4
- package/dist/integrations/github/sandbox.js.map +1 -1
- package/dist/integrations/github/session-subscriptions.js +2 -2
- package/dist/integrations/github/session-subscriptions.js.map +1 -1
- package/dist/integrations/github/token-refresh.d.ts +2 -1
- package/dist/integrations/github/token-refresh.d.ts.map +1 -1
- package/dist/integrations/github/token-refresh.js.map +1 -1
- package/dist/integrations/gitlab/agent-tools.js +1 -1
- package/dist/integrations/gitlab/default-rules.d.ts +73 -31
- package/dist/integrations/gitlab/default-rules.d.ts.map +1 -1
- package/dist/integrations/gitlab/default-rules.js +106 -43
- package/dist/integrations/gitlab/default-rules.js.map +1 -1
- package/dist/integrations/gitlab/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/gitlab/issue-reconciler.js +2 -1
- package/dist/integrations/gitlab/issue-reconciler.js.map +1 -1
- package/dist/integrations/gitlab/merge-request-reconciler.d.ts.map +1 -1
- package/dist/integrations/gitlab/merge-request-reconciler.js +12 -5
- package/dist/integrations/gitlab/merge-request-reconciler.js.map +1 -1
- package/dist/integrations/gitlab/routes.d.ts.map +1 -1
- package/dist/integrations/gitlab/routes.js +1 -3
- package/dist/integrations/gitlab/routes.js.map +1 -1
- package/dist/integrations/gitlab/rules.d.ts +6 -1
- package/dist/integrations/gitlab/rules.d.ts.map +1 -1
- package/dist/integrations/gitlab/rules.js +119 -30
- package/dist/integrations/gitlab/rules.js.map +1 -1
- package/dist/integrations/gitlab/session-subscriptions.js +1 -1
- package/dist/integrations/incidentio/agent-tools.js +6 -6
- package/dist/integrations/incidentio/agent-tools.js.map +1 -1
- package/dist/integrations/incidentio/default-rules.d.ts.map +1 -1
- package/dist/integrations/incidentio/default-rules.js +3 -3
- package/dist/integrations/incidentio/default-rules.js.map +1 -1
- package/dist/integrations/incidentio/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/incidentio/issue-reconciler.js +2 -1
- package/dist/integrations/incidentio/issue-reconciler.js.map +1 -1
- package/dist/integrations/incidentio/routes.d.ts +2 -2
- package/dist/integrations/incidentio/routes.d.ts.map +1 -1
- package/dist/integrations/incidentio/routes.js +10 -13
- package/dist/integrations/incidentio/routes.js.map +1 -1
- package/dist/integrations/incidentio/rules.d.ts +4 -4
- package/dist/integrations/incidentio/rules.d.ts.map +1 -1
- package/dist/integrations/incidentio/rules.js +18 -14
- package/dist/integrations/incidentio/rules.js.map +1 -1
- package/dist/integrations/issue-reconciler.js +1 -1
- package/dist/integrations/issue-reconciler.js.map +1 -1
- package/dist/integrations/jira/agent-tools.js +1 -1
- package/dist/integrations/jira/binding-scope.d.ts +5 -6
- package/dist/integrations/jira/binding-scope.d.ts.map +1 -1
- package/dist/integrations/jira/binding-scope.js +9 -11
- package/dist/integrations/jira/binding-scope.js.map +1 -1
- package/dist/integrations/jira/default-rules.d.ts.map +1 -1
- package/dist/integrations/jira/default-rules.js +3 -3
- package/dist/integrations/jira/default-rules.js.map +1 -1
- package/dist/integrations/jira/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/jira/issue-reconciler.js +2 -1
- package/dist/integrations/jira/issue-reconciler.js.map +1 -1
- package/dist/integrations/jira/routes.d.ts.map +1 -1
- package/dist/integrations/jira/routes.js +3 -5
- package/dist/integrations/jira/routes.js.map +1 -1
- package/dist/integrations/jira/rules.d.ts +4 -4
- package/dist/integrations/jira/rules.d.ts.map +1 -1
- package/dist/integrations/jira/rules.js +18 -14
- package/dist/integrations/jira/rules.js.map +1 -1
- package/dist/integrations/linear/agent-tools.d.ts +9 -1
- package/dist/integrations/linear/agent-tools.d.ts.map +1 -1
- package/dist/integrations/linear/agent-tools.js +81 -3
- package/dist/integrations/linear/agent-tools.js.map +1 -1
- package/dist/integrations/linear/default-rules.d.ts.map +1 -1
- package/dist/integrations/linear/default-rules.js +3 -3
- package/dist/integrations/linear/default-rules.js.map +1 -1
- package/dist/integrations/linear/integration.d.ts +4 -1
- package/dist/integrations/linear/integration.d.ts.map +1 -1
- package/dist/integrations/linear/integration.js +21 -1
- package/dist/integrations/linear/integration.js.map +1 -1
- package/dist/integrations/linear/issue-reconciler.d.ts.map +1 -1
- package/dist/integrations/linear/issue-reconciler.js +2 -1
- package/dist/integrations/linear/issue-reconciler.js.map +1 -1
- package/dist/integrations/linear/routes.d.ts +2 -1
- package/dist/integrations/linear/routes.d.ts.map +1 -1
- package/dist/integrations/linear/routes.js +15 -17
- package/dist/integrations/linear/routes.js.map +1 -1
- package/dist/integrations/linear/rules.d.ts +4 -4
- package/dist/integrations/linear/rules.d.ts.map +1 -1
- package/dist/integrations/linear/rules.js +16 -15
- package/dist/integrations/linear/rules.js.map +1 -1
- package/dist/integrations/platform/connect/session-tools.d.ts +5 -0
- package/dist/integrations/platform/connect/session-tools.d.ts.map +1 -1
- package/dist/integrations/platform/connect/session-tools.js +5 -0
- package/dist/integrations/platform/connect/session-tools.js.map +1 -1
- package/dist/integrations/platform/github/event-worker.d.ts +4 -1
- package/dist/integrations/platform/github/event-worker.d.ts.map +1 -1
- package/dist/integrations/platform/github/event-worker.js +39 -3
- package/dist/integrations/platform/github/event-worker.js.map +1 -1
- package/dist/integrations/platform/github/integration.d.ts +8 -0
- package/dist/integrations/platform/github/integration.d.ts.map +1 -1
- package/dist/integrations/platform/github/integration.js +143 -93
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/integrations/platform/jira/agent-tools.js +1 -1
- package/dist/integrations/platform/jira/routes.d.ts.map +1 -1
- package/dist/integrations/platform/jira/routes.js +3 -5
- package/dist/integrations/platform/jira/routes.js.map +1 -1
- package/dist/integrations/platform/linear/event-worker.d.ts +1 -1
- package/dist/integrations/platform/linear/event-worker.d.ts.map +1 -1
- package/dist/integrations/platform/linear/event-worker.js +1 -1
- package/dist/integrations/platform/linear/event-worker.js.map +1 -1
- package/dist/integrations/platform/linear/integration.d.ts +1 -1
- package/dist/integrations/platform/linear/integration.d.ts.map +1 -1
- package/dist/integrations/platform/linear/integration.js +6 -5
- package/dist/integrations/platform/linear/integration.js.map +1 -1
- package/dist/integrations/slack/chat-tools.js +1 -1
- package/dist/integrations/slack/integration.d.ts +0 -2
- package/dist/integrations/slack/integration.d.ts.map +1 -1
- package/dist/integrations/slack/integration.js +7 -9
- package/dist/integrations/slack/integration.js.map +1 -1
- package/dist/integrations/slack/reply-tool.js +1 -1
- package/dist/integrations/slack/run-error-card.js +1 -0
- package/dist/integrations/slack/run-error-card.js.map +1 -1
- package/dist/integrations/slack/share-file-tool.js +1 -1
- package/dist/integrations/slack/slack.d.ts +13 -22
- package/dist/integrations/slack/slack.d.ts.map +1 -1
- package/dist/integrations/slack/slack.js +22 -83
- package/dist/integrations/slack/slack.js.map +1 -1
- package/dist/links.d.ts +1 -2
- package/dist/links.d.ts.map +1 -1
- package/dist/links.js +4 -4
- package/dist/links.js.map +1 -1
- package/dist/mcp/routes.js +3 -3
- package/dist/mcp/routes.js.map +1 -1
- package/dist/provider-display-name.d.ts.map +1 -1
- package/dist/provider-display-name.js +1 -0
- package/dist/provider-display-name.js.map +1 -1
- package/dist/routes/attention-parked.d.ts +1 -0
- package/dist/routes/attention-parked.d.ts.map +1 -1
- package/dist/routes/attention-parked.js +2 -2
- package/dist/routes/attention-parked.js.map +1 -1
- package/dist/routes/attention-providers.d.ts +0 -25
- package/dist/routes/attention-providers.d.ts.map +1 -1
- package/dist/routes/attention-providers.js +2 -150
- package/dist/routes/attention-providers.js.map +1 -1
- package/dist/routes/attention.d.ts +0 -2
- package/dist/routes/attention.d.ts.map +1 -1
- package/dist/routes/attention.js +2 -13
- package/dist/routes/attention.js.map +1 -1
- package/dist/routes/automation-runs.d.ts +5 -1
- package/dist/routes/automation-runs.d.ts.map +1 -1
- package/dist/routes/automation-runs.js +15 -0
- package/dist/routes/automation-runs.js.map +1 -1
- package/dist/routes/board-snapshot.d.ts +21 -0
- package/dist/routes/board-snapshot.d.ts.map +1 -0
- package/dist/routes/board-snapshot.js +58 -0
- package/dist/routes/board-snapshot.js.map +1 -0
- package/dist/routes/boards.d.ts +2 -2
- package/dist/routes/boards.d.ts.map +1 -1
- package/dist/routes/boards.js +1 -17
- package/dist/routes/boards.js.map +1 -1
- package/dist/routes/config.d.ts +11 -1
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +120 -22
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/contracts.d.ts +257 -51
- package/dist/routes/contracts.d.ts.map +1 -1
- package/dist/routes/contracts.js +131 -40
- package/dist/routes/contracts.js.map +1 -1
- package/dist/routes/feed-events.d.ts +15 -0
- package/dist/routes/feed-events.d.ts.map +1 -0
- package/dist/routes/feed-events.js +68 -0
- package/dist/routes/feed-events.js.map +1 -0
- package/dist/routes/fs.d.ts +4 -0
- package/dist/routes/fs.d.ts.map +1 -1
- package/dist/routes/fs.js +8 -4
- package/dist/routes/fs.js.map +1 -1
- package/dist/routes/intake-routes.d.ts.map +1 -1
- package/dist/routes/intake-routes.js +6 -1
- package/dist/routes/intake-routes.js.map +1 -1
- package/dist/routes/intake.d.ts +0 -23
- package/dist/routes/intake.d.ts.map +1 -1
- package/dist/routes/intake.js +13 -309
- package/dist/routes/intake.js.map +1 -1
- package/dist/routes/knowledge.js +1 -1
- package/dist/routes/mastra-gateway.d.ts +19 -0
- package/dist/routes/mastra-gateway.d.ts.map +1 -0
- package/dist/routes/mastra-gateway.js +120 -0
- package/dist/routes/mastra-gateway.js.map +1 -0
- package/dist/routes/projects.d.ts +1 -1
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +74 -58
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/provider-credentials.d.ts +6 -1
- package/dist/routes/provider-credentials.d.ts.map +1 -1
- package/dist/routes/provider-credentials.js +42 -7
- package/dist/routes/provider-credentials.js.map +1 -1
- package/dist/routes/route.d.ts +6 -0
- package/dist/routes/route.d.ts.map +1 -1
- package/dist/routes/route.js.map +1 -1
- package/dist/routes/running-packages.d.ts +13 -0
- package/dist/routes/running-packages.d.ts.map +1 -0
- package/dist/routes/running-packages.js +45 -0
- package/dist/routes/running-packages.js.map +1 -0
- package/dist/routes/sandbox-envs.d.ts +26 -0
- package/dist/routes/sandbox-envs.d.ts.map +1 -0
- package/dist/routes/sandbox-envs.js +180 -0
- package/dist/routes/sandbox-envs.js.map +1 -0
- package/dist/routes/session-access.d.ts.map +1 -1
- package/dist/routes/session-access.js +12 -3
- package/dist/routes/session-access.js.map +1 -1
- package/dist/routes/surface.d.ts +10 -8
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +105 -42
- package/dist/routes/surface.js.map +1 -1
- package/dist/routes/tenant-credentials.d.ts.map +1 -1
- package/dist/routes/tenant-credentials.js +5 -1
- package/dist/routes/tenant-credentials.js.map +1 -1
- package/dist/routes/work-items.d.ts +0 -3
- package/dist/routes/work-items.d.ts.map +1 -1
- package/dist/routes/work-items.js +94 -12
- package/dist/routes/work-items.js.map +1 -1
- package/dist/rules/binding-context.d.ts.map +1 -1
- package/dist/rules/binding-context.js +1 -0
- package/dist/rules/binding-context.js.map +1 -1
- package/dist/rules/dispatcher.d.ts +0 -9
- package/dist/rules/dispatcher.d.ts.map +1 -1
- package/dist/rules/dispatcher.js +362 -69
- package/dist/rules/dispatcher.js.map +1 -1
- package/dist/rules/event-rules.d.ts +33 -2
- package/dist/rules/event-rules.d.ts.map +1 -1
- package/dist/rules/event-rules.js +46 -11
- package/dist/rules/event-rules.js.map +1 -1
- package/dist/rules/index.d.ts +2 -4
- package/dist/rules/index.d.ts.map +1 -1
- package/dist/rules/index.js +2 -3
- package/dist/rules/phase-goal.d.ts +54 -0
- package/dist/rules/phase-goal.d.ts.map +1 -0
- package/dist/rules/phase-goal.js +70 -0
- package/dist/rules/phase-goal.js.map +1 -0
- package/dist/rules/phase-tools.d.ts +11 -0
- package/dist/rules/phase-tools.d.ts.map +1 -0
- package/dist/rules/phase-tools.js +19 -0
- package/dist/rules/phase-tools.js.map +1 -0
- package/dist/rules/processor.d.ts.map +1 -1
- package/dist/rules/processor.js +116 -15
- package/dist/rules/processor.js.map +1 -1
- package/dist/rules/review-source-tool.d.ts +4 -1
- package/dist/rules/review-source-tool.d.ts.map +1 -1
- package/dist/rules/review-source-tool.js +24 -4
- package/dist/rules/review-source-tool.js.map +1 -1
- package/dist/rules/rule-group.d.ts +1 -1
- package/dist/rules/rule-group.d.ts.map +1 -1
- package/dist/rules/rule-group.js +15 -6
- package/dist/rules/rule-group.js.map +1 -1
- package/dist/rules/start-coordinator.d.ts +5 -1
- package/dist/rules/start-coordinator.d.ts.map +1 -1
- package/dist/rules/start-coordinator.js +9 -3
- package/dist/rules/start-coordinator.js.map +1 -1
- package/dist/rules/tools.d.ts.map +1 -1
- package/dist/rules/tools.js +39 -28
- package/dist/rules/tools.js.map +1 -1
- package/dist/rules/transition-service.d.ts +4 -10
- package/dist/rules/transition-service.d.ts.map +1 -1
- package/dist/rules/transition-service.js +61 -55
- package/dist/rules/transition-service.js.map +1 -1
- package/dist/rules/types.d.ts +86 -36
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/rules/types.js +5 -41
- package/dist/rules/types.js.map +1 -1
- package/dist/rules/validation.d.ts.map +1 -1
- package/dist/rules/validation.js +32 -2
- package/dist/rules/validation.js.map +1 -1
- package/dist/run-error.d.ts +1 -1
- package/dist/run-error.d.ts.map +1 -1
- package/dist/run-error.js +38 -5
- package/dist/run-error.js.map +1 -1
- package/dist/sandbox/sandbox-env-cache.d.ts +33 -0
- package/dist/sandbox/sandbox-env-cache.d.ts.map +1 -0
- package/dist/sandbox/sandbox-env-cache.js +140 -0
- package/dist/sandbox/sandbox-env-cache.js.map +1 -0
- package/dist/sandbox/sandbox-env.d.ts +77 -0
- package/dist/sandbox/sandbox-env.d.ts.map +1 -0
- package/dist/sandbox/sandbox-env.js +130 -0
- package/dist/sandbox/sandbox-env.js.map +1 -0
- package/dist/secret-encryption.d.ts +21 -0
- package/dist/secret-encryption.d.ts.map +1 -1
- package/dist/secret-encryption.js +31 -4
- package/dist/secret-encryption.js.map +1 -1
- package/dist/session/live-sessions.d.ts +11 -4
- package/dist/session/live-sessions.d.ts.map +1 -1
- package/dist/session/live-sessions.js +41 -10
- package/dist/session/live-sessions.js.map +1 -1
- package/dist/session/self-review-gate.d.ts +6 -4
- package/dist/session/self-review-gate.d.ts.map +1 -1
- package/dist/session/self-review-gate.js +9 -12
- package/dist/session/self-review-gate.js.map +1 -1
- package/dist/session/session-threads.d.ts +2 -3
- package/dist/session/session-threads.d.ts.map +1 -1
- package/dist/session/session-threads.js.map +1 -1
- package/dist/session/source-control-tools.d.ts +39 -13
- package/dist/session/source-control-tools.d.ts.map +1 -1
- package/dist/session/source-control-tools.js +55 -61
- package/dist/session/source-control-tools.js.map +1 -1
- package/dist/session/work-item-state-processor.d.ts +24 -0
- package/dist/session/work-item-state-processor.d.ts.map +1 -0
- package/dist/session/work-item-state-processor.js +275 -0
- package/dist/session/work-item-state-processor.js.map +1 -0
- package/dist/storage/domains/audit/actions.d.ts +2 -1
- package/dist/storage/domains/audit/actions.d.ts.map +1 -1
- package/dist/storage/domains/audit/actions.js +5 -4
- package/dist/storage/domains/audit/actions.js.map +1 -1
- package/dist/storage/domains/boards/base.d.ts +85 -32
- package/dist/storage/domains/boards/base.d.ts.map +1 -1
- package/dist/storage/domains/boards/base.js +120 -131
- package/dist/storage/domains/boards/base.js.map +1 -1
- package/dist/storage/domains/boards/schemas.d.ts.map +1 -1
- package/dist/storage/domains/boards/schemas.js +12 -0
- package/dist/storage/domains/boards/schemas.js.map +1 -1
- package/dist/storage/domains/channel-identity/base.d.ts +0 -4
- package/dist/storage/domains/channel-identity/base.d.ts.map +1 -1
- package/dist/storage/domains/channel-identity/base.js +0 -7
- package/dist/storage/domains/channel-identity/base.js.map +1 -1
- package/dist/storage/domains/intake/base.d.ts +5 -45
- package/dist/storage/domains/intake/base.d.ts.map +1 -1
- package/dist/storage/domains/intake/base.js +11 -89
- package/dist/storage/domains/intake/base.js.map +1 -1
- package/dist/storage/domains/projects/base.d.ts +17 -9
- package/dist/storage/domains/projects/base.d.ts.map +1 -1
- package/dist/storage/domains/projects/base.js +15 -7
- package/dist/storage/domains/projects/base.js.map +1 -1
- package/dist/storage/domains/sandbox-envs/base.d.ts +70 -0
- package/dist/storage/domains/sandbox-envs/base.d.ts.map +1 -0
- package/dist/storage/domains/sandbox-envs/base.js +227 -0
- package/dist/storage/domains/sandbox-envs/base.js.map +1 -0
- package/dist/storage/domains/work-items/base.d.ts +62 -22
- package/dist/storage/domains/work-items/base.d.ts.map +1 -1
- package/dist/storage/domains/work-items/base.js +231 -146
- package/dist/storage/domains/work-items/base.js.map +1 -1
- package/dist/storage/domains/work-items/board-version.d.ts +6 -2
- package/dist/storage/domains/work-items/board-version.d.ts.map +1 -1
- package/dist/storage/domains/work-items/board-version.js +20 -9
- package/dist/storage/domains/work-items/board-version.js.map +1 -1
- package/dist/storage/domains/work-items/cards.d.ts +28 -5
- package/dist/storage/domains/work-items/cards.d.ts.map +1 -1
- package/dist/storage/domains/work-items/cards.js +156 -23
- package/dist/storage/domains/work-items/cards.js.map +1 -1
- package/dist/storage/domains/work-items/legacy-review.d.ts +63 -0
- package/dist/storage/domains/work-items/legacy-review.d.ts.map +1 -0
- package/dist/storage/domains/work-items/legacy-review.js +109 -0
- package/dist/storage/domains/work-items/legacy-review.js.map +1 -0
- package/dist/storage/domains/work-items/metrics.d.ts +12 -4
- package/dist/storage/domains/work-items/metrics.d.ts.map +1 -1
- package/dist/storage/domains/work-items/metrics.js +14 -32
- package/dist/storage/domains/work-items/metrics.js.map +1 -1
- package/dist/storage/domains/work-items/work-item-schema.d.ts +4 -2
- package/dist/storage/domains/work-items/work-item-schema.d.ts.map +1 -1
- package/dist/storage/domains/work-items/work-item-schema.js +59 -26
- package/dist/storage/domains/work-items/work-item-schema.js.map +1 -1
- package/dist/tools/approval-tools.d.ts.map +1 -1
- package/dist/tools/approval-tools.js +28 -9
- package/dist/tools/approval-tools.js.map +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/messaging-tools.d.ts +3 -0
- package/dist/tools/messaging-tools.d.ts.map +1 -1
- package/dist/tools/messaging-tools.js +2 -1
- package/dist/tools/messaging-tools.js.map +1 -1
- package/dist/tools/read-tools.d.ts +8 -4
- package/dist/tools/read-tools.d.ts.map +1 -1
- package/dist/tools/read-tools.js +86 -37
- package/dist/tools/read-tools.js.map +1 -1
- package/dist/tools/reports.d.ts +1 -0
- package/dist/tools/reports.d.ts.map +1 -1
- package/dist/tools/reports.js +2 -1
- package/dist/tools/reports.js.map +1 -1
- package/dist/tools/run-watch.d.ts +1 -1
- package/dist/tools/run-watch.d.ts.map +1 -1
- package/dist/tools/run-watch.js +1 -0
- package/dist/tools/run-watch.js.map +1 -1
- package/dist/tools/sandbox-tools.js +1 -1
- package/dist/tools/session-tools.js +1 -1
- package/dist/tools/sessions-state-processor.d.ts +2 -0
- package/dist/tools/sessions-state-processor.d.ts.map +1 -1
- package/dist/tools/sessions-state-processor.js +4 -2
- package/dist/tools/sessions-state-processor.js.map +1 -1
- package/dist/tools/side-sessions.d.ts +2 -0
- package/dist/tools/side-sessions.d.ts.map +1 -1
- package/dist/tools/side-sessions.js +2 -1
- package/dist/tools/side-sessions.js.map +1 -1
- package/dist/tools/work-item-tools.d.ts +0 -3
- package/dist/tools/work-item-tools.d.ts.map +1 -1
- package/dist/tools/work-item-tools.js +10 -20
- package/dist/tools/work-item-tools.js.map +1 -1
- package/dist/work-item-branch.d.ts +13 -0
- package/dist/work-item-branch.d.ts.map +1 -1
- package/dist/work-item-branch.js +16 -1
- package/dist/work-item-branch.js.map +1 -1
- package/dist/work-items/create-work-item.d.ts +6 -0
- package/dist/work-items/create-work-item.d.ts.map +1 -1
- package/dist/work-items/create-work-item.js +28 -3
- package/dist/work-items/create-work-item.js.map +1 -1
- package/dist/work-items/description-context.d.ts +5 -0
- package/dist/work-items/description-context.d.ts.map +1 -0
- package/dist/work-items/description-context.js +17 -0
- package/dist/work-items/description-context.js.map +1 -0
- package/dist/work-items/providers/base.d.ts +4 -1
- package/dist/work-items/providers/base.d.ts.map +1 -1
- package/dist/work-items/providers/base.js +6 -1
- package/dist/work-items/providers/base.js.map +1 -1
- package/dist/work-items/providers/github.d.ts.map +1 -1
- package/dist/work-items/providers/github.js +2 -1
- package/dist/work-items/providers/github.js.map +1 -1
- package/dist/work-items/providers/gitlab.d.ts.map +1 -1
- package/dist/work-items/providers/gitlab.js +2 -1
- package/dist/work-items/providers/gitlab.js.map +1 -1
- package/dist/work-items/providers/jira.d.ts.map +1 -1
- package/dist/work-items/providers/jira.js +3 -2
- package/dist/work-items/providers/jira.js.map +1 -1
- package/dist/work-items/providers/linear.d.ts.map +1 -1
- package/dist/work-items/providers/linear.js +3 -2
- package/dist/work-items/providers/linear.js.map +1 -1
- package/dist/work-items/providers/types.d.ts +6 -0
- package/dist/work-items/providers/types.d.ts.map +1 -1
- package/dist/work-items/related-cards.d.ts +21 -0
- package/dist/work-items/related-cards.d.ts.map +1 -0
- package/dist/work-items/related-cards.js +45 -0
- package/dist/work-items/related-cards.js.map +1 -0
- package/dist/work-items/split-migration.d.ts.map +1 -1
- package/dist/work-items/split-migration.js +8 -8
- package/dist/work-items/split-migration.js.map +1 -1
- package/dist/workspace.d.ts +3 -1
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +122 -45
- package/dist/workspace.js.map +1 -1
- package/factory-skills/configure-factory-rules/SKILL.md +13 -11
- package/factory-skills/factory-build/SKILL.md +64 -0
- package/factory-skills/factory-gitlab-rereview/SKILL.md +4 -4
- package/factory-skills/factory-gitlab-review/SKILL.md +6 -6
- package/factory-skills/factory-plan/SKILL.md +8 -10
- package/factory-skills/factory-rereview/SKILL.md +74 -28
- package/factory-skills/factory-review/SKILL.md +85 -29
- package/factory-skills/factory-self-review/SKILL.md +32 -13
- package/factory-skills/factory-triage/SKILL.md +36 -32
- package/package.json +12 -12
- package/dist/boards/index.js.map +0 -1
- package/dist/boards/pull-request-review.d.ts +0 -14
- package/dist/boards/pull-request-review.d.ts.map +0 -1
- package/dist/boards/pull-request-review.js +0 -81
- package/dist/boards/pull-request-review.js.map +0 -1
- package/dist/boards/work-tool-rules.d.ts +0 -8
- package/dist/boards/work-tool-rules.d.ts.map +0 -1
- package/dist/boards/work-tool-rules.js +0 -19
- package/dist/boards/work-tool-rules.js.map +0 -1
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts +0 -8
- package/dist/integrations/slack/emoji-shortcodes.generated.d.ts.map +0 -1
- package/dist/integrations/slack/emoji-shortcodes.generated.js +0 -1984
- package/dist/integrations/slack/emoji-shortcodes.generated.js.map +0 -1
- package/dist/integrations/slack/emoji.d.ts +0 -3
- package/dist/integrations/slack/emoji.d.ts.map +0 -1
- package/dist/integrations/slack/emoji.js +0 -11
- package/dist/integrations/slack/emoji.js.map +0 -1
- package/dist/integrations/slack/feed-publisher.d.ts +0 -26
- package/dist/integrations/slack/feed-publisher.d.ts.map +0 -1
- package/dist/integrations/slack/feed-publisher.js +0 -43
- package/dist/integrations/slack/feed-publisher.js.map +0 -1
- package/dist/routes/attention-activity.d.ts +0 -23
- package/dist/routes/attention-activity.d.ts.map +0 -1
- package/dist/routes/attention-activity.js +0 -154
- package/dist/routes/attention-activity.js.map +0 -1
- package/dist/rules/resolve.d.ts +0 -15
- package/dist/rules/resolve.d.ts.map +0 -1
- package/dist/rules/resolve.js +0 -22
- package/dist/rules/resolve.js.map +0 -1
- package/dist/storage/domains/comments/activity.d.ts +0 -40
- package/dist/storage/domains/comments/activity.d.ts.map +0 -1
- package/dist/storage/domains/comments/activity.js +0 -93
- package/dist/storage/domains/comments/activity.js.map +0 -1
- package/dist/storage/domains/comments/actor.d.ts +0 -51
- package/dist/storage/domains/comments/actor.d.ts.map +0 -1
- package/dist/storage/domains/comments/actor.js +0 -37
- package/dist/storage/domains/comments/actor.js.map +0 -1
- package/dist/storage/domains/comments/base.d.ts +0 -245
- package/dist/storage/domains/comments/base.d.ts.map +0 -1
- package/dist/storage/domains/comments/base.js +0 -539
- package/dist/storage/domains/comments/base.js.map +0 -1
- package/dist/storage/domains/comments/domain.d.ts +0 -135
- package/dist/storage/domains/comments/domain.d.ts.map +0 -1
- package/dist/storage/domains/comments/domain.js +0 -284
- package/dist/storage/domains/comments/domain.js.map +0 -1
- package/dist/storage/domains/comments/feed-context.d.ts +0 -22
- package/dist/storage/domains/comments/feed-context.d.ts.map +0 -1
- package/dist/storage/domains/comments/feed-context.js +0 -88
- package/dist/storage/domains/comments/feed-context.js.map +0 -1
- package/dist/storage/domains/comments/feed-sync.d.ts +0 -21
- package/dist/storage/domains/comments/feed-sync.d.ts.map +0 -1
- package/dist/storage/domains/comments/feed-sync.js +0 -1
- package/dist/storage/domains/comments/parse.d.ts +0 -23
- package/dist/storage/domains/comments/parse.d.ts.map +0 -1
- package/dist/storage/domains/comments/parse.js +0 -89
- package/dist/storage/domains/comments/parse.js.map +0 -1
- package/dist/storage/domains/comments/routes.d.ts +0 -24
- package/dist/storage/domains/comments/routes.d.ts.map +0 -1
- package/dist/storage/domains/comments/routes.js +0 -299
- package/dist/storage/domains/comments/routes.js.map +0 -1
- package/dist/storage/domains/comments/schema.d.ts +0 -5
- package/dist/storage/domains/comments/schema.d.ts.map +0 -1
- package/dist/storage/domains/comments/schema.js +0 -178
- package/dist/storage/domains/comments/schema.js.map +0 -1
- package/dist/storage/domains/comments/wire.d.ts +0 -40
- package/dist/storage/domains/comments/wire.d.ts.map +0 -1
- package/dist/storage/domains/comments/wire.js +0 -36
- package/dist/storage/domains/comments/wire.js.map +0 -1
- package/factory-skills/factory-complete-issue/SKILL.md +0 -24
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { closeReason } from "../../boards/board-events.js";
|
|
2
2
|
import "../../boards/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { toBoardSource } from "../../boards/project-boards.js";
|
|
4
|
+
import { cardLabels } from "../../boards/relocate.js";
|
|
5
|
+
import { boardEventHandlers, boardForWorkItem, cardBoardFlow, cardOwnsBranch, eventBoardId, intakeTarget, isTerminalWorkItem, newestOwnedOpenPullRequestNumber, pullRequestSources, rulePhaseField, withBoardClosure, withBoardFlow, workItemPhaseSemantics } from "../../boards/semantics.js";
|
|
6
6
|
import { requestsChangesVerdict } from "../../review-verdict.js";
|
|
7
7
|
import { deploymentOwnsEvent, routeEventDecision, selectEventRule, withoutRouteEvent } from "../../rules/event-rules.js";
|
|
8
8
|
import { assertFactoryDecisionTarget, validateFactoryRuleDecisions } from "../../rules/validation.js";
|
|
9
|
-
import { resolveIntakeLabelRoute } from "../../storage/domains/intake/base.js";
|
|
10
9
|
import { FACTORY_PULL_REQUEST_RECONCILIATION_KEY, WorkItemUpdateConflictError } from "../../storage/domains/work-items/base.js";
|
|
11
10
|
import { primarySource } from "../../storage/domains/work-items/work-item-schema.js";
|
|
11
|
+
import { workItemBranch, workItemBranchSource } from "../../work-item-branch.js";
|
|
12
|
+
import { closingIssueNumbers } from "../closing-references.js";
|
|
12
13
|
import { recordPullRequestHead } from "../pull-request-head.js";
|
|
14
|
+
import { isRepositoryPullRequest } from "./pull-request-source.js";
|
|
13
15
|
import { changeRequestTargetKey } from "./subscriptions.js";
|
|
14
16
|
import { createHash } from "crypto";
|
|
15
17
|
// src/integrations/github/rules.ts
|
|
@@ -162,6 +164,36 @@ function canonicalSourceKey(kind, itemNumber) {
|
|
|
162
164
|
function legacySourceKey(repositoryId, kind, itemNumber) {
|
|
163
165
|
return `github:${repositoryId}:${kind}:${itemNumber}`;
|
|
164
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* The head branch of a pull request pushed to the repository itself. A fork's branch lives in
|
|
169
|
+
* another repository, so its name says nothing about which card wrote it — anyone could name a
|
|
170
|
+
* fork branch after a card. A payload without `head.repo` (rebuilt from polled state) is the
|
|
171
|
+
* base repository's own record and keeps its branch.
|
|
172
|
+
*/
|
|
173
|
+
function sameRepositoryHeadBranch(pullRequest, repositoryId) {
|
|
174
|
+
const head = object(pullRequest?.head);
|
|
175
|
+
if (head && "repo" in head && number(object(head.repo)?.id) !== repositoryId) return void 0;
|
|
176
|
+
return string(head?.ref);
|
|
177
|
+
}
|
|
178
|
+
/** A card attributed to a different repository than the pull request's. */
|
|
179
|
+
function cardInOtherRepository(item, repositoryId, repositoryFullName) {
|
|
180
|
+
return (/^https?:\/\/[^/]+\/.+\/(?:issues|pull)\/\d+(?:[/?#]|$)/.test(item.externalSource?.url ?? "") || typeof item.workItem.metadata?.githubRepositoryId === "number") && !cardBelongsToRepository(item, repositoryId, repositoryFullName);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* The work item a pull request's head branch belongs to: a session of the item checked it out,
|
|
184
|
+
* or it is the item's own branch name, which covers pull requests opened from a session that
|
|
185
|
+
* only follows the card (no session on the card holds the branch, and no provenance was
|
|
186
|
+
* recorded). Only a single match counts; two cards claiming one branch name neither.
|
|
187
|
+
*/
|
|
188
|
+
function branchAuthoringItem(items, headBranch, repositoryId, repositoryFullName) {
|
|
189
|
+
if (!headBranch) return void 0;
|
|
190
|
+
const matches = items.filter((item) => item.externalSource?.type !== "pull-request" && !cardInOtherRepository(item, repositoryId, repositoryFullName) && (Object.values(item.sessions).some((session) => session.branch === headBranch) || workItemBranch({
|
|
191
|
+
id: item.id,
|
|
192
|
+
source: workItemBranchSource(item.externalSource),
|
|
193
|
+
metadata: item.workItem.metadata
|
|
194
|
+
}) === headBranch));
|
|
195
|
+
return matches.length === 1 ? matches[0] : void 0;
|
|
196
|
+
}
|
|
165
197
|
/** Every source a card for this issue or pull request may be filed under. */
|
|
166
198
|
function githubItemSources(repositoryId, kind, itemNumber) {
|
|
167
199
|
return [canonicalSourceKey(kind, itemNumber), legacySourceKey(repositoryId, kind, itemNumber)].map((externalId) => ({
|
|
@@ -170,6 +202,14 @@ function githubItemSources(repositoryId, kind, itemNumber) {
|
|
|
170
202
|
externalId
|
|
171
203
|
}));
|
|
172
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* The pull request source an issue card carries for this repository's pull request, when it was
|
|
207
|
+
* attached to the card rather than filed on a card of its own.
|
|
208
|
+
*/
|
|
209
|
+
function attachedPullRequestSource(item, repositoryId, repositoryFullName, pullRequestNumber) {
|
|
210
|
+
if (item.externalSource?.type === "pull-request") return void 0;
|
|
211
|
+
return pullRequestSources(item).find((source) => isRepositoryPullRequest(source, repositoryId, repositoryFullName, pullRequestNumber));
|
|
212
|
+
}
|
|
173
213
|
function provenanceTarget(repositoryId, pullRequestNumber) {
|
|
174
214
|
return `factory-pr-provenance:${repositoryId}:${pullRequestNumber}`;
|
|
175
215
|
}
|
|
@@ -225,8 +265,8 @@ function pullRequestProvenance(data, factoryProjectId) {
|
|
|
225
265
|
workItemId: data.workItemId
|
|
226
266
|
};
|
|
227
267
|
}
|
|
228
|
-
/** Identity under which label
|
|
229
|
-
const
|
|
268
|
+
/** Identity under which label and assignee syncs are recorded. */
|
|
269
|
+
const CARD_SYNC_USER_ID = "factory-rule-dispatcher";
|
|
230
270
|
/**
|
|
231
271
|
* Whether a login is Factory itself. Prefers the resolved identity, which is
|
|
232
272
|
* observed from Factory's own writes, and falls back to the configured slug.
|
|
@@ -242,6 +282,14 @@ var GithubRules = class {
|
|
|
242
282
|
constructor(options) {
|
|
243
283
|
this.options = options;
|
|
244
284
|
}
|
|
285
|
+
/** Brings the project's boards up to date, so the sync reads below see its stored boards. */
|
|
286
|
+
async loadBoards(scope) {
|
|
287
|
+
await toBoardSource(this.options.boards).load(scope);
|
|
288
|
+
}
|
|
289
|
+
/** The project's loaded boards; {@link loadBoards} runs before an event is handled. */
|
|
290
|
+
#boards(scope) {
|
|
291
|
+
return toBoardSource(this.options.boards).forProject(scope);
|
|
292
|
+
}
|
|
245
293
|
/**
|
|
246
294
|
* Whether a login is Factory itself. Prefers the resolved identity, which is
|
|
247
295
|
* observed from Factory's own writes, and falls back to the configured slug.
|
|
@@ -258,80 +306,31 @@ var GithubRules = class {
|
|
|
258
306
|
return slug ? `${slug.toLowerCase()}[bot]` : void 0;
|
|
259
307
|
}
|
|
260
308
|
/**
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
* leaves built-in routing (Work) in charge.
|
|
264
|
-
*/
|
|
265
|
-
async #intakeTarget(project, repositoryName, labels) {
|
|
266
|
-
const intake = this.options.intake;
|
|
267
|
-
if (!intake) return void 0;
|
|
268
|
-
const { orgId, factoryProjectId } = project;
|
|
269
|
-
if (labels.length > 0) {
|
|
270
|
-
const routes = await intake.listLabelRoutes({
|
|
271
|
-
orgId,
|
|
272
|
-
factoryProjectId,
|
|
273
|
-
integrationId: "github"
|
|
274
|
-
});
|
|
275
|
-
const route = resolveIntakeLabelRoute(routes, labels);
|
|
276
|
-
const board = route ? this.options.boards.get(route.board) : void 0;
|
|
277
|
-
if (board) return {
|
|
278
|
-
board: board.id,
|
|
279
|
-
initialPhase: board.initialPhase
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
const slug = repositoryName.toLowerCase();
|
|
283
|
-
const binding = (await intake.listBindings({
|
|
284
|
-
orgId,
|
|
285
|
-
integrationId: "github"
|
|
286
|
-
})).find((candidate) => candidate.factoryProjectId === factoryProjectId && (candidate.sourceId === project.projectRepository.repositoryId || candidate.sourceId.toLowerCase() === slug));
|
|
287
|
-
const board = binding?.board ? this.options.boards.get(binding.board) : void 0;
|
|
288
|
-
return board ? {
|
|
289
|
-
board: board.id,
|
|
290
|
-
initialPhase: board.initialPhase
|
|
291
|
-
} : void 0;
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* `labeled` / `unlabeled` are not rule events: the labels only decide which board the card belongs
|
|
295
|
-
* on, so the card is re-routed here and its label metadata refreshed. Cards a run owns, and
|
|
296
|
-
* finished cards, stay where they are.
|
|
309
|
+
* `labeled` / `unlabeled` are not rule events: the card's label metadata is refreshed and the card
|
|
310
|
+
* stays where it is. Intake routes placed it when it arrived; a label change doesn't move it.
|
|
297
311
|
*/
|
|
298
|
-
async #
|
|
312
|
+
async #syncIssueLabels(parsed, repositoryId, repositoryName, project) {
|
|
299
313
|
const issue = object(parsed.payload.issue);
|
|
300
314
|
const issueNumber = issue?.pull_request === void 0 ? number(issue?.number) : void 0;
|
|
301
315
|
if (!issueNumber) return { status: "ignored" };
|
|
302
316
|
const found = await this.#relatedItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, issueNumber, void 0, void 0, null);
|
|
303
317
|
if (!found || found.externalSource?.type !== "issue") return { status: "ignored" };
|
|
304
318
|
const labels = labelNames(issue?.labels);
|
|
305
|
-
|
|
306
|
-
let
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
if (!(error instanceof WorkItemUpdateConflictError)) throw error;
|
|
319
|
-
return { status: "ignored" };
|
|
320
|
-
}
|
|
321
|
-
if (!updated) return { status: "ignored" };
|
|
322
|
-
item = updated.item;
|
|
323
|
-
changed = true;
|
|
319
|
+
if (sameLabels(cardLabels(found), labels)) return { status: "ignored" };
|
|
320
|
+
let updated;
|
|
321
|
+
try {
|
|
322
|
+
updated = await this.options.storage.syncCard({
|
|
323
|
+
orgId: found.orgId,
|
|
324
|
+
id: found.id,
|
|
325
|
+
userId: CARD_SYNC_USER_ID,
|
|
326
|
+
patch: { metadata: { labels } },
|
|
327
|
+
expectedSourceRevision: primarySource(found)?.revision
|
|
328
|
+
});
|
|
329
|
+
} catch (error) {
|
|
330
|
+
if (!(error instanceof WorkItemUpdateConflictError)) throw error;
|
|
331
|
+
return { status: "ignored" };
|
|
324
332
|
}
|
|
325
|
-
|
|
326
|
-
const target = await this.#intakeTarget(project, repositoryName, labels);
|
|
327
|
-
const outcome = await moveCardToBoard({
|
|
328
|
-
workItems: this.options.storage,
|
|
329
|
-
boardRegistry: this.options.boards,
|
|
330
|
-
userId: LABEL_ROUTE_USER_ID,
|
|
331
|
-
item,
|
|
332
|
-
targetBoard: target?.board ?? "work"
|
|
333
|
-
});
|
|
334
|
-
return { status: changed || outcome === "moved" ? "committed" : "ignored" };
|
|
333
|
+
return { status: updated ? "committed" : "ignored" };
|
|
335
334
|
}
|
|
336
335
|
/**
|
|
337
336
|
* `assigned` / `unassigned` are not rule events either: an existing issue card only mirrors the
|
|
@@ -354,7 +353,7 @@ var GithubRules = class {
|
|
|
354
353
|
return { status: await this.options.storage.syncCard({
|
|
355
354
|
orgId: item.orgId,
|
|
356
355
|
id: item.id,
|
|
357
|
-
userId:
|
|
356
|
+
userId: CARD_SYNC_USER_ID,
|
|
358
357
|
patch: { metadata: {
|
|
359
358
|
assignees,
|
|
360
359
|
...payloadTime !== void 0 ? { githubAssigneesUpdatedAt: updatedAt } : {}
|
|
@@ -371,7 +370,7 @@ var GithubRules = class {
|
|
|
371
370
|
if (parsed.event !== "issues") return void 0;
|
|
372
371
|
switch (string(parsed.payload.action)) {
|
|
373
372
|
case "labeled":
|
|
374
|
-
case "unlabeled": return (...args) => this.#
|
|
373
|
+
case "unlabeled": return (...args) => this.#syncIssueLabels(...args);
|
|
375
374
|
case "assigned":
|
|
376
375
|
case "unassigned": return (...args) => this.#syncIssueAssignees(...args);
|
|
377
376
|
default: return;
|
|
@@ -398,7 +397,10 @@ var GithubRules = class {
|
|
|
398
397
|
});
|
|
399
398
|
if (projects.length === 0) return { status: "ignored" };
|
|
400
399
|
const results = [];
|
|
401
|
-
for (const project of projects)
|
|
400
|
+
for (const project of projects) {
|
|
401
|
+
await this.loadBoards(project);
|
|
402
|
+
results.push(await handle(project));
|
|
403
|
+
}
|
|
402
404
|
if (results.some((result) => result.status === "committed")) return { status: "committed" };
|
|
403
405
|
if (results.some((result) => result.status === "replayed")) return { status: "replayed" };
|
|
404
406
|
return results[0] ?? { status: "ignored" };
|
|
@@ -450,9 +452,9 @@ var GithubRules = class {
|
|
|
450
452
|
const requestedReviewer = string(object(parsed.payload.requested_reviewer)?.login);
|
|
451
453
|
const pullRequestAuthor = string(object(pullRequest?.user)?.login);
|
|
452
454
|
const pullRequestFactoryAuthored = provenance !== null || this.#isFactoryLogin(pullRequestAuthor);
|
|
453
|
-
const resolvedItem = await this.#relatedItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, issueNumber, pullRequestNumber,
|
|
454
|
-
const
|
|
455
|
-
const intake =
|
|
455
|
+
const resolvedItem = await this.#relatedItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, issueNumber, pullRequestNumber, sameRepositoryHeadBranch(pullRequest, repositoryId), reReviewEvent ? null : provenance, senderIsResponder && !reviewEntryRequested);
|
|
456
|
+
const matchedItem = reviewEntryRequested && resolvedItem?.externalSource?.type !== "pull-request" && !(resolvedItem && pullRequestNumber && attachedPullRequestSource(resolvedItem, repositoryId, repositoryName, pullRequestNumber)) ? void 0 : resolvedItem;
|
|
457
|
+
const intake = intakeTarget(this.#boards(project));
|
|
456
458
|
const actor = await githubActor(this.options.github, {
|
|
457
459
|
installationId,
|
|
458
460
|
repository: repositoryName,
|
|
@@ -460,6 +462,22 @@ var GithubRules = class {
|
|
|
460
462
|
factoryAuthored: !senderIsResponder && provenance !== null || this.#isFactoryLogin(login)
|
|
461
463
|
});
|
|
462
464
|
if (actor.type === "github" && actor.factoryAuthored && (event === "issueCommentCreated" || event === "issueCommentEdited") && string(issueComment?.body)?.includes(FACTORY_TRIAGE_COMMENT_MARKER)) return { status: "ignored" };
|
|
465
|
+
const home = event === "pullRequestOpened" && pullRequestNumber ? await this.#pullRequestHome({
|
|
466
|
+
orgId: project.orgId,
|
|
467
|
+
factoryProjectId: project.factoryProjectId,
|
|
468
|
+
repositoryId,
|
|
469
|
+
repositoryName,
|
|
470
|
+
pullRequestNumber,
|
|
471
|
+
matchedItem,
|
|
472
|
+
factoryAuthored: pullRequestFactoryAuthored,
|
|
473
|
+
authorTrusted: actor.type === "github" && actor.trusted && login === pullRequestAuthor,
|
|
474
|
+
body: string(pullRequest?.body)
|
|
475
|
+
}) : void 0;
|
|
476
|
+
const relatedItem = (home?.reason === "authored" ? home.card : void 0) ?? matchedItem;
|
|
477
|
+
const pullRequestHome = home ? {
|
|
478
|
+
workItemId: home.card.id,
|
|
479
|
+
reason: home.reason
|
|
480
|
+
} : void 0;
|
|
463
481
|
const evaluate = async (item, ingressIdentity, pullRequestIntake = false, attempt = 1) => {
|
|
464
482
|
const context = {
|
|
465
483
|
tenant: {
|
|
@@ -489,11 +507,13 @@ var GithubRules = class {
|
|
|
489
507
|
},
|
|
490
508
|
board: boardForWorkItem(item),
|
|
491
509
|
itemRevision: item.revision,
|
|
492
|
-
...withBoardClosure(this
|
|
493
|
-
...rulePhaseField(this
|
|
510
|
+
...withBoardClosure(this.#boards(project), item),
|
|
511
|
+
...rulePhaseField(this.#boards(project), item),
|
|
512
|
+
...withBoardFlow(this.#boards(project), item)
|
|
494
513
|
} : {},
|
|
495
514
|
...intake ? { intake } : {},
|
|
496
515
|
...pullRequestIntake ? { pullRequestIntake: true } : {},
|
|
516
|
+
...pullRequestHome ? { pullRequestHome } : {},
|
|
497
517
|
event,
|
|
498
518
|
deliveryId: parsed.deliveryId,
|
|
499
519
|
factory: { createdAt: factoryProject.createdAt.toISOString() },
|
|
@@ -541,6 +561,7 @@ var GithubRules = class {
|
|
|
541
561
|
...pullRequestAuthor ? { author: pullRequestAuthor } : {},
|
|
542
562
|
factoryAuthored: pullRequestFactoryAuthored,
|
|
543
563
|
headBranch: string(object(pullRequest?.head)?.ref) ?? "",
|
|
564
|
+
...string(object(pullRequest?.head)?.sha) ? { headSha: string(object(pullRequest?.head)?.sha).toLowerCase() } : {},
|
|
544
565
|
baseBranch: string(object(pullRequest?.base)?.ref) ?? ""
|
|
545
566
|
} } : {},
|
|
546
567
|
...reviewRequested && requestedReviewer ? { reviewRequest: {
|
|
@@ -558,8 +579,8 @@ var GithubRules = class {
|
|
|
558
579
|
};
|
|
559
580
|
const boardEvent = boardEventFor(context);
|
|
560
581
|
if (boardEvent) context.boardEvent = boardEvent;
|
|
561
|
-
const ownedByDeployment = deploymentOwnsEvent(this.options.github.rules, boardEventHandlers(this
|
|
562
|
-
const rule = selectEventRule(this.options.github.rules, boardEventHandlers(this
|
|
582
|
+
const ownedByDeployment = deploymentOwnsEvent(this.options.github.rules, boardEventHandlers(this.#boards(project), eventBoardId(context), "github"), event);
|
|
583
|
+
const rule = selectEventRule(this.options.github.rules, boardEventHandlers(this.#boards(project), eventBoardId(context), "github"), event);
|
|
563
584
|
let decision = void 0;
|
|
564
585
|
let decisions = [];
|
|
565
586
|
let outcome = { status: "accepted" };
|
|
@@ -571,7 +592,7 @@ var GithubRules = class {
|
|
|
571
592
|
reason: decision.reason
|
|
572
593
|
};
|
|
573
594
|
else if (decision) decisions = validateFactoryRuleDecisions([decision]).map((entry) => {
|
|
574
|
-
assertFactoryDecisionTarget(entry, this
|
|
595
|
+
assertFactoryDecisionTarget(entry, this.#boards(project), item ? boardForWorkItem(item) : void 0);
|
|
575
596
|
return { ...entry };
|
|
576
597
|
});
|
|
577
598
|
} catch (error) {
|
|
@@ -621,6 +642,16 @@ var GithubRules = class {
|
|
|
621
642
|
const headSha = string(object(pullRequest?.head)?.sha)?.toLowerCase();
|
|
622
643
|
if (event !== "pullRequestUpdated" || !headSha || !pullRequestNumber) return;
|
|
623
644
|
const headAt = timestamp(pullRequest?.updated_at);
|
|
645
|
+
if (relatedItem && attachedPullRequestSource(relatedItem, repositoryId, repositoryName, pullRequestNumber)) {
|
|
646
|
+
await recordPullRequestHead(this.options.storage, {
|
|
647
|
+
orgId: relatedItem.orgId,
|
|
648
|
+
id: relatedItem.id,
|
|
649
|
+
headSha,
|
|
650
|
+
headAt,
|
|
651
|
+
ownedPullRequestNumber: pullRequestNumber
|
|
652
|
+
});
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
624
655
|
if (relatedItem?.externalSource?.type !== "pull-request") return;
|
|
625
656
|
const parent = await this.#linkedClosureItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, pullRequestNumber, relatedItem);
|
|
626
657
|
await recordPullRequestHead(this.options.storage, {
|
|
@@ -645,14 +676,22 @@ var GithubRules = class {
|
|
|
645
676
|
const deliveryIdentity = `${installationId}:${parsed.deliveryId}`;
|
|
646
677
|
const pullRequestOpened = event === "pullRequestOpened";
|
|
647
678
|
const primary = await evaluate(evaluated, deliveryIdentity, pullRequestOpened);
|
|
648
|
-
const linked = (event === "pullRequestMerged" || event === "pullRequestClosed") && relatedItem && pullRequestNumber ? await this.#linkedClosureItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, pullRequestNumber, relatedItem
|
|
679
|
+
const linked = (event === "pullRequestMerged" || event === "pullRequestClosed") && relatedItem && pullRequestNumber ? await this.#linkedClosureItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, pullRequestNumber, relatedItem, relatedItem.externalSource?.type === "pull-request" && !relatedItem.parentWorkItemId && (pullRequestFactoryAuthored || pullRequestAuthor !== void 0 && await trustedCollaborator(this.options.github, {
|
|
680
|
+
installationId,
|
|
681
|
+
repository: repositoryName,
|
|
682
|
+
login: pullRequestAuthor
|
|
683
|
+
})) ? sameRepositoryHeadBranch(pullRequest, repositoryId) : void 0) : void 0;
|
|
649
684
|
const stampClosed = async (companionStatus) => {
|
|
650
685
|
if (!pullRequestNumber) return;
|
|
651
686
|
if (pullRequestOpened) {
|
|
652
687
|
const trusted = actor.type === "github" && actor.trusted || pullRequestFactoryAuthored;
|
|
653
688
|
if (!authoringItem || !trusted || authoringItem.metadata?.openPullRequestNumber === pullRequestNumber) return;
|
|
654
689
|
const reviewCard = await this.#linkedClosureItem(project.orgId, project.factoryProjectId, repositoryId, repositoryName, pullRequestNumber, authoringItem);
|
|
655
|
-
|
|
690
|
+
const attached = attachedPullRequestSource(authoringItem, repositoryId, repositoryName, pullRequestNumber);
|
|
691
|
+
const recordedState = reviewCard ? reviewCard.workItem.state : attached?.state;
|
|
692
|
+
if (!(companionStatus === "replayed" ? (reviewCard !== void 0 || attached !== void 0) && !["closed", "merged"].includes(recordedState ?? "") : !["closed", "merged"].includes(recordedState ?? ""))) return;
|
|
693
|
+
const headBranch = string(object(pullRequest?.head)?.ref);
|
|
694
|
+
if (!(home?.reason === "authored" || home === void 0 && (attached === void 0 || pullRequestFactoryAuthored || cardOwnsBranch(authoringItem, headBranch)))) return;
|
|
656
695
|
await this.options.storage.update({
|
|
657
696
|
orgId: authoringItem.orgId,
|
|
658
697
|
id: authoringItem.id,
|
|
@@ -669,10 +708,25 @@ var GithubRules = class {
|
|
|
669
708
|
for (const card of [relatedItem, linked]) {
|
|
670
709
|
if (!card) continue;
|
|
671
710
|
if (card.externalSource?.type !== "pull-request") {
|
|
711
|
+
const attached = attachedPullRequestSource(card, repositoryId, repositoryName, pullRequestNumber);
|
|
712
|
+
if (attached) await this.options.storage.syncWorkItemSource({
|
|
713
|
+
orgId: card.orgId,
|
|
714
|
+
factoryProjectId: card.factoryProjectId,
|
|
715
|
+
provider: attached.provider,
|
|
716
|
+
externalId: attached.externalId,
|
|
717
|
+
patch: {
|
|
718
|
+
state: event === "pullRequestMerged" ? "merged" : "closed",
|
|
719
|
+
metadata: {
|
|
720
|
+
state: "closed",
|
|
721
|
+
merged: event === "pullRequestMerged"
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
if (!attached && pullRequestSources(card).length > 0) continue;
|
|
672
726
|
const recorded = card.metadata?.openPullRequestNumber;
|
|
673
727
|
const settled = {
|
|
674
728
|
...(typeof recorded !== "number" || recorded === pullRequestNumber) && event === "pullRequestMerged" && typeof card.metadata?.reviewVerdict === "string" ? { reviewVerdict: null } : {},
|
|
675
|
-
...recorded === pullRequestNumber ? { openPullRequestNumber:
|
|
729
|
+
...recorded === pullRequestNumber ? { openPullRequestNumber: newestOwnedOpenPullRequestNumber(card, pullRequestNumber) } : {}
|
|
676
730
|
};
|
|
677
731
|
if (Object.keys(settled).length > 0) await this.options.storage.update({
|
|
678
732
|
orgId: card.orgId,
|
|
@@ -711,18 +765,51 @@ var GithubRules = class {
|
|
|
711
765
|
* heuristics. Returns nothing when the pull request has only one card, which
|
|
712
766
|
* is every pull request Factory did not open from a work item's session.
|
|
713
767
|
*/
|
|
714
|
-
async #linkedClosureItem(orgId, projectId, repositoryId, repositoryFullName, pullRequestNumber, resolved) {
|
|
768
|
+
async #linkedClosureItem(orgId, projectId, repositoryId, repositoryFullName, pullRequestNumber, resolved, headBranch) {
|
|
715
769
|
await this.options.storage.copyLegacyCards({
|
|
716
770
|
orgId,
|
|
717
771
|
factoryProjectId: projectId,
|
|
718
772
|
sources: githubItemSources(repositoryId, "pull-request", pullRequestNumber)
|
|
719
773
|
});
|
|
720
|
-
const items = await this.options.storage.
|
|
774
|
+
const items = await this.options.storage.listShared({
|
|
721
775
|
orgId,
|
|
722
776
|
factoryProjectId: projectId
|
|
723
777
|
});
|
|
724
|
-
const linked = resolved.externalSource?.type === "pull-request" ? await this.#parentItem(orgId, projectId, items, resolved) : items.find((item) => item.parentWorkItemId === resolved.id && (item.externalSource?.externalId === canonicalSourceKey("pull-request", pullRequestNumber) || item.externalSource?.externalId === legacySourceKey(repositoryId, "pull-request", pullRequestNumber)) && cardBelongsToRepository(item, repositoryId, repositoryFullName));
|
|
725
|
-
return linked
|
|
778
|
+
const linked = resolved.externalSource?.type === "pull-request" ? resolved.parentWorkItemId ? await this.#parentItem(orgId, projectId, items, resolved) : branchAuthoringItem(items, headBranch, repositoryId, repositoryFullName) : items.find((item) => item.parentWorkItemId === resolved.id && (item.externalSource?.externalId === canonicalSourceKey("pull-request", pullRequestNumber) || item.externalSource?.externalId === legacySourceKey(repositoryId, "pull-request", pullRequestNumber)) && cardBelongsToRepository(item, repositoryId, repositoryFullName));
|
|
779
|
+
return linked && linked.id !== resolved.id ? structuredClone(linked) : void 0;
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* The existing card a pull request opened for the first time belongs with, or undefined when it
|
|
783
|
+
* gets a card of its own. The card must be open, in this repository, and not a pull request's
|
|
784
|
+
* own card. In order: the card that authored it (on a board that reviews pull requests), by provenance or session branch,
|
|
785
|
+
* when the pull request is Factory-authored or its author is trusted; it is filed there. Then,
|
|
786
|
+
* for a trusted author only, the card of the first issue its description says it closes; an
|
|
787
|
+
* intake route decides whether it joins that one. An untrusted author's pull request never
|
|
788
|
+
* lands on another card, whatever it says.
|
|
789
|
+
*/
|
|
790
|
+
async #pullRequestHome(input) {
|
|
791
|
+
if (!input.factoryAuthored && !input.authorTrusted) return void 0;
|
|
792
|
+
const items = await this.options.storage.listShared({
|
|
793
|
+
orgId: input.orgId,
|
|
794
|
+
factoryProjectId: input.factoryProjectId
|
|
795
|
+
});
|
|
796
|
+
if (items.some((item) => attachedPullRequestSource(item, input.repositoryId, input.repositoryName, input.pullRequestNumber) || item.externalSource?.type === "pull-request" && (item.externalSource.externalId === canonicalSourceKey("pull-request", input.pullRequestNumber) || item.externalSource.externalId === legacySourceKey(input.repositoryId, "pull-request", input.pullRequestNumber)) && cardBelongsToRepository(item, input.repositoryId, input.repositoryName))) return void 0;
|
|
797
|
+
const eligible = (card) => card.externalSource?.type !== "pull-request" && !isTerminalWorkItem(this.#boards(input), card) && cardBelongsToRepository(card, input.repositoryId, input.repositoryName);
|
|
798
|
+
if (input.matchedItem && eligible(input.matchedItem) && cardBoardFlow(this.#boards(input), input.matchedItem).pullRequestReview !== void 0) return {
|
|
799
|
+
card: input.matchedItem,
|
|
800
|
+
reason: "authored"
|
|
801
|
+
};
|
|
802
|
+
if (!input.authorTrusted) return void 0;
|
|
803
|
+
for (const issueNumber of closingIssueNumbers(input.body, {
|
|
804
|
+
provider: "github",
|
|
805
|
+
repository: input.repositoryName
|
|
806
|
+
})) {
|
|
807
|
+
const card = items.find((item) => (item.externalSource?.externalId === canonicalSourceKey("issue", issueNumber) || item.externalSource?.externalId === legacySourceKey(input.repositoryId, "issue", issueNumber)) && eligible(item));
|
|
808
|
+
if (card) return {
|
|
809
|
+
card: structuredClone(card),
|
|
810
|
+
reason: "closes"
|
|
811
|
+
};
|
|
812
|
+
}
|
|
726
813
|
}
|
|
727
814
|
async #relatedItem(orgId, projectId, repositoryId, repositoryFullName, issueNumber, pullRequestNumber, pullRequestHeadBranch, provenance, preferAuthoringItem = false) {
|
|
728
815
|
await this.options.storage.copyLegacyCards({
|
|
@@ -731,13 +818,13 @@ var GithubRules = class {
|
|
|
731
818
|
sources: [...issueNumber ? githubItemSources(repositoryId, "issue", issueNumber) : [], ...pullRequestNumber ? githubItemSources(repositoryId, "pull-request", pullRequestNumber) : []]
|
|
732
819
|
});
|
|
733
820
|
if (provenance) await this.options.storage.getForProject(orgId, projectId, provenance.workItemId);
|
|
734
|
-
const items = await this.options.storage.
|
|
821
|
+
const items = await this.options.storage.listShared({
|
|
735
822
|
orgId,
|
|
736
823
|
factoryProjectId: projectId
|
|
737
824
|
});
|
|
738
825
|
const resolved = this.#resolveItem(items, repositoryId, repositoryFullName, issueNumber, pullRequestNumber, pullRequestHeadBranch, provenance);
|
|
739
|
-
if (preferAuthoringItem && resolved?.externalSource?.type === "pull-request" && resolved.parentWorkItemId) return await this.#parentItem(orgId, projectId, items, resolved) ?? resolved;
|
|
740
|
-
return resolved;
|
|
826
|
+
if (preferAuthoringItem && resolved?.externalSource?.type === "pull-request" && resolved.parentWorkItemId) return structuredClone(await this.#parentItem(orgId, projectId, items, resolved) ?? resolved);
|
|
827
|
+
return resolved && structuredClone(resolved);
|
|
741
828
|
}
|
|
742
829
|
/** The card `child` was filed from; read on its own when the board list lacks it (not copied yet). */
|
|
743
830
|
async #parentItem(orgId, projectId, items, child) {
|
|
@@ -747,9 +834,64 @@ var GithubRules = class {
|
|
|
747
834
|
#resolveItem(items, repositoryId, repositoryFullName, issueNumber, pullRequestNumber, pullRequestHeadBranch, provenance) {
|
|
748
835
|
if (provenance) return items.find((item) => item.id === provenance.workItemId);
|
|
749
836
|
if (issueNumber) return items.find((item) => item.externalSource?.externalId === canonicalSourceKey("issue", issueNumber) && cardBelongsToRepository(item, repositoryId, repositoryFullName)) ?? items.find((item) => item.externalSource?.externalId === legacySourceKey(repositoryId, "issue", issueNumber));
|
|
750
|
-
if (pullRequestNumber) return items.find((item) => item.externalSource?.externalId === canonicalSourceKey("pull-request", pullRequestNumber) && cardBelongsToRepository(item, repositoryId, repositoryFullName)) ?? items.find((item) => item.externalSource?.externalId === legacySourceKey(repositoryId, "pull-request", pullRequestNumber)) ??
|
|
837
|
+
if (pullRequestNumber) return items.find((item) => item.externalSource?.externalId === canonicalSourceKey("pull-request", pullRequestNumber) && cardBelongsToRepository(item, repositoryId, repositoryFullName)) ?? items.find((item) => item.externalSource?.externalId === legacySourceKey(repositoryId, "pull-request", pullRequestNumber)) ?? items.find((item) => attachedPullRequestSource(item, repositoryId, repositoryFullName, pullRequestNumber)) ?? branchAuthoringItem(items, pullRequestHeadBranch, repositoryId, repositoryFullName);
|
|
751
838
|
}
|
|
752
839
|
};
|
|
840
|
+
/** The facts of an open, non-draft pull request as a version-control listing reports them. */
|
|
841
|
+
function listedPullRequestState(pullRequest) {
|
|
842
|
+
return {
|
|
843
|
+
number: Number(pullRequest.id),
|
|
844
|
+
title: pullRequest.title,
|
|
845
|
+
url: pullRequest.url,
|
|
846
|
+
state: "open",
|
|
847
|
+
draft: false,
|
|
848
|
+
merged: false,
|
|
849
|
+
assignees: pullRequest.assignees ?? [],
|
|
850
|
+
requestedReviewers: pullRequest.requestedReviewers ?? [],
|
|
851
|
+
labels: pullRequest.labels ?? [],
|
|
852
|
+
headBranch: pullRequest.headBranch,
|
|
853
|
+
baseBranch: pullRequest.baseBranch,
|
|
854
|
+
...pullRequest.author ? { author: pullRequest.author } : {},
|
|
855
|
+
createdAt: pullRequest.createdAt,
|
|
856
|
+
headSha: pullRequest.headSha,
|
|
857
|
+
updatedAt: pullRequest.updatedAt
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Missed-open discovery reads at most this many pages per repository per sweep,
|
|
862
|
+
* so a repository flooded with pull requests (or a listing whose cursor never
|
|
863
|
+
* ends) cannot grow a sweep's API cost without limit. A missed open is among
|
|
864
|
+
* the newest, and thirty per page keeps the 600 newest in reach.
|
|
865
|
+
*/
|
|
866
|
+
const OPEN_PULL_REQUEST_DISCOVERY_MAX_PAGES = 20;
|
|
867
|
+
/**
|
|
868
|
+
* Missed-open discovery over an integration's version-control capability.
|
|
869
|
+
* GitHub lists open pull requests newest first, so paging stops at the first
|
|
870
|
+
* page opened entirely before `createdSince`, or at the page cap.
|
|
871
|
+
*/
|
|
872
|
+
function openPullRequestLister(versionControl) {
|
|
873
|
+
return async ({ installationId, repository, createdSince }) => {
|
|
874
|
+
const states = [];
|
|
875
|
+
let cursor = "1";
|
|
876
|
+
for (let page = 0; cursor !== null && page < OPEN_PULL_REQUEST_DISCOVERY_MAX_PAGES; page += 1) {
|
|
877
|
+
const listed = await versionControl.listPullRequests({
|
|
878
|
+
connection: {
|
|
879
|
+
type: "app-installation",
|
|
880
|
+
installationId
|
|
881
|
+
},
|
|
882
|
+
sourceId: repository,
|
|
883
|
+
state: "open",
|
|
884
|
+
includeDrafts: true,
|
|
885
|
+
cursor
|
|
886
|
+
});
|
|
887
|
+
const recent = listed.pullRequests.filter((pullRequest) => !(Date.parse(pullRequest.createdAt) < createdSince));
|
|
888
|
+
states.push(...recent.filter((pullRequest) => !pullRequest.draft).map(listedPullRequestState));
|
|
889
|
+
if (recent.length === 0) break;
|
|
890
|
+
cursor = listed.nextCursor;
|
|
891
|
+
}
|
|
892
|
+
return states;
|
|
893
|
+
};
|
|
894
|
+
}
|
|
753
895
|
const RECONCILE_ERROR_SAMPLE_LIMIT = 5;
|
|
754
896
|
function sameStrings(left, right) {
|
|
755
897
|
if (right === void 0) return true;
|
|
@@ -780,6 +922,16 @@ function reconcilablePullRequestNumber(item, repository) {
|
|
|
780
922
|
const canonical = /^github-pr:(\d+)$/.exec(externalId);
|
|
781
923
|
return canonical ? Number(canonical[1]) : void 0;
|
|
782
924
|
}
|
|
925
|
+
/** The number of an attached pull request source, when it belongs to the given repository. */
|
|
926
|
+
function attachedPullRequestNumber(source, repository) {
|
|
927
|
+
if (source.integrationId !== "github") return void 0;
|
|
928
|
+
if (source.url) {
|
|
929
|
+
const match = /^https?:\/\/[^/]+\/(.+)\/pull\/(\d+)(?:[/?#]|$)/.exec(source.url);
|
|
930
|
+
return match && match[1] === repository.fullName ? Number(match[2]) : void 0;
|
|
931
|
+
}
|
|
932
|
+
const legacy = /^pull-request:github:(\d+):pull-request:(\d+)$/.exec(source.externalId);
|
|
933
|
+
return legacy && Number(legacy[1]) === repository.id ? Number(legacy[2]) : void 0;
|
|
934
|
+
}
|
|
783
935
|
/**
|
|
784
936
|
* Extracts the issue number a work item tracks, but only when the item
|
|
785
937
|
* belongs to the given repository. Stricter than
|
|
@@ -892,6 +1044,17 @@ function polledPullRequestEvent(repository, pullRequestNumber, state) {
|
|
|
892
1044
|
}
|
|
893
1045
|
};
|
|
894
1046
|
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Replays an open pull request that has no card as the `opened` delivery
|
|
1049
|
+
* GitHub never sent. The delivery id is stable per pull request so repeat
|
|
1050
|
+
* sweeps dedupe at the ingress.
|
|
1051
|
+
*/
|
|
1052
|
+
function reconciledPullRequestOpenedEvent(repository, pullRequestNumber, state) {
|
|
1053
|
+
return {
|
|
1054
|
+
...polledPullRequestEvent(repository, pullRequestNumber, state),
|
|
1055
|
+
deliveryId: `reconcile:${repository.id}:pull-request:${pullRequestNumber}:opened`
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
895
1058
|
function reconciledClosedEvent(repository, pullRequestNumber, state) {
|
|
896
1059
|
const outcome = state.merged ? "merged" : "closed";
|
|
897
1060
|
return {
|
|
@@ -923,10 +1086,14 @@ function pullRequestPayload(pullRequestNumber, state) {
|
|
|
923
1086
|
assignees: githubUsers(state.assignees),
|
|
924
1087
|
requested_reviewers: githubUsers(state.requestedReviewers),
|
|
925
1088
|
labels: githubLabels(state.labels),
|
|
926
|
-
head: {
|
|
1089
|
+
head: {
|
|
1090
|
+
ref: state.headBranch,
|
|
1091
|
+
...state.headSha ? { sha: state.headSha } : {}
|
|
1092
|
+
},
|
|
927
1093
|
base: { ref: state.baseBranch }
|
|
928
1094
|
};
|
|
929
1095
|
if (state.createdAt) payload.created_at = state.createdAt;
|
|
1096
|
+
if (state.updatedAt) payload.updated_at = state.updatedAt;
|
|
930
1097
|
if (state.author) payload.user = { login: state.author };
|
|
931
1098
|
return payload;
|
|
932
1099
|
}
|
|
@@ -972,6 +1139,7 @@ async function retireReconciledSubscriptions(storage, repository, pullRequestNum
|
|
|
972
1139
|
* can miss a merge (cursor gaps, downtime, terminally failed decisions), so
|
|
973
1140
|
* this sweep compares still-open PR cards against actual GitHub state and
|
|
974
1141
|
* replays the merge through the normal rules ingress when they disagree.
|
|
1142
|
+
* Missed opens are {@link createGithubPullRequestDiscovery}'s, on its own cadence.
|
|
975
1143
|
*/
|
|
976
1144
|
function createGithubPullRequestReconciler(options, fetchPullRequest) {
|
|
977
1145
|
const rules = new GithubRules(options);
|
|
@@ -992,11 +1160,11 @@ function createGithubPullRequestReconciler(options, fetchPullRequest) {
|
|
|
992
1160
|
error: error instanceof Error ? error.message : String(error)
|
|
993
1161
|
});
|
|
994
1162
|
};
|
|
995
|
-
const
|
|
996
|
-
const scoped = repositories.filter((repository) => configured.has(`${repository.installationId}\u0000${repository.id}`));
|
|
1163
|
+
const scoped = await linkedRepositories(options, repositories);
|
|
997
1164
|
summary.repositories = scoped.length;
|
|
998
1165
|
for (const repository of scoped) {
|
|
999
1166
|
let cardsByNumber;
|
|
1167
|
+
let attachedOpen;
|
|
1000
1168
|
let unanswered;
|
|
1001
1169
|
try {
|
|
1002
1170
|
const projects = await options.sourceControl.projectRepositories.listByExternalRepository({
|
|
@@ -1005,9 +1173,11 @@ function createGithubPullRequestReconciler(options, fetchPullRequest) {
|
|
|
1005
1173
|
});
|
|
1006
1174
|
if (projects.length === 0) continue;
|
|
1007
1175
|
cardsByNumber = /* @__PURE__ */ new Map();
|
|
1176
|
+
attachedOpen = /* @__PURE__ */ new Set();
|
|
1008
1177
|
unanswered = [];
|
|
1009
1178
|
for (const project of projects) {
|
|
1010
|
-
|
|
1179
|
+
await rules.loadBoards(project);
|
|
1180
|
+
const items = await options.storage.listShared({
|
|
1011
1181
|
orgId: project.orgId,
|
|
1012
1182
|
factoryProjectId: project.factoryProjectId
|
|
1013
1183
|
});
|
|
@@ -1017,6 +1187,10 @@ function createGithubPullRequestReconciler(options, fetchPullRequest) {
|
|
|
1017
1187
|
item,
|
|
1018
1188
|
author: unansweredAuthor
|
|
1019
1189
|
});
|
|
1190
|
+
if (item.externalSource?.type !== "pull-request" && !isTerminalWorkItem(toBoardSource(options.boards).forProject(item), item)) for (const source of pullRequestSources(item)) {
|
|
1191
|
+
const number = attachedPullRequestNumber(source, repository);
|
|
1192
|
+
if (number !== void 0 && !["closed", "merged"].includes(source.state ?? "")) attachedOpen.add(number);
|
|
1193
|
+
}
|
|
1020
1194
|
const pullRequestNumber = reconcilablePullRequestNumber(item, repository);
|
|
1021
1195
|
if (!pullRequestNumber) continue;
|
|
1022
1196
|
const metadata = {
|
|
@@ -1025,7 +1199,7 @@ function createGithubPullRequestReconciler(options, fetchPullRequest) {
|
|
|
1025
1199
|
};
|
|
1026
1200
|
const reconciliation = metadata[FACTORY_PULL_REQUEST_RECONCILIATION_KEY];
|
|
1027
1201
|
const reconciledOutcome = reconciledPullRequestOutcome(metadata);
|
|
1028
|
-
if (workItemPhaseSemantics(options.boards, item)?.kind === "terminal" && reconciledOutcome !== void 0 && reconciliation === reconciledOutcome) continue;
|
|
1202
|
+
if (workItemPhaseSemantics(toBoardSource(options.boards).forProject(item), item)?.kind === "terminal" && reconciledOutcome !== void 0 && reconciliation === reconciledOutcome) continue;
|
|
1029
1203
|
const cards = cardsByNumber.get(pullRequestNumber) ?? [];
|
|
1030
1204
|
cards.push(item);
|
|
1031
1205
|
cardsByNumber.set(pullRequestNumber, cards);
|
|
@@ -1089,7 +1263,7 @@ function createGithubPullRequestReconciler(options, fetchPullRequest) {
|
|
|
1089
1263
|
if (state.state !== "closed") continue;
|
|
1090
1264
|
const cleanupFailures = /* @__PURE__ */ new Set();
|
|
1091
1265
|
for (const card of cards) {
|
|
1092
|
-
if (workItemPhaseSemantics(options.boards, card)?.kind !== "terminal") continue;
|
|
1266
|
+
if (workItemPhaseSemantics(toBoardSource(options.boards).forProject(card), card)?.kind !== "terminal") continue;
|
|
1093
1267
|
try {
|
|
1094
1268
|
await options.storage.supersedeDecisionsForWorkItem({
|
|
1095
1269
|
orgId: card.orgId,
|
|
@@ -1123,10 +1297,161 @@ function createGithubPullRequestReconciler(options, fetchPullRequest) {
|
|
|
1123
1297
|
} catch (error) {
|
|
1124
1298
|
recordFailure(repository, error, pullRequestNumber);
|
|
1125
1299
|
}
|
|
1300
|
+
for (const pullRequestNumber of attachedOpen) {
|
|
1301
|
+
if (cardsByNumber.has(pullRequestNumber)) continue;
|
|
1302
|
+
try {
|
|
1303
|
+
const state = await fetchPullRequest({
|
|
1304
|
+
installationId: repository.installationId,
|
|
1305
|
+
repository: repository.fullName,
|
|
1306
|
+
number: pullRequestNumber
|
|
1307
|
+
});
|
|
1308
|
+
summary.checked += 1;
|
|
1309
|
+
if (state?.state !== "closed") continue;
|
|
1310
|
+
await rules.ingest(reconciledClosedEvent(repository, pullRequestNumber, state));
|
|
1311
|
+
await retireReconciledSubscriptions(options.integrationStorage, repository, pullRequestNumber, state.merged);
|
|
1312
|
+
if (state.merged) summary.merged += 1;
|
|
1313
|
+
else summary.closed += 1;
|
|
1314
|
+
} catch (error) {
|
|
1315
|
+
recordFailure(repository, error, pullRequestNumber);
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1319
|
+
return summary;
|
|
1320
|
+
};
|
|
1321
|
+
}
|
|
1322
|
+
/**
|
|
1323
|
+
* An installation can expose hundreds of repositories; only the ones actually
|
|
1324
|
+
* linked to a factory project can have cards, so sweeps scope to those up
|
|
1325
|
+
* front instead of probing each repository.
|
|
1326
|
+
*/
|
|
1327
|
+
async function linkedRepositories(options, repositories) {
|
|
1328
|
+
const configured = new Set((await options.sourceControl.projectRepositories.listConfiguredExternalKeys()).map((key) => `${key.installationExternalId}\u0000${key.repositoryExternalId}`));
|
|
1329
|
+
return repositories.filter((repository) => configured.has(`${repository.installationId}\u0000${repository.id}`));
|
|
1330
|
+
}
|
|
1331
|
+
/** A non-terminal card that holds an open pull request but no longer records it as the one it has out. */
|
|
1332
|
+
/**
|
|
1333
|
+
* Catches what the opened webhook (or its follow-up writes) missed, from the
|
|
1334
|
+
* open pull request list alone, so its GitHub cost is the listing's and does
|
|
1335
|
+
* not grow with the cards on the board:
|
|
1336
|
+
*
|
|
1337
|
+
* - an open pull request filed since the repository was linked that no card
|
|
1338
|
+
* holds is replayed as its `opened` delivery, which files it;
|
|
1339
|
+
* - an open pull request whose authoring card lost its open mark (the write
|
|
1340
|
+
* after the opening failed) is replayed the same way, which restores it.
|
|
1341
|
+
*
|
|
1342
|
+
* Both replays use one stable delivery id per pull request, so repeats in
|
|
1343
|
+
* later sweeps are absorbed by the ingress instead of filing a second card.
|
|
1344
|
+
*/
|
|
1345
|
+
function createGithubPullRequestDiscovery(options, listOpenPullRequests) {
|
|
1346
|
+
const rules = new GithubRules(options);
|
|
1347
|
+
const boards = toBoardSource(options.boards);
|
|
1348
|
+
return async (repositories) => {
|
|
1349
|
+
const summary = {
|
|
1350
|
+
repositories: 0,
|
|
1351
|
+
listed: 0,
|
|
1352
|
+
created: 0,
|
|
1353
|
+
repaired: 0,
|
|
1354
|
+
failed: 0,
|
|
1355
|
+
errors: []
|
|
1356
|
+
};
|
|
1357
|
+
const recordFailure = (repository, error, pullRequestNumber) => {
|
|
1358
|
+
summary.failed += 1;
|
|
1359
|
+
if (summary.errors.length < 5) summary.errors.push({
|
|
1360
|
+
repository: repository.fullName,
|
|
1361
|
+
...pullRequestNumber === void 0 ? {} : { pullRequestNumber },
|
|
1362
|
+
error: error instanceof Error ? error.message : String(error)
|
|
1363
|
+
});
|
|
1364
|
+
};
|
|
1365
|
+
const scoped = await linkedRepositories(options, repositories);
|
|
1366
|
+
summary.repositories = scoped.length;
|
|
1367
|
+
for (const repository of scoped) {
|
|
1368
|
+
const carded = /* @__PURE__ */ new Set();
|
|
1369
|
+
const unmarked = /* @__PURE__ */ new Map();
|
|
1370
|
+
let linkedAt;
|
|
1371
|
+
try {
|
|
1372
|
+
const projects = await options.sourceControl.projectRepositories.listByExternalRepository({
|
|
1373
|
+
installationExternalId: String(repository.installationId),
|
|
1374
|
+
repositoryExternalId: String(repository.id)
|
|
1375
|
+
});
|
|
1376
|
+
if (projects.length === 0) continue;
|
|
1377
|
+
linkedAt = Math.min(...projects.map((project) => project.projectRepository.createdAt.getTime()));
|
|
1378
|
+
const items = [];
|
|
1379
|
+
for (const project of projects) {
|
|
1380
|
+
await rules.loadBoards(project);
|
|
1381
|
+
items.push(...await options.storage.listShared({
|
|
1382
|
+
orgId: project.orgId,
|
|
1383
|
+
factoryProjectId: project.factoryProjectId
|
|
1384
|
+
}));
|
|
1385
|
+
}
|
|
1386
|
+
const authoring = (item) => item !== void 0 && item.externalSource?.type !== "pull-request" && typeof item.metadata?.openPullRequestNumber !== "number" && !isTerminalWorkItem(boards.forProject(item), item);
|
|
1387
|
+
const byId = new Map(items.map((item) => [item.id, item]));
|
|
1388
|
+
for (const item of items) {
|
|
1389
|
+
for (const source of pullRequestSources(item)) {
|
|
1390
|
+
const number = attachedPullRequestNumber(source, repository);
|
|
1391
|
+
if (number === void 0) continue;
|
|
1392
|
+
carded.add(number);
|
|
1393
|
+
if (authoring(item) && !["closed", "merged"].includes(source.state ?? "")) unmarked.set(number, [...unmarked.get(number) ?? [], item]);
|
|
1394
|
+
}
|
|
1395
|
+
const number = reconcilablePullRequestNumber(item, repository);
|
|
1396
|
+
if (number === void 0) continue;
|
|
1397
|
+
carded.add(number);
|
|
1398
|
+
const parent = item.parentWorkItemId ? byId.get(item.parentWorkItemId) : void 0;
|
|
1399
|
+
if (parent && authoring(parent) && !["closed", "merged"].includes(item.workItem.state ?? "")) unmarked.set(number, [...unmarked.get(number) ?? [], parent]);
|
|
1400
|
+
}
|
|
1401
|
+
} catch (error) {
|
|
1402
|
+
recordFailure(repository, error);
|
|
1403
|
+
continue;
|
|
1404
|
+
}
|
|
1405
|
+
let open;
|
|
1406
|
+
try {
|
|
1407
|
+
open = await listOpenPullRequests({
|
|
1408
|
+
installationId: repository.installationId,
|
|
1409
|
+
repository: repository.fullName,
|
|
1410
|
+
createdSince: linkedAt
|
|
1411
|
+
});
|
|
1412
|
+
} catch (error) {
|
|
1413
|
+
recordFailure(repository, error);
|
|
1414
|
+
continue;
|
|
1415
|
+
}
|
|
1416
|
+
summary.listed += open.length;
|
|
1417
|
+
const restored = /* @__PURE__ */ new Set();
|
|
1418
|
+
for (const pullRequest of open) try {
|
|
1419
|
+
if (!carded.has(pullRequest.number)) {
|
|
1420
|
+
if ((await rules.ingest(reconciledPullRequestOpenedEvent(repository, pullRequest.number, pullRequest))).status === "committed") summary.created += 1;
|
|
1421
|
+
continue;
|
|
1422
|
+
}
|
|
1423
|
+
const candidate = await ownedUnmarkedCard(options, repository, pullRequest, (unmarked.get(pullRequest.number) ?? []).filter((card) => !restored.has(card.id)));
|
|
1424
|
+
if (!candidate) continue;
|
|
1425
|
+
restored.add(candidate.id);
|
|
1426
|
+
await rules.ingest(reconciledPullRequestOpenedEvent(repository, pullRequest.number, pullRequest));
|
|
1427
|
+
if ((await options.storage.get({
|
|
1428
|
+
orgId: candidate.orgId,
|
|
1429
|
+
id: candidate.id
|
|
1430
|
+
}))?.metadata?.openPullRequestNumber === pullRequest.number) summary.repaired += 1;
|
|
1431
|
+
} catch (error) {
|
|
1432
|
+
recordFailure(repository, error, pullRequest.number);
|
|
1433
|
+
}
|
|
1126
1434
|
}
|
|
1127
1435
|
return summary;
|
|
1128
1436
|
};
|
|
1129
1437
|
}
|
|
1438
|
+
/**
|
|
1439
|
+
* The unmarked card an open pull request's replayed opening would mark: the
|
|
1440
|
+
* one Factory's provenance names, which is the only link a replay resolves
|
|
1441
|
+
* back to the authoring card once the pull request has its own Review card.
|
|
1442
|
+
* Decided from storage, so a card holding someone else's pull request (or one
|
|
1443
|
+
* a replay cannot restore) costs no replay, and no permission lookup, per sweep.
|
|
1444
|
+
*/
|
|
1445
|
+
async function ownedUnmarkedCard(options, repository, pullRequest, candidates) {
|
|
1446
|
+
if (candidates.length === 0) return void 0;
|
|
1447
|
+
const provenance = await options.integrationStorage.subscriptions.listByTarget(provenanceTarget(repository.id, pullRequest.number), { status: "active" });
|
|
1448
|
+
return candidates.find((card) => provenance.some((subscription) => subscription.orgId === card.orgId && pullRequestProvenance(subscription.data, card.factoryProjectId)?.workItemId === card.id));
|
|
1449
|
+
}
|
|
1450
|
+
function attachGithubPullRequestDiscovery(github, context, listOpenPullRequests) {
|
|
1451
|
+
const options = githubRulesOptions(github, context);
|
|
1452
|
+
if (!options) return void 0;
|
|
1453
|
+
return createGithubPullRequestDiscovery(options, listOpenPullRequests);
|
|
1454
|
+
}
|
|
1130
1455
|
function githubRulesOptions(github, context) {
|
|
1131
1456
|
if (!context.runtime) return void 0;
|
|
1132
1457
|
return {
|
|
@@ -1137,7 +1462,6 @@ function githubRulesOptions(github, context) {
|
|
|
1137
1462
|
storage: context.runtime.workItems,
|
|
1138
1463
|
configVersion: context.runtime.configVersion,
|
|
1139
1464
|
boards: context.runtime.boards,
|
|
1140
|
-
intake: context.storage.intake,
|
|
1141
1465
|
...context.hooks?.onRepositoryPush ? { onRepositoryPush: context.hooks.onRepositoryPush } : {}
|
|
1142
1466
|
};
|
|
1143
1467
|
}
|
|
@@ -1152,6 +1476,6 @@ function attachGithubReconciler(github, context, fetchPullRequest) {
|
|
|
1152
1476
|
if (!options) return void 0;
|
|
1153
1477
|
return createGithubPullRequestReconciler(options, fetchPullRequest);
|
|
1154
1478
|
}
|
|
1155
|
-
export { GithubRules, RECONCILE_ERROR_SAMPLE_LIMIT, activitySignalFor, attachGithubReconciler, attachGithubRules, boardEventFor, cardBelongsToRepository, createGithubPullRequestReconciler, githubItemSources, githubRulesOptions, isFactoryGithubLogin, polledPullRequestEvent, reconcilableIssueNumber, reconciledClosedEvent, reconciledIssueClosedEvent, reconciledIssueOpenedEvent, reconciledIssueRelabeledEvent, sameStrings, sweepTrustLookup, trustedCollaborator };
|
|
1479
|
+
export { GithubRules, RECONCILE_ERROR_SAMPLE_LIMIT, activitySignalFor, attachGithubPullRequestDiscovery, attachGithubReconciler, attachGithubRules, attachedPullRequestSource, boardEventFor, cardBelongsToRepository, createGithubPullRequestDiscovery, createGithubPullRequestReconciler, githubItemSources, githubRulesOptions, isFactoryGithubLogin, listedPullRequestState, openPullRequestLister, polledPullRequestEvent, reconcilableIssueNumber, reconciledClosedEvent, reconciledIssueClosedEvent, reconciledIssueOpenedEvent, reconciledIssueRelabeledEvent, reconciledPullRequestOpenedEvent, sameStrings, sweepTrustLookup, trustedCollaborator };
|
|
1156
1480
|
|
|
1157
1481
|
//# sourceMappingURL=rules.js.map
|