Loading...
Loading...
Programmatic hunk selection for Jujutsu — split, commit, or squash specific hunks without interactive prompts. Use when making partial commits or selective squashes.
npx skill4agent add knoopx/pi jj-hunk# See what hunks exist
jj-hunk list
jj-hunk list --format text # Human-readable output
jj-hunk list --files # Files with hunk counts only
# Split changes using a spec file
jj-hunk split --spec-file /tmp/spec.yaml "feat: add feature A"
# Commit specific files, leave rest uncommitted
jj-hunk commit --spec-file /tmp/commit-spec.yaml "fix: handle edge case"
# Squash into parent
jj-hunk squash --spec-file /tmp/squash-spec.yaml-r <rev>@-files:
src/main.rs:
hunks: [0, "hunk-7c3d..."] # Select by index or stable id
path/to/skip:
action: reset # Discard all changes
default: reset # Unlisted files get this actionhunks: [indices|ids]jj-hunk listids: ["hunk-..."]action: keepaction: resetdefaultjj-hunk list --spec-template# 1. List hunks
jj-hunk list --format text
# Output: M src/main.rs — hunk 0 insert hunk-abc123, hunk 1 insert hunk-def456
# 2. Create spec for first hunk only
cat > /tmp/split-spec.yaml << 'EOF'
files:
src/main.rs:
hunks: [0]
default: reset
EOF
# 3. Split — first hunk becomes commit A, rest stays in working copy
jj-hunk split --spec-file /tmp/split-spec.yaml "feat: add feature A"cat > /tmp/commit-spec.yaml << 'EOF'
files:
src/fix.rs:
action: keep
default: reset
EOF
jj-hunk commit --spec-file /tmp/commit-spec.yaml "fix: handle edge case"--filescat spec.yaml | jj-hunk commit - "message"-r <rev>concat()description