feat: aggregate views (--domains, --size-by-type, --redirects) + --body-grep filter#2
feat: aggregate views (--domains, --size-by-type, --redirects) + --body-grep filter#2brunojm wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27e8b80a3f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if cli.domains { | ||
| emit_json_doc(&aggregates::domains(&filtered))?; | ||
| return Ok(0); |
There was a problem hiding this comment.
Preserve no-match exit code in aggregate modes
These aggregate branches return Ok(0) unconditionally, which bypasses the documented grep-like contract (1 when nothing matches). In practice, commands like --redirects can emit [] (e.g., a HAR with no 3xx responses) but still exit 0, so automation cannot distinguish “no matches” from “matches found.” Please derive the exit status from the emitted aggregate rows (or at least from exit_code) instead of hardcoding success.
Useful? React with 👍 / 👎.
…and --body-grep filter
PR 2 of the LLM-friendly series. Stacks on feat/llm-improvements-pr1.
Each new aggregate view answers a question that previously forced an agent to
chain several hargrep calls and post-process the output. --body-grep replaces
falling back to rg/grep on the raw HAR (noisy and unaware of JSON escaping).
Flags:
- --domains: [{domain, count}] sorted by count desc. Respects filters, so
e.g. --status-range 4xx --domains shows which hosts are erroring.
- --size-by-type: [{mime_type, total_bytes, count}] sorted by total_bytes
desc. Makes "where's my bandwidth going?" a one-liner.
- --redirects: [{id, url, status, location}] for every 3xx entry. Raw pairs
rather than stitched chains — stitching is one step in the agent and keeps
the format simple.
- --body-grep SUBSTRING: new filter that matches against request postData.text
or response content.text. Composes with the existing filter pipeline.
All four are mutually exclusive with each other and with --overview,
--count, --fields, --entry, --no-body, --include-all-bodies, --output where
combining would be nonsensical.
116 tests pass (55 unit + 61 integration). Clippy clean, fmt clean.
27e8b80 to
cdeaf5b
Compare
|
Addressed the Codex review point in cdeaf5b: All three aggregate views ( For Also rebased onto the updated PR #1 (which added its own Note: CI won't run here because the PR base is |
Summary
Second PR in the LLM-friendly series. Stacks on #1 — please review and merge #1 first, then rebase this onto main.
Each new flag collapses a multi-turn agent interaction into a single call.
What changed
All aggregate views respect filters, so `--status-range 4xx --domains` scopes to erroring hosts.
Why not combine with PR 1?
Keeping PRs small and focused. PR 1 introduces the structural pieces (entry IDs, overview, asset stripping, compact JSON). PR 2 adds targeted aggregate flags that build on them.
Test plan
Follow-up (PR 3)
🤖 Generated with Claude Code