Skip to content

Commit 52c3cc1

Browse files
committed
docs: add --cat flag documentation to CLI reference
Documents the new --cat flag that emits full file content at SHA instead of diff. Includes option table entry, progressive disclosure ladder placement, usage examples, and detailed behavior description for text/JSON modes and --out behavior.
1 parent 899ae87 commit 52c3cc1

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

docs/CLI.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ cex [REPO] [OPTIONS]
3939
| `--diff` || Include full diff; implies `--max-lines 500` unless set |
4040
| `--no-diff` || Explicitly suppress the diff (wins over `--diff`) |
4141
| `--file PATH` || On `--show`/`--compare`/`--pr`/`--range`: restrict diff to this file (implies `--diff`). On `--export`: filter commit list to commits that touched PATH (rename-aware). Repeatable. |
42+
| `--cat` || Emit the **full file content** at SHA instead of a diff. Requires `--show` and `--file`. Repeatable `--file` supported. |
4243

4344
### Size caps
4445

@@ -83,11 +84,14 @@ Headless commands climb from cheapest → fullest. Agents should start at the to
8384
| 1 | `--summary` | Metadata + diff stat line (≤ 20 lines) |
8485
| 2 | *(default)* | Metadata + file list (no diff body) |
8586
| 3 | `--file PATH` | Diff restricted to one file |
87+
| 3b | `--file PATH --cat` | Full file content at that commit (no diff) |
8688
| 4 | `--diff` | Full diff, capped at 500 lines (truncation marker emitted) |
8789
| 5 | `--diff --max-lines 0` | Uncapped full diff |
8890

8991
Priority when multiple flags are passed: `--summary` > `--no-diff` > `--diff` > `--file`.
9092

93+
`--cat` is orthogonal to the diff ladder — it bypasses the diff entirely and returns the raw file bytes at the given SHA. Only valid with `--show`.
94+
9195
---
9296

9397
## Modes
@@ -158,16 +162,20 @@ File-history mode (`--file PATH`) emits a flat one-line-per-commit listing of ev
158162
### 4. Single commit (`--show SHA`)
159163

160164
```bash
161-
cex owner/repo --show abc1234 # file list only (no diff)
162-
cex owner/repo --show abc1234 --summary # metadata + stat line only
163-
cex owner/repo --show abc1234 --diff # full diff (capped at 500 lines)
164-
cex owner/repo --show abc1234 --file src/app.py # diff for that file only
165-
cex owner/repo --show abc1234 --format json # structured output
166-
cex owner/repo --show abc1234 --out ./artifacts # write file + print path
165+
cex owner/repo --show abc1234 # file list only (no diff)
166+
cex owner/repo --show abc1234 --summary # metadata + stat line only
167+
cex owner/repo --show abc1234 --diff # full diff (capped at 500 lines)
168+
cex owner/repo --show abc1234 --file src/app.py # diff for that file only
169+
cex owner/repo --show abc1234 --file src/app.py --cat # full file content at SHA
170+
cex owner/repo --show abc1234 --file a.py --file b.py --cat # multiple files
171+
cex owner/repo --show abc1234 --format json # structured output
172+
cex owner/repo --show abc1234 --out ./artifacts # write file + print path
167173
```
168174

169175
Short (7+ chars) and full SHAs are both accepted.
170176

177+
`--cat` fetches the blob on demand from the partial clone (same lazy-fetch mechanism as `--diff`). In text mode with a single `--file`, raw content is emitted directly; with multiple `--file` flags each block is prefixed with `=== path ===`. In JSON mode the response has `"kind": "file_content"` with a `"files"` array of `{"path", "content"}` objects. With `--out`, each file is written as `<short-sha>_<basename>` and the path is printed.
178+
171179
---
172180

173181
### 5. Commit range (`--range SHA [SHA]`)
@@ -315,7 +323,8 @@ cex torvalds/linux --export --file kernel/sched/core.c
315323
cex torvalds/linux --show abc1234 # file list
316324
cex torvalds/linux --show abc1234 --summary # stats only
317325
cex torvalds/linux --show abc1234 --diff # full diff (capped)
318-
cex torvalds/linux --show abc1234 --file foo.c # one file's diff
326+
cex torvalds/linux --show abc1234 --file foo.c # one file's diff
327+
cex torvalds/linux --show abc1234 --file foo.c --cat # full file content at SHA
319328

320329
# Structured output for agents
321330
cex torvalds/linux --show abc1234 --format json | jq .summary

0 commit comments

Comments
 (0)