Skip to content

Agent Comments: Allow for bulk update #158

@sroidl-airup

Description

@sroidl-airup

First of all, thanks for this nice tool!

Context
I've been trying to find a good workflow to use hunk to review code changes.
Currently, I'm using it to review a git commit or the current changeset after work has been done.

My prompt is something like this (I'm using it with opencode):

Use the `hunk-review` skill to understand the hunk command.

1. Understand the entire session that the user is looking at.
2. Make sure to provide a summary of the review to the topmost chunk, regardless of its contents.
3. Provide annotations for central changes of the code and guide the user through the 'golden threat' of this changeset.

Do _not_ annotate any files in the `*/**/.generated` folder.
Do _not_ annotate the C4 Diagram.

## additional info

- After understanding what diff the user is looking at (either the current changes in the worktree or a git commit from history), use the correct `git` command to get a full understanding of the changes.

- Use the '--json' flag to get better output for your consumption when dealing with hunk.
- When annotating a hunk, parse it's file and the line number from the respective git diff.
- You can only annotate a full hunk, indicated by the line number after the `@@ @@` in the git diff. You cannot annotate other line numbers, even when the CLI suggests that.

<example>

</example>

Here the file is "[...]/Badge.tsx"  and the file number to annotate is 24. 


## Important
You must not provide a text summary. 
The expected output is you interacting with the `hunk` binary to annotate the active user session.

Issue
It seems that the current cli/api for agents to understand the users session is not very suitable to understand and update it in one go:

The session context only returns the current users hunk with details about line numbers that can be used to annotate.
It seems that the agent has to navigate through all hunks to understand them. This can be somewhat mitigated by having it use git to see the entire changeset, but it still has to annotate hunk-by-hunk, instead of, say sending all comments in one go.

Idea

  1. Some sort of flag could be helpful, that extends the current session context command to return the entire session with all hunks (including lines), possibly even with the actual diff, so that an agent can understand it in one go.
  2. Have an option to annotate this list of hunks in one go, instead of the need to annotate each file one-by-one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions