Skip to content

feat(service-git): add readFile, tags, and path-scoped log for read-only history browsing - #269

Merged
antfu merged 1 commit into
mainfrom
feat/service-git-history
Aug 20, 2026
Merged

feat(service-git): add readFile, tags, and path-scoped log for read-only history browsing#269
antfu merged 1 commit into
mainfrom
feat/service-git-history

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Closes #268.

Intent

Extend the built-in @devframes/service-git wire service with the three read-only patterns a downstream history/file browser (e.g. tsnapi's API-snapshot inspector) needs, so consumers can drive git browsing over RPC instead of shelling out. All additions are backward-compatible — existing ops' behavior and types are untouched.

What's added

  • readFile({ path, ref? })GitFile — raw contents of a single file at a commit-ish (default HEAD), the core primitive for browsing versioned files. Absence at the ref is a clear found: false / content: null signal rather than a throw; binary blobs return with content omitted; oversized blobs are clipped with truncated: true. Exact bytes are preserved (including trailing newline), and the client-supplied ref is guarded against option injection.
  • tags()GitTags — tags newest-first with target SHA, creation date, message subject, and an annotated flag. Dates come from creatordate, so annotated tags populate their date (a naive committerdate would be empty for them).
  • Path-scoped logLogArgs gains an optional paths?: string[] (git log -- <paths>) to list only commits that touched given file(s)/director(ies), preserving the existing GitLog/Commit shape.

Each read op is registered as a type: 'query' RPC (agent-flagged read-only), mirrored in the two declaration merges that keep the surface typed for consumers, with the tsnapi API snapshot and the services guide updated accordingly.

Tests

New cases cover file present vs. absent at a ref (plus the dashed-ref injection guard), annotated + lightweight tags with dates and ordering, and path-scoped log filtering. The out-of-repo degradation test now also exercises tags/readFile.

This PR was created with the help of an agent.

@netlify

netlify Bot commented Aug 20, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 65d889f
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a867e670af1d500083d2c9c
😎 Deploy Preview https://deploy-preview-269--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@antfu
antfu merged commit edcbbf2 into main Aug 20, 2026
12 checks passed
@antfu
antfu deleted the feat/service-git-history branch August 20, 2026 04:19
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.

feat(service-git): support raw file-at-ref, tags, and path-scoped log for read-only history browsing

2 participants