@sentry/junior-github 0.271.0 → 0.273.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/{chunk-MUWR6X24.js → chunk-E5QVQE4U.js} +24 -0
- package/dist/egress-policy.d.ts +4 -1
- package/dist/git-config.d.ts +7 -2
- package/dist/index.js +31 -25
- package/dist/testing.js +1 -1
- package/dist/tools/create-issue.d.ts +2 -0
- package/dist/tools/create-pull-request.d.ts +2 -0
- package/dist/tools/get-deployment.d.ts +2 -0
- package/dist/tools/get-pull-request.d.ts +2 -0
- package/dist/tools/get-release.d.ts +2 -0
- package/dist/tools/get-repository.d.ts +2 -0
- package/dist/tools/update-issue.d.ts +2 -0
- package/dist/tools/update-pull-request.d.ts +2 -0
- package/package.json +2 -2
|
@@ -90,8 +90,14 @@ function gitHubDeploymentSourceResource(input) {
|
|
|
90
90
|
}
|
|
91
91
|
function gitHubDeploymentSourceSubscribable(input) {
|
|
92
92
|
if (!input.canSubscribe) return void 0;
|
|
93
|
+
const environment = input.environment?.trim().toLowerCase();
|
|
93
94
|
return {
|
|
94
95
|
...gitHubDeploymentSourceResource(input),
|
|
96
|
+
match: {
|
|
97
|
+
repo: gitHubRepoDataSchema.parse(input.repo),
|
|
98
|
+
commitSha: gitHubCommitShaDataSchema.parse(input.commitSha),
|
|
99
|
+
...environment ? { environment } : void 0
|
|
100
|
+
},
|
|
95
101
|
suggestedEvents: GITHUB_DEPLOYMENT_SUGGESTED_EVENTS,
|
|
96
102
|
supportedEvents: [...GITHUB_DEPLOYMENT_EVENTS],
|
|
97
103
|
type: "deployment_source"
|
|
@@ -163,6 +169,10 @@ function gitHubIssueSubscribable(input) {
|
|
|
163
169
|
if (!input.canSubscribe) return void 0;
|
|
164
170
|
return {
|
|
165
171
|
...gitHubIssueResource(input),
|
|
172
|
+
match: {
|
|
173
|
+
repo: gitHubRepoDataSchema.parse(input.repo),
|
|
174
|
+
issue: input.number
|
|
175
|
+
},
|
|
166
176
|
suggestedEvents: GITHUB_ISSUE_SUGGESTED_EVENTS,
|
|
167
177
|
supportedEvents: GITHUB_ISSUE_EVENTS,
|
|
168
178
|
type: "issue"
|
|
@@ -188,6 +198,10 @@ var GITHUB_PULL_REQUEST_EVENTS = [
|
|
|
188
198
|
"pull_request.merge_conflict"
|
|
189
199
|
];
|
|
190
200
|
var GITHUB_PULL_REQUEST_EVENT_GUIDANCE = {
|
|
201
|
+
"pull_request.checks.failed": "Fix only failures that the pull request causes. Do not skip, disable, or weaken a check to make it pass.",
|
|
202
|
+
// An approval with a body also arrives as review.commented in the same
|
|
203
|
+
// Turn, so this guidance must not tell the agent to hold off on that body.
|
|
204
|
+
"pull_request.review.approved": "When the approval includes actionable feedback, address it like any other review feedback.",
|
|
191
205
|
"pull_request.comment.created": 'After acting on actionable feedback, call github_updatePullRequestFeedback with the exact repo, commentId, and commentKind from Verified details, and status "addressed" or "declined".',
|
|
192
206
|
"pull_request.review_comment.created": 'After acting on actionable feedback, call github_updatePullRequestFeedback with the exact repo, commentId, and commentKind from Verified details, and status "addressed" or "declined". Then resolve the thread with github_resolvePullRequestReviewThread.',
|
|
193
207
|
"pull_request.merge_conflict": "Fetch baseBranch from Verified details and merge it into the pull request branch. Do not rebase. Resolve each conflict so that both the pull request change and the base branch change stay intact. Run the checks again, push, and confirm that the pull request can merge. Report the files that had conflicts."
|
|
@@ -311,6 +325,10 @@ function gitHubPullRequestSubscribable(input) {
|
|
|
311
325
|
);
|
|
312
326
|
return {
|
|
313
327
|
...gitHubPullRequestResource(input),
|
|
328
|
+
match: {
|
|
329
|
+
repo: gitHubRepoDataSchema.parse(input.repo),
|
|
330
|
+
pullRequest: input.number
|
|
331
|
+
},
|
|
314
332
|
...suggestedEvents.length > 0 ? { suggestedEvents: [...suggestedEvents] } : void 0,
|
|
315
333
|
supportedEvents: [...GITHUB_PULL_REQUEST_EVENTS],
|
|
316
334
|
type: "pull_request"
|
|
@@ -350,8 +368,13 @@ function gitHubReleaseSourceResource(input) {
|
|
|
350
368
|
}
|
|
351
369
|
function gitHubReleaseSourceSubscribable(input) {
|
|
352
370
|
if (!input.canSubscribe) return void 0;
|
|
371
|
+
const tag = input.tag?.trim();
|
|
353
372
|
return {
|
|
354
373
|
...gitHubReleaseSourceResource(input),
|
|
374
|
+
match: {
|
|
375
|
+
repo: gitHubRepoDataSchema.parse(input.repo),
|
|
376
|
+
...tag ? { tag: gitHubReleaseTagDataSchema.parse(tag) } : void 0
|
|
377
|
+
},
|
|
355
378
|
suggestedEvents: GITHUB_RELEASE_SUGGESTED_EVENTS,
|
|
356
379
|
supportedEvents: [...GITHUB_RELEASE_EVENTS],
|
|
357
380
|
type: "release_source"
|
|
@@ -385,6 +408,7 @@ function gitHubRepositorySubscribable(input) {
|
|
|
385
408
|
if (!input.canSubscribe) return void 0;
|
|
386
409
|
return {
|
|
387
410
|
...gitHubRepositoryResource(input),
|
|
411
|
+
match: { repo: gitHubRepoDataSchema.parse(input.repo) },
|
|
388
412
|
suggestedEvents: [...GITHUB_REPOSITORY_SUGGESTED_EVENTS],
|
|
389
413
|
supportedEvents: [...GITHUB_REPOSITORY_EVENTS],
|
|
390
414
|
type: "repository"
|
package/dist/egress-policy.d.ts
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* GitHub egress policy and grant selection.
|
|
3
3
|
*
|
|
4
4
|
* Owns which GitHub requests Junior may make and which credential grant
|
|
5
|
-
* each request needs.
|
|
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.
|
|
6
9
|
*/
|
|
7
10
|
import { type EgressHookContext, type EgressResponseHookContext } from "@sentry/junior-plugin-api";
|
|
8
11
|
import { type GitHubGrant } from "./credential-support.js";
|
package/dist/git-config.d.ts
CHANGED
|
@@ -43,5 +43,10 @@ export declare function setGitHooksPathEnv(env: PluginEnv, hooksPath: string): v
|
|
|
43
43
|
export declare function repositoryHook(name: string): string;
|
|
44
44
|
/** Build the hook that replaces model-supplied commit attribution. */
|
|
45
45
|
export declare function prepareCommitMsgHook(): string;
|
|
46
|
-
/**
|
|
47
|
-
|
|
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>;
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
readGrantPermissions,
|
|
60
60
|
requireEnv,
|
|
61
61
|
resolveUserAccount
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-E5QVQE4U.js";
|
|
63
63
|
|
|
64
64
|
// src/tool-support/attribution.ts
|
|
65
65
|
var GITHUB_REQUEST_ATTRIBUTION_START = "<!-- junior-request-attribution:start -->";
|
|
@@ -4130,7 +4130,7 @@ async function syncOne(args, target) {
|
|
|
4130
4130
|
if (ready) {
|
|
4131
4131
|
await items.upsert({
|
|
4132
4132
|
assigneeIdentityIds: [opener.identityId],
|
|
4133
|
-
body: `**${state.title}** is approved, and GitHub says that it can merge
|
|
4133
|
+
body: `**${state.title}** is approved, and GitHub says that it can merge: ${state.url}`,
|
|
4134
4134
|
dedupeKey,
|
|
4135
4135
|
subject: { id: state.url, title: name, url: state.url },
|
|
4136
4136
|
title: `Ready to merge: ${name}`
|
|
@@ -5081,14 +5081,38 @@ else
|
|
|
5081
5081
|
fi
|
|
5082
5082
|
`;
|
|
5083
5083
|
}
|
|
5084
|
-
|
|
5084
|
+
var PREPARE_GIT_SCRIPT = `set -eu
|
|
5085
|
+
hooks_dir=$1
|
|
5086
|
+
shift
|
|
5087
|
+
mkdir -p "$hooks_dir"
|
|
5088
|
+
while [ "$#" -gt 0 ]; do
|
|
5089
|
+
printf '%s' "$2" > "$hooks_dir/$1"
|
|
5090
|
+
chmod 755 "$hooks_dir/$1"
|
|
5091
|
+
shift 2
|
|
5092
|
+
done
|
|
5093
|
+
git config --global core.hooksPath "$hooks_dir"
|
|
5094
|
+
git config --global commit.gpgsign false
|
|
5095
|
+
git config --global credential.helper ""
|
|
5096
|
+
git config --global http.emptyAuth true
|
|
5097
|
+
`;
|
|
5098
|
+
async function prepareSandboxGit(ctx) {
|
|
5099
|
+
const hooks = [
|
|
5100
|
+
["prepare-commit-msg", prepareCommitMsgHook()],
|
|
5101
|
+
...REPOSITORY_HOOK_NAMES.map((name) => [name, repositoryHook(name)])
|
|
5102
|
+
];
|
|
5085
5103
|
const result = await ctx.sandbox.run({
|
|
5086
|
-
cmd: "
|
|
5087
|
-
args: [
|
|
5104
|
+
cmd: "bash",
|
|
5105
|
+
args: [
|
|
5106
|
+
"-c",
|
|
5107
|
+
PREPARE_GIT_SCRIPT,
|
|
5108
|
+
"bash",
|
|
5109
|
+
gitHooksPath(ctx.sandbox.juniorRoot),
|
|
5110
|
+
...hooks.flat()
|
|
5111
|
+
]
|
|
5088
5112
|
});
|
|
5089
5113
|
if (result.exitCode !== 0) {
|
|
5090
5114
|
throw new Error(
|
|
5091
|
-
`Failed to
|
|
5115
|
+
`Failed to prepare sandbox git: ${result.stderr || result.stdout}`
|
|
5092
5116
|
);
|
|
5093
5117
|
}
|
|
5094
5118
|
}
|
|
@@ -6284,25 +6308,7 @@ function githubPlugin(options = {}) {
|
|
|
6284
6308
|
);
|
|
6285
6309
|
},
|
|
6286
6310
|
workspacePrepare: prepareWorkspace,
|
|
6287
|
-
|
|
6288
|
-
const hooksPath = gitHooksPath(ctx.sandbox.juniorRoot);
|
|
6289
|
-
await ctx.sandbox.writeFile({
|
|
6290
|
-
path: `${hooksPath}/prepare-commit-msg`,
|
|
6291
|
-
mode: 493,
|
|
6292
|
-
content: prepareCommitMsgHook()
|
|
6293
|
-
});
|
|
6294
|
-
for (const name of REPOSITORY_HOOK_NAMES) {
|
|
6295
|
-
await ctx.sandbox.writeFile({
|
|
6296
|
-
path: `${hooksPath}/${name}`,
|
|
6297
|
-
mode: 493,
|
|
6298
|
-
content: repositoryHook(name)
|
|
6299
|
-
});
|
|
6300
|
-
}
|
|
6301
|
-
await configureGit(ctx, "core.hooksPath", hooksPath);
|
|
6302
|
-
await configureGit(ctx, "commit.gpgsign", "false");
|
|
6303
|
-
await configureGit(ctx, "credential.helper", "");
|
|
6304
|
-
await configureGit(ctx, "http.emptyAuth", "true");
|
|
6305
|
-
},
|
|
6311
|
+
sandboxPrepare: prepareSandboxGit,
|
|
6306
6312
|
async beforeToolExecute(ctx) {
|
|
6307
6313
|
if (ctx.tool.name !== "bash") {
|
|
6308
6314
|
return;
|
package/dist/testing.js
CHANGED
|
@@ -64,6 +64,7 @@ export declare function createGitHubIssueTool(ctx: ToolRegistrationHookContext):
|
|
|
64
64
|
subscribable?: {
|
|
65
65
|
identifier: string;
|
|
66
66
|
label: string;
|
|
67
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
67
68
|
namespace: string;
|
|
68
69
|
suggestedEvents?: string[] | undefined;
|
|
69
70
|
supportedEvents: string[];
|
|
@@ -130,6 +131,7 @@ export declare function createGitHubIssueTool(ctx: ToolRegistrationHookContext):
|
|
|
130
131
|
subscribable?: {
|
|
131
132
|
identifier: string;
|
|
132
133
|
label: string;
|
|
134
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
133
135
|
namespace: string;
|
|
134
136
|
suggestedEvents?: string[] | undefined;
|
|
135
137
|
supportedEvents: string[];
|
|
@@ -68,6 +68,7 @@ export declare function createGitHubPullRequestTool(ctx: ToolRegistrationHookCon
|
|
|
68
68
|
subscribable?: {
|
|
69
69
|
identifier: string;
|
|
70
70
|
label: string;
|
|
71
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
71
72
|
namespace: string;
|
|
72
73
|
suggestedEvents?: string[] | undefined;
|
|
73
74
|
supportedEvents: string[];
|
|
@@ -138,6 +139,7 @@ export declare function createGitHubPullRequestTool(ctx: ToolRegistrationHookCon
|
|
|
138
139
|
subscribable?: {
|
|
139
140
|
identifier: string;
|
|
140
141
|
label: string;
|
|
142
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
141
143
|
namespace: string;
|
|
142
144
|
suggestedEvents?: string[] | undefined;
|
|
143
145
|
supportedEvents: string[];
|
|
@@ -90,6 +90,7 @@ export declare function createGitHubGetDeploymentTool(ctx: {
|
|
|
90
90
|
subscribable?: {
|
|
91
91
|
identifier: string;
|
|
92
92
|
label: string;
|
|
93
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
93
94
|
namespace: string;
|
|
94
95
|
suggestedEvents?: string[] | undefined;
|
|
95
96
|
supportedEvents: string[];
|
|
@@ -177,6 +178,7 @@ export declare function createGitHubGetDeploymentTool(ctx: {
|
|
|
177
178
|
subscribable?: {
|
|
178
179
|
identifier: string;
|
|
179
180
|
label: string;
|
|
181
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
180
182
|
namespace: string;
|
|
181
183
|
suggestedEvents?: string[] | undefined;
|
|
182
184
|
supportedEvents: string[];
|
|
@@ -73,6 +73,7 @@ export declare function createGitHubGetPullRequestTool(ctx: {
|
|
|
73
73
|
subscribable?: {
|
|
74
74
|
identifier: string;
|
|
75
75
|
label: string;
|
|
76
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
76
77
|
namespace: string;
|
|
77
78
|
suggestedEvents?: string[] | undefined;
|
|
78
79
|
supportedEvents: string[];
|
|
@@ -146,6 +147,7 @@ export declare function createGitHubGetPullRequestTool(ctx: {
|
|
|
146
147
|
subscribable?: {
|
|
147
148
|
identifier: string;
|
|
148
149
|
label: string;
|
|
150
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
149
151
|
namespace: string;
|
|
150
152
|
suggestedEvents?: string[] | undefined;
|
|
151
153
|
supportedEvents: string[];
|
|
@@ -78,6 +78,7 @@ export declare function createGitHubGetReleaseTool(ctx: {
|
|
|
78
78
|
subscribable?: {
|
|
79
79
|
identifier: string;
|
|
80
80
|
label: string;
|
|
81
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
81
82
|
namespace: string;
|
|
82
83
|
suggestedEvents?: string[] | undefined;
|
|
83
84
|
supportedEvents: string[];
|
|
@@ -155,6 +156,7 @@ export declare function createGitHubGetReleaseTool(ctx: {
|
|
|
155
156
|
subscribable?: {
|
|
156
157
|
identifier: string;
|
|
157
158
|
label: string;
|
|
159
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
158
160
|
namespace: string;
|
|
159
161
|
suggestedEvents?: string[] | undefined;
|
|
160
162
|
supportedEvents: string[];
|
|
@@ -69,6 +69,7 @@ export declare function createGitHubGetRepositoryTool(ctx: {
|
|
|
69
69
|
subscribable?: {
|
|
70
70
|
identifier: string;
|
|
71
71
|
label: string;
|
|
72
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
72
73
|
namespace: string;
|
|
73
74
|
suggestedEvents?: string[] | undefined;
|
|
74
75
|
supportedEvents: string[];
|
|
@@ -138,6 +139,7 @@ export declare function createGitHubGetRepositoryTool(ctx: {
|
|
|
138
139
|
subscribable?: {
|
|
139
140
|
identifier: string;
|
|
140
141
|
label: string;
|
|
142
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
141
143
|
namespace: string;
|
|
142
144
|
suggestedEvents?: string[] | undefined;
|
|
143
145
|
supportedEvents: string[];
|
|
@@ -90,6 +90,7 @@ export declare function createGitHubUpdateIssueTool(ctx: {
|
|
|
90
90
|
subscribable?: {
|
|
91
91
|
identifier: string;
|
|
92
92
|
label: string;
|
|
93
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
93
94
|
namespace: string;
|
|
94
95
|
suggestedEvents?: string[] | undefined;
|
|
95
96
|
supportedEvents: string[];
|
|
@@ -159,6 +160,7 @@ export declare function createGitHubUpdateIssueTool(ctx: {
|
|
|
159
160
|
subscribable?: {
|
|
160
161
|
identifier: string;
|
|
161
162
|
label: string;
|
|
163
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
162
164
|
namespace: string;
|
|
163
165
|
suggestedEvents?: string[] | undefined;
|
|
164
166
|
supportedEvents: string[];
|
|
@@ -95,6 +95,7 @@ export declare function createGitHubUpdatePullRequestTool(ctx: {
|
|
|
95
95
|
subscribable?: {
|
|
96
96
|
identifier: string;
|
|
97
97
|
label: string;
|
|
98
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
98
99
|
namespace: string;
|
|
99
100
|
suggestedEvents?: string[] | undefined;
|
|
100
101
|
supportedEvents: string[];
|
|
@@ -166,6 +167,7 @@ export declare function createGitHubUpdatePullRequestTool(ctx: {
|
|
|
166
167
|
subscribable?: {
|
|
167
168
|
identifier: string;
|
|
168
169
|
label: string;
|
|
170
|
+
match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
|
|
169
171
|
namespace: string;
|
|
170
172
|
suggestedEvents?: string[] | undefined;
|
|
171
173
|
supportedEvents: string[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.273.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.273.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@oxlint/plugins": "1.79.0",
|