Code Storage now has a first-class blame API for reading per-line commit attribution without cloning a repository.
Pass a file path with an optional branch, tag, or commit SHA to get line-by-line blame entries and a deduplicated commit map keyed by SHA. Each line references the commit that introduced it, while the commit map includes author, committer, timestamp, previous commit, and summary metadata.
const blame = await repo.getBlame({
path: 'src/index.ts',
ref: 'main',
});blame = await repo.get_blame(
path="src/index.ts",
ref="main",
)blame, err := repo.GetBlame(ctx, storage.GetBlameOptions{
Path: "src/index.ts",
Ref: "main",
})You can also limit the response to specific git blame -L ranges, including line-number and regex
ranges, and enable rename/copy detection when you need to follow code across file moves. The move
detection option corresponds to git blame -C -C -M.
const blame = await repo.getBlame({
path: 'src/index.ts',
ref: 'main',
ranges: ['10,40', '/handler/,+20'],
detectMoves: true,
});The HTTP API resolves against the repository default branch when ref is omitted. If the
ephemeral flag is true, it resolves refs from the ephemeral namespace instead. TypeScript, Python,
and Go SDKs all support getBlame.