@sentry/junior-github 0.1.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # @sentry/junior-github
2
+
3
+ `@sentry/junior-github` adds GitHub issue workflows to Junior using a GitHub App.
4
+
5
+ Install it alongside `@sentry/junior`:
6
+
7
+ ```bash
8
+ pnpm add @sentry/junior @sentry/junior-github
9
+ ```
10
+
11
+ For full setup, configuration, and verification steps, see [skills/github/README.md](skills/github/README.md).
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "@sentry/junior-github",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "type": "module",
9
+ "files": [
10
+ "plugin.yaml",
11
+ "skills"
12
+ ]
13
+ }
package/plugin.yaml ADDED
@@ -0,0 +1,29 @@
1
+ name: github
2
+ description: GitHub issue management via GitHub App
3
+
4
+ capabilities:
5
+ - issues.read
6
+ - issues.write
7
+ - issues.comment
8
+ - labels.write
9
+
10
+ config-keys:
11
+ - repo
12
+
13
+ credentials:
14
+ type: github-app
15
+ api-domains:
16
+ - api.github.com
17
+ auth-token-env: GITHUB_TOKEN
18
+ auth-token-placeholder: ghp_host_managed_credential
19
+ app-id-env: GITHUB_APP_ID
20
+ private-key-env: GITHUB_APP_PRIVATE_KEY
21
+ installation-id-env: GITHUB_INSTALLATION_ID
22
+
23
+ target:
24
+ type: repo
25
+ config-key: repo
26
+
27
+ runtime-dependencies:
28
+ - type: system
29
+ package: gh
@@ -0,0 +1,101 @@
1
+ # github setup
2
+
3
+ This skill uses host-issued GitHub App installation tokens.
4
+
5
+ ## 1) Create/install GitHub App
6
+
7
+ In GitHub:
8
+ 1. Go to `Settings -> Developer settings -> GitHub Apps -> New GitHub App`.
9
+ 2. Set app name and callback URL (any valid HTTPS URL is fine if you do not use web flow).
10
+ 3. Under repository permissions, grant:
11
+ - Issues: Read and write
12
+ - Metadata: Read
13
+ 4. Create the app and generate a private key.
14
+ 5. Install the app on the target org/repo(s).
15
+
16
+ Install the app on target repos/orgs and collect:
17
+ - `GITHUB_APP_ID`
18
+ - `GITHUB_APP_PRIVATE_KEY` (PEM)
19
+
20
+ ## 2) Configure host runtime
21
+
22
+ Set on the harness host (never in skill files):
23
+ - `GITHUB_APP_ID`
24
+ - `GITHUB_APP_PRIVATE_KEY`
25
+ - `GITHUB_INSTALLATION_ID`
26
+
27
+ ### Vercel env setup (multiline-safe)
28
+
29
+ `GITHUB_APP_PRIVATE_KEY` is accepted as:
30
+ - Raw PEM (multiline)
31
+ - Escaped-newline PEM (single-line with `\n`)
32
+ - Base64-encoded PEM
33
+
34
+ For Vercel, prefer CLI file input so newlines are preserved exactly:
35
+
36
+ ```bash
37
+ vercel env add GITHUB_APP_ID production
38
+ vercel env add GITHUB_INSTALLATION_ID production
39
+ vercel env add GITHUB_APP_PRIVATE_KEY production --sensitive < ./github-app-private-key.pem
40
+ ```
41
+
42
+ If variables already exist, use `vercel env update` instead of `vercel env add`:
43
+
44
+ ```bash
45
+ vercel env update GITHUB_APP_PRIVATE_KEY production --sensitive < ./github-app-private-key.pem
46
+ ```
47
+
48
+ Repeat for `preview` and `development` as needed. After env changes, redeploy so the new deployment picks up updated values.
49
+
50
+ ## 3) Runtime behavior
51
+
52
+ - Credentials are issued lazily when `jr-rpc issue-credential <capability>` is run.
53
+ - Issued credentials are reused for the rest of the current turn.
54
+ - Sandbox does not receive raw tokens via env; host applies scoped Authorization header transforms for GitHub API calls.
55
+
56
+ ## 4) CLI usage
57
+
58
+ Run as a regular sandbox `bash` command while this skill is active:
59
+
60
+ ```bash
61
+ jr-rpc issue-credential github.issues.write
62
+ gh issue create --repo owner/repo --title "Example issue" --body-file /vercel/sandbox/tmp/issue.md
63
+ ```
64
+
65
+ `gh` supports either direct `GITHUB_TOKEN` (for local debugging) or sandbox-level header injection.
66
+ Use `github.issues.read` for read-only commands (`view`, comment reads via `gh api`), `github.issues.comment` for comments, and `github.labels.write` for label updates.
67
+
68
+ Optional: set a default repository once per channel/thread context so `--repo` is not needed each turn:
69
+
70
+ ```bash
71
+ jr-rpc config set github.repo getsentry/junior
72
+ ```
73
+
74
+ ## 5) Quick verification
75
+
76
+ - `pnpm skills:check`
77
+ - Create issue in a test repo.
78
+ - Update/comment/label the same issue.
79
+ - Use read-only commands (`gh issue view`, `gh api .../comments`) for issue inspection.
80
+
81
+ ## 6) Production verification (step-by-step)
82
+
83
+ 1. Confirm host env vars are present in prod:
84
+ - `GITHUB_APP_ID`
85
+ - `GITHUB_APP_PRIVATE_KEY`
86
+ - `GITHUB_INSTALLATION_ID`
87
+ 2. Confirm the GitHub App is installed on your test repo with the permissions above.
88
+ 3. Deploy `main` to prod.
89
+ 4. Run `/github` to create an issue in a safe test repo.
90
+ 5. Verify the issue is authored by the GitHub App identity.
91
+ 6. Run `/github` to update title/body, add/remove labels, and add a comment.
92
+ 7. Verify all mutations succeed and are attributed to the app.
93
+ 8. Verify GitHub API calls succeed while this skill is active without writing tokens into sandbox env/files.
94
+ 9. Verify raw token values are never printed in output or logs.
95
+ 10. Check logs for:
96
+ - `credential_issue_request`
97
+ - `credential_issue_success`
98
+ - `credential_inject_start`
99
+ - `credential_inject_cleanup`
100
+ 11. Verify logs contain no token/private-key values.
101
+ 12. Negative test: target a repo without app installation and confirm explicit failure.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: github
3
+ description: Manage GitHub issue workflows via GitHub App identity with concise, evidence-backed content. Use when users ask to open, edit, label, comment on, close/reopen, or inspect GitHub issues via /github, especially when command-level CLI guidance is needed.
4
+ requires-capabilities: github.issues.read github.issues.write github.issues.comment github.labels.write
5
+ uses-config: github.repo
6
+ allowed-tools: bash
7
+ ---
8
+
9
+ # GitHub Operations
10
+
11
+ Use this skill for `/github` workflows in the harness. Issues are the primary supported surface today.
12
+
13
+ ## Workflow
14
+
15
+ 1. Confirm operation and target:
16
+ - Determine `create`, `update`, `comment`, `labels`, `state`, or read-only inspection.
17
+ - Resolve repository (`owner/repo`) and issue number for non-create operations.
18
+ - If repository is not explicit in args, query channel config:
19
+ - `jr-rpc config get github.repo`
20
+ - If config exists and is valid `owner/repo`, use it as default.
21
+ - If repository is still missing, ask the user for `owner/repo`.
22
+
23
+ 2. Classify issue type before drafting:
24
+ - Use explicit user type when provided (`bug`, `feature`, `task`).
25
+ - Otherwise infer from intent:
26
+ - `bug`: broken behavior, regression, error, failure.
27
+ - `feature`: net-new capability or behavioral expansion.
28
+ - `task`: maintenance, cleanup, docs, refactor, operational chore.
29
+ - Default to `task` when uncertain.
30
+
31
+ 3. Draft issue content:
32
+ - Load the type-specific template:
33
+ - `bug`: [references/issue-template-bug.md](references/issue-template-bug.md)
34
+ - `feature`: [references/issue-template-feature.md](references/issue-template-feature.md)
35
+ - `task`: [references/issue-template-task.md](references/issue-template-task.md)
36
+ - Follow [references/research-rules.md](references/research-rules.md) and the type-specific research rules:
37
+ - `bug`: [references/issue-type-bug.md](references/issue-type-bug.md)
38
+ - `feature`: [references/issue-type-feature.md](references/issue-type-feature.md)
39
+ - `task`: [references/issue-type-task.md](references/issue-type-task.md)
40
+ - Generalize conversation context: replace user names, slash-command invocations, channel references, and session-specific fragments with the underlying technical problem.
41
+ - Include code snippets when they clarify the problem pattern or proposed change.
42
+ - Cross-reference related issues and PRs when they provide context.
43
+ - For quality gates, use [references/issue-quality-checklist.md](references/issue-quality-checklist.md).
44
+ - For structure examples, use [references/issue-examples.md](references/issue-examples.md).
45
+
46
+ 4. Execute operation:
47
+ - Issue credential for the required capability before API calls:
48
+ - Read-only (`gh issue view`, comment reads via `gh api`): `jr-rpc issue-credential github.issues.read`
49
+ - Create/update/state changes: `jr-rpc issue-credential github.issues.write`
50
+ - Comments: `jr-rpc issue-credential github.issues.comment`
51
+ - Labels: `jr-rpc issue-credential github.labels.write`
52
+ - Resolve command and flags from [references/api-surface.md](references/api-surface.md).
53
+ - Execute using `gh` CLI directly. Use [references/github-issue-api.md](references/github-issue-api.md) for exact command shapes.
54
+ - Use [references/common-use-cases.md](references/common-use-cases.md) for ready-to-run operation patterns.
55
+ - If an operation fails, follow [references/troubleshooting-workarounds.md](references/troubleshooting-workarounds.md) before retrying.
56
+ - Read [references/sandbox-runtime.md](references/sandbox-runtime.md) for credential delivery details.
57
+
58
+ 5. Report result:
59
+ - Return canonical issue URL, issue number, issue type, applied changes, and confidence.
60
+ - Include references used for verified claims.
61
+
62
+ ## Guardrails
63
+
64
+ - Execute operations as soon as required fields are available. Do not pause for confirmation unless the user explicitly asks for preview/dry-run.
65
+ - Require explicit confirmation only for close/reopen or destructive broad rewrites.
66
+ - Never claim verification without citing sources.
67
+ - For `bug` issues, do not present a fix as definitive unless root-cause evidence is explicit.
68
+ - Do not overwrite issue fields unless explicitly requested. Prefer partial updates over full body replacement.
69
+ - If repository or installation access is missing, stop and return a concrete remediation message.
70
+ - Scope is issue workflows only. Do not execute pull-request or repository admin mutations in this skill.
@@ -0,0 +1,51 @@
1
+ # GitHub Issue CLI API Surface
2
+
3
+ This skill supports issue workflows only.
4
+
5
+ All operations use `gh` CLI.
6
+
7
+ ## Capability to command mapping
8
+
9
+ | Capability | Commands |
10
+ | --- | --- |
11
+ | `github.issues.read` | `gh issue view`, `gh api /repos/.../comments` |
12
+ | `github.issues.write` | `gh issue create`, `gh issue edit`, `gh issue close`, `gh issue reopen` |
13
+ | `github.issues.comment` | `gh issue comment` |
14
+ | `github.labels.write` | `gh issue edit --add-label/--remove-label` |
15
+
16
+ ## Command matrix
17
+
18
+ | Operation | Command |
19
+ | --- | --- |
20
+ | Create issue | `gh issue create --repo owner/repo --title "..." [--body-file PATH]` |
21
+ | Update issue fields | `gh issue edit NUMBER --repo owner/repo [--title "..."] [--body-file PATH]` |
22
+ | Close issue | `gh issue close NUMBER --repo owner/repo [--comment "..."]` |
23
+ | Reopen issue | `gh issue reopen NUMBER --repo owner/repo` |
24
+ | Add labels | `gh issue edit NUMBER --repo owner/repo --add-label LABEL [--add-label LABEL2]` |
25
+ | Remove labels | `gh issue edit NUMBER --repo owner/repo --remove-label LABEL [--remove-label LABEL2]` |
26
+ | Add comment | `gh issue comment NUMBER --repo owner/repo --body-file PATH` |
27
+ | Read issue | `gh issue view NUMBER --repo owner/repo --json number,title,state,labels,assignees,author,url,body` |
28
+ | Read comments | `gh api /repos/owner/repo/issues/NUMBER/comments --method GET --header "Accept: application/vnd.github+json"` |
29
+
30
+ ## Credential + config helper commands
31
+
32
+ Resolve repo default:
33
+
34
+ ```bash
35
+ jr-rpc config get github.repo
36
+ ```
37
+
38
+ Set repo default:
39
+
40
+ ```bash
41
+ jr-rpc config set github.repo owner/repo
42
+ ```
43
+
44
+ Issue scoped credentials:
45
+
46
+ ```bash
47
+ jr-rpc issue-credential github.issues.read
48
+ jr-rpc issue-credential github.issues.write
49
+ jr-rpc issue-credential github.issues.comment
50
+ jr-rpc issue-credential github.labels.write
51
+ ```
@@ -0,0 +1,64 @@
1
+ # Common GitHub Issue CLI Use Cases
2
+
3
+ Use these patterns as direct execution playbooks.
4
+
5
+ ## 1) Create a bug issue
6
+
7
+ ```bash
8
+ jr-rpc issue-credential github.issues.write
9
+ gh issue create --repo owner/repo --title "OAuth token refresh fails in long-running thread" --body-file /vercel/sandbox/tmp/issue.md
10
+ ```
11
+
12
+ ## 2) Patch issue title/body
13
+
14
+ ```bash
15
+ jr-rpc issue-credential github.issues.write
16
+ gh issue edit 123 --repo owner/repo --title "Clarify retry semantics for lock contention" --body-file /vercel/sandbox/tmp/revised-issue.md
17
+ ```
18
+
19
+ ## 3) Close or reopen issue
20
+
21
+ ```bash
22
+ jr-rpc issue-credential github.issues.write
23
+ gh issue close 123 --repo owner/repo --comment "Fixed in #456"
24
+ ```
25
+
26
+ Reopen:
27
+
28
+ ```bash
29
+ gh issue reopen 123 --repo owner/repo
30
+ ```
31
+
32
+ ## 4) Add implementation comment
33
+
34
+ ```bash
35
+ jr-rpc issue-credential github.issues.comment
36
+ gh issue comment 123 --repo owner/repo --body-file /vercel/sandbox/tmp/comment.md
37
+ ```
38
+
39
+ ## 5) Apply triage labels
40
+
41
+ ```bash
42
+ jr-rpc issue-credential github.labels.write
43
+ gh issue edit 123 --repo owner/repo --add-label bug --add-label needs-triage
44
+ ```
45
+
46
+ Remove labels:
47
+
48
+ ```bash
49
+ gh issue edit 123 --repo owner/repo --remove-label needs-triage
50
+ ```
51
+
52
+ ## 6) Read issue details before mutation
53
+
54
+ ```bash
55
+ jr-rpc issue-credential github.issues.read
56
+ gh issue view 123 --repo owner/repo --json number,title,state,labels,assignees,author,url,body
57
+ ```
58
+
59
+ ## 7) Read comment history in JSON
60
+
61
+ ```bash
62
+ jr-rpc issue-credential github.issues.read
63
+ gh api /repos/owner/repo/issues/123/comments --method GET --header "Accept: application/vnd.github+json"
64
+ ```
@@ -0,0 +1,54 @@
1
+ # GitHub CLI Command Reference
2
+
3
+ All issue operations should go through `gh` CLI commands.
4
+
5
+ ## Authentication
6
+
7
+ - Preferred: sandbox network policy injects Authorization headers for `api.github.com`.
8
+ - Optional local fallback: `GITHUB_TOKEN` (short-lived GitHub App installation token).
9
+ - If `GITHUB_TOKEN` is a host placeholder value, rely on header transforms and do not override it.
10
+
11
+ ## Command shapes
12
+
13
+ ### Create issue
14
+
15
+ `gh issue create --repo owner/repo --title "..." [--body-file /tmp/issue.md]`
16
+
17
+ ### Update title/body
18
+
19
+ `gh issue edit 123 --repo owner/repo [--title "..."] [--body-file /tmp/issue.md]`
20
+
21
+ ### Close issue
22
+
23
+ `gh issue close 123 --repo owner/repo [--comment "..."]`
24
+
25
+ ### Reopen issue
26
+
27
+ `gh issue reopen 123 --repo owner/repo`
28
+
29
+ ### Add labels
30
+
31
+ `gh issue edit 123 --repo owner/repo --add-label bug --add-label regression`
32
+
33
+ ### Remove labels
34
+
35
+ `gh issue edit 123 --repo owner/repo --remove-label triage`
36
+
37
+ ### Add comment
38
+
39
+ `gh issue comment 123 --repo owner/repo --body-file /tmp/comment.md`
40
+
41
+ ### Get issue JSON
42
+
43
+ `gh issue view 123 --repo owner/repo --json number,title,state,labels,assignees,author,url,body`
44
+
45
+ ### List comments JSON (read-only)
46
+
47
+ `gh api /repos/owner/repo/issues/123/comments --method GET --header "Accept: application/vnd.github+json"`
48
+
49
+ ## Behavior notes
50
+
51
+ - Prefer `--json` output for machine-readable parsing where available.
52
+ - Use `gh api` for endpoints not fully covered by `gh issue` subcommands.
53
+ - Commands should be deterministic and non-interactive in harness usage.
54
+ - Return actionable errors for auth, permission, not-found, and validation failures.
@@ -0,0 +1,88 @@
1
+ # Issue Examples
2
+
3
+ Calibrate structure and depth by comparing good and bad patterns.
4
+
5
+ ## Bug example
6
+
7
+ Bad title: "Error in auth"
8
+ Good title: "OAuth token refresh fails during long-running operations"
9
+
10
+ Bad summary:
11
+ > Something is broken with auth tokens. Users are seeing errors.
12
+
13
+ Good summary:
14
+ > The SDK sets a dedup key before acquiring the per-thread lock. When the lock is contended, the message is permanently lost because the dedup slot is already consumed.
15
+
16
+ Bad structure — generic catch-all:
17
+ > ## Analysis
18
+ > - There's an auth error
19
+ > - It happens sometimes
20
+ > - We should fix it
21
+
22
+ Good structure — problem-specific sections:
23
+ > ## Root cause
24
+ > The dedup key is set *before* the lock is attempted. When a second message arrives...
25
+ >
26
+ > ## Reproduction
27
+ > 1. Two users @-mention the bot in the same thread while processing
28
+ > 2. First message acquires the lock
29
+ > 3. Second message sets its dedup key, fails lock acquisition
30
+ >
31
+ > ## Expected behavior
32
+ > Either:
33
+ > - **Option A**: Acquire lock before setting dedup key
34
+ > - **Option B**: Clear dedup key on lock failure
35
+ >
36
+ > ## Workaround
37
+ > Retry wrapper that catches LockError and clears the dedup key (PR #32).
38
+
39
+ ## Task example
40
+
41
+ Bad title: "Clean up some code"
42
+ Good title: "Remove 7 monkey-patches made unnecessary by SDK v2.1"
43
+
44
+ Bad scope:
45
+ > We have some patches we should clean up.
46
+
47
+ Good scope — quantified and specific:
48
+ > We maintain patches on **8 of 9 `process*` methods**. 7 exist solely to keep `waitUntil` offload behavior consistent while `processMessage` is customized for durable workflow routing. The 8th has two additional behavioral fixes.
49
+ >
50
+ > | Method | Patch reason |
51
+ > |--------|-------------|
52
+ > | `processReaction` | scheduling only |
53
+ > | `processAction` | scheduling only |
54
+ > | `processMessage` | scheduling + thread ID normalization + lock retry |
55
+
56
+ ## Feature example
57
+
58
+ Bad framing:
59
+ > It would be nice to have better config reloading.
60
+
61
+ Good framing — current state, gap, options:
62
+ > ## Current behavior
63
+ > Workers read config at startup. Changes require a full restart.
64
+ >
65
+ > ## Gap
66
+ > Config changes during incidents require redeploying, adding 2-3 minutes to mitigation.
67
+ >
68
+ > ## Options
69
+ > | Approach | Tradeoff |
70
+ > |----------|----------|
71
+ > | File watch + hot reload | Simple, but no atomicity guarantee |
72
+ > | Config service with polling | Consistent, but adds a dependency |
73
+
74
+ ## Principles
75
+
76
+ - Use problem-specific headings, not generic labels
77
+ - Include code snippets when they clarify the pattern
78
+ - Quantify scope precisely ("8 of 9", not "many")
79
+ - Cross-reference related issues and PRs
80
+ - Show concrete options with tradeoffs, not vague "should be fixed"
81
+ - Use tables for structured comparisons
82
+
83
+ ## Anti-patterns
84
+
85
+ - Overlong, sprawling body with no clear sections
86
+ - Confident fix claims without root-cause evidence
87
+ - Speculative detail mixed into verified facts
88
+ - Session-specific content (user names, slash commands, channel references)
@@ -0,0 +1,34 @@
1
+ # Issue Quality Checklist
2
+
3
+ Run this checklist before create/update mutation.
4
+
5
+ ## External Quality Signals
6
+
7
+ - Does the issue contain user names, slash commands, or channel references from the originating conversation? If so, generalize.
8
+ - Is the issue concise and still actionable?
9
+ - Are unknowns called out instead of guessed?
10
+ - Are concerns included only when material?
11
+
12
+ Useful external guidance:
13
+ - GitHub docs, creating and structuring issues: https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/creating-an-issue
14
+ - GitHub docs, issue templates: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/about-issue-and-pull-request-templates
15
+ - Stack Overflow, minimal reproducible example standard: https://stackoverflow.com/help/minimal-reproducible-example
16
+ - Mozilla Bugzilla, bug writing guidance: https://bugzilla.mozilla.org/page.cgi?id=bug-writing.html
17
+
18
+ ## Internal Quality Bar
19
+
20
+ - Issue type chosen and stated (`bug`, `feature`, or `task`).
21
+ - Title is specific and <= 60 characters.
22
+ - Summary is short and clear.
23
+ - Analysis depth matches the issue type.
24
+ - Verified claims have sources.
25
+ - Timeline statements use exact dates when known.
26
+ - Confidence is explicit when certainty is low.
27
+ - Concerns are included only when meaningful.
28
+
29
+ ## Negative Calibration
30
+
31
+ Avoid these anti-patterns:
32
+ - Overlong, sprawling issue bodies with no clear sections
33
+ - Confident solution claims that are weakly evidenced
34
+ - Speculative detail mixed into verified sections
@@ -0,0 +1,23 @@
1
+ # Bug Issue Template
2
+
3
+ Use as a starting structure. Adapt headings to fit the specific bug.
4
+
5
+ ## Summary
6
+ Up to 3 sentences describing the failure and its impact.
7
+
8
+ ## Suggested sections (use what fits, rename freely)
9
+
10
+ - **Root cause** — technical explanation of why the bug occurs, with code snippets if relevant
11
+ - **Reproduction** — numbered steps any developer can follow independently
12
+ - **Expected behavior** — what should happen, with concrete options if multiple fixes exist
13
+ - **Workaround** — current mitigation if one exists, with links to relevant PRs
14
+ - **Versions affected** — specific versions or environments confirmed
15
+
16
+ Remove sections that don't apply. Add sections the problem needs.
17
+
18
+ ## Constraints
19
+ - Title hard max: 60 characters (target 40-60).
20
+ - Summary max 3 sentences.
21
+ - Remove empty sections.
22
+ - Adapt section headings to fit the issue, not the reverse.
23
+ - Do not include acceptance criteria unless explicitly requested.
@@ -0,0 +1,22 @@
1
+ # Feature Issue Template
2
+
3
+ Use as a starting structure. Adapt headings to fit the specific feature.
4
+
5
+ ## Summary
6
+ Up to 3 sentences describing the desired improvement and user outcome.
7
+
8
+ ## Suggested sections (use what fits, rename freely)
9
+
10
+ - **Current behavior** — how the system works today, with code snippets if relevant
11
+ - **Gap** — why current behavior is insufficient, with concrete impact
12
+ - **Options** — viable approaches with tradeoffs
13
+ - **Recommendation** — preferred direction with rationale
14
+
15
+ Remove sections that don't apply. Add sections the feature needs.
16
+
17
+ ## Constraints
18
+ - Title hard max: 60 characters (target 40-60).
19
+ - Summary max 3 sentences.
20
+ - Remove empty sections.
21
+ - Adapt section headings to fit the issue, not the reverse.
22
+ - Do not include acceptance criteria unless explicitly requested.
@@ -0,0 +1,22 @@
1
+ # Task Issue Template
2
+
3
+ Use as a starting structure. Adapt headings to fit the specific task.
4
+
5
+ ## Summary
6
+ Up to 3 sentences describing the task and intended result.
7
+
8
+ ## Suggested sections (use what fits, rename freely)
9
+
10
+ - **Background** — why this task exists, with code snippets showing current state
11
+ - **Scope** — what's included and excluded, quantify when possible
12
+ - **Implementation** — concrete steps or approach
13
+ - **Dependencies** — related issues, PRs, or external blockers
14
+
15
+ Remove sections that don't apply. Add sections the task needs.
16
+
17
+ ## Constraints
18
+ - Title hard max: 60 characters (target 40-60).
19
+ - Summary max 3 sentences.
20
+ - Remove empty sections.
21
+ - Adapt section headings to fit the issue, not the reverse.
22
+ - Do not include acceptance criteria unless explicitly requested.
@@ -0,0 +1,51 @@
1
+ # Bug Issue Rules
2
+
3
+ Use this file only when issue type is `bug`.
4
+
5
+ ## Primary Goal
6
+
7
+ Produce a high-signal bug issue that drives root-cause discovery, not premature solutioning.
8
+
9
+ ## Required Research Shape
10
+
11
+ 1. Capture concrete evidence:
12
+ - reproducible steps or explicit non-repro statement
13
+ - exact error or symptom
14
+ - impacted surface and scope
15
+
16
+ 2. Build a timeline with exact dates when known:
17
+ - first observed
18
+ - known regressions or relevant deploy/release windows
19
+
20
+ 3. Separate known from unknown:
21
+ - verified facts contain only directly supported claims
22
+ - unknown details stay explicit
23
+
24
+ 4. Form root-cause hypotheses:
25
+ - each hypothesis must link back to evidence
26
+ - include confidence (`high`, `medium`, `low`)
27
+
28
+ ## Fix Guidance
29
+
30
+ - You may include tentative fix options.
31
+ - Label options as tentative unless root cause is directly evidenced.
32
+ - If root cause is not verified, include next RCA steps before or alongside fix options.
33
+ - Do not present one fix as certain without explicit evidence.
34
+
35
+ ## Context Generalization
36
+
37
+ When deriving bug content from conversation, generalize to the technical problem.
38
+
39
+ Before (session-specific):
40
+ > @alice ran `/github create` in #ops-alerts and saw "token refresh failed" when the OAuth token expired mid-thread
41
+
42
+ After (generalized):
43
+ > OAuth token refresh fails during long-running operations, producing "token refresh failed" errors
44
+
45
+ ## Completion Bar
46
+
47
+ A `bug` issue is ready when it has:
48
+ - clear symptom and scope
49
+ - evidence-backed facts
50
+ - explicit unknowns
51
+ - root-cause hypotheses with confidence
@@ -0,0 +1,41 @@
1
+ # Feature Issue Rules
2
+
3
+ Use this file only when issue type is `feature`.
4
+
5
+ ## Primary Goal
6
+
7
+ Propose an intentional improvement with clear current-state analysis and practical options.
8
+
9
+ ## Required Research Shape
10
+
11
+ 1. Analyze how the system works today:
12
+ - current behavior
13
+ - known constraints
14
+ - why current behavior is insufficient
15
+
16
+ 2. Gather prior art:
17
+ - target a couple relevant examples when available
18
+ - include links and what each example proves
19
+ - if none found, explicitly say no strong prior art was found
20
+
21
+ 3. Frame options:
22
+ - at least one viable path, preferably multiple when tradeoffs are meaningful
23
+ - include implementation and operational tradeoffs
24
+
25
+ ## Context Generalization
26
+
27
+ When deriving feature content from conversation, generalize to the capability gap.
28
+
29
+ Before (session-specific):
30
+ > @carol mentioned in the standup thread that she has to manually restart the worker every time the config changes
31
+
32
+ After (generalized):
33
+ > Workers do not pick up config changes without a restart, requiring manual intervention
34
+
35
+ ## Completion Bar
36
+
37
+ A `feature` issue is ready when it has:
38
+ - clear problem framing and objective
39
+ - current-state analysis
40
+ - prior-art section (or explicit none found)
41
+ - concise option tradeoffs
@@ -0,0 +1,34 @@
1
+ # Task Issue Rules
2
+
3
+ Use this file only when issue type is `task`.
4
+
5
+ ## Primary Goal
6
+
7
+ Create a concise execution ticket for maintenance, cleanup, docs, refactors, or operational chores.
8
+
9
+ ## Research Standard
10
+
11
+ - Minimal research by default.
12
+ - Prefer first-party repository context when available.
13
+ - No required external prior-art scan unless user asks for it.
14
+
15
+ ## Required Content
16
+
17
+ - explicit goal
18
+ - scope boundaries
19
+ - concrete implementation steps
20
+ - dependencies or risks only when material
21
+
22
+ ## Context Generalization
23
+
24
+ When deriving task content from conversation, generalize to the goal and scope.
25
+
26
+ Before (session-specific):
27
+ > @bob asked in #eng-chat to clean up the unused `legacyAuth` middleware that he noticed while reviewing PR #312
28
+
29
+ After (generalized):
30
+ > Remove unused `legacyAuth` middleware to reduce maintenance surface
31
+
32
+ ## Completion Bar
33
+
34
+ A `task` issue is ready when it is short, actionable, and testable without extra discovery.
@@ -0,0 +1,33 @@
1
+ # Research and Verification Rules
2
+
3
+ Use this file for cross-type rules. Then apply the matching type-specific file:
4
+ - `bug`: [issue-type-bug.md](issue-type-bug.md)
5
+ - `feature`: [issue-type-feature.md](issue-type-feature.md)
6
+ - `task`: [issue-type-task.md](issue-type-task.md)
7
+
8
+ ## Source Priority
9
+
10
+ 1. First-party repository evidence:
11
+ - Source code and tests
12
+ - Existing issues and PRs
13
+ - Release notes/changelog
14
+ - Project docs
15
+
16
+ 2. First-party vendor docs for dependencies/services.
17
+
18
+ 3. Reputable external sources only when needed.
19
+
20
+ ## Verification Standard
21
+
22
+ - Treat statements as `verified` only when backed by direct evidence.
23
+ - Prefer at least two independent supporting signals for high-impact claims.
24
+ - If signals conflict, state the conflict and lower confidence.
25
+ - If evidence is missing, mark as `unknown`.
26
+
27
+ ## Output Expectations
28
+
29
+ - Clearly distinguish verified facts from unknowns. Weave evidence naturally into the issue structure rather than forcing separate sections.
30
+ - Include source links/paths for each verified fact.
31
+ - Use exact dates for timeline claims.
32
+ - Avoid absolute language when confidence is low.
33
+ - For `feature` issues, target a couple prior-art examples when available; if not found, explicitly say none were found.
@@ -0,0 +1,38 @@
1
+ # Sandbox Runtime Guidance
2
+
3
+ This skill runs in the harness sandbox (`node22`) and commands execute via the `bash` tool.
4
+
5
+ ## Runtime environment
6
+
7
+ - Sandbox OS is Amazon Linux 2023.
8
+ - System packages are installed with `dnf`.
9
+ - Any package install command must run with root privileges (`sudo: true` in sandbox command execution).
10
+
11
+ ## What is currently available
12
+
13
+ - Node runtime in sandbox (`node22` image).
14
+ - Writable workspace under `/vercel/sandbox`.
15
+ - Outbound network access (default allow-all unless harness sets a network policy).
16
+ - Skill files are synchronized into `/vercel/sandbox/skills/<skill-name>`.
17
+
18
+ ## Important constraint
19
+
20
+ Credentials should only be injected per command execution scope. Do not rely on global/session-wide environment for privileged tokens.
21
+
22
+ ## Credential strategy
23
+
24
+ 1. Enable credentials with the narrowest capability needed:
25
+ - `github.issues.read` for `view` and comment reads
26
+ - `github.issues.write` for create/update/close/reopen
27
+ - `github.issues.comment` for comments
28
+ - `github.labels.write` for label mutations
29
+ 2. Runtime injects `Authorization` header transforms for `api.github.com`.
30
+ 3. Execute `gh` CLI commands directly.
31
+ 4. Do not persist tokens in files.
32
+
33
+ ## Operational checks
34
+
35
+ - Verify CLI availability:
36
+ - `gh --version`
37
+ - Use non-interactive command flags in automation contexts.
38
+ - If 401/403 appears after credential issuance, reissue once, then stop with remediation guidance if still failing.
@@ -0,0 +1,21 @@
1
+ # GitHub Issue CLI Troubleshooting
2
+
3
+ Use this table to recover quickly while keeping operations deterministic.
4
+
5
+ | Symptom | Likely cause | Fix |
6
+ | --- | --- | --- |
7
+ | `unknown command "issue"` from `gh` | CLI version too old or wrong binary. | Verify `gh --version`; ensure GitHub CLI from `gh-cli` repo is installed. |
8
+ | `Missing required option --repo` | Repo not passed and no default was resolved. | Resolve with `jr-rpc config get github.repo`; pass `--repo owner/repo` explicitly when missing. |
9
+ | `GraphQL: Could not resolve to a Repository` | Repo slug is wrong or inaccessible. | Validate `owner/repo` and confirm app installation on target repository. |
10
+ | 401 Unauthorized | Credential not issued for current command scope. | Run `jr-rpc issue-credential <capability>` for the exact command and retry once. |
11
+ | 403 Forbidden | App lacks required permission on repo. | Confirm GitHub App permissions and installation scope. |
12
+ | 404 Not Found | Issue number or repo is wrong. | Validate repo + issue ID with `gh issue view NUMBER --repo owner/repo`. |
13
+ | `sandbox setup failed (dnf install gh failed ...)` | `gh` package not available in default repos. | Configure/install from GitHub RPM repo (`gh-cli`) in sandbox dependency bootstrap, then retry. |
14
+ | `gh issue edit` does not change labels | Wrong flag usage or missing label capability context. | Use repeated `--add-label/--remove-label` flags and issue `github.labels.write` credential first. |
15
+ | Comment command fails with empty body | Body file missing/empty. | Ensure comment file exists and has content before `gh issue comment`. |
16
+
17
+ ## Retry guidance
18
+
19
+ - Retry once for transient auth/transport failures after reissuing credentials.
20
+ - Do not loop retries on repeated 401/403/404 validation errors.
21
+ - For persistent permission problems, return explicit remediation and stop.