feat: fetch_issue script for trimmed issue reads

Raw `tea issues -o json` / `tea api` dumps the full payload (avatars,
nested users, every comment) into the model context. The script writes
trimmed markdown to tmp/issue/<n>/ and prints only a compact index;
login comes from the operator pin, never an argument.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
naudachu
2026-08-07 18:06:09 +05:00
parent e9ddc999f7
commit 6c6e0149ac
2 changed files with 216 additions and 0 deletions
+33
View File
@@ -46,6 +46,39 @@ The pin takes effect immediately — no restart. Only `tea logins list` and
per-project by the operator (see `/tea:auth`) and injected by the guard.
Config lives in `$XDG_CONFIG_HOME/tea`.
## Reading an issue: use the fetch script, not raw tea calls
To read an existing issue (its body, its discussion), do NOT run
`tea issues <n> -o json` or `tea api .../issues/<n>` directly — the full JSON
payload (avatars, nested user objects, every comment body) lands in your
context whether you need it or not. Instead run the bundled script; the only
input it needs is the issue key:
```bash
python3 <skill-base-dir>/scripts/fetch_issue.py 42
```
Key forms: `42`, `#42`, `owner/repo#42`, or a full issue URL. Repo defaults
to the current directory's git remote (add `--repo owner/repo` outside one).
It writes trimmed markdown files locally and prints only a compact index:
```
tmp/issue/42/data issue: metadata header + body
tmp/issue/42/comments/ one file per comment: NNN-<comment-id>.md
```
Then Read just the files the task needs — often the `data` file alone, or a
single comment picked from the index (author + date per line). Each comment
file carries its `comment-id`, ready for a `PATCH` via `tea api`.
Notes:
- No `--login` on the script call: the script resolves the operator's pinned
login itself from `.claude/settings.local.json` — same source as the
tea-guard hook. No pin → it exits with a pointer to `/tea:auth`.
- Every run refetches fresh and wipes the issue's `comments/` dir, so stale
files never survive.
## Index
- [tea CLI overview](references/tea/index.md) — global flags, common options, output formats