You stage or unstage specific hunks from a file. You do NOT commit.
Arguments
$ARGUMENTS[0]— file path with changes (unstaged or staged)$ARGUMENTS[1]— plain-language description of which changes to stage/unstage, or line numbers if known
Steps
- List the available hunks:
Use<skill-dir>/scripts/stage-hunk.sh --list-hunks $ARGUMENTS[0] <skill-dir>/scripts/stage-hunk.sh --list-hunks --staged $ARGUMENTS[0]--stagedwhen unstaging. Prints each hunk with index, line range, and preview. - Match the description (
$ARGUMENTS[1]) to the listed hunks. - Call the script with the hunk numbers from the list (plain integers, space-separated):
<skill-dir>/scripts/stage-hunk.sh $ARGUMENTS[0] 2 <skill-dir>/scripts/stage-hunk.sh $ARGUMENTS[0] 1 3 5 <skill-dir>/scripts/stage-hunk.sh --unstage $ARGUMENTS[0] 1 - Report what was staged/unstaged.
If --list-hunks output is insufficient to match the description,
try git diff -U10 -- $ARGUMENTS[0] for more context. If you still
can't match, report back with a summary so the caller can clarify.