-
-
Notifications
You must be signed in to change notification settings - Fork 1
Coco Blame
Griffen Fargo edited this page Aug 2, 2026
·
1 revision
coco blame <file> runs git blame and optionally asks an LLM to explain why each blamed range was introduced.
# Standard blame output (no AI, no API key needed)
coco blame src/index.ts
# Blame a specific line range
coco blame src/index.ts --lines 10:50
# Ask the LLM to explain the introducing commits
coco blame src/index.ts --lines 10:50 --explain
# JSON output
coco blame src/index.ts --explain --json| Flag | Default | Description |
|---|---|---|
<file> (positional) |
required | Repo-relative path to the file to blame |
--lines <range> |
entire file | Limit to a 1-based inclusive line range: "10:20", "10:" (open-ended), or "10" (single line) |
--explain |
false |
Send the blamed commits to the LLM for a natural-language explanation of why each range was introduced |
--json |
false |
Emit machine-readable JSON output |
Without --explain, coco blame prints a formatted table of blame annotations (commit hash, author, date, line number, content). This mode requires no API key and makes no network calls beyond git blame itself.
With --explain, coco:
- Groups the blamed lines by introducing commit hash.
- Fetches the full commit detail (message, diff stats) for each unique commit.
- Sends the grouped context to the configured LLM and asks it to explain, per commit, why those lines were written.
- Prints both the blame table and the per-commit explanations.
To prevent runaway cost on large files:
-
Line cap:
--explainis limited to 400 lines. Narrow the range with--linesif you exceed this. - Commit cap: At most 25 unique commits are explained per invocation. If the range touches more, the oldest are truncated with a note.
- Uncommitted/staged lines (the all-zero sha) are always excluded from explanation.
$ coco blame src/lib/config/types.ts --lines 1:30 --explain
Hash Author Date Line Content
a1b2c3d gfargo 2026-03-12 1 import { ... }
a1b2c3d gfargo 2026-03-12 2 ...
f4e5d6c contributor 2026-05-01 15 export type LLMProvider = ...
...
Explanations:
a1b2c3d (gfargo, 2026-03-12)
Initial module scaffold — established the config type hierarchy and
provider union for the langchain integration layer.
f4e5d6c (contributor, 2026-05-01)
Added the OpenAI-compatible provider presets (deepseek, groq, xai, etc.)
to the LLMProvider union, extending the type system to cover the new
first-class provider category.
With --json, the output is a structured object:
{
"path": "src/lib/config/types.ts",
"lines": [ ... ],
"explanations": [
{
"hash": "a1b2c3d...",
"shortHash": "a1b2c3d",
"author": "gfargo",
"lines": "1-14",
"subject": "feat: initial config type scaffold",
"explanation": "Established the config type hierarchy..."
}
]
}- Command Reference
-
Dynamic Model Routing —
blameExplainis a routable task when usingservice.model: "dynamic"