skillmkt 0.4.28 → 0.4.29

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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  // skillmkt — local-first agent skill manager
3
- import { makeCtx, withState } from '../lib/ctx.js';
3
+ import { makeCtx, withState, KNOWN_FLAGS } from '../lib/ctx.js';
4
4
  import { hubExists, isInitialized } from '../lib/hub.js';
5
5
  import { L } from '../lib/i18n.js';
6
6
 
@@ -61,6 +61,12 @@ async function main() {
61
61
  const [cmd, ...args] = ctx.positional;
62
62
  ctx.args = args;
63
63
 
64
+ // 打错的 flag 不静默吞——警告后继续(不硬失败,防误伤前向兼容)
65
+ const kebab = (s) => s.replace(/([A-Z])/g, (_, c) => `-${c.toLowerCase()}`);
66
+ for (const k of Object.keys(ctx.flags.raw)) {
67
+ if (!KNOWN_FLAGS.has(k)) console.error(`${L('⚠ 未知 flag,已忽略', 'warning: unknown flag ignored')}: --${kebab(k)}`);
68
+ }
69
+
64
70
  if (ctx.flags.raw.help || ctx.flags.raw.h) { console.log(L(HELP_ZH, HELP)); process.exit(0); }
65
71
  if (ctx.flags.raw.version || ctx.flags.raw.V) {
66
72
  const pkg = (await import('../../package.json', { with: { type: 'json' } })).default;
@@ -10,6 +10,7 @@ import { L } from '../lib/i18n.js';
10
10
  export async function run(ctx) {
11
11
  const flags = ctx.flags.raw;
12
12
  const skills = ctx.library.skills || {};
13
+ if (flags.all && ctx.args.length) { fail(L('--all 和指定名字只能二选一', '--all and specific names are mutually exclusive')); return 1; }
13
14
  const names = flags.all ? Object.keys(skills) : ctx.args;
14
15
  if (!names.length) { fail(L('用法: skillmkt audit <名字|--all> [--llm]', 'usage: skillmkt audit <name|--all> [--llm]')); return 1; }
15
16
  let worst = 'clean';
@@ -9,6 +9,7 @@ export async function run(ctx) {
9
9
  const raw = readConfig(ctx.hub)._raw;
10
10
 
11
11
  if (sub === 'get') {
12
+ if (!key) { fail(L('用法: config get <键>', 'usage: config get <key>')); return 1; }
12
13
  const v = getConfigKey(raw, key);
13
14
  if (v === undefined) { fail(L(`未知配置键: ${key}`, `unknown key: ${key}`)); return 1; }
14
15
  console.log(typeof v === 'object' ? YAML.stringify(v).trim() : String(v));
@@ -7,7 +7,7 @@ import { L } from '../lib/i18n.js';
7
7
  export async function run(ctx) {
8
8
  const [id] = ctx.args;
9
9
  const { resolution, reason, custom } = ctx.flags.raw;
10
- if (!id || !resolution || !reason) { fail(L('用法: skillmkt decide <冲突id> --resolution keep-a|keep-b|merge|dismissed --reason "…" [--custom text]', 'usage: skillmkt decide <conf-id> --resolution keep-a|keep-b|merge|dismissed --reason "…" [--custom text]')); return 1; }
10
+ if (!id || ctx.args.length > 1 || !resolution || !reason) { fail(L('用法: skillmkt decide <冲突id> --resolution keep-a|keep-b|merge|dismissed --reason "…" [--custom text]', 'usage: skillmkt decide <conf-id> --resolution keep-a|keep-b|merge|dismissed --reason "…" [--custom text]')); return 1; }
11
11
  const c = loadConflicts(ctx.hub).find((x) => x.id === id);
12
12
  if (!c) { fail(L(`没找到: ${id}`, `not found: ${id}`)); return 1; }
13
13
  if (!['keep-a', 'keep-b', 'merge', 'dismissed'].includes(resolution)) { fail(L(`resolution 只能是 keep-a/keep-b/merge/dismissed: ${resolution}`, `bad resolution: ${resolution}`)); return 1; }
@@ -17,6 +17,7 @@ function sectionsOf(dir) {
17
17
 
18
18
  export async function run(ctx) {
19
19
  const name = ctx.args[0];
20
+ if (!name || ctx.args.length > 1) { fail(L('用法: skillmkt diff <名字> [--semantic]', 'usage: skillmkt diff <name> [--semantic]')); return 1; }
20
21
  const s = ctx.library.skills?.[name];
21
22
  if (!s) { fail(L(`没纳入管理: ${name}`, `not managed: ${name}`)); return 1; }
22
23
  const src = s.source || {};
@@ -10,7 +10,7 @@ import { L } from '../lib/i18n.js';
10
10
 
11
11
  export async function run(ctx) {
12
12
  const input = ctx.args[0];
13
- if (!input) { fail(L('用法: skillmkt download <owner/repo 或 skills.sh slug>', 'usage: skillmkt download <owner/repo or skills.sh slug>')); return 1; }
13
+ if (!input || ctx.args.length > 1) { fail(L('用法: skillmkt download <owner/repo 或 skills.sh slug>(一次一个)', 'usage: skillmkt download <owner/repo or skills.sh slug> (one at a time)')); return 1; }
14
14
  const ref = parseRef(input, ctx.flags.raw, { harnesses: ctx.harnesses, registries: ctx.config.registries });
15
15
  ensureHub(ctx.hub);
16
16
 
@@ -11,7 +11,7 @@ import { projectSkill, resolveTargets } from '../lib/project.js';
11
11
  import { primaryDir } from '../lib/scanner.js';
12
12
  import { cacheLookup } from '../lib/state.js';
13
13
  import { confirm, multiChoose } from '../lib/prompt.js';
14
- import { ok, warn, fail, info } from '../lib/render.js';
14
+ import { ok, warn, fail, info, auditTag } from '../lib/render.js';
15
15
  import { L } from '../lib/i18n.js';
16
16
 
17
17
  // 来源取证:.git remote → skills-lock.json → .market-skills.json → frontmatter
@@ -57,8 +57,9 @@ function copyFiltered(src, dst, keep) {
57
57
 
58
58
  export async function run(ctx) {
59
59
  const input = ctx.args[0];
60
- if (!input) { fail(L('用法: skillmkt install <ref|路径|owner/repo>', 'usage: skillmkt install <ref|path|owner/repo>')); return 1; }
60
+ if (!input || ctx.args.length > 1) { fail(L('用法: skillmkt install <ref|路径|owner/repo>(一次一个)', 'usage: skillmkt install <ref|path|owner/repo> (one at a time)')); return 1; }
61
61
  const flags = ctx.flags.raw;
62
+ if (flags.scope && !['project', 'global'].includes(flags.scope)) { fail(L(`--scope 只能是 project|global: ${flags.scope}`, `--scope must be project|global: ${flags.scope}`)); return 1; }
62
63
 
63
64
  const ref = parseRef(input, flags, { harnesses: ctx.harnesses, registries: ctx.config.registries });
64
65
  if (!ctx.flags.dryRun) ensureHub(ctx.hub);
@@ -183,6 +184,6 @@ export async function run(ctx) {
183
184
 
184
185
  const actZh = { conflict: '冲突', exists: '已有', skipped: '跳过', absent: '缺', removed: '已删' };
185
186
  const mark = results.map((r) => `${r.id.split(':')[0]}(${r.action === 'copied' ? 'copy' : r.action === 'linked' ? 'sym' : L(actZh[r.action] ?? r.action, r.action)})`).join(' ');
186
- ok(`${ctx.flags.dryRun ? '[dry-run] ' : ''}${L('已装', 'installed')} ${name} → ${mark || L('只进 hub', 'hub only')} · ${L('审核', 'audit')}:${audit.stripped.length ? 'stripped' : audit.verdict} · ${L('锁定', 'locked')} ${treeHash(dest).slice(7, 15)}`);
187
+ ok(`${ctx.flags.dryRun ? '[dry-run] ' : ''}${L('已装', 'installed')} ${name} → ${mark || L('只进 hub', 'hub only')} · ${L('审核', 'audit')}:${auditTag(audit.stripped.length ? 'stripped' : audit.verdict)} · ${L('锁定', 'locked')} ${treeHash(dest).slice(7, 15)}`);
187
188
  return 0;
188
189
  }
@@ -10,7 +10,9 @@ export async function run(ctx) {
10
10
  const up = readUpstream(ctx.hub);
11
11
  const rows = [];
12
12
  let outdated = 0;
13
- for (const [name, s] of Object.entries(ctx.library.skills || {})) {
13
+ const all = ctx.library.skills || {};
14
+ const entries = ctx.args.length ? ctx.args.map((n) => [n, all[n]]).filter(([n, s]) => s ? true : warn(L(`没纳入管理: ${n}`, `not managed: ${n}`))) : Object.entries(all);
15
+ for (const [name, s] of entries) {
14
16
  const u = up.skills?.[name];
15
17
  const localDir = path.join(ctx.hub, 'skills', name);
16
18
  if (!u) {
@@ -8,7 +8,7 @@ import { L } from '../lib/i18n.js';
8
8
 
9
9
  export async function run(ctx) {
10
10
  const name = ctx.args[0];
11
- if (!name) { fail(L('用法: skillmkt pack <名字>', 'usage: skillmkt pack <name>')); return 1; }
11
+ if (!name || ctx.args.length > 1) { fail(L('用法: skillmkt pack <名字>', 'usage: skillmkt pack <name>')); return 1; }
12
12
  const src = path.join(ctx.hub, 'skills', name);
13
13
  if (!fs.existsSync(path.join(src, 'SKILL.md'))) { fail(L(`没纳入管理: ${name}`, `not managed: ${name}`)); return 1; }
14
14
  const ver = ctx.library.skills?.[name]?.version || '0.0.0';
@@ -1,6 +1,7 @@
1
1
  // registry — list / add --type <t> --url <u> [--token env:X] [--name n] / remove <name>
2
2
  import { readConfig, writeConfig } from '../lib/hub.js';
3
3
  import { table, ok, fail } from '../lib/render.js';
4
+ import { L } from '../lib/i18n.js';
4
5
 
5
6
  export async function run(ctx) {
6
7
  const [sub, ...rest] = ctx.args;
@@ -11,12 +12,13 @@ export async function run(ctx) {
11
12
  if (!sub || sub === 'list') {
12
13
  if (ctx.flags.json) { console.log(JSON.stringify(raw.registries, null, 2)); return 0; }
13
14
  table(raw.registries.map((r) => ({ type: r.type, name: r.name || '-', url: r.url || '-', default: r.default ? '●' : '', auth: r.token ? '●' : '' })),
14
- [{ key: 'type', title: 'type' }, { key: 'name', title: 'name' }, { key: 'url', title: 'url' }, { key: 'default', title: 'def' }, { key: 'auth', title: 'auth' }]);
15
+ [{ key: 'type', title: L('类型', 'type') }, { key: 'name', title: L('名字', 'name') }, { key: 'url', title: 'url' }, { key: 'default', title: L('默认', 'def') }, { key: 'auth', title: L('认证', 'auth') }]);
15
16
  return 0;
16
17
  }
17
18
 
18
19
  if (sub === 'add') {
19
20
  if (!flags.type) { fail(L('用法: registry add --type <github|rfc|clawhub|skillssh> [--url u] [--name n] [--token env:X]', 'usage: registry add --type <github|rfc|clawhub|skillssh> [--url u] [--name n] [--token env:X]')); return 1; }
21
+ if (!['github', 'rfc', 'clawhub', 'skillssh'].includes(flags.type)) { fail(L(`--type 只能是 github|rfc|clawhub|skillssh: ${flags.type}`, `--type must be github|rfc|clawhub|skillssh: ${flags.type}`)); return 1; }
20
22
  const entry = { type: flags.type };
21
23
  if (flags.url) entry.url = flags.url;
22
24
  if (flags.name) entry.name = flags.name;
@@ -10,8 +10,9 @@ import { L } from '../lib/i18n.js';
10
10
 
11
11
  export async function run(ctx) {
12
12
  const name = ctx.args[0];
13
- if (!name) { fail(L('用法: skillmkt remove <名字> [--purge] [--scope project]', 'usage: skillmkt remove <name> [--purge] [--scope project]')); return 1; }
13
+ if (!name || ctx.args.length > 1) { fail(L('用法: skillmkt remove <名字> [--purge] [--scope project](一次一个)', 'usage: skillmkt remove <name> [--purge] [--scope project] (one at a time)')); return 1; }
14
14
  const flags = ctx.flags.raw;
15
+ if (flags.scope && !['project', 'global'].includes(flags.scope)) { fail(L(`--scope 只能是 project|global: ${flags.scope}`, `--scope must be project|global: ${flags.scope}`)); return 1; }
15
16
  const entry = ctx.library.skills?.[name];
16
17
  if (!entry) { fail(L(`没纳入管理: ${name}`, `not managed: ${name}`)); return 1; }
17
18
 
@@ -41,8 +41,9 @@ export async function run(ctx) {
41
41
  }
42
42
  }
43
43
  const target = ctx.args[0] ? queue.filter((c) => c.id === ctx.args[0]) : queue;
44
+ if (ctx.args[0] && !target.length) { fail(L(`没有待裁决的冲突叫 ${ctx.args[0]}(可能已裁决过)`, `no pending conflict named ${ctx.args[0]} (maybe already resolved)`)); return 1; }
44
45
  if (!target.length) { info(L('没有待裁决的冲突', 'no pending conflicts')); return 0; }
45
- if (!process.stdin.isTTY || ctx.flags.raw.cli === false) { info(L(`${target.length} 个待裁决(这里不是交互终端)——终端跑 skillmkt resolve,或 skillmkt serve 开面板`, `${target.length} pending (not resolved without a TTY) — run skillmkt resolve interactively, or the web UI`)); return 3; }
46
+ if (!process.stdin.isTTY) { info(L(`${target.length} 个待裁决(这里不是交互终端)——终端跑 skillmkt resolve,或 skillmkt serve 开面板`, `${target.length} pending (not resolved without a TTY) — run skillmkt resolve interactively, or the web UI`)); return 3; }
46
47
 
47
48
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
48
49
  const ask = (q) => new Promise((r) => rl.question(q, r));
@@ -11,6 +11,7 @@ import { L } from '../lib/i18n.js';
11
11
 
12
12
  export async function run(ctx) {
13
13
  const name = ctx.args[0];
14
+ if (!name || ctx.args.length > 1) { fail(L('用法: skillmkt rollback <名字>', 'usage: skillmkt rollback <name>')); return 1; }
14
15
  const s = ctx.library.skills?.[name];
15
16
  if (!s) { fail(L(`没纳入管理: ${name}`, `not managed: ${name}`)); return 1; }
16
17
  if (!fs.existsSync(historyDir(ctx.hub, name))) { fail(L(`${name}: 无历史副本(upgrade 后才有一版深度)`, `${name}: no history copy (one version deep, only after upgrade)`)); return 1; }
@@ -1,4 +1,4 @@
1
- // search (find/f/s) — 本地优先两级检索;--remote 走 skills.sh 官方 API
1
+ // search (find/f/s) — npm 语义:默认只搜远端 skills.sh;--local 才查本地
2
2
  import { scanAll } from '../lib/scanner.js';
3
3
  import { searchRemote } from '../lib/registries/skillssh.js';
4
4
  import { table, info, warn } from '../lib/render.js';
@@ -6,17 +6,22 @@ import { L } from '../lib/i18n.js';
6
6
 
7
7
  export async function run(ctx) {
8
8
  const query = ctx.args.join(' ').trim();
9
- if (!query) { warn(L('用法: skillmkt search <关键词> [--local|--remote] [--json]', 'usage: skillmkt search <query> [--local|--remote] [--json]')); return 1; }
9
+ if (!query) { warn(L('用法: skillmkt search <关键词> [--local] [--json]', 'usage: skillmkt search <query> [--local] [--json]')); return 1; }
10
10
  const flags = ctx.flags.raw;
11
11
  const q = query.toLowerCase();
12
12
 
13
- // LOCAL:已装+external
14
- const rows = scanAll(ctx.hub, ctx.harnesses, ctx.library, ctx.project?.root);
15
- const local = rows.filter((r) => r.name.toLowerCase().includes(q) || (r.meta?.description || '').toLowerCase().includes(q));
13
+ // npm 对齐:默认远端;--local 只查本地;--local --remote 两个都出
14
+ const wantLocal = !!flags.local;
15
+ const wantRemote = !flags.local || !!flags.remote;
16
+
17
+ // LOCAL:已装+external(--local 时才扫)
18
+ let local = [];
19
+ if (wantLocal) {
20
+ const rows = scanAll(ctx.hub, ctx.harnesses, ctx.library, ctx.project?.root);
21
+ local = rows.filter((r) => r.name.toLowerCase().includes(q) || (r.meta?.description || '').toLowerCase().includes(q));
22
+ }
16
23
 
17
- // REMOTE:默认 TTY 附带;--remote 强制;--local 禁用
18
24
  let remote = { skills: [], base: null }, remoteErr = null;
19
- const wantRemote = flags.remote || (!flags.local && ctx.tty);
20
25
  if (wantRemote) {
21
26
  try { remote = await searchRemote(query, ctx); }
22
27
  catch (e) { remoteErr = e.message; }
@@ -27,21 +32,22 @@ export async function run(ctx) {
27
32
  return 0;
28
33
  }
29
34
 
30
- info(L('本地', 'LOCAL'));
31
- if (local.length) {
32
- table(local.map((r) => ({ name: r.name, where: `${r.where}${r.state === 'external' ? ` ${L('(未管理)', '(external)')}` : ''}`, ver: r.version, desc: (r.description || '').slice(0, 50) })),
33
- [{ key: 'name', title: 'skill' }, { key: 'where', title: L('位置', 'where') }, { key: 'ver', title: 'ver' }, { key: 'desc', title: L('说明', 'desc') }]);
34
- } else info(L(' (本地没匹配到)', ' (no local match)'));
35
+ if (wantLocal) {
36
+ info(L('本地', 'LOCAL'));
37
+ if (local.length) {
38
+ table(local.map((r) => ({ name: r.name, where: `${r.where}${r.state === 'external' ? ` ${L('(未管理)', '(external)')}` : ''}`, ver: r.version, desc: (r.description || '').slice(0, 50) })),
39
+ [{ key: 'name', title: 'skill' }, { key: 'where', title: L('位置', 'where') }, { key: 'ver', title: 'ver' }, { key: 'desc', title: L('说明', 'desc') }]);
40
+ } else info(L(' (本地没匹配到)', ' (no local match)'));
41
+ if (wantRemote) info('');
42
+ }
35
43
 
36
44
  if (wantRemote) {
37
- info('');
38
- info(L(`远端 ${remote.base || ''}`, `REMOTE ${remote.base || ''}`));
39
- if (remoteErr) warn(L(`远端搜索失败: ${remoteErr}(本地结果仍可用)`, `remote search failed: ${remoteErr} (local results still shown)`));
45
+ if (remoteErr) warn(L(`远端搜索失败: ${remoteErr}`, `remote search failed: ${remoteErr}`));
40
46
  else if (remote.skills.length) {
41
47
  table(remote.skills.slice(0, 15).map((s) => ({ name: s.name, id: s.slug, installs: s.installs })),
42
48
  [{ key: 'name', title: 'skill' }, { key: 'id', title: 'id' }, { key: 'installs', title: 'installs' }]);
43
49
  info(`→ skillmkt install ${remote.skills[0].slug.split('/').slice(0, 2).join('/')} --path ${remote.skills[0].slug.split('/').slice(2).join('/')}`);
44
- } else info(L(' (远端没匹配到)', ' (no remote match)'));
50
+ } else info(L('(远端没匹配到)', '(no remote match)'));
45
51
  }
46
52
  return 0;
47
53
  }
@@ -11,6 +11,8 @@ export async function run(ctx) {
11
11
  const name = ctx.args[0];
12
12
  if (!name) { fail(L('用法: skillmkt show <名字> [--raw|--files|--audit]', 'usage: skillmkt show <name> [--raw|--files|--audit]')); return 1; }
13
13
  const flags = ctx.flags.raw;
14
+ const modes = ['raw', 'files', 'audit'].filter((m) => flags[m]);
15
+ if (modes.length > 1) { fail(L(`--raw/--files/--audit 一次只能用一个`, '--raw/--files/--audit are mutually exclusive')); return 1; }
14
16
 
15
17
  // 受管 → hub;否则 external 中找
16
18
  let dir = path.join(ctx.hub, 'skills', name);
@@ -25,7 +25,7 @@ export async function run(ctx) {
25
25
  const avail = ctx.harnesses.filter((h) => h.state === 'available' && !h.detectOnly
26
26
  && !ctx.config.default_targets.includes(h.id));
27
27
  for (const h of avail) {
28
- if (await confirm(L(`检测到新 harness ${h.id}(available)——纳入默认投影目标?`, `New agent detected: ${h.id} (available) — add to default install locations?`), { defaultYes: false })) {
28
+ if (await confirm(L(`检测到新 agent ${h.id}(可装)——加入默认安装位置?`, `New agent detected: ${h.id} (available) — add to default install locations?`), { defaultYes: false })) {
29
29
  const raw = ctx.config._raw;
30
30
  raw.default_targets = [...new Set([...(raw.default_targets || []), h.id])];
31
31
  const { writeConfig } = await import('../lib/hub.js');
@@ -16,16 +16,17 @@ export async function run(ctx) {
16
16
  if ((!sub || sub === 'list') && !ctx.flags.json && await maybeHandoff(ctx, '/#skills')) return 0;
17
17
 
18
18
  if (!sub || sub === 'list') {
19
+ const stZh = { installed: '已装', available: '可装', likely: '疑似', absent: '没有', custom: '自定义' };
19
20
  const rows = ctx.harnesses.map((h) => ({
20
- id: h.id, state: h.state,
21
+ id: h.id, state: L(stZh[h.state] ?? h.state, h.state),
21
22
  dir: h.dirs.map((d) => d.path).join(', '),
22
23
  default: ctx.config.default_targets.includes(h.id) ? '●' : '',
23
24
  }));
24
- const customs = Object.entries(ctx.config.targets).map(([n, t]) => ({ id: n, state: 'custom', dir: expandHome(t.path), default: ctx.config.default_targets.includes(n) ? '●' : '' }));
25
+ const customs = Object.entries(ctx.config.targets).map(([n, t]) => ({ id: n, state: L('自定义', 'custom'), dir: expandHome(t.path), default: ctx.config.default_targets.includes(n) ? '●' : '' }));
25
26
  if (ctx.flags.json) { console.log(JSON.stringify({ harnesses: rows, custom: customs }, null, 2)); return 0; }
26
27
  table([...rows, ...customs], [
27
- { key: 'id', title: 'target' }, { key: 'state', title: 'state' },
28
- { key: 'dir', title: 'dir' }, { key: 'default', title: 'def' },
28
+ { key: 'id', title: L('目标', 'target') }, { key: 'state', title: L('状态', 'state') },
29
+ { key: 'dir', title: L('目录', 'dir') }, { key: 'default', title: L('默认', 'def') },
29
30
  ]);
30
31
  return 0;
31
32
  }
@@ -4,12 +4,13 @@ import fs from 'node:fs';
4
4
  import { remoteTree } from '../lib/registries/github.js';
5
5
  import { setUpstream, readUpstream, writeUpstream } from '../lib/state.js';
6
6
  import { gitTreeHash } from '../lib/githash.js';
7
- import { ok, warn, info } from '../lib/render.js';
7
+ import { ok, warn, info, fail } from '../lib/render.js';
8
8
  import { L } from '../lib/i18n.js';
9
9
 
10
10
  export async function run(ctx) {
11
11
  const skills = ctx.library.skills || {};
12
- const names = ctx.args[0] === '--all' || !ctx.args[0] ? Object.keys(skills) : ctx.args;
12
+ if (ctx.flags.raw.all && ctx.args.length) { fail(L('--all 和指定名字只能二选一', '--all and specific names are mutually exclusive')); return 1; }
13
+ const names = ctx.flags.raw.all || !ctx.args.length ? Object.keys(skills) : ctx.args;
13
14
  let n = 0, na = 0, errs = 0;
14
15
  for (const name of names) {
15
16
  const s = skills[name];
@@ -26,6 +26,7 @@ export async function run(ctx) {
26
26
  const flags = ctx.flags.raw;
27
27
  const up = readUpstream(ctx.hub);
28
28
  const skills = ctx.library.skills || {};
29
+ if (flags.all && ctx.args.length) { fail(L('--all 和指定名字只能二选一', '--all and specific names are mutually exclusive')); return 1; }
29
30
  const names = flags.all ? Object.keys(skills) : ctx.args;
30
31
  if (!names.length) { fail(L('用法: skillmkt upgrade <名字|--all>', 'usage: skillmkt upgrade <name|--all>')); return 1; }
31
32
 
package/client/lib/ctx.js CHANGED
@@ -5,7 +5,7 @@ import { resolveLLM } from './llm.js';
5
5
  import { setUILang } from './i18n.js';
6
6
 
7
7
  const VALUE_FLAGS = new Set(['hub', 'base-url', 'model', 'api-key-env', 'from', 'to', 'target', 'scope', 'path', 'registry', 'name', 'resolution', 'reason', 'custom', 'port', 'project', 'type', 'url', 'token', 'out', 'limit']);
8
- const BOOL_FLAGS = new Set(['json', 'verbose', 'no-llm', 'dry-run', 'ui', 'cli', 'no-ui', 'yes', 'y', 'help', 'h', 'version', 'V', 'force', 'all', 'llm', 'semantic', 'raw', 'files', 'rules', 'audit-only', 'purge', 'link', 'remote', 'local', 'wait', 'stop', 'daemon', 'keep-scripts', 'report', 'check', 'once']);
8
+ const BOOL_FLAGS = new Set(['json', 'verbose', 'no-llm', 'dry-run', 'ui', 'cli', 'no-ui', 'yes', 'y', 'help', 'h', 'version', 'V', 'force', 'all', 'llm', 'semantic', 'raw', 'files', 'rules', 'audit-only', 'purge', 'link', 'remote', 'local', 'wait', 'stop', 'daemon', 'keep-scripts', 'report', 'check', 'once', 'scan', 'evidence', 'auto']);
9
9
 
10
10
  export function parseArgv(argv) {
11
11
  const flags = {};
@@ -25,6 +25,9 @@ export function parseArgv(argv) {
25
25
 
26
26
  const camel = (s) => s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
27
27
 
28
+ // 已知 flag 全集(kebab→camel 后比对)——bin 用它对打错的 flag 报警
29
+ export const KNOWN_FLAGS = new Set([...VALUE_FLAGS, ...BOOL_FLAGS].map(camel));
30
+
28
31
  function normalizeFlags(f) {
29
32
  return {
30
33
  json: !!f.json,
@@ -87,7 +87,7 @@ export function resolveTargets(ctx, { allowAdopted = null } = {}) {
87
87
  const custom = ctx.config.targets[id];
88
88
  if (custom) { out.push({ id: `custom:${path.resolve(expandTilde(custom.path))}`, dir: path.resolve(expandTilde(custom.path)), mode: custom.transport === 'link' ? 'link' : 'copy' }); continue; }
89
89
  const h = ctx.harnesses.find((x) => x.id === id);
90
- if (!h) { if (ids) throw new Error(`unknown target: ${id}`); continue; }
90
+ if (!h) { if (ids) throw new Error(L(`未知目标: ${id}`, `unknown target: ${id}`)); continue; }
91
91
  const dir = primaryDir(h);
92
92
  if (dir) out.push({ id, dir, mode: 'copy' });
93
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skillmkt",
3
- "version": "0.4.28",
3
+ "version": "0.4.29",
4
4
  "type": "module",
5
5
  "description": "Local-first agent skill manager: install, audit, merge, distribute.",
6
6
  "license": "MIT",