@sentry/junior-github 0.122.1 → 0.124.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/SETUP.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # GitHub plugin setup
2
2
 
3
- This plugin exposes three skills — `github-code` (clone, source-code investigation, pull requests), `github-issues` (issue workflows), and `attach-github-assets` (local image/video uploads for GitHub markdown). Junior uses GitHub App installation tokens for reads, workflow dispatches, allowlisted issue and pull request writes, and Git branch pushes. Human OAuth is reserved for explicitly personal operations such as pull request reviews and user-attachment uploads.
3
+ This plugin exposes two skills — `github-code` (clone, source-code investigation, pull requests) and `github-issues` (issue workflows). Junior uses GitHub App installation tokens for reads, workflow dispatches, allowlisted issue and pull request writes, and Git branch pushes. Human OAuth is reserved for explicitly personal operations such as pull request reviews and user-attachment uploads.
4
4
 
5
5
  ## 1) Create/install GitHub App
6
6
 
package/dist/index.js CHANGED
@@ -216,7 +216,7 @@ function actorLabel(actor) {
216
216
  function appendGitHubRequesterAttribution(body, actor) {
217
217
  const label = actorLabel(actor);
218
218
  const attribution = label ? `${GITHUB_REQUEST_ATTRIBUTION_START}
219
- Requested by ${label} via Junior.
219
+ Requested by ${label}.
220
220
  ${GITHUB_REQUEST_ATTRIBUTION_END}` : void 0;
221
221
  const normalizedBody = body.trimEnd();
222
222
  const existing = new RegExp(
@@ -449,6 +449,12 @@ async function annotateIssue(ctx, input, result) {
449
449
  }
450
450
  function createGitHubIssueTool(ctx) {
451
451
  return definePluginTool({
452
+ annotations: {
453
+ destructiveHint: false,
454
+ idempotentHint: true,
455
+ openWorldHint: true,
456
+ readOnlyHint: false
457
+ },
452
458
  description: "Create a GitHub issue with a runtime-owned Junior conversation footer. Use this instead of shelling out to gh issue create when creating issues.",
453
459
  inputSchema: createIssueToolInputSchema,
454
460
  outputSchema: gitHubIssueOutputSchema,
@@ -625,6 +631,12 @@ function repositoryUrl(repo, path) {
625
631
  }
626
632
  function createGitHubGetDeploymentTool(ctx) {
627
633
  return definePluginTool2({
634
+ annotations: {
635
+ destructiveHint: false,
636
+ idempotentHint: true,
637
+ openWorldHint: true,
638
+ readOnlyHint: true
639
+ },
628
640
  description: "Get the latest GitHub deployment and status for an exact repository and full commit SHA, optionally limited to one environment. The result remains subscribable when no deployment exists yet, so use it before waiting for a deployment outcome.",
629
641
  inputSchema,
630
642
  outputSchema,
@@ -991,6 +1003,12 @@ function gitHubPullRequestStructuredResult(input, result) {
991
1003
  }
992
1004
  function createGitHubPullRequestTool(ctx) {
993
1005
  return definePluginTool3({
1006
+ annotations: {
1007
+ destructiveHint: false,
1008
+ idempotentHint: true,
1009
+ openWorldHint: true,
1010
+ readOnlyHint: false
1011
+ },
994
1012
  description: "Create a GitHub pull request with a runtime-owned Junior conversation footer. Use this instead of shelling out to gh pr create when creating pull requests.",
995
1013
  inputSchema: createPullRequestToolInputSchema,
996
1014
  outputSchema: gitHubPullRequestOutputSchema,
@@ -1119,6 +1137,12 @@ async function readJson2(response) {
1119
1137
  }
1120
1138
  function createGitHubGetPullRequestTool(ctx) {
1121
1139
  return definePluginTool4({
1140
+ annotations: {
1141
+ destructiveHint: false,
1142
+ idempotentHint: true,
1143
+ openWorldHint: true,
1144
+ readOnlyHint: true
1145
+ },
1122
1146
  description: "Get a GitHub pull request. Use this when an existing PR may need resource-event monitoring; the result includes a subscribable hint when GitHub webhooks are configured.",
1123
1147
  inputSchema: inputSchema2,
1124
1148
  outputSchema: outputSchema2,
@@ -1249,6 +1273,12 @@ function githubApiErrorMessage3(payload) {
1249
1273
  }
1250
1274
  function createGitHubUpdatePullRequestTool(ctx) {
1251
1275
  return definePluginTool5({
1276
+ annotations: {
1277
+ destructiveHint: true,
1278
+ idempotentHint: true,
1279
+ openWorldHint: true,
1280
+ readOnlyHint: false
1281
+ },
1252
1282
  description: "Update an existing GitHub pull request's title, body, base branch, or open/closed state. Use this instead of raw GitHub API calls when changing PR metadata.",
1253
1283
  inputSchema: inputSchema3,
1254
1284
  outputSchema: outputSchema3,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior-github",
3
- "version": "0.122.1",
3
+ "version": "0.124.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.122.1"
34
+ "@sentry/junior-plugin-api": "0.124.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^25.9.1",
@@ -57,7 +57,8 @@ Follow [references/research-rules.md](references/research-rules.md) for cross-ty
57
57
  - Prefer flat bullet lists over headed sections for simple issues. Remove empty sections.
58
58
  - Generalize session framing — strip channel references, slash commands, Slack thread IDs, user @mentions, and transcript fragments; replace with the underlying technical problem.
59
59
  - Compress source material. Research notes, hypotheses, or transcripts become a short summary + scoped bullets — never paste raw investigation into the body.
60
- - Do not add desired outcome, expected behavior, or acceptance criteria unless the thread explicitly requests them.
60
+ - Do not add desired outcome, expected behavior, acceptance criteria, fixes, implementation steps, approaches, or options unless the user explicitly asks to preserve a specific proposal.
61
+ - Never infer a solution from research. If a user-provided proposal must be preserved, attribute it as a proposal and keep it separate from verified diagnosis.
61
62
  - Preserve material source references inline.
62
63
 
63
64
  **Source attribution:**
@@ -74,6 +75,7 @@ Before running the `gh` create/edit command, check each gate. If any fails, revi
74
75
  - Title length ≤ 60 characters.
75
76
  - No session framing remains (channel refs, slash commands, @mentions, Slack thread IDs).
76
77
  - Body structure matches complexity — no empty sections, no restated title, no raw research dump.
78
+ - No invented or unattributed solution, implementation step, approach, or option appears in the title or body.
77
79
 
78
80
  Run [references/issue-quality-checklist.md](references/issue-quality-checklist.md) for holistic soft-signal review when the draft warrants it.
79
81
 
@@ -93,5 +95,5 @@ Run [references/issue-quality-checklist.md](references/issue-quality-checklist.m
93
95
 
94
96
  - Require explicit confirmation only for close/reopen or destructive broad rewrites.
95
97
  - Do not overwrite issue fields unless explicitly requested. Prefer partial updates over full body replacement.
96
- - For `bug` issues, do not present a fix as definitive unless root-cause evidence is explicit.
98
+ - Keep ticket handoffs diagnosis-first. Root-cause evidence can establish what is wrong; it does not justify inventing what should be built or changed.
97
99
  - If repository or installation access is missing, stop and return a concrete remediation message.
@@ -30,7 +30,7 @@ Research informs what goes in the issue, not how structured it looks.
30
30
  3. Separate verified facts from unknowns — label each explicitly.
31
31
  4. Form root-cause hypotheses linked to evidence, with confidence (`high`, `medium`, `low`).
32
32
 
33
- Include fix suggestions only when the thread discusses fixes. Do not present a fix as certain without explicit evidence.
33
+ Do not add fix suggestions. If the user explicitly asks to preserve a specific proposal from the source context, attribute it as proposed and keep it separate from verified facts and root-cause hypotheses.
34
34
 
35
35
  ## Context generalization
36
36
 
@@ -35,12 +35,10 @@ Good structure — problem-specific sections:
35
35
  > 2. First message acquires the lock
36
36
  > 3. Second message sets its dedup key, fails lock acquisition
37
37
  >
38
- > ## Expected behavior
38
+ > ## Unknowns
39
39
  >
40
- > Either:
41
- >
42
- > - **Option A**: Acquire lock before setting dedup key
43
- > - **Option B**: Clear dedup key on lock failure
40
+ > - Whether lock contention is the only path that consumes the dedup slot without processing
41
+ > - Whether the behavior reproduces across all message entry points
44
42
  >
45
43
  > ## Workaround
46
44
  >
@@ -71,7 +69,7 @@ Bad framing:
71
69
 
72
70
  > It would be nice to have better config reloading.
73
71
 
74
- Good framing — current state, gap, options:
72
+ Good framing — current state, gap, and impact:
75
73
 
76
74
  > ## Current behavior
77
75
  >
@@ -81,12 +79,9 @@ Good framing — current state, gap, options:
81
79
  >
82
80
  > Config changes during incidents require redeploying, adding 2-3 minutes to mitigation.
83
81
  >
84
- > ## Options
82
+ > ## Impact
85
83
  >
86
- > | Approach | Tradeoff |
87
- > | --------------------------- | ---------------------------------- |
88
- > | File watch + hot reload | Simple, but no atomicity guarantee |
89
- > | Config service with polling | Consistent, but adds a dependency |
84
+ > During incidents, each config change adds 2-3 minutes of mitigation delay and requires an operator to coordinate the restart.
90
85
 
91
86
  ## Principles
92
87
 
@@ -94,7 +89,6 @@ Good framing — current state, gap, options:
94
89
  - Include code snippets when they clarify the pattern
95
90
  - Quantify scope precisely ("8 of 9", not "many")
96
91
  - Cross-reference related issues and PRs
97
- - Show concrete options with tradeoffs, not vague "should be fixed"
98
92
  - Use tables for structured comparisons
99
93
 
100
94
  ## Anti-patterns
@@ -102,7 +96,8 @@ Good framing — current state, gap, options:
102
96
  - Over-structured issues: using ## Summary, ## Impact, ## Root Cause headings for a 3-line bug
103
97
  - Adding "Expected behavior" or "Desired outcome" when the thread didn't state one
104
98
  - Restating the title as the first sentence of the body
105
- - Confident fix claims without root-cause evidence
99
+ - Invented fixes, implementation steps, approaches, or options, even when the root cause is verified
100
+ - Unattributed proposals mixed into verified diagnosis
106
101
  - Speculative detail mixed into verified facts
107
102
  - Dumping a list of URLs without inline context
108
103
  - Session-specific content (slash commands, channel references, raw transcript framing, or unrelated user chatter)
@@ -4,11 +4,11 @@ Load when issue type is `feature`. Cross-type rules (title length, delegated foo
4
4
 
5
5
  ## Primary goal
6
6
 
7
- Propose an intentional improvement with clear current-state analysis and practical options.
7
+ Describe an intentional improvement through verified current-state analysis, the gap, and its impact without prescribing implementation.
8
8
 
9
9
  ## Shape
10
10
 
11
- A flat bullet list is fine for simple features. Use headed sections only when tradeoffs need detailed framing.
11
+ A flat bullet list is fine for simple features. Use headed sections only when the current-state evidence and impact need detailed framing.
12
12
 
13
13
  **Summary** — up to 3 sentences describing the improvement. Short imperative title (e.g. "Support SAML SSO for enterprise orgs").
14
14
 
@@ -16,15 +16,14 @@ A flat bullet list is fine for simple features. Use headed sections only when tr
16
16
 
17
17
  - **Current behavior** — how the system works today
18
18
  - **Gap** — why current behavior is insufficient, with concrete impact
19
- - **Options** — viable approaches with tradeoffs (include only when the thread discusses alternatives)
20
19
 
21
- For simple features, skip sections and use flat bullets describing the gap and desired capability.
20
+ For simple features, skip sections and use flat bullets describing the current behavior, gap, and impact.
22
21
 
23
22
  ## Research guidance
24
23
 
25
24
  1. Analyze current behavior and why it's insufficient.
26
25
  2. Gather prior art when available — include links and what each proves. If none found, omit rather than stating "none found."
27
- 3. Frame options with tradeoffs when the thread discusses alternatives.
26
+ 3. Do not generate approaches or options. Preserve a specific proposal only when the user explicitly asks, attribute it, and keep it separate from the gap analysis.
28
27
 
29
28
  ## Context generalization
30
29
 
@@ -15,7 +15,8 @@ Soft-signal review beyond the hard gates in `SKILL.md` § Verify draft. Use when
15
15
  ## Anti-patterns to avoid
16
16
 
17
17
  - Overlong, sprawling bodies with no clear sections.
18
- - Confident solution claims that are weakly evidenced.
18
+ - Invented fixes, implementation steps, approaches, or options, regardless of diagnostic confidence.
19
+ - User-provided proposals presented without attribution or mixed into verified diagnosis.
19
20
  - Speculative detail mixed into verified sections.
20
21
 
21
22
  ## External guidance
@@ -17,12 +17,12 @@ A task can be just a title + 2-3 bullets. Use headed sections only when scope is
17
17
  - **Background** — why this task exists, with code snippets if relevant
18
18
  - **Scope** — what's included and excluded, quantify when possible
19
19
 
20
- For simple tasks, skip sections and use flat bullets for scope and next step.
20
+ For simple tasks, skip sections and use flat bullets for background and scope.
21
21
 
22
22
  ## Research guidance
23
23
 
24
24
  - Minimal research by default. Prefer first-party repository context when available.
25
- - Include implementation steps only when the thread discusses approach. Otherwise, state the goal and scope.
25
+ - Do not generate implementation steps or approaches. Preserve a specific user-provided plan only when explicitly requested, attribute it, and keep it separate from verified scope.
26
26
  - Include dependencies or risks only when material.
27
27
 
28
28
  ## Context generalization
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Intercom
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,41 +0,0 @@
1
- ---
2
- name: attach-github-assets
3
- description: Upload concrete local images or videos to GitHub user attachments and return markdown-ready links. Use when a user asks to attach a local screenshot, recording, image, or video to a GitHub pull request, issue, body, or comment. Do not use for remote URLs or when no local file path is available.
4
- ---
5
-
6
- # Attach GitHub Assets
7
-
8
- Upload each user-provided local file with `scripts/upload.sh`. Do not replace the upload with a description of what the user could do manually.
9
-
10
- ## Preconditions
11
-
12
- Proceed only when both are true:
13
-
14
- - The request identifies a concrete local path for a supported image or video.
15
- - The destination is a GitHub pull request, issue, body, or comment.
16
-
17
- Supported extensions: `png`, `jpg`, `jpeg`, `gif`, `webp`, `svg`, `mov`, `mp4`, `webm`.
18
-
19
- Do not upload remote URLs, invent paths, or invoke this skill speculatively. If the request contains no local path, return `no-op: no local file path`.
20
-
21
- ## Upload
22
-
23
- Run from this skill's working directory, once per file:
24
-
25
- ```bash
26
- bash scripts/upload.sh "<file-path>" [owner/repo]
27
- ```
28
-
29
- - Pass the explicit `owner/repo` when the user supplied one.
30
- - Otherwise the script resolves the repository from `github.repo` config, then the current checkout's `origin` remote.
31
- - The script is non-interactive, prints one asset URL on stdout, and prints an actionable error on stderr when it fails.
32
- - Do not batch files into one invocation. If one upload fails, report that file's exact error and do not claim it uploaded.
33
-
34
- ## Return markdown
35
-
36
- For each successful upload:
37
-
38
- - Images: `![filename](asset-url)`
39
- - Videos: put the asset URL on its own line so GitHub renders it.
40
-
41
- Return only the markdown-ready results plus any per-file failures the user needs to act on.
@@ -1,31 +0,0 @@
1
- # Sources
2
-
3
- ## Inventory
4
-
5
- - `intercom/2x-skills@59213af`, `plugins/pr-tools/skills/attach-github-assets/SKILL.md` — upstream runtime intent and supported use cases; primary source; high confidence; MIT.
6
- - `intercom/2x-skills@59213af`, `plugins/pr-tools/skills/attach-github-assets/scripts/upload.sh` — upstream endpoint, MIME mapping, and response contract; primary implementation source; high confidence; MIT.
7
- - `intercom/2x-skills@59213af`, `plugins/pr-tools/LICENSE` — upstream copyright and license notice; authoritative legal source; high confidence.
8
- - `packages/junior-github/src/credential-support.ts` — local GitHub credential boundary; authoritative local source; high confidence.
9
- - `packages/junior-github/src/plugin.ts` — local GitHub egress boundary; authoritative local source; high confidence.
10
- - `packages/junior-github/skills/github-code/SKILL.md` — local repository targeting and credential guidance; authoritative local convention; high confidence.
11
- - GitHub REST API documentation — no documented user-attachment upload operation found; official source; medium confidence for absence.
12
-
13
- ## Decisions
14
-
15
- - **Adopted:** preserve the upstream one-file-per-upload behavior, supported formats, markdown output, and upload endpoint.
16
- - **Adopted:** preserve the upstream MIT license in the skill directory as explicitly required.
17
- - **Replaced:** direct `gh auth token` access with Junior's host-managed requesting-user OAuth credential injection so credentials never enter script output or files.
18
- - **Replaced:** numeric repository-id override with explicit `owner/repo`; the script resolves the id through authenticated `gh api`.
19
- - **Narrowed:** automatic activation requires a concrete local path and GitHub destination.
20
- - **Verified:** a live upload with the repository-scoped installation credential returned HTTP 500; the endpoint's upstream implementation uses a user token.
21
-
22
- ## Coverage
23
-
24
- - Happy path: local image/video, repository resolution, successful URL extraction.
25
- - Failures: missing path, missing file, unsupported type, unresolved repository, non-201 response, missing URL.
26
- - Safety: no guessed paths, no remote URLs, no token retrieval, one upload per invocation.
27
- - Portability: the skill is intentionally Junior GitHub-plugin-specific; relative script paths use the skill working directory supplied by `loadSkill`.
28
-
29
- ## Stopping Rationale
30
-
31
- Further retrieval was low-yield: the upstream implementation, local plugin credential boundary, local skill conventions, tests, and package registration behavior cover the runtime contract. The upload endpoint remains undocumented by GitHub, so the implementation records that limitation rather than inventing a public API guarantee.
@@ -1,48 +0,0 @@
1
- # Attach GitHub Assets Specification
2
-
3
- ## Intent
4
-
5
- Upload local image and video files to GitHub's user-attachment service and return markdown-ready links for pull requests and issues.
6
-
7
- ## Scope
8
-
9
- In scope:
10
-
11
- - Concrete local image and video paths.
12
- - GitHub pull request and issue bodies or comments.
13
- - Repository resolution from an explicit target, Junior config, or the current checkout.
14
-
15
- Out of scope:
16
-
17
- - Remote URLs, arbitrary file types, or speculative screenshot requests.
18
- - Editing a pull request or issue after upload; the calling workflow owns placement.
19
- - Persisting or printing GitHub credentials.
20
-
21
- ## Runtime Contract
22
-
23
- - Run `scripts/upload.sh` once per local file.
24
- - Return image markdown or a bare video URL.
25
- - Surface per-file failures exactly enough for the user to act.
26
- - Use the GitHub plugin's requesting-user OAuth credential injection; do not retrieve tokens in the script.
27
-
28
- ## Reference Architecture
29
-
30
- - `SKILL.md` contains trigger, execution, and output rules.
31
- - `scripts/upload.sh` performs deterministic validation, repository resolution, and upload.
32
- - `LICENSE` preserves the upstream MIT license and copyright notice.
33
-
34
- ## Validation
35
-
36
- - `pnpm skills:check` validates skill structure.
37
- - Shell syntax and mocked upload smoke checks cover deterministic script behavior.
38
- - GitHub plugin tests cover credential routing to `uploads.github.com`.
39
-
40
- ## Known Limitations
41
-
42
- - GitHub's user-attachment endpoint is not part of the documented public REST API.
43
- - A real upload requires the requesting user to authorize the GitHub App.
44
-
45
- ## Maintenance Notes
46
-
47
- - Keep supported extensions synchronized between `SKILL.md` and `scripts/upload.sh`.
48
- - Preserve `LICENSE` when adapting or moving the skill.
@@ -1,83 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- file_path="${1:-}"
5
- repository="${2:-}"
6
-
7
- if [[ -z "$file_path" ]]; then
8
- echo "Usage: upload.sh <file-path> [owner/repo]" >&2
9
- exit 1
10
- fi
11
-
12
- if [[ ! -f "$file_path" ]]; then
13
- echo "Error: File not found: $file_path" >&2
14
- exit 1
15
- fi
16
-
17
- filename=$(basename "$file_path")
18
- extension="${filename##*.}"
19
- extension=$(printf '%s' "$extension" | tr '[:upper:]' '[:lower:]')
20
-
21
- case "$extension" in
22
- png) mime_type="image/png" ;;
23
- jpg|jpeg) mime_type="image/jpeg" ;;
24
- gif) mime_type="image/gif" ;;
25
- webp) mime_type="image/webp" ;;
26
- svg) mime_type="image/svg+xml" ;;
27
- mov) mime_type="video/quicktime" ;;
28
- mp4) mime_type="video/mp4" ;;
29
- webm) mime_type="video/webm" ;;
30
- *)
31
- echo "Error: Unsupported file type '.$extension'. Supported: png, jpg, jpeg, gif, webp, svg, mov, mp4, webm" >&2
32
- exit 1
33
- ;;
34
- esac
35
-
36
- if [[ -z "$repository" ]] && command -v jr-rpc >/dev/null 2>&1; then
37
- repository=$(jr-rpc config get github.repo 2>/dev/null || true)
38
- fi
39
-
40
- if [[ -z "$repository" ]]; then
41
- remote_url=$(git remote get-url origin 2>/dev/null || true)
42
- case "$remote_url" in
43
- git@github.com:*) repository="${remote_url#git@github.com:}" ;;
44
- https://github.com/*) repository="${remote_url#https://github.com/}" ;;
45
- esac
46
- repository="${repository%.git}"
47
- fi
48
-
49
- if [[ ! "$repository" =~ ^[^/[:space:]]+/[^/[:space:]]+$ ]]; then
50
- echo "Error: Could not resolve a GitHub repository. Pass owner/repo as the second argument or configure github.repo." >&2
51
- exit 1
52
- fi
53
-
54
- repository_id=$(gh api "repos/$repository" --jq '.id')
55
- encoded_name=$(printf '%s' "$filename" | jq -sRr @uri)
56
- encoded_mime=$(printf '%s' "$mime_type" | jq -sRr @uri)
57
- response_file=$(mktemp)
58
- trap 'rm -f "$response_file"' EXIT
59
-
60
- http_code=$(curl --silent --show-error \
61
- --output "$response_file" \
62
- --write-out '%{http_code}' \
63
- --request POST \
64
- --header 'Content-Type: application/octet-stream' \
65
- --header 'Accept: application/json' \
66
- --header 'X-GitHub-Api-Version: 2022-11-28' \
67
- --data-binary "@$file_path" \
68
- "https://uploads.github.com/user-attachments/assets?name=$encoded_name&content_type=$encoded_mime&repository_id=$repository_id")
69
-
70
- if [[ "$http_code" != "201" ]]; then
71
- echo "Error: Upload failed with HTTP $http_code" >&2
72
- cat "$response_file" >&2
73
- exit 1
74
- fi
75
-
76
- asset_url=$(jq -r '.url // empty' "$response_file")
77
- if [[ -z "$asset_url" ]]; then
78
- echo "Error: GitHub upload response did not include an asset URL." >&2
79
- cat "$response_file" >&2
80
- exit 1
81
- fi
82
-
83
- printf '%s\n' "$asset_url"