feat(bin): add skill for uploading evidence screenshots to GitHub - #1
Open
bkp5190 wants to merge 2 commits into
Open
feat(bin): add skill for uploading evidence screenshots to GitHub#1bkp5190 wants to merge 2 commits into
bkp5190 wants to merge 2 commits into
Conversation
Crewmates take real before/after evidence screenshots but only ever referenced the local file path in PR descriptions, which is unreachable from GitHub. Add a wrapper around the undocumented uploads.github.com attachment endpoint plus a skill documenting when and how to use it, and point future ship briefs at it instead of a bare local path.
…x broken doc links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Create a skill for uploading screenshots to GitHub using the GitHub API (checking the API docs where possible). Background: crewmates working on stockmatch/stockmatch-infra/stockmatch-ios PRs already take real before/after screenshots as evidence, but they only ever referenced the local evidence file path (e.g. ~/.no-mistakes/evidence//after.png) in the PR description - that path is meaningless to anyone viewing the PR on GitHub, so the screenshots were never actually visible. Firstmate had just fixed this manually for three open PRs by uploading the existing local PNGs to GitHub and posting them as PR comments; the captain wants this turned into a reusable skill so future crewmates (and firstmate) do this automatically instead of it being a one-off manual fix. The captain was told GitHub has no officially documented API for uploading an image into a PR/issue body, but there is a working, undocumented uploads.github.com endpoint (POST https://uploads.github.com/user-attachments/assets?name=&content_type=&repository_id= with an Authorization: Bearer header and the file as the request body), which returns {"url": "https://github.com/user-attachments/assets/"} that renders inline when embedded as
in a PR body or comment. The captain explicitly chose this undocumented-endpoint approach over the alternative of committing screenshots into the repo permanently, after being told the tradeoff - the endpoint being unofficial and able to break without notice is an accepted risk, not something to silently work around by switching approaches.
What Changed
.agents/skills/github-pr-screenshot/SKILL.md, an agent-only skill that uploads a local evidence screenshot to GitHub's attachment endpoint and embeds the returned URL as markdown so it renders inline on a PR, instead of referencing a local file path that's meaningless off the crewmate's machine.bin/fm-pr-screenshot-upload.sh, the helper script backing the skill that performs the upload.AGENTS.md: section 11 now directs crewmate briefs that ask for evidence screenshots to usegithub-pr-screenshotinstead of a bare local path, and section 13 registers it in the agent-only skill trigger list.docs/documentation-audiences.jsonunder theagent-runtimeaudience.Risk Assessment
✅ Low: The diff is a small, well-bounded skill+script addition; both previously authorized fixes (documentation-audiences entry, markdown alt-text escaping of
]) are correctly applied, shellcheck is clean, and tracing the upload script's logic (media-type detection, URL/query encoding, per-file error handling in a mixed batch) surfaced no new reachable bug.Testing
Ran the targeted documentation-audiences regression test (passes, confirming the required audience-classification fix landed) and manually exercised bin/fm-pr-screenshot-upload.sh end-to-end against a real GitHub repository with push access, uploading a test PNG whose filename contains a literal
]: the script correctly escaped it in the markdown alt text and the real uploads.github.com endpoint returned a working asset URL that was verified (via authenticated fetch + byte comparison) to resolve back to the exact uploaded image, directly demonstrating the user's core intent — that a local screenshot becomes an actually-visible GitHub-hosted image. No findings.Evidence: End-to-end upload verification transcript
Source: End-to-end upload verification transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
🔧 **Rebase** - 1 issue found → auto-fixed ✅
.agents/skills/afk/SKILL.md- branch carries 498 commit(s) that exist on your local main branch but were never pushed to origin/main; rebasing would bundle this unrelated work (497 file(s)) into the PR:Push main to origin, or rebase your branch onto origin/main, before gating.
🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-documentation-audiences.test.sh— all 4 subtests pass, confirming .agents/skills/github-pr-screenshot/SKILL.md is now classified in docs/documentation-audiences.json (resolves test-1/review-1)Manual end-to-end run ofbin/fm-pr-screenshot-upload.sh bkp5190/firstmate "before]after.png"against a real GitHub repo with confirmed push access: produced![before\]after.png](https://github.com/user-attachments/assets/...)— bracket in filename correctly backslash-escaped in markdown alt text (resolves review-2)Fetched the returned asset URL with an authenticated Bearer request: got a 302 to a signed S3 URL, downloaded content, and confirmed viacmpit is byte-identical to the originally uploaded PNG — proves the returned URL is a genuine, renderable image asset, not just an API artifactgit status --porcelainafter testing — worktree left clean, no stray files✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.