Skip to content

feat: infer repo for bare issue numbers#37

Merged
dutifulbob merged 2 commits into
mainfrom
feat/infer-resource-repo-from-remote
Jun 9, 2026
Merged

feat: infer repo for bare issue numbers#37
dutifulbob merged 2 commits into
mainfrom
feat/infer-resource-repo-from-remote

Conversation

@dutifulbob

Copy link
Copy Markdown
Member

Opened on behalf of Onur Solmaz (osolmaz).

Summary

Running gzg 1234 from inside a GitHub checkout should open issue or PR number 1234 in that repo.
This change makes startup parsing and gzg open infer owner/repo from the current git remote before treating a bare number as invalid.
It also documents the shortcut and keeps the capture manifests aligned with the new app tree.

What Changed

Bare resource numbers now work when the current directory has a GitHub remote.
The parser still accepts full GitHub URLs, owner/repo#number, and owner/repo number exactly as before.

  • Added ResourceId::parse_with_repo_context for bare 1234 and #1234 parsing.
  • Exposed current-repo detection from git remotes, preferring origin and falling back to another GitHub remote.
  • Wired repo inference into normal startup and gzg open session-control parsing.
  • Updated README usage examples.
  • Refreshed capture manifest metadata after the source change.

Testing

I tested the new parser paths directly, then ran the full local gate.
I also ran a real CLI smoke from a temporary git checkout with origin=https://github.com/openclaw/openclaw.git and verified gzg ... 81834 rendered the OpenClaw PR fixture.

  • cargo test repo_context
  • cargo test relative_numbers
  • cargo test open_parser
  • cargo test github_remote
  • gzg --once smoke via cargo run --manifest-path /home/bob/repos/ghzinga/Cargo.toml --bin gzg -- --once --offline-fixture /home/bob/repos/ghzinga/fixtures/pr-81834.json 81834 from a temp GitHub checkout
  • scripts/ci-local.sh

Risks

The behavior is low risk because bare numbers only resolve when a GitHub remote is available.
Without that repo context, existing invalid-input behavior remains in place.

  • Repo inference shells out to local git remote, matching the existing session-context approach.
  • A repo with multiple GitHub remotes uses origin first, then the first non-origin GitHub remote reported by git.

@dutifulbob dutifulbob merged commit f7a8505 into main Jun 9, 2026
1 check passed
@dutifulbob dutifulbob deleted the feat/infer-resource-repo-from-remote branch June 9, 2026 06:29
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.

2 participants