@sentry/junior-github 0.302.0 → 0.304.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 (93) hide show
  1. package/dist/events-DGd7UVVs.js +2452 -0
  2. package/dist/index.d.ts +71 -3
  3. package/dist/index.js +7193 -8134
  4. package/dist/testing.d.ts +51 -1
  5. package/dist/testing.js +1 -6
  6. package/package.json +10 -13
  7. package/dist/account-links.d.ts +0 -8
  8. package/dist/annotations.d.ts +0 -33
  9. package/dist/chunk-6SOJ5TN6.js +0 -2618
  10. package/dist/clone-command.d.ts +0 -7
  11. package/dist/configured-repository.d.ts +0 -10
  12. package/dist/conversation-title-context.d.ts +0 -20
  13. package/dist/credential-support.d.ts +0 -107
  14. package/dist/db/database.d.ts +0 -5
  15. package/dist/db/schema.d.ts +0 -1412
  16. package/dist/default-branch.d.ts +0 -15
  17. package/dist/draft-readiness.d.ts +0 -31
  18. package/dist/egress-policy.d.ts +0 -25
  19. package/dist/events/comment.d.ts +0 -14
  20. package/dist/events/declarations.d.ts +0 -18
  21. package/dist/events/deployment.d.ts +0 -38
  22. package/dist/events/issue.d.ts +0 -42
  23. package/dist/events/pull-request.d.ts +0 -75
  24. package/dist/events/release.d.ts +0 -42
  25. package/dist/events/repository.d.ts +0 -23
  26. package/dist/events/resource-url.d.ts +0 -5
  27. package/dist/events/scope.d.ts +0 -13
  28. package/dist/git-config.d.ts +0 -52
  29. package/dist/github-status.d.ts +0 -16
  30. package/dist/graphql-documents.d.ts +0 -44
  31. package/dist/hooks-path-command.d.ts +0 -5
  32. package/dist/images.d.ts +0 -8
  33. package/dist/issue-outcomes/store.d.ts +0 -42
  34. package/dist/merge-conflict-checks/heartbeat.d.ts +0 -31
  35. package/dist/merge-conflict-checks/policy.d.ts +0 -74
  36. package/dist/merge-conflict-checks/store.d.ts +0 -44
  37. package/dist/merge-conflict-checks/webhooks.d.ts +0 -23
  38. package/dist/object-facts.d.ts +0 -29
  39. package/dist/permissions.d.ts +0 -6
  40. package/dist/plugin.d.ts +0 -45
  41. package/dist/pull-request-outcomes/apply.d.ts +0 -22
  42. package/dist/pull-request-outcomes/commit-composition.d.ts +0 -6
  43. package/dist/pull-request-outcomes/reconcile.d.ts +0 -42
  44. package/dist/pull-request-outcomes/store.d.ts +0 -120
  45. package/dist/pull-request-requesters/draft-reviewers.d.ts +0 -15
  46. package/dist/pull-request-requesters/store.d.ts +0 -41
  47. package/dist/pull-request-review-policy.d.ts +0 -6
  48. package/dist/receive-pack-policy.d.ts +0 -21
  49. package/dist/reply-markdown.d.ts +0 -18
  50. package/dist/sandbox-paths.d.ts +0 -4
  51. package/dist/tool-support/attribution.d.ts +0 -52
  52. package/dist/tool-support/github-api.d.ts +0 -51
  53. package/dist/tool-support/github-text.d.ts +0 -8
  54. package/dist/tool-support/pull-request-description.d.ts +0 -8
  55. package/dist/tools/clone-repository.d.ts +0 -287
  56. package/dist/tools/comment-on-issue.d.ts +0 -289
  57. package/dist/tools/comment-on-pull-request.d.ts +0 -294
  58. package/dist/tools/create-issue.d.ts +0 -300
  59. package/dist/tools/create-pull-request.d.ts +0 -322
  60. package/dist/tools/footer.d.ts +0 -17
  61. package/dist/tools/get-deployment.d.ts +0 -346
  62. package/dist/tools/get-issue.d.ts +0 -330
  63. package/dist/tools/get-pull-request.d.ts +0 -358
  64. package/dist/tools/get-release.d.ts +0 -325
  65. package/dist/tools/get-repository.d.ts +0 -308
  66. package/dist/tools/get-status.d.ts +0 -295
  67. package/dist/tools/react-to-issue.d.ts +0 -289
  68. package/dist/tools/resolve-pull-request-review-thread.d.ts +0 -288
  69. package/dist/tools/stack-pull-request.d.ts +0 -43
  70. package/dist/tools/submit-pull-request-review.d.ts +0 -300
  71. package/dist/tools/update-issue-comment.d.ts +0 -290
  72. package/dist/tools/update-issue.d.ts +0 -331
  73. package/dist/tools/update-pull-request-feedback.d.ts +0 -324
  74. package/dist/tools/update-pull-request.d.ts +0 -338
  75. package/dist/tools.d.ts +0 -13
  76. package/dist/webhooks/check-suite.d.ts +0 -121
  77. package/dist/webhooks/event-targets.d.ts +0 -44
  78. package/dist/webhooks/events.d.ts +0 -23
  79. package/dist/webhooks/fail-open-log.d.ts +0 -10
  80. package/dist/webhooks/handler.d.ts +0 -57
  81. package/dist/webhooks/installation-requests.d.ts +0 -105
  82. package/dist/webhooks/issue-outcome.d.ts +0 -11
  83. package/dist/webhooks/issue-update.d.ts +0 -8
  84. package/dist/webhooks/merge-conflict.d.ts +0 -53
  85. package/dist/webhooks/ownership.d.ts +0 -14
  86. package/dist/webhooks/pull-request-action.d.ts +0 -37
  87. package/dist/webhooks/pull-request-activity.d.ts +0 -11
  88. package/dist/webhooks/pull-request-match-data.d.ts +0 -31
  89. package/dist/webhooks/pull-request-outcome.d.ts +0 -16
  90. package/dist/webhooks/pull-request-people.d.ts +0 -51
  91. package/dist/webhooks/pull-request-preview.d.ts +0 -12
  92. package/dist/webhooks/pull-request-ready-reviewers.d.ts +0 -25
  93. package/dist/workspace-prepare.d.ts +0 -3
@@ -1,44 +0,0 @@
1
- /**
2
- * Merge conflict checks that wait for the heartbeat, one per repository.
3
- *
4
- * A check is only a debounce, so it lives in plugin state, not in the
5
- * database. When a check is lost, the next push or pull request event
6
- * checks again. A push to the default branch adds a check, and a check
7
- * that already waits keeps its time. The heartbeat reads GitHub later, so a
8
- * burst of pushes gives one check, and GitHub has time to calculate
9
- * mergeability.
10
- */
11
- import type { PluginState } from "@sentry/junior-plugin-api";
12
- import type { GitHubDb } from "../db/database.js";
13
- /** One claimed check. */
14
- export interface GitHubConflictCheck {
15
- attempts: number;
16
- repositoryFullName: string;
17
- }
18
- /** Return the repositories that have open Junior pull requests. */
19
- export declare function listGitHubRepositoriesWithOpenPullRequests(db: GitHubDb, repositoryFullName?: string): Promise<string[]>;
20
- /**
21
- * Add a check at `dueAtMs` for a repository with open Junior pull requests.
22
- * A check that already waits keeps its earlier time, so pushes that keep
23
- * coming do not delay it. Return whether a check waits.
24
- */
25
- export declare function scheduleGitHubConflictCheck(args: {
26
- db: GitHubDb;
27
- dueAtMs: number;
28
- repositoryFullName: string;
29
- state: PluginState;
30
- }): Promise<boolean>;
31
- /**
32
- * Claim the due check of a repository. The claim removes the push key
33
- * before the check reads GitHub, so the read includes every push that the
34
- * key held, and a later push adds a new key. A repeat at `claimedUntilMs`
35
- * runs the check again when it stops without an end.
36
- */
37
- export declare function claimGitHubConflictCheck(args: {
38
- claimedUntilMs: number;
39
- nowMs: number;
40
- repositoryFullName: string;
41
- state: PluginState;
42
- }): Promise<GitHubConflictCheck | undefined>;
43
- /** End a claimed check, or repeat it at `retryAtMs`. */
44
- export declare function settleGitHubConflictCheck(state: PluginState, check: GitHubConflictCheck, retryAtMs?: number): Promise<void>;
@@ -1,23 +0,0 @@
1
- /**
2
- * The `push` webhook part of merge conflict checks. It makes no GitHub API
3
- * calls, so a busy default branch costs one database read and a state
4
- * write.
5
- */
6
- import type { PluginState } from "@sentry/junior-plugin-api";
7
- import type { GitHubDb } from "../db/database.js";
8
- /**
9
- * Time from a push to its check. GitHub calculates mergeability after a
10
- * push, and pushes in this time share one check.
11
- */
12
- export declare const CONFLICT_CHECK_DELAY_MS: number;
13
- /**
14
- * Schedule a check after a push to a repository's default branch. Stacked
15
- * pull requests do not need this, because Junior restacks them when it
16
- * pushes the branch below. Return whether a check waits.
17
- */
18
- export declare function scheduleGitHubPushConflictCheck(args: {
19
- body: unknown;
20
- db: GitHubDb;
21
- now: Date;
22
- state: PluginState;
23
- }): Promise<boolean>;
@@ -1,29 +0,0 @@
1
- import { type ObjectAnnotation, type ObjectFacts } from "@sentry/junior-plugin-api";
2
- /**
3
- * Return where a description image is stored, or nothing when Junior does
4
- * not serve it. The dashboard loads each one through the Junior image route:
5
- * - `artifact`: Junior's own public artifacts, under `JUNIOR_BASE_URL`.
6
- * - `attachment`: `github.com/user-attachments/assets/<id>` images. They
7
- * need the GitHub App credential on private repositories, and GitHub
8
- * redirects them to a short-lived signed URL. Junior never saves the
9
- * signed `private-user-images.githubusercontent.com` URL, because it
10
- * expires in minutes.
11
- */
12
- export declare function githubImageKind(url: URL): "artifact" | "attachment" | undefined;
13
- /**
14
- * Return the images in a pull request body that Junior serves, in body
15
- * order, for card previews. Screenshots often come as a before and after
16
- * pair, so the dashboard chooses which one to show.
17
- */
18
- export declare function githubPreviewImageUrls(body: string | null | undefined): string[];
19
- type CodeChangeFacts = Extract<ObjectFacts, {
20
- type: "code_change";
21
- }>;
22
- /**
23
- * Add preview images in body order while the facts stay in the 4 KiB limit.
24
- * Images that do not fit are left out.
25
- */
26
- export declare function withGitHubPreviewImages(facts: Omit<CodeChangeFacts, "previewImageUrls">, urls: readonly string[]): CodeChangeFacts;
27
- /** Select card facts from GitHub REST responses; never infer reviews or checks. */
28
- export declare function githubObjectFacts(type: "task" | "code_change", response: unknown): Pick<ObjectAnnotation, "facts" | "sourceUpdatedAt" | "description">;
29
- export {};
@@ -1,6 +0,0 @@
1
- export type GitHubAppPermissionLevel = "admin" | "read" | "write";
2
- export type GitHubAppPermissions = Record<string, GitHubAppPermissionLevel>;
3
- /** Validate the configured GitHub App read-token permission declaration. */
4
- export declare function normalizePermissions(permissions: GitHubAppPermissions | undefined): GitHubAppPermissions | undefined;
5
- /** Build the read-only installation-token permission body. */
6
- export declare function readGrantPermissions(permissions: Record<string, unknown> | undefined): Record<string, "read">;
package/dist/plugin.d.ts DELETED
@@ -1,45 +0,0 @@
1
- import { type PluginRegistration } from "@sentry/junior-plugin-api";
2
- import { type GitHubAppPermissions } from "./permissions.js";
3
- import { type GitHubPluginExperiments } from "./tools.js";
4
- import { type GitHubPullRequestEventOptions } from "./events/pull-request.js";
5
- /** Configure the built-in GitHub plugin manifest and hooks. */
6
- export interface GitHubPluginOptions {
7
- /**
8
- * Extra OAuth `scope` values to request during GitHub App user authorization.
9
- *
10
- * GitHub App user tokens report empty scopes, so Junior treats this as a
11
- * local reauthorization contract only. Effective access still comes from the
12
- * app permissions, installation repositories, and requesting user's access.
13
- */
14
- additionalUserScopes?: string[];
15
- /**
16
- * GitHub App permissions Junior should downscope to read for
17
- * installation-read tokens.
18
- *
19
- * Keys may use GitHub permission names with underscores or hyphens.
20
- * Installation-write tokens inherit the App installation's complete
21
- * permission envelope. GitHub remains the source of truth for whether a
22
- * permission exists.
23
- */
24
- appPermissions?: GitHubAppPermissions;
25
- /** Environment variable containing the GitHub App id. */
26
- appIdEnv?: string;
27
- /** Opt-ins for GitHub plugin behavior that is still being tested. */
28
- experimental?: GitHubPluginExperiments;
29
- /** Environment variable containing Junior's Git committer email. */
30
- botEmailEnv?: string;
31
- /** Environment variable containing Junior's Git committer name. */
32
- botNameEnv?: string;
33
- /** Environment variable containing the GitHub App OAuth client id. */
34
- clientIdEnv?: string;
35
- /** Environment variable containing the GitHub App OAuth client secret. */
36
- clientSecretEnv?: string;
37
- /** Environment variable containing the GitHub App installation id. */
38
- installationIdEnv?: string;
39
- /** Environment variable containing the GitHub App private key. */
40
- privateKeyEnv?: string;
41
- /** App-configured pull request event behavior. */
42
- pullRequestEvents?: GitHubPullRequestEventOptions;
43
- }
44
- /** Register GitHub runtime hooks for repository workflows. */
45
- export declare function githubPlugin(options?: GitHubPluginOptions): PluginRegistration;
@@ -1,22 +0,0 @@
1
- /**
2
- * The one write path for a pull request lifecycle outcome. The webhook and
3
- * the daily reconcile both use it, so the stored row, Junior's code index,
4
- * and the conversation chip change together.
5
- */
6
- import type { CodeChangeInput, CodeChangePublisher, PluginConversationAnnotations, PluginLogger } from "@sentry/junior-plugin-api";
7
- import type { GitHubDb } from "../db/database.js";
8
- import { type GitHubPullRequestOutcomeInput, recordGitHubPullRequestOutcome } from "./store.js";
9
- /** Write a pull request outcome as a code change in Junior's code index. */
10
- export declare function githubCodeChange(outcome: GitHubPullRequestOutcomeInput, conversationIds: string[]): CodeChangeInput;
11
- /**
12
- * Record one pull request outcome. When the stored row changes, update the
13
- * code index, and mark the chip of each linked conversation merged or closed.
14
- * A failed chip is logged, so it does not stop the work after it.
15
- */
16
- export declare function applyGitHubPullRequestOutcome(args: {
17
- annotations: PluginConversationAnnotations;
18
- codeChanges: CodeChangePublisher;
19
- db: GitHubDb;
20
- log?: Pick<PluginLogger, "error">;
21
- outcome: GitHubPullRequestOutcomeInput;
22
- }): Promise<Awaited<ReturnType<typeof recordGitHubPullRequestOutcome>>>;
@@ -1,6 +0,0 @@
1
- import type { GitHubPullRequestCommitComposition } from "../db/schema.js";
2
- /** Classify whether every Git author in a PR commit list is Junior's bot. */
3
- export declare function classifyGitHubPullRequestCommitComposition(args: {
4
- botEmail: string;
5
- loadPage(page: number, perPage: number): Promise<unknown>;
6
- }): Promise<GitHubPullRequestCommitComposition | undefined>;
@@ -1,42 +0,0 @@
1
- /**
2
- * The daily reconcile of open Junior pull requests.
3
- *
4
- * Only `pull_request` webhooks change a stored pull request. When GitHub
5
- * does not deliver a close, or its handler fails, the row stays open. Once a
6
- * day for each repository, the heartbeat reads the stored open rows from
7
- * GitHub with GraphQL. Each close goes through the webhook write path, with
8
- * its merged or closed_unmerged event. A changed draft state of an open pull
9
- * request goes through the same path, without an event. A pull request that
10
- * is still open also gets its current title in the code index. The writes are
11
- * guarded by `updatedAt`, so a replay cannot move a newer row back.
12
- */
13
- import type { CodeChangePublisher, EventPublisher, PluginConversationAnnotations, PluginConversationReviewItems, PluginLogger, PluginState } from "@sentry/junior-plugin-api";
14
- import type { GitHubDb } from "../db/database.js";
15
- import { type GitHubCommitPageLoader, type GitHubPullRequestTarget } from "../webhooks/pull-request-people.js";
16
- interface ReconcileArgs {
17
- annotations: PluginConversationAnnotations;
18
- botEmail?: string;
19
- codeChanges: CodeChangePublisher;
20
- db: GitHubDb;
21
- events: EventPublisher;
22
- /** Read the commits of one pull request, for the people of a merge. */
23
- loadCommitPages(target: GitHubPullRequestTarget): Promise<GitHubCommitPageLoader>;
24
- /**
25
- * Read the lifecycle of some pull requests with one GraphQL query. Throws
26
- * `GitHubRepositoryUnreachableError` when GitHub cannot reach the repository.
27
- */
28
- loadLifecycles(input: {
29
- numbers: number[];
30
- repositoryId: number;
31
- }): Promise<unknown>;
32
- log: Pick<PluginLogger, "error" | "warn">;
33
- nowMs: number;
34
- reviewItems: PluginConversationReviewItems;
35
- state: PluginState;
36
- }
37
- /**
38
- * Reconcile the next repository that has open Junior pull requests and was
39
- * not reconciled in the last day.
40
- */
41
- export declare function reconcileGitHubPullRequests(args: ReconcileArgs): Promise<void>;
42
- export {};
@@ -1,120 +0,0 @@
1
- import * as z from "zod";
2
- import type { GitHubDb } from "../db/database.js";
3
- import { type GitHubPullRequestAction, type GitHubPullRequestCommitComposition } from "../db/schema.js";
4
- declare const githubPullRequestOutcomeInputSchema: z.ZodObject<{
5
- candidateOwned: z.ZodBoolean;
6
- closedAt: z.ZodOptional<z.ZodDate>;
7
- commitComposition: z.ZodOptional<z.ZodEnum<{
8
- junior_only: "junior_only";
9
- mixed: "mixed";
10
- }>>;
11
- draft: z.ZodOptional<z.ZodBoolean>;
12
- mergedAt: z.ZodOptional<z.ZodDate>;
13
- number: z.ZodNumber;
14
- openedAt: z.ZodDate;
15
- pullRequestId: z.ZodString;
16
- repositoryFullName: z.ZodString;
17
- repositoryId: z.ZodString;
18
- state: z.ZodEnum<{
19
- closed_unmerged: "closed_unmerged";
20
- merged: "merged";
21
- open: "open";
22
- }>;
23
- title: z.ZodOptional<z.ZodString>;
24
- updatedAt: z.ZodDate;
25
- }, z.core.$strict>;
26
- export type GitHubPullRequestOutcomeInput = z.output<typeof githubPullRequestOutcomeInputSchema>;
27
- declare const githubPullRequestConversationsInputSchema: z.ZodObject<{
28
- conversationIds: z.ZodArray<z.ZodString>;
29
- pullRequestId: z.ZodString;
30
- }, z.core.$strict>;
31
- export type GitHubPullRequestConversationsInput = z.output<typeof githubPullRequestConversationsInputSchema>;
32
- declare const githubPullRequestLinkedIssuesInputSchema: z.ZodObject<{
33
- linkedIssues: z.ZodArray<z.ZodObject<{
34
- number: z.ZodNumber;
35
- repositoryFullName: z.ZodString;
36
- }, z.core.$strict>>;
37
- pullRequestId: z.ZodString;
38
- }, z.core.$strict>;
39
- export type GitHubPullRequestLinkedIssuesInput = z.output<typeof githubPullRequestLinkedIssuesInputSchema>;
40
- /**
41
- * Record the newest lifecycle projection for one Junior-owned pull request.
42
- * An ownership-qualified opening or terminal recovery inserts; later events
43
- * update existing rows, and older provider timestamps cannot regress it.
44
- * Returns the written row state so follow-up enrichment can remain idempotent.
45
- */
46
- export declare function recordGitHubPullRequestOutcome(db: GitHubDb, input: GitHubPullRequestOutcomeInput): Promise<{
47
- applied: boolean;
48
- commitComposition: GitHubPullRequestCommitComposition | undefined;
49
- conversationIds: string[];
50
- }>;
51
- /** Return candidate conversations that have an associated open pull request. */
52
- export declare function listGitHubUnfinishedWork(db: GitHubDb, conversationIds: string[]): Promise<string[]>;
53
- /**
54
- * Return the latest merge or close time for each candidate conversation.
55
- * A closed pull request is finished even when it did not merge. A
56
- * conversation with an open pull request is still unfinished; the caller
57
- * combines this with `listGitHubUnfinishedWork`.
58
- */
59
- export declare function listGitHubFinishedWork(db: GitHubDb, conversationIds: string[]): Promise<Record<string, string>>;
60
- /**
61
- * Return the open Junior pull requests whose last lifecycle change is
62
- * before `before`, oldest first. The daily reconcile checks these against
63
- * GitHub.
64
- */
65
- export declare function listGitHubStaleOpenPullRequests(db: GitHubDb, before: Date): Promise<Array<{
66
- draft: boolean;
67
- number: number;
68
- repositoryFullName: string;
69
- repositoryId: string;
70
- }>>;
71
- /** Return candidate conversations linked to any Junior-owned pull request. */
72
- export declare function listGitHubAssignedWork(db: GitHubDb, conversationIds: string[]): Promise<string[]>;
73
- /** Return the conversations linked to one Junior-owned pull request. */
74
- export declare function readGitHubPullRequestConversationIds(db: GitHubDb, pullRequestId: string): Promise<string[]>;
75
- /** Append native conversation ids to an existing Junior-owned PR projection. */
76
- export declare function recordGitHubPullRequestConversations(db: GitHubDb, input: GitHubPullRequestConversationsInput): Promise<boolean>;
77
- /** Link an existing Junior-owned PR to tracked issues across repositories. */
78
- export declare function recordGitHubPullRequestLinkedIssues(db: GitHubDb, input: GitHubPullRequestLinkedIssuesInput): Promise<boolean>;
79
- /** Match one pull request row by repository name, in any case, and number. */
80
- export declare function pullRequestRow(target: {
81
- number: number;
82
- repositoryFullName: string;
83
- }): import("drizzle-orm").SQL<unknown> | undefined;
84
- /**
85
- * Ask to check the next action of a Junior pull request, and claim the check
86
- * when no other webhook runs one. A claim older than `staleMs` is free.
87
- * Return the claim and the saved action, or undefined when another webhook
88
- * runs the check or Junior does not own the pull request. The webhook that
89
- * runs the check sees the new request in `releaseGitHubPullRequestReadySync`.
90
- */
91
- export declare function claimGitHubPullRequestReadySync(db: GitHubDb, target: {
92
- number: number;
93
- repositoryFullName: string;
94
- }, options: {
95
- now: Date;
96
- staleMs: number;
97
- }): Promise<{
98
- action: GitHubPullRequestAction | undefined;
99
- id: number;
100
- requests: number;
101
- } | undefined>;
102
- /** Save the next action of a Junior pull request. */
103
- export declare function setGitHubPullRequestNextAction(db: GitHubDb, target: {
104
- action: GitHubPullRequestAction | undefined;
105
- number: number;
106
- repositoryFullName: string;
107
- }): Promise<void>;
108
- /**
109
- * End a claimed check. When a webhook asked again during the check, keep the
110
- * claim and return the new request count, so the caller checks once more.
111
- * Return undefined when the claim ended or another webhook took it.
112
- */
113
- export declare function releaseGitHubPullRequestReadySync(db: GitHubDb, target: {
114
- number: number;
115
- repositoryFullName: string;
116
- }, claim: {
117
- id: number;
118
- requests: number;
119
- }): Promise<number | undefined>;
120
- export {};
@@ -1,15 +0,0 @@
1
- /**
2
- * The reviewers that a person named for a draft pull request.
3
- *
4
- * Junior asks for a review when it opens a pull request. A draft gets no
5
- * request, so GitHub does not notify the reviewers before the work is ready.
6
- * When the person named the reviewers, Junior saves them here, and the
7
- * `ready_for_review` webhook asks them. With no saved reviewers, that webhook
8
- * asks the requester.
9
- */
10
- import type { PluginState } from "@sentry/junior-plugin-api";
11
- import type { GitHubPullRequestTarget } from "../webhooks/pull-request-people.js";
12
- /** Save the reviewers that a person named for a draft pull request. */
13
- export declare function saveGitHubDraftReviewers(state: PluginState, target: GitHubPullRequestTarget, reviewers: string[]): Promise<void>;
14
- /** Return the reviewers that a person named for a draft pull request. */
15
- export declare function readGitHubDraftReviewers(state: PluginState, target: GitHubPullRequestTarget): Promise<string[] | undefined>;
@@ -1,41 +0,0 @@
1
- import type { GitHubDb } from "../db/database.js";
2
- /**
3
- * Save the person who asked Junior to open a pull request, after GitHub
4
- * opens it.
5
- *
6
- * `createdAt` is when the create call started. The row uses it, so the opener
7
- * stays the first row for the number. Any row for the number from before that
8
- * time belongs to an earlier repository with the same name, and is removed. A
9
- * retry of the same create call can call this again.
10
- */
11
- export declare function recordGitHubPullRequestOpener(db: GitHubDb, input: {
12
- conversationId: string;
13
- createdAt: Date;
14
- identityId: string;
15
- number: number;
16
- repositoryFullName: string;
17
- }): Promise<void>;
18
- /**
19
- * Add a person who asked Junior to update a pull request. A person who is
20
- * already a requester keeps their row, so the opener does not change.
21
- */
22
- export declare function recordGitHubPullRequestRequester(db: GitHubDb, input: {
23
- identityId: string;
24
- number: number;
25
- repositoryFullName: string;
26
- }): Promise<void>;
27
- /** The first person who asked Junior for a pull request. */
28
- export interface GitHubPullRequestOpener {
29
- /** Set only for the person who asked Junior to open it. */
30
- conversationId?: string;
31
- identityId: string;
32
- }
33
- /**
34
- * Load the first requester of each pull request. This is the person who
35
- * asked Junior to open it, or, when the create had no identity, the first
36
- * person who asked Junior to update it.
37
- */
38
- export declare function listGitHubPullRequestOpeners(db: GitHubDb, input: {
39
- numbers: number[];
40
- repositoryFullName: string;
41
- }): Promise<Map<number, GitHubPullRequestOpener>>;
@@ -1,6 +0,0 @@
1
- /** Deny APPROVE while allowing change requests, comments, and dismissals. */
2
- export declare function assertGitHubPullRequestApprovalDenied(input: {
3
- bodyText?: string;
4
- method: string;
5
- upstreamUrl: URL;
6
- }): void;
@@ -1,21 +0,0 @@
1
- /**
2
- * Git push policy for GitHub smart HTTP.
3
- *
4
- * Junior pushes with the App installation token, so a push lands as the App
5
- * no matter who asked. Junior proposes changes through pull requests. It
6
- * never updates or deletes the repository's default branch, and it pushes
7
- * only branches. Other protected branches rely on GitHub rulesets.
8
- */
9
- import { type PluginAuditAttributes, type PluginCache, type PluginGitPush } from "@sentry/junior-plugin-api";
10
- import type { GitHubRepository } from "./credential-support.js";
11
- import type { GitHubInstallationEnv } from "./webhooks/installation-requests.js";
12
- /**
13
- * Refuse a Git push that changes the default branch or a ref outside
14
- * `refs/heads/`. Returns the audit attributes for an allowed push.
15
- */
16
- export declare function assertGitHubPushAllowed(input: {
17
- cache: PluginCache;
18
- env: GitHubInstallationEnv;
19
- gitPush: PluginGitPush | undefined;
20
- repository: GitHubRepository;
21
- }): Promise<PluginAuditAttributes>;
@@ -1,18 +0,0 @@
1
- /**
2
- * Linkify GitHub autolinked references outside Markdown code and links.
3
- *
4
- * `owner/repo#123`, `owner/repo@sha`, and GitHub issue, pull request,
5
- * discussion, and commit URLs always become links. `#123`, `GH-123`,
6
- * `user@sha`, and full SHAs need a repository: the one that the text names,
7
- * else the `repo` config value when the text names none. `@login` becomes the
8
- * `mention` of the known person with that GitHub login. Other logins become
9
- * GitHub profile links when the text is GitHub text, or names a repository.
10
- * Chat `@name` words are often people who are not GitHub accounts. Set
11
- * `bareUrls` to keep bare URLs, where the place shows them as cards.
12
- */
13
- export declare function linkifyGitHubReferences(text: string, options?: {
14
- bareUrls?: boolean;
15
- config?: Record<string, string>;
16
- githubText?: boolean;
17
- mention?: (login: string) => string | undefined;
18
- }): string;
@@ -1,4 +0,0 @@
1
- /** Sandbox root directories reserved for Junior runtime material. */
2
- export declare const RESERVED_SANDBOX_DIRECTORIES: Set<string>;
3
- /** True when a checkout path collides with a reserved sandbox root (case-insensitive). */
4
- export declare function isReservedSandboxDirectory(path: string): boolean;
@@ -1,52 +0,0 @@
1
- import type { Actor, Identity, PluginEgress, PluginLogger, Source, User } from "@sentry/junior-plugin-api";
2
- export declare const GITHUB_REQUEST_ATTRIBUTION_START = "<!-- junior-request-attribution:start -->";
3
- export declare const GITHUB_REQUEST_ATTRIBUTION_END = "<!-- junior-request-attribution:end -->";
4
- /** Return a GitHub login without a leading `@`, when it is a valid login. */
5
- export declare function parseGitHubLogin(value: string | undefined): string | undefined;
6
- /**
7
- * Return the GitHub login linked to a user, when it is a valid login.
8
- *
9
- * Attribution mentions, PR assignment, and review requests use this login so
10
- * the requester gets GitHub notifications for the issue or pull request.
11
- */
12
- export declare function linkedGitHubLogin(user: User | undefined): string | undefined;
13
- /**
14
- * Read the body that is on GitHub now, so an update keeps its requesters.
15
- * The model sees descriptions with the attribution block removed.
16
- */
17
- export declare function readGitHubBody(egress: PluginEgress, input: {
18
- operation: string;
19
- path: string;
20
- }): Promise<string | undefined>;
21
- /** The stored Junior identity and user of the Actor that makes a GitHub write. */
22
- export interface GitHubRequester {
23
- identity?: Identity;
24
- user?: User;
25
- }
26
- /**
27
- * Look up the current Actor once for one GitHub write. The attribution block,
28
- * the saved pull request requester, and the assignee all use this one result.
29
- *
30
- * System actors have no requester. The lookup is best effort: a failure is
31
- * logged and gives no requester, so it never blocks the write.
32
- */
33
- export declare function resolveGitHubRequester(ctx: {
34
- actor?: Actor;
35
- log: PluginLogger;
36
- users: {
37
- resolveActor(): Promise<GitHubRequester | undefined>;
38
- };
39
- }): Promise<GitHubRequester | undefined>;
40
- /**
41
- * Append or replace runtime-owned requester attribution in a GitHub body.
42
- * Pass `currentBody` on updates so requesters already on GitHub are kept.
43
- * With no stored requester, the label falls back to the already-hydrated
44
- * actor profile.
45
- */
46
- export declare function appendGitHubRequesterAttribution(body: string, ctx: {
47
- actor?: Actor;
48
- automationLink?: {
49
- url: string;
50
- };
51
- source?: Source;
52
- }, requester: GitHubRequester | undefined, currentBody?: string): string;
@@ -1,51 +0,0 @@
1
- import { type PluginEgress } from "@sentry/junior-plugin-api";
2
- /** A GitHub API reply with its body parsed as JSON, or as text when it is not JSON. */
3
- export interface GitHubApiResponse {
4
- body: unknown;
5
- ok: boolean;
6
- status: number;
7
- }
8
- /**
9
- * Send one GitHub API request through host egress.
10
- *
11
- * Egress injects credentials, so tools never see a token. `operation` names
12
- * the provider action for grant selection and diagnostics. Callers own the
13
- * error mapping, because the status that means bad input differs per route.
14
- * `followRedirects` follows GET redirects on the GitHub API host. Set it only
15
- * when the caller reads the object identity from the response, because the
16
- * redirect target can be in another repository.
17
- */
18
- export declare function githubApi(egress: PluginEgress, input: {
19
- apiVersion?: string;
20
- body?: unknown;
21
- followRedirects?: boolean;
22
- method?: "DELETE" | "GET" | "PATCH" | "POST" | "PUT";
23
- operation: string;
24
- path: string;
25
- signal?: AbortSignal;
26
- }): Promise<GitHubApiResponse>;
27
- /**
28
- * Return where a `github.com` attachment URL redirects, through host
29
- * egress. GitHub signs that address for a short time, so it needs no
30
- * credential. Egress does not follow the redirect, so the credential never
31
- * reaches the image host.
32
- */
33
- export declare function githubAttachmentLocation(egress: PluginEgress, url: string): Promise<string | undefined>;
34
- /** Return the `/repos/{owner}/{name}` API path prefix for a parsed repo. */
35
- export declare function repoPath(repo: {
36
- name: string;
37
- owner: string;
38
- }): string;
39
- /** Parse a model-supplied `owner/name` repository reference. */
40
- export declare function parseRepo(value: string): {
41
- name: string;
42
- owner: string;
43
- ref: string;
44
- };
45
- /**
46
- * Return a readable error from a GitHub REST or GraphQL error body.
47
- *
48
- * REST validation errors list the failed fields in `errors`, and GraphQL puts
49
- * every message in `errors`. Both details help the model fix its input.
50
- */
51
- export declare function githubErrorMessage(body: unknown): string;
@@ -1,8 +0,0 @@
1
- import type { PluginToolDefinition } from "@sentry/junior-plugin-api";
2
- /**
3
- * Make every GitHub tool send GitHub text. The model reads Slack threads, so
4
- * it can copy Slack mention syntax into a title, body, or comment. GitHub
5
- * shows that syntax as literal text, so core rewrites it before the tool
6
- * runs: a Slack user becomes their linked GitHub `@login`, or their name.
7
- */
8
- export declare function withGitHubText(tools: Record<string, PluginToolDefinition>): Record<string, PluginToolDefinition>;
@@ -1,8 +0,0 @@
1
- import { type PluginDecider } from "@sentry/junior-plugin-api";
2
- /** List the fixes that a pull request description needs. Empty means it passes. */
3
- export declare function pullRequestDescriptionFixes(decider: PluginDecider, body: string): Promise<string[]>;
4
- /**
5
- * Reject a pull request description that has what reviewers do not need.
6
- * The agent gets the reasons as a tool input error and sends a better body.
7
- */
8
- export declare function checkPullRequestDescription(decider: PluginDecider, body: string): Promise<void>;