@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,15 +0,0 @@
1
- /**
2
- * Default branch lookup for the Git push policy.
3
- *
4
- * The egress grant hook decides whether a push may leave the sandbox, so it
5
- * cannot read GitHub through host egress. This file calls GitHub directly,
6
- * with a metadata-only installation token.
7
- */
8
- import type { PluginCache } from "@sentry/junior-plugin-api";
9
- import { type GitHubRepository } from "./credential-support.js";
10
- import type { GitHubInstallationEnv } from "./webhooks/installation-requests.js";
11
- /**
12
- * Read a repository's default branch with a metadata-only installation
13
- * token. Results are cached for ten minutes.
14
- */
15
- export declare function loadDefaultBranch(env: GitHubInstallationEnv, cache: PluginCache, repository: GitHubRepository): Promise<string>;
@@ -1,25 +0,0 @@
1
- /**
2
- * GitHub egress policy and grant selection.
3
- *
4
- * Owns which GitHub requests Junior may make and which credential grant
5
- * each request needs. Junior-owned issue, pull request, review, and push
6
- * writes never fall back to user OAuth. Merge, fork, branch deletion, REST ref
7
- * writes, and administration stay unsupported; unknown REST writes and
8
- * GraphQL mutations are denied. Git pushes never touch the default branch.
9
- */
10
- import { type EgressHookContext, type EgressResponseHookContext } from "@sentry/junior-plugin-api";
11
- import type { GitHubInstallationEnv } from "./webhooks/installation-requests.js";
12
- import { type GitHubGrant } from "./credential-support.js";
13
- /**
14
- * Classify a GitHub response as a permission denial.
15
- *
16
- * Returns a message only when GitHub says that the credential lacks access.
17
- * Other GitHub refusals return undefined, so the runtime does not call them
18
- * permission problems.
19
- */
20
- export declare function githubPermissionDeniedMessage(ctx: EgressResponseHookContext): Promise<string | undefined>;
21
- /**
22
- * Select the GitHub grant for one egress request, and name its repository
23
- * for the write audit event.
24
- */
25
- export declare function githubGrantForEgress(ctx: EgressHookContext, env: GitHubInstallationEnv): Promise<GitHubGrant>;
@@ -1,14 +0,0 @@
1
- import { type EventMatchFields } from "@sentry/junior-plugin-api";
2
- /**
3
- * Filters on the GitHub user who sent the webhook: who wrote a comment or
4
- * review, or who made an issue update. Resource types that merge these maps
5
- * keep one description, so it names every case.
6
- */
7
- export declare function gitHubSenderMatchFields(events: readonly string[]): EventMatchFields;
8
- /**
9
- * Filters on a GitHub comment or review: who wrote it and whether it mentions
10
- * the App. Issue comments, pull request comments, reviews, and inline review
11
- * comments set them, so the issue, pull request, and repository resource types
12
- * share one definition.
13
- */
14
- export declare function gitHubCommentMatchFields(events: readonly string[]): EventMatchFields;
@@ -1,18 +0,0 @@
1
- import type { PluginEventDeclaration } from "@sentry/junior-plugin-api";
2
- import { type GitHubPullRequestEvent } from "./pull-request.js";
3
- /**
4
- * Declare the reach and guidance of every GitHub event.
5
- *
6
- * - Deployment events reach every repository. They carry status facts,
7
- * Junior adds no reaction, and they load nothing from GitHub.
8
- * - Release, issue, and pull request events need a `repo` filter. They carry
9
- * release notes, titles, bodies, comments, or reviews from repositories
10
- * that can be private, and comments and reviews make Junior add a
11
- * reaction. The filter limits how many repositories a trigger covers. It
12
- * does not check that the person can see the repository.
13
- *
14
- * Pull request filters such as `authors` and `openerRole` load data from
15
- * GitHub. Core skips a trigger with no identifier when its `repo` filter does
16
- * not match the event, so it loads nothing for other repositories.
17
- */
18
- export declare function gitHubEventDeclarations(pullRequestGuidance: Partial<Record<GitHubPullRequestEvent, string>>): Record<string, PluginEventDeclaration>;
@@ -1,38 +0,0 @@
1
- import { type SubscribableResource } from "@sentry/junior-plugin-api";
2
- export declare const GITHUB_DEPLOYMENT_EVENTS: readonly ["deployment.created", "deployment.queued", "deployment.pending", "deployment.in_progress", "deployment.succeeded", "deployment.failed", "deployment.error"];
3
- export declare const GITHUB_DEPLOYMENT_SUGGESTED_EVENTS: string[];
4
- /**
5
- * Trusted deployment values that watches and event automations can match.
6
- * Every deployment event sets them; the repository resource type also has
7
- * events that do not.
8
- */
9
- export declare const GITHUB_DEPLOYMENT_MATCH_FIELDS: Record<string, {
10
- kind: "boolean" | "number" | "string";
11
- description: string;
12
- enum?: string[] | undefined;
13
- list?: true | undefined;
14
- case?: "lower" | "upper" | undefined;
15
- events?: string[] | undefined;
16
- }>;
17
- /** The identifier shape that `gitHubDeploymentSourceResource` builds. */
18
- export declare const GITHUB_DEPLOYMENT_SOURCE_IDENTIFIER: {
19
- format: string;
20
- pattern: string;
21
- };
22
- /** Build the stable deployment-source identity shared by tools and webhooks. */
23
- export declare function gitHubDeploymentSourceResource(input: {
24
- commitSha: string;
25
- environment?: string;
26
- repo: string;
27
- }): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
28
- /**
29
- * Describe a deployment source that a conversation can watch.
30
- * Return undefined when the host cannot create Watches.
31
- */
32
- export declare function gitHubDeploymentSourceSubscribable(input: {
33
- /** `ctx.events.canSubscribe` from the tool context. */
34
- canSubscribe: boolean;
35
- commitSha: string;
36
- environment?: string;
37
- repo: string;
38
- }): SubscribableResource | undefined;
@@ -1,42 +0,0 @@
1
- import { type SubscribableResource } from "@sentry/junior-plugin-api";
2
- export declare const GITHUB_ISSUE_EVENTS: string[];
3
- export declare const GITHUB_ISSUE_SUGGESTED_EVENTS: string[];
4
- /**
5
- * The `issues` webhook actions that `issue.updated` publishes. The webhook
6
- * schema and the `change` match field both use this list.
7
- */
8
- export declare const GITHUB_ISSUE_UPDATE_CHANGES: readonly ["edited", "labeled", "unlabeled", "assigned", "unassigned", "milestoned", "demilestoned"];
9
- /**
10
- * Exact values GitHub sets on issue event data. Every issue event sets the
11
- * repository and issue number. Comments and updates set who acted. Only
12
- * updates set `change` and `label`, so an automation can run on one label
13
- * that one person adds without the model deciding from untrusted text.
14
- */
15
- export declare const GITHUB_ISSUE_MATCH_FIELDS: Record<string, {
16
- kind: "boolean" | "number" | "string";
17
- description: string;
18
- enum?: string[] | undefined;
19
- list?: true | undefined;
20
- case?: "lower" | "upper" | undefined;
21
- events?: string[] | undefined;
22
- }>;
23
- /** The identifier shape that `gitHubIssueResource` builds. */
24
- export declare const GITHUB_ISSUE_IDENTIFIER: {
25
- format: string;
26
- pattern: string;
27
- };
28
- /** Build the stable issue identity shared by tools and webhooks. */
29
- export declare function gitHubIssueResource(input: {
30
- number: number;
31
- repo: string;
32
- }): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
33
- /**
34
- * Describe an issue as a resource that a conversation can watch.
35
- * Return undefined when the host cannot create Watches.
36
- */
37
- export declare function gitHubIssueSubscribable(input: {
38
- /** `ctx.events.canSubscribe` from the tool context. */
39
- canSubscribe: boolean;
40
- number: number;
41
- repo: string;
42
- }): SubscribableResource | undefined;
@@ -1,75 +0,0 @@
1
- import { type SubscribableResource } from "@sentry/junior-plugin-api";
2
- export declare const GITHUB_PULL_REQUEST_EVENTS: readonly ["pull_request.checks.failed", "pull_request.checks.recovered", "pull_request.comment.created", "pull_request.opened", "pull_request.ready_for_review", "pull_request.review.approved", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
3
- export type GitHubPullRequestEvent = (typeof GITHUB_PULL_REQUEST_EVENTS)[number];
4
- /** Combine provider defaults with app guidance for pull request events. */
5
- export declare function gitHubPullRequestEventGuidance(guidance?: Partial<Record<GitHubPullRequestEvent, string>>): Partial<Record<GitHubPullRequestEvent, string>>;
6
- /** App-configured pull request event behavior. */
7
- export interface GitHubPullRequestEventOptions {
8
- /** App guidance applied within the matching subscription or event automation instruction. */
9
- guidance?: Partial<Record<GitHubPullRequestEvent, string>>;
10
- /**
11
- * Temporary subscription created after Junior creates a pull request.
12
- * Defaults to the maintenance Watch below. `false` turns it off.
13
- */
14
- subscribeAfterCreate?: GitHubPullRequestSubscriptionConfig | false;
15
- }
16
- /** Temporary subscription created after Junior creates a pull request. */
17
- export interface GitHubPullRequestSubscriptionConfig {
18
- events: GitHubPullRequestEvent[];
19
- intent: string;
20
- }
21
- /** Resolve the Watch to create after Junior creates a pull request, if any. */
22
- export declare function gitHubPullRequestSubscription(config: GitHubPullRequestSubscriptionConfig | false | undefined): GitHubPullRequestSubscriptionConfig | undefined;
23
- /**
24
- * Build the Watch created after Junior creates a pull request. Only a draft
25
- * Watch gets passing checks, so a ready pull request is not woken by each
26
- * passing check suite.
27
- */
28
- export declare function gitHubPullRequestCreateWatch(config: GitHubPullRequestSubscriptionConfig, pullRequest: {
29
- draft: boolean;
30
- }): {
31
- events: GitHubPullRequestEvent[];
32
- guidance: Partial<Record<GitHubPullRequestEvent, string>>;
33
- intent: string;
34
- };
35
- export declare const GITHUB_PULL_REQUEST_SUGGESTED_EVENTS: readonly ["pull_request.checks.failed", "pull_request.comment.created", "pull_request.ready_for_review", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
36
- /**
37
- * Exact values GitHub may set on pull request event data. Missing keys do not
38
- * match. The opener and author values load in
39
- * `webhooks/pull-request-match-data.ts` for every payload pull request event.
40
- * The pull request comment webhook has no head branch. A check suite result
41
- * that GitHub links to no pull request has no `pullRequest`. The webhook
42
- * checks for a Watch or event automation before it reads a pull request for
43
- * a conflict, so `pull_request.merge_conflict` matches only `repo` and
44
- * `pullRequest`.
45
- */
46
- export declare const GITHUB_PULL_REQUEST_MATCH_FIELDS: Record<string, {
47
- kind: "boolean" | "number" | "string";
48
- description: string;
49
- enum?: string[] | undefined;
50
- list?: true | undefined;
51
- case?: "lower" | "upper" | undefined;
52
- events?: string[] | undefined;
53
- }>;
54
- /** The identifier shape that `gitHubPullRequestResource` builds. */
55
- export declare const GITHUB_PULL_REQUEST_IDENTIFIER: {
56
- format: string;
57
- pattern: string;
58
- };
59
- /** Build the stable pull request identity shared by tools and webhooks. */
60
- export declare function gitHubPullRequestResource(input: {
61
- number: number;
62
- repo: string;
63
- }): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
64
- /**
65
- * Describe a pull request as a resource that a conversation can watch.
66
- * Return undefined when the host cannot create Watches.
67
- */
68
- export declare function gitHubPullRequestSubscribable(input: {
69
- /** `ctx.events.canSubscribe` from the tool context. */
70
- canSubscribe: boolean;
71
- number: number;
72
- repo: string;
73
- /** Events already covered by a forced subscription; omit them from suggestions. */
74
- omitSuggestedEvents?: readonly string[];
75
- }): SubscribableResource | undefined;
@@ -1,42 +0,0 @@
1
- import { type SubscribableResource } from "@sentry/junior-plugin-api";
2
- import * as z from "zod";
3
- export declare const GITHUB_RELEASE_EVENTS: readonly ["release.published"];
4
- /**
5
- * `tag` in event data: the trimmed tag with ASCII letters in lowercase. The
6
- * release-source identifier has the URI-encoded tag, and the plugin
7
- * lowercases identifiers. Encoding turns other characters into `%XX`
8
- * escapes, so only ASCII letters change case there. This form is the same
9
- * text, so `release/1.0` is not `release%2f1.0`, and `Ü` stays `Ü`. To turn
10
- * an identifier into a `tag` filter, decode its tag part.
11
- */
12
- export declare const gitHubReleaseTagDataSchema: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
13
- /** Exact values that every release event sets. */
14
- export declare const GITHUB_RELEASE_MATCH_FIELDS: Record<string, {
15
- kind: "boolean" | "number" | "string";
16
- description: string;
17
- enum?: string[] | undefined;
18
- list?: true | undefined;
19
- case?: "lower" | "upper" | undefined;
20
- events?: string[] | undefined;
21
- }>;
22
- export declare const GITHUB_RELEASE_SUGGESTED_EVENTS: string[];
23
- /** The identifier shape that `gitHubReleaseSourceResource` builds. */
24
- export declare const GITHUB_RELEASE_SOURCE_IDENTIFIER: {
25
- format: string;
26
- pattern: string;
27
- };
28
- /** Build the stable release-source identity shared by tools and webhooks. */
29
- export declare function gitHubReleaseSourceResource(input: {
30
- repo: string;
31
- tag?: string;
32
- }): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
33
- /**
34
- * Describe a release source that a conversation can watch.
35
- * Return undefined when the host cannot create Watches.
36
- */
37
- export declare function gitHubReleaseSourceSubscribable(input: {
38
- /** `ctx.events.canSubscribe` from the tool context. */
39
- canSubscribe: boolean;
40
- repo: string;
41
- tag?: string;
42
- }): SubscribableResource | undefined;
@@ -1,23 +0,0 @@
1
- import type { SubscribableResource } from "@sentry/junior-plugin-api";
2
- /** The identifier shape that `gitHubRepositoryResource` builds. */
3
- export declare const GITHUB_REPOSITORY_IDENTIFIER: {
4
- format: string;
5
- pattern: string;
6
- };
7
- /** Build the stable repository identity shared by tools and webhooks. */
8
- export declare function gitHubRepositoryResource(input: {
9
- repo: string;
10
- }): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
11
- /** Events that a repository Watch gets: deployments, issues, and pull requests. */
12
- export declare const GITHUB_REPOSITORY_EVENTS: readonly ["deployment.created", "deployment.queued", "deployment.pending", "deployment.in_progress", "deployment.succeeded", "deployment.failed", "deployment.error", ...string[], "pull_request.checks.failed", "pull_request.checks.recovered", "pull_request.comment.created", "pull_request.opened", "pull_request.ready_for_review", "pull_request.review.approved", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
13
- /** Repository events to suggest when a conversation starts a Watch. */
14
- export declare const GITHUB_REPOSITORY_SUGGESTED_EVENTS: readonly ["issue.opened", "pull_request.opened", ...string[], "pull_request.checks.failed", "pull_request.comment.created", "pull_request.ready_for_review", "pull_request.review.changes_requested", "pull_request.review.commented", "pull_request.review_comment.created", "pull_request.merged", "pull_request.closed_unmerged", "pull_request.merge_conflict"];
15
- /**
16
- * Describe a repository as a resource that a conversation can watch.
17
- * Return undefined when the host cannot create Watches.
18
- */
19
- export declare function gitHubRepositorySubscribable(input: {
20
- /** `ctx.events.canSubscribe` from the tool context. */
21
- canSubscribe: boolean;
22
- repo: string;
23
- }): SubscribableResource | undefined;
@@ -1,5 +0,0 @@
1
- /** Name the github.com page of one watched resource, when it has one. */
2
- export declare function gitHubResourceUrl(input: {
3
- identifier: string;
4
- resourceType: string;
5
- }): string | undefined;
@@ -1,13 +0,0 @@
1
- import { type EventMatchFields } from "@sentry/junior-plugin-api";
2
- import * as z from "zod";
3
- /**
4
- * `repo` in event data: lowercase `owner/repo`. GitHub ignores case in
5
- * repository names, so tools accept this form.
6
- */
7
- export declare const gitHubRepoDataSchema: z.ZodString;
8
- /** `commitSha` in event data: the full lowercase commit SHA. */
9
- export declare const gitHubCommitShaDataSchema: z.ZodString;
10
- /** Filter on the repository of an event. */
11
- export declare function gitHubRepoMatchFields(events: readonly string[]): EventMatchFields;
12
- /** Filter on the commit of an event. */
13
- export declare function gitHubCommitMatchFields(events: readonly string[]): EventMatchFields;
@@ -1,52 +0,0 @@
1
- /**
2
- * Git identity and commit-hook setup for GitHub sandboxes.
3
- */
4
- import type { Actor, PluginEnv, SandboxPrepareHookContext, User } from "@sentry/junior-plugin-api";
5
- /**
6
- * Build `Co-Authored-By` trailers crediting human run actors.
7
- *
8
- * `run.actors` is attribution only (see `multi-actor-runs.md`): a steerer
9
- * without a resolvable name and email is silently omitted rather than
10
- * denying the commit. Dedupes by identity and resolved email so the same human
11
- * under two display profiles, or an actor matching the bot identity, only ever
12
- * produces one line.
13
- *
14
- * When the current actor has a linked GitHub identity, prefer that noreply
15
- * address so external automation can resolve a login for assignment.
16
- */
17
- export declare function additionalActorCoauthorTrailers(args: {
18
- actors?: Actor[];
19
- botEmail: string;
20
- /** Linked user for the current run actor, when already resolved. */
21
- currentUser?: User;
22
- }): string[];
23
- /**
24
- * Client hooks that Junior's hooks directory passes to the repository.
25
- *
26
- * Junior's `core.hooksPath` replaces the repository hooks directory: the
27
- * repository's own `core.hooksPath` (husky) or `.git/hooks` (simple-git-hooks,
28
- * Git LFS). Git would skip those hooks without these pass-through hooks.
29
- * `prepare-commit-msg` is not in the list because Junior's own hook runs the
30
- * repository hook first.
31
- */
32
- export declare const REPOSITORY_HOOK_NAMES: readonly ["applypatch-msg", "pre-applypatch", "post-applypatch", "pre-commit", "pre-merge-commit", "commit-msg", "post-commit", "pre-rebase", "post-checkout", "post-merge", "pre-push", "post-rewrite", "pre-auto-gc"];
33
- /** Directory for Junior's Git hooks under the sandbox Junior root. */
34
- export declare function gitHooksPath(juniorRoot: string): string;
35
- /**
36
- * Point Git at Junior's hooks for one command.
37
- *
38
- * Command env config has a higher priority than every config file, so it
39
- * also wins over a repository `core.hooksPath` such as husky's.
40
- */
41
- export declare function setGitHooksPathEnv(env: PluginEnv, hooksPath: string): void;
42
- /** Build a hook that runs the repository's own hook with the same name. */
43
- export declare function repositoryHook(name: string): string;
44
- /** Build the hook that replaces model-supplied commit attribution. */
45
- export declare function prepareCommitMsgHook(): string;
46
- /**
47
- * Write Junior's Git hooks and global Git config inside the sandbox.
48
- *
49
- * This runs on every sandbox acquire, and each sandbox call is one provider
50
- * round trip, so all of the setup is one command.
51
- */
52
- export declare function prepareSandboxGit(ctx: SandboxPrepareHookContext): Promise<void>;
@@ -1,16 +0,0 @@
1
- import type { PluginCache } from "@sentry/junior-plugin-api";
2
- /** One incident from githubstatus.com. */
3
- export type GitHubStatusIncident = {
4
- components: string[];
5
- impact: string;
6
- name: string;
7
- resolvedAt?: string;
8
- startedAt: string;
9
- status: string;
10
- url: string;
11
- };
12
- /**
13
- * Read GitHub incidents that are open, or that were resolved within
14
- * `withinMs`. Callers share one cached read of githubstatus.com.
15
- */
16
- export declare function loadGitHubStatusIncidents(cache: PluginCache, withinMs: number): Promise<GitHubStatusIncident[]>;
@@ -1,31 +0,0 @@
1
- /** The `operationName` and `query` of one GraphQL request body. */
2
- export interface GitHubGraphqlOperation {
3
- operationName: string;
4
- query: string;
5
- }
6
- /** Add one reaction to a review body. */
7
- export declare const ADD_REVIEW_REACTION: GitHubGraphqlOperation;
8
- /** Remove one reaction from a review body. */
9
- export declare const REMOVE_REVIEW_REACTION: GitHubGraphqlOperation;
10
- /** Read the reactions of a review body, with the bots that added them. */
11
- export declare const REVIEW_REACTIONS: GitHubGraphqlOperation;
12
- /** Mark a draft pull request ready for review. */
13
- export declare const MARK_PULL_REQUEST_READY_FOR_REVIEW: GitHubGraphqlOperation;
14
- /** Convert a pull request to a draft. */
15
- export declare const CONVERT_PULL_REQUEST_TO_DRAFT: GitHubGraphqlOperation;
16
- /** Read a review thread with the pull request that owns it. */
17
- export declare const REVIEW_THREAD_OWNERSHIP: GitHubGraphqlOperation;
18
- /** Resolve a review thread. */
19
- export declare const RESOLVE_REVIEW_THREAD: GitHubGraphqlOperation;
20
- /**
21
- * Read the merge state of one pull request and the checks of its head
22
- * commit, with whether each check is required.
23
- */
24
- export declare const PULL_REQUEST_CHECKS: GitHubGraphqlOperation;
25
- /** Read one page of a pull request search, with mergeability. */
26
- export declare const OPEN_PULL_REQUEST_MERGEABILITY: GitHubGraphqlOperation;
27
- /**
28
- * Return the query that reads the lifecycle of `count` pull requests of one
29
- * repository. Pull request `i` has the alias `pr<i>` and the variable `$n<i>`.
30
- */
31
- export declare function pullRequestLifecycles(count: number): GitHubGraphqlOperation;
package/dist/images.d.ts DELETED
@@ -1,8 +0,0 @@
1
- /**
2
- * Description images of GitHub objects, served through the Junior image
3
- * route. Each read checks that the viewer's linked GitHub account can see
4
- * the repository. Only then does Junior fetch the image with the App.
5
- */
6
- import { type PluginImageSource } from "@sentry/junior-plugin-api";
7
- /** Serve the description images of GitHub objects to viewers who can see the repository. */
8
- export declare const githubImageSource: PluginImageSource;
@@ -1,42 +0,0 @@
1
- import * as z from "zod";
2
- import type { GitHubDb } from "../db/database.js";
3
- declare const githubIssueOutcomeInputSchema: z.ZodObject<{
4
- candidateOwned: z.ZodBoolean;
5
- closedAt: z.ZodOptional<z.ZodDate>;
6
- issueId: z.ZodString;
7
- number: z.ZodNumber;
8
- openedAt: z.ZodDate;
9
- repositoryFullName: z.ZodString;
10
- repositoryId: z.ZodString;
11
- state: z.ZodEnum<{
12
- closed: "closed";
13
- open: "open";
14
- }>;
15
- stateReason: z.ZodOptional<z.ZodEnum<{
16
- completed: "completed";
17
- duplicate: "duplicate";
18
- not_planned: "not_planned";
19
- reopened: "reopened";
20
- }>>;
21
- updatedAt: z.ZodDate;
22
- }, z.core.$strict>;
23
- export type GitHubIssueOutcomeInput = z.output<typeof githubIssueOutcomeInputSchema>;
24
- declare const githubIssueConversationsInputSchema: z.ZodObject<{
25
- conversationIds: z.ZodArray<z.ZodString>;
26
- issueId: z.ZodString;
27
- }, z.core.$strict>;
28
- export type GitHubIssueConversationsInput = z.output<typeof githubIssueConversationsInputSchema>;
29
- /**
30
- * Record the newest lifecycle projection for one Junior-owned issue.
31
- * Ownership-qualified opening or closing events insert; later events update
32
- * existing rows, and older provider timestamps cannot regress them.
33
- * Returns the written row state so follow-up annotation updates stay scoped to
34
- * associated conversations.
35
- */
36
- export declare function recordGitHubIssueOutcome(db: GitHubDb, input: GitHubIssueOutcomeInput): Promise<{
37
- applied: boolean;
38
- conversationIds: string[];
39
- }>;
40
- /** Append native conversation ids to an existing Junior-owned issue projection. */
41
- export declare function recordGitHubIssueConversations(db: GitHubDb, input: GitHubIssueConversationsInput): Promise<boolean>;
42
- export {};
@@ -1,27 +0,0 @@
1
- /**
2
- * The heartbeat part of merge conflict checks. For each due repository, a
3
- * GraphQL search reads the open Junior pull requests with their
4
- * mergeability.
5
- * Only a conflict that a Watch or event automation wants publishes
6
- * `pull_request.merge_conflict`. No agent runs for the check.
7
- */
8
- import type { EventPublisher, PluginLogger, PluginState } from "@sentry/junior-plugin-api";
9
- import type { GitHubDb } from "../db/database.js";
10
- type SearchOpenPullRequests = (input: {
11
- after?: string;
12
- repositoryFullName: string;
13
- }) => Promise<unknown>;
14
- interface CheckArgs {
15
- db: GitHubDb;
16
- events: EventPublisher;
17
- log: Pick<PluginLogger, "error">;
18
- now: Date;
19
- search: SearchOpenPullRequests;
20
- state: PluginState;
21
- }
22
- /**
23
- * Run the merge conflict checks that are due. Only a repository with open
24
- * Junior pull requests can have a check.
25
- */
26
- export declare function runGitHubConflictChecks(args: CheckArgs): Promise<void>;
27
- export {};
@@ -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">;