-
Notifications
You must be signed in to change notification settings - Fork 8
Description
Problem
Hunk should make it easy to hand the currently relevant diff context to a coding agent.
The user request here is broader than "export the focused hunk": ideally, if the user selects text in Hunk, that selection should become available to their coding agent. At minimum, Hunk should have a first-class way to publish the current hunk/selection to an external agent workflow.
Related work already in flight
There are already open PRs that appear to cover important pieces of this:
- feat: export selected hunk to pi #73 —
feat: export selected hunk to pi - feat: add Hunk notify stream #77 —
feat: add Hunk notify stream
From those PR descriptions:
- feat: export selected hunk to pi #73 adds a
pshortcut and writes.hunk/pi-selection.json - feat: add Hunk notify stream #77 adds a notify stream and
hunk session selection ...
That looks like good foundation work, but there is not yet a clear issue tracking the end-user capability we want to ship.
Goal
Let Hunk publish the user's current review context to a coding agent in a structured, low-friction way.
Potential levels of support:
- focused hunk export
- published selection export (
p-style explicit action) - exact text selection export when terminal selection support makes that possible
Scope / design questions
- Should Hunk bless the file bridge (
.hunk/pi-selection.json), the session CLI + notify stream, or both? - Should the integration be Pi-specific or generic enough for any local coding agent?
- Is the primary UX:
- explicit publish (
p) - always-current focused selection
- both?
- explicit publish (
- If arbitrary text selection is not practical cross-terminal, is the focused hunk the right stable primitive to ship first?
Acceptance criteria
- A user can publish the current review context from Hunk to a coding agent workflow without copy/paste.
- The exported payload includes enough structure to be useful:
- repo root (when available)
- file path / previous path
- hunk or selection range
- diff snippet / patch
- human-readable prompt text
- The transport is documented and stable enough for external tooling to rely on.
- If exact text selection is not supported initially, document that the first shipped unit is the focused/published hunk.
Notes
This issue is intentionally outcome-focused so the work can reuse or supersede #73 / #77 as needed without losing sight of the user-facing goal.