Skip to content

feat(cli): rat grep for transcript search - #6

Merged
seamoss merged 1 commit into
devfrom
feat/grep-transcript
Apr 24, 2026
Merged

seamoss merged 1 commit into
devfrom
feat/grep-transcript

Conversation

@seamoss

@seamoss seamoss commented Apr 24, 2026

Copy link
Copy Markdown
Owner

Summary

`rat grep ` scans PtyOutput events across session logs. Works against live sessions, dead sessions with metas on disk, or any raw .log file — no daemon round-trip.

```sh
rat grep ERROR # all sessions
rat grep ERROR -s agent # single session
rat grep ERROR --log path.log # specific file
rat grep "\x1b\[31m" --raw # raw-byte match
```

Output: `{session_short}:{seq}: {line}`. Default strips ANSI; `--raw` matches literal bytes.

Test plan

  • `cargo test`, `cargo clippy -D warnings`, `cargo fmt --check`
  • Smoke: `rat grep rat --log ~/.local/state/rat/.log` returns expected match
  • CI green

New `rat grep <pattern>` subcommand that scans PtyOutput events across
session logs for a substring. Uniquely enabled by the event-log
design: works against live sessions, dead sessions with metas still
on disk, or any raw .log file — no daemon round-trip needed.

Flags:
- `-s, --session <id|name>` — limit to one session
- `--log <path>` — scan a specific log file
- `--raw` — match raw bytes; default strips ANSI so colored prompts
  and editor decorations don't interfere with the match text.

Output format: `{session_short}:{seq}: {line}`, which composes cleanly
with unix piping. Plain substring match only for MVP; regex is a
natural follow-up.

Adds a tiny CSI-only ANSI stripper inline rather than pulling in
`vte` — grep only needs to drop color codes from match lines, full
terminal emulation would be overkill.
@seamoss
seamoss force-pushed the feat/grep-transcript branch from 656e221 to a8c598f Compare April 24, 2026 23:18
@seamoss
seamoss merged commit fcdc868 into dev Apr 24, 2026
3 checks passed
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.

1 participant