Skip to content

add hunk-only exports for git diff modes#35

Merged
hyle merged 1 commit intomainfrom
add-hunks
Mar 17, 2026
Merged

add hunk-only exports for git diff modes#35
hyle merged 1 commit intomainfrom
add-hunks

Conversation

@hyle
Copy link
Copy Markdown
Owner

@hyle hyle commented Mar 17, 2026

Summary

Add --hunks[=N] for --staged, --unstaged, and --diff so review-oriented exports can include only changed hunks plus configurable surrounding context.

Changes

  • Add --hunks, --hunks=N, and --hunks N
  • Reject --hunks outside explicit Git delta modes
  • Add header metadata for hunk exports:
    • Hunks: on (context: N)
  • Extend Git-selected path metadata with repo-relative current and previous paths for correct per-file hunk lookup
  • Collect per-file unified hunk ranges from Git using path-scoped git diff -U0
  • Keep added files as full-file exports under --hunks
  • Treat zero-hunk delta entries as metadata-only:
    • keep them in Change Context
    • omit their file body
    • omit them from the project tree
  • Add slice-aware render prep with renderer-owned visibility state
  • Render omission markers between visible slices:
    • ... X unchanged lines omitted ...
  • Preserve original file line numbers when --line-numbers is combined with --hunks
  • Make tree rendering and byte/token metrics honor only render-visible entries
  • Reject signed hunk context values such as --hunks=-1
  • Update README docs and examples for hunk-mode behavior

Why

Git delta modes were already useful for narrowing scope, but they still exported full files. --hunks makes review exports substantially more precise without changing fuori’s model: a single Markdown artifact, grounded in Git, with exact metrics based on the final rendered output.

Verification

  • Ran make test successfully
  • Manual vetting of some output samples

@hyle hyle self-assigned this Mar 17, 2026
@hyle hyle added the enhancement New feature or request label Mar 17, 2026
@hyle hyle merged commit 665dbc3 into main Mar 17, 2026
@hyle hyle deleted the add-hunks branch March 17, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant