skillmkt 0.4.24 → 0.4.26
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/client/bin/skillmkt.js +1 -1
- package/client/commands/audit.js +6 -6
- package/client/commands/build.js +2 -2
- package/client/commands/config.js +3 -3
- package/client/commands/conflicts.js +3 -2
- package/client/commands/decide.js +4 -4
- package/client/commands/diff.js +7 -7
- package/client/commands/doctor.js +16 -16
- package/client/commands/download.js +4 -4
- package/client/commands/init.js +2 -2
- package/client/commands/install.js +11 -10
- package/client/commands/list.js +5 -4
- package/client/commands/merge.js +6 -6
- package/client/commands/outdated.js +6 -6
- package/client/commands/pack.js +3 -3
- package/client/commands/publish.js +1 -1
- package/client/commands/registry.js +5 -5
- package/client/commands/remove.js +7 -7
- package/client/commands/resolve.js +12 -12
- package/client/commands/rollback.js +2 -2
- package/client/commands/search.js +6 -6
- package/client/commands/serve.js +3 -3
- package/client/commands/show.js +10 -9
- package/client/commands/sync.js +7 -7
- package/client/commands/targets.js +9 -9
- package/client/commands/update.js +3 -3
- package/client/commands/upgrade.js +9 -9
- package/client/lib/render.js +12 -5
- package/package.json +1 -1
package/client/bin/skillmkt.js
CHANGED
|
@@ -81,7 +81,7 @@ async function main() {
|
|
|
81
81
|
mod = await import(`../commands/${name}.js`);
|
|
82
82
|
} catch (e) {
|
|
83
83
|
if (e.code === 'ERR_MODULE_NOT_FOUND') {
|
|
84
|
-
console.error(`${name}: not implemented yet`);
|
|
84
|
+
console.error(`${name}: ${L('还没实现', 'not implemented yet')}`);
|
|
85
85
|
process.exit(1);
|
|
86
86
|
}
|
|
87
87
|
throw e;
|
package/client/commands/audit.js
CHANGED
|
@@ -4,19 +4,19 @@ import fs from 'node:fs';
|
|
|
4
4
|
import { auditDir, writeScan } from '../lib/audit.js';
|
|
5
5
|
import { llmAudit } from '../lib/ai.js';
|
|
6
6
|
import { walk } from '../lib/package.js';
|
|
7
|
-
import { ok, warn, fail, info } from '../lib/render.js';
|
|
7
|
+
import { ok, warn, fail, info, auditTag } from '../lib/render.js';
|
|
8
8
|
import { L } from '../lib/i18n.js';
|
|
9
9
|
|
|
10
10
|
export async function run(ctx) {
|
|
11
11
|
const flags = ctx.flags.raw;
|
|
12
12
|
const skills = ctx.library.skills || {};
|
|
13
13
|
const names = flags.all ? Object.keys(skills) : ctx.args;
|
|
14
|
-
if (!names.length) { fail('usage: skillmkt audit <name|--all> [--llm]'); return 1; }
|
|
14
|
+
if (!names.length) { fail(L('用法: skillmkt audit <名字|--all> [--llm]', 'usage: skillmkt audit <name|--all> [--llm]')); return 1; }
|
|
15
15
|
let worst = 'clean';
|
|
16
16
|
const order = { clean: 0, suspicious: 1, stripped: 1, malicious: 2 };
|
|
17
17
|
for (const name of names) {
|
|
18
18
|
const dir = path.join(ctx.hub, 'skills', name);
|
|
19
|
-
if (!fs.existsSync(dir)) { warn(L(
|
|
19
|
+
if (!fs.existsSync(dir)) { warn(L(`没纳入管理: ${name}`, `not managed: ${name}`)); continue; }
|
|
20
20
|
const r = auditDir(dir, { strip: false });
|
|
21
21
|
// --llm:additive 语义审(静态结论之上,降级安全)
|
|
22
22
|
if (flags.llm && ctx.llm) {
|
|
@@ -24,12 +24,12 @@ export async function run(ctx) {
|
|
|
24
24
|
.map((p) => ({ path: path.relative(dir, p), content: fs.readFileSync(p, 'utf8') }));
|
|
25
25
|
const lr = await llmAudit(ctx.llm, { name, files }).catch(() => null);
|
|
26
26
|
if (lr) { r.llm = lr; info(` llm: ${lr.verdict}${lr.reasons?.length ? ` — ${lr.reasons.join('; ')}` : ''}`); }
|
|
27
|
-
else warn(L('
|
|
27
|
+
else warn(L(' LLM 审核不可用——沿用静态检查结论', ' llm audit unavailable — keeping static verdict'));
|
|
28
28
|
}
|
|
29
29
|
writeScan(ctx.hub, name, r);
|
|
30
30
|
if (order[r.verdict] > order[worst]) worst = r.verdict;
|
|
31
|
-
info(`${name}: ${r.verdict}${r.findings.length ? ` (${r.findings.length} findings)` : ''}`);
|
|
31
|
+
info(`${name}: ${auditTag(r.verdict)}${r.findings.length ? L(`(${r.findings.length} 处发现)`, ` (${r.findings.length} findings)`) : ''}`);
|
|
32
32
|
}
|
|
33
|
-
ok('audit done');
|
|
33
|
+
ok(L('审核完成', 'audit done'));
|
|
34
34
|
return worst === 'malicious' ? 2 : 0;
|
|
35
35
|
}
|
package/client/commands/build.js
CHANGED
|
@@ -52,11 +52,11 @@ export async function run(ctx) {
|
|
|
52
52
|
if (ctx.flags.raw.check) {
|
|
53
53
|
const f = path.join(outDir, 'SKILL.md');
|
|
54
54
|
const same = fs.existsSync(f) && fs.readFileSync(f, 'utf8') === md;
|
|
55
|
-
console.log(same ? 'build --check: ok' : 'build --check: STALE');
|
|
55
|
+
console.log(same ? L('build --check: 一致', 'build --check: ok') : L('build --check: 已过期——先跑 skillmkt build', 'build --check: STALE'));
|
|
56
56
|
return same ? 0 : 1;
|
|
57
57
|
}
|
|
58
58
|
fs.mkdirSync(outDir, { recursive: true });
|
|
59
59
|
fs.writeFileSync(path.join(outDir, 'SKILL.md'), md);
|
|
60
|
-
ok(`built ${outDir}/SKILL.md — ${kept.length} rules
|
|
60
|
+
ok(L(`已生成 ${outDir}/SKILL.md——${kept.length} 条规则`, `built ${outDir}/SKILL.md — ${kept.length} rules`) + (pending ? L(`,⚠ ${pending} 个待裁决冲突两边都没收`, ` — ⚠ ${pending} pending conflicts, both sides excluded`) : ''));
|
|
61
61
|
return pending ? 3 : 0;
|
|
62
62
|
}
|
|
@@ -10,13 +10,13 @@ export async function run(ctx) {
|
|
|
10
10
|
|
|
11
11
|
if (sub === 'get') {
|
|
12
12
|
const v = getConfigKey(raw, key);
|
|
13
|
-
if (v === undefined) { fail(`unknown key: ${key}`); return 1; }
|
|
13
|
+
if (v === undefined) { fail(L(`未知配置键: ${key}`, `unknown key: ${key}`)); return 1; }
|
|
14
14
|
console.log(typeof v === 'object' ? YAML.stringify(v).trim() : String(v));
|
|
15
15
|
return 0;
|
|
16
16
|
}
|
|
17
17
|
if (sub === 'set') {
|
|
18
18
|
const value = rest.join(' ');
|
|
19
|
-
if (!key || value === '') { fail('usage: config set <key> <value>'); return 1; }
|
|
19
|
+
if (!key || value === '') { fail(L('用法: config set <键> <值>', 'usage: config set <key> <value>')); return 1; }
|
|
20
20
|
// 数字/布尔/JSON 智能转型
|
|
21
21
|
let v = value;
|
|
22
22
|
try { v = JSON.parse(value); } catch { /* string */ }
|
|
@@ -29,6 +29,6 @@ export async function run(ctx) {
|
|
|
29
29
|
console.log(YAML.stringify(raw).trim() || '# empty');
|
|
30
30
|
return 0;
|
|
31
31
|
}
|
|
32
|
-
fail('usage: skillmkt config [list] | get <key> | set <key> <value>');
|
|
32
|
+
fail(L('用法: skillmkt config [list] | get <键> | set <键> <值>', 'usage: skillmkt config [list] | get <key> | set <key> <value>'));
|
|
33
33
|
return 1;
|
|
34
34
|
}
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
import { loadConflicts } from '../lib/conflicts.js';
|
|
3
3
|
import { maybeHandoff } from '../lib/daemon.js';
|
|
4
4
|
import { table } from '../lib/render.js';
|
|
5
|
+
import { L } from '../lib/i18n.js';
|
|
5
6
|
|
|
6
7
|
export async function run(ctx) {
|
|
7
8
|
const all = loadConflicts(ctx.hub);
|
|
8
9
|
if (!ctx.flags.json && all.some((c) => c.status === 'pending') && await maybeHandoff(ctx, '/#conflicts')) return 0;
|
|
9
10
|
const pending = all.filter((c) => c.status === 'pending');
|
|
10
11
|
if (ctx.flags.json) { console.log(JSON.stringify(all, null, 2)); return pending.length ? 3 : 0; }
|
|
11
|
-
if (!all.length) { console.log('no conflicts recorded — run: skillmkt merge <a> <b>'); return 0; }
|
|
12
|
+
if (!all.length) { console.log(L('没有冲突记录——先跑 skillmkt merge <a> <b> 生成', 'no conflicts recorded — run: skillmkt merge <a> <b>')); return 0; }
|
|
12
13
|
table(all.map((c) => ({ id: c.id, status: c.status, domain: c.domain || '-', A: `${c.sides[0].source}:${c.sides[0].hash}`, B: `${c.sides[1].source}:${c.sides[1].hash}` })),
|
|
13
14
|
[{ key: 'id', title: 'id' }, { key: 'status', title: 'status' }, { key: 'domain', title: 'domain' }, { key: 'A', title: 'A' }, { key: 'B', title: 'B' }]);
|
|
14
|
-
if (pending.length) console.log(`\n${pending.length} pending — skillmkt resolve`);
|
|
15
|
+
if (pending.length) console.log(L(`\n${pending.length} 个待裁决——跑 skillmkt resolve`, `\n${pending.length} pending — run skillmkt resolve`));
|
|
15
16
|
return pending.length ? 3 : 0;
|
|
16
17
|
}
|
|
@@ -7,14 +7,14 @@ 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('usage: skillmkt decide <conf-id> --resolution keep-a|keep-b|merge|dismissed --reason "…" [--custom text]'); return 1; }
|
|
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; }
|
|
11
11
|
const c = loadConflicts(ctx.hub).find((x) => x.id === id);
|
|
12
|
-
if (!c) { fail(`not found: ${id}`); return 1; }
|
|
13
|
-
if (!['keep-a', 'keep-b', 'merge', 'dismissed'].includes(resolution)) { fail(`bad resolution: ${resolution}`); return 1; }
|
|
12
|
+
if (!c) { fail(L(`没找到: ${id}`, `not found: ${id}`)); return 1; }
|
|
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; }
|
|
14
14
|
if (resolution === 'merge' && !custom) { fail(L('resolution=merge 需要 --custom 提供合并文本', 'resolution=merge needs --custom with the merged text')); return 1; }
|
|
15
15
|
decide(ctx.hub, c, { resolution, custom, reason, by: process.env.USER || 'cli' });
|
|
16
16
|
c.status = 'resolved';
|
|
17
17
|
writeConflict(ctx.hub, c);
|
|
18
|
-
ok(`${id} → ${resolution}`);
|
|
18
|
+
ok(`${id} → ${L({ 'keep-a': '选了A', 'keep-b': '选了B', merge: '合并', dismissed: '不算冲突' }[resolution] ?? resolution, resolution)}`);
|
|
19
19
|
return 0;
|
|
20
20
|
}
|
package/client/commands/diff.js
CHANGED
|
@@ -18,7 +18,7 @@ function sectionsOf(dir) {
|
|
|
18
18
|
export async function run(ctx) {
|
|
19
19
|
const name = ctx.args[0];
|
|
20
20
|
const s = ctx.library.skills?.[name];
|
|
21
|
-
if (!s) { fail(L(
|
|
21
|
+
if (!s) { fail(L(`没纳入管理: ${name}`, `not managed: ${name}`)); return 1; }
|
|
22
22
|
const src = s.source || {};
|
|
23
23
|
if (src.registry !== 'github' || !src.ref) { fail(L(`${name}: 无上游可比`, `${name}: no upstream to diff against`)); return 1; }
|
|
24
24
|
|
|
@@ -40,14 +40,14 @@ export async function run(ctx) {
|
|
|
40
40
|
const report = { name, sha: got.sha, files: { added, removed, changed }, sections: { added: secAdded, removed: secRemoved } };
|
|
41
41
|
if (ctx.flags.json) { console.log(JSON.stringify(report, null, 2)); return 0; }
|
|
42
42
|
|
|
43
|
-
info(`${name}: pin ${src.pin?.slice(0, 7) ?? '-'} → upstream ${got.sha.slice(0, 7)}`);
|
|
44
|
-
info(
|
|
45
|
-
if (secAdded.length) info(
|
|
46
|
-
if (secRemoved.length) info(
|
|
43
|
+
info(`${name}: pin ${src.pin?.slice(0, 7) ?? '-'} → ${L('上游', 'upstream')} ${got.sha.slice(0, 7)}`);
|
|
44
|
+
info(`${L('文件', 'files')}: +${added.length} -${removed.length} ~${changed.length}`);
|
|
45
|
+
if (secAdded.length) info(`${L('新增小节', 'sections +')}: ${secAdded.join(' | ')}`);
|
|
46
|
+
if (secRemoved.length) info(`${L('删掉的小节', 'sections -')}: ${secRemoved.join(' | ')}`);
|
|
47
47
|
if (ctx.flags.raw.semantic) {
|
|
48
|
-
if (!ctx.llm) { warn(L('--semantic 需要 LLM
|
|
48
|
+
if (!ctx.llm) { warn(L('--semantic 需要 LLM——先跑 skillmkt init;上面是结构 diff', '--semantic needs an LLM — run skillmkt init; structural diff shown above')); return 0; }
|
|
49
49
|
const summary = await semanticDiff(ctx.llm, { name, added, removed, changed, secAdded, secRemoved }).catch(() => null);
|
|
50
|
-
info(summary ? `semantic: ${summary}` : L('semantic: LLM
|
|
50
|
+
info(summary ? `semantic: ${summary}` : L('semantic: LLM 不可用——上面是结构 diff', 'semantic: LLM unavailable — structural diff above'));
|
|
51
51
|
}
|
|
52
52
|
return 0;
|
|
53
53
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// doctor — 环境健康检查(npm doctor 语义 + flutter 式工具链矩阵)
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import { ok, warn, fail, info } from '../lib/render.js';
|
|
4
|
+
import { ok, warn, fail, info, pad } from '../lib/render.js';
|
|
5
5
|
import { hubExists } from '../lib/hub.js';
|
|
6
6
|
import { scanSkillDir } from '../lib/scanner.js';
|
|
7
7
|
import { readSkillDir, treeHash } from '../lib/package.js';
|
|
@@ -55,20 +55,20 @@ export async function run(ctx) {
|
|
|
55
55
|
const exists = hubExists(ctx.hub);
|
|
56
56
|
let writable = false;
|
|
57
57
|
try { fs.mkdirSync(ctx.hub, { recursive: true }); fs.accessSync(ctx.hub, fs.constants.W_OK); writable = true; } catch {}
|
|
58
|
-
say(writable, `hub ${ctx.hub} ${exists ? '' : '(
|
|
58
|
+
say(writable, `hub ${ctx.hub} ${exists ? '' : L('(空目录)', '(empty) ')}${writable ? L('(可写)', '(writable)') : L('(不可写!)', '(NOT WRITABLE)')}`);
|
|
59
59
|
|
|
60
60
|
// harness 矩阵
|
|
61
61
|
const hrows = [];
|
|
62
62
|
for (const h of ctx.harnesses) {
|
|
63
63
|
const dir = h.dirs.find((d) => d.exists) ?? h.dirs[0];
|
|
64
64
|
const skills = dir?.exists ? scanSkillDir(dir.path).length : 0;
|
|
65
|
-
const note = h.detectOnly ? 'detect-only' : h.state === 'available' ? 'bin only — dir will create'
|
|
66
|
-
: h.state === 'likely' ? L('
|
|
65
|
+
const note = h.detectOnly ? L('只探测不投影', 'detect-only') : h.state === 'available' ? L('只有 CLI——目录装 skill 时自动建', 'bin only — dir will create')
|
|
66
|
+
: h.state === 'likely' ? L('只有目录——没找到 CLI', 'dir only — no CLI found') : h.state === 'absent' ? '' : `${skills} skills`;
|
|
67
67
|
hrows.push({ id: h.id, dir: dir?.path ?? '-', state: h.state, note });
|
|
68
68
|
}
|
|
69
69
|
const hInstalled = hrows.filter((r) => r.state === 'installed').length;
|
|
70
|
-
say(hInstalled > 0 || hrows.some((r) => r.state !== 'absent'), 'harnesses detected:');
|
|
71
|
-
for (const r of hrows) info(`${r.id.padEnd(12)} ${r.dir.padEnd(34)} ${r.state.
|
|
70
|
+
say(hInstalled > 0 || hrows.some((r) => r.state !== 'absent'), L('检测到 agent:', 'harnesses detected:'));
|
|
71
|
+
for (const r of hrows) info(`${r.id.padEnd(12)} ${r.dir.padEnd(34)} ${pad(L({ installed: '已装', available: '可装', likely: '疑似', absent: '没有' }[r.state] ?? r.state, r.state), 10)} ${r.note}`);
|
|
72
72
|
|
|
73
73
|
// registries 连通
|
|
74
74
|
const regs = ctx.config.registries;
|
|
@@ -78,33 +78,33 @@ export async function run(ctx) {
|
|
|
78
78
|
let gh = true;
|
|
79
79
|
try { execFileSync('gh', ['--version'], { stdio: 'ignore' }); } catch { gh = false; }
|
|
80
80
|
regNotes.push(`github${r.default ? ' (default)' : ''}${gh ? '' : ' — gh CLI missing!'}`);
|
|
81
|
-
if (!gh) say('warn', 'registry github: gh CLI not found');
|
|
81
|
+
if (!gh) say('warn', L('registry github: 没找到 gh 命令', 'registry github: gh CLI not found'));
|
|
82
82
|
} else if (r.url) {
|
|
83
83
|
const code = await ping(r.url);
|
|
84
|
-
regNotes.push(`${r.type} ${r.url}${code ? '' : ' — unreachable'}`);
|
|
85
|
-
if (!code) say('warn', `registry ${r.type} ${r.url}: unreachable`);
|
|
84
|
+
regNotes.push(`${r.type} ${r.url}${code ? '' : L(' — 连不上', ' — unreachable')}`);
|
|
85
|
+
if (!code) say('warn', L(`registry ${r.type} ${r.url}: 连不上`, `registry ${r.type} ${r.url}: unreachable`));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
say(regNotes.length > 0, `registries: ${regNotes.join(', ') || 'none'}`);
|
|
88
|
+
say(regNotes.length > 0, `registries: ${regNotes.join(', ') || L('(无)', 'none')}`);
|
|
89
89
|
|
|
90
90
|
// llm 已配状态(不探端口——探测只在 init/config)
|
|
91
|
-
if (ctx.llm) say(true, `llm configured: ${ctx.llm.model} @ ${ctx.llm.base_url}`);
|
|
91
|
+
if (ctx.llm) say(true, L(`llm 已配置: ${ctx.llm.model} @ ${ctx.llm.base_url}`, `llm configured: ${ctx.llm.model} @ ${ctx.llm.base_url}`));
|
|
92
92
|
else {
|
|
93
|
-
say('warn', L('llm
|
|
93
|
+
say('warn', L('llm 未配置——LLM 功能停用(audit/conflicts/diff 退为静态检查)', 'llm not configured — LLM features disabled (audit/conflicts/diff fall back to static)'));
|
|
94
94
|
info(L('→ 跑 skillmkt init 一键配置', '→ run skillmkt init for one-step setup'));
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// drift
|
|
98
98
|
const drift = exists ? driftCheck(ctx) : [];
|
|
99
|
-
if (drift.length) say('warn', `projection drift: ${drift.length} (run: skillmkt sync)`);
|
|
100
|
-
else if (exists) say(true, 'projections in sync');
|
|
99
|
+
if (drift.length) say('warn', L(`投影漂移 ${drift.length} 处(跑 skillmkt sync 修)`, `projection drift: ${drift.length} (run: skillmkt sync)`));
|
|
100
|
+
else if (exists) say(true, L('投影一致', 'projections in sync'));
|
|
101
101
|
|
|
102
102
|
const bad = checks.filter((c) => c.ok === false).length;
|
|
103
103
|
const warns = checks.filter((c) => c.ok === 'warn').length;
|
|
104
104
|
if (ctx.flags.json) {
|
|
105
105
|
console.log(JSON.stringify({ node: process.versions.node, hub: ctx.hub, harnesses: hrows, drift, checks, ok: bad === 0 }, null, 2));
|
|
106
106
|
}
|
|
107
|
-
if (bad) { fail(`${bad} check(s) failed`); return 1; }
|
|
108
|
-
if (warns) info(`${warns} warning(s)`);
|
|
107
|
+
if (bad) { fail(L(`${bad} 项检查没过`, `${bad} check(s) failed`)); return 1; }
|
|
108
|
+
if (warns) info(L(`${warns} 个警告`, `${warns} warning(s)`));
|
|
109
109
|
return 0;
|
|
110
110
|
}
|
|
@@ -5,12 +5,12 @@ import { fetchRef } from '../lib/registries/index.js';
|
|
|
5
5
|
import { auditDir, writeScan } from '../lib/audit.js';
|
|
6
6
|
import { readSkillDir, copyDir, rmDir } from '../lib/package.js';
|
|
7
7
|
import { ensureHub, cacheDir, quarantinePath } from '../lib/hub.js';
|
|
8
|
-
import { ok, warn, fail } from '../lib/render.js';
|
|
8
|
+
import { ok, warn, fail, auditTag } from '../lib/render.js';
|
|
9
9
|
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('usage: skillmkt download <
|
|
13
|
+
if (!input) { fail(L('用法: skillmkt download <owner/repo 或 skills.sh slug>', 'usage: skillmkt download <owner/repo or skills.sh slug>')); 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
|
|
|
@@ -22,7 +22,7 @@ export async function run(ctx) {
|
|
|
22
22
|
const audit = auditDir(got.dir, { strip: !ctx.flags.raw.keepScripts });
|
|
23
23
|
if (audit.verdict === 'malicious') {
|
|
24
24
|
if (!ctx.flags.dryRun) { rmDir(quarantinePath(ctx.hub, pkg.name)); copyDir(got.dir, quarantinePath(ctx.hub, pkg.name)); writeScan(ctx.hub, pkg.name, audit); }
|
|
25
|
-
warn(`malicious — quarantined: ${pkg.name}`);
|
|
25
|
+
warn(L(`判定为恶意——已隔离: ${pkg.name}`, `malicious — quarantined: ${pkg.name}`));
|
|
26
26
|
return 2;
|
|
27
27
|
}
|
|
28
28
|
const dest = cacheDir(ctx.hub, pkg.name, got.sha || pkg.contentHash);
|
|
@@ -31,6 +31,6 @@ export async function run(ctx) {
|
|
|
31
31
|
copyDir(got.dir, dest);
|
|
32
32
|
writeScan(ctx.hub, pkg.name, audit);
|
|
33
33
|
}
|
|
34
|
-
ok(`${ctx.flags.dryRun ? '[dry-run] ' : ''}downloaded ${pkg.name}
|
|
34
|
+
ok(`${ctx.flags.dryRun ? '[dry-run] ' : ''}${L('已下载进缓存', 'downloaded to cache')} ${pkg.name}(${L(`${pkg.fileCount} 个文件,审核:${auditTag(audit.verdict)}`, `${pkg.fileCount} files, audit:${audit.verdict}`)})`);
|
|
35
35
|
return 0;
|
|
36
36
|
}
|
package/client/commands/init.js
CHANGED
|
@@ -18,7 +18,7 @@ export async function run(ctx) {
|
|
|
18
18
|
let mode = ctx.flags.ui === 'force' ? 'web' : ctx.flags.ui === 'off' ? 'cli' : null;
|
|
19
19
|
while (!mode) {
|
|
20
20
|
const sel = await choose(L('初始化方式?', 'Init method?'), [
|
|
21
|
-
{ label: L('Web 面板(推荐——探测结果、模型列表、
|
|
21
|
+
{ label: L('Web 面板(推荐——探测结果、模型列表、agent 勾选可视化)', 'Web panel (recommended — visual probe results, model list, agent checkboxes)'), v: 'web' },
|
|
22
22
|
{ label: L('终端向导(纯键盘,SSH/无浏览器环境)', 'Terminal wizard (keyboard-only, for SSH/no-browser setups)'), v: 'cli' },
|
|
23
23
|
{ label: L('切换语言 / Switch language', 'Switch language / 切换语言'), v: 'lang' },
|
|
24
24
|
]);
|
|
@@ -136,7 +136,7 @@ export async function run(ctx) {
|
|
|
136
136
|
// 冒烟:真实 chat 调用
|
|
137
137
|
try {
|
|
138
138
|
const reply = await chat({ base_url, model, api_key: keyPlain, timeout_ms: 15000 }, { user: 'Reply with exactly: OK', maxTokens: 64 });
|
|
139
|
-
ok(`llm smoke: ${reply.trim().slice(0, 40) || '(empty reply)'}`);
|
|
139
|
+
ok(L(`llm 冒烟: ${reply.trim().slice(0, 40) || '(空回复)'}`, `llm smoke: ${reply.trim().slice(0, 40) || '(empty reply)'}`));
|
|
140
140
|
} catch (e) {
|
|
141
141
|
warn(L(`llm smoke failed: ${e.message}(配置已写入,功能将降级)`, `llm smoke failed: ${e.message} (config saved; features will degrade)`));
|
|
142
142
|
}
|
|
@@ -57,7 +57,7 @@ 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('usage: skillmkt install <ref|path|owner/repo>'); return 1; }
|
|
60
|
+
if (!input) { fail(L('用法: skillmkt install <ref|路径|owner/repo>', 'usage: skillmkt install <ref|path|owner/repo>')); return 1; }
|
|
61
61
|
const flags = ctx.flags.raw;
|
|
62
62
|
|
|
63
63
|
const ref = parseRef(input, flags, { harnesses: ctx.harnesses, registries: ctx.config.registries });
|
|
@@ -76,11 +76,11 @@ export async function run(ctx) {
|
|
|
76
76
|
// download 缓存命中:cache/<name>-*/ 存在即复用不重复拉
|
|
77
77
|
const cached = ref.kind === 'named' ? cacheLookup(ctx.hub, ref.name) : null;
|
|
78
78
|
if (cached) {
|
|
79
|
-
info(`cache hit: ${cached}`);
|
|
79
|
+
info(L(`缓存命中: ${cached}`, `cache hit: ${cached}`));
|
|
80
80
|
srcDir = cached;
|
|
81
81
|
provenance = { registry: 'cache', adopted_from: cached };
|
|
82
82
|
} else {
|
|
83
|
-
info(`fetching ${input} …`);
|
|
83
|
+
info(L(`正在拉取 ${input} …`, `fetching ${input} …`));
|
|
84
84
|
const got = await fetchRef(ref, ctx);
|
|
85
85
|
srcDir = got.dir; tmp = got.tmp;
|
|
86
86
|
provenance = got.provenance;
|
|
@@ -99,15 +99,15 @@ export async function run(ctx) {
|
|
|
99
99
|
copyDir(srcDir, quarantinePath(ctx.hub, name));
|
|
100
100
|
writeScan(ctx.hub, name, audit);
|
|
101
101
|
}
|
|
102
|
-
fail(`malicious — quarantined: ${name}
|
|
102
|
+
fail(L(`判定为恶意——已隔离: ${name}(${audit.findings.length} 处发现)`, `malicious — quarantined: ${name} (${audit.findings.length} findings)`));
|
|
103
103
|
return 2;
|
|
104
104
|
}
|
|
105
105
|
if (audit.verdict === 'suspicious' && ctx.config.policy !== 'permissive') {
|
|
106
|
-
warn(`suspicious: ${audit.findings.length} findings${audit.stripped.length ? `, stripping ${audit.stripped.length} files` : ''}`);
|
|
106
|
+
warn(L(`可疑:发现 ${audit.findings.length} 处${audit.stripped.length ? `,已剔除 ${audit.stripped.length} 个文件` : ''}`, `suspicious: ${audit.findings.length} findings${audit.stripped.length ? `, stripping ${audit.stripped.length} files` : ''}`));
|
|
107
107
|
audit.findings.slice(0, 5).forEach((f) => info(`${f.rule} ${f.file}:${f.line} — ${f.excerpt.slice(0, 80)}`));
|
|
108
108
|
// --yes 不放大 suspicious(安全默认);strict 直接拒
|
|
109
109
|
const proceed = ctx.config.policy === 'strict' ? false : await confirm(L(`继续安装 ${name}?`, `Install ${name} anyway?`), { defaultYes: false });
|
|
110
|
-
if (!proceed) { fail('install aborted'); return 2; }
|
|
110
|
+
if (!proceed) { fail(L('已取消', 'install aborted')); return 2; }
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
// ③ 落 hub(stripped 过滤)
|
|
@@ -119,7 +119,7 @@ export async function run(ctx) {
|
|
|
119
119
|
// 与现有 hub 副本内容对比:相同则跳过 copy
|
|
120
120
|
const srcFilteredHash = (() => { const t = path.join(ctx.hub, 'cache', `__probe_${process.pid}`); rmDir(t); copyFiltered(srcDir, t, keep); const h = treeHash(t); rmDir(t); return h; })();
|
|
121
121
|
if (srcFilteredHash !== freshHash() && !flags.force) {
|
|
122
|
-
warn(L(`${name}
|
|
122
|
+
warn(L(`${name} 已在管理、但内容不同——--force 覆盖,或走 skillmkt upgrade`, `${name} already managed with different content — --force to overwrite, or use upgrade`));
|
|
123
123
|
return 1;
|
|
124
124
|
}
|
|
125
125
|
}
|
|
@@ -160,7 +160,7 @@ export async function run(ctx) {
|
|
|
160
160
|
lockEntry: lockT ? { hash: lockT.hash } : null,
|
|
161
161
|
});
|
|
162
162
|
results.push({ ...r, id: t.id });
|
|
163
|
-
if (r.action === 'conflict') warn(`${name} → ${t.dir}: ${
|
|
163
|
+
if (r.action === 'conflict') warn(`${name} → ${t.dir}: ${L('目标目录里已有别的内容且不一样——--force 覆盖', 'unmanaged content differs — --force to overwrite')}`);
|
|
164
164
|
else lockTargets[t.id] = { hash: r.hash, projected_at: new Date().toISOString(), mode: r.mode };
|
|
165
165
|
}
|
|
166
166
|
|
|
@@ -181,7 +181,8 @@ export async function run(ctx) {
|
|
|
181
181
|
if (Object.keys(lockTargets).length) updateLock(ctx.hub, name, treeHash(dest), lockTargets);
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
const
|
|
185
|
-
|
|
184
|
+
const actZh = { conflict: '冲突', exists: '已有', skipped: '跳过', absent: '缺', removed: '已删' };
|
|
185
|
+
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)}`);
|
|
186
187
|
return 0;
|
|
187
188
|
}
|
package/client/commands/list.js
CHANGED
|
@@ -36,18 +36,19 @@ export async function run(ctx) {
|
|
|
36
36
|
json: ctx.flags.json,
|
|
37
37
|
human: () => {
|
|
38
38
|
if (tableRows.length) table(tableRows, cols);
|
|
39
|
-
else info(L('
|
|
39
|
+
else info(L('(清单是空的——先 skillmkt install <路径> 收一个进来,或 skillmkt search 去搜)', '(list is empty — skillmkt install <path> to add one, or skillmkt search to find one)'));
|
|
40
40
|
if (extRows.length) {
|
|
41
41
|
info('');
|
|
42
|
-
info(L('
|
|
42
|
+
info(L('这些 skill 在 agent 目录里,但还没纳入管理:', 'these skills exist in agent dirs but are not managed yet:'));
|
|
43
43
|
for (const e of extRows) info(` ${e.name.padEnd(30)} ${e.dir}`);
|
|
44
|
-
|
|
44
|
+
const ex = extRows[0];
|
|
45
|
+
info(L(`→ 收一个进来试试:skillmkt install ${ex.dir}/${ex.name.slice(1)}`, `→ to manage one, e.g.: skillmkt install ${ex.dir}/${ex.name.slice(1)}`));
|
|
45
46
|
}
|
|
46
47
|
if (ctx.project) {
|
|
47
48
|
const projRows = rows.filter((r) => r.where === 'project');
|
|
48
49
|
if (projRows.length) {
|
|
49
50
|
info('');
|
|
50
|
-
info(`project ${ctx.project.root}:`);
|
|
51
|
+
info(L(`项目 ${ctx.project.root}:`, `project ${ctx.project.root}:`));
|
|
51
52
|
for (const r of projRows) info(` ${r.state === 'managed' ? '●' : '◌'} ${r.name} ${r.targetDir}`);
|
|
52
53
|
}
|
|
53
54
|
}
|
package/client/commands/merge.js
CHANGED
|
@@ -13,7 +13,7 @@ export const mergedDir = (hub) => path.join(hub, 'merged');
|
|
|
13
13
|
|
|
14
14
|
export async function run(ctx) {
|
|
15
15
|
const names = ctx.args.filter((a) => !a.startsWith('--'));
|
|
16
|
-
if (names.length < 2) { fail('usage: skillmkt merge <a> <b> [more…] [--name n]'); return 1; }
|
|
16
|
+
if (names.length < 2) { fail(L('用法: skillmkt merge <a> <b> [更多…] [--name 名字]', 'usage: skillmkt merge <a> <b> [more…] [--name n]')); return 1; }
|
|
17
17
|
const outName = ctx.flags.raw.name || `merged-${names.length}skills`;
|
|
18
18
|
|
|
19
19
|
const useLlm = ctx.flags.raw.llm && ctx.llm;
|
|
@@ -21,7 +21,7 @@ export async function run(ctx) {
|
|
|
21
21
|
for (const name of names) {
|
|
22
22
|
const dir = path.join(ctx.hub, 'skills', name);
|
|
23
23
|
const f = path.join(dir, 'SKILL.md');
|
|
24
|
-
if (!fs.existsSync(f)) { fail(L(
|
|
24
|
+
if (!fs.existsSync(f)) { fail(L(`没纳入管理: ${name}`, `not managed: ${name}`)); return 1; }
|
|
25
25
|
let rs = null;
|
|
26
26
|
if (useLlm) {
|
|
27
27
|
try { rs = await extractRulesLLM(ctx.llm, fs.readFileSync(f, 'utf8'), name); } catch { /* 降级静态 */ }
|
|
@@ -38,14 +38,14 @@ export async function run(ctx) {
|
|
|
38
38
|
const news = detectConflicts(ctx.hub, dedup);
|
|
39
39
|
// --auto:仲裁直接吃确定项(fresh-context per conflict)
|
|
40
40
|
if (ctx.flags.raw.auto && ctx.llm && news.length) {
|
|
41
|
-
const r = await autoArbitrate(ctx.hub, ctx.llm, news, { onProgress: (c, x) => info(`${c.id}: ${x?.verdict ?? '?'}
|
|
42
|
-
info(`auto-arbiter: ${r.auto} ${L('
|
|
41
|
+
const r = await autoArbitrate(ctx.hub, ctx.llm, news, { onProgress: (c, x) => info(`${c.id}: ${x?.verdict ?? '?'}${L('(置信', ' (confidence ')}${x?.confidence ?? '?'})`) });
|
|
42
|
+
info(`auto-arbiter: ${r.auto} ${L('已自动裁决', 'auto-decided')},${r.human} ${L('留给你', 'left for you')}`);
|
|
43
43
|
}
|
|
44
44
|
const dir = mergedDir(ctx.hub);
|
|
45
45
|
fs.mkdirSync(dir, { recursive: true });
|
|
46
46
|
writeYAML(path.join(dir, 'rules.yml'), { name: outName, sources: names, merged_at: new Date().toISOString(), rules: dedup });
|
|
47
|
-
ok(L(
|
|
47
|
+
ok(L(`合并完成:${dedup.length} 条规则(原始 ${rules.length} 条,去重 -${rules.length - dedup.length})· 新冲突 ${news.length} 个`,
|
|
48
48
|
`merged: ${dedup.length} rules (${rules.length} raw, deduped -${rules.length - dedup.length}) · new conflicts ${news.length}`));
|
|
49
|
-
if (news.length) info(L(`skillmkt conflicts
|
|
49
|
+
if (news.length) info(L(`skillmkt conflicts 看队列;decide/resolve 裁决后跑 build`, `skillmkt conflicts to review; decide/resolve then build`));
|
|
50
50
|
return news.length ? 3 : 0;
|
|
51
51
|
}
|
|
@@ -14,22 +14,22 @@ export async function run(ctx) {
|
|
|
14
14
|
const u = up.skills?.[name];
|
|
15
15
|
const localDir = path.join(ctx.hub, 'skills', name);
|
|
16
16
|
if (!u) {
|
|
17
|
-
rows.push({ name, status: s.source?.registry === 'adopted' || s.source?.registry === 'local' ? L('
|
|
17
|
+
rows.push({ name, status: s.source?.registry === 'adopted' || s.source?.registry === 'local' ? L('本地收的,无上游', 'n/a (no upstream)') : L('没查过——先跑 skillmkt update', 'never checked — run update') });
|
|
18
18
|
continue;
|
|
19
19
|
}
|
|
20
20
|
const localTree = fs.existsSync(localDir) ? gitTreeHash(localDir) : null;
|
|
21
21
|
if (localTree && u.tree_hash && localTree !== u.tree_hash) {
|
|
22
22
|
outdated++;
|
|
23
|
-
rows.push({ name, status:
|
|
23
|
+
rows.push({ name, status: L(`上游有更新 (${u.ref?.slice(0, 6)})——跑 upgrade 应用`, `upstream changed (${u.ref?.slice(0, 6)}) — run upgrade to apply`) });
|
|
24
24
|
} else {
|
|
25
|
-
rows.push({ name, status: '
|
|
25
|
+
rows.push({ name, status: L('已是最新', 'up to date') });
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
if (ctx.flags.json) { console.log(JSON.stringify({ outdated, rows })); }
|
|
29
29
|
else {
|
|
30
|
-
if (rows.length) table(rows, [{ key: 'name', title: 'skill' }, { key: 'status', title: 'status' }]);
|
|
31
|
-
if (!Object.keys(up.skills || {}).length) warn(L('
|
|
32
|
-
else info(
|
|
30
|
+
if (rows.length) table(rows, [{ key: 'name', title: 'skill' }, { key: 'status', title: L('状态', 'status') }]);
|
|
31
|
+
if (!Object.keys(up.skills || {}).length) warn(L('还没拉过远端信息——先跑 skillmkt update', 'no upstream data yet — run skillmkt update first'));
|
|
32
|
+
else info(L(`上次刷新: ${up.refreshed_at ?? '未知'}(skillmkt update 再拉一次)`, `last refresh: ${up.refreshed_at ?? 'unknown'} (skillmkt update to refresh)`));
|
|
33
33
|
}
|
|
34
34
|
return outdated ? 4 : 0;
|
|
35
35
|
}
|
package/client/commands/pack.js
CHANGED
|
@@ -8,9 +8,9 @@ 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('usage: skillmkt pack <name>'); return 1; }
|
|
11
|
+
if (!name) { fail(L('用法: skillmkt pack <名字>', 'usage: skillmkt pack <name>')); return 1; }
|
|
12
12
|
const src = path.join(ctx.hub, 'skills', name);
|
|
13
|
-
if (!fs.existsSync(path.join(src, 'SKILL.md'))) { fail(L(
|
|
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';
|
|
15
15
|
const out = path.resolve(`${name}-${ver}.tar.gz`);
|
|
16
16
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'skillmkt-pack-'));
|
|
@@ -18,6 +18,6 @@ export async function run(ctx) {
|
|
|
18
18
|
execFileSync('cp', ['-R', src + '/', path.join(tmp, name)]);
|
|
19
19
|
execFileSync('tar', ['czf', out, '-C', tmp, name]);
|
|
20
20
|
fs.rmSync(tmp, { recursive: true, force: true });
|
|
21
|
-
ok(`packed ${out} (${(fs.statSync(out).size / 1024).toFixed(1)} KB)`);
|
|
21
|
+
ok(L(`已打包 ${out}(${(fs.statSync(out).size / 1024).toFixed(1)} KB)`, `packed ${out} (${(fs.statSync(out).size / 1024).toFixed(1)} KB)`));
|
|
22
22
|
return 0;
|
|
23
23
|
}
|
|
@@ -5,7 +5,7 @@ import { L } from '../lib/i18n.js';
|
|
|
5
5
|
export async function run(ctx) {
|
|
6
6
|
const name = ctx.args[0];
|
|
7
7
|
const to = ctx.flags.raw.to;
|
|
8
|
-
if (!name || !to) { fail('usage: skillmkt publish <name> --to <registry>'); return 1; }
|
|
8
|
+
if (!name || !to) { fail(L('用法: skillmkt publish <名字> --to <registry>', 'usage: skillmkt publish <name> --to <registry>')); return 1; }
|
|
9
9
|
fail(L(`publish: '${to}' adapter 未实现(二期:clawhub POST /api/v1/skills / 企业 registry)——当前可用 skillmkt pack ${name} 出包手动分发`,
|
|
10
10
|
`publish: '${to}' adapter not implemented (phase 2: clawhub POST /api/v1/skills / enterprise registry) — for now use skillmkt pack ${name} and distribute manually`));
|
|
11
11
|
return 1;
|
|
@@ -16,14 +16,14 @@ export async function run(ctx) {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
if (sub === 'add') {
|
|
19
|
-
if (!flags.type) { fail('usage: registry add --type <github|rfc|clawhub|skillssh> [--url u] [--name n] [--token env:X]'); return 1; }
|
|
19
|
+
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; }
|
|
20
20
|
const entry = { type: flags.type };
|
|
21
21
|
if (flags.url) entry.url = flags.url;
|
|
22
22
|
if (flags.name) entry.name = flags.name;
|
|
23
23
|
if (flags.token) entry.token = flags.token.startsWith('env:') ? flags.token : `env:${flags.token}`;
|
|
24
24
|
raw.registries.push(entry);
|
|
25
25
|
writeConfig(ctx.hub, raw);
|
|
26
|
-
ok(`registry added: ${flags.type}
|
|
26
|
+
ok(L(`registry 已添加: ${flags.type}`, `registry added: ${flags.type}`) + `${flags.url ? ` ${flags.url}` : ''}${flags.name ? ` (${flags.name})` : ''}`);
|
|
27
27
|
return 0;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -31,12 +31,12 @@ export async function run(ctx) {
|
|
|
31
31
|
const id = rest[0];
|
|
32
32
|
const before = raw.registries.length;
|
|
33
33
|
raw.registries = raw.registries.filter((r) => (r.name || r.type) !== id);
|
|
34
|
-
if (raw.registries.length === before) { fail(`not found: ${id}`); return 1; }
|
|
34
|
+
if (raw.registries.length === before) { fail(L(`没找到: ${id}`, `not found: ${id}`)); return 1; }
|
|
35
35
|
writeConfig(ctx.hub, raw);
|
|
36
|
-
ok(`registry removed: ${id}`);
|
|
36
|
+
ok(L(`registry 已删: ${id}`, `registry removed: ${id}`));
|
|
37
37
|
return 0;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
fail('usage: registry [list] | add --type … | remove <name>');
|
|
40
|
+
fail(L('用法: registry [list] | add --type … | remove <名字>', 'usage: registry [list] | add --type … | remove <name>'));
|
|
41
41
|
return 1;
|
|
42
42
|
}
|
|
@@ -10,10 +10,10 @@ 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('usage: skillmkt remove <name> [--purge] [--scope project]'); return 1; }
|
|
13
|
+
if (!name) { fail(L('用法: skillmkt remove <名字> [--purge] [--scope project]', 'usage: skillmkt remove <name> [--purge] [--scope project]')); return 1; }
|
|
14
14
|
const flags = ctx.flags.raw;
|
|
15
15
|
const entry = ctx.library.skills?.[name];
|
|
16
|
-
if (!entry) { fail(L(
|
|
16
|
+
if (!entry) { fail(L(`没纳入管理: ${name}`, `not managed: ${name}`)); return 1; }
|
|
17
17
|
|
|
18
18
|
const projectOnly = flags.scope === 'project';
|
|
19
19
|
const targets = Object.entries(ctx.lock.skills?.[name]?.targets || {})
|
|
@@ -23,27 +23,27 @@ export async function run(ctx) {
|
|
|
23
23
|
const dir = targetDirFor(ctx, t, name);
|
|
24
24
|
if (!dir) continue;
|
|
25
25
|
const r = unproject(name, dir, { dryRun: ctx.flags.dryRun });
|
|
26
|
-
if (r.action !== 'absent') info(`${r.action} ${r.target}`);
|
|
26
|
+
if (r.action !== 'absent') info(`${r.action === 'removed' ? L('已删', 'removed') : r.action === 'would-remove' ? L('将删', 'would remove') : r.action} ${r.target}`);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
if (projectOnly) {
|
|
30
|
-
info(L('
|
|
30
|
+
info(L('已删项目内副本,hub 里的保留', 'project copy removed; hub copy kept'));
|
|
31
31
|
return 0;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
if (!ctx.flags.dryRun) {
|
|
35
35
|
const hubDir = path.join(ctx.hub, 'skills', name);
|
|
36
36
|
if (fs.existsSync(hubDir)) {
|
|
37
|
-
if (flags.purge) { rmDir(hubDir); info(`purged ${hubDir}`); }
|
|
37
|
+
if (flags.purge) { rmDir(hubDir); info(L(`已彻底删除 ${hubDir}`, `purged ${hubDir}`)); }
|
|
38
38
|
else {
|
|
39
39
|
const trash = trashPath(ctx.hub, name);
|
|
40
40
|
rmDir(trash);
|
|
41
41
|
fs.renameSync(hubDir, trash);
|
|
42
|
-
info(L(`→ .trash
|
|
42
|
+
info(L(`→ 移进 .trash(想恢复:mv 回 skills/,或重新 install)`, `→ moved to .trash (restore: mv back to skills/, or reinstall)`));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
unregisterSkill(ctx.hub, name);
|
|
46
46
|
}
|
|
47
|
-
ok(`${ctx.flags.dryRun ? '[dry-run] ' : ''}removed ${name}${flags.purge ? ' (purged)' : ''}`);
|
|
47
|
+
ok(`${ctx.flags.dryRun ? '[dry-run] ' : ''}${L('已移除', 'removed')} ${name}${flags.purge ? L('(含 hub 副本)', ' (hub copy purged)') : ''}`);
|
|
48
48
|
return 0;
|
|
49
49
|
}
|
|
@@ -25,9 +25,9 @@ export async function run(ctx) {
|
|
|
25
25
|
let queue = loadConflicts(ctx.hub, { pendingOnly: true });
|
|
26
26
|
// --auto:fresh-context 仲裁先吃掉确定项,剩余真价值权衡留人
|
|
27
27
|
if (ctx.flags.raw.auto) {
|
|
28
|
-
if (!ctx.llm) { fail(L('--auto 需要 LLM
|
|
29
|
-
const r = await autoArbitrate(ctx.hub, ctx.llm, queue, { onProgress: (c, x) => info(`${c.id}: ${x ? `${x.verdict}@${x.confidence}` : 'parse-fail'}`) });
|
|
30
|
-
ok(`auto-arbiter: ${r.auto} ${L('
|
|
28
|
+
if (!ctx.llm) { fail(L('--auto 需要 LLM——先跑 skillmkt init 配好模型', '--auto needs an LLM — run skillmkt init first')); return 1; }
|
|
29
|
+
const r = await autoArbitrate(ctx.hub, ctx.llm, queue, { onProgress: (c, x) => info(`${c.id}: ${x ? `${x.verdict}@${x.confidence}` : L('解析失败', 'parse-fail')}`) });
|
|
30
|
+
ok(`auto-arbiter: ${r.auto} ${L('已自动裁决', 'auto-decided')},${r.human} ${L('留给你', 'left for you')},${r.errors} ${L('失败', 'errors')}`);
|
|
31
31
|
queue = loadConflicts(ctx.hub, { pendingOnly: true });
|
|
32
32
|
if (!queue.length) return 0;
|
|
33
33
|
}
|
|
@@ -35,14 +35,14 @@ export async function run(ctx) {
|
|
|
35
35
|
if (ctx.flags.raw.evidence) {
|
|
36
36
|
const { makeEvidence, isDesignDomain } = await import('../lib/evidence.js');
|
|
37
37
|
for (const c of queue.filter((x) => isDesignDomain(x.domain))) {
|
|
38
|
-
if (!ctx.llm) { warn(L('--evidence 需要 LLM', '--evidence needs an LLM')); break; }
|
|
39
|
-
try { await makeEvidence(ctx.llm, ctx.hub, c); info(`${c.id}: evidence ${c.evidence}`); }
|
|
40
|
-
catch (e) { warn(`${c.id}: evidence failed — ${e.message.slice(0, 60)}`); }
|
|
38
|
+
if (!ctx.llm) { warn(L('--evidence 需要 LLM——先跑 skillmkt init', '--evidence needs an LLM — run skillmkt init first')); break; }
|
|
39
|
+
try { await makeEvidence(ctx.llm, ctx.hub, c); info(`${c.id}: ${L('证据已生成', 'evidence generated')} ${c.evidence}`); }
|
|
40
|
+
catch (e) { warn(`${c.id}: ${L('证据生成失败', 'evidence failed')} — ${e.message.slice(0, 60)}`); }
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
const target = ctx.args[0] ? queue.filter((c) => c.id === ctx.args[0]) : queue;
|
|
44
|
-
if (!target.length) { info(L('
|
|
45
|
-
if (!process.stdin.isTTY || ctx.flags.raw.cli === false) { info(L(`${target.length}
|
|
44
|
+
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
46
|
|
|
47
47
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
48
48
|
const ask = (q) => new Promise((r) => rl.question(q, r));
|
|
@@ -52,7 +52,7 @@ export async function run(ctx) {
|
|
|
52
52
|
console.log(` A(${c.sides[0].source}): ${c.sides[0].text}`);
|
|
53
53
|
console.log(` B(${c.sides[1].source}): ${c.sides[1].text}`);
|
|
54
54
|
for (;;) {
|
|
55
|
-
const a = (await ask(L(' [a][b][m][e
|
|
55
|
+
const a = (await ask(L(' [a 选A][b 选B][m 合并][e 编辑器里合并][d 不算冲突][s 跳过][q 退出] > ', ' [a pick A][b pick B][m erge][e dit-merge][d ismiss][s kip][q uit] > '))).trim().toLowerCase();
|
|
56
56
|
if (a === 'q') { rl.close(); return resolved ? 0 : 3; }
|
|
57
57
|
if (a === 's') break;
|
|
58
58
|
const res = { a: 'keep-a', b: 'keep-b', m: 'merge', e: 'merge', d: 'dismissed' }[a];
|
|
@@ -62,8 +62,8 @@ export async function run(ctx) {
|
|
|
62
62
|
custom = a === 'e' ? edit(`${c.sides[0].text}\n---\n${c.sides[1].text}\n`) : (await ask(L(' 合并文本 > ', ' merged text > '))).trim();
|
|
63
63
|
if (!custom) { info(L('空文本,跳过', 'empty text — skipped')); break; }
|
|
64
64
|
}
|
|
65
|
-
const reason = (await ask(' reason > ')).trim();
|
|
66
|
-
if (!reason) { info(L('
|
|
65
|
+
const reason = (await ask(L(' 理由(为什么这样选)> ', ' reason (why) > '))).trim();
|
|
66
|
+
if (!reason) { info(L('得给个理由', 'a reason is required')); continue; }
|
|
67
67
|
decide(ctx.hub, c, { resolution: res, custom, reason, by: process.env.USER || 'cli' });
|
|
68
68
|
c.status = 'resolved';
|
|
69
69
|
writeConflict(ctx.hub, c);
|
|
@@ -72,6 +72,6 @@ export async function run(ctx) {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
rl.close();
|
|
75
|
-
ok(
|
|
75
|
+
ok(`${L('已裁决', 'resolved')} ${resolved}/${target.length}`);
|
|
76
76
|
return 0;
|
|
77
77
|
}
|
|
@@ -12,7 +12,7 @@ import { L } from '../lib/i18n.js';
|
|
|
12
12
|
export async function run(ctx) {
|
|
13
13
|
const name = ctx.args[0];
|
|
14
14
|
const s = ctx.library.skills?.[name];
|
|
15
|
-
if (!s) { fail(L(
|
|
15
|
+
if (!s) { fail(L(`没纳入管理: ${name}`, `not managed: ${name}`)); return 1; }
|
|
16
16
|
if (!fs.existsSync(historyDir(ctx.hub, name))) { fail(L(`${name}: 无历史副本(upgrade 后才有一版深度)`, `${name}: no history copy (one version deep, only after upgrade)`)); return 1; }
|
|
17
17
|
if (!ctx.flags.dryRun) {
|
|
18
18
|
historyRestore(ctx.hub, name);
|
|
@@ -26,6 +26,6 @@ export async function run(ctx) {
|
|
|
26
26
|
}
|
|
27
27
|
updateLock(ctx.hub, name, treeHash(dest), lockTargets);
|
|
28
28
|
}
|
|
29
|
-
ok(`${ctx.flags.dryRun ? '[dry-run] ' : ''}rolled back ${name}`);
|
|
29
|
+
ok(`${ctx.flags.dryRun ? '[dry-run] ' : ''}${L(`已回滚 ${name}`, `rolled back ${name}`)}`);
|
|
30
30
|
return 0;
|
|
31
31
|
}
|
|
@@ -6,7 +6,7 @@ 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('usage: skillmkt search <query> [--local|--remote] [--json]'); return 1; }
|
|
9
|
+
if (!query) { warn(L('用法: skillmkt search <关键词> [--local|--remote] [--json]', 'usage: skillmkt search <query> [--local|--remote] [--json]')); return 1; }
|
|
10
10
|
const flags = ctx.flags.raw;
|
|
11
11
|
const q = query.toLowerCase();
|
|
12
12
|
|
|
@@ -27,21 +27,21 @@ export async function run(ctx) {
|
|
|
27
27
|
return 0;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
info('LOCAL');
|
|
30
|
+
info(L('本地', 'LOCAL'));
|
|
31
31
|
if (local.length) {
|
|
32
32
|
table(local.map((r) => ({ name: r.name, where: `${r.where}${r.state === 'external' ? ' (external)' : ''}`, ver: r.version })),
|
|
33
33
|
[{ key: 'name', title: 'skill' }, { key: 'where', title: 'where' }, { key: 'ver', title: 'ver' }]);
|
|
34
|
-
} else info(' (no local match)');
|
|
34
|
+
} else info(L(' (本地没匹配到)', ' (no local match)'));
|
|
35
35
|
|
|
36
36
|
if (wantRemote) {
|
|
37
37
|
info('');
|
|
38
|
-
info(`REMOTE ${remote.base || ''}`);
|
|
39
|
-
if (remoteErr) warn(`remote search failed: ${remoteErr}
|
|
38
|
+
info(L(`远端 ${remote.base || ''}`, `REMOTE ${remote.base || ''}`));
|
|
39
|
+
if (remoteErr) warn(L(`远端搜索失败: ${remoteErr}(本地结果仍可用)`, `remote search failed: ${remoteErr} (local results still shown)`));
|
|
40
40
|
else if (remote.skills.length) {
|
|
41
41
|
table(remote.skills.slice(0, 15).map((s) => ({ name: s.name, id: s.slug, installs: s.installs })),
|
|
42
42
|
[{ key: 'name', title: 'skill' }, { key: 'id', title: 'id' }, { key: 'installs', title: 'installs' }]);
|
|
43
43
|
info(`→ skillmkt install ${remote.skills[0].slug.split('/').slice(0, 2).join('/')} --path ${remote.skills[0].slug.split('/').slice(2).join('/')}`);
|
|
44
|
-
} else info(' (no remote match)');
|
|
44
|
+
} else info(L(' (远端没匹配到)', ' (no remote match)'));
|
|
45
45
|
}
|
|
46
46
|
return 0;
|
|
47
47
|
}
|
package/client/commands/serve.js
CHANGED
|
@@ -206,14 +206,14 @@ export async function run(ctx) {
|
|
|
206
206
|
const flags = ctx.flags.raw;
|
|
207
207
|
if (flags.stop) {
|
|
208
208
|
const d = readDaemon(ctx.hub);
|
|
209
|
-
if (d) { try { process.kill(d.pid); } catch { /* dead */ } fs.rmSync(daemonFile(ctx.hub), { force: true }); ok('daemon stopped'); }
|
|
210
|
-
else info('no daemon');
|
|
209
|
+
if (d) { try { process.kill(d.pid); } catch { /* dead */ } fs.rmSync(daemonFile(ctx.hub), { force: true }); ok(L('daemon 已停', 'daemon stopped')); }
|
|
210
|
+
else info(L('没有 daemon 在跑', 'no daemon running'));
|
|
211
211
|
return 0;
|
|
212
212
|
}
|
|
213
213
|
// 已有前台/分离实例在跑 → 不重复起,报地址
|
|
214
214
|
const existing = readDaemon(ctx.hub);
|
|
215
215
|
if (existing && existing.pid !== process.pid) {
|
|
216
|
-
try { process.kill(existing.pid, 0); info(`已在跑: http://127.0.0.1:${existing.port}/?token=${existing.token}(--stop
|
|
216
|
+
try { process.kill(existing.pid, 0); info(L(`已在跑: http://127.0.0.1:${existing.port}/?token=${existing.token}(--stop 停掉)`, `already running: http://127.0.0.1:${existing.port}/?token=${existing.token} (use --stop to stop)`)); return 0; } catch { /* stale */ }
|
|
217
217
|
}
|
|
218
218
|
const d = await startServer(ctx, { quiet: !!flags.daemon, port: flags.port || 0 });
|
|
219
219
|
if (flags.daemon) { console.log(`daemon ready :${d.port}`); await new Promise(() => {}); }
|
package/client/commands/show.js
CHANGED
|
@@ -4,11 +4,12 @@ import path from 'node:path';
|
|
|
4
4
|
import { readSkillDir, parseFrontmatter } from '../lib/package.js';
|
|
5
5
|
import { scanAll } from '../lib/scanner.js';
|
|
6
6
|
import { readYAMLFile } from '../lib/hub.js';
|
|
7
|
-
import { info, fail } from '../lib/render.js';
|
|
7
|
+
import { info, fail, auditTag } from '../lib/render.js';
|
|
8
|
+
import { L } from '../lib/i18n.js';
|
|
8
9
|
|
|
9
10
|
export async function run(ctx) {
|
|
10
11
|
const name = ctx.args[0];
|
|
11
|
-
if (!name) { fail('usage: skillmkt show <name> [--raw|--files|--audit]'); return 1; }
|
|
12
|
+
if (!name) { fail(L('用法: skillmkt show <名字> [--raw|--files|--audit]', 'usage: skillmkt show <name> [--raw|--files|--audit]')); return 1; }
|
|
12
13
|
const flags = ctx.flags.raw;
|
|
13
14
|
|
|
14
15
|
// 受管 → hub;否则 external 中找
|
|
@@ -18,7 +19,7 @@ export async function run(ctx) {
|
|
|
18
19
|
if (!fs.existsSync(path.join(dir, 'SKILL.md'))) {
|
|
19
20
|
const ext = scanAll(ctx.hub, ctx.harnesses, ctx.library, ctx.project?.root)
|
|
20
21
|
.find((r) => r.name === name && r.state === 'external');
|
|
21
|
-
if (!ext) { fail(`not found: ${name}`); return 1; }
|
|
22
|
+
if (!ext) { fail(L(`没找到: ${name}`, `not found: ${name}`)); return 1; }
|
|
22
23
|
dir = ext.path; where = `${ext.where} (external)`;
|
|
23
24
|
}
|
|
24
25
|
const pkg = readSkillDir(dir);
|
|
@@ -28,8 +29,8 @@ export async function run(ctx) {
|
|
|
28
29
|
if (flags.audit) {
|
|
29
30
|
const scan = readYAMLFile(path.join(ctx.hub, 'scans', `${name}.yml`), null);
|
|
30
31
|
if (ctx.flags.json) { console.log(JSON.stringify(scan)); return 0; }
|
|
31
|
-
if (!scan) { info('no scan record'); return 0; }
|
|
32
|
-
info(
|
|
32
|
+
if (!scan) { info(L('没有审核记录', 'no scan record')); return 0; }
|
|
33
|
+
info(`${L('结论', 'verdict')}: ${auditTag(scan.verdict)} @ ${scan.scanned_at}`);
|
|
33
34
|
(scan.static?.findings || []).forEach((f) => info(` ${f.rule} ${f.file}:${f.line}`));
|
|
34
35
|
return 0;
|
|
35
36
|
}
|
|
@@ -42,11 +43,11 @@ export async function run(ctx) {
|
|
|
42
43
|
if (ctx.flags.json) { console.log(JSON.stringify(card, null, 2)); return 0; }
|
|
43
44
|
info(`${card.name} v${card.version}`);
|
|
44
45
|
info(`${card.description}`);
|
|
45
|
-
info(
|
|
46
|
-
info(
|
|
46
|
+
info(`${L('位置', 'where')}: ${card.where} · ${card.path}`);
|
|
47
|
+
info(`${L('文件数', 'files')}: ${card.files}`);
|
|
47
48
|
if (entry) {
|
|
48
|
-
info(
|
|
49
|
-
info(
|
|
49
|
+
info(`${L('来源', 'source')}: ${entry.source?.registry} ${entry.source?.ref || ''}${entry.source?.path ? ` (${entry.source.path})` : ''}${entry.source?.adopted_from ? ` adopted_from ${entry.source.adopted_from}` : ''}`);
|
|
50
|
+
info(`${L('装到', 'targets')}: ${(entry.targets || []).join(', ') || L('只在 hub', 'hub only')} · ${L('审核', 'audit')}: ${auditTag(entry.audit)}`);
|
|
50
51
|
}
|
|
51
52
|
return 0;
|
|
52
53
|
}
|
package/client/commands/sync.js
CHANGED
|
@@ -13,11 +13,11 @@ export async function run(ctx) {
|
|
|
13
13
|
if (ctx.flags.dryRun) {
|
|
14
14
|
const drift = checkDrift(ctx);
|
|
15
15
|
if (drift.length) {
|
|
16
|
-
for (const d of drift) info(`${d.name} @ ${d.target}: ${d.issue}`);
|
|
17
|
-
warn(`${drift.length} drift — run 'skillmkt sync' to repair`);
|
|
16
|
+
for (const d of drift) info(`${d.name} @ ${d.target}: ${d.issue === 'missing' ? L('目标里没了', 'missing') : L('内容不一致', 'content differs')}`);
|
|
17
|
+
warn(L(`${drift.length} 处漂移——跑 skillmkt sync 修复`, `${drift.length} drift — run 'skillmkt sync' to repair`));
|
|
18
18
|
return 4;
|
|
19
19
|
}
|
|
20
|
-
ok('projections in sync');
|
|
20
|
+
ok(L('投影一致,无需修复', 'projections in sync'));
|
|
21
21
|
return 0;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -30,7 +30,7 @@ export async function run(ctx) {
|
|
|
30
30
|
raw.default_targets = [...new Set([...(raw.default_targets || []), h.id])];
|
|
31
31
|
const { writeConfig } = await import('../lib/hub.js');
|
|
32
32
|
writeConfig(ctx.hub, raw);
|
|
33
|
-
info(`${h.id} →
|
|
33
|
+
info(`${h.id} → ${L('加入默认目标', 'added to default targets')}`);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
@@ -41,15 +41,15 @@ export async function run(ctx) {
|
|
|
41
41
|
const lockTargets = {};
|
|
42
42
|
for (const t of s.targets || []) {
|
|
43
43
|
const dir = targetDirFor(ctx, t, name);
|
|
44
|
-
if (!dir) { warn(`${name}: unknown target ${t}`); continue; }
|
|
44
|
+
if (!dir) { warn(`${name}: ${L(`未知目标 ${t}`, `unknown target ${t}`)}`); continue; }
|
|
45
45
|
const r = projectSkill(src, name, dir, { mode: s.transport?.[t] === 'link' ? 'link' : 'copy', force: !!ctx.flags.raw.force });
|
|
46
46
|
if (r.action === 'conflict') warn(`${name} @ ${t}: ${r.detail}${L('(手动改过的内容不覆盖——--force 强制重建,或改回后 sync)', ' (manual edits not overwritten — --force rebuilds, or revert then sync)')}`);
|
|
47
|
-
else if (r.action !== 'skipped') { repaired++; info(`${name} → ${r.action} ${r.target}`); }
|
|
47
|
+
else if (r.action !== 'skipped') { repaired++; info(`${name} → ${r.action === 'copied' ? L('已重建', 'rebuilt') : r.action} ${r.target}`); }
|
|
48
48
|
lockTargets[t] = { hash: r.hash, projected_at: new Date().toISOString(), mode: r.mode };
|
|
49
49
|
n++;
|
|
50
50
|
}
|
|
51
51
|
if (Object.keys(lockTargets).length) updateLock(ctx.hub, name, lock.skills?.[name]?.content_hash ?? 'sha256:', lockTargets);
|
|
52
52
|
}
|
|
53
|
-
ok(`sync done: ${n} targets checked, ${repaired} (re)projected`);
|
|
53
|
+
ok(L(`sync 完成:检查了 ${n} 个目标,修了 ${repaired} 个`, `sync done: ${n} targets checked, ${repaired} (re)projected`));
|
|
54
54
|
return 0;
|
|
55
55
|
}
|
|
@@ -35,22 +35,22 @@ export async function run(ctx) {
|
|
|
35
35
|
// targets add --path <dir> <name>
|
|
36
36
|
if (flags.path) {
|
|
37
37
|
const name = rest[0];
|
|
38
|
-
if (!name) { fail('usage: targets add --path <dir> <name>'); return 1; }
|
|
38
|
+
if (!name) { fail(L('用法: targets add --path <目录> <名字>', 'usage: targets add --path <dir> <name>')); return 1; }
|
|
39
39
|
raw.targets = raw.targets || {};
|
|
40
40
|
raw.targets[name] = { path: flags.path, transport: 'copy' };
|
|
41
41
|
writeConfig(ctx.hub, raw);
|
|
42
|
-
ok(`custom target registered: ${name} → ${flags.path}`);
|
|
42
|
+
ok(L(`自定义目标已登记: ${name} → ${flags.path}`, `custom target registered: ${name} → ${flags.path}`));
|
|
43
43
|
return 0;
|
|
44
44
|
}
|
|
45
45
|
// targets add <harness-id|custom-name>:写 default_targets + 立即投影全部
|
|
46
46
|
const id = rest[0];
|
|
47
|
-
if (!id) { fail('usage: targets add <id>'); return 1; }
|
|
47
|
+
if (!id) { fail(L('用法: targets add <id>', 'usage: targets add <id>')); return 1; }
|
|
48
48
|
const h = ctx.harnesses.find((x) => x.id === id);
|
|
49
49
|
const custom = ctx.config.targets[id];
|
|
50
|
-
if (!h && !custom) { fail(`unknown target: ${id}`); return 1; }
|
|
50
|
+
if (!h && !custom) { fail(L(`未知目标: ${id}`, `unknown target: ${id}`)); return 1; }
|
|
51
51
|
raw.default_targets = [...new Set([...(raw.default_targets || []), id])];
|
|
52
52
|
writeConfig(ctx.hub, raw);
|
|
53
|
-
ok(`${id} →
|
|
53
|
+
ok(L(`${id} → 已加入默认目标`, `${id} → added to default targets`));
|
|
54
54
|
|
|
55
55
|
const dirs = h ? h.dirs.map((d) => ({ dir: d.path, id })) : [{ dir: expandHome(custom.path), id: `custom:${expandHome(custom.path)}` }];
|
|
56
56
|
for (const [name] of Object.entries(ctx.library.skills || {})) {
|
|
@@ -58,7 +58,7 @@ export async function run(ctx) {
|
|
|
58
58
|
if (!fs.existsSync(src)) continue;
|
|
59
59
|
for (const { dir, id: tid } of dirs) {
|
|
60
60
|
const r = projectSkill(src, name, dir, { mode: 'copy', dryRun: ctx.flags.dryRun });
|
|
61
|
-
info(`${name} → ${r.action} ${r.target}`);
|
|
61
|
+
info(`${name} → ${r.action === 'copied' ? L('已装', 'copied') : r.action === 'skipped' ? L('已在', 'present') : r.action} ${r.target}`);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
return 0;
|
|
@@ -67,13 +67,13 @@ export async function run(ctx) {
|
|
|
67
67
|
if (sub === 'remove' || sub === 'rm') {
|
|
68
68
|
const id = rest[0];
|
|
69
69
|
const raw = readConfig(ctx.hub)._raw;
|
|
70
|
-
if (raw.targets?.[id]) { delete raw.targets[id]; writeConfig(ctx.hub, raw); ok(`custom target removed: ${id}`); return 0; }
|
|
70
|
+
if (raw.targets?.[id]) { delete raw.targets[id]; writeConfig(ctx.hub, raw); ok(L(`自定义目标已删: ${id}`, `custom target removed: ${id}`)); return 0; }
|
|
71
71
|
raw.default_targets = (raw.default_targets || []).filter((t) => t !== id);
|
|
72
72
|
writeConfig(ctx.hub, raw);
|
|
73
|
-
ok(`${id}
|
|
73
|
+
ok(L(`${id} 已从默认目标移除(装到各 agent 的副本还在——skillmkt sync 清理)`, `${id} removed from default targets (projected copies kept — skillmkt sync can clean)`));
|
|
74
74
|
return 0;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
fail('usage: skillmkt targets [list] | add <id> | add --path <dir> <name> | remove <id>');
|
|
77
|
+
fail(L('用法: skillmkt targets [list] | add <id> | add --path <目录> <名字> | remove <id>', 'usage: skillmkt targets [list] | add <id> | add --path <dir> <name> | remove <id>'));
|
|
78
78
|
return 1;
|
|
79
79
|
}
|
|
@@ -13,7 +13,7 @@ export async function run(ctx) {
|
|
|
13
13
|
let n = 0, na = 0, errs = 0;
|
|
14
14
|
for (const name of names) {
|
|
15
15
|
const s = skills[name];
|
|
16
|
-
if (!s) { warn(L(
|
|
16
|
+
if (!s) { warn(L(`没纳入管理: ${name}`, `not managed: ${name}`)); continue; }
|
|
17
17
|
const src = s.source || {};
|
|
18
18
|
if (src.registry !== 'github' || !src.ref) { na++; continue; } // adopted/local/rfc 无远端可查(rfc 走 registry 适配后续)
|
|
19
19
|
try {
|
|
@@ -26,7 +26,7 @@ export async function run(ctx) {
|
|
|
26
26
|
outdated: localTree !== null && localTree !== remote.tree_hash,
|
|
27
27
|
});
|
|
28
28
|
n++;
|
|
29
|
-
if (localTree !== remote.tree_hash) info(`${name}: upstream changed`);
|
|
29
|
+
if (localTree !== remote.tree_hash) info(`${name}: ${L('上游有更新', 'upstream changed')}`);
|
|
30
30
|
} catch (e) {
|
|
31
31
|
errs++;
|
|
32
32
|
warn(`${name}: ${e.message.slice(0, 80)}`);
|
|
@@ -35,6 +35,6 @@ export async function run(ctx) {
|
|
|
35
35
|
const u = readUpstream(ctx.hub);
|
|
36
36
|
u.refreshed_at = new Date().toISOString();
|
|
37
37
|
writeUpstream(ctx.hub, u);
|
|
38
|
-
ok(`update done: ${n} refreshed${na ? `, ${na} n/a(adopted/local)` : ''}${errs ? `, ${errs} errors` : ''}`);
|
|
38
|
+
ok(L(`update 完成:刷新了 ${n} 个${na ? `,${na} 个无上游可比(本地收的)` : ''}${errs ? `,${errs} 个失败` : ''}`, `update done: ${n} refreshed${na ? `, ${na} n/a (adopted/local)` : ''}${errs ? `, ${errs} errors` : ''}`));
|
|
39
39
|
return errs ? 1 : 0;
|
|
40
40
|
}
|
|
@@ -8,7 +8,7 @@ import { readSkillDir, walk, rmDir, treeHash } from '../lib/package.js';
|
|
|
8
8
|
import { projectSkill, targetDirFor } from '../lib/project.js';
|
|
9
9
|
import { registerSkill, updateLock } from '../lib/hub.js';
|
|
10
10
|
import { fetchMirror } from '../lib/registries/index.js';
|
|
11
|
-
import { ok, warn, fail, info } from '../lib/render.js';
|
|
11
|
+
import { ok, warn, fail, info, auditTag } from '../lib/render.js';
|
|
12
12
|
import { L } from '../lib/i18n.js';
|
|
13
13
|
|
|
14
14
|
function copyFiltered(src, dst, keep) {
|
|
@@ -27,26 +27,26 @@ export async function run(ctx) {
|
|
|
27
27
|
const up = readUpstream(ctx.hub);
|
|
28
28
|
const skills = ctx.library.skills || {};
|
|
29
29
|
const names = flags.all ? Object.keys(skills) : ctx.args;
|
|
30
|
-
if (!names.length) { fail('usage: skillmkt upgrade <name|--all>'); return 1; }
|
|
30
|
+
if (!names.length) { fail(L('用法: skillmkt upgrade <名字|--all>', 'usage: skillmkt upgrade <name|--all>')); return 1; }
|
|
31
31
|
|
|
32
32
|
let upgraded = 0;
|
|
33
33
|
for (const name of names) {
|
|
34
34
|
const s = skills[name];
|
|
35
|
-
if (!s) { warn(L(
|
|
35
|
+
if (!s) { warn(L(`没纳入管理: ${name}`, `not managed: ${name}`)); continue; }
|
|
36
36
|
const u = up.skills?.[name];
|
|
37
37
|
if (!u?.outdated && !flags.force) { info(L(`${name}: clean(update 先刷新)`, `${name}: clean (run update first to refresh)`)); continue; }
|
|
38
38
|
const src = s.source || {};
|
|
39
39
|
if (src.registry !== 'github' || !src.ref) { warn(L(`${name}: 无上游可升级`, `${name}: no upstream to upgrade from`)); continue; }
|
|
40
40
|
|
|
41
41
|
const [owner, repo] = src.ref.split('/');
|
|
42
|
-
info(`${name}: fetching ${src.ref} …`);
|
|
42
|
+
info(`${name}: ${L(`正在拉取 ${src.ref} …`, `fetching ${src.ref} …`)}`);
|
|
43
43
|
try {
|
|
44
44
|
const got = await fetchSkill({ owner, repo, ref: null, path: src.path || null, mirror: fetchMirror(ctx) });
|
|
45
45
|
const pkg = readSkillDir(got.dir);
|
|
46
46
|
const audit = auditDir(got.dir, { strip: !flags.keepScripts });
|
|
47
|
-
if (audit.verdict === 'malicious') { warn(L(`${name}:
|
|
47
|
+
if (audit.verdict === 'malicious') { warn(L(`${name}: 新版判定为恶意——保留旧版`, `${name}: new version audited malicious — keeping old version`)); continue; }
|
|
48
48
|
if (ctx.flags.dryRun) {
|
|
49
|
-
info(`[dry-run] ${name}: ${pkg?.fileCount ?? '?'} files, audit:${audit.verdict}${audit.stripped.length ? `,strip ${audit.stripped.length}` : ''}`);
|
|
49
|
+
info(`[dry-run] ${name}: ${L(`${pkg?.fileCount ?? '?'} 个文件,审核:${auditTag(audit.verdict)}`, `${pkg?.fileCount ?? '?'} files, audit:${audit.verdict}`)}${audit.stripped.length ? L(`,剔除 ${audit.stripped.length} 个`, `, strip ${audit.stripped.length}`) : ''}`);
|
|
50
50
|
continue;
|
|
51
51
|
}
|
|
52
52
|
historySnapshot(ctx.hub, name);
|
|
@@ -66,11 +66,11 @@ export async function run(ctx) {
|
|
|
66
66
|
updateLock(ctx.hub, name, treeHash(dest), lockTargets);
|
|
67
67
|
setUpstream(ctx.hub, name, { ref: got.sha, outdated: false });
|
|
68
68
|
upgraded++;
|
|
69
|
-
ok(`${name} → ${got.sha.slice(0, 7)} audit:${audit.verdict}`);
|
|
69
|
+
ok(`${name} → ${got.sha.slice(0, 7)} ${L('审核', 'audit')}:${auditTag(audit.verdict)}`);
|
|
70
70
|
} catch (e) {
|
|
71
|
-
warn(`${name}: upgrade failed — ${e.message.slice(0, 100)}`);
|
|
71
|
+
warn(`${name}: ${L('升级失败', 'upgrade failed')} — ${e.message.slice(0, 100)}`);
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
ok(`upgrade done: ${upgraded} applied`);
|
|
74
|
+
ok(L(`upgrade 完成:应用了 ${upgraded} 个`, `upgrade done: ${upgraded} applied`));
|
|
75
75
|
return 0;
|
|
76
76
|
}
|
package/client/lib/render.js
CHANGED
|
@@ -19,6 +19,13 @@ export function out(data, { json = false, human = null } = {}) {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// 审核结论词 → 当前语言(clean/suspicious/stripped/malicious/quarantined)
|
|
23
|
+
export const auditTag = (v) => L({ clean: '干净', suspicious: '可疑', stripped: '已剔除', malicious: '恶意', quarantined: '已隔离' }[v] ?? v, v);
|
|
24
|
+
|
|
25
|
+
// 按终端显示宽度对齐(CJK 字符算 2 列)
|
|
26
|
+
const w = (s) => [...s].reduce((n, c) => n + (c.codePointAt(0) > 0x2e7f ? 2 : 1), 0);
|
|
27
|
+
export const pad = (s, n) => s + ' '.repeat(Math.max(0, n - w(s)));
|
|
28
|
+
|
|
22
29
|
export const ok = (s) => err(`✓ ${s}`);
|
|
23
30
|
export const warn = (s) => err(`⚠ ${s}`);
|
|
24
31
|
export const fail = (s) => err(`✗ ${s}`);
|
|
@@ -37,17 +44,17 @@ export function dashboard({ hub, library, scan, upstream, conflicts, llm, llmVia
|
|
|
37
44
|
|
|
38
45
|
err(`skillmkt · hub ${hub}${llm ? ` · llm ${llm.model} ✓${llmVia ? L(`(来自 ${llmVia},未写 config.yml)`, ` (from ${llmVia}, not in config.yml)`) : ''}` : ''}`);
|
|
39
46
|
err('');
|
|
40
|
-
err(
|
|
47
|
+
err(`${pad(L('skill', 'skills'), 11)}${L(`${skills.length} 个已管理`, `${skills.length} installed`)}${updates ? ` · ${L(`${updates} 个可更新`, `${updates} update available`)}` : ''} · ${L(`审核`, 'audit')} ${audits.length - bad}✓${bad ? `/${bad}⚠` : ''}`);
|
|
41
48
|
// 按状态分组展示(已装/可装;likely 探测不确定不显示)
|
|
42
49
|
const grp = (st) => scan.harnesses.filter((h) => h.state === st).map((h) => h.id);
|
|
43
50
|
const parts = [
|
|
44
51
|
grp('installed').length && `${L('已装', 'installed')} ${grp('installed').join(' ')}`,
|
|
45
52
|
grp('available').length && `${L('可装', 'installable')} ${grp('available').join(' ')}`,
|
|
46
53
|
].filter(Boolean);
|
|
47
|
-
if (parts.length) err(
|
|
48
|
-
if (project) err(
|
|
49
|
-
if (pending) err(
|
|
50
|
-
if (externals) err(
|
|
54
|
+
if (parts.length) err(`${pad(L('agent', 'agents'), 11)}${parts.join(' · ')}`);
|
|
55
|
+
if (project) err(`${pad(L('项目', 'project'), 11)}${project.root}`);
|
|
56
|
+
if (pending) err(`${pad(L('冲突', 'conflicts'), 11)}${L(`${pending} 个待裁决`, `${pending} pending`)} — ${L('需要裁决', 'needs your decision')}`);
|
|
57
|
+
if (externals) err(`${pad(L('agent目录', 'agent dirs'), 11)}${L(`${externals} 个 skill 但没被管理`, `${externals} skills, unmanaged`)} — ${L('install <path> 收进来', '`install <path>` to manage')}`);
|
|
51
58
|
err('');
|
|
52
59
|
const hints = [];
|
|
53
60
|
if (pending) hints.push(L('skillmkt conflicts --ui 裁决冲突(开面板看图)', 'skillmkt conflicts --ui decide conflicts (visual panel)'));
|