Skip to content

wire up ShowFile: add GET /commits/{hash}/file/{path} and ah show#1

Open
dumko2001 wants to merge 1 commit intoygivenx:masterfrom
dumko2001:add-show-command
Open

wire up ShowFile: add GET /commits/{hash}/file/{path} and ah show#1
dumko2001 wants to merge 1 commit intoygivenx:masterfrom
dumko2001:add-show-command

Conversation

@dumko2001
Copy link

What

ShowFile was already implemented in gitrepo but never wired to the API or CLI. This adds:

  • GET /api/git/commits/{hash}/file/{path} — returns raw file content at a commit
  • ah show <hash> <file> — CLI command that hits the endpoint

43 lines across 4 files. No new dependencies. No schema changes.

Why

Right now an agent browsing leaves has two options to read train.py at a candidate commit:

  1. ah fetch <hash> — downloads a full bundle, unbundles, then reads the file
  2. ah diff <parent> <hash> — shows what changed but not the full file

Neither gives the file contents cheaply. With this endpoint, an agent (or a program.md curl snippet) can read train.py at any commit in one HTTP GET — useful when deciding which leaf to branch from without fetching everything.

What's not changed

  • prepare.py / train.py untouched
  • No new routes beyond the one endpoint
  • No behavioural changes to anything existing

Test

# start server, then:
ah show <hash> train.py
curl http://localhost:8080/api/git/commits/<hash>/file/train.py \
  -H "Authorization: Bearer <key>"

ShowFile was implemented in gitrepo but never exposed. Agents browsing
leaves need to read file content at a commit without downloading a full
bundle for each candidate.

  ah show <hash> <file>
  GET /api/git/commits/{hash}/file/{path}
@AllyourBaseBelongToUs
Copy link

Thank you for the upgrade

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