Skip to content

feat: pasted GitHub file links become chips with the file's contents - #575

Merged
adampeterhiggins merged 1 commit into
mainfrom
ah/fix-github-link-paste-parsing
Nov 13, 2026
Merged

adampeterhiggins merged 1 commit into
mainfrom
ah/fix-github-link-paste-parsing

Conversation

@adampeterhiggins

Copy link
Copy Markdown
Owner

Problem

Pasting a GitHub file link (github.com/<owner>/<repo>/blob/<ref>/<path>#L6) into the composer left it as plain text. The /blob/ URL shape wasn't one of the GitHub links the composer recognises, so the agent got only the URL and had to fetch the file itself.

Fix

A file link is now one more kind of GitHub ref (linkType: "blob", refType: "file"). The existing ref pipeline carries it end to end: the composer chip, the loading chip, the hover card, the RPC, MCP read_context_link, and bare links in chat messages.

  • Parsing (packages/contracts/src/githubRefs.ts): /blob/<ref>/<path> with an optional #L6, #L6-L9 or #L6C2-L9C5 anchor. The ref and path are kept joined, because a branch name can contain slashes.
  • Reading (apps/server/src/githubIssues/gitHubRefs.ts): one gh api graphql query asks for object(expression: "<ref>:<path>") under an alias for every way the URL can split into ref and path (up to 8 ref segments). The shortest ref that resolves to a blob wins. A missing file or a folder returns null, not a 404, so a folder link stays a plain link.
  • What the agent gets: a facts list (ref, path, lines, size), the linked lines in their own fenced block, then the whole file. All of it sits within the existing 32k cap. Binary files say so instead of including content.
  • Chip: labelled repo: kustomization.yaml:6. Web shows a file-code icon; mobile uses the generic file glyph. The context id includes the path, so two files at one commit don't collapse into one chip.

Docs: docs/user/composer.md and docs/fork-differences.md.

Verification

  • Extended tests: the link parser and label (composerObjectLinks.test.ts), and GitHubIssues.test.ts (a branch with a slash plus linked lines, a folder treated as not found, a binary file at a SHA).
  • vp run check:changed passes.
  • Ran the real query through gh against the private link that prompted this:
# focaldata/cin-iac-application file workloads/cin-tusd/base/application/kustomization.yaml:6
- Ref: 9f182a902a824d274a07d4f527baf9391ba150c8
- Lines: 6–6 of 15
## Line 6
    newName: eu.gcr.io/raincloud-focaldata/market-research-platform/cin-tusd

Not yet done: a pass in the running app with before/after screenshots of the chip.

Claude Opus 5.5 via Claude Code (in T3 Code).

🤖 Generated with Claude Code

A github.com /blob/ link (optionally #L6 or #L6-L9) now converts to a
chip like `repo: kustomization.yaml:6`. The agent receives the linked
lines and the whole file at that ref, read in one GraphQL query that
tries each ref/path split, so branches with slashes resolve and a
folder stays a plain link.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adampeterhiggins
adampeterhiggins force-pushed the ah/fix-github-link-paste-parsing branch from 63d5d6a to e73f12f Compare November 13, 2026 15:07
@adampeterhiggins
adampeterhiggins merged commit 082a138 into main Nov 13, 2026
@adampeterhiggins
adampeterhiggins deleted the ah/fix-github-link-paste-parsing branch November 13, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant