feat: ktfmt argfile fix, output-mode option#22
Merged
Lauri "datafox" Heino (melodicore) merged 12 commits intoJul 7, 2026
Conversation
- fix ktfmt to write only files to argfile; flags and extra args now go in exec args like javaformat (elide ktfmt now supports mixed args) - add elideFlags parameter to buildFormatterArgs/runFormatter for flags that go before --; stdout is captured when elide flags are provided - add output-mode option (none/file/diff/command) with post-run output: file prints affected paths, diff prints patch diffs, command prints a fix command using the listed files or a custom string - add output-mode-diffs (integer limit for --list-diffs=N) and output-mode-command (custom command string for command mode) Signed-off-by: melodicore <datafox@datafox.me>
- Fix output-mode=diff misparse when elide falls back to file listing (write mode, or --list-diffs=N limit exceeded): detect actual diff output via ---/+++/@@ markers and fall back to file-listing display - Shell-quote file paths in command-mode suggestion - Add files-failed action output (newline-separated affected files, populated in both check and write modes); only emitted when output-mode is file - Update README: document new inputs, outputs, usage examples, remove stale skipped-directories sentence Signed-off-by: melodicore <datafox@datafox.me>
Signed-off-by: melodicore <datafox@datafox.me>
Copilot started reviewing on behalf of
Lauri "datafox" Heino (melodicore)
July 7, 2026 09:17
View session
There was a problem hiding this comment.
Pull request overview
This PR updates the action’s formatter invocation to fix ktfmt argfile handling and adds a new output-mode feature set that controls what the action prints (file list, diffs, or a suggested fix command), plus a new files-failed output.
Changes:
- Fix ktfmt argfile behavior by writing only file paths into the argfile and passing flags via the normal argument list.
- Add
output-mode/output-mode-diffs/output-mode-commandinputs, and implement stdout parsing/printing helpers for list-files and list-diffs. - Add
files-failedoutput and expand unit tests to cover new option parsing and output-mode behavior.
Reviewed changes
Copilot reviewed 8 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/options.ts | Adds output-mode options, defaults, and input parsing helpers. |
| src/main.ts | Implements output-mode flag selection, stdout parsing, printing, and files-failed output. |
| src/command.ts | Changes formatter invocation to unify argfile handling and optionally capture stdout for output-mode. |
| README.md | Documents new inputs/outputs and provides usage examples. |
| action.yml | Adds new inputs and files-failed output metadata. |
| tests/options.test.ts | Adds tests for output-mode normalization/defaults and new inputs. |
| tests/main.test.ts | Adds tests for output-mode helpers and run() behavior with captured stdout. |
| tests/command.test.ts | Updates tests for revised argfile behavior and added elide flags support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: melodicore <datafox@datafox.me>
Signed-off-by: melodicore <datafox@datafox.me>
Copilot started reviewing on behalf of
Lauri "datafox" Heino (melodicore)
July 7, 2026 09:45
View session
Signed-off-by: melodicore <datafox@datafox.me>
Copilot started reviewing on behalf of
Lauri "datafox" Heino (melodicore)
July 7, 2026 09:54
View session
Signed-off-by: melodicore <datafox@datafox.me>
Signed-off-by: melodicore <datafox@datafox.me>
Signed-off-by: melodicore <datafox@datafox.me>
Copilot started reviewing on behalf of
Lauri "datafox" Heino (melodicore)
July 7, 2026 11:30
View session
Signed-off-by: melodicore <datafox@datafox.me>
Signed-off-by: melodicore <datafox@datafox.me>
Signed-off-by: melodicore <datafox@datafox.me>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
output-modeinput (none|file|diff|command) to control what the action prints after formatting, using--list-files/--list-diffsflags added in elide v1.4.0output-mode-diffsinput to cap the number of files whose diffs are printed (falls back to file listing if exceeded)output-mode-commandinput to print a custom fix command instead of a generated elide invocationfiles-failedaction output (newline-separated file paths) populated whenoutput-mode: fileis set