@sentry/junior-github 0.155.0 → 0.157.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/index.js +3794 -3530
- package/dist/pull-request-outcomes/store.d.ts +4 -0
- package/dist/pull-request-review-policy.d.ts +6 -0
- package/dist/tools/update-issue.d.ts +51 -0
- package/package.json +2 -2
- package/skills/github-code/SKILL.md +4 -4
- package/skills/github-code/references/api-surface.md +4 -3
- package/skills/github-code/references/troubleshooting-workarounds.md +2 -0
- package/skills/github-issues/SKILL.md +3 -2
- package/skills/github-issues/references/api-surface.md +9 -5
|
@@ -48,6 +48,10 @@ export declare function recordGitHubPullRequestOutcome(db: GitHubDb, input: GitH
|
|
|
48
48
|
}>;
|
|
49
49
|
/** Return candidate conversations that have an associated unmerged pull request. */
|
|
50
50
|
export declare function listGitHubUnfinishedWork(db: GitHubDb, conversationIds: string[]): Promise<string[]>;
|
|
51
|
+
/** Return the latest merge time for each candidate conversation. */
|
|
52
|
+
export declare function listGitHubFinishedWork(db: GitHubDb, conversationIds: string[]): Promise<Record<string, string>>;
|
|
53
|
+
/** Return candidate conversations linked to any Junior-owned pull request. */
|
|
54
|
+
export declare function listGitHubAssignedWork(db: GitHubDb, conversationIds: string[]): Promise<string[]>;
|
|
51
55
|
/** Append native conversation ids to an existing Junior-owned PR projection. */
|
|
52
56
|
export declare function recordGitHubPullRequestConversations(db: GitHubDb, input: GitHubPullRequestConversationsInput): Promise<boolean>;
|
|
53
57
|
/** Link an existing Junior-owned PR to tracked issues across repositories. */
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ToolRegistrationHookContext } from "@sentry/junior-plugin-api";
|
|
2
|
+
/** Update mutable issue metadata while preserving Junior-owned body attribution. */
|
|
3
|
+
export declare function createGitHubUpdateIssueTool(ctx: ToolRegistrationHookContext): import("@sentry/junior-plugin-api").PluginToolDefinition<{
|
|
4
|
+
repo: string;
|
|
5
|
+
number: number;
|
|
6
|
+
title?: string | undefined;
|
|
7
|
+
body?: string | undefined;
|
|
8
|
+
state?: "open" | "closed" | undefined;
|
|
9
|
+
}, {
|
|
10
|
+
[x: string]: unknown;
|
|
11
|
+
body: string | null;
|
|
12
|
+
number: number;
|
|
13
|
+
state: string;
|
|
14
|
+
title: string;
|
|
15
|
+
url: string;
|
|
16
|
+
target: "updateIssue";
|
|
17
|
+
truncated?: boolean | undefined;
|
|
18
|
+
continuation?: {
|
|
19
|
+
arguments: Record<string, unknown>;
|
|
20
|
+
reason?: string | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
subscribable?: {
|
|
23
|
+
identifier: string;
|
|
24
|
+
label: string;
|
|
25
|
+
namespace: string;
|
|
26
|
+
supportedEvents: string[];
|
|
27
|
+
type: string;
|
|
28
|
+
suggestedEvents?: string[] | undefined;
|
|
29
|
+
} | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
[x: string]: unknown;
|
|
32
|
+
body: string | null;
|
|
33
|
+
number: number;
|
|
34
|
+
state: string;
|
|
35
|
+
title: string;
|
|
36
|
+
url: string;
|
|
37
|
+
target: "updateIssue";
|
|
38
|
+
truncated?: boolean | undefined;
|
|
39
|
+
continuation?: {
|
|
40
|
+
arguments: Record<string, unknown>;
|
|
41
|
+
reason?: string | undefined;
|
|
42
|
+
} | undefined;
|
|
43
|
+
subscribable?: {
|
|
44
|
+
identifier: string;
|
|
45
|
+
label: string;
|
|
46
|
+
namespace: string;
|
|
47
|
+
supportedEvents: string[];
|
|
48
|
+
type: string;
|
|
49
|
+
suggestedEvents?: string[] | undefined;
|
|
50
|
+
} | undefined;
|
|
51
|
+
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-github",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.157.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.
|
|
34
|
+
"@sentry/junior-plugin-api": "0.157.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^25.9.1",
|
|
@@ -5,7 +5,7 @@ description: Work with GitHub repositories, source code, branches, commits, pull
|
|
|
5
5
|
|
|
6
6
|
# GitHub Code Operations
|
|
7
7
|
|
|
8
|
-
Use `git` and `gh` for repository work. Use `github_createPullRequest`, not `gh pr create`, for new PRs.
|
|
8
|
+
Use `git` and `gh` for repository work. Use `github_createPullRequest`, not `gh pr create`, for new PRs. Use `github_updatePullRequest`, not raw `gh api`/`gh pr edit`, when changing PR title, body, base, or open/closed state.
|
|
9
9
|
|
|
10
10
|
## References
|
|
11
11
|
|
|
@@ -64,7 +64,7 @@ Unless the user explicitly says not to create a PR, every completed repository e
|
|
|
64
64
|
2. Commit using repo conventions; otherwise use `<type>(<scope>): <Subject>` in imperative present tense, with no agent branding.
|
|
65
65
|
3. Push explicitly with `git push -u origin BRANCH`.
|
|
66
66
|
4. Resolve the actual default branch.
|
|
67
|
-
5. Reuse and update an existing PR for the branch
|
|
67
|
+
5. Reuse and update an existing PR for the branch with `github_updatePullRequest`; otherwise call `github_createPullRequest` with explicit repo, head, base, title, body, and `draft: true` unless the user or repo explicitly requires ready-for-review.
|
|
68
68
|
|
|
69
69
|
PR titles use the same conventional form as commits: `<type>(<scope>): <Subject>` or `<type>: <Subject>`. Match the current dominant change, not the latest commit or a stale title.
|
|
70
70
|
|
|
@@ -72,9 +72,9 @@ Write the PR body for a reviewer who knows the product but not this change. Use
|
|
|
72
72
|
|
|
73
73
|
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
74
|
|
|
75
|
-
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
|
|
75
|
+
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.
|
|
76
76
|
|
|
77
|
-
If PR creation is blocked, report the exact failed command/tool call and leave the committed branch intact.
|
|
77
|
+
If PR creation or update is blocked, report the exact failed command/tool call and leave the committed branch intact.
|
|
78
78
|
|
|
79
79
|
### 6. Follow and report
|
|
80
80
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GitHub API Surface — code & pull requests
|
|
2
2
|
|
|
3
|
-
PR creation uses Junior's `github_createPullRequest` tool.
|
|
3
|
+
PR creation uses Junior's `github_createPullRequest` tool. PR title, body, base, and open/closed state updates use `github_updatePullRequest` so Junior keeps requester attribution and the conversation footer. Other supported mutations use allowlisted REST endpoints through `gh api`; generic GraphQL-backed `gh pr` mutations are not supported.
|
|
4
4
|
|
|
5
5
|
## Repo scoping
|
|
6
6
|
|
|
@@ -42,11 +42,11 @@ Treat explicit repo flags as command-targeting safety rails, not as a credential
|
|
|
42
42
|
| Rerun workflow job | `gh run rerun --job JOB_ID -R owner/repo` |
|
|
43
43
|
| Cancel workflow run | `gh run cancel RUN_ID -R owner/repo` |
|
|
44
44
|
| Create pull request (draft) | `github_createPullRequest({ repo: "owner/repo", head: "BRANCH", base: "BASE", title: "...", body: "...", draft: true })` |
|
|
45
|
-
| Update pull request | `
|
|
45
|
+
| Update pull request | `github_updatePullRequest({ repo: "owner/repo", number: NUMBER, title?: "...", body?: "...", base?: "BASE", state?: "open" \| "closed" })` |
|
|
46
46
|
| Mark ready for review | `gh api repos/owner/repo/pulls/NUMBER/ready_for_review --method POST` |
|
|
47
47
|
| Request reviewers | `gh api repos/owner/repo/pulls/NUMBER/requested_reviewers --method POST --input reviewers.json` |
|
|
48
48
|
| Remove requested reviewers | `gh api repos/owner/repo/pulls/NUMBER/requested_reviewers --method DELETE --input reviewers.json` |
|
|
49
|
-
| Close pull request | `
|
|
49
|
+
| Close pull request | `github_updatePullRequest({ repo: "owner/repo", number: NUMBER, state: "closed" })` |
|
|
50
50
|
| Submit pull request review | `gh api repos/owner/repo/pulls/NUMBER/reviews --method POST --input review.json` |
|
|
51
51
|
| Post inline review comment | `gh api repos/owner/repo/pulls/NUMBER/comments --method POST --input comment.json` |
|
|
52
52
|
| Reply to inline review comment | `gh api repos/owner/repo/pulls/NUMBER/comments/COMMENT_ID/replies --method POST --input reply.json` |
|
|
@@ -75,6 +75,7 @@ jr-rpc config set github.repo owner/repo
|
|
|
75
75
|
- If the commit changes workflow files under `.github/workflows`, the App installation needs Workflows write in addition to Contents write.
|
|
76
76
|
- Before rebasing, merge-base analysis, blame/history inspection, or a base comparison, check whether the repository is shallow. Fetch a bounded depth of the base into `refs/remotes/origin/BASE`, deepen incrementally until the needed ancestry is present, and compare against `origin/BASE`; use `--unshallow` only when bounded deepening is insufficient. Never force-push to work around missing ancestry.
|
|
77
77
|
- Before `github_createPullRequest`, push the head branch explicitly and resolve the target repo's default branch for `base`. That push requires GitHub write access to the remote.
|
|
78
|
+
- Use `github_updatePullRequest` for title, body, base, or open/closed state changes. Do not raw-`PATCH` `/repos/.../pulls/NUMBER`; that path is denied so Junior can keep the conversation footer.
|
|
78
79
|
- Merge, fork creation, REST contents/Git database writes, and repository administration are outside the current write allowlist.
|
|
79
80
|
- Pull request reviews and inline review comments use the same repository-scoped `installation-write` credential as other bot-owned PR writes, so they post as Junior even on headless turns. Merge remains denied.
|
|
80
81
|
- If the explicit `git push` fails with 401/403 or another access/permission error, verify the repo context and retry once. If it still fails, load troubleshooting guidance and report the exact command failure.
|
|
@@ -18,6 +18,8 @@ Use this table to recover quickly while keeping operations deterministic.
|
|
|
18
18
|
| `github_createPullRequest` returns upstream 401/403 | The App installation or target repository does not permit the operation. | Use the structured upstream denial to verify installation scope and accepted permissions; do not request user OAuth for this bot-owned operation. |
|
|
19
19
|
| `github_createPullRequest` returns 422 for `head` | The head branch was not pushed or the explicit head ref is wrong. | Push the branch, then retry with explicit `repo`, `head`, and `base` values. |
|
|
20
20
|
| `github_createPullRequest` fails with 422 validation on `base` | The `base` branch does not exist in the target repo. | Resolve the default branch with `gh repo view owner/repo --json defaultBranchRef --jq .defaultBranchRef.name`, then retry with that value as `base`. |
|
|
21
|
+
| `403` names `github_updatePullRequest` | Raw PR title/body/base/state PATCH was blocked so Junior can own the footer. | Retry with `github_updatePullRequest`; do not use `gh api .../pulls/NUMBER --method PATCH` or `gh pr edit`. |
|
|
22
|
+
| `github_updatePullRequest` returns upstream 401/403 | The App installation or target repository does not permit the operation. | Use the structured upstream denial to verify installation scope and accepted permissions; do not request user OAuth for this bot-owned operation. |
|
|
21
23
|
| `git blame`, long log history, or old commits are missing after clone | Repo was cloned shallow by design. | Fetch the required ref and deepen it incrementally; use `--unshallow` only when bounded deepening is insufficient. |
|
|
22
24
|
| Rebase, merge-base, or `origin/BASE...HEAD` comparison fails or gives odd ancestry | Required ancestry or the remote-tracking base ref is absent from the shallow clone. | Fetch a bounded depth into `BASE:refs/remotes/origin/BASE`, deepen that base ref until the merge base exists, and compare or rebase against `origin/BASE`. Never force-push around incomplete history. |
|
|
23
25
|
| Tests fail because dependencies or executables are missing | Repository dependencies were not installed. | Detect the lockfile and run the repo-native frozen/immutable install. Do not rewrite the lockfile unless dependency changes are part of the task. |
|
|
@@ -5,7 +5,7 @@ description: Create, update, comment on, label, and inspect GitHub issues with c
|
|
|
5
5
|
|
|
6
6
|
# GitHub Issue Operations
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Create issues with `github_createIssue`. Update issue title, body, or state with `github_updateIssue`. Use `gh` for comments, labels, and inspection.
|
|
9
9
|
Use only for GitHub issues. For pull requests, branches, pushes, or PR creation order questions, load `github-code` instead.
|
|
10
10
|
|
|
11
11
|
## Reference loading
|
|
@@ -93,7 +93,8 @@ Run [references/issue-quality-checklist.md](references/issue-quality-checklist.m
|
|
|
93
93
|
### 5. Execute
|
|
94
94
|
|
|
95
95
|
- Use `github_createIssue` for new issues so Junior owns idempotency and session-link footers.
|
|
96
|
-
- Use `
|
|
96
|
+
- Use `github_updateIssue` for issue title, body, or state changes so Junior preserves requester attribution and the session footer.
|
|
97
|
+
- Use `gh` commands from [references/api-surface.md](references/api-surface.md) for comments, labels, assignees, and read-only operations.
|
|
97
98
|
- For issue listing or other read-only inspection, prefer `--json` output so empty results still produce deterministic stdout.
|
|
98
99
|
- Check duplicates silently before creating a new issue. Do not mention this check in the final reply unless a duplicate blocks creation.
|
|
99
100
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# GitHub Issue API Surface
|
|
2
2
|
|
|
3
|
-
Issue creation uses
|
|
3
|
+
Issue creation uses `github_createIssue`. Issue title, body, and state updates use `github_updateIssue` so Junior keeps requester attribution and the conversation footer. Comments, labels, assignees, and reads use allowlisted REST endpoints through `gh api`; generic GraphQL-backed `gh issue` mutations are not supported.
|
|
4
4
|
|
|
5
5
|
## Repo scoping
|
|
6
6
|
|
|
@@ -13,18 +13,20 @@ Treat explicit repo flags as command-targeting safety rails, not as a credential
|
|
|
13
13
|
| Permission capability | Operations |
|
|
14
14
|
| --------------------- | ------------------------------------------------------------------------------------ |
|
|
15
15
|
| `github.issues.read` | `gh issue view`, `gh api /repos/.../comments` |
|
|
16
|
-
| `github.issues.write` |
|
|
16
|
+
| `github.issues.write` | Typed issue create/update tools and allowlisted comment, label, or assignee endpoints through `gh api` |
|
|
17
17
|
|
|
18
18
|
## Command matrix
|
|
19
19
|
|
|
20
20
|
| Operation | Command |
|
|
21
21
|
| ------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
22
22
|
| Create issue | `github_createIssue({ repo: "owner/repo", title: "...", body: "...", labels: ["..."] })` |
|
|
23
|
-
| Update issue fields | `
|
|
24
|
-
| Close issue | `
|
|
25
|
-
| Reopen issue | `
|
|
23
|
+
| Update issue fields | `github_updateIssue({ repo: "owner/repo", number: NUMBER, title?: "...", body?: "...", state?: "open" \| "closed" })` |
|
|
24
|
+
| Close issue | `github_updateIssue({ repo: "owner/repo", number: NUMBER, state: "closed" })` |
|
|
25
|
+
| Reopen issue | `github_updateIssue({ repo: "owner/repo", number: NUMBER, state: "open" })` |
|
|
26
26
|
| Add labels | `gh api repos/owner/repo/issues/NUMBER/labels --method POST --input labels.json` |
|
|
27
27
|
| Remove label | `gh api repos/owner/repo/issues/NUMBER/labels/LABEL --method DELETE` |
|
|
28
|
+
| Add assignees | `gh api repos/owner/repo/issues/NUMBER/assignees --method POST --input assignees.json` |
|
|
29
|
+
| Remove assignees | `gh api repos/owner/repo/issues/NUMBER/assignees --method DELETE --input assignees.json` |
|
|
28
30
|
| Add comment | `gh api repos/owner/repo/issues/NUMBER/comments --method POST --input comment.json` |
|
|
29
31
|
| List issues | `gh issue list --repo owner/repo --json number,title,state,url --limit 20` |
|
|
30
32
|
| Read issue | `gh issue view NUMBER --repo owner/repo --json number,title,state,labels,assignees,author,url,body` |
|
|
@@ -42,5 +44,7 @@ jr-rpc config set github.repo owner/repo
|
|
|
42
44
|
- Prefer `--json` output for machine-readable parsing where available.
|
|
43
45
|
- Use `gh api` for endpoints not fully covered by `gh issue` subcommands.
|
|
44
46
|
- For creation, call `github_createIssue` directly instead of shelling out to `gh issue create`.
|
|
47
|
+
- Use `github_updateIssue` for title, body, or state changes. Raw issue PATCH is denied because GitHub also uses that endpoint for pull requests.
|
|
48
|
+
- Use the dedicated assignees endpoint for assignment changes. Do not send `assignees` through `github_updateIssue`.
|
|
45
49
|
- Keep `--repo owner/repo` explicit when working across repositories.
|
|
46
50
|
- Return actionable errors for access, permission, not-found, and validation failures.
|