Skip to content

feat(cli): support replies to review comments - #1012

Merged
benvinegar merged 2 commits into
mainfrom
fix/964-cli-comment-replies
Sep 6, 2026
Merged

feat(cli): support replies to review comments#1012
benvinegar merged 2 commits into
mainfrom
fix/964-cli-comment-replies

Conversation

@benvinegar

Copy link
Copy Markdown
Member

Summary

Closes #964.

  • add hunk session comment add --reply-to <note-id> for replying to an existing inline review note
  • accept replyTo on each comment apply batch entry
  • inherit the parent's semantic file and anchor, preserving nested threads and atomic batch behavior
  • expose parentId through default and typed JSON comment listings
  • update the daemon protocol revision, command help, agent workflow docs, generated review skill, and changeset

Approach

Reply targets are mutually exclusive with explicit file/line targets at the CLI, type, HTTP, and broker boundaries. The live-session adapter resolves the parent from shared review state and reuses the shared reply-parent validation and semantic anchor derivations rather than introducing a CLI-specific threading model.

This only adds the CLI write surface. It does not route replies back to connected agents, edit existing notes, or change TUI interactions.

Validation

  • bun run typecheck
  • bun run lint
  • bun run deps:check
  • bun run test
  • bun run test:integration
  • focused CLI, protocol, broker, and terminal-review tests
  • changed-file oxfmt --check
  • git diff --check
  • two independent fresh-context code-review passes found no blockers

Manual check

On Linux in a real Hunk TUI launched from source, created a root comment and multiple nested replies through hunk session comment add --reply-to. Confirmed that:

  • every reply inherited the parent's file, side, line, and hunk
  • nested and sibling replies rendered as a thread beside the code
  • hunk session comment list --json included each reply's parentId

No TUI behavior was changed.

This PR description was generated by Pi using GPT-5.6 Sol

@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hunk-web Ready Ready Preview Sep 6, 2026 11:08pm UTC

Request Review

@benvinegar
benvinegar marked this pull request as ready for review September 6, 2026 23:06
@greptile-apps

greptile-apps Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds reply support to the session comment CLI and carries reply relationships through parsing, daemon and broker protocols, shared review state, snapshots, and JSON listings.

  • Adds mutually exclusive root-note and reply targets for single and batched comment commands.
  • Resolves reply parents against shared review state and inherits their semantic anchors.
  • Preserves atomic batch mutation and existing hunk-first targeting behavior.
  • Exposes parentId through live and typed comment listings.
  • Updates protocol revision, generated agent guidance, documentation, tests, and release metadata.

Confidence Score: 5/5

The PR appears safe to merge; reply targeting, anchor inheritance, listing propagation, and batch atomicity are consistently implemented and tested.

No actionable correctness, security, protocol, or repository-rule failure remained after tracing the reply flow across CLI parsing, daemon validation, broker dispatch, review-state mutation, and listing projections.

Important Files Changed

Filename Overview
packages/hunk/src/ui/hooks/useTerminalReview.ts Resolves reply parents from shared review state, inherits semantic anchors, and atomically creates single or batched live replies.
packages/hunk/src/ui/lib/reviewNoteMapping.ts Maps live replies into threaded stored notes using the parent’s identity, anchor, and resolution.
packages/hunk/src/app/cli.ts Parses reply-only single and batch inputs while rejecting mixed explicit and inherited targets.
packages/hunk/src/session/broker/brokerServer.ts Lowers validated daemon requests into mutually exclusive session comment command inputs.
packages/hunk/src/session/protocolSchemas.ts Extends daemon request and snapshot schemas with validated reply targets and parent identifiers.
packages/hunk/src/session/broker/protocolParsers.ts Validates reply/root target exclusivity at the broker command boundary.
packages/hunk/src/core/review/intents.ts Extracts shared validation for active or stale reply parents while rejecting unavailable parents.
packages/hunk/src/core/liveComments.ts Introduces discriminated comment target types and records reply parent identifiers on live comments.

Sequence Diagram

sequenceDiagram
    participant CLI as Session CLI
    participant Daemon as Session daemon
    participant Broker as Command broker
    participant Review as Live review state
    CLI->>Daemon: comment add/apply with replyTo
    Daemon->>Daemon: Validate reply/root exclusivity
    Daemon->>Broker: Forward typed comment command
    Broker->>Review: Resolve existing parent note
    Review->>Review: Inherit file and semantic anchor
    Review->>Review: Add reply with parentId
    Review-->>Broker: Applied comment result
    Broker-->>CLI: Result and updated listing
Loading

Reviews (1): Last reviewed commit: "feat(cli): support replies to review com..." | Re-trigger Greptile

@benvinegar
benvinegar merged commit a83da6d into main Sep 6, 2026
12 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.

CLI: support replying to an existing inline review note

1 participant