跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    中文English
    Stephanvs
    opencode-sfx

    OpenCode plugin that plays Warcraft-style sound effects for session events

    GitHub 星标

    1

    月装机量

    33

    近 7 天 13

    综合评分SCORE

    22.5

    生态多维模型

    最近提交

    5 个月前

    2026-02-27

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-sfx@0.3.0"]
    }

    opencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    OpenCode plugin that plays your own sound effects for key agent moments.

    Installation

    Add it to your OpenCode config, OpenCode will download/manage it for you:

    {
      "plugin": ["opencode-sfx"]
    }
    

    Event Folders

    Default sound root:

    ~/.config/opencode/opencode-sfx/sounds

    On startup, the plugin checks whether this root and each event folder already exists before creating anything new. It never deletes existing files.

    If soundRoot is missing on first bootstrap, the plugin copies the entire bundled assets/ tree into soundRoot so event folders are prefilled out of the box. It also seeds bundled assets when all configured event folders are empty.

    Put one or more clips directly in each event folder (non-recursive):

    OpenCode event Folder name
    plugin load sessionStart/
    session.created sessionCreated/
    tui.command.execute (prompt.submit) promptSubmit/
    permission.updated (and permission.ask) permission/
    session.error notification/
    session.status (status.type === "idle") stop/

    Supported file types:

    • .ogg
    • .wav
    • .mp3

    When an event fires, one clip is chosen at random from that folder.

    Configuration

    Optional config file:

    ~/.config/opencode/opencode-sfx.json

    Minimal example:

    {
      "enabled": true
    }
    

    Full example:

    {
      "enabled": true,
      "soundRoot": "opencode-sfx/sounds",
      "playerCommand": "ffplay",
      "playerArgs": ["-loglevel", "quiet", "-nodisp", "-autoexit"],
      "events": {
        "sessionStart": true,
        "sessionCreated": true,
        "promptSubmit": true,
        "notification": true,
        "permission": true,
        "stop": true
      },
      "eventFolders": {
        "sessionStart": "sessionStart",
        "sessionCreated": "sessionCreated",
        "promptSubmit": "promptSubmit",
        "notification": "notification",
        "permission": "permission",
        "stop": "stop"
      }
    }
    

    Config notes:

    • If playerCommand is omitted, the plugin auto-detects a player:
      • macOS: afplay, then ffplay
      • Linux: paplay, then aplay, then ffplay
      • Windows: ffplay
    • playerCommand should be an executable name/path, and playerArgs should list each argument separately.
    • Relative soundRoot paths are resolved from ~/.config/opencode/.
    • Relative eventFolders paths are resolved from soundRoot.
    • Event folder scanning is non-recursive.

    Asset Source

    Sample Warcraft clips in assets/ come from:

    See assets/README.md for exact file list.

    License

    Plugin code is MIT (LICENSE).

    Game audio remains property of its original rights holders.