@sentry/junior-github 0.281.0 → 0.283.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/testing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  normalizeGitHubEvents
3
- } from "./chunk-NSAVG2P3.js";
3
+ } from "./chunk-XOE6HDSA.js";
4
4
  export {
5
5
  normalizeGitHubEvents
6
6
  };
@@ -0,0 +1,172 @@
1
+ import { type Actor, type Identity, type PluginEgress, type PluginLogger, type User } from "@sentry/junior-plugin-api";
2
+ /**
3
+ * Read one GitHub issue. Sandbox issue reads are routed here so the result can
4
+ * tell the agent to claim an issue that the requester does not own yet.
5
+ */
6
+ export declare function createGitHubGetIssueTool(ctx: {
7
+ actor?: Actor;
8
+ egress: PluginEgress;
9
+ events: {
10
+ canSubscribe: boolean;
11
+ };
12
+ log: PluginLogger;
13
+ users: {
14
+ resolveActor(): Promise<{
15
+ identity?: Identity;
16
+ user?: User;
17
+ } | undefined>;
18
+ };
19
+ }): import("@sentry/junior-plugin-api").PluginToolDefinition<{
20
+ repo: string;
21
+ number: number;
22
+ }, {
23
+ objectAnnotations?: {
24
+ kind: "object";
25
+ key: string;
26
+ label: string;
27
+ objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
28
+ title: string;
29
+ url: string | null;
30
+ description?: string | undefined;
31
+ status?: string | undefined;
32
+ trigger?: string | undefined;
33
+ warning?: string | undefined;
34
+ displayType?: string | undefined;
35
+ sourceUpdatedAt?: string | undefined;
36
+ facts?: {
37
+ type: "code_change";
38
+ author?: string | undefined;
39
+ sourceBranch?: string | undefined;
40
+ targetBranch?: string | undefined;
41
+ reviewers?: string[] | undefined;
42
+ review?: "approved" | "changes_requested" | "required" | undefined;
43
+ checks?: {
44
+ passed: number;
45
+ failed: number;
46
+ pending: number;
47
+ } | undefined;
48
+ mergeable?: boolean | undefined;
49
+ changedFiles?: number | undefined;
50
+ additions?: number | undefined;
51
+ deletions?: number | undefined;
52
+ } | {
53
+ type: "task";
54
+ assignees?: string[] | undefined;
55
+ priority?: string | undefined;
56
+ project?: string | undefined;
57
+ cycle?: string | undefined;
58
+ dueDate?: string | undefined;
59
+ labels?: string[] | undefined;
60
+ } | {
61
+ type: "deployment";
62
+ project?: string | undefined;
63
+ environment?: string | undefined;
64
+ revision?: string | undefined;
65
+ branch?: string | undefined;
66
+ } | {
67
+ type: "calendar_event";
68
+ when?: string | undefined;
69
+ attendees?: string[] | undefined;
70
+ } | undefined;
71
+ }[] | undefined;
72
+ truncated?: boolean | undefined;
73
+ continuation?: {
74
+ arguments: Record<string, unknown>;
75
+ reason?: string | undefined;
76
+ } | undefined;
77
+ assignees: string[];
78
+ author?: string | undefined;
79
+ body: string | null;
80
+ comments: number;
81
+ labels: string[];
82
+ note?: string | undefined;
83
+ number: number;
84
+ state: string;
85
+ subscribable?: {
86
+ identifier: string;
87
+ label: string;
88
+ match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
89
+ namespace: string;
90
+ suggested_events?: string[] | undefined;
91
+ supported_events: string[];
92
+ type: string;
93
+ } | undefined;
94
+ title: string;
95
+ url: string;
96
+ target: "getIssue";
97
+ }, {
98
+ objectAnnotations?: {
99
+ kind: "object";
100
+ key: string;
101
+ label: string;
102
+ objectType: "automation" | "calendar_event" | "code_change" | "deployment" | "item" | "task";
103
+ title: string;
104
+ url: string | null;
105
+ description?: string | undefined;
106
+ status?: string | undefined;
107
+ trigger?: string | undefined;
108
+ warning?: string | undefined;
109
+ displayType?: string | undefined;
110
+ sourceUpdatedAt?: string | undefined;
111
+ facts?: {
112
+ type: "code_change";
113
+ author?: string | undefined;
114
+ sourceBranch?: string | undefined;
115
+ targetBranch?: string | undefined;
116
+ reviewers?: string[] | undefined;
117
+ review?: "approved" | "changes_requested" | "required" | undefined;
118
+ checks?: {
119
+ passed: number;
120
+ failed: number;
121
+ pending: number;
122
+ } | undefined;
123
+ mergeable?: boolean | undefined;
124
+ changedFiles?: number | undefined;
125
+ additions?: number | undefined;
126
+ deletions?: number | undefined;
127
+ } | {
128
+ type: "task";
129
+ assignees?: string[] | undefined;
130
+ priority?: string | undefined;
131
+ project?: string | undefined;
132
+ cycle?: string | undefined;
133
+ dueDate?: string | undefined;
134
+ labels?: string[] | undefined;
135
+ } | {
136
+ type: "deployment";
137
+ project?: string | undefined;
138
+ environment?: string | undefined;
139
+ revision?: string | undefined;
140
+ branch?: string | undefined;
141
+ } | {
142
+ type: "calendar_event";
143
+ when?: string | undefined;
144
+ attendees?: string[] | undefined;
145
+ } | undefined;
146
+ }[] | undefined;
147
+ truncated?: boolean | undefined;
148
+ continuation?: {
149
+ arguments: Record<string, unknown>;
150
+ reason?: string | undefined;
151
+ } | undefined;
152
+ assignees: string[];
153
+ author?: string | undefined;
154
+ body: string | null;
155
+ comments: number;
156
+ labels: string[];
157
+ note?: string | undefined;
158
+ number: number;
159
+ state: string;
160
+ subscribable?: {
161
+ identifier: string;
162
+ label: string;
163
+ match?: Record<string, string | number | boolean | (string | number)[]> | undefined;
164
+ namespace: string;
165
+ suggested_events?: string[] | undefined;
166
+ supported_events: string[];
167
+ type: string;
168
+ } | undefined;
169
+ title: string;
170
+ url: string;
171
+ target: "getIssue";
172
+ }>;
@@ -29,6 +29,7 @@ export declare function createGitHubUpdateIssueTool(ctx: {
29
29
  title?: string | undefined;
30
30
  body?: string | undefined;
31
31
  state?: "closed" | "open" | undefined;
32
+ assign_requester?: boolean | undefined;
32
33
  }, {
33
34
  objectAnnotations?: {
34
35
  kind: "object";
@@ -84,6 +85,7 @@ export declare function createGitHubUpdateIssueTool(ctx: {
84
85
  arguments: Record<string, unknown>;
85
86
  reason?: string | undefined;
86
87
  } | undefined;
88
+ assignees: string[];
87
89
  body: string | null;
88
90
  number: number;
89
91
  state: string;
@@ -154,6 +156,7 @@ export declare function createGitHubUpdateIssueTool(ctx: {
154
156
  arguments: Record<string, unknown>;
155
157
  reason?: string | undefined;
156
158
  } | undefined;
159
+ assignees: string[];
157
160
  body: string | null;
158
161
  number: number;
159
162
  state: string;
@@ -43,6 +43,8 @@ export interface GitHubPullRequestMergeState {
43
43
  * only when GitHub says the pull request can merge cleanly.
44
44
  */
45
45
  approved: boolean;
46
+ /** A person turned on auto-merge, so GitHub merges it without them. */
47
+ autoMerge: boolean;
46
48
  draft: boolean;
47
49
  /**
48
50
  * GitHub's `mergeable_state`, such as `clean` or `blocked`. `clean` means
@@ -58,7 +60,7 @@ export interface GitHubPullRequestMergeState {
58
60
  * Read whether a pull request is ready to merge, with a read-only token.
59
61
  * GitHub computes `mergeable_state` after a change, so an unknown state is
60
62
  * read once more. Reviews load only for an open pull request that is not a
61
- * draft and can merge cleanly. Each reviewer counts by their latest
63
+ * draft, has no auto-merge, and can merge cleanly. Each reviewer counts by their latest
62
64
  * approval, change request, or dismissal. Comments do not change the result.
63
65
  */
64
66
  export declare function loadPullRequestMergeState(env: GitHubInstallationEnv, pullRequest: {
@@ -2,7 +2,8 @@
2
2
  * The "ready to merge" notice on the review desk for a Junior pull request.
3
3
  *
4
4
  * A pull request is ready to merge when it is open, not a draft, approved,
5
- * and GitHub's merge state is `clean`. Each webhook that can change one of
5
+ * and GitHub's merge state is `clean`. With auto-merge on, GitHub merges it,
6
+ * so no person needs the notice. Each webhook that can change one of
6
7
  * these facts reads them again from GitHub. The notice goes to the
7
8
  * Conversation where a person asked Junior to open the pull request. It is
8
9
  * assigned to that person only when they are in that Conversation. It closes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-github",
3
- "version": "0.281.0",
3
+ "version": "0.283.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.281.0"
35
+ "@sentry/junior-plugin-api": "0.283.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@oxlint/plugins": "1.79.0",
@@ -46,7 +46,8 @@ If the user omits `owner/repo`, run `jr-rpc config get github.repo`. Then pass `
46
46
  | Resolve review thread | `github_resolvePullRequestReviewThread` |
47
47
  | Inline review comment | `gh api repos/owner/repo/pulls/NUMBER/comments --method POST --input comment.json` |
48
48
  | View PR / checks | `gh pr view NUMBER --repo owner/repo` / `gh pr checks NUMBER --repo owner/repo` |
49
- | PR mergeability | `gh pr view NUMBER --repo owner/repo --json mergeable,baseRefName` |
49
+ | PR merge state | `gh pr view NUMBER --repo owner/repo --json mergeStateStatus,reviewDecision,autoMergeRequest` |
50
+ | Branch merge rules | `gh api repos/owner/repo/rules/branches/BRANCH` |
50
51
  | Diff PR | `gh pr diff NUMBER --repo owner/repo` |
51
52
  | List runs | `gh run list -R owner/repo --workflow WORKFLOW` |
52
53
  | View / watch run | `gh run view RUN_ID -R owner/repo` / `gh run watch RUN_ID -R owner/repo --exit-status` |
@@ -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
- Create issues with `github_createIssue`. Update issue title, body, or state with `github_updateIssue`. Use `gh` for comments, labels, and inspection.
8
+ Create issues with `github_createIssue`. Read one issue with `github_getIssue`. Update issue title, body, or state with `github_updateIssue`. Use `gh` for comments, labels, and issue lists.
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
@@ -94,7 +94,7 @@ Run [references/issue-quality-checklist.md](references/issue-quality-checklist.m
94
94
 
95
95
  - Use `github_createIssue` for new issues so the runtime owns idempotency and session-link footers.
96
96
  - Use `github_updateIssue` for issue title, body, or state changes so the runtime 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
+ - Use `gh` commands from [references/api-surface.md](references/api-surface.md) for comments, labels, assignees, and issue lists.
98
98
  - For issue listing or other read-only inspection, prefer `--json` output so empty results still produce deterministic stdout.
99
99
  - Check duplicates silently before creating a new issue. Do not mention this check in the final reply unless a duplicate blocks creation.
100
100
 
@@ -1,6 +1,6 @@
1
1
  # GitHub Issue API Surface
2
2
 
3
- Issue creation uses `github_createIssue`. Issue title, body, and state updates use `github_updateIssue` so the runtime 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.
3
+ Issue creation uses `github_createIssue`, one-issue reads use `github_getIssue`, and title, body, and state updates use `github_updateIssue`. Comments, labels, assignees, and issue lists use `gh`; generic GraphQL-backed `gh issue` mutations are not supported.
4
4
 
5
5
  ## Repo scoping
6
6
 
@@ -10,27 +10,27 @@ Treat explicit repo flags as command-targeting safety rails, not as a credential
10
10
 
11
11
  ## GitHub App permission guidance
12
12
 
13
- | Permission capability | Operations |
14
- | --------------------- | ------------------------------------------------------------------------------------ |
15
- | `github.issues.read` | `gh issue view`, `gh api /repos/.../comments` |
13
+ | Permission capability | Operations |
14
+ | --------------------- | ------------------------------------------------------------------------------------------------------ |
15
+ | `github.issues.read` | `github_getIssue`, `gh api /repos/.../comments` |
16
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
- | Operation | Command |
21
- | ------------------- | ------------------------------------------------------------------------------------------------------------- |
22
- | Create issue | `github_createIssue({ repo: "owner/repo", title: "...", body: "...", labels: ["..."] })` |
20
+ | Operation | Command |
21
+ | ------------------- | --------------------------------------------------------------------------------------------------------------------- |
22
+ | Create issue | `github_createIssue({ repo: "owner/repo", title: "...", body: "...", labels: ["..."] })` |
23
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
- | Add labels | `gh api repos/owner/repo/issues/NUMBER/labels --method POST --input labels.json` |
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` |
30
- | Add comment | `gh api repos/owner/repo/issues/NUMBER/comments --method POST --input comment.json` |
31
- | List issues | `gh issue list --repo owner/repo --json number,title,state,url --limit 20` |
32
- | Read issue | `gh issue view NUMBER --repo owner/repo --json number,title,state,labels,assignees,author,url,body` |
33
- | Read comments | `gh api /repos/owner/repo/issues/NUMBER/comments --method GET --header "Accept: application/vnd.github+json"` |
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
+ | Add labels | `gh api repos/owner/repo/issues/NUMBER/labels --method POST --input labels.json` |
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` |
30
+ | Add comment | `gh api repos/owner/repo/issues/NUMBER/comments --method POST --input comment.json` |
31
+ | List issues | `gh issue list --repo owner/repo --json number,title,state,url --limit 20` |
32
+ | Read issue | `github_getIssue({ repo: "owner/repo", number: NUMBER })` |
33
+ | Read comments | `gh api /repos/owner/repo/issues/NUMBER/comments --method GET --header "Accept: application/vnd.github+json"` |
34
34
 
35
35
  ## Config helpers
36
36
 
@@ -12,7 +12,7 @@ Use this table to recover quickly while keeping operations deterministic.
12
12
  | `junior-auth-required provider=github grant=user-write` | User-to-server OAuth is missing or stale for a human-identity operation. | Follow the private OAuth prompt; do not ask the user to paste or manage tokens manually. |
13
13
  | 403 without `permission_denied` where `source: "upstream"` | The runtime may have rejected an unsupported route before contacting GitHub. | Read the response body. Follow any required-tool instruction; do not ask for GitHub permissions unless the failure is confirmed upstream. |
14
14
  | `permission_denied` with `source: "upstream"` | GitHub rejected the forwarded request. | Read GitHub's error first. If the message says GitHub denied access, verify the target, App permissions, and installation scope. Do not request user OAuth for a bot-owned issue operation. |
15
- | 404 Not Found | Issue number or repo is wrong. | Validate repo + issue ID with `gh issue view NUMBER --repo owner/repo`. |
15
+ | 404 Not Found | Issue number or repo is wrong. | Validate repo + issue ID with `github_getIssue`. |
16
16
  | Issue label mutation fails | Wrong REST payload or wrong repo context. | Use the allowlisted issue labels endpoint with an explicit `owner/repo` path and valid JSON input. |
17
17
  | Comment command fails with empty body | JSON input is missing a non-empty `body`. | Ensure the REST comment payload contains a non-empty `body` before retrying. |
18
18