feat(session): filter comment list by author#500
Conversation
- Add `--author <name>` and `--no-author` flags to `hunk session comment list` - Thread the author filters through CLI parsing, types, and session protocol - Apply filtering in the broker for both live and stored comment paths - Cover parsing and broker filtering with unit tests and update agent docs Fixes modem-dev#489
|
PR author is not in the allowed authors list. |
|
Don't love --no-author meaning "human notes", but I guess we can go with it. Wish there was better / clearer language ... I feel agents would perform better. |
Yeah agreed the language is a bit confusing, and I just realized my PR description was wrong about who actually lands in For context on I've corrected the PR description accordingly so Sticking with the
Happy to give that a shot if it sounds right to you. |
What
Adds
--author <name>and--no-authorfilters tohunk session comment list, letting the CLI narrow inline review comments by author — mirroring the existing--fileand--typefilters.Why
In an agent-assisted review, an agent and a human both leave notes on the same session, so
hunk session comment list --jsonreturns a mixed set. Today the only way to isolate one author's notes is to pipe the JSON throughjq(jq '[.comments[] | select(.author=="pi")]'), which pushes a conceptually one-flag filter into every consumer. A native--author <name>flag — plus a--no-authorcompanion for untagged notes — keeps--jsonconsumers thin and matches the ergonomics of--file/--type.How it works
The filter threads through the same layers as
--type, with the actual filtering in a single place (the daemon list handler):core/cli.ts—--author <name>/--no-authoroptions, parsed and forwarded into the command inputcore/types.ts,session/protocol.ts—author/noAuthoron the command input and wire shapeshunk-session/cli.ts— the client includes them in the requestsession-broker/brokerServer.ts— one post-branch filter narrows the result by author, covering both the live-comment and review-note paths (both carryauthor)--author <name>matches that author exactly;--no-authorreturns only comments with no author tag — comments added viacomment add/applywithout an author. (Humancnotes are auto-taggedauthor: "user", so they're matched by--author user.) Neither flag returns everything. Documented indocs/agent-workflows.md.Testing
core/cli.test.ts):--author pi→{ author: "pi" };--no-author→{ noAuthor: true }.brokerServer.helpers.test.ts): for a mixed-author comment set,--authorreturns only the matching author,--no-authorreturns only the author-less, and no flag returns all.bun run typecheck,bun run lint, andbun run format:checkclean.Screenshots
End-to-end via
hunkdevon this branch — drag each PNG into the GitHub editor to upload it in place:1. Add one
--author picomment and one untagged comment2.
hunk session comment list --author pi→ only pi's3.
hunk session comment list --no-author→ only the untagged one4.
hunk session comment list(no filter) → bothFixes #489