nvwa-skill-cli 0.1.0 → 0.1.2

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.
Files changed (3) hide show
  1. package/README.md +9 -5
  2. package/bin/cli.js +30 -11
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -21,7 +21,7 @@ npm install
21
21
  node bin/cli.js --help
22
22
  node bin/cli.js install ./demo-skill.zip --target ./skills
23
23
  node bin/cli.js install-skillhub 2062784556544692224 --base-url http://localhost:8188 -g
24
- node bin/cli.js install-skillhub 2062784556544692224 1.0.0 --base-url http://localhost:8188 --agent codex -y
24
+ node bin/cli.js install-skillhub 2062784556544692224 1.0.0 --base-url http://localhost:8188 --agent codex,cursor -y
25
25
  ```
26
26
 
27
27
  也可以用 `npx` 调试本地包:
@@ -30,7 +30,7 @@ node bin/cli.js install-skillhub 2062784556544692224 1.0.0 --base-url http://loc
30
30
  npx . --help
31
31
  npx . install ./demo-skill.zip --target ./skills
32
32
  npx . install-skillhub 2062784556544692224 --base-url http://localhost:8188 -g
33
- npx . install-skillhub 2062784556544692224 1.0.0 --base-url http://localhost:8188 --agent codex -y
33
+ npx . install-skillhub 2062784556544692224 1.0.0 --base-url http://localhost:8188 --agent codex,cursor -y
34
34
  ```
35
35
 
36
36
  ## 命令
@@ -38,6 +38,7 @@ npx . install-skillhub 2062784556544692224 1.0.0 --base-url http://localhost:818
38
38
  ```bash
39
39
  npx nvwa-skill-cli install <zip-url-or-file> [options]
40
40
  npx nvwa-skill-cli install-skillhub <skillId> [version] [options]
41
+ nvwa-skill-cli install-skillhub <skillId> [version] [options]
41
42
  ```
42
43
 
43
44
  ### 参数
@@ -48,7 +49,7 @@ npx nvwa-skill-cli install-skillhub <skillId> [version] [options]
48
49
  - `--force`:目标目录已存在时覆盖
49
50
  - `install-skillhub` 命令参数
50
51
  - `--base-url <url>`:`install-skillhub` 使用的 8188 地址,默认 `http://localhost:8188`
51
- - `--agent <agent>`:要安装到的 agent,默认 `codex`
52
+ - `--agent <agent>`:要安装到的 agent;支持逗号分隔或重复传参;不传时默认安装到所有支持的 agent
52
53
  - `-g, --global`:安装到全局目录;对于 Codex 即 `~/.codex/skills`
53
54
  - `--copy`:调用 `skills add` 时使用复制模式,不走 symlink
54
55
  - `-y, --yes`:跳过 `skills` 的交互确认
@@ -61,16 +62,19 @@ npx nvwa-skill-cli install https://example.com/demo-skill.zip
61
62
  npx nvwa-skill-cli install ./demo-skill.zip --target ./skills
62
63
  npx nvwa-skill-cli install https://example.com/demo-skill.zip --name self-improvement
63
64
  npx nvwa-skill-cli install-skillhub 2062784556544692224 --base-url http://localhost:8188 -g
64
- npx nvwa-skill-cli install-skillhub 2062784556544692224 1.0.0 --base-url http://localhost:8188 --agent codex -y
65
+ npx nvwa-skill-cli install-skillhub 2062784556544692224 1.0.0 --base-url http://localhost:8188 --agent codex,cursor -y
66
+ nvwa-skill-cli install-skillhub 2062785580131028992 --base-url http://172.23.64.1:8188 --agent codex -g -y
67
+ ```
65
68
 
66
69
  ## 安装结果
67
70
 
68
71
  - `install`:只是解压到指定目录,方便检查 zip 内容
69
72
  - `install-skillhub`:下载后调用 `skills add <临时目录>`,会真正安装到 agent 的 skills 目录
73
+ - `install-skillhub` 不传 `--agent` 时,默认安装到所有支持的 agent
74
+ - `install-skillhub --agent codex,cursor` 这类写法支持一次安装到多个指定 agent
70
75
  - 对 Codex 而言:
71
76
  - 项目级安装默认落到 `./.agents/skills`
72
77
  - 全局安装 `-g` 落到 `~/.codex/skills`
73
- ```
74
78
 
75
79
  ## 发布到 npm
76
80
 
package/bin/cli.js CHANGED
@@ -12,9 +12,9 @@ const AdmZip = require("adm-zip");
12
12
 
13
13
  const HELP_TEXT = `
14
14
  Usage:
15
- nvwa-skill install <zip-url-or-file> [options]
16
- nvwa-skill install-skillhub <skillId> [version] [options]
17
- nvwa-skill help
15
+ nvwa-skill-cli install <zip-url-or-file> [options]
16
+ nvwa-skill-cli install-skillhub <skillId> [version] [options]
17
+ nvwa-skill-cli help
18
18
 
19
19
  Commands:
20
20
  install Download or read a zip, extract it, verify SKILL.md, and install it
@@ -25,7 +25,7 @@ Options:
25
25
  --target <dir> Installation root directory (default: ./installed-skills)
26
26
  --name <dirName> Override installed directory name
27
27
  --base-url <url> 8188 base URL for install-skillhub (default: http://localhost:8188)
28
- --agent <agent> Target agent for install-skillhub (default: codex)
28
+ --agent <agent> Target agent(s) for install-skillhub; repeatable or comma-separated (default: all agents)
29
29
  -g, --global Install to global agent directory
30
30
  --copy Copy files instead of symlinking when using skills
31
31
  -y, --yes Skip skills confirmation prompts
@@ -37,7 +37,7 @@ Examples:
37
37
  npx nvwa-skill-cli install ./demo-skill.zip --target ./skills
38
38
  npx nvwa-skill-cli install https://example.com/demo-skill.zip --name self-improvement
39
39
  npx nvwa-skill-cli install-skillhub 2062784556544692224 --base-url http://localhost:8188 -g
40
- npx nvwa-skill-cli install-skillhub 2062784556544692224 1.0.0 --base-url http://localhost:8188 --agent codex -y
40
+ npx nvwa-skill-cli install-skillhub 2062784556544692224 1.0.0 --base-url http://localhost:8188 --agent codex,cursor -y
41
41
  `.trim();
42
42
 
43
43
  async function main() {
@@ -152,7 +152,7 @@ function parseInstallSkillHubArgs(args) {
152
152
  skillId: "",
153
153
  version: "",
154
154
  baseUrl: "http://localhost:8188",
155
- agent: "codex",
155
+ agents: [],
156
156
  global: false,
157
157
  copy: false,
158
158
  yes: false
@@ -172,7 +172,7 @@ function parseInstallSkillHubArgs(args) {
172
172
  continue;
173
173
  }
174
174
  if (arg === "--agent") {
175
- result.agent = requireNextValue(args, index, "--agent");
175
+ appendAgents(result.agents, requireNextValue(args, index, "--agent"));
176
176
  index += 1;
177
177
  continue;
178
178
  }
@@ -203,9 +203,24 @@ function parseInstallSkillHubArgs(args) {
203
203
  if (!result.skillId) {
204
204
  fail("Missing skillId for install-skillhub.");
205
205
  }
206
+ if (result.agents.length === 0) {
207
+ result.agents.push("*");
208
+ }
206
209
  return result;
207
210
  }
208
211
 
212
+ function appendAgents(target, rawValue) {
213
+ const values = String(rawValue || "")
214
+ .split(",")
215
+ .map((item) => item.trim())
216
+ .filter(Boolean);
217
+ for (const value of values) {
218
+ if (!target.includes(value)) {
219
+ target.push(value);
220
+ }
221
+ }
222
+ }
223
+
209
224
  function requireNextValue(args, index, optionName) {
210
225
  const value = args[index + 1];
211
226
  if (!value || value.startsWith("-")) {
@@ -259,7 +274,7 @@ async function installFromSkillHub(parsed) {
259
274
  const detectedSkillName = await detectSkillName(skillRoot);
260
275
  const installName = sanitizeDirectoryName(String(detectedSkillName || detailData.name || path.basename(skillRoot)));
261
276
  const installResult = await runSkillsAdd(skillRoot, {
262
- agent: parsed.agent,
277
+ agents: parsed.agents,
263
278
  global: parsed.global,
264
279
  copy: parsed.copy,
265
280
  yes: parsed.yes
@@ -272,7 +287,7 @@ async function installFromSkillHub(parsed) {
272
287
  skillId: parsed.skillId,
273
288
  version: parsed.version || String(detailData.version || ""),
274
289
  installedName: installName,
275
- agent: parsed.agent,
290
+ agents: parsed.agents,
276
291
  global: parsed.global,
277
292
  mode: parsed.copy ? "copy" : "symlink",
278
293
  skillsCommand: installResult.command,
@@ -286,7 +301,10 @@ async function installFromSkillHub(parsed) {
286
301
  async function runSkillsAdd(skillRoot, options) {
287
302
  const skillsPackageJson = require.resolve("skills/package.json");
288
303
  const skillsCliPath = path.join(path.dirname(skillsPackageJson), "bin", "cli.mjs");
289
- const commandArgs = [skillsCliPath, "add", skillRoot, "--agent", options.agent];
304
+ const commandArgs = [skillsCliPath, "add", skillRoot];
305
+ for (const agent of options.agents) {
306
+ commandArgs.push("--agent", agent);
307
+ }
290
308
  if (options.global) {
291
309
  commandArgs.push("--global");
292
310
  }
@@ -317,7 +335,8 @@ async function runSkillsAdd(skillRoot, options) {
317
335
  }
318
336
 
319
337
  async function syncCodexGlobalSkillIfNeeded(skillName, options) {
320
- if (options.agent !== "codex" || !options.global) {
338
+ const shouldSyncCodex = options.global && (options.agents.includes("*") || options.agents.includes("codex"));
339
+ if (!shouldSyncCodex) {
321
340
  return "";
322
341
  }
323
342
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "nvwa-skill-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "CLI for installing skill packages from zip URLs or local zip files.",
5
5
  "bin": {
6
- "nvwa-skill": "bin/cli.js"
6
+ "nvwa-skill-cli": "bin/cli.js"
7
7
  },
8
8
  "files": [
9
9
  "bin",