@sentry/junior-github 0.296.0 → 0.298.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 +1338 -877
- 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/react-to-issue.d.ts +137 -0
- package/dist/tools/update-issue-comment.d.ts +138 -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 +4 -4
- package/skills/github-issues/references/api-surface.md +3 -1
package/dist/annotations.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ConversationAnnotation, type ConversationSidebarAnnotation, type ObjectAnnotation, type PluginAnnotations, type PluginConversationAnnotations, type PluginLogger } from "@sentry/junior-plugin-api";
|
|
2
2
|
/** Return GitHub annotations for a conversation row, newest first. */
|
|
3
3
|
export declare function githubSidebarAnnotations(annotations: ConversationAnnotation[]): ConversationSidebarAnnotation[];
|
|
4
4
|
/** Build the annotation returned by GitHub create and update tools. */
|
|
@@ -14,9 +14,20 @@ export declare function githubObjectAnnotation(input: {
|
|
|
14
14
|
description?: string;
|
|
15
15
|
}): ObjectAnnotation;
|
|
16
16
|
/** Refresh an existing object's status without selecting a card for delivery. */
|
|
17
|
-
|
|
17
|
+
declare function updateGitHubAnnotation(store: PluginAnnotations, input: {
|
|
18
18
|
repo: string;
|
|
19
19
|
number: number;
|
|
20
20
|
objectType: "task" | "code_change";
|
|
21
21
|
status: "merged" | "closed";
|
|
22
22
|
}): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Refresh the status of one object in each linked conversation. One failed
|
|
25
|
+
* conversation does not stop the others. Each failure is logged.
|
|
26
|
+
*/
|
|
27
|
+
export declare function updateGitHubAnnotations(args: {
|
|
28
|
+
annotations: PluginConversationAnnotations;
|
|
29
|
+
conversationIds: string[];
|
|
30
|
+
log?: Pick<PluginLogger, "error">;
|
|
31
|
+
update: Parameters<typeof updateGitHubAnnotation>[1];
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
export {};
|
|
@@ -253,6 +253,21 @@ function gitHubPullRequestEventGuidance(guidance) {
|
|
|
253
253
|
}
|
|
254
254
|
return merged;
|
|
255
255
|
}
|
|
256
|
+
var DEFAULT_PULL_REQUEST_SUBSCRIPTION = {
|
|
257
|
+
events: [
|
|
258
|
+
"pull_request.checks.failed",
|
|
259
|
+
"pull_request.closed_unmerged",
|
|
260
|
+
"pull_request.comment.created",
|
|
261
|
+
"pull_request.review.changes_requested",
|
|
262
|
+
"pull_request.review.commented",
|
|
263
|
+
"pull_request.review_comment.created"
|
|
264
|
+
],
|
|
265
|
+
intent: "Maintain pull requests Junior creates. For actionable review feedback or failed checks, inspect the evidence, make scoped fixes, verify them, and push, without asking first. Reply on GitHub to review comments and questions, in the thread where they were asked. Report completed work or blockers in the originating thread. Report when the pull request closes unmerged. When a reviewer submits a review, notify the person who asked for the pull request by mentioning them, with the reviewer, the review outcome, and the pull request link. Stay silent on other events that are not feedback."
|
|
266
|
+
};
|
|
267
|
+
function gitHubPullRequestSubscription(config) {
|
|
268
|
+
if (config === false) return void 0;
|
|
269
|
+
return config ?? DEFAULT_PULL_REQUEST_SUBSCRIPTION;
|
|
270
|
+
}
|
|
256
271
|
var MERGE_STATE_CHECK = "Do not guess whether it can merge. Before you say anything about that, run `gh pr view NUMBER --repo OWNER/REPO --json autoMergeRequest,mergeStateStatus,reviewDecision,baseRefName --jq '{autoMerge: (.autoMergeRequest != null), mergeStateStatus, reviewDecision, baseRefName}'` and `gh pr checks NUMBER --repo OWNER/REPO --required`. If it prints \"no required checks reported\", the required checks may not have started on the latest commit yet. It does not mean that none are required. If auto-merge is on and only required checks remain, say only that it merges when they pass. If GitHub blocks it for another reason, run `gh api repos/OWNER/REPO/rules/branches/BASE` and name the rule that blocks it. Do not say that you did not merge it.";
|
|
257
272
|
var GITHUB_PULL_REQUEST_OUTCOME_GUIDANCE = {
|
|
258
273
|
"pull_request.review.approved": `Mention each person in People involved, or the person who asked for the pull request if that line is missing. Say who approved it and link it. Do not merge it unless asked. ${MERGE_STATE_CHECK}`,
|
|
@@ -2233,7 +2248,6 @@ function normalizePullRequestEvent(deliveryId, body) {
|
|
|
2233
2248
|
eventType: event.eventType,
|
|
2234
2249
|
occurredAtMs: event.occurredAtMs,
|
|
2235
2250
|
identifier: resource.identifier,
|
|
2236
|
-
...event.terminal ? { terminal: true } : void 0,
|
|
2237
2251
|
trustedSummary: event.trustedSummary,
|
|
2238
2252
|
data: event.isDraft === false ? readyData : data,
|
|
2239
2253
|
...event.untrustedText ? { untrustedText: event.untrustedText } : void 0
|
|
@@ -2270,16 +2284,34 @@ function normalizePullRequestEvent(deliveryId, body) {
|
|
|
2270
2284
|
untrustedText
|
|
2271
2285
|
});
|
|
2272
2286
|
}
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2287
|
+
return gitHubPullRequestTerminalEvents(body);
|
|
2288
|
+
}
|
|
2289
|
+
function gitHubPullRequestTerminalEvents(body) {
|
|
2290
|
+
const parsed = pullRequestWebhookSchema.safeParse(body);
|
|
2291
|
+
if (!parsed.success || parsed.data.action !== "closed") return [];
|
|
2292
|
+
const { pull_request: pullRequest } = parsed.data;
|
|
2293
|
+
const repo = parsed.data.repository.full_name;
|
|
2294
|
+
const resource = gitHubPullRequestResource({
|
|
2295
|
+
number: pullRequest.number,
|
|
2296
|
+
repo
|
|
2282
2297
|
});
|
|
2298
|
+
const merged = pullRequest.merged === true;
|
|
2299
|
+
const eventType = merged ? "pull_request.merged" : "pull_request.closed_unmerged";
|
|
2300
|
+
const occurredAtMs = providerTime(merged ? pullRequest.merged_at : pullRequest.closed_at) ?? providerTime(pullRequest.updated_at) ?? Date.now();
|
|
2301
|
+
return pullRequestTargets(
|
|
2302
|
+
{
|
|
2303
|
+
// A pull request merges once. It can close, reopen, and close again,
|
|
2304
|
+
// so the key of a close also has its time.
|
|
2305
|
+
eventKey: merged ? `github:${resource.identifier}:${eventType}` : `github:${resource.identifier}:${eventType}:${occurredAtMs}`,
|
|
2306
|
+
eventType,
|
|
2307
|
+
occurredAtMs,
|
|
2308
|
+
identifier: resource.identifier,
|
|
2309
|
+
terminal: true,
|
|
2310
|
+
trustedSummary: merged ? `${resource.label} was merged.` : `${resource.label} was closed without being merged.`,
|
|
2311
|
+
data: pullRequestEventData({ pullRequest, repo })
|
|
2312
|
+
},
|
|
2313
|
+
repo
|
|
2314
|
+
);
|
|
2283
2315
|
}
|
|
2284
2316
|
var releaseWebhookSchema = z6.object({
|
|
2285
2317
|
action: z6.string(),
|
|
@@ -2395,6 +2427,7 @@ export {
|
|
|
2395
2427
|
gitHubDeploymentSourceSubscribable,
|
|
2396
2428
|
GITHUB_PULL_REQUEST_EVENTS,
|
|
2397
2429
|
gitHubPullRequestEventGuidance,
|
|
2430
|
+
gitHubPullRequestSubscription,
|
|
2398
2431
|
gitHubPullRequestCreateWatch,
|
|
2399
2432
|
GITHUB_PULL_REQUEST_SUGGESTED_EVENTS,
|
|
2400
2433
|
GITHUB_PULL_REQUEST_MATCH_FIELDS,
|
|
@@ -2439,5 +2472,6 @@ export {
|
|
|
2439
2472
|
parseCheckSuitePublishTargets,
|
|
2440
2473
|
needsCheckSuitePullRequestFacts,
|
|
2441
2474
|
loadCheckSuiteFacts,
|
|
2475
|
+
gitHubPullRequestTerminalEvents,
|
|
2442
2476
|
normalizeGitHubEvents
|
|
2443
2477
|
};
|
|
@@ -7,14 +7,19 @@ export declare function gitHubPullRequestEventGuidance(guidance?: Partial<Record
|
|
|
7
7
|
export interface GitHubPullRequestEventOptions {
|
|
8
8
|
/** App guidance applied within the matching subscription or event automation instruction. */
|
|
9
9
|
guidance?: Partial<Record<GitHubPullRequestEvent, string>>;
|
|
10
|
-
/**
|
|
11
|
-
|
|
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;
|
|
12
15
|
}
|
|
13
16
|
/** Temporary subscription created after Junior creates a pull request. */
|
|
14
17
|
export interface GitHubPullRequestSubscriptionConfig {
|
|
15
18
|
events: GitHubPullRequestEvent[];
|
|
16
19
|
intent: string;
|
|
17
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;
|
|
18
23
|
/** Build the Watch created after Junior creates a pull request. */
|
|
19
24
|
export declare function gitHubPullRequestCreateWatch(config: GitHubPullRequestSubscriptionConfig): {
|
|
20
25
|
events: GitHubPullRequestEvent[];
|