Skip to content

add write tool formatters#1017

Open
LasmarKhalifa wants to merge 1 commit into
06-30/pi-tool-formatter-readfrom
06-30/pi-tool-formatter-write
Open

add write tool formatters#1017
LasmarKhalifa wants to merge 1 commit into
06-30/pi-tool-formatter-readfrom
06-30/pi-tool-formatter-write

Conversation

@LasmarKhalifa

@LasmarKhalifa LasmarKhalifa commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Closes #1025

LasmarKhalifa commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@LasmarKhalifa LasmarKhalifa force-pushed the 06-30/pi-tool-formatter-write branch from f2399f0 to 4166e5d Compare July 3, 2026 15:30
@LasmarKhalifa LasmarKhalifa force-pushed the 06-30/pi-tool-formatter-read branch from 1522547 to 2162423 Compare July 3, 2026 15:30
@LasmarKhalifa LasmarKhalifa marked this pull request as ready for review July 3, 2026 16:30

@mathiusj mathiusj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write formatter — one inconsistency with the sibling formatters.

lines = content.to_s.lines
preview = truncate(lines.first.to_s.strip)
count = lines.length
"WRITE #{path} \"#{preview}\" (+#{count} #{"line".pluralize(count)})"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format_write has no bare-name fallback and interpolates path untruncated — unlike every sibling. format_bash/format_ls/format_read degrade to "BASH"/"LS"/"READ" when the key is absent and run path through truncate. This line renders unconditionally, so no-args produces WRITE "" (+0 lines) (double space, empty quotes), and a long path blows the one-line goal since it isn't truncated. Suggest guarding the bare case and wrapping path in truncate to match the others.

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.

2 participants