<div align="center">
  <a href="https://codeberg.org/bastiangx/opencode-unmoji">
      <img src="https://github.com/user-attachments/assets/01c5fa35-036d-4d7a-9feb-8becd744a5af"/>
  </a>
</div>

# UNMOJI

<a href="https://npmx.dev/package/@bastiangx/opencode-unmoji"><img src="https://img.shields.io/badge/npm-black?style=for-the-badge&logo=npm&logoSize=auto&labelColor=%23141010&color=%231F1A1A" alt="NPM Package"></a> <a href="https://npmjs.com/package/@bastiangx/opencode-unmoji"><img src="https://img.shields.io/npm/v/%40bastiangx%2Fopencode-unmoji?style=for-the-badge&label=version&labelColor=%23141010&color=%231F1A1A" alt="NPM Version"></a> <a href="https://npmjs.com/package/@bastiangx/opencode-unmoji"><img src="https://img.shields.io/npm/dm/%40bastiangx%2Fopencode-unmoji?style=for-the-badge&label=downloads&labelColor=%23141010&color=%231F1A1A" alt="NPM Downloads"></a> <a href="https://ko-fi.com/bastiangx"><img src="https://img.shields.io/badge/buy_me_a_coffee-black?style=for-the-badge&logo=kofi&logoSize=auto&labelColor=%23141010&color=%231F1A1A" alt="Ko-fi"></a> <a href="https://opencode.cafe/plugin/opencode-unmoji"><img src="https://img.shields.io/badge/opnecode_cafe-black?style=for-the-badge&logo=awesomelists&logoSize=auto&labelColor=%23141010&color=%231F1A1A" alt="OpenCode Cafe"></a> <a href="https://www.codeberg.org/bastiangx/opencode-unmoji"><img src="https://img.shields.io/badge/codeberg-black?style=for-the-badge&logo=codeberg&logoSize=auto&labelColor=%23141010&color=%231F1A1A" alt="codeberg"></a>

An [OpenCode](https://opencode.ai) plugin that strips _all kinds of_ emojis from your agent outputs.

<img height="700" src="https://github.com/user-attachments/assets/fe606d89-01b0-4da6-81b7-5014d6aff972"/>

## Installation

Add the following to your `opencode.json` file:

```json
{
  "plugin": ["@bastiangx/opencode-unmoji@latest"]
}
```

> You can find your OpenCode file in a couple of different locations:
>
> 1. Global: in **`~/.config/opencode/opencode.json`**. You’ll want to use the global config for things like themes, providers, or keybinds.
> 2. Per Project: You can also add a `opencode.json` in your project. Settings from this config are merged with and can override the global config.

> Visit [OpenCode docs](https://opencode.ai/docs/) for more info.

## What It Does

UNMOJI automatically removes _all_ _standard_ unicode emojis and glyphs from your agent outputs.

Especially useful when you are using models like Claude which seem to _LOVE_ spamming emojis on summaries, README files and various documentations.

### Output targets

1. _Regular_ agent text and summaries in the main UI thread (format agnostic).
2. Added content in `.md` and `.markdown` files when an agent calls the `edit` or `apply_patch` tool.
3. Whole-file content in `.md` and `.markdown` files when an agent calls the `write` tool.

> _Thinking_ tokens as output targets are not supported at this time.

## Configuration

Create `unmoji.json` in either or both supported locations:

- Global: `~/.config/opencode/unmoji.json`
- Per project: `<project>/.opencode/unmoji.json`

Project settings override global settings. Inline plugin options override both:

```json
{
  "plugin": [
    [
      "@bastiangx/opencode-unmoji@latest",
      {
        "preserveBlockquotes": true
      }
    ]
  ]
}
```

Every option is optional. The complete default configuration is:

```json
{
  "enabled": true,
  "processMarkdown": true,
  "markdownExtensions": [".md"],
  "preserveCodeBlocks": true,
  "preserveInlineCode": true,
  "preserveBlockquotes": false
}
```

#### Full options spec

| Option                |  Default  | Possible values                             | Description                                                |
| :-------------------- | :-------: | :------------------------------------------ | :--------------------------------------------------------- |
| `enabled`             |  `true`   | `true`, `false`                             | Enable or disable the plugin without uninstalling it       |
| `processMarkdown`     |  `true`   | `true`, `false`                             | Process Markdown content passed to supported writing tools |
| `markdownExtensions`  | `[".md"]` | Non-empty array of `.md` and/or `.markdown` | File extensions treated as Markdown by tool hooks          |
| `preserveCodeBlocks`  |  `true`   | `true`, `false`                             | Leave emojis inside fenced and indented code blocks intact |
| `preserveInlineCode`  |  `true`   | `true`, `false`                             | Leave emojis inside inline code intact                     |
| `preserveBlockquotes` |  `false`  | `true`, `false`                             | Leave emojis inside Markdown blockquotes intact            |

---

## Contributing

Contributions are welcome!

Follow the [Contributing guide](https://codeberg.org/bastiangx/opencode-unmoji/src/branch/main/CONTRIBUTING.md) for instructions.

---

---

License: MIT
