ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 andrewli315

mod-manager

Claude Code 的按会话 mod 管理器。提示符上方的工具栏可让你在当前会话中打开或关闭任意本地安装的 mod。

已翻译

关于这个 mod

mod-manager 会在 Claude Code 提示符上方添加 MODS 工具栏,让你按会话打开或关闭本地安装的 mod。它列出已知 mod 及其开关状态和版本,提供 Enable all / Disable all,并在 Manage 窗格(/mods)中提供逐个 mod 的 Enable/Disable 和 Save-as-default 控制。选择按 session id 存储,通过 ↻ Apply 按钮(快捷键 a)应用待处理更改。新出现、此前未见过的 mod 在你作出决定(Enable 或 Keep off)之前会被拒绝。它会扫描 ~/.claude/dev-mods、~/.claude/plugins/synced、~/.claude/plugins/marketplaces、~/.claude/skills、CLAUDE_CODE_PLUGIN_DIRS 中的文件夹以及同级文件夹;只有包含 .claude-plugin/plugin.json 和带有 modules 列表的 hooks/hooks.json 的文件夹才算 mod。plugin.register hook 会在每个 mod 加入会话前评估它,并拒绝已禁用的 mod,因此它们的 hooks、命令和工具都不会加载。安装方式是将文件夹放入 mod 目录,或使用 claude --plugin-dir;也可以通过 CLAUDE_CODE_PLUGIN_DIR_WATCH=1 将其加入 CLAUDE_CODE_PLUGIN_DIRS 以启用热重载。限制包括:只能关闭用户级 mod;无法拒绝在它之前加载的 mod;未加载的 marketplace 插件不会列出;移动设备上没有工具栏(但 /mods 仍可用)。

安装

请先查看作者 README 确认 marketplace 和插件名称;命令可能随仓库结构改变。

claude plugin marketplace add andrewli315/mod-manager
claude plugin install mod-manager
原文 / README

mod-manager

A per-session mod manager for Claude Code. A toolbar above the prompt lets you switch any locally installed mod on or off for the current session.

╭────────────────────────────────────────────────────────╮
│ ⬢ MODS  [ Mods ▾  3/5 on ]  ● pending  [ ↻ Apply ]  ⚙ Manage │
╰────────────────────────────────────────────────────────╯

Features

  • Dropdown toolbar above the prompt listing every mod it knows about, marked ● (on) or ○ (off), with versions. Pick a mod to toggle it; Enable all and Disable all are included.
  • Manage pane (/mods or the ⚙ Manage button): one card per mod with Enable/Disable buttons and a ★ Save as default button.
  • Per-session choices: selections are stored per session id. New sessions start from your saved default (everything on unless you saved otherwise).
  • Apply button: a change shows a yellow ● pending marker until you press ↻ Apply (hotkey a).
  • mod-manager itself is locked on so you can always turn mods back on.

Hotkeys (when the bar has focus): a Apply, m Manage.

Install

Requires a Claude Code build with function-hook mods (plugin authoring support).

  1. Put this folder inside your mods folder, for example ~/.claude/dev-mods/<id>/mod-manager/, and accept the "Enable hot reloading for this session?" prompt.

  2. Or load it directly for one session:

    claude --plugin-dir /path/to/mod-manager
    

Make it available in every session

Add the folder to CLAUDE_CODE_PLUGIN_DIRS in the env block of ~/.claude/settings.json (separate several folders with ; on Windows, : elsewhere). CLAUDE_CODE_PLUGIN_DIR_WATCH=1 makes long-lived sessions (the desktop app, the SDK) hot-reload it too:

{
  "env": {
    "CLAUDE_CODE_PLUGIN_DIRS": "/absolute/path/to/mod-manager",
    "CLAUDE_CODE_PLUGIN_DIR_WATCH": "1"
  }
}

New mods ask first

The first time mod-manager runs it treats every mod already present as known. After that, a mod it has never seen is refused until you decide: the MODS bar shows a magenta ✦ NEW MOD row with Enable and Keep off. Enable loads it right away; Keep off records the choice for this session. Your choices are remembered, so each mod asks once.

Where it looks for mods

~/.claude/dev-mods, ~/.claude/plugins/synced, ~/.claude/plugins/marketplaces, ~/.claude/skills, every folder in CLAUDE_CODE_PLUGIN_DIRS, and the folder beside mod-manager. A folder counts as a mod when it has a .claude-plugin/plugin.json and a hooks/hooks.json with a modules list. Mods that have loaded in any session are also listed, whatever their location.

How it works

  • A plugin.register hook sees every mod before it joins the session. Mods you switched off are refused, so none of their hooks, commands or tools load. It records each mod it sees in the plugin store so the dropdown can list it.
  • Sibling folders next to mod-manager are scanned for .claude-plugin/plugin.json, so mods that never loaded still appear.
  • ↻ Apply writes hooks/.reload. With hot reloading on, that save reloads all mods, and the refusal list is applied. Without hot reloading, changes take effect the next time mods load.

Limitations

  • Only mods in the user tier can be switched off; managed and built-in plugins are never refused.
  • A mod that loads before mod-manager cannot be refused by it.
  • The dropdown lists mods the manager has seen load plus siblings on disk. It does not scan marketplace-installed plugins that have never loaded.
  • No toolbar on the mobile surface (it has no dropdown element); /mods still works.

Development

claude plugin validate .

Files:

| Path | Purpose | | --- | --- | | .claude-plugin/plugin.json | Manifest | | hooks/hooks.json | Points at the hooks module | | hooks/register.tsx | All hooks: register filter, toolbar, pane, /mods | | types/index.d.ts | $.state contract (mods, disabled, isDirty) |

Contributing

Issues and pull requests are welcome. Please run claude plugin validate . before submitting.

License

MIT

其他同名作品

更多类似作品