Skip to content

fix(read): preserve exact head semantics#1018

Open
em0t wants to merge 1 commit intortk-ai:developfrom
em0t:fix/head-exact-semantics
Open

fix(read): preserve exact head semantics#1018
em0t wants to merge 1 commit intortk-ai:developfrom
em0t:fix/head-exact-semantics

Conversation

@em0t
Copy link
Copy Markdown

@em0t em0t commented Apr 4, 2026

Summary

  • preserve exact head semantics in rewrites by routing head through an internal --head-lines mode instead of --max-lines
  • rewrite both plain head file and numeric variants like head -20, head -n 12, and head --lines 7 to exact top-line slicing
  • keep existing rtk read --max-lines summarizing behavior unchanged for direct rtk read usage
  • add focused regression coverage for rewrite routing and exact head windowing

Minimal Cases

head

Fixture (input file contents)

line-01
line-02
line-03
line-04
line-05
line-06
line-07
line-08
line-09
line-10
line-11
line-12

Raw

line-01
line-02
line-03
line-04
line-05
line-06
line-07
line-08
line-09
line-10

Previous RTK

line-01
line-02
line-03
line-04
line-05
line-06
line-07
line-08
line-09
line-10
line-11
line-12

This PR

line-01
line-02
line-03
line-04
line-05
line-06
line-07
line-08
line-09
line-10

head -3

Fixture (input file contents)

line-01
line-02
line-03
line-04
line-05

Raw

line-01
line-02
line-03

Previous RTK

line-01
// ... 4 more lines (total: 5)

This PR

line-01
line-02
line-03

Testing

  • cargo fmt --all
  • cargo test test_rewrite_head -- --nocapture
  • cargo test test_apply_line_window_head_lines -- --nocapture
  • cargo test --all
  • cargo clippy --all-targets (existing repo warnings only; none introduced by this PR)

Signed-off-by: em0t <10153971+em0t@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant