@sentry/junior-github 0.181.1 → 0.182.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.
package/dist/plugin.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * GitHub plugin runtime boundary.
3
3
  *
4
- * This module composes GitHub hooks and owns GitHub egress policy.
4
+ * This module composes GitHub hooks, resource events, and credentials.
5
5
  */
6
6
  import { type PluginRegistration } from "@sentry/junior-plugin-api";
7
7
  import { type GitHubAppPermissions } from "./permissions.js";
@@ -1,4 +1,4 @@
1
- import type { SubscribableResource } from "@sentry/junior-plugin-api";
1
+ import { type SubscribableResource } from "@sentry/junior-plugin-api";
2
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"];
3
3
  export type GitHubPullRequestEvent = (typeof GITHUB_PULL_REQUEST_EVENTS)[number];
4
4
  /** App-configured pull request resource event behavior. */
@@ -14,6 +14,12 @@ export interface GitHubPullRequestSubscriptionConfig {
14
14
  intent: string;
15
15
  }
16
16
  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"];
17
+ /** Exact values GitHub may set on pull request event data. Missing keys do not match. */
18
+ export declare const GITHUB_PULL_REQUEST_MATCH_FIELDS: Record<string, {
19
+ kind: "string" | "number" | "boolean";
20
+ description: string;
21
+ enum?: string[] | undefined;
22
+ }>;
17
23
  /** Build the stable pull request identity shared by tools and webhooks. */
18
24
  export declare function gitHubPullRequestResource(input: {
19
25
  number: number;
package/dist/testing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeGitHubResourceEvents
3
- } from "./chunk-GXZVNEIB.js";
3
+ } from "./chunk-JROTRF27.js";
4
4
  export {
5
5
  normalizeGitHubResourceEvents
6
6
  };
@@ -0,0 +1,69 @@
1
+ /**
2
+ * GitHub check suite resource events.
3
+ */
4
+ import type { ResourceEventInput } from "@sentry/junior-plugin-api";
5
+ export type GitHubFailingCheck = {
6
+ checkRunId: number;
7
+ conclusion: string;
8
+ htmlUrl?: string;
9
+ name: string;
10
+ };
11
+ /** Pull request values filled in when the check suite body omits them. */
12
+ export type GitHubCheckSuitePullRequestFacts = {
13
+ authorEmail?: string;
14
+ authorUsername?: string;
15
+ isDraft?: boolean;
16
+ };
17
+ /** Optional values for one check suite event. */
18
+ export type GitHubCheckSuiteFacts = {
19
+ failingChecks?: GitHubFailingCheck[];
20
+ /** Pull request values by number when GitHub omitted them on the suite. */
21
+ pullRequestFactsByNumber?: Record<number, GitHubCheckSuitePullRequestFacts>;
22
+ };
23
+ /** Build a browser URL for one check suite. GitHub does not send html_url. */
24
+ export declare function buildCheckSuiteUrl(args: {
25
+ checkSuiteId: number;
26
+ headSha: string;
27
+ repo: string;
28
+ }): string;
29
+ /** Build the trusted data and summary for one check-suite PR event. */
30
+ export declare function buildCheckSuiteResourceEvent(args: {
31
+ appName?: string;
32
+ authorEmail?: string;
33
+ authorUsername?: string;
34
+ checkSuiteId?: number;
35
+ deliveryId: string;
36
+ eventType: "pull_request.checks.failed" | "pull_request.checks.recovered";
37
+ failingChecks?: GitHubFailingCheck[];
38
+ headSha?: string;
39
+ isDraft?: boolean;
40
+ latestCheckRunsCount?: number;
41
+ pullRequestNumber: number;
42
+ repo: string;
43
+ suiteConclusion: string;
44
+ }): ResourceEventInput;
45
+ /** Keep only failed check runs from one suite. */
46
+ export declare function selectFailingChecks(checkRuns: unknown, options?: {
47
+ checkSuiteId?: number;
48
+ }): GitHubFailingCheck[];
49
+ /** Normalize a completed check suite for each attached pull request. */
50
+ export declare function normalizeCheckSuiteEvents(deliveryId: string, body: unknown, options?: GitHubCheckSuiteFacts): ResourceEventInput[];
51
+ /** Read which check suite values still need a GitHub API load. */
52
+ export declare function parseCheckSuiteFactsTarget(body: unknown): {
53
+ checkSuiteId: number;
54
+ headSha: string;
55
+ loadFailingChecks: boolean;
56
+ owner: string;
57
+ pullRequestNumbers: number[];
58
+ repoName: string;
59
+ } | undefined;
60
+ /** Load missing values for one check suite event. */
61
+ export declare function loadCheckSuiteFacts(args: {
62
+ appIdEnv: string;
63
+ body: unknown;
64
+ installationIdEnv: string;
65
+ log?: {
66
+ error(message: string, metadata?: Record<string, unknown>): void;
67
+ };
68
+ privateKeyEnv: string;
69
+ }): Promise<GitHubCheckSuiteFacts | undefined>;
@@ -1,10 +1,10 @@
1
1
  import type { PluginConversationAnnotations, PluginLogger, PluginRoute, ResourceEventPublisher } from "@sentry/junior-plugin-api";
2
2
  import type { GitHubDb } from "../db/database.js";
3
3
  import type { GitHubPullRequestCommitComposition } from "../db/schema.js";
4
- import { type GitHubFailingCheck } from "./resource-events.js";
5
4
  /** Create the public, signed GitHub webhook route owned by the plugin. */
6
5
  export declare function createGitHubWebhookRoute(args: {
7
6
  annotations: PluginConversationAnnotations;
7
+ appIdEnv: string;
8
8
  botEmail(): string | undefined;
9
9
  classifyPullRequestCommits?(input: {
10
10
  number: number;
@@ -12,8 +12,9 @@ export declare function createGitHubWebhookRoute(args: {
12
12
  }): Promise<GitHubPullRequestCommitComposition | undefined>;
13
13
  db: GitHubDb;
14
14
  installationId(): string | undefined;
15
- loadFailingChecks?(body: unknown): Promise<GitHubFailingCheck[] | undefined>;
15
+ installationIdEnv: string;
16
16
  log?: Pick<PluginLogger, "error">;
17
+ privateKeyEnv: string;
17
18
  resourceEvents: ResourceEventPublisher;
18
19
  webhookSecret(): string | undefined;
19
20
  }): PluginRoute;
@@ -1,44 +1,12 @@
1
1
  import type { ResourceEventInput } from "@sentry/junior-plugin-api";
2
- export type GitHubFailingCheck = {
3
- checkRunId: number;
4
- conclusion: string;
5
- htmlUrl?: string;
6
- name: string;
7
- };
8
- /** Build a browser URL for one check suite. GitHub does not send html_url. */
9
- export declare function buildCheckSuiteUrl(args: {
10
- checkSuiteId: number;
11
- headSha: string;
12
- repo: string;
13
- }): string;
14
- /** Build the trusted data and summary for one check-suite PR event. */
15
- export declare function buildCheckSuiteResourceEvent(args: {
16
- appName?: string;
17
- checkSuiteId?: number;
18
- deliveryId: string;
19
- eventType: "pull_request.checks.failed" | "pull_request.checks.recovered";
20
- failingChecks?: GitHubFailingCheck[];
21
- headSha?: string;
22
- latestCheckRunsCount?: number;
23
- pullRequestNumber: number;
24
- repo: string;
25
- suiteConclusion: string;
26
- }): ResourceEventInput;
27
- /** Keep only failed check runs from one suite. */
28
- export declare function selectFailingChecks(checkRuns: unknown, options?: {
29
- checkSuiteId?: number;
30
- }): GitHubFailingCheck[];
31
- /** Read the check suite target used to load failed check runs. */
32
- export declare function parseCheckSuiteEnrichmentTarget(body: unknown): {
33
- checkSuiteId: number;
34
- headSha: string;
35
- owner: string;
36
- repoName: string;
37
- } | undefined;
2
+ import { type GitHubCheckSuiteFacts } from "./check-suite.js";
3
+ export type { GitHubCheckSuiteFacts, GitHubCheckSuitePullRequestFacts, GitHubFailingCheck, } from "./check-suite.js";
4
+ export { buildCheckSuiteResourceEvent, buildCheckSuiteUrl, loadCheckSuiteFacts, parseCheckSuiteFactsTarget, selectFailingChecks, } from "./check-suite.js";
5
+ /** Read the check suite target used to load missing suite facts. */
38
6
  /** Normalize one verified GitHub delivery into conversation resource events. */
39
7
  export declare function normalizeGitHubResourceEvents(args: {
40
8
  body: unknown;
9
+ checkSuiteFacts?: GitHubCheckSuiteFacts;
41
10
  deliveryId: string;
42
11
  eventName: string;
43
- failingChecks?: GitHubFailingCheck[];
44
12
  }): ResourceEventInput[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-github",
3
- "version": "0.181.1",
3
+ "version": "0.182.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -31,7 +31,7 @@
31
31
  "@sinclair/typebox": "^0.34.49",
32
32
  "drizzle-orm": "^0.45.2",
33
33
  "zod": "^4.4.3",
34
- "@sentry/junior-plugin-api": "0.181.1"
34
+ "@sentry/junior-plugin-api": "0.182.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@oxlint/plugins": "1.79.0",
@@ -71,7 +71,7 @@ PR titles use the same conventional form as commits: `<type>(<scope>): <Subject>
71
71
 
72
72
  Write the PR body for a reviewer who knows the product but not this change. Use ASD-STE100 English: short sentences, common words, active voice, and one idea per sentence. Avoid dense academic prose and unnecessary jargon.
73
73
 
74
- Explain what this PR changes and why it matters. Add only context the diff cannot show. Keep the body short by default; add structure only when it helps. Omit empty or `N/A` sections, file-by-file narration, copied commit logs, and redundant diff summaries.
74
+ Explain what this PR changes and why it matters. Add only context the diff cannot show. Keep the body short by default; add structure only when it helps. Omit empty or `N/A` sections, file-by-file narration, copied commit logs, and redundant diff summaries. Do not put `Checks`, `Verification`, `Test plan`, or similar validation sections in the PR body; put local check results only in the final user report.
75
75
 
76
76
  Treat the current title, body, and commit messages as fallible context. After material follow-up commits, re-check the title and rewrite the body against the current diff with `github_updatePullRequest`. Never include customer data, PII, secrets, or sensitive thread context, especially in public repositories. Resolve requested assignee/reviewer handles from evidence; skip unconfirmed identities.
77
77
 
@@ -81,4 +81,4 @@ If PR creation or update is blocked, report the exact failed command/tool call a
81
81
 
82
82
  When PR creation returns a subscribable resource hint, subscribe to suggested review/CI events. Report only actionable feedback addressed, build failures fixed, fully green/ready state, or merge.
83
83
 
84
- Return: repo, branch, PR URL/number, checks and results, pre-existing failures, and anything not run with the reason.
84
+ Return to the user (not the PR body): repo, branch, PR URL/number, local check results, pre-existing failures, and anything not run with the reason.
@@ -12,7 +12,7 @@ Guide evidence-first GitHub repository work from inspection through a reviewable
12
12
  - Install repository dependencies with the detected package manager's locked/frozen mode before verification when dependencies are absent.
13
13
  - For every completed repository edit, create or update a pushed PR unless the user explicitly opts out; default new PRs to draft while honoring explicit ready-for-review instructions.
14
14
  - Write conventional PR titles that match the current dominant change.
15
- - Write short reviewer-facing PR bodies in ASD-STE100 English; explain what changed and why, add only context the diff cannot show, and omit empty ceremony or fixed templates.
15
+ - Write short reviewer-facing PR bodies in ASD-STE100 English; explain what changed and why, add only context the diff cannot show, omit empty ceremony or fixed templates, and keep Checks/Verification/Test plan style sections out of the PR body (report local checks to the user instead).
16
16
  - Treat existing PR metadata and commit messages as fallible context, and refresh the title/body against the current diff after material changes.
17
17
  - Report exact validation and permission failures without claiming partial work is complete.
18
18