tools-manager 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,375 @@
1
+ # Tools Manager
2
+
3
+ [English](README.md)
4
+
5
+ Tools Manager (`tm`) 是一个基于 Bun 的 CLI,用来统一管理 Codex、Claude Code 和 Cursor 等 AI Agent 的 skills 与 MCP server 配置。
6
+
7
+ 它提供一个本地统一管理入口:
8
+
9
+ - Skills 存放在 `~/.tools-manager/skills`
10
+ - Skill presets 用来按 Agent 或工作流给 skills 分组
11
+ - MCP servers 存储在 Tools Manager 数据库中,并可同步到各 Agent 的配置文件
12
+
13
+ 不想记子命令时,直接运行无参数的 `tm`,打开交互式命令菜单:
14
+
15
+ ![Tools Manager interactive menu](docs/images/menu.svg)
16
+
17
+ 下面这张图展示 skills 和 MCP servers 如何在本地 Agent 与 Tools Manager 存储之间流转:
18
+
19
+ ![Tools Manager workflow](docs/images/workflow.svg)
20
+
21
+ ## 环境要求
22
+
23
+ - Bun `>= 1.3.0`
24
+ - Git,用于从 Git URL 导入 skills,以及执行 `tm backup`
25
+
26
+ ## 安装
27
+
28
+ 全局安装:
29
+
30
+ ```bash
31
+ npm install -g tools-manager
32
+ ```
33
+
34
+ 验证 CLI:
35
+
36
+ ```bash
37
+ tm status
38
+ ```
39
+
40
+ 如果是源码检出方式使用,见 [开发](#开发)。
41
+
42
+ ## 快速开始
43
+
44
+ 先把所有本地 Agent 里已有的 skills 导入 Tools Manager,再把默认 preset 应用回所有支持的 Agent:
45
+
46
+ ```bash
47
+ tm init
48
+ tm skills add --tool all
49
+ tm skills list
50
+ tm presets apply
51
+ ```
52
+
53
+ 如果还没有 link 或安装这个包,可以使用:
54
+
55
+ ```bash
56
+ bun run tm init
57
+ bun run tm skills add --tool all
58
+ bun run tm skills list
59
+ bun run tm presets apply
60
+ ```
61
+
62
+ 默认情况下,Tools Manager 会把状态写入:
63
+
64
+ ```text
65
+ ~/.tools-manager
66
+ ```
67
+
68
+ 设置 `TOOLS_MANAGER_HOME` 可以使用自定义管理目录。
69
+
70
+ 运行无参数 `tm` 可以打开交互式命令菜单:
71
+
72
+ ```bash
73
+ tm
74
+ ```
75
+
76
+ 菜单支持用方向键选择常用的 skill、skill preset、MCP、agent 和 backup 命令。菜单包含手动添加 skill source、手动添加 MCP server、从已有 Agent 导入的流程。涉及 tool 参数时会进入选项选择器,默认选择 `all`。命令执行后,按 `Enter` 或 `Esc` 返回菜单。
77
+
78
+ ## Skills
79
+
80
+ 添加本地 skill 目录:
81
+
82
+ ```bash
83
+ tm skills add ./my-skill
84
+ ```
85
+
86
+ 从某一个本地 Agent 导入已有 skills:
87
+
88
+ ```bash
89
+ tm skills add --tool codex
90
+ tm skills add --tool cursor
91
+ tm skills add --tool claude_code
92
+ ```
93
+
94
+ 从所有支持的本地 Agent 导入已有 skills:
95
+
96
+ ```bash
97
+ tm skills add --tool all
98
+ ```
99
+
100
+ 从 Agent 导入时,Tools Manager 会把 skills 复制到 `~/.tools-manager/skills`,然后用指向托管副本的 symlink 替换原本的本地 Agent skill 目录。
101
+
102
+ 从 Git 导入 skill:
103
+
104
+ ```bash
105
+ tm skills add 'git@gitlab.company.com:group/repo.git#main:path/to/skill'
106
+ ```
107
+
108
+ 如果 source 中包含多个 skill 目录,会导入所有发现的 skills。已有同名 skill 会被更新。
109
+
110
+ 仓库目录结构要求见 [Remote Skill Repositories](docs/remote-skill-repositories.md)。
111
+
112
+ 列出托管的 skills:
113
+
114
+ ```bash
115
+ tm skills list
116
+ ```
117
+
118
+ 列出当前本地 Agent 可见的 skills:
119
+
120
+ ```bash
121
+ tm skills list --tool codex
122
+ tm skills list --tool all
123
+ ```
124
+
125
+ 查看某个托管 skill:
126
+
127
+ ```bash
128
+ tm skills show my-skill
129
+ ```
130
+
131
+ 移除某个托管 skill:
132
+
133
+ ```bash
134
+ tm skills remove my-skill
135
+ ```
136
+
137
+ 如果 Agent 的 skill 目录中存在指向托管 skill source 的 symlink,Tools Manager 会展示这些 symlink,并在删除托管 source 和 Agent symlink 前要求确认。非交互场景可使用 `--yes`:
138
+
139
+ ```bash
140
+ tm skills remove my-skill --yes
141
+ ```
142
+
143
+ 同步 skills 到 Agent skill 目录:
144
+
145
+ ```bash
146
+ tm skills sync
147
+ tm skills sync Work --tool cursor
148
+ tm skills sync --mode copy
149
+ tm skills sync Work --tool codex --mode symlink
150
+ ```
151
+
152
+ `tm skills sync` 与 `tm presets apply` 使用相同的 preset 行为:默认 preset 是 `Default`,默认 tool 是 `all`。使用 `--mode symlink` 或 `--mode copy` 可以覆盖本次同步的配置模式。
153
+
154
+ ## Skill Presets
155
+
156
+ Skill presets 是命名的 skill 分组。导入的 skills 会自动加入 `Default` preset。
157
+
158
+ 列出 skill presets:
159
+
160
+ ```bash
161
+ tm presets list
162
+ ```
163
+
164
+ 把单个 skill 从一个 preset 移动到另一个 preset:
165
+
166
+ ```bash
167
+ tm presets move-skill my-skill Default Work
168
+ ```
169
+
170
+ 把一个 preset 里的所有 skills 移动到另一个 preset:
171
+
172
+ ```bash
173
+ tm presets move Default Work
174
+ ```
175
+
176
+ 把 preset 应用到 Agent skill 目录:
177
+
178
+ ```bash
179
+ tm presets apply
180
+ tm presets apply Work --tool cursor
181
+ tm presets apply --mode copy
182
+ ```
183
+
184
+ 默认行为:
185
+
186
+ - `tm presets apply` 使用 preset `Default`
187
+ - `tm presets apply` 使用 `--tool all`
188
+ - `tm presets apply` 默认使用配置里的 `sync_mode`,传入 `--mode symlink|copy` 时覆盖本次执行
189
+
190
+ ## MCP Servers
191
+
192
+ 添加 MCP server 到 Tools Manager:
193
+
194
+ ```bash
195
+ tm mcp add playwright --command npx --arg @playwright/mcp@latest --tool codex
196
+ ```
197
+
198
+ 从 Agent 配置文件导入已有 MCP servers:
199
+
200
+ ```bash
201
+ tm mcp add --tool codex
202
+ tm mcp add --tool all
203
+ ```
204
+
205
+ 列出托管的 MCP servers:
206
+
207
+ ```bash
208
+ tm mcp list
209
+ ```
210
+
211
+ 列出当前本地 Agent 配置中的 MCP servers:
212
+
213
+ ```bash
214
+ tm mcp list --tool codex
215
+ tm mcp list --tool all
216
+ ```
217
+
218
+ 查看某个托管 MCP server:
219
+
220
+ ```bash
221
+ tm mcp show playwright
222
+ ```
223
+
224
+ 移除某个托管 MCP server:
225
+
226
+ ```bash
227
+ tm mcp remove playwright
228
+ ```
229
+
230
+ 把托管 MCP servers 同步回 Agent 配置文件:
231
+
232
+ ```bash
233
+ tm mcp sync
234
+ tm mcp sync --tool codex
235
+ ```
236
+
237
+ 默认行为:
238
+
239
+ - `tm mcp sync` 使用 `--tool all`
240
+ - 同步写入配置文件前会创建带时间戳的备份
241
+
242
+ 支持的配置目标:
243
+
244
+ ```text
245
+ codex -> ~/.codex/config.toml
246
+ claude_code -> ~/.claude/mcp.json
247
+ cursor -> ~/.cursor/mcp.json
248
+ ```
249
+
250
+ ## Backup
251
+
252
+ 用 Git 备份托管 skills:
253
+
254
+ ```bash
255
+ tm backup
256
+ ```
257
+
258
+ 如果需要,`tm backup` 会在 `~/.tools-manager/skills` 中初始化 Git 仓库,提交 skill 变更;当 `~/.tools-manager/config.toml` 中配置了 `git_remote` 时,还会执行 push。
259
+
260
+ ## 命令参考
261
+
262
+ ```bash
263
+ tm init
264
+ tm status [--json]
265
+ tm agents list [--tool <tool|all>] [--json]
266
+ tm skills add <source>
267
+ tm skills add --tool <tool|all>
268
+ tm skills list [--json]
269
+ tm skills list --tool <tool|all> [--json]
270
+ tm skills show <name> [--json]
271
+ tm skills remove <name> [--yes]
272
+ tm skills sync [preset] [--tool <tool|all>] [--mode <symlink|copy>]
273
+ tm presets list [--json]
274
+ tm presets apply [preset] [--tool <tool|all>] [--mode <symlink|copy>]
275
+ tm presets move-skill <skill> <from> <to>
276
+ tm presets move <from> <to>
277
+ tm mcp add <name> --command <cmd> [--arg value] [--env K=V] [--tool <tool|all>]
278
+ tm mcp add --tool <tool|all>
279
+ tm mcp list [--json]
280
+ tm mcp list --tool <tool|all> [--json]
281
+ tm mcp show <name> [--json]
282
+ tm mcp remove <name>
283
+ tm mcp sync [--tool <tool|all>]
284
+ tm backup
285
+ ```
286
+
287
+ 支持的 tools:
288
+
289
+ ```text
290
+ codex
291
+ claude_code
292
+ cursor
293
+ all
294
+ ```
295
+
296
+ ## 开发
297
+
298
+ 安装依赖并运行检查:
299
+
300
+ ```bash
301
+ bun install
302
+ bun run check
303
+ ```
304
+
305
+ 本仓库通过 `.npmrc` 和 `bunfig.toml` 将 npm 与 Bun 安装固定到 npmmirror registry。
306
+
307
+ 通过 package script 运行 CLI:
308
+
309
+ ```bash
310
+ bun run tm status
311
+ bun run tm skills list
312
+ ```
313
+
314
+ 构建发布用的 CLI bundle:
315
+
316
+ ```bash
317
+ bun run build
318
+ ls -la dist
319
+ ```
320
+
321
+ 按用户实际使用方式测试 `tm` 二进制:
322
+
323
+ ```bash
324
+ npm link
325
+ tm status
326
+ tm skills list
327
+ npm unlink -g tools-manager
328
+ ```
329
+
330
+ ## 发布
331
+
332
+ 发布前:
333
+
334
+ ```bash
335
+ bun run release:dry
336
+ ```
337
+
338
+ 检查 dry-run 输出。它应该只包含:
339
+
340
+ - `package.json`
341
+ - `README.md`
342
+ - `README.zh-CN.md`
343
+ - `dist/**`
344
+ - `docs/**`
345
+
346
+ 发布:
347
+
348
+ ```bash
349
+ bun run release
350
+ ```
351
+
352
+ 发布并自动升级版本:
353
+
354
+ ```bash
355
+ bun run release:patch
356
+ bun run release:minor
357
+ bun run release:major
358
+ ```
359
+
360
+ 发布后,在干净 shell 中测试安装:
361
+
362
+ ```bash
363
+ npm install -g tools-manager
364
+ tm --help
365
+ tm status
366
+ ```
367
+
368
+ ## 备注
369
+
370
+ - `tm skills add` 支持本地文件夹、GitHub URL、内部 GitLab URL、SSH Git URL,以及 `#ref:path/to/skill`。
371
+ - Git 认证交给本地 Git 配置处理:SSH keys、VPN、credential helpers 和 tokens。启用 2FA 的私有 HTTPS 仓库需要 personal access token,或改用 SSH Git URL。
372
+ - `tm skills add --codex` 和 `tm skills add --all` 会作为兼容别名保留。
373
+ - `tm skills remove` 会删除托管 skill 文件、移除 preset membership,并在确认后移除指向托管 source 的 Agent symlinks。
374
+ - `tm mcp remove` 只会从 Tools Manager 删除 server;运行 `tm mcp sync` 后才会更新 Agent 配置文件。
375
+ - `--json` 可用于 list/status 类命令,方便脚本调用。
package/SKILL.md ADDED
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: tools-manager
3
+ description: Manage AI agent skills, skill presets, and MCP server configuration using the tm CLI from the tools-manager package. Use when users ask how to initialize tm, import local agent skills, add skills from local/Git sources, list/show/remove/sync skills, move skills between presets, choose symlink versus copy sync mode, import/list/add/remove/sync MCP servers, inspect agent-side contents, back up managed skills, build/publish the package, or troubleshoot tm command behavior.
4
+ ---
5
+
6
+ # Tools Manager
7
+
8
+ Use this skill when working with the `tm` CLI or the `tools-manager` repository.
9
+
10
+ ## Command Model
11
+
12
+ - `tm` stores managed skills, presets, MCP server records, and config under `~/.tools-manager` unless `TOOLS_MANAGER_HOME` is set.
13
+ - Managed skills live in `~/.tools-manager/skills`.
14
+ - Agent-side skill directories are:
15
+ - Codex: `~/.codex/skills`
16
+ - Claude Code: `~/.claude/skills`
17
+ - Cursor: `~/.cursor/skills`
18
+ - `Default` is created automatically and imported skills are added to it.
19
+ - `sync_mode` defaults to `symlink`; command flags can override it per run.
20
+
21
+ ## Common Workflows
22
+
23
+ Initialize and inspect:
24
+
25
+ ```bash
26
+ tm init
27
+ tm status
28
+ tm agents list --tool all
29
+ ```
30
+
31
+ Import skills into tm:
32
+
33
+ ```bash
34
+ tm skills add ./path/to/skill
35
+ tm skills add 'git@example.com:group/repo.git#main:path/to/skill'
36
+ tm skills add --tool codex
37
+ tm skills add --tool all
38
+ ```
39
+
40
+ Manage skills:
41
+
42
+ ```bash
43
+ tm skills list
44
+ tm skills show <skill>
45
+ tm skills remove <skill>
46
+ ```
47
+
48
+ Apply presets to agents:
49
+
50
+ ```bash
51
+ tm skills sync
52
+ tm skills sync Work --tool cursor --mode copy
53
+ tm presets apply Default --tool all --mode symlink
54
+ ```
55
+
56
+ Move preset membership:
57
+
58
+ ```bash
59
+ tm presets move-skill <skill> Default Work
60
+ tm presets move Default Work
61
+ ```
62
+
63
+ Use `move-skill` for one skill. Use `move` only when moving all skills from one preset to another.
64
+
65
+ Manage MCP records:
66
+
67
+ ```bash
68
+ tm mcp add playwright --command npx --arg @playwright/mcp@latest --tool codex
69
+ tm mcp add --tool all
70
+ tm mcp list
71
+ tm mcp list --tool codex
72
+ tm mcp remove playwright
73
+ tm mcp sync --tool all
74
+ ```
75
+
76
+ ## Sync Modes
77
+
78
+ Use `--mode symlink` to create agent-side symlinks to managed skills.
79
+
80
+ Use `--mode copy` to copy managed skill files into agent directories.
81
+
82
+ Examples:
83
+
84
+ ```bash
85
+ tm skills sync --mode symlink
86
+ tm skills sync --mode copy
87
+ tm presets apply Work --tool codex --mode copy
88
+ ```
89
+
90
+ If `TOOLS_MANAGER_HOME` points inside the system temporary directory, do not symlink into real agent directories. Use a non-temporary manager home or `--mode copy`.
91
+
92
+ ## Build And Publish
93
+
94
+ Build the distributable CLI:
95
+
96
+ ```bash
97
+ bun run build
98
+ ls -la dist
99
+ ```
100
+
101
+ Preview package contents:
102
+
103
+ ```bash
104
+ bun run release:dry
105
+ ```
106
+
107
+ Publish:
108
+
109
+ ```bash
110
+ bun run release
111
+ bun run release:patch
112
+ bun run release:minor
113
+ bun run release:major
114
+ ```
115
+
116
+ Use `release:patch`, `release:minor`, or `release:major` when the npm version must be bumped before publishing.