@sentry/junior-github 0.295.0 → 0.297.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/annotations.d.ts +13 -2
- package/dist/{chunk-D74ZUIJR.js → chunk-OK6BNAGC.js} +44 -10
- package/dist/events/pull-request.d.ts +7 -2
- package/dist/index.js +537 -321
- package/dist/pull-request-outcomes/apply.d.ts +20 -0
- package/dist/pull-request-outcomes/reconcile.d.ts +36 -0
- package/dist/pull-request-outcomes/store.d.ts +9 -0
- package/dist/testing.js +1 -1
- package/dist/tools/stack-pull-request.d.ts +1 -0
- package/dist/tools/update-issue.d.ts +2 -4
- package/dist/tools/update-pull-request.d.ts +2 -4
- package/dist/webhooks/events.d.ts +6 -0
- package/dist/webhooks/installation-requests.d.ts +8 -0
- package/dist/webhooks/pull-request-activity.d.ts +11 -0
- package/package.json +2 -2
- package/skills/github-code/SKILL.md +2 -0
- package/skills/github-issues/SKILL.md +3 -3
|
@@ -0,0 +1,20 @@
|
|
|
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 { 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
|
+
/**
|
|
10
|
+
* Record one pull request outcome. When the stored row changes, update the
|
|
11
|
+
* code index, and mark the chip of each linked conversation merged or closed.
|
|
12
|
+
* A failed chip is logged, so it does not stop the work after it.
|
|
13
|
+
*/
|
|
14
|
+
export declare function applyGitHubPullRequestOutcome(args: {
|
|
15
|
+
annotations: PluginConversationAnnotations;
|
|
16
|
+
codeChanges: CodeChangePublisher;
|
|
17
|
+
db: GitHubDb;
|
|
18
|
+
log?: Pick<PluginLogger, "error">;
|
|
19
|
+
outcome: GitHubPullRequestOutcomeInput;
|
|
20
|
+
}): Promise<Awaited<ReturnType<typeof recordGitHubPullRequestOutcome>>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
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. The write is guarded by `updatedAt`,
|
|
9
|
+
* so a replay cannot move a newer row back.
|
|
10
|
+
*/
|
|
11
|
+
import type { CodeChangePublisher, EventPublisher, PluginConversationAnnotations, PluginLogger, PluginState } from "@sentry/junior-plugin-api";
|
|
12
|
+
import type { GitHubDb } from "../db/database.js";
|
|
13
|
+
import { type GitHubCommitPageLoader, type GitHubPullRequestTarget } from "../webhooks/pull-request-people.js";
|
|
14
|
+
interface ReconcileArgs {
|
|
15
|
+
annotations: PluginConversationAnnotations;
|
|
16
|
+
botEmail?: string;
|
|
17
|
+
codeChanges: CodeChangePublisher;
|
|
18
|
+
db: GitHubDb;
|
|
19
|
+
events: EventPublisher;
|
|
20
|
+
/** Read the commits of one pull request, for the people of a merge. */
|
|
21
|
+
loadCommitPages(target: GitHubPullRequestTarget): Promise<GitHubCommitPageLoader>;
|
|
22
|
+
/** Read the lifecycle of some pull requests with one GraphQL query. */
|
|
23
|
+
loadLifecycles(input: {
|
|
24
|
+
numbers: number[];
|
|
25
|
+
repositoryFullName: string;
|
|
26
|
+
}): Promise<unknown>;
|
|
27
|
+
log: Pick<PluginLogger, "error">;
|
|
28
|
+
nowMs: number;
|
|
29
|
+
state: PluginState;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Reconcile the next repository that has open Junior pull requests and was
|
|
33
|
+
* not reconciled in the last day.
|
|
34
|
+
*/
|
|
35
|
+
export declare function reconcileGitHubPullRequests(args: ReconcileArgs): Promise<void>;
|
|
36
|
+
export {};
|
|
@@ -56,6 +56,15 @@ export declare function listGitHubUnfinishedWork(db: GitHubDb, conversationIds:
|
|
|
56
56
|
* combines this with `listGitHubUnfinishedWork`.
|
|
57
57
|
*/
|
|
58
58
|
export declare function listGitHubFinishedWork(db: GitHubDb, conversationIds: string[]): Promise<Record<string, string>>;
|
|
59
|
+
/**
|
|
60
|
+
* Return the open Junior pull requests whose last lifecycle change is
|
|
61
|
+
* before `before`, oldest first. The daily reconcile checks these against
|
|
62
|
+
* GitHub.
|
|
63
|
+
*/
|
|
64
|
+
export declare function listGitHubStaleOpenPullRequests(db: GitHubDb, before: Date): Promise<Array<{
|
|
65
|
+
number: number;
|
|
66
|
+
repositoryFullName: string;
|
|
67
|
+
}>>;
|
|
59
68
|
/** Return candidate conversations linked to any Junior-owned pull request. */
|
|
60
69
|
export declare function listGitHubAssignedWork(db: GitHubDb, conversationIds: string[]): Promise<string[]>;
|
|
61
70
|
/** Append native conversation ids to an existing Junior-owned PR projection. */
|
package/dist/testing.js
CHANGED
|
@@ -2,6 +2,12 @@ import type { EventInput } from "@sentry/junior-plugin-api";
|
|
|
2
2
|
import { type GitHubCheckSuiteFacts } from "./check-suite.js";
|
|
3
3
|
export type { GitHubCheckSuiteFacts, GitHubCheckSuitePullRequestFacts, GitHubFailingCheck, } from "./check-suite.js";
|
|
4
4
|
export { buildCheckSuiteEvent, buildCheckSuiteUrl, loadCheckSuiteFacts, needsCheckSuitePullRequestFacts, parseCheckSuiteFactsTarget, parseCheckSuitePublishTargets, selectFailingChecks, } from "./check-suite.js";
|
|
5
|
+
/**
|
|
6
|
+
* Build the merged or closed_unmerged events of one closed pull request.
|
|
7
|
+
* The webhook and the daily reconcile both publish them. The key names the
|
|
8
|
+
* close, not the webhook delivery, so a Watch gets the close once.
|
|
9
|
+
*/
|
|
10
|
+
export declare function gitHubPullRequestTerminalEvents(body: unknown): EventInput[];
|
|
5
11
|
/**
|
|
6
12
|
* Normalize one verified GitHub delivery into conversation events.
|
|
7
13
|
*
|
|
@@ -21,6 +21,14 @@ export declare function loadPullRequest(env: GitHubInstallationEnv, pullRequest:
|
|
|
21
21
|
number: number;
|
|
22
22
|
repositoryFullName: string;
|
|
23
23
|
}): Promise<unknown>;
|
|
24
|
+
/**
|
|
25
|
+
* Read the lifecycle of some pull requests of one repository in one GraphQL
|
|
26
|
+
* query, with a read-only token. Each pull request has the alias `pr<index>`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function loadPullRequestLifecycles(env: GitHubInstallationEnv, input: {
|
|
29
|
+
numbers: number[];
|
|
30
|
+
repositoryFullName: string;
|
|
31
|
+
}): Promise<unknown>;
|
|
24
32
|
/**
|
|
25
33
|
* Read one page of a repository's open pull requests by one author, with
|
|
26
34
|
* their mergeability, through GraphQL search and a read-only token.
|
|
@@ -0,0 +1,11 @@
|
|
|
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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.297.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"drizzle-orm": "^0.45.2",
|
|
33
33
|
"marked": "^18.1.2",
|
|
34
34
|
"zod": "^4.5.4",
|
|
35
|
-
"@sentry/junior-plugin-api": "0.
|
|
35
|
+
"@sentry/junior-plugin-api": "0.297.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@oxlint/plugins": "1.79.0",
|
|
@@ -39,5 +39,7 @@ Use `git` and `gh` for repository work.
|
|
|
39
39
|
- Code changes always end in a pushed branch and a PR. Do not ask whether to open one. Skip it only when the user opts out or asks for investigation only.
|
|
40
40
|
- Open the PR ready for review when the work is complete and the checks pass. Open a draft when work, checks, or decisions remain. A scope or follow-up question is not a reason to stop: open the PR, and name the question in the PR body and the report.
|
|
41
41
|
- Link the PR. Mention checks only when they failed or were skipped.
|
|
42
|
+
- The runtime adds the requester `via` line. Do not write one.
|
|
43
|
+
- Credit other people, such as a reporter, by GitHub `@login` so GitHub notifies them. Get the login from `userLookup` (`linked_identities` with provider `github`, else a GitHub link in `profile_fields`). Pass the Slack user ID when known. With no login, write the name. Never guess a login. When you delegate the write, put the `@login` in the brief.
|
|
42
44
|
|
|
43
45
|
Do not install or repair the GitHub plugin from this skill.
|
|
@@ -66,7 +66,7 @@ Follow [references/research-rules.md](references/research-rules.md) for cross-ty
|
|
|
66
66
|
- **Issue title format: plain language, no type prefix.** Do not use `fix(x):`, `feat(x):`, `chore:`, `ref(x):`, or any other type-scope prefix — those belong in commit messages and PR titles, not issues.
|
|
67
67
|
- Summary ≤ 3 sentences. Do not restate the title in the body.
|
|
68
68
|
- Prefer flat bullet lists over headed sections for simple issues. Remove empty sections.
|
|
69
|
-
- Generalize session framing — strip channel references, slash commands, Slack thread IDs, user
|
|
69
|
+
- Generalize session framing — strip channel references, slash commands, Slack thread IDs, Slack user mentions, and transcript fragments; replace with the underlying technical problem.
|
|
70
70
|
- Compress source material. Research notes, hypotheses, or transcripts become a short summary + scoped bullets — never paste raw investigation into the body.
|
|
71
71
|
- Do not add desired outcome, expected behavior, acceptance criteria, fixes, implementation steps, approaches, or options unless the user explicitly asks to preserve a specific proposal.
|
|
72
72
|
- Never infer a solution from research. If a user-provided proposal must be preserved, attribute it as a proposal and keep it separate from verified diagnosis.
|
|
@@ -75,7 +75,7 @@ Follow [references/research-rules.md](references/research-rules.md) for cross-ty
|
|
|
75
75
|
**Source attribution:**
|
|
76
76
|
|
|
77
77
|
- The runtime adds the verified `Requested by` block. Do not add or rewrite requester attribution in model-authored body text.
|
|
78
|
-
- If the person who originally reported or observed the problem differs from the issue creator, capture that with durable body text such as `Reported by
|
|
78
|
+
- If the person who originally reported or observed the problem differs from the issue creator, capture that with durable body text such as `Reported by @alice.` or `Raised by @alice during incident triage.` Use their GitHub `@login` so GitHub notifies them. Get it from `userLookup` (`linked_identities` with provider `github`, else a GitHub link in `profile_fields`). With no login, write the name. Never guess a login.
|
|
79
79
|
- Attach screenshots from the thread when present. For GitHub Markdown, first publish each local image with `publishImage` (the image becomes public to anyone with the URL), then embed the returned URL in the issue body or comment. Do not use private Slack file links or conversation attachment URLs.
|
|
80
80
|
- Include code snippets, related issues, and related PRs only when they materially improve the issue.
|
|
81
81
|
|
|
@@ -84,7 +84,7 @@ Follow [references/research-rules.md](references/research-rules.md) for cross-ty
|
|
|
84
84
|
Before running the `gh` create/edit command, check each gate. If any fails, revise and re-check before executing:
|
|
85
85
|
|
|
86
86
|
- Title length ≤ 60 characters.
|
|
87
|
-
- No session framing remains (channel refs, slash commands,
|
|
87
|
+
- No session framing remains (channel refs, slash commands, Slack user mentions, Slack thread IDs).
|
|
88
88
|
- Body structure matches complexity — no empty sections, no restated title, no raw research dump.
|
|
89
89
|
- No invented or unattributed solution, implementation step, approach, or option appears in the title or body.
|
|
90
90
|
|