@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,14 +0,0 @@
1
- /** Derive the provider login encoded in a standard GitHub noreply address. */
2
- export declare function botLoginFromEmail(value: string | undefined): string | undefined;
3
- /** Check whether a GitHub login is the bot encoded in the configured bot email. */
4
- export declare function isBotLogin(login: string | null | undefined, botEmail: string | undefined): boolean;
5
- /** Derive the GitHub user id encoded in a standard GitHub noreply address. */
6
- export declare function botUserIdFromEmail(value: string | undefined): number | undefined;
7
- /**
8
- * Check whether the author's own text mentions the bot encoded in the
9
- * configured bot email. GitHub sends mentions only as comment text, with no
10
- * structured field, so this reads the App slug: the bot login without `[bot]`.
11
- * This shows only that the comment addresses the bot. It does not grant trust;
12
- * match the commenter's `senderId` for that.
13
- */
14
- export declare function mentionsBotLogin(text: string, botEmail: string | undefined): boolean;
@@ -1,11 +0,0 @@
1
- /** One push, review, or comment by a person on a pull request. */
2
- export interface GitHubPullRequestActivity {
3
- at: Date;
4
- number: number;
5
- repositoryProviderId: string;
6
- }
7
- /** Read a person's pull request activity from a webhook, if it has any. */
8
- export declare function normalizeGitHubPullRequestActivity(input: {
9
- body: unknown;
10
- eventName: string;
11
- }): GitHubPullRequestActivity | undefined;
@@ -1,31 +0,0 @@
1
- import type { EventInput, EventPublisher, PluginLogger } from "@sentry/junior-plugin-api";
2
- import type { GitHubDb } from "../db/database.js";
3
- import type { GitHubPullRequestTarget } from "./pull-request-people.js";
4
- /** The login whose repository role a lookup reads. */
5
- export interface GitHubRoleTarget {
6
- login: string;
7
- repositoryFullName: string;
8
- }
9
- /**
10
- * Add who opened and who wrote each pull request to its events.
11
- * `openerUsername` is the GitHub user who opened it, or on Junior's pull
12
- * requests the person who asked Junior to open it. `openerRole` is that
13
- * person's repository role. `authors` lists the commit authors and
14
- * `Co-authored-by` people. These values need database or GitHub calls. They
15
- * load first when a Watch or event automation filters on them, and the rest
16
- * load only when an event matches, so the agent sees them all.
17
- */
18
- export declare function withGitHubPullRequestMatchData(args: {
19
- body: unknown;
20
- botEmail: string | undefined;
21
- db: GitHubDb;
22
- deliveryId: string;
23
- events: EventInput[];
24
- hasMatch: EventPublisher["hasMatch"];
25
- loadAuthors?(target: GitHubPullRequestTarget): Promise<string[]>;
26
- /** Linked GitHub login of the user of one Junior identity, if any. */
27
- loadGitHubLogin?(identityId: string): Promise<string | undefined>;
28
- loadRole?(target: GitHubRoleTarget): Promise<string>;
29
- log?: Pick<PluginLogger, "error">;
30
- neededMatchKeys: EventPublisher["neededMatchKeys"];
31
- }): Promise<EventInput[]>;
@@ -1,16 +0,0 @@
1
- import type { GitHubPullRequestConversationsInput, GitHubPullRequestLinkedIssuesInput, GitHubPullRequestOutcomeInput } from "../pull-request-outcomes/store.js";
2
- /** Normalize only the fields required for the Junior-owned PR projection. */
3
- export declare function normalizeGitHubPullRequestOutcome(args: {
4
- body: unknown;
5
- botEmail?: string;
6
- }): GitHubPullRequestOutcomeInput | undefined;
7
- /** Normalize native conversation ids written to a Junior-owned PR by its bot. */
8
- export declare function normalizeGitHubPullRequestConversations(args: {
9
- body: unknown;
10
- botEmail?: string;
11
- }): GitHubPullRequestConversationsInput | undefined;
12
- /** Normalize linked issues written into a Junior-owned PR body by its bot. */
13
- export declare function normalizeGitHubPullRequestLinkedIssues(args: {
14
- body: unknown;
15
- botEmail?: string;
16
- }): GitHubPullRequestLinkedIssuesInput | undefined;
@@ -1,51 +0,0 @@
1
- import type { EventInput, EventPerson, EventPublisher, PluginLogger } from "@sentry/junior-plugin-api";
2
- /** One pull request in a repository. */
3
- export interface GitHubPullRequestTarget {
4
- number: number;
5
- repositoryFullName: string;
6
- }
7
- /** The pull request that a people lookup reads. */
8
- export interface GitHubPullRequestPeopleTarget extends GitHubPullRequestTarget {
9
- /** Pull request opener and assignees from the webhook. */
10
- logins: string[];
11
- }
12
- /** Loads one page of a pull request's commits from GitHub. */
13
- export type GitHubCommitPageLoader = (page: number, perPage: number) => Promise<unknown>;
14
- /**
15
- * Share commit page loads within one webhook delivery, so the `authors` field
16
- * and the people involved read each page once.
17
- */
18
- export declare function shareCommitPages(load: (target: GitHubPullRequestTarget) => Promise<GitHubCommitPageLoader>): (target: GitHubPullRequestTarget) => GitHubCommitPageLoader;
19
- /**
20
- * Collect the people involved in a pull request: the webhook logins, commit
21
- * authors, and `Co-authored-by` trailers. Junior adds a trailer for each
22
- * person whose instructions a run accepted, so people who steer later are
23
- * included. Noreply emails become logins. `[bot]` accounts are skipped.
24
- */
25
- export declare function loadGitHubPullRequestPeople(args: {
26
- logins: readonly string[];
27
- loadPage: GitHubCommitPageLoader;
28
- }): Promise<EventPerson[]>;
29
- /**
30
- * Collect the GitHub logins of a pull request's commit authors and
31
- * `Co-authored-by` people, for the `authors` event field. Bots stay in the
32
- * list, so Junior's own commits name `sentry-junior[bot]` and the people it
33
- * credits. A co-author without a noreply email has no known login and is
34
- * left out.
35
- */
36
- export declare function loadGitHubPullRequestAuthors(args: {
37
- loadPage: GitHubCommitPageLoader;
38
- }): Promise<string[]>;
39
- /**
40
- * Add the people involved to approval and merge events. It loads them only
41
- * when a Watch or event automation matches, so other deliveries make no extra
42
- * GitHub calls. People only add context, so a failed load keeps the events.
43
- */
44
- export declare function withGitHubPullRequestPeople(args: {
45
- body: unknown;
46
- deliveryId: string;
47
- events: EventInput[];
48
- hasMatch: EventPublisher["hasMatch"];
49
- load?(target: GitHubPullRequestPeopleTarget): Promise<EventPerson[]>;
50
- log?: Pick<PluginLogger, "error">;
51
- }): Promise<EventInput[]>;
@@ -1,12 +0,0 @@
1
- import type { PluginConversationAnnotations, PluginLogger } from "@sentry/junior-plugin-api";
2
- import type { GitHubDb } from "../db/database.js";
3
- /**
4
- * Set or clear the preview image fact on each chip of a Junior pull request
5
- * from the webhook body. One failed conversation does not stop the others.
6
- */
7
- export declare function refreshGitHubPullRequestPreview(args: {
8
- annotations: PluginConversationAnnotations;
9
- body: unknown;
10
- db: GitHubDb;
11
- log?: Pick<PluginLogger, "error">;
12
- }): Promise<void>;
@@ -1,25 +0,0 @@
1
- /**
2
- * The review request for a Junior draft pull request when it becomes ready.
3
- *
4
- * Junior asks for no review while a pull request is a draft. When GitHub
5
- * marks the draft ready for review, Junior asks the reviewers that the person
6
- * named, or else the requester's linked GitHub account.
7
- */
8
- import type { PluginLogger, PluginState } from "@sentry/junior-plugin-api";
9
- import type { GitHubDb } from "../db/database.js";
10
- import { type GitHubInstallationEnv } from "./installation-requests.js";
11
- /**
12
- * Ask for the review of a Junior pull request that GitHub marked ready for
13
- * review. The request is optional, so a failure is logged and does not fail
14
- * the delivery.
15
- */
16
- export declare function requestGitHubReviewersWhenReady(args: {
17
- body: unknown;
18
- db: GitHubDb;
19
- deliveryId: string;
20
- env: GitHubInstallationEnv;
21
- eventName: string;
22
- loadGitHubLogin?(identityId: string): Promise<string | undefined>;
23
- log?: Pick<PluginLogger, "warn">;
24
- state: PluginState;
25
- }): Promise<void>;
@@ -1,31 +0,0 @@
1
- /**
2
- * The "ready to merge" notice on the review desk for a Junior pull request.
3
- *
4
- * A pull request is ready to merge when it is open, not a draft, approved,
5
- * and GitHub's merge state is `clean`. With auto-merge on, GitHub merges it,
6
- * so no person needs the notice. Each webhook that can change one of
7
- * these facts reads them again from GitHub. The notice goes to the
8
- * Conversation where a person asked Junior to open the pull request. It is
9
- * assigned to that person only when they are in that Conversation, and it
10
- * waits on them: the merge is their step. It closes when the pull request
11
- * merges, closes, or is no longer ready.
12
- */
13
- import type { PluginConversationReviewItems, PluginLogger } from "@sentry/junior-plugin-api";
14
- import type { GitHubDb } from "../db/database.js";
15
- import { type GitHubInstallationEnv } from "./installation-requests.js";
16
- import type { GitHubPullRequestTarget } from "./pull-request-people.js";
17
- /** Return the pull requests whose readiness one webhook delivery can change. */
18
- export declare function pullRequestReadyTargets(eventName: string, body: unknown): GitHubPullRequestTarget[];
19
- /**
20
- * Add or close the "ready to merge" notice of each Junior pull request that a
21
- * webhook delivery can change. The notice is optional, so a failure is logged
22
- * and does not fail the delivery.
23
- */
24
- export declare function syncGitHubPullRequestReadyNotices(args: {
25
- db: GitHubDb;
26
- deliveryId: string;
27
- env: GitHubInstallationEnv;
28
- log?: Pick<PluginLogger, "error" | "warn">;
29
- reviewItems: PluginConversationReviewItems;
30
- targets: GitHubPullRequestTarget[];
31
- }): Promise<void>;
@@ -1,32 +0,0 @@
1
- /**
2
- * The "review requested" ask on the review desk for a Junior pull request.
3
- *
4
- * When GitHub asks the requester for a review on a pull request that they
5
- * asked Junior to open, the ask goes to the Conversation where they asked.
6
- * It is assigned to them only when they are in that Conversation, and it
7
- * waits on them. It closes when they submit a review, when the request is
8
- * removed, or when the pull request closes. Reopening the pull request adds
9
- * it again while their request is still open, because GitHub does not send
10
- * a new request for it. GitHub sends each of these facts in the webhook, so
11
- * the ask needs no GitHub read and no saved state.
12
- *
13
- * Only the requester can get the ask. Junior maps a GitHub login to a person
14
- * only through the requester's linked GitHub account, and other pull
15
- * requests have no Conversation for the ask.
16
- */
17
- import type { PluginConversationReviewItems, PluginLogger } from "@sentry/junior-plugin-api";
18
- import type { GitHubDb } from "../db/database.js";
19
- /**
20
- * Add or close the "review requested" ask of a Junior pull request when one
21
- * webhook delivery changes the review request of its requester. The ask is
22
- * optional, so a failure is logged and does not fail the delivery.
23
- */
24
- export declare function syncGitHubPullRequestReviewRequest(args: {
25
- body: unknown;
26
- db: GitHubDb;
27
- deliveryId: string;
28
- eventName: string;
29
- loadGitHubLogin?(identityId: string): Promise<string | undefined>;
30
- log?: Pick<PluginLogger, "error">;
31
- reviewItems: PluginConversationReviewItems;
32
- }): Promise<void>;
@@ -1,3 +0,0 @@
1
- import type { WorkspaceFinalize, WorkspacePrepareHookContext } from "@sentry/junior-plugin-api";
2
- /** Clone missing GitHub repositories or refresh existing Workspace checkouts. */
3
- export declare function prepareWorkspace(ctx: WorkspacePrepareHookContext): Promise<WorkspaceFinalize>;