@sentry/junior-github 0.272.0 → 0.274.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.
|
@@ -197,10 +197,16 @@ var GITHUB_PULL_REQUEST_EVENTS = [
|
|
|
197
197
|
"pull_request.closed_unmerged",
|
|
198
198
|
"pull_request.merge_conflict"
|
|
199
199
|
];
|
|
200
|
+
var STACK_CHECK = "Check if the pull request is in a stack: `gh api 'repos/OWNER/REPO/stacks?pull_request=NUMBER'`.";
|
|
201
|
+
var STACK_CONFLICT_STEPS = "run `gh stack rebase`, resolve each conflict so that both changes stay intact, stage the files, and run `gh stack rebase --continue`. Run the checks again, run `gh stack push`, and confirm that each open pull request in the stack can merge. Report the files that had conflicts.";
|
|
200
202
|
var GITHUB_PULL_REQUEST_EVENT_GUIDANCE = {
|
|
203
|
+
"pull_request.checks.failed": "Fix only failures that the pull request causes. Do not skip, disable, or weaken a check to make it pass.",
|
|
204
|
+
// An approval with a body also arrives as review.commented in the same
|
|
205
|
+
// Turn, so this guidance must not tell the agent to hold off on that body.
|
|
206
|
+
"pull_request.review.approved": "When the approval includes actionable feedback, address it like any other review feedback.",
|
|
201
207
|
"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".',
|
|
202
208
|
"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.',
|
|
203
|
-
"pull_request.merge_conflict":
|
|
209
|
+
"pull_request.merge_conflict": `${STACK_CHECK} If it is, run \`gh stack checkout NUMBER\`, then ${STACK_CONFLICT_STEPS} If it is not, 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.`
|
|
204
210
|
};
|
|
205
211
|
function gitHubPullRequestEventGuidance(guidance) {
|
|
206
212
|
const merged = { ...GITHUB_PULL_REQUEST_EVENT_GUIDANCE };
|
|
@@ -214,7 +220,7 @@ function gitHubPullRequestEventGuidance(guidance) {
|
|
|
214
220
|
}
|
|
215
221
|
var GITHUB_PULL_REQUEST_OUTCOME_GUIDANCE = {
|
|
216
222
|
"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.",
|
|
217
|
-
"pull_request.merged":
|
|
223
|
+
"pull_request.merged": `${STACK_CHECK} If open pull requests in the stack remain above it and Junior pushed their branches, restack them before you reply. Do not ask first. Run \`gh stack checkout NUMBER\` with the lowest open pull request, then \`gh stack sync\`. If sync reports a conflict, ${STACK_CONFLICT_STEPS} Then mention each person in People involved, or the person who asked for the pull request if that line is missing. Say that it merged and link it. When you restacked, say so in the same reply.`
|
|
218
224
|
};
|
|
219
225
|
function gitHubPullRequestCreateWatch(config) {
|
|
220
226
|
const outcomeEvents = Object.keys(
|
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-EALXNZGU.js";
|
|
63
63
|
|
|
64
64
|
// src/tool-support/attribution.ts
|
|
65
65
|
var GITHUB_REQUEST_ATTRIBUTION_START = "<!-- junior-request-attribution:start -->";
|
|
@@ -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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.274.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.274.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@oxlint/plugins": "1.79.0",
|
|
@@ -11,7 +11,7 @@ Guide evidence-first GitHub repository work from inspection through a reviewable
|
|
|
11
11
|
- Treat shallow clones as inspection checkouts; deepen before history work; never force-push around missing ancestry.
|
|
12
12
|
- Install dependencies with the lockfile frozen mode before verification when needed.
|
|
13
13
|
- Finish every code change with a pushed PR, without asking, unless the user opts out or asked for investigation only. Open it ready when work and checks are done; open a draft when work, checks, or decisions remain. An open scope question goes in the PR body, not in a stop.
|
|
14
|
-
- After each push to a branch with an open PR, check mergeability. Resolve conflicts without asking, by merging the PR base branch (usually the default branch). Never rebase for this. GitHub sends no event for a new conflict, and conflicted PRs get no new checks. The plugin publishes `pull_request.merge_conflict` for a watched PR only when another webhook event arrives for it, so the post-push check stays.
|
|
14
|
+
- After each push to a branch with an open PR, check mergeability. Resolve conflicts without asking, by merging the PR base branch (usually the default branch). Never rebase for this, except in a stack: a stack merges only with a linear history, so stacked PRs restack with `gh stack`. When a stacked PR merges, restack the open PRs above it, because GitHub sends them no event when its own rebase stops at a conflict. GitHub sends no event for a new conflict, and conflicted PRs get no new checks. The plugin publishes `pull_request.merge_conflict` for a watched PR only when another webhook event arrives for it, so the post-push check stays.
|
|
15
15
|
- Write conventional PR titles and short plain-English bodies; keep check results out of the PR body.
|
|
16
16
|
- Report exact validation and permission failures.
|
|
17
17
|
|
|
@@ -38,6 +38,7 @@ Open this when making repository edits, not for read-only inspection.
|
|
|
38
38
|
- Run `gh pr view NUMBER --repo owner/repo --json mergeable,baseRefName`.
|
|
39
39
|
- `UNKNOWN`: GitHub is still calculating it. Wait about 5 seconds and check again, up to 3 times. If it stays `UNKNOWN`, report that and continue.
|
|
40
40
|
- `CONFLICTING`: resolve it now. Do not ask first. GitHub checks mergeability against the PR base (`baseRefName`), which is usually the default branch. Fetch the base and merge `origin/BASE` into the PR branch. Do not rebase. Resolve each conflict so that both the PR change and the base branch change stay intact. Run the checks again, push, and check mergeability again.
|
|
41
|
+
- Stacked PR (`gh api 'repos/owner/repo/stacks?pull_request=NUMBER'` returns a stack): a stack merges only with a linear history, so rebase instead of merge. Run `gh stack checkout NUMBER` and `gh stack rebase`, resolve each conflict, run `gh stack rebase --continue`, run the checks, and `gh stack push`.
|
|
41
42
|
4. Resolve the actual default branch.
|
|
42
43
|
5. Update an existing PR for the branch with `github_updatePullRequest`, or create with `github_createPullRequest` (`draft: true` only when work, checks, or decisions remain; otherwise ready for review).
|
|
43
44
|
6. PR title matches the current dominant change, same conventional form as commits.
|
|
@@ -48,4 +49,4 @@ Open this when making repository edits, not for read-only inspection.
|
|
|
48
49
|
|
|
49
50
|
## Follow
|
|
50
51
|
|
|
51
|
-
When PR creation returns a subscribable hint, subscribe to suggested review/CI events. Fix routine review feedback and failed checks without a thread update. Reply only when the requester needs to act, or when the PR merges or closes.
|
|
52
|
+
When PR creation returns a subscribable hint, subscribe to suggested review/CI events. Fix routine review feedback and failed checks without a thread update. When a PR in a stack merges, restack the open PRs above it with `gh stack sync` before you reply; GitHub sends them no event when its own rebase stops at a conflict. Reply only when the requester needs to act, or when the PR merges or closes.
|