Skip to content

fix: improve command output mode failure message#27

Merged
Lauri "datafox" Heino (melodicore) merged 5 commits into
masterfrom
fix/command-output-mode-message
Jul 7, 2026
Merged

fix: improve command output mode failure message#27
Lauri "datafox" Heino (melodicore) merged 5 commits into
masterfrom
fix/command-output-mode-message

Conversation

@melodicore

Copy link
Copy Markdown
Member

Summary

  • Removes the bare custom command that was previously printed inline by printOutputModeResult; the fix command now appears only in the failure annotation at the bottom
  • printOutputModeResult now returns the fix command string (string | null) so the failure message can include the full generated command with file paths, not just elide <formatter>
  • Suppresses the "Run locally to fix" suffix from the failure message when output_mode is not command — other modes have no business telling you to run a local formatter command
  • Fixes pre-existing biome lint warnings (import sort order, template literals)

- Remove bare custom command print from printOutputModeResult; the fix
  command now only appears in the failure message at the bottom
- printOutputModeResult returns the fix command string so the failure
  message can use it (generated command with file paths, or custom command)
- Suppress "Run locally to fix" from the failure message when output_mode
  is not command
- Fix pre-existing biome lint warnings (import sort, template literals)

Signed-off-by: melodicore <lauri@elide.dev>
Signed-off-by: melodicore <lauri@elide.dev>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the formatting action’s “output_mode=command” UX by generating and propagating full fix commands (including file paths) into the final failure annotation, while avoiding “run locally” guidance for non-command output modes. It also includes small cleanup changes to satisfy existing lint rules (import ordering and template literals).

Changes:

  • Update printOutputModeResult to return a generated/custom fix command (string | null) so the failure annotation can include the full command.
  • Adjust failure message construction to include “Run locally to fix …” only for output_mode=command, deduping commands across failed formatters.
  • Apply lint-driven refactors (import sorting, template literal usage) and update tests to match the new messaging behavior.

Reviewed changes

Copilot reviewed 8 out of 11 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/telemetry.ts Reorders imports to satisfy lint rules.
src/main.ts Returns fix commands from output handling and incorporates them into the failure annotation; adjusts messaging by output mode.
src/command.ts Reorders imports to satisfy lint rules.
tests/telemetry.test.ts Import ordering lint fix.
tests/options.test.ts Import ordering lint fix; minor mock implementation tweak.
tests/main.test.ts Updates/extends tests for the new failure message behavior and custom command handling.
tests/index.test.ts Import ordering lint fix.
tests/command.test.ts Import ordering lint fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main.ts Outdated
Comment thread src/main.ts Outdated
- Move customCommand return before !stdout guard so command mode with
  a custom command returns correctly even when formatter stdout is empty
- Use typed formatters array to index fixCommands instead of
  Object.entries, avoiding string vs FormatterName type unsafety

Signed-off-by: melodicore <lauri@elide.dev>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 11 changed files in this pull request and generated 2 comments.

Comment thread src/main.ts
Comment thread __tests__/options.test.ts
- Remove unreachable customCommand branch inside command switch case
  (already handled by early return before the switch)
- Simplify include-kts test mock to remove redundant && true

Signed-off-by: melodicore <lauri@elide.dev>
Signed-off-by: melodicore <lauri@elide.dev>
@melodicore Lauri "datafox" Heino (melodicore) merged commit aae4b4e into master Jul 7, 2026
2 checks passed
@melodicore Lauri "datafox" Heino (melodicore) deleted the fix/command-output-mode-message branch July 7, 2026 16:17
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