ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 lamberttraccard

jinglebox

一個 Claude Code 外掛,工作階段發生事件時,會從 Jinglebox 工作區播放聲音。

lamberttraccard@lamberttraccard

lamberttraccard/jinglebox-marketplace/tree/main/plugins/jinglebox

已翻譯

關於這個 mod

Claude Code 的 Jinglebox

一個 Claude Code 外掛,工作階段發生事件時,會從 Jinglebox 工作區播放聲音。

| 事件 | 播放時機 | |---|---| | turn-done | Claude 已完成,答案正等著你查看 | | needs-answer | Claude 正在等你:問題、待核准的計畫、權限提示,或以問題結尾的答案 | | long-turn | 超過 60 s 的工作回合完成時(取代 turn-done) | | tests-passed / tests-failed | Claude 執行的測試指令成功或失敗(artisan test、pest、phpunit、pytest、jest、vitest、go test、cargo test、npm test……) | | pr-created | glab mr create 或 gh pr create 成功 |

安裝後每個事件都會播放工作區中的隨機短音效;使用 /jinglebox set 設定自己的音效。

此外掛不附帶音訊。每台機器都透過自己的 Jinglebox MCP 連線、使用自己的帳號下載音效,並在本機快取(最多 40 個音效)。

安裝

  1. 連線 Jinglebox MCP 伺服器(每台機器一次):

    claude mcp add --transport http --scope user jinglebox https://jinglebox.app/mcp
    

    接著在互動式 claude 終端機執行 /mcp,選取 jinglebox 並完成驗證。

  2. 允許唯讀工具,這樣外掛呼叫在自動模式下就不會被拒絕。在 ~/.claude/settings.json 中:

    "permissions": {
      "allow": [
        "mcp__jinglebox__get-sound",
        "mcp__jinglebox__search-sounds",
        "mcp__jinglebox__get-workspace",
        "mcp__jinglebox__list-workspaces"
      ]
    }
    
  3. 安裝外掛:

    claude plugin marketplace add lamberttraccard/jinglebox-marketplace
    claude plugin install jinglebox@jinglebox
    

    或不安裝直接試用:claude --plugin-dir ./plugins/jinglebox。

  4. 開始新的工作階段。如果帳號有多個工作區,使用 /jinglebox workspace <slug> 選取一個。

指令

/jinglebox                                       current sounds
/jinglebox workspace [slug]                      list or pick the workspace
/jinglebox set <event> 329 | #329 | <sound URL>  a fixed sound
/jinglebox set <event> 21,349,336                random among these
/jinglebox set <event> random [tag]              random short sound of the workspace, or of one tag
/jinglebox set <event> default                   back to the default (random from the workspace)
/jinglebox search <words>                        find sounds and their IDs
/jinglebox test <event>                          play an event's sound now
/jinglebox mute | unmute
/jinglebox export                                your setup as one /jinglebox import line
/jinglebox import <workspace> <event>=<choice>…  apply a shared setup
/jinglebox debug                                 check the MCP call, the playback and the cache

選項會依機器、依工作區保存,並跨工作階段保留。隨機選取不會連續兩次播放同一個音效,而且會預先下載下一個音效,讓它立即開始播放。提示訊息會顯示每個已播放音效的名稱;喜歡某個隨機音效時,可以用 /jinglebox set 將它固定下來。

分享設定

/jinglebox export 會把設定印成單行,例如:

/jinglebox import my-team turn-done=random:fun needs-answer=177 long-turn=339 tests-passed=325 tests-failed=329 pr-created=344

把它貼到團隊交流的地方;執行它的人會得到相同的工作區和音效,之後可以用 /jinglebox set 修改任一項。選項可以是音效 ID(177)、供選取的清單(21,349,336)、random 或 random:<tag>。不會託管任何內容:這一行就是設定。

在擁有多個工作區的帳號上選取(或匯入)工作區之前,不會播放音效;外掛會在提示訊息中說明這件事,每 10 分鐘最多一次,和其他錯誤相同。

設定

| 設定 | 預設值 | 意義 | |---|---|---| | workspace | empty | 工作區 slug;留空即可使用 /jinglebox workspace 選取 | | mcp_server | jinglebox | Jinglebox MCP 伺服器名稱,和 /mcp 列出的名稱相同 | | long_turn_seconds | 60 | 超過這個時間的工作回合會播放 long-turn | | random_max_seconds | 4 | 隨機選取只會使用不超過這個時間的音效 |

運作方式

這是 Claude Code 的函式勾點外掛(plugins/jinglebox/hooks/register.ts),屬於早期存取 API,需要支援它的 Claude Code 建置版本。

  • turn.complete:主要迴圈工作回合結束時,答案最後一段提出問題就會是 needs-answer,否則是 long-turn 或 turn-done。
  • classic.PermissionRequest,以及 AskUserQuestion 和 ExitPlanMode 上的 tool.call:觸發 needs-answer,每 3 s 最多一次。
  • Bash 上的 tool.call:觸發 tests-passed、tests-failed、pr-created。
  • 外掛在資訊清單中宣告 Jinglebox MCP 伺服器,並在第一次呼叫前透過 $.mcp.connect 連線,所以即使工作階段尚未載入伺服器工具也能運作;如果工作階段已經執行同一台伺服器(步驟 1),就會重用該連線。
  • 音效來自 MCP 的 get-sound,會快取在外掛儲存區,再以 $.audio.play 播放。隨機選取來自 search-sounds,每天重新整理一次。

疑難排解

/jinglebox debug 會執行每個步驟,並指出失敗的步驟。

  • 「MCP server is not connected」:外掛無法連線 Jinglebox MCP 伺服器(網路問題,或伺服器啟動時逾時)。執行 /mcp,重新連線 jinglebox,再試一次。
  • 「call refused」:缺少步驟 2 的權限。

授權條款

MIT,請參閱 LICENSE。

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

claude plugin marketplace add lamberttraccard/jinglebox-marketplace
claude plugin install jinglebox
原文 / README

Jinglebox for Claude Code

A Claude Code plugin that plays sounds from your Jinglebox workspace when something happens in a session.

| Event | When it plays | |---|---| | turn-done | Claude finished and its answer waits for you | | needs-answer | Claude waits on you: a question, a plan to approve, a permission prompt, or an answer that ends on a question | | long-turn | a turn longer than 60 s finished (instead of turn-done) | | tests-passed / tests-failed | a test command run by Claude passed or failed (artisan test, pest, phpunit, pytest, jest, vitest, go test, cargo test, npm test…) | | pr-created | glab mr create or gh pr create succeeded |

Out of the box every event plays a random short sound of your workspace; set your own with /jinglebox set.

The plugin ships no audio. Each machine downloads its sounds through its own Jinglebox MCP connection, with its own account, and caches them locally (40 sounds at most).

Install

  1. Connect the Jinglebox MCP server (once per machine):

    claude mcp add --transport http --scope user jinglebox https://jinglebox.app/mcp
    

    then run /mcp in an interactive claude terminal, pick jinglebox and authenticate.

  2. Allow its read-only tools, so the plugin's calls are not refused in auto mode. In ~/.claude/settings.json:

    "permissions": {
      "allow": [
        "mcp__jinglebox__get-sound",
        "mcp__jinglebox__search-sounds",
        "mcp__jinglebox__get-workspace",
        "mcp__jinglebox__list-workspaces"
      ]
    }
    
  3. Install the plugin:

    claude plugin marketplace add lamberttraccard/jinglebox-marketplace
    claude plugin install jinglebox@jinglebox
    

    Or try it without installing: claude --plugin-dir ./plugins/jinglebox.

  4. Start a new session. If your account has several workspaces, pick one with /jinglebox workspace <slug>.

Commands

/jinglebox                                       current sounds
/jinglebox workspace [slug]                      list or pick the workspace
/jinglebox set <event> 329 | #329 | <sound URL>  a fixed sound
/jinglebox set <event> 21,349,336                random among these
/jinglebox set <event> random [tag]              random short sound of the workspace, or of one tag
/jinglebox set <event> default                   back to the default (random from the workspace)
/jinglebox search <words>                        find sounds and their IDs
/jinglebox test <event>                          play an event's sound now
/jinglebox mute | unmute
/jinglebox export                                your setup as one /jinglebox import line
/jinglebox import <workspace> <event>=<choice>…  apply a shared setup
/jinglebox debug                                 check the MCP call, the playback and the cache

Choices are kept per machine and per workspace, across sessions. A random pick never plays the same sound twice in a row, and the next sound is downloaded ahead so it starts at once. The toast names each sound played, so a random one you like can be pinned with /jinglebox set.

Share a setup

/jinglebox export prints your setup as a single line, for instance:

/jinglebox import my-team turn-done=random:fun needs-answer=177 long-turn=339 tests-passed=325 tests-failed=329 pr-created=344

Paste it wherever your team talks; whoever runs it gets the same workspace and sounds, then can change any of them with /jinglebox set. A choice is a sound ID (177), a list to pick from (21,349,336), random, or random:<tag>. Nothing is hosted: the line is the setup.

Until a workspace is picked (or imported) on an account with several, no sound plays; the plugin says so in a toast, at most once every 10 minutes, like any other failure.

Settings

| Setting | Default | Meaning | |---|---|---| | workspace | empty | the workspace slug; empty to pick it with /jinglebox workspace | | mcp_server | jinglebox | the Jinglebox MCP server's name, as /mcp lists it | | long_turn_seconds | 60 | a turn longer than this plays long-turn | | random_max_seconds | 4 | a random pick only takes sounds this short |

How it works

It is a plugin of Claude Code function hooks (plugins/jinglebox/hooks/register.ts), an early-access API: it needs a Claude Code build that supports it.

  • turn.complete, at the end of a main-loop turn: needs-answer when the answer's last paragraph asks a question, else long-turn or turn-done.
  • classic.PermissionRequest, and tool.call on AskUserQuestion and ExitPlanMode: needs-answer, at most once every 3 s.
  • tool.call on Bash: tests-passed, tests-failed, pr-created.
  • The plugin declares the Jinglebox MCP server in its manifest and connects it with $.mcp.connect before its first call, so it works even when the session has not loaded the server's tools yet; when the session already runs the same server (step 1), that connection is reused.
  • Sounds come from the MCP's get-sound, are cached in the plugin's store and played with $.audio.play. Random picks draw from search-sounds, refreshed once a day.

Troubleshooting

/jinglebox debug runs each step and says which one fails.

  • "MCP server is not connected": the plugin could not connect the Jinglebox MCP server (network, or the server timed out at startup). Run /mcp, reconnect jinglebox, and try again.
  • "call refused": the permissions of step 2 are missing.

License

MIT, see LICENSE.

更多類似作品