-
Notifications
You must be signed in to change notification settings - Fork 70
add edit tool formatters #1018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 06-30/pi-tool-formatter-write
Are you sure you want to change the base?
add edit tool formatters #1018
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,6 +107,22 @@ def format_write | |
| ok_line(@input[:path]) | ||
| end | ||
|
|
||
| # Formats an edit tool result. | ||
| # | ||
| # Input: :path – the path that was edited, from the originating call. | ||
| # | ||
| # Output: "EDIT OK <path>" – the file path, omitted when the call | ||
| # had none. | ||
| # | ||
| # Examples: | ||
| # EDIT OK lib/roast/version.rb | ||
| # EDIT OK | ||
| # | ||
| #: () -> String | ||
| def format_edit | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Readability nit: the result formatter reads |
||
| ok_line(@input[:path]) | ||
| end | ||
|
|
||
| # Formats a result for which Roast has no dedicated formatter. | ||
| # | ||
| # Content: the tool's output text. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|| []only guardsnil— if:editsever arrives as a non-Array (e.g. a String or a single Hash),.lengtheither silently returns the wrong count (char count for a String) or raises. Given this is display-only, I wouldn't add validation here; the clean fix is a rescue→format_unknownat the dispatch site in #1012 (commented there). Just flagging so it's a conscious choice rather than an assumption. Also noteEDIT #{path}interpolates the path untruncated, so a long path blows past the one-line goal the comments state.