@sentry/junior-github 0.301.0 → 0.303.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.
Files changed (97) hide show
  1. package/dist/events-CrbJHQ0w.js +2466 -0
  2. package/dist/index.d.ts +71 -3
  3. package/dist/index.js +7294 -7881
  4. package/dist/testing.d.ts +51 -1
  5. package/dist/testing.js +1 -6
  6. package/migrations/0012_pull_request_next_action.sql +5 -0
  7. package/migrations/meta/0012_snapshot.json +434 -0
  8. package/migrations/meta/_journal.json +7 -0
  9. package/package.json +11 -13
  10. package/skills/github-code/SKILL.md +1 -1
  11. package/skills/github-code/SPEC.md +2 -2
  12. package/skills/github-code/references/workflow.md +1 -1
  13. package/dist/account-links.d.ts +0 -8
  14. package/dist/annotations.d.ts +0 -33
  15. package/dist/chunk-YUF5P5I7.js +0 -2507
  16. package/dist/clone-command.d.ts +0 -5
  17. package/dist/configured-repository.d.ts +0 -10
  18. package/dist/conversation-title-context.d.ts +0 -20
  19. package/dist/credential-support.d.ts +0 -107
  20. package/dist/db/database.d.ts +0 -5
  21. package/dist/db/schema.d.ts +0 -1403
  22. package/dist/default-branch.d.ts +0 -15
  23. package/dist/egress-policy.d.ts +0 -25
  24. package/dist/events/comment.d.ts +0 -14
  25. package/dist/events/declarations.d.ts +0 -18
  26. package/dist/events/deployment.d.ts +0 -38
  27. package/dist/events/issue.d.ts +0 -42
  28. package/dist/events/pull-request.d.ts +0 -75
  29. package/dist/events/release.d.ts +0 -42
  30. package/dist/events/repository.d.ts +0 -23
  31. package/dist/events/resource-url.d.ts +0 -5
  32. package/dist/events/scope.d.ts +0 -13
  33. package/dist/git-config.d.ts +0 -52
  34. package/dist/github-status.d.ts +0 -16
  35. package/dist/graphql-documents.d.ts +0 -31
  36. package/dist/images.d.ts +0 -8
  37. package/dist/issue-outcomes/store.d.ts +0 -42
  38. package/dist/merge-conflict-checks/heartbeat.d.ts +0 -27
  39. package/dist/merge-conflict-checks/store.d.ts +0 -44
  40. package/dist/merge-conflict-checks/webhooks.d.ts +0 -23
  41. package/dist/object-facts.d.ts +0 -29
  42. package/dist/permissions.d.ts +0 -6
  43. package/dist/plugin.d.ts +0 -45
  44. package/dist/pull-request-outcomes/apply.d.ts +0 -22
  45. package/dist/pull-request-outcomes/commit-composition.d.ts +0 -6
  46. package/dist/pull-request-outcomes/reconcile.d.ts +0 -41
  47. package/dist/pull-request-outcomes/store.d.ts +0 -115
  48. package/dist/pull-request-requesters/draft-reviewers.d.ts +0 -15
  49. package/dist/pull-request-requesters/store.d.ts +0 -41
  50. package/dist/pull-request-review-policy.d.ts +0 -6
  51. package/dist/receive-pack-policy.d.ts +0 -21
  52. package/dist/reply-markdown.d.ts +0 -18
  53. package/dist/sandbox-paths.d.ts +0 -4
  54. package/dist/tool-support/attribution.d.ts +0 -52
  55. package/dist/tool-support/github-api.d.ts +0 -51
  56. package/dist/tool-support/github-text.d.ts +0 -8
  57. package/dist/tool-support/pull-request-description.d.ts +0 -8
  58. package/dist/tools/clone-repository.d.ts +0 -205
  59. package/dist/tools/comment-on-issue.d.ts +0 -205
  60. package/dist/tools/comment-on-pull-request.d.ts +0 -210
  61. package/dist/tools/create-issue.d.ts +0 -218
  62. package/dist/tools/create-pull-request.d.ts +0 -240
  63. package/dist/tools/footer.d.ts +0 -17
  64. package/dist/tools/get-deployment.d.ts +0 -264
  65. package/dist/tools/get-issue.d.ts +0 -248
  66. package/dist/tools/get-pull-request.d.ts +0 -255
  67. package/dist/tools/get-release.d.ts +0 -243
  68. package/dist/tools/get-repository.d.ts +0 -226
  69. package/dist/tools/get-status.d.ts +0 -213
  70. package/dist/tools/react-to-issue.d.ts +0 -205
  71. package/dist/tools/resolve-pull-request-review-thread.d.ts +0 -206
  72. package/dist/tools/stack-pull-request.d.ts +0 -43
  73. package/dist/tools/submit-pull-request-review.d.ts +0 -216
  74. package/dist/tools/update-issue-comment.d.ts +0 -206
  75. package/dist/tools/update-issue.d.ts +0 -249
  76. package/dist/tools/update-pull-request-feedback.d.ts +0 -242
  77. package/dist/tools/update-pull-request.d.ts +0 -255
  78. package/dist/tools.d.ts +0 -13
  79. package/dist/webhooks/check-suite.d.ts +0 -94
  80. package/dist/webhooks/event-targets.d.ts +0 -44
  81. package/dist/webhooks/events.d.ts +0 -23
  82. package/dist/webhooks/fail-open-log.d.ts +0 -10
  83. package/dist/webhooks/handler.d.ts +0 -55
  84. package/dist/webhooks/installation-requests.d.ts +0 -98
  85. package/dist/webhooks/issue-outcome.d.ts +0 -11
  86. package/dist/webhooks/issue-update.d.ts +0 -8
  87. package/dist/webhooks/merge-conflict.d.ts +0 -48
  88. package/dist/webhooks/ownership.d.ts +0 -14
  89. package/dist/webhooks/pull-request-activity.d.ts +0 -11
  90. package/dist/webhooks/pull-request-match-data.d.ts +0 -31
  91. package/dist/webhooks/pull-request-outcome.d.ts +0 -16
  92. package/dist/webhooks/pull-request-people.d.ts +0 -51
  93. package/dist/webhooks/pull-request-preview.d.ts +0 -12
  94. package/dist/webhooks/pull-request-ready-reviewers.d.ts +0 -25
  95. package/dist/webhooks/pull-request-ready.d.ts +0 -31
  96. package/dist/webhooks/pull-request-review-request.d.ts +0 -32
  97. package/dist/workspace-prepare.d.ts +0 -3
@@ -1,255 +0,0 @@
1
- import { type Identity, type User, type Actor, type PluginLogger, type PluginDecider, type PluginEgress, type Source } from "@sentry/junior-plugin-api";
2
- /** Update mutable PR metadata while preserving runtime-owned body attribution. */
3
- export declare function createGitHubUpdatePullRequestTool(ctx: {
4
- actor?: Actor;
5
- automationLink?: {
6
- url: string;
7
- };
8
- conversationId?: string;
9
- db: unknown;
10
- egress: PluginEgress;
11
- log: PluginLogger;
12
- events: {
13
- canSubscribe: boolean;
14
- };
15
- conversationLink?: {
16
- url: string;
17
- };
18
- source?: Source;
19
- users: {
20
- resolveActor(): Promise<{
21
- identity?: Identity;
22
- user?: User;
23
- } | undefined>;
24
- };
25
- },
26
- /** Set when the description check experiment is on. */
27
- descriptionDecider?: PluginDecider): import("@sentry/junior-plugin-api").PluginToolDefinition<{
28
- repo: string;
29
- number: number;
30
- title?: string | undefined;
31
- body?: string | undefined;
32
- base?: string | undefined;
33
- state?: "closed" | "open" | undefined;
34
- draft?: boolean | undefined;
35
- }, {
36
- objectAnnotations?: {
37
- kind: "object";
38
- key: string;
39
- label: string;
40
- objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "document" | "item" | "message" | "person" | "task" | "web_page";
41
- title: string;
42
- url: string | null;
43
- description?: string | undefined;
44
- status?: string | undefined;
45
- trigger?: string | undefined;
46
- warning?: string | undefined;
47
- displayType?: string | undefined;
48
- sourceUpdatedAt?: string | undefined;
49
- facts?: {
50
- type: "code_change";
51
- summary?: string | undefined;
52
- author?: string | undefined;
53
- sourceBranch?: string | undefined;
54
- targetBranch?: string | undefined;
55
- reviewers?: string[] | undefined;
56
- review?: "approved" | "changes_requested" | "required" | undefined;
57
- checks?: {
58
- passed: number;
59
- failed: number;
60
- pending: number;
61
- } | undefined;
62
- mergeable?: boolean | undefined;
63
- changedFiles?: number | undefined;
64
- additions?: number | undefined;
65
- deletions?: number | undefined;
66
- previewImageUrls?: string[] | undefined;
67
- } | {
68
- type: "task";
69
- summary?: string | undefined;
70
- assignees?: string[] | undefined;
71
- priority?: string | undefined;
72
- project?: string | undefined;
73
- cycle?: string | undefined;
74
- dueDate?: string | undefined;
75
- labels?: string[] | undefined;
76
- } | {
77
- type: "deployment";
78
- summary?: string | undefined;
79
- project?: string | undefined;
80
- environment?: string | undefined;
81
- revision?: string | undefined;
82
- branch?: string | undefined;
83
- } | {
84
- type: "calendar_event";
85
- summary?: string | undefined;
86
- when?: string | undefined;
87
- attendees?: string[] | undefined;
88
- } | {
89
- type: "conversation";
90
- summary?: string | undefined;
91
- participants?: string[] | undefined;
92
- lastActivityAt?: string | undefined;
93
- } | {
94
- type: "document";
95
- summary?: string | undefined;
96
- owner?: string | undefined;
97
- modifiedAt?: string | undefined;
98
- } | {
99
- type: "message";
100
- summary?: string | undefined;
101
- channel?: string | undefined;
102
- author?: string | undefined;
103
- sentAt?: string | undefined;
104
- } | {
105
- type: "web_page";
106
- summary?: string | undefined;
107
- siteName?: string | undefined;
108
- author?: string | undefined;
109
- thumbnailUrl?: string | undefined;
110
- } | {
111
- type: "person";
112
- summary?: string | undefined;
113
- email?: string | undefined;
114
- slackHandle?: string | undefined;
115
- githubHandle?: string | undefined;
116
- avatarUrl?: string | undefined;
117
- } | undefined;
118
- }[] | undefined;
119
- reply?: {
120
- text: string;
121
- url?: string | undefined;
122
- } | undefined;
123
- truncated?: boolean | undefined;
124
- continuation?: {
125
- arguments: Record<string, unknown>;
126
- reason?: string | undefined;
127
- } | undefined;
128
- base: string;
129
- body: string | null;
130
- draft: boolean;
131
- number: number;
132
- state: string;
133
- subscribable?: {
134
- identifier: string;
135
- label: string;
136
- match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
137
- namespace: string;
138
- suggested_events?: string[] | undefined;
139
- supported_events: string[];
140
- type: string;
141
- } | undefined;
142
- title: string;
143
- url: string;
144
- target: "updatePullRequest";
145
- }, {
146
- objectAnnotations?: {
147
- kind: "object";
148
- key: string;
149
- label: string;
150
- objectType: "automation" | "calendar_event" | "code_change" | "conversation" | "deployment" | "document" | "item" | "message" | "person" | "task" | "web_page";
151
- title: string;
152
- url: string | null;
153
- description?: string | undefined;
154
- status?: string | undefined;
155
- trigger?: string | undefined;
156
- warning?: string | undefined;
157
- displayType?: string | undefined;
158
- sourceUpdatedAt?: string | undefined;
159
- facts?: {
160
- type: "code_change";
161
- summary?: string | undefined;
162
- author?: string | undefined;
163
- sourceBranch?: string | undefined;
164
- targetBranch?: string | undefined;
165
- reviewers?: string[] | undefined;
166
- review?: "approved" | "changes_requested" | "required" | undefined;
167
- checks?: {
168
- passed: number;
169
- failed: number;
170
- pending: number;
171
- } | undefined;
172
- mergeable?: boolean | undefined;
173
- changedFiles?: number | undefined;
174
- additions?: number | undefined;
175
- deletions?: number | undefined;
176
- previewImageUrls?: string[] | undefined;
177
- } | {
178
- type: "task";
179
- summary?: string | undefined;
180
- assignees?: string[] | undefined;
181
- priority?: string | undefined;
182
- project?: string | undefined;
183
- cycle?: string | undefined;
184
- dueDate?: string | undefined;
185
- labels?: string[] | undefined;
186
- } | {
187
- type: "deployment";
188
- summary?: string | undefined;
189
- project?: string | undefined;
190
- environment?: string | undefined;
191
- revision?: string | undefined;
192
- branch?: string | undefined;
193
- } | {
194
- type: "calendar_event";
195
- summary?: string | undefined;
196
- when?: string | undefined;
197
- attendees?: string[] | undefined;
198
- } | {
199
- type: "conversation";
200
- summary?: string | undefined;
201
- participants?: string[] | undefined;
202
- lastActivityAt?: string | undefined;
203
- } | {
204
- type: "document";
205
- summary?: string | undefined;
206
- owner?: string | undefined;
207
- modifiedAt?: string | undefined;
208
- } | {
209
- type: "message";
210
- summary?: string | undefined;
211
- channel?: string | undefined;
212
- author?: string | undefined;
213
- sentAt?: string | undefined;
214
- } | {
215
- type: "web_page";
216
- summary?: string | undefined;
217
- siteName?: string | undefined;
218
- author?: string | undefined;
219
- thumbnailUrl?: string | undefined;
220
- } | {
221
- type: "person";
222
- summary?: string | undefined;
223
- email?: string | undefined;
224
- slackHandle?: string | undefined;
225
- githubHandle?: string | undefined;
226
- avatarUrl?: string | undefined;
227
- } | undefined;
228
- }[] | undefined;
229
- reply?: {
230
- text: string;
231
- url?: string | undefined;
232
- } | undefined;
233
- truncated?: boolean | undefined;
234
- continuation?: {
235
- arguments: Record<string, unknown>;
236
- reason?: string | undefined;
237
- } | undefined;
238
- base: string;
239
- body: string | null;
240
- draft: boolean;
241
- number: number;
242
- state: string;
243
- subscribable?: {
244
- identifier: string;
245
- label: string;
246
- match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
247
- namespace: string;
248
- suggested_events?: string[] | undefined;
249
- supported_events: string[];
250
- type: string;
251
- } | undefined;
252
- title: string;
253
- url: string;
254
- target: "updatePullRequest";
255
- }>;
package/dist/tools.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import type { PluginToolDefinition, ToolRegistrationHookContext } from "@sentry/junior-plugin-api";
2
- import type { GitHubPullRequestSubscriptionConfig } from "./events/pull-request.js";
3
- /** Opt-ins for GitHub plugin behavior that is still being tested. */
4
- export interface GitHubPluginExperiments {
5
- /**
6
- * Check pull request descriptions with the decision model before a create
7
- * or update, and reject ones with check results, a work log, chat talk, or
8
- * no reason.
9
- */
10
- pullRequestDescriptionChecks?: boolean;
11
- }
12
- /** Build the GitHub plugin's runtime tools from their per-tool modules. */
13
- export declare function createGitHubTools(ctx: ToolRegistrationHookContext, botEmail?: string, pullRequestSubscription?: GitHubPullRequestSubscriptionConfig, experimental?: GitHubPluginExperiments): Record<string, PluginToolDefinition>;
@@ -1,94 +0,0 @@
1
- /**
2
- * GitHub check suite events.
3
- */
4
- import type { EventInput, PluginLogger } from "@sentry/junior-plugin-api";
5
- import type { GitHubStatusIncident } from "../github-status.js";
6
- export type GitHubFailingCheck = {
7
- checkRunId: number;
8
- conclusion: string;
9
- htmlUrl?: string;
10
- name: string;
11
- };
12
- /** Pull request values filled in when a match filter needs them. */
13
- export type GitHubCheckSuitePullRequestFacts = {
14
- openerEmail?: string;
15
- openerUsername?: string;
16
- isDraft?: boolean;
17
- };
18
- /** Optional values for one check suite event. */
19
- export type GitHubCheckSuiteFacts = {
20
- failingChecks?: GitHubFailingCheck[];
21
- /** Open or recent githubstatus.com incidents when the suite failed. */
22
- githubIncidents?: GitHubStatusIncident[];
23
- /** Pull request values by number when a match filter needs them. */
24
- pullRequestFactsByNumber?: Record<number, GitHubCheckSuitePullRequestFacts>;
25
- };
26
- /** Build a browser URL for one check suite. GitHub does not send html_url. */
27
- export declare function buildCheckSuiteUrl(args: {
28
- checkSuiteId: number;
29
- headSha: string;
30
- repo: string;
31
- }): string;
32
- /** Build the trusted data and summary for one check-suite event. */
33
- export declare function buildCheckSuiteEvent(args: {
34
- appName?: string;
35
- openerEmail?: string;
36
- openerUsername?: string;
37
- checkSuiteId?: number;
38
- deliveryId: string;
39
- eventType: "pull_request.checks.failed" | "pull_request.checks.recovered";
40
- failingChecks?: GitHubFailingCheck[];
41
- githubIncidents?: GitHubStatusIncident[];
42
- headBranch?: string;
43
- headSha?: string;
44
- isDraft?: boolean;
45
- latestCheckRunsCount?: number;
46
- /** Pull request number when GitHub attached one. */
47
- pullRequestNumber?: number;
48
- repo: string;
49
- suiteConclusion: string;
50
- }): EventInput;
51
- /** Keep only failed check runs from one suite. */
52
- export declare function selectFailingChecks(checkRuns: unknown, options?: {
53
- checkSuiteId?: number;
54
- }): GitHubFailingCheck[];
55
- /** Normalize a completed check suite for attached PRs, or the repository alone. */
56
- export declare function normalizeCheckSuiteEvents(deliveryId: string, body: unknown, options?: GitHubCheckSuiteFacts): EventInput[];
57
- /** The same-repository pull requests of one completed check suite. */
58
- export declare function checkSuitePullRequests(body: unknown): Array<{
59
- number: number;
60
- repositoryFullName: string;
61
- }>;
62
- /** Identifiers and event types one completed check suite may publish. */
63
- export declare function parseCheckSuitePublishTargets(body: unknown): {
64
- data: {
65
- repo: string;
66
- };
67
- eventTypes: string[];
68
- identifiers: string[];
69
- } | undefined;
70
- /** Read which check suite values still need a GitHub API load. */
71
- export declare function parseCheckSuiteFactsTarget(body: unknown, options?: {
72
- loadPullRequestFacts?: boolean;
73
- }): {
74
- checkSuiteId: number;
75
- headSha: string;
76
- loadFailingChecks: boolean;
77
- loadPullRequestFacts: boolean;
78
- owner: string;
79
- pullRequestNumbers: number[];
80
- repoName: string;
81
- } | undefined;
82
- /** True when active match filters need pull request fields from the API. */
83
- export declare function needsCheckSuitePullRequestFacts(matchKeys: Iterable<string>): boolean;
84
- /** Load failed check runs and optional pull request match fields. */
85
- export declare function loadCheckSuiteFacts(args: {
86
- appIdEnv: string;
87
- body: unknown;
88
- installationIdEnv: string;
89
- /** Open or recent githubstatus.com incidents, shared through a cache. */
90
- loadGitHubIncidents?(): Promise<GitHubStatusIncident[]>;
91
- loadPullRequestFacts?: boolean;
92
- log?: Pick<PluginLogger, "error" | "warn">;
93
- privateKeyEnv: string;
94
- }): Promise<GitHubCheckSuiteFacts | undefined>;
@@ -1,44 +0,0 @@
1
- /**
2
- * Event data, event key, and target helpers shared by the GitHub webhook
3
- * normalizers.
4
- */
5
- import type { EventInput } from "@sentry/junior-plugin-api";
6
- import * as z from "zod";
7
- /**
8
- * The user who sent a webhook. GitHub authenticates this user, so on a comment
9
- * or review it is the author, and on an issue update it made the change.
10
- * Match on the numeric id; logins can be renamed and reused.
11
- */
12
- export declare const gitHubSenderSchema: z.ZodObject<{
13
- id: z.ZodNumber;
14
- login: z.ZodString;
15
- }, z.core.$strip>;
16
- /** Trusted event data that names who sent a webhook. */
17
- export declare function gitHubSenderData(sender: z.output<typeof gitHubSenderSchema> | undefined): {
18
- senderId?: number;
19
- senderLogin?: string;
20
- };
21
- /** The GitHub user who did what an Event describes, when GitHub names one. */
22
- export declare function gitHubDoneBy(login: string | undefined): Pick<EventInput, "doneBy"> | undefined;
23
- /** The text of a webhook value, or undefined when it is missing or blank. */
24
- export declare function nonBlank(value: string | null | undefined): string | undefined;
25
- /** The title and body of an issue or pull request, as untrusted text. */
26
- export declare function titleAndBodyText(item: {
27
- body?: string | null;
28
- title?: string;
29
- }): string | undefined;
30
- /** Convert an optional provider timestamp for receipt-time fallback ordering. */
31
- export declare function providerTime(value: string | null | undefined): number | undefined;
32
- /**
33
- * Drop missing values from event data. A filter on a value that GitHub did not
34
- * send then does not match.
35
- */
36
- export declare function definedValues(data: Record<string, unknown>): Record<string, unknown>;
37
- /** Build the event key for one event type from one webhook delivery. */
38
- export declare function gitHubEventKey(deliveryId: string, eventType: string): string;
39
- /**
40
- * Address a pull request event through both the pull request and its
41
- * repository. Only the pull request copy keeps `terminal`, so a terminal
42
- * event never completes a repository Watch.
43
- */
44
- export declare function pullRequestTargets(event: EventInput, repo: string): EventInput[];
@@ -1,23 +0,0 @@
1
- import type { EventInput } from "@sentry/junior-plugin-api";
2
- import { type GitHubCheckSuiteFacts } from "./check-suite.js";
3
- export type { GitHubCheckSuiteFacts, GitHubCheckSuitePullRequestFacts, GitHubFailingCheck, } from "./check-suite.js";
4
- export { buildCheckSuiteEvent, buildCheckSuiteUrl, loadCheckSuiteFacts, needsCheckSuitePullRequestFacts, parseCheckSuiteFactsTarget, parseCheckSuitePublishTargets, selectFailingChecks, } from "./check-suite.js";
5
- /**
6
- * Build the merged or closed_unmerged events of one closed pull request.
7
- * The webhook and the daily reconcile both publish them. The key names the
8
- * close, not the webhook delivery, so a Watch gets the close once.
9
- */
10
- export declare function gitHubPullRequestTerminalEvents(body: unknown): EventInput[];
11
- /**
12
- * Normalize one verified GitHub delivery into conversation events.
13
- *
14
- * Comments and reviews written by the configured bot are dropped, so Junior
15
- * does not react to or act on its own feedback.
16
- */
17
- export declare function normalizeGitHubEvents(args: {
18
- body: unknown;
19
- botEmail?: string;
20
- checkSuiteFacts?: GitHubCheckSuiteFacts;
21
- deliveryId: string;
22
- eventName: string;
23
- }): EventInput[];
@@ -1,10 +0,0 @@
1
- /**
2
- * Logging for optional webhook work that fails open.
3
- */
4
- import type { PluginLogger } from "@sentry/junior-plugin-api";
5
- /**
6
- * Log a failure of optional webhook work. A GitHub 5xx is a GitHub outage,
7
- * not a Junior bug, so it is a warning with the HTTP status. Other failures
8
- * stay errors.
9
- */
10
- export declare function logFailOpenFailure(log: Pick<PluginLogger, "error" | "warn"> | undefined, message: string, error: unknown, metadata: Record<string, unknown>): void;
@@ -1,55 +0,0 @@
1
- import type { GitHubStatusIncident } from "../github-status.js";
2
- import type { CodeChangePublisher, PluginConversationAnnotations, PluginConversationReviewItems, PluginLogger, PluginRoute, EventPublisher, PluginState } from "@sentry/junior-plugin-api";
3
- import * as z from "zod";
4
- import type { GitHubDb } from "../db/database.js";
5
- import type { GitHubPullRequestCommitComposition } from "../db/schema.js";
6
- import { type GitHubPullRequestRef } from "./merge-conflict.js";
7
- import { type GitHubRoleTarget } from "./pull-request-match-data.js";
8
- import { type GitHubCommitPageLoader, type GitHubPullRequestTarget } from "./pull-request-people.js";
9
- /** The pull request comment data that the feedback reaction needs. */
10
- declare const feedbackTargetSchema: z.ZodObject<{
11
- commentId: z.ZodNumber;
12
- commentKind: z.ZodEnum<{
13
- conversation: "conversation";
14
- review: "review";
15
- review_body: "review_body";
16
- }>;
17
- pullRequest: z.ZodNumber;
18
- repo: z.ZodString;
19
- }, z.core.$strip>;
20
- type FeedbackTarget = z.output<typeof feedbackTargetSchema>;
21
- /** Create the public, signed GitHub webhook route owned by the plugin. */
22
- export declare function createGitHubWebhookRoute(args: {
23
- annotations: PluginConversationAnnotations;
24
- appIdEnv: string;
25
- botEmail(): string | undefined;
26
- classifyPullRequestCommits?(input: {
27
- number: number;
28
- repositoryFullName: string;
29
- }): Promise<GitHubPullRequestCommitComposition | undefined>;
30
- codeChanges: CodeChangePublisher;
31
- db: GitHubDb;
32
- installationId(): string | undefined;
33
- installationIdEnv: string;
34
- /**
35
- * Read a pull request's commits for the `authors` field and the people
36
- * involved.
37
- */
38
- loadPullRequestCommitPages?(target: GitHubPullRequestTarget): Promise<GitHubCommitPageLoader>;
39
- /** Read open and recent GitHub incidents for failed check suites. */
40
- loadGitHubIncidents?(): Promise<GitHubStatusIncident[]>;
41
- /** Read one pull request for its mergeability. */
42
- loadPullRequest?(pullRequest: GitHubPullRequestRef): Promise<unknown>;
43
- /** Load a repository role for `openerRole`. */
44
- loadRepositoryRole?(target: GitHubRoleTarget): Promise<string>;
45
- /** Linked GitHub login of the user of one Junior identity, if any. */
46
- loadGitHubLogin?(identityId: string): Promise<string | undefined>;
47
- log?: Pick<PluginLogger, "error" | "warn">;
48
- markFeedbackReviewing(input: FeedbackTarget): Promise<void>;
49
- privateKeyEnv: string;
50
- events: EventPublisher;
51
- reviewItems: PluginConversationReviewItems;
52
- state: PluginState;
53
- webhookSecret(): string | undefined;
54
- }): PluginRoute;
55
- export {};
@@ -1,98 +0,0 @@
1
- /**
2
- * GitHub requests that webhook handling makes with installation tokens.
3
- *
4
- * A webhook delivery has no Turn and no egress context, so these requests
5
- * call GitHub directly. Other plugin code must use host egress.
6
- */
7
- import type { PluginCache } from "@sentry/junior-plugin-api";
8
- /** Environment variable names for the GitHub App installation. */
9
- export interface GitHubInstallationEnv {
10
- appIdEnv: string;
11
- installationIdEnv: string;
12
- privateKeyEnv: string;
13
- }
14
- /** Return a reader for pages of a pull request's commits, with a read-only token. */
15
- export declare function loadPullRequestCommitPages(env: GitHubInstallationEnv, pullRequest: {
16
- number: number;
17
- repositoryFullName: string;
18
- }): Promise<(page: number, perPage: number) => Promise<unknown>>;
19
- /** Read one pull request, with a read-only token. */
20
- export declare function loadPullRequest(env: GitHubInstallationEnv, pullRequest: {
21
- number: number;
22
- repositoryFullName: string;
23
- }): Promise<unknown>;
24
- /** GitHub cannot reach a repository: it is gone, or the installation lost it. */
25
- export declare class GitHubRepositoryUnreachableError extends Error {
26
- constructor(repositoryId: number);
27
- }
28
- /**
29
- * Read the lifecycle of some pull requests of one repository in one GraphQL
30
- * query, with a read-only token. Each pull request has the alias `pr<index>`.
31
- * The repository is found by its id, because a rename changes its name.
32
- */
33
- export declare function loadPullRequestLifecycles(env: GitHubInstallationEnv, input: {
34
- numbers: number[];
35
- repositoryId: number;
36
- }): Promise<unknown>;
37
- /**
38
- * Read one page of a repository's open pull requests by one author, with
39
- * their mergeability, through GraphQL search and a read-only token.
40
- */
41
- export declare function searchOpenPullRequestMergeability(env: GitHubInstallationEnv, input: {
42
- after?: string;
43
- author: string;
44
- repositoryFullName: string;
45
- }): Promise<unknown>;
46
- /** Ask people to review one pull request, with a pull request write token. */
47
- export declare function requestPullRequestReviewers(env: GitHubInstallationEnv, input: {
48
- number: number;
49
- repositoryFullName: string;
50
- reviewers: string[];
51
- }): Promise<void>;
52
- /** Add the "reviewing" reaction to one pull request comment or review body. */
53
- export declare function markPullRequestFeedbackReviewing(env: GitHubInstallationEnv, target: {
54
- commentId: number;
55
- commentKind: "conversation" | "review" | "review_body";
56
- pullRequest: number;
57
- repo: string;
58
- }): Promise<void>;
59
- /**
60
- * Read one user's role on a repository, with a metadata-only token. GitHub
61
- * returns "none" for accounts without access, such as most bots. Roles are
62
- * cached for ten minutes.
63
- */
64
- export declare function loadRepositoryRole(env: GitHubInstallationEnv, cache: PluginCache, target: {
65
- login: string;
66
- repositoryFullName: string;
67
- }): Promise<string>;
68
- /** The pull request facts that decide whether it is ready to merge. */
69
- export interface GitHubPullRequestMergeState {
70
- /**
71
- * At least one approval, and no reviewer still requests changes. Read
72
- * only when GitHub says the pull request can merge cleanly.
73
- */
74
- approved: boolean;
75
- /** A person turned on auto-merge, so GitHub merges it without them. */
76
- autoMerge: boolean;
77
- draft: boolean;
78
- /**
79
- * GitHub's `mergeable_state`, such as `clean` or `blocked`. `clean` means
80
- * that the required reviews and every check and status passed, and there
81
- * are no conflicts. Undefined when GitHub has not computed it yet.
82
- */
83
- mergeableState?: string;
84
- state: "closed" | "merged" | "open";
85
- title: string;
86
- url: string;
87
- }
88
- /**
89
- * Read whether a pull request is ready to merge, with a read-only token.
90
- * GitHub computes `mergeable_state` after a change, so an unknown state is
91
- * read once more. Reviews load only for an open pull request that is not a
92
- * draft, has no auto-merge, and can merge cleanly. Each reviewer counts by their latest
93
- * approval, change request, or dismissal. Comments do not change the result.
94
- */
95
- export declare function loadPullRequestMergeState(env: GitHubInstallationEnv, pullRequest: {
96
- number: number;
97
- repositoryFullName: string;
98
- }): Promise<GitHubPullRequestMergeState>;
@@ -1,11 +0,0 @@
1
- import type { GitHubIssueConversationsInput, GitHubIssueOutcomeInput } from "../issue-outcomes/store.js";
2
- /** Normalize only the fields required for the Junior-owned issue projection. */
3
- export declare function normalizeGitHubIssueOutcome(args: {
4
- body: unknown;
5
- botEmail?: string;
6
- }): GitHubIssueOutcomeInput | undefined;
7
- /** Normalize native conversation ids written to a Junior-owned issue by its bot. */
8
- export declare function normalizeGitHubIssueConversations(args: {
9
- body: unknown;
10
- botEmail?: string;
11
- }): GitHubIssueConversationsInput | undefined;
@@ -1,8 +0,0 @@
1
- import type { EventInput } from "@sentry/junior-plugin-api";
2
- /**
3
- * Normalize an issue edit, label, assignee, or milestone change into
4
- * `issue.updated` for the issue and its repository. Return undefined when the
5
- * delivery is not one of these updates. Changes that the bot makes publish
6
- * nothing, so Junior's own issue updates do not wake its Watches.
7
- */
8
- export declare function normalizeIssueUpdateEvents(deliveryId: string, body: unknown, botEmail: string | undefined): EventInput[] | undefined;
@@ -1,48 +0,0 @@
1
- /**
2
- * Merge conflict checks on pull request webhook events.
3
- *
4
- * GitHub sends no webhook when a pull request gets a conflict, and a
5
- * conflicted pull request gets no new checks. So when a webhook delivers
6
- * another event for a watched pull request, such as a comment, a review, or a
7
- * check result, the webhook also reads its mergeability and publishes
8
- * `pull_request.merge_conflict`. A push to the default branch also starts a
9
- * check of the repository's open Junior pull requests. See
10
- * `merge-conflict-checks/`.
11
- */
12
- import type { EventInput, EventPublisher, PluginLogger } from "@sentry/junior-plugin-api";
13
- /** Values that GitHub reports for a conflicted pull request. */
14
- export interface GitHubMergeConflict {
15
- baseBranch: string;
16
- headSha: string;
17
- url?: string;
18
- }
19
- /** One pull request in one repository. */
20
- export interface GitHubPullRequestRef {
21
- number: number;
22
- repositoryFullName: string;
23
- }
24
- /**
25
- * Build the `pull_request.merge_conflict` copies for one pull request. With
26
- * no conflict, the copies have only the values that filters can match. The
27
- * event key names the head commit, so each head commit publishes once.
28
- */
29
- export declare function gitHubMergeConflictEvents(input: GitHubPullRequestRef & {
30
- conflict?: GitHubMergeConflict;
31
- }): EventInput[];
32
- /**
33
- * Return `pull_request.merge_conflict` events for the open pull requests that
34
- * these events are about, when a Watch or event automation wants them and
35
- * GitHub reports a conflict. A `pull_request` webhook payload gives the
36
- * mergeability when GitHub knows it. Otherwise the check reads the pull
37
- * request, which also makes GitHub calculate its mergeability. When GitHub
38
- * does not know it yet, a later event reads it again.
39
- */
40
- export declare function loadGitHubMergeConflictEvents(args: {
41
- deliveryId: string;
42
- events: EventInput[];
43
- hasMatch: EventPublisher["hasMatch"];
44
- loadPullRequest?(ref: GitHubPullRequestRef): Promise<unknown>;
45
- log?: Pick<PluginLogger, "error" | "warn">;
46
- /** The body of a `pull_request` webhook. */
47
- pullRequestPayload?: unknown;
48
- }): Promise<EventInput[]>;