cli-blueprint 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.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # dsh-skillpack
2
+
3
+ **多 IDE 通用 skill 插件包** —— 一键安装 / 更新 / 卸载一组 skills,自动适配你本机已安装的每个 IDE,可无限扩展,可分发给任何人。
4
+
5
+ 默认包含:`blueprint`(CLI.Tax 工程规划 skill,`https://cli.tax/wvz6zmRWmX`)。
6
+
7
+ ## 这是什么机制?
8
+
9
+ clitaxio 的本质只是从 `https://cli.tax/api/public/skills/{code}` 下载两个文件
10
+ (`SKILL.md` + `skill.json`)并写入 IDE 的 skills 目录。本包把这个过程**固化成一个可版本化、
11
+ 可分发、可扩展的本地插件包**,并打通了 cli.tax 生态:
12
+
13
+ - **自动拉取**:`sources.json` 里配置 cli.tax skill 源(如 `wvz6zmRWmX`),
14
+ `node install.mjs pull` 或 install 时自动从 cli.tax 拉取最新内容到 `skills/`(可提交进 git)
15
+ - **自动匹配分发**:每个 skill 是一个目录:`skills/<name>/SKILL.md`;安装器自动检测本机
16
+ 真实安装的 IDE,把 skill 分发到各 IDE 自己的用户级根(如 Codex 扫 `~/.codex/skills`、
17
+ DSH 扫 `~/.dsh/skills`),各一份、互不干扰
18
+ - 共享兼容根 `~/.agents/skills` 默认跳过——它会被多个工具扫描,是"同一 skill 重复出现"的根源
19
+
20
+ **与 clitaxio 的区别**:clitaxio 只把 skill 装到**一个** IDE 目录;本包是"拉取 + 多 IDE 自动分发",
21
+ 装一次,本机所有已装 IDE 都能用。
22
+
23
+ ## 安装 / 更新 / 卸载
24
+
25
+ ```bash
26
+ # 本地运行(无需发布)
27
+ node install.mjs pull # 从 cli.tax(sources.json)拉取最新 skill 到 skills/,可 git 提交
28
+ node install.mjs install # 自动匹配:skills/ 为空时自动先 pull,再分发到本机已装 IDE
29
+ node install.mjs install --all # 装到所有已知 IDE(不管是否安装)
30
+ node install.mjs install --ide codex --ide dsh # 只装指定 IDE(可重复)
31
+ node install.mjs install --skip cursor # 自动匹配但跳过指定 IDE(可重复)
32
+ node install.mjs install --pull # 强制重新从 cli.tax 拉取后再安装
33
+ node install.mjs install --project # 额外装到当前项目的项目级根
34
+ node install.mjs install --agents # 额外装到共享 ~/.agents/skills(警告:可能被多工具重复发现)
35
+ node install.mjs install --target /abs/path # 只装到自定义目录
36
+ node install.mjs update # 幂等覆盖,等同 install
37
+ node install.mjs list # 列出包内 skills
38
+ node install.mjs ides # 查看已知 IDE 及本机检测结果(✓ = 本机已装)
39
+ node install.mjs uninstall # 从相同目标卸载本包安装的 skills
40
+ ```
41
+
42
+ **自动匹配说明**:默认安装会探测本机真实安装的 IDE(`which` 命令 / 应用路径 / 配置文件),
43
+ 只装给已安装的 IDE,让每个 IDE 自己识别需要的 skill。用 `node install.mjs ides` 查看
44
+ 本机检测结果(✓ = 已安装)。
45
+
46
+ ## 支持的 IDE(全世界已知安装位置,官方文档核实)
47
+
48
+ | IDE | 用户级根 | 项目级根 | 说明 |
49
+ |---|---|---|---|
50
+ | Codex CLI | `~/.codex/skills` | `.codex/skills` | 新官方约定 `~/.agents/skills`;此处用专属根避免共享冲突 |
51
+ | DSH | `~/.dsh/skills` | `.dsh/skills` | skill-filesystem 自动扫描 |
52
+ | Claude Code | `~/.claude/skills` | `.claude/skills` | 父目录向上扫描至 repo root |
53
+ | Gemini CLI | `~/.gemini/skills` | `.gemini/skills` | 别名 `.agents/skills` 优先级更高 |
54
+ | Google Antigravity | `~/.gemini/antigravity/skills` | `.agents/skills`(随 --agents) | workspace 级固定用 agents 标准 |
55
+ | Cursor | `~/.cursor/skills` | `.cursor/skills` | 兼容加载 .claude/.codex/.agents/skills |
56
+ | Cline | `~/.cline/skills` | `.cline/skills` | 全局优先于项目 |
57
+ | Roo Code | `~/.roo/skills` | `.roo/skills` | 项目覆盖全局 |
58
+ | Kilo Code | `~/.kilo/skills` | `.kilo/skills` | kilo.jsonc 可配 |
59
+ | Windsurf | `~/.codeium/windsurf/skills` | `.windsurf/skills` | Cascade Skills |
60
+ | VS Code / Copilot | `~/.copilot/skills` | `.github/skills` | 另兼容 .claude/skills |
61
+ | Trae | `~/.trae-cn/skills`(国内版) | `.trae/skills` | 国际版用户级未确认 |
62
+ | Qwen Code | `~/.qwen/skills` | `.qwen/skills` | 模型自动调用 |
63
+ | OpenCode | `~/.config/opencode/skills` | `.opencode/skills` | 兼容 .claude/.agents |
64
+ | Zed | `~/.agents/skills`(仅 --agents) | `.agents/skills`(仅 --agents) | 官方即用 agents 标准根 |
65
+ | Amazon Q | 无 skills 机制 | 无 skills 机制 | 官方确认不支持 SKILL.md |
66
+
67
+ > 跨工具互操作标准根 `~/.agents/skills`(agentskills.io):Codex 新约定、Gemini、Zed、
68
+ > OpenCode、Cursor、Antigravity、Kilo 等都支持,但会被**多个工具同时扫描**——同一 skill
69
+ > 装进去会在各工具中重复出现。本安装器默认跳过它(`--agents` 显式开启并警告)。
70
+ >
71
+ > 新增 IDE:在 `install.mjs` 的 `IDES` 数组加一行即可,其余逻辑自动生效。
72
+
73
+ ## 分发给别人
74
+
75
+ ### 方式 A:Git 仓库(推荐,最简单)
76
+ 把本目录推到一个 git 仓库,使用者:
77
+ ```bash
78
+ git clone <repo-url> && cd dsh-skillpack && node install.mjs install
79
+ ```
80
+ 更新:`git pull && node install.mjs update`
81
+
82
+ ### 方式 B:发布为 npm 包(一条命令装)
83
+ 本包已配好 `bin`,发布后使用者只需:
84
+ ```bash
85
+ npx dsh-skillpack@latest install
86
+ ```
87
+ 更新:同一命令(`@latest` 自动拉新版)。
88
+ > 注意 npm 官方源对包名唯一性有要求;内部使用可部署私有 registry(如 Verdaccio)。
89
+
90
+ ### 方式 C:直接用 clitaxio(如果只想引第三方 skill)
91
+ ```bash
92
+ npx clitaxio@latest install <runtime-code> ~/.codex/skills/<slug>
93
+ ```
94
+ 本包是更可控的本地化替代:离线可用、可审计、可 git 管理、可批量管理多个 skill、自动多 IDE 分发。
95
+
96
+ ## 目录结构
97
+
98
+ ```
99
+ dsh-skillpack/
100
+ ├── install.mjs # 安装器(Node ≥18,零依赖):pull / install / uninstall / list / ides
101
+ ├── sources.json # ★ cli.tax skill 源清单(code → 自动拉取),扩展就加一行
102
+ ├── package.json # npm 包元数据(可发布)
103
+ ├── README.md
104
+ └── skills/ # skill 内容(pull 生成,可提交 git 离线兜底)
105
+ └── blueprint/
106
+ ├── SKILL.md
107
+ └── skill.json
108
+ ```
109
+
110
+ ## 无限扩展(加新 skill 两种方式)
111
+
112
+ **方式 A:从 cli.tax 拉取**(推荐)——`sources.json` 加一行:
113
+ ```json
114
+ { "cliTax": [
115
+ { "code": "wvz6zmRWmX", "slug": "blueprint", "endpoint": "https://cli.tax/api/public/skills/{code}" },
116
+ { "code": "你的新code", "slug": "新skill名", "endpoint": "https://cli.tax/api/public/skills/{code}" }
117
+ ] }
118
+ ```
119
+ 然后 `node install.mjs pull` → 自动下载到 skills/。
120
+
121
+ **方式 B:本地手工写**——直接建 `skills/my-new-skill/SKILL.md`(frontmatter: `name` kebab-case + `description`)。
122
+
123
+ 两种方式后都只需 `node install.mjs update` 同步到本机所有已装 IDE。
124
+
125
+ ## 常见问题
126
+
127
+ - **装完当前会话没立刻出现?** skill 目录在会话初始化时注入,新会话即可发现;文件系统 watcher 也会自动感知变更。
128
+ - **Codex 里出现了 2 个同一个 skill?** 常见原因是同时存在 `~/.codex/skills/<name>` 和 `~/.agents/skills/<name>`(或 config.toml 注册条目)。本安装器默认不会装到 `~/.agents/skills`,避免此问题;如已发生,删除 `~/.agents/skills/<name>` 并清理 config.toml 中的 `[[skills.config]]` 条目即可。
129
+ - **想改 skill 内容?** 直接改 `skills/<name>/SKILL.md` 再 `update`,幂等覆盖。
130
+ - **命名要求?** 目录名即 skill 名,必须 kebab-case(如 `my-new-skill`)。
package/install.mjs ADDED
@@ -0,0 +1,297 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * dsh-skillpack — 多 IDE 通用 skill 插件包安装器
4
+ *
5
+ * 从本包 `skills/` 目录同步一组 skill 到全世界各 IDE/编码 agent 的 skills 根目录。
6
+ * 每个子目录(含 SKILL.md + skill.json)即一个 skill;新增/删除子目录后重跑即可扩展。
7
+ *
8
+ * 设计原则:
9
+ * - 内置「全世界已知 IDE 的 skills 安装位置表」(IDES,官方文档核实);
10
+ * - 默认「自动匹配」:检测本机真实安装的 IDE(which 命令 / 应用路径 / 配置文件),
11
+ * 只装给已安装的 IDE,让每个 IDE 自己识别需要的 skill;--all 才全量安装;
12
+ * - 每个 IDE 装到它自己的专属用户级根 → IDE 内部唯一、IDE 之间互不重复;
13
+ * - 跨工具互操作标准 ~/.agents/skills(agentskills.io)默认跳过——它会被多个工具
14
+ * 同时扫描(Codex 新约定/Gemini/Zed/OpenCode/Cursor/Antigravity),装进去会被重复发现;
15
+ * 需要时用 --agents 显式开启(会打印警告);
16
+ * - --ide / --skip 精确控制;新增 IDE 只需在 IDES 表加一行。
17
+ *
18
+ * 用法:
19
+ * node install.mjs pull # 从 sources.json(cli.tax)拉取全部 skill 到 skills/
20
+ * node install.mjs install # 自动匹配:只装本机已安装的 IDE(推荐)
21
+ * # skills/ 为空时自动先 pull;--pull 强制重新拉取
22
+ * node install.mjs install --all # 装到所有已知 IDE(不管是否安装)
23
+ * node install.mjs install --ide codex # 仅安装到指定 IDE(可重复: --ide codex --ide dsh)
24
+ * node install.mjs install --skip cursor # 自动匹配但跳过指定 IDE(可重复)
25
+ * node install.mjs install --project # 额外安装到当前项目的项目级根(每个选中 IDE 一个)
26
+ * node install.mjs install --agents # 额外安装到共享 ~/.agents/skills(警告)
27
+ * node install.mjs install --target /abs/path # 仅自定义目录
28
+ * node install.mjs update # 同 install(幂等覆盖)
29
+ * node install.mjs uninstall # 从相同目标移除本包安装的 skills
30
+ * node install.mjs list # 列出本包包含的 skills
31
+ * node install.mjs ides # 列出已知 IDE 及本机检测结果
32
+ *
33
+ * 作为 npm 包发布后: npx dsh-skillpack@latest install
34
+ */
35
+ import { cp, mkdir, readdir, rm, writeFile } from 'node:fs/promises'
36
+ import { existsSync, readFileSync, readdirSync } from 'node:fs'
37
+ import { homedir } from 'node:os'
38
+ import { join, resolve } from 'node:path'
39
+ import { fileURLToPath } from 'node:url'
40
+ import { spawnSync } from 'node:child_process'
41
+
42
+ const __dirname = fileURLToPath(new URL('.', import.meta.url))
43
+ const SKILLS_SRC = join(__dirname, 'skills')
44
+
45
+ const HOME = homedir()
46
+ const CWD = process.cwd()
47
+
48
+ /**
49
+ * 全世界已知 IDE/编码 agent 的 skills 安装位置表(官方文档核实,2026-08)。
50
+ * key: 命令行标识
51
+ * label: 显示名
52
+ * detect: 安装探测规则数组(任一命中即视为已安装):
53
+ * { cmd: 'codex' } —— which 命令存在
54
+ * { app: '/Applications/X.app' } —— 应用路径存在
55
+ * { file: '~/.codex/config.toml' } —— 配置文件存在(确认真实安装,非本工具创建)
56
+ * user: 用户级 skills 根(默认安装目标,每个 IDE 一份)
57
+ * project: 项目级 skills 根(--project 时使用)
58
+ * doc: 官方文档 URL
59
+ * 新增 IDE 只需在此加一行,其余逻辑自动生效。
60
+ */
61
+ const IDES = [
62
+ // OpenAI / Anthropic / Google 系
63
+ { key: 'codex', label: 'Codex CLI', detect: [{ cmd: 'codex' }, { file: join(HOME, '.codex', 'config.toml') }], user: join(HOME, '.codex', 'skills'), project: join(CWD, '.codex', 'skills'), doc: 'https://developers.openai.com/codex/skills', note: '新官方约定 ~/.agents/skills;此处用旧约定 ~/.codex/skills(skill-installer 仍默认写入),避免共享根重复' },
64
+ { key: 'dsh', label: 'DSH', detect: [{ file: join(HOME, '.dsh', 'settings.yaml') }, { file: join(HOME, '.dsh', '.credentials.yaml') }], user: join(HOME, '.dsh', 'skills'), project: join(CWD, '.dsh', 'skills'), doc: 'https://github.com/deepseek-ai/Harness', note: 'skill-filesystem 扫描 ~/.dsh/skills + ~/.agents/skills' },
65
+ { key: 'claude', label: 'Claude Code', detect: [{ cmd: 'claude' }, { file: join(HOME, '.claude', 'settings.json') }, { dir: join(HOME, '.claude') }], user: join(HOME, '.claude', 'skills'), project: join(CWD, '.claude', 'skills'), doc: 'https://code.claude.com/docs/en/skills', note: '含父目录向上扫描至 repo root;monorepo 子目录生效' },
66
+ { key: 'gemini', label: 'Gemini CLI', detect: [{ cmd: 'gemini' }, { file: join(HOME, '.gemini', 'settings.json') }], user: join(HOME, '.gemini', 'skills'), project: join(CWD, '.gemini', 'skills'), doc: 'https://geminicli.com/docs/cli/skills/', note: '别名 .agents/skills 优先级更高(此处用专属根避免共享冲突)' },
67
+ { key: 'antigravity', label: 'Google Antigravity', detect: [{ cmd: 'antigravity' }, { app: '/Applications/Antigravity.app' }], user: join(HOME, '.gemini', 'antigravity', 'skills'), project: join(CWD, '.agents', 'skills'), doc: 'https://antigravity.google/docs/ide/skills', note: 'workspace 级固定用 .agents/skills(需 --agents 才装项目级)' },
68
+
69
+ // 编辑器 / VS Code 生态
70
+ { key: 'cursor', label: 'Cursor', detect: [{ cmd: 'cursor' }, { app: '/Applications/Cursor.app' }, { file: join(HOME, '.cursor', 'cursor.db') }], user: join(HOME, '.cursor', 'skills'), project: join(CWD, '.cursor', 'skills'), doc: 'https://cursor.com/help/customization/skills.md', note: '兼容加载 .claude/.codex/.agents/skills' },
71
+ { key: 'cline', label: 'Cline', detect: [{ cmd: 'cline' }, { dir: join(HOME, '.cline') }], user: join(HOME, '.cline', 'skills'), project: join(CWD, '.cline', 'skills'), doc: 'https://cline.bot/blog/cline-3-48-0-skills-and-websearch-make-cline-smarter', note: '全局优先于项目' },
72
+ { key: 'roo', label: 'Roo Code', detect: [{ cmd: 'roo' }, { dir: join(HOME, '.roo') }], user: join(HOME, '.roo', 'skills'), project: join(CWD, '.roo', 'skills'), doc: 'https://docs.roocode.com/features/skills', note: '项目覆盖全局,模式级覆盖通用' },
73
+ { key: 'kilo', label: 'Kilo Code', detect: [{ cmd: 'kilo' }, { dir: join(HOME, '.kilo') }], user: join(HOME, '.kilo', 'skills'), project: join(CWD, '.kilo', 'skills'), doc: 'https://kilo.ai/docs/customize/skills', note: 'kilo.jsonc 可配 skills.paths/urls;另默认加载 .agents/skills' },
74
+ { key: 'windsurf', label: 'Windsurf', detect: [{ cmd: 'windsurf' }, { app: '/Applications/Windsurf.app' }], user: join(HOME, '.codeium', 'windsurf', 'skills'), project: join(CWD, '.windsurf', 'skills'), doc: 'https://docs.windsurf.com/windsurf/cascade/skills', note: '全局 ~/.codeium/windsurf/skills,workspace .windsurf/skills' },
75
+ { key: 'copilot', label: 'VS Code / Copilot', detect: [{ cmd: 'copilot' }, { app: '/Applications/Visual Studio Code.app' }, { file: join(HOME, '.copilot', 'accounts.json') }], user: join(HOME, '.copilot', 'skills'), project: join(CWD, '.github', 'skills'), doc: 'https://code.visualstudio.com/docs/agent-customization/agent-skills', note: 'workspace .github/skills + .claude/skills;user ~/.copilot/skills + ~/.claude/skills' },
76
+ { key: 'trae', label: 'Trae', detect: [{ cmd: 'trae' }, { app: '/Applications/Trae.app' }, { dir: join(HOME, '.trae-cn') }], user: join(HOME, '.trae-cn', 'skills'), project: join(CWD, '.trae', 'skills'), doc: 'https://docs.trae.cn/work_skills', note: '国内版 ~/.trae-cn/skills;国际版用户级未确认;另有 .trae/rules' },
77
+
78
+ // CLI agent
79
+ { key: 'qwen', label: 'Qwen Code', detect: [{ cmd: 'qwen' }, { file: join(HOME, '.qwen', 'settings.json') }], user: join(HOME, '.qwen', 'skills'), project: join(CWD, '.qwen', 'skills'), doc: 'https://qwenlm.github.io/qwen-code-docs/users/features/skills/', note: '模型自动调用;/learn 生成到项目 .qwen/skills' },
80
+ { key: 'opencode', label: 'OpenCode', detect: [{ cmd: 'opencode' }, { dir: join(HOME, '.config', 'opencode') }], user: join(HOME, '.config', 'opencode', 'skills'), project: join(CWD, '.opencode', 'skills'), doc: 'https://github.com/anomalyco/opencode/blob/main/packages/web/src/content/docs/skills.mdx', note: '兼容 .claude/skills 与 .agents/skills' },
81
+ { key: 'zed', label: 'Zed', detect: [{ cmd: 'zed' }, { app: '/Applications/Zed.app' }], user: join(HOME, '.agents', 'skills'), project: join(CWD, '.agents', 'skills'), doc: 'https://zed.dev/docs/ai/skills', note: '官方即用 .agents/skills 标准根,仅 --agents 时安装(避免默认触碰共享根)', agentsOnly: true },
82
+ // Amazon Q Developer:官方确认无 SKILL.md skills 机制(能力目录为 ~/.aws/amazonq/cli-agents/),故不入表
83
+ ]
84
+
85
+ // 跨工具互操作标准根(默认跳过;--agents 显式开启)
86
+ const AGENTS = { label: '共享 agents 级 (.agents/skills 标准)', path: join(HOME, '.agents', 'skills') }
87
+
88
+ function print(line = '') { process.stdout.write(`${line}\n`) }
89
+
90
+ /** 探测 IDE 是否真实安装(which 命令 / 应用路径 / 配置文件,任一命中即已安装) */
91
+ function isIdeInstalled(ide) {
92
+ for (const probe of ide.detect) {
93
+ if (probe.cmd !== undefined) {
94
+ const r = spawnSync('which', [probe.cmd], { stdio: 'ignore' })
95
+ if (r.status === 0) return true
96
+ }
97
+ if (probe.app !== undefined && existsSync(probe.app)) return true
98
+ if (probe.file !== undefined && existsSync(probe.file)) return true
99
+ if (probe.dir !== undefined) {
100
+ // 目录存在且包含非 skills 的真实内容(避免本安装器创建的 skills 子目录误判)
101
+ try {
102
+ const entries = readdirSync(probe.dir)
103
+ if (entries.some((e) => e !== 'skills' && e !== '.git')) return true
104
+ } catch { /* 目录不存在或不可读,忽略 */ }
105
+ }
106
+ }
107
+ return false
108
+ }
109
+
110
+ async function listSkills() {
111
+ if (!existsSync(SKILLS_SRC)) return []
112
+ const entries = await readdir(SKILLS_SRC, { withFileTypes: true })
113
+ const skills = []
114
+ for (const e of entries) {
115
+ if (!e.isDirectory()) continue
116
+ const skillDir = join(SKILLS_SRC, e.name)
117
+ if (existsSync(join(skillDir, 'SKILL.md'))) skills.push(e.name)
118
+ }
119
+ return skills.sort()
120
+ }
121
+
122
+ async function syncOne(name, targetRoot, { remove = false } = {}) {
123
+ const dest = join(targetRoot, name)
124
+ if (remove) {
125
+ if (existsSync(dest)) { await rm(dest, { recursive: true, force: true }); print(` ✓ 已移除 ${name} ← ${targetRoot}`) }
126
+ return
127
+ }
128
+ await mkdir(dest, { recursive: true })
129
+ await cp(join(SKILLS_SRC, name), dest, { recursive: true, force: true })
130
+ print(` ✓ 已安装 ${name} → ${dest}`)
131
+ }
132
+
133
+ async function syncAll(targetRoot, { remove = false } = {}) {
134
+ const skills = await listSkills()
135
+ if (!remove) await mkdir(targetRoot, { recursive: true })
136
+ for (const s of skills) await syncOne(s, targetRoot, { remove })
137
+ }
138
+
139
+ /** 解析目标列表:--target / --ide / --skip / 默认(全部已知 IDE) */
140
+ function parseTargets(args) {
141
+ const flags = args.filter((a) => a.startsWith('--'))
142
+
143
+ const targetFlag = args.indexOf('--target')
144
+ if (targetFlag !== -1) {
145
+ const p = args[targetFlag + 1]
146
+ if (!p) { print('--target 需要一个绝对路径'); process.exit(1) }
147
+ return [{ label: '自定义', path: resolve(p) }]
148
+ }
149
+
150
+ const selected = []
151
+ const withProject = flags.includes('--project')
152
+
153
+ // 显式 --ide(可重复)
154
+ const ideKeys = []
155
+ for (let i = 0; i < args.length; i++) {
156
+ if (args[i] === '--ide') {
157
+ const k = args[i + 1]
158
+ if (!k) { print('--ide 需要一个 IDE key(如 codex)'); process.exit(1) }
159
+ ideKeys.push(k)
160
+ i++
161
+ }
162
+ }
163
+ if (ideKeys.length) {
164
+ for (const k of ideKeys) {
165
+ const ide = IDES.find((x) => x.key === k)
166
+ if (!ide) { print(`未知 IDE: ${k}(可用: ${IDES.map((x) => x.key).join(', ')})`); process.exit(1) }
167
+ selected.push({ label: `${ide.label} 用户级`, path: ide.user })
168
+ if (withProject) selected.push({ label: `${ide.label} 项目级`, path: ide.project })
169
+ }
170
+ return selected
171
+ }
172
+
173
+ // --skip(排除某些 IDE)
174
+ const skipped = []
175
+ for (let i = 0; i < args.length; i++) {
176
+ if (args[i] === '--skip') {
177
+ const k = args[i + 1]
178
+ if (!k) { print('--skip 需要一个 IDE key(如 cursor)'); process.exit(1) }
179
+ skipped.push(k)
180
+ i++
181
+ }
182
+ }
183
+
184
+ // 默认:自动匹配——只装本机真实安装的 IDE;--all 则装全部已知 IDE。
185
+ const wantAgents = flags.includes('--agents')
186
+ const wantAll = flags.includes('--all')
187
+ for (const ide of IDES) {
188
+ if (skipped.includes(ide.key)) continue
189
+ // agentsOnly(如 Zed):仅 --agents 时安装,默认不触碰共享根
190
+ if (ide.agentsOnly && !wantAgents) continue
191
+ // 默认只装检测到已安装的 IDE;--all 忽略检测
192
+ if (!wantAll && !isIdeInstalled(ide)) continue
193
+ selected.push({ label: `${ide.label} 用户级`, path: ide.user })
194
+ if (withProject) selected.push({ label: `${ide.label} 项目级`, path: ide.project })
195
+ }
196
+ if (!selected.length) {
197
+ print('未检测到任何已安装的 IDE;可用 --all 安装全部已知 IDE,或 --ide <key> 指定。')
198
+ process.exit(1)
199
+ }
200
+ return selected
201
+ }
202
+
203
+ const [cmd, ...rest] = process.argv.slice(2)
204
+
205
+ /** 从 cli.tax 拉取一个 skill 到 skills/<slug>/(覆盖本地副本) */
206
+ async function pullSkill(source) {
207
+ const url = source.endpoint.replace('{code}', source.code)
208
+ const resp = await fetch(url)
209
+ if (!resp.ok) {
210
+ print(` ✗ 拉取失败 ${source.slug}(${url} → HTTP ${resp.status})`)
211
+ return false
212
+ }
213
+ const data = await resp.json()
214
+ const dir = join(SKILLS_SRC, data.slug || source.slug)
215
+ await mkdir(dir, { recursive: true })
216
+ await writeFile(join(dir, 'SKILL.md'), data.skillMd)
217
+ await writeFile(join(dir, 'skill.json'), data.skillJson)
218
+ print(` ✓ 已拉取 ${data.displayName} ${data.version ?? ''} → skills/${data.slug}/`)
219
+ return true
220
+ }
221
+
222
+ /** 读取 sources.json 中的源列表 */
223
+ function loadSources() {
224
+ const p = join(__dirname, 'sources.json')
225
+ if (!existsSync(p)) return []
226
+ try {
227
+ const raw = readFileSync(p, 'utf8')
228
+ return JSON.parse(raw).cliTax ?? []
229
+ } catch {
230
+ print('⚠ sources.json 解析失败,忽略源。')
231
+ return []
232
+ }
233
+ }
234
+
235
+ /** 拉取全部源;失败不影响本地已有 skills */
236
+ async function pullAllSources() {
237
+ const sources = loadSources()
238
+ if (!sources.length) return false
239
+ print(`从 cli.tax 拉取 ${sources.length} 个 skill 源:`)
240
+ let ok = 0
241
+ for (const s of sources) { if (await pullSkill(s)) ok++ }
242
+ print(`拉取完成(${ok}/${sources.length})。`)
243
+ return ok > 0
244
+ }
245
+
246
+ if (cmd === 'list') {
247
+ const skills = await listSkills()
248
+ print(`本包包含 ${skills.length} 个 skills:`)
249
+ for (const s of skills) print(` - ${s}`)
250
+ } else if (cmd === 'ides') {
251
+ print(`已知 IDE 及本机检测结果(共 ${IDES.length} 个):`)
252
+ for (const ide of IDES) {
253
+ const installed = isIdeInstalled(ide)
254
+ print(` ${installed ? '✓' : '·'} ${ide.key.padEnd(11)} ${ide.label.padEnd(20)} ${ide.user}`)
255
+ }
256
+ print(` · agents 共享 agents 级 ${AGENTS.path}(默认跳过,--agents 开启)`)
257
+ print('默认 install 只装 ✓ 标记的 IDE;--all 装全部。')
258
+ } else if (cmd === 'pull') {
259
+ const ok = await pullAllSources()
260
+ if (ok) print('已更新 skills/ 目录;可用 git add/commit 提交到仓库。')
261
+ process.exit(ok ? 0 : 1)
262
+ } else if (cmd === 'install' || cmd === 'update') {
263
+ // 自动拉取:--pull 强制拉取;skills/ 为空时也自动拉取
264
+ if (rest.includes('--pull') || !existsSync(SKILLS_SRC) || (await readdir(SKILLS_SRC).catch(() => [])).length === 0) {
265
+ await pullAllSources()
266
+ }
267
+ const targets = parseTargets(rest)
268
+ const skills = await listSkills()
269
+ if (!skills.length) { print('skills/ 目录为空,无法安装'); process.exit(1) }
270
+ if (rest.includes('--agents') && !targets.some((t) => t.path === AGENTS.path)) targets.push(AGENTS)
271
+ print(`将安装 ${skills.length} 个 skills → ${targets.length} 个目标`)
272
+ for (const t of targets) {
273
+ print(`[${t.label}] ${t.path}`)
274
+ await syncAll(t.path)
275
+ }
276
+ if (rest.includes('--agents')) {
277
+ print('⚠ 已安装到共享 ~/.agents/skills:该目录会被 Codex/Gemini/Zed/OpenCode/Cursor 等同时扫描,同一 skill 可能被重复发现。')
278
+ }
279
+ print('完成。各 IDE 会自动发现各自用户级根中的新目录(可立即在新会话中调用)。')
280
+ } else if (cmd === 'uninstall') {
281
+ const targets = parseTargets(rest)
282
+ if (rest.includes('--agents') && !targets.some((t) => t.path === AGENTS.path)) targets.push(AGENTS)
283
+ for (const t of targets) {
284
+ print(`[${t.label}] ${t.path}`)
285
+ await syncAll(t.path, { remove: true })
286
+ }
287
+ print('完成。')
288
+ } else {
289
+ print(`用法:
290
+ node install.mjs install [--all|--ide <key>|--skip <key>|--project|--agents|--pull|--target <dir>]
291
+ node install.mjs pull
292
+ node install.mjs update
293
+ node install.mjs uninstall
294
+ node install.mjs list
295
+ node install.mjs ides`)
296
+ process.exit(1)
297
+ }
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "cli-blueprint",
3
+ "version": "0.1.0",
4
+ "description": "Blueprint skill 多 IDE 安装器:从 cli.tax 自动拉取并分发到本机所有已装 IDE(Codex/DSH/Claude/Cursor/…)。",
5
+ "type": "module",
6
+ "bin": {
7
+ "cli-blueprint": "install.mjs"
8
+ },
9
+ "files": [
10
+ "install.mjs",
11
+ "sources.json",
12
+ "skills"
13
+ ],
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "license": "MIT",
18
+ "keywords": [
19
+ "blueprint",
20
+ "skill",
21
+ "cli.tax",
22
+ "clitax",
23
+ "codex",
24
+ "agent",
25
+ "installer"
26
+ ]
27
+ }
@@ -0,0 +1,39 @@
1
+ ---
2
+ name: "blueprint"
3
+ description: "Blueprint 是一个跨工具的工程规划 CLI,把明确目标编译为可执行、可追溯、可验收的全站工程蓝图,并通过确定性规则检查每个节点、分支、合同、任务与验收闭环。默认由当前 IDE 的多智能体协同推演,也可连接用户自行安装的本地 Hermes;平台不托管模型密钥。"
4
+ ---
5
+
6
+ # blueprint
7
+
8
+ Use this Skill only when the user's request matches the capability described below.
9
+
10
+ ## Capability
11
+
12
+ - Source type: Skill
13
+ - Version: v0.4.0
14
+ - Status at generation: published
15
+ - Address: `https://cli.tax/wvz6zmRWmX`
16
+ - Method: `POST`
17
+ - Content type: `application/json`
18
+
19
+ Blueprint 是一个跨工具的工程规划 CLI,把明确目标编译为可执行、可追溯、可验收的全站工程蓝图,并通过确定性规则检查每个节点、分支、合同、任务与验收闭环。默认由当前 IDE 的多智能体协同推演,也可连接用户自行安装的本地 Hermes;平台不托管模型密钥。
20
+
21
+ ## Invocation
22
+
23
+ Send JSON to the exact CLI address and put capability arguments inside `input`:
24
+
25
+ ```json
26
+ {
27
+ "input": {}
28
+ }
29
+ ```
30
+
31
+ Do not rewrite the CLI address, invent parameters, or include API keys, tokens, cookies, passwords, or private keys. Ask for missing non-secret inputs. Runtime invocation is available only after the CLI is published and the owner has an active subscription.
32
+
33
+ ## Errors
34
+
35
+ - `402`: subscription or quota unavailable
36
+ - `404`: CLI is unavailable or not published
37
+ - `422`: invalid input or contract
38
+ - `429`: rate or concurrency limit reached
39
+ - `5xx`: execution or upstream failure
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "blueprint",
3
+ "displayName": "blueprint",
4
+ "description": "Blueprint 是一个跨工具的工程规划 CLI,把明确目标编译为可执行、可追溯、可验收的全站工程蓝图,并通过确定性规则检查每个节点、分支、合同、任务与验收闭环。默认由当前 IDE 的多智能体协同推演,也可连接用户自行安装的本地 Hermes;平台不托管模型密钥。",
5
+ "schemaVersion": "cli.request/1.0",
6
+ "endpoint": "https://cli.tax/wvz6zmRWmX",
7
+ "method": "POST",
8
+ "version": "v0.4.0",
9
+ "type": "Skill"
10
+ }
package/sources.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "cliTax": [
3
+ {
4
+ "code": "wvz6zmRWmX",
5
+ "slug": "blueprint",
6
+ "endpoint": "https://cli.tax/api/public/skills/{code}",
7
+ "doc": "https://cli.tax/wvz6zmRWmX",
8
+ "description": "Blueprint 工程规划 CLI skill(CLI.Tax 发布)"
9
+ }
10
+ ]
11
+ }