Skip to content

[Bug]: Formatters defined in opencode don't work #2117

@ezhlobo

Description

@ezhlobo

Prerequisites

  • I will write this issue in English (see our Language Policy)
  • I have searched existing issues to avoid duplicates
  • I am using the latest version of oh-my-opencode
  • I have read the documentation or asked an AI coding agent with this project's GitHub URL loaded and couldn't find the answer

Bug Description

Since the edit tool is overwritten here, nothing triggers the formatters defined in OpenCode.

Steps to Reproduce

  1. Have a repository with Prettier set up (OpenCode's default formatter should be enabled and adjusted according to your environment) and a single file with Prettier issues
  2. Prompt any agent to modify that file in places unrelated to the Prettier issues

Expected Behavior

All Prettier issues in the touched file should be gone.

Actual Behavior

Prettier has not been run on the touched file.

Doctor Output

oMoMoMoMo Doctor

 ⚠ 2 issues found:

1. Comment checker unavailable
   Comment checker binary is not installed.
   Fix: Install @code-yeongyu/comment-checker
   Affects: comment-checker hook

2. GitHub CLI missing
   gh CLI is not installed.
   Fix: Install from https://cli.github.com/
   Affects: GitHub automation

Error Logs

Configuration

Additional Context

OpenCode's default edit tool emits a file.edited event:
https://github.com/anomalyco/opencode/blob/1172fa418e9aa5e0fcfccea326c6c9d35e1d57fd/packages/opencode/src/tool/edit.ts#L65-L67

OpenCode's formatter then listens to that event and applies the necessary formatters:
https://github.com/anomalyco/opencode/blob/1172fa418e9aa5e0fcfccea326c6c9d35e1d57fd/packages/opencode/src/format/index.ts#L106

With OMO, the edit tool is modified, so nothing emits the event and therefore nothing triggers the formatters to run.

Operating System

macOS

OpenCode Version

1.2.14

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions