skillmkt 0.3.16 → 0.4.1
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 +15 -3
- package/client/commands/audit.js +3 -2
- package/client/commands/build.js +3 -2
- package/client/commands/decide.js +2 -1
- package/client/commands/diff.js +5 -4
- package/client/commands/doctor.js +4 -3
- package/client/commands/download.js +2 -1
- package/client/commands/init.js +22 -21
- package/client/commands/install.js +5 -4
- package/client/commands/list.js +4 -3
- package/client/commands/merge.js +6 -4
- package/client/commands/outdated.js +5 -4
- package/client/commands/pack.js +2 -1
- package/client/commands/publish.js +3 -1
- package/client/commands/remove.js +4 -3
- package/client/commands/resolve.js +10 -9
- package/client/commands/rollback.js +3 -2
- package/client/commands/search.js +2 -1
- package/client/commands/serve.js +13 -9
- package/client/commands/sync.js +4 -3
- package/client/commands/targets.js +2 -1
- package/client/commands/update.js +2 -1
- package/client/commands/upgrade.js +5 -4
- package/client/lib/ctx.js +2 -0
- package/client/lib/daemon.js +3 -2
- package/client/lib/hub.js +1 -1
- package/client/lib/i18n.js +14 -0
- package/client/lib/llm.js +2 -1
- package/client/lib/project.js +3 -2
- package/client/lib/prompt.js +2 -1
- package/client/lib/registries/github.js +3 -2
- package/client/lib/registries/index.js +6 -5
- package/client/lib/registries/rfc.js +2 -1
- package/client/lib/render.js +7 -6
- package/client/public/app.js +254 -81
- package/client/public/index.html +8 -1
- package/package.json +1 -1
package/client/bin/skillmkt.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// skillmkt — local-first agent skill manager
|
|
3
3
|
import { makeCtx, withState } from '../lib/ctx.js';
|
|
4
4
|
import { hubExists } from '../lib/hub.js';
|
|
5
|
+
import { L } from '../lib/i18n.js';
|
|
5
6
|
|
|
6
7
|
const COMMANDS = {
|
|
7
8
|
init: 'init', config: 'config', doctor: 'doctor',
|
|
@@ -29,10 +30,21 @@ dist: audit pack publish registry serve
|
|
|
29
30
|
|
|
30
31
|
bare run = dashboard. docs: docs/CLI.md`;
|
|
31
32
|
|
|
33
|
+
const HELP_ZH = `skillmkt — 本地优先的 agent skill 管理器
|
|
34
|
+
|
|
35
|
+
用法: skillmkt <命令> [参数] [--json] [--hub <路径>] [--dry-run] [--ui|--cli]
|
|
36
|
+
|
|
37
|
+
核心: init config doctor search list show install remove targets sync
|
|
38
|
+
版本: update outdated upgrade download diff rollback
|
|
39
|
+
合并: conflicts resolve decide merge build
|
|
40
|
+
分发: audit pack publish registry serve
|
|
41
|
+
|
|
42
|
+
裸跑 = 仪表盘。文档: docs/CLI.md`;
|
|
43
|
+
|
|
32
44
|
async function bareRun(ctx) {
|
|
33
45
|
if (!hubExists(ctx.hub)) {
|
|
34
46
|
if (!ctx.tty) {
|
|
35
|
-
console.error("run 'skillmkt init' to get started");
|
|
47
|
+
console.error(L("请先运行 'skillmkt init' 完成初始化", "run 'skillmkt init' to get started"));
|
|
36
48
|
process.exit(1);
|
|
37
49
|
}
|
|
38
50
|
const mod = await import('../commands/init.js');
|
|
@@ -49,7 +61,7 @@ async function main() {
|
|
|
49
61
|
const [cmd, ...args] = ctx.positional;
|
|
50
62
|
ctx.args = args;
|
|
51
63
|
|
|
52
|
-
if (ctx.flags.raw.help || ctx.flags.raw.h) { console.log(HELP); process.exit(0); }
|
|
64
|
+
if (ctx.flags.raw.help || ctx.flags.raw.h) { console.log(L(HELP_ZH, HELP)); process.exit(0); }
|
|
53
65
|
if (ctx.flags.raw.version || ctx.flags.raw.V) {
|
|
54
66
|
const pkg = (await import('../../package.json', { with: { type: 'json' } })).default;
|
|
55
67
|
console.log(pkg.version);
|
|
@@ -60,7 +72,7 @@ async function main() {
|
|
|
60
72
|
|
|
61
73
|
const name = COMMANDS[cmd];
|
|
62
74
|
if (!name) {
|
|
63
|
-
console.error(
|
|
75
|
+
console.error(`${L('未知命令', 'unknown command')}: ${cmd}\n\n${L(HELP_ZH, HELP)}`);
|
|
64
76
|
process.exit(1);
|
|
65
77
|
}
|
|
66
78
|
|
package/client/commands/audit.js
CHANGED
|
@@ -5,6 +5,7 @@ import { auditDir, writeScan } from '../lib/audit.js';
|
|
|
5
5
|
import { llmAudit } from '../lib/ai.js';
|
|
6
6
|
import { walk } from '../lib/package.js';
|
|
7
7
|
import { ok, warn, fail, info } from '../lib/render.js';
|
|
8
|
+
import { L } from '../lib/i18n.js';
|
|
8
9
|
|
|
9
10
|
export async function run(ctx) {
|
|
10
11
|
const flags = ctx.flags.raw;
|
|
@@ -15,7 +16,7 @@ export async function run(ctx) {
|
|
|
15
16
|
const order = { clean: 0, suspicious: 1, stripped: 1, malicious: 2 };
|
|
16
17
|
for (const name of names) {
|
|
17
18
|
const dir = path.join(ctx.hub, 'skills', name);
|
|
18
|
-
if (!fs.existsSync(dir)) { warn(`未受管: ${name}`); continue; }
|
|
19
|
+
if (!fs.existsSync(dir)) { warn(L(`未受管: ${name}`, `not managed: ${name}`)); continue; }
|
|
19
20
|
const r = auditDir(dir, { strip: false });
|
|
20
21
|
// --llm:additive 语义审(静态结论之上,降级安全)
|
|
21
22
|
if (flags.llm && ctx.llm) {
|
|
@@ -23,7 +24,7 @@ export async function run(ctx) {
|
|
|
23
24
|
.map((p) => ({ path: path.relative(dir, p), content: fs.readFileSync(p, 'utf8') }));
|
|
24
25
|
const lr = await llmAudit(ctx.llm, { name, files }).catch(() => null);
|
|
25
26
|
if (lr) { r.llm = lr; info(` llm: ${lr.verdict}${lr.reasons?.length ? ` — ${lr.reasons.join('; ')}` : ''}`); }
|
|
26
|
-
else warn(' llm audit 不可用——保留静态结论');
|
|
27
|
+
else warn(L(' llm audit 不可用——保留静态结论', ' llm audit unavailable — keeping static verdict'));
|
|
27
28
|
}
|
|
28
29
|
writeScan(ctx.hub, name, r);
|
|
29
30
|
if (order[r.verdict] > order[worst]) worst = r.verdict;
|
package/client/commands/build.js
CHANGED
|
@@ -7,6 +7,7 @@ import { activeDecisions } from '../lib/decide.js';
|
|
|
7
7
|
import { readYAML } from '../../pipeline/lib/util.js';
|
|
8
8
|
import { ok, warn, fail, info } from '../lib/render.js';
|
|
9
9
|
import { mergedDir } from './merge.js';
|
|
10
|
+
import { L } from '../lib/i18n.js';
|
|
10
11
|
|
|
11
12
|
export function buildSkill(hub) {
|
|
12
13
|
const mPath = path.join(mergedDir(hub), 'rules.yml');
|
|
@@ -31,7 +32,7 @@ export function buildSkill(hub) {
|
|
|
31
32
|
|
|
32
33
|
export async function run(ctx) {
|
|
33
34
|
const b = buildSkill(ctx.hub);
|
|
34
|
-
if (!b) { fail('无 merged/rules.yml — 先 skillmkt merge'); return 1; }
|
|
35
|
+
if (!b) { fail(L('无 merged/rules.yml — 先 skillmkt merge', 'no merged/rules.yml — run skillmkt merge first')); return 1; }
|
|
35
36
|
const { merged, kept, customs, pending } = b;
|
|
36
37
|
// 渲染:域分组 + provenance 注释
|
|
37
38
|
const byDom = new Map();
|
|
@@ -56,6 +57,6 @@ export async function run(ctx) {
|
|
|
56
57
|
}
|
|
57
58
|
fs.mkdirSync(outDir, { recursive: true });
|
|
58
59
|
fs.writeFileSync(path.join(outDir, 'SKILL.md'), md);
|
|
59
|
-
ok(`built ${outDir}/SKILL.md — ${kept.length} rules${pending ? `,⚠ ${pending} pending
|
|
60
|
+
ok(`built ${outDir}/SKILL.md — ${kept.length} rules${pending ? L(`,⚠ ${pending} pending 双边已排除`, ` — ⚠ ${pending} pending, both sides excluded`) : ''}`);
|
|
60
61
|
return pending ? 3 : 0;
|
|
61
62
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { loadConflicts, writeConflict } from '../lib/conflicts.js';
|
|
3
3
|
import { decide } from '../lib/decide.js';
|
|
4
4
|
import { ok, fail } from '../lib/render.js';
|
|
5
|
+
import { L } from '../lib/i18n.js';
|
|
5
6
|
|
|
6
7
|
export async function run(ctx) {
|
|
7
8
|
const [id] = ctx.args;
|
|
@@ -10,7 +11,7 @@ export async function run(ctx) {
|
|
|
10
11
|
const c = loadConflicts(ctx.hub).find((x) => x.id === id);
|
|
11
12
|
if (!c) { fail(`not found: ${id}`); return 1; }
|
|
12
13
|
if (!['keep-a', 'keep-b', 'merge', 'dismissed'].includes(resolution)) { fail(`bad resolution: ${resolution}`); return 1; }
|
|
13
|
-
if (resolution === 'merge' && !custom) { fail('resolution=merge 需要 --custom 提供合并文本'); return 1; }
|
|
14
|
+
if (resolution === 'merge' && !custom) { fail(L('resolution=merge 需要 --custom 提供合并文本', 'resolution=merge needs --custom with the merged text')); return 1; }
|
|
14
15
|
decide(ctx.hub, c, { resolution, custom, reason, by: process.env.USER || 'cli' });
|
|
15
16
|
c.status = 'resolved';
|
|
16
17
|
writeConflict(ctx.hub, c);
|
package/client/commands/diff.js
CHANGED
|
@@ -7,6 +7,7 @@ import { walk, treeHash } from '../lib/package.js';
|
|
|
7
7
|
import { gitTreeHash } from '../lib/githash.js';
|
|
8
8
|
import { info, warn, fail } from '../lib/render.js';
|
|
9
9
|
import { semanticDiff } from '../lib/ai.js';
|
|
10
|
+
import { L } from '../lib/i18n.js';
|
|
10
11
|
|
|
11
12
|
function sectionsOf(dir) {
|
|
12
13
|
const f = path.join(dir, 'SKILL.md');
|
|
@@ -17,9 +18,9 @@ function sectionsOf(dir) {
|
|
|
17
18
|
export async function run(ctx) {
|
|
18
19
|
const name = ctx.args[0];
|
|
19
20
|
const s = ctx.library.skills?.[name];
|
|
20
|
-
if (!s) { fail(`未受管: ${name}`); return 1; }
|
|
21
|
+
if (!s) { fail(L(`未受管: ${name}`, `not managed: ${name}`)); return 1; }
|
|
21
22
|
const src = s.source || {};
|
|
22
|
-
if (src.registry !== 'github' || !src.ref) { fail(`${name}:
|
|
23
|
+
if (src.registry !== 'github' || !src.ref) { fail(L(`${name}: 无上游可比`, `${name}: no upstream to diff against`)); return 1; }
|
|
23
24
|
|
|
24
25
|
const [owner, repo] = src.ref.split('/');
|
|
25
26
|
const localDir = path.join(ctx.hub, 'skills', name);
|
|
@@ -44,9 +45,9 @@ export async function run(ctx) {
|
|
|
44
45
|
if (secAdded.length) info(`sections +: ${secAdded.join(' | ')}`);
|
|
45
46
|
if (secRemoved.length) info(`sections -: ${secRemoved.join(' | ')}`);
|
|
46
47
|
if (ctx.flags.raw.semantic) {
|
|
47
|
-
if (!ctx.llm) { warn('--semantic 需要 LLM(config.llm 或 OMLX_*)——以上为结构 diff'); return 0; }
|
|
48
|
+
if (!ctx.llm) { warn(L('--semantic 需要 LLM(config.llm 或 OMLX_*)——以上为结构 diff', '--semantic needs an LLM (config.llm or OMLX_*) — structural diff shown above')); return 0; }
|
|
48
49
|
const summary = await semanticDiff(ctx.llm, { name, added, removed, changed, secAdded, secRemoved }).catch(() => null);
|
|
49
|
-
info(summary ? `semantic: ${summary}` : 'semantic: LLM 不可用——结构 diff 如上');
|
|
50
|
+
info(summary ? `semantic: ${summary}` : L('semantic: LLM 不可用——结构 diff 如上', 'semantic: LLM unavailable — structural diff above'));
|
|
50
51
|
}
|
|
51
52
|
return 0;
|
|
52
53
|
}
|
|
@@ -6,6 +6,7 @@ import { hubExists } from '../lib/hub.js';
|
|
|
6
6
|
import { scanSkillDir } from '../lib/scanner.js';
|
|
7
7
|
import { readSkillDir, treeHash } from '../lib/package.js';
|
|
8
8
|
import { execFileSync } from 'node:child_process';
|
|
9
|
+
import { L } from '../lib/i18n.js';
|
|
9
10
|
|
|
10
11
|
const NODE_MIN = 22;
|
|
11
12
|
|
|
@@ -62,7 +63,7 @@ export async function run(ctx) {
|
|
|
62
63
|
const dir = h.dirs.find((d) => d.exists) ?? h.dirs[0];
|
|
63
64
|
const skills = dir?.exists ? scanSkillDir(dir.path).length : 0;
|
|
64
65
|
const note = h.detectOnly ? 'detect-only' : h.state === 'available' ? 'bin only — dir will create'
|
|
65
|
-
: h.state === 'likely' ? 'dir only — 装过?' : h.state === 'absent' ? '' : `${skills} skills`;
|
|
66
|
+
: h.state === 'likely' ? L('dir only — 装过?', 'dir only — installed?') : h.state === 'absent' ? '' : `${skills} skills`;
|
|
66
67
|
hrows.push({ id: h.id, dir: dir?.path ?? '-', state: h.state, note });
|
|
67
68
|
}
|
|
68
69
|
const hInstalled = hrows.filter((r) => r.state === 'installed').length;
|
|
@@ -89,8 +90,8 @@ export async function run(ctx) {
|
|
|
89
90
|
// llm 已配状态(不探端口——探测只在 init/config)
|
|
90
91
|
if (ctx.llm) say(true, `llm configured: ${ctx.llm.model} @ ${ctx.llm.base_url}`);
|
|
91
92
|
else {
|
|
92
|
-
say('warn', 'llm not configured — LLM features disabled (audit/conflicts/diff 降级静态)');
|
|
93
|
-
info('→ 跑 skillmkt init 一键配置');
|
|
93
|
+
say('warn', L('llm not configured — LLM features disabled (audit/conflicts/diff 降级静态)', 'llm not configured — LLM features disabled (audit/conflicts/diff fall back to static)'));
|
|
94
|
+
info(L('→ 跑 skillmkt init 一键配置', '→ run skillmkt init for one-step setup'));
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
// drift
|
|
@@ -6,6 +6,7 @@ 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
8
|
import { ok, warn, fail } from '../lib/render.js';
|
|
9
|
+
import { L } from '../lib/i18n.js';
|
|
9
10
|
|
|
10
11
|
export async function run(ctx) {
|
|
11
12
|
const input = ctx.args[0];
|
|
@@ -17,7 +18,7 @@ export async function run(ctx) {
|
|
|
17
18
|
? { dir: ref.absPath, provenance: { registry: 'local', adopted_from: ref.absPath }, sha: null }
|
|
18
19
|
: await fetchRef(ref, ctx);
|
|
19
20
|
const pkg = readSkillDir(got.dir);
|
|
20
|
-
if (!pkg) { fail(`不是合法 skill: ${input}`); return 1; }
|
|
21
|
+
if (!pkg) { fail(L(`不是合法 skill: ${input}`, `not a valid skill: ${input}`)); return 1; }
|
|
21
22
|
const audit = auditDir(got.dir, { strip: !ctx.flags.raw.keepScripts });
|
|
22
23
|
if (audit.verdict === 'malicious') {
|
|
23
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); }
|
package/client/commands/init.js
CHANGED
|
@@ -5,19 +5,20 @@ import { probeEndpoints, chat } from '../lib/llm.js';
|
|
|
5
5
|
import { openURL, readDaemon, pidAlive } from '../lib/daemon.js';
|
|
6
6
|
import { choose, confirm } from '../lib/prompt.js';
|
|
7
7
|
import { ok, warn, fail, info } from '../lib/render.js';
|
|
8
|
+
import { L } from '../lib/i18n.js';
|
|
8
9
|
|
|
9
10
|
export async function run(ctx) {
|
|
10
11
|
ensureHub(ctx.hub);
|
|
11
12
|
if (!ctx.tty) {
|
|
12
|
-
info('non-interactive: hub 骨架已建,LLM 配置请用 skillmkt config set llm.*');
|
|
13
|
+
info(L('non-interactive: hub 骨架已建,LLM 配置请用 skillmkt config set llm.*', 'non-interactive: hub skeleton created — configure LLM with skillmkt config set llm.*'));
|
|
13
14
|
return 0;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
// 首问:初始化形态(写 ui.enabled——§3.11 自动接管与裸跑形态听它的)
|
|
17
18
|
const mode = ctx.flags.ui === 'force' ? 'web' : ctx.flags.ui === 'off' ? 'cli'
|
|
18
|
-
: (await choose('初始化方式?', [
|
|
19
|
-
{ label: 'Web 面板(推荐——探测结果、模型列表、harness 勾选可视化)', v: 'web' },
|
|
20
|
-
{ label: '终端向导(纯键盘,SSH/无浏览器环境)', v: 'cli' },
|
|
19
|
+
: (await choose(L('初始化方式?', 'Init method?'), [
|
|
20
|
+
{ label: L('Web 面板(推荐——探测结果、模型列表、harness 勾选可视化)', 'Web panel (recommended — visual probe results, model list, agent checkboxes)'), v: 'web' },
|
|
21
|
+
{ label: L('终端向导(纯键盘,SSH/无浏览器环境)', 'Terminal wizard (keyboard-only, for SSH/no-browser setups)'), v: 'cli' },
|
|
21
22
|
])).v;
|
|
22
23
|
|
|
23
24
|
const raw = readConfig(ctx.hub)._raw;
|
|
@@ -29,24 +30,24 @@ export async function run(ctx) {
|
|
|
29
30
|
try {
|
|
30
31
|
const d = readDaemon(ctx.hub);
|
|
31
32
|
if (d && pidAlive(d.pid)) {
|
|
32
|
-
ok(`Web 初始化已打开: ${openURL(d, '/#setup')}
|
|
33
|
+
ok(`Web 初始化已打开: ${openURL(d, '/#setup')}${L('(服务已在别的终端跑)', ' (server running in another terminal)')}`);
|
|
33
34
|
return 0;
|
|
34
35
|
}
|
|
35
36
|
const { startServer } = await import('./serve.js');
|
|
36
37
|
const srv = await startServer(ctx, { quiet: false });
|
|
37
38
|
const url = openURL({ port: srv.port, token: srv.token }, '/#setup');
|
|
38
|
-
ok(
|
|
39
|
-
info('setup 页内:扫描端点 → 选模型 → 勾 agent → 保存(写入 config.yml)');
|
|
40
|
-
info('服务前台运行中 — Ctrl-C 退出');
|
|
39
|
+
ok(`${L('Web 初始化已打开', 'Web init opened')}: ${url}`);
|
|
40
|
+
info(L('setup 页内:扫描端点 → 选模型 → 勾 agent → 保存(写入 config.yml)', 'in setup: scan endpoints → pick model → check agents → save (writes config.yml)'));
|
|
41
|
+
info(L('服务前台运行中 — Ctrl-C 退出', 'server running in foreground — Ctrl-C to exit'));
|
|
41
42
|
await new Promise(() => {});
|
|
42
43
|
return 0;
|
|
43
44
|
} catch (e) {
|
|
44
|
-
warn(`服务起不来(${e.message.slice(0, 60)}
|
|
45
|
+
warn(L(`服务起不来(${e.message.slice(0, 60)})——回退终端向导`, `server failed to start (${e.message.slice(0, 60)}) — falling back to terminal wizard`));
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
// LLM 端点探测(只在用户进入配置步骤时探测——铁律)
|
|
49
|
-
info('探测本地 LLM 服务…');
|
|
50
|
+
info(L('探测本地 LLM 服务…', 'Probing local LLM services…'));
|
|
50
51
|
const found = await probeEndpoints(400, { extraBases: [ctx.config.llm?.base_url] });
|
|
51
52
|
let base_url = null, model = null;
|
|
52
53
|
|
|
@@ -55,13 +56,13 @@ export async function run(ctx) {
|
|
|
55
56
|
...found.flatMap((f) => f.models.slice(0, 6).map((m) => ({
|
|
56
57
|
label: `${f.name}:${f.port} — ${m}`, v: { base_url: f.base_url, model: m },
|
|
57
58
|
}))),
|
|
58
|
-
{ label: '手动输入端点', v: 'manual' },
|
|
59
|
-
{ label: '跳过(确定性功能照常用)', v: 'skip' },
|
|
59
|
+
{ label: L('手动输入端点', 'Enter endpoint manually'), v: 'manual' },
|
|
60
|
+
{ label: L('跳过(确定性功能照常用)', 'Skip (deterministic features still work)'), v: 'skip' },
|
|
60
61
|
];
|
|
61
62
|
for (const f of found.filter((x) => x.needs_key)) {
|
|
62
|
-
info(`发现 ${f.name}:${f.port}(需要密钥,模型列表读不出)——选"手动输入端点"后填 ${f.base_url}`);
|
|
63
|
+
info(L(`发现 ${f.name}:${f.port}(需要密钥,模型列表读不出)——选"手动输入端点"后填 ${f.base_url}`, `found ${f.name}:${f.port} (key required, can't list models) — pick "manual" and enter ${f.base_url}`));
|
|
63
64
|
}
|
|
64
|
-
const sel = await choose('选择模型端点:', opts);
|
|
65
|
+
const sel = await choose(L('选择模型端点:', 'Choose a model endpoint:'), opts);
|
|
65
66
|
if (sel.v === 'manual') {
|
|
66
67
|
// 手动输入交给 config set 提示
|
|
67
68
|
info('→ skillmkt config set llm.base_url <url> && skillmkt config set llm.model <id>');
|
|
@@ -69,14 +70,14 @@ export async function run(ctx) {
|
|
|
69
70
|
({ base_url, model } = sel.v);
|
|
70
71
|
}
|
|
71
72
|
} else {
|
|
72
|
-
info('未发现本地 LLM 服务(已扫本机所有监听端口)');
|
|
73
|
-
info('→
|
|
73
|
+
info(L('未发现本地 LLM 服务(已扫本机所有监听端口)', 'No local LLM service found (all listening ports probed)'));
|
|
74
|
+
info('→ skillmkt config set llm.base_url http://host:port/v1');
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
// API key 环境变量引用(不存真值)
|
|
77
78
|
if (base_url) {
|
|
78
|
-
const keyEnv = await choose('API key 来源?', [
|
|
79
|
-
{ label: '无需 key(本地端点常见)', v: null },
|
|
79
|
+
const keyEnv = await choose(L('API key 来源?', 'API key source?'), [
|
|
80
|
+
{ label: L('无需 key(本地端点常见)', 'No key needed (common for local endpoints)'), v: null },
|
|
80
81
|
{ label: 'SKILLMKT_API_KEY', v: 'env:SKILLMKT_API_KEY' },
|
|
81
82
|
{ label: 'OMLX_API_KEY', v: 'env:OMLX_API_KEY' },
|
|
82
83
|
]);
|
|
@@ -88,7 +89,7 @@ export async function run(ctx) {
|
|
|
88
89
|
const reply = await chat(probe, { user: 'Reply with exactly: OK', maxTokens: 64 });
|
|
89
90
|
ok(`llm smoke: ${reply.trim().slice(0, 40) || '(empty reply)'}`);
|
|
90
91
|
} catch (e) {
|
|
91
|
-
warn(`llm smoke failed: ${e.message}
|
|
92
|
+
warn(L(`llm smoke failed: ${e.message}(配置已写入,功能将降级)`, `llm smoke failed: ${e.message} (config saved; features will degrade)`));
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
|
|
@@ -97,7 +98,7 @@ export async function run(ctx) {
|
|
|
97
98
|
raw.default_targets = [...new Set([...(raw.default_targets || []), ...installed])];
|
|
98
99
|
writeConfig(ctx.hub, raw);
|
|
99
100
|
|
|
100
|
-
ok(`init done — default_targets: ${raw.default_targets.join(', ') || '(无 installed harness,装好后 targets add)'}`);
|
|
101
|
-
info(`llm: ${model ? `${model} @ ${base_url}` : '未配置(skillmkt init 随时重跑)'}`);
|
|
101
|
+
ok(`init done — default_targets: ${raw.default_targets.join(', ') || L('(无 installed harness,装好后 targets add)', '(no installed agent — use targets add later)')}`);
|
|
102
|
+
info(`llm: ${model ? `${model} @ ${base_url}` : L('未配置(skillmkt init 随时重跑)', 'not configured (rerun skillmkt init anytime)')}`);
|
|
102
103
|
return 0;
|
|
103
104
|
}
|
|
@@ -12,6 +12,7 @@ import { primaryDir } from '../lib/scanner.js';
|
|
|
12
12
|
import { cacheLookup } from '../lib/state.js';
|
|
13
13
|
import { confirm, multiChoose } from '../lib/prompt.js';
|
|
14
14
|
import { ok, warn, fail, info } from '../lib/render.js';
|
|
15
|
+
import { L } from '../lib/i18n.js';
|
|
15
16
|
|
|
16
17
|
// 来源取证:.git remote → skills-lock.json → .market-skills.json → frontmatter
|
|
17
18
|
function recoverProvenance(dir, meta) {
|
|
@@ -87,7 +88,7 @@ export async function run(ctx) {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
const pkg = readSkillDir(srcDir);
|
|
90
|
-
if (!pkg) { fail(`不是合法 skill(缺 SKILL.md): ${srcDir}`); return 1; }
|
|
91
|
+
if (!pkg) { fail(L(`不是合法 skill(缺 SKILL.md): ${srcDir}`, `not a valid skill (missing SKILL.md): ${srcDir}`)); return 1; }
|
|
91
92
|
const name = pkg.name;
|
|
92
93
|
|
|
93
94
|
// ② 审核闸门
|
|
@@ -105,7 +106,7 @@ export async function run(ctx) {
|
|
|
105
106
|
warn(`suspicious: ${audit.findings.length} findings${audit.stripped.length ? `, stripping ${audit.stripped.length} files` : ''}`);
|
|
106
107
|
audit.findings.slice(0, 5).forEach((f) => info(`${f.rule} ${f.file}:${f.line} — ${f.excerpt.slice(0, 80)}`));
|
|
107
108
|
// --yes 不放大 suspicious(安全默认);strict 直接拒
|
|
108
|
-
const proceed = ctx.config.policy === 'strict' ? false : await confirm(`继续安装 ${name}?`, { defaultYes: false });
|
|
109
|
+
const proceed = ctx.config.policy === 'strict' ? false : await confirm(L(`继续安装 ${name}?`, `Install ${name} anyway?`), { defaultYes: false });
|
|
109
110
|
if (!proceed) { fail('install aborted'); return 2; }
|
|
110
111
|
}
|
|
111
112
|
|
|
@@ -118,7 +119,7 @@ export async function run(ctx) {
|
|
|
118
119
|
// 与现有 hub 副本内容对比:相同则跳过 copy
|
|
119
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; })();
|
|
120
121
|
if (srcFilteredHash !== freshHash() && !flags.force) {
|
|
121
|
-
warn(`${name} 已受管且内容不同——--force 覆盖,或 upgrade
|
|
122
|
+
warn(L(`${name} 已受管且内容不同——--force 覆盖,或 upgrade 流程`, `${name} already managed with different content — --force to overwrite, or use upgrade`));
|
|
122
123
|
return 1;
|
|
123
124
|
}
|
|
124
125
|
}
|
|
@@ -144,7 +145,7 @@ export async function run(ctx) {
|
|
|
144
145
|
}
|
|
145
146
|
if (pool.length) {
|
|
146
147
|
const checked = pool.map((_, i) => i).slice(0, targets.length);
|
|
147
|
-
const idx = await multiChoose(`装到哪些位置?`, pool.map((t) => `${t.id} → ${t.dir}`), { checked });
|
|
148
|
+
const idx = await multiChoose(L(`装到哪些位置?`, `Install to which locations?`), pool.map((t) => `${t.id} → ${t.dir}`), { checked });
|
|
148
149
|
targets = idx.map((i) => pool[i]);
|
|
149
150
|
}
|
|
150
151
|
}
|
package/client/commands/list.js
CHANGED
|
@@ -3,6 +3,7 @@ import path from 'node:path';
|
|
|
3
3
|
import { table, out, info } from '../lib/render.js';
|
|
4
4
|
import { scanAll } from '../lib/scanner.js';
|
|
5
5
|
import { listYAML } from '../lib/yamlls.js';
|
|
6
|
+
import { L } from '../lib/i18n.js';
|
|
6
7
|
|
|
7
8
|
export async function run(ctx) {
|
|
8
9
|
const { hub, library, harnesses, project } = ctx;
|
|
@@ -35,12 +36,12 @@ export async function run(ctx) {
|
|
|
35
36
|
json: ctx.flags.json,
|
|
36
37
|
human: () => {
|
|
37
38
|
if (tableRows.length) table(tableRows, cols);
|
|
38
|
-
else info('(empty — skillmkt search / install 开始)');
|
|
39
|
+
else info(L('(empty — skillmkt search / install 开始)', '(empty — skillmkt search / install to start)'));
|
|
39
40
|
if (extRows.length) {
|
|
40
41
|
info('');
|
|
41
|
-
info('external(未收编):');
|
|
42
|
+
info(L('external(未收编):', 'external (unmanaged):'));
|
|
42
43
|
for (const e of extRows) info(` ${e.name.padEnd(30)} ${e.dir}`);
|
|
43
|
-
info(`→ skillmkt install <path>
|
|
44
|
+
info(L(`→ skillmkt install <path> 收编`, `→ skillmkt install <path> to adopt`));
|
|
44
45
|
}
|
|
45
46
|
if (ctx.project) {
|
|
46
47
|
const projRows = rows.filter((r) => r.where === 'project');
|
package/client/commands/merge.js
CHANGED
|
@@ -7,6 +7,7 @@ import { detectConflicts } from '../lib/conflicts.js';
|
|
|
7
7
|
import { autoArbitrate } from '../lib/autoarb.js';
|
|
8
8
|
import { tokens, jaccard, writeYAML } from '../../pipeline/lib/util.js';
|
|
9
9
|
import { ok, warn, fail, info } from '../lib/render.js';
|
|
10
|
+
import { L } from '../lib/i18n.js';
|
|
10
11
|
|
|
11
12
|
export const mergedDir = (hub) => path.join(hub, 'merged');
|
|
12
13
|
|
|
@@ -20,7 +21,7 @@ export async function run(ctx) {
|
|
|
20
21
|
for (const name of names) {
|
|
21
22
|
const dir = path.join(ctx.hub, 'skills', name);
|
|
22
23
|
const f = path.join(dir, 'SKILL.md');
|
|
23
|
-
if (!fs.existsSync(f)) { fail(`未受管: ${name}`); return 1; }
|
|
24
|
+
if (!fs.existsSync(f)) { fail(L(`未受管: ${name}`, `not managed: ${name}`)); return 1; }
|
|
24
25
|
let rs = null;
|
|
25
26
|
if (useLlm) {
|
|
26
27
|
try { rs = await extractRulesLLM(ctx.llm, fs.readFileSync(f, 'utf8'), name); } catch { /* 降级静态 */ }
|
|
@@ -38,12 +39,13 @@ export async function run(ctx) {
|
|
|
38
39
|
// --auto:仲裁直接吃确定项(fresh-context per conflict)
|
|
39
40
|
if (ctx.flags.raw.auto && ctx.llm && news.length) {
|
|
40
41
|
const r = await autoArbitrate(ctx.hub, ctx.llm, news, { onProgress: (c, x) => info(`${c.id}: ${x?.verdict ?? '?'}@${x?.confidence ?? '?'}`) });
|
|
41
|
-
info(`auto-arbiter: ${r.auto}
|
|
42
|
+
info(`auto-arbiter: ${r.auto} ${L('已决', 'decided')},${r.human} ${L('留人', 'left for you')}`);
|
|
42
43
|
}
|
|
43
44
|
const dir = mergedDir(ctx.hub);
|
|
44
45
|
fs.mkdirSync(dir, { recursive: true });
|
|
45
46
|
writeYAML(path.join(dir, 'rules.yml'), { name: outName, sources: names, merged_at: new Date().toISOString(), rules: dedup });
|
|
46
|
-
ok(`merged: ${dedup.length} rules(原始 ${rules.length},去重 -${rules.length - dedup.length})· 新冲突 ${news.length}
|
|
47
|
-
|
|
47
|
+
ok(L(`merged: ${dedup.length} rules(原始 ${rules.length},去重 -${rules.length - dedup.length})· 新冲突 ${news.length}`,
|
|
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 查看队列;decide/resolve 裁决后 build`, `skillmkt conflicts to review; decide/resolve then build`));
|
|
48
50
|
return news.length ? 3 : 0;
|
|
49
51
|
}
|
|
@@ -4,6 +4,7 @@ import fs from 'node:fs';
|
|
|
4
4
|
import { readUpstream } from '../lib/state.js';
|
|
5
5
|
import { gitTreeHash } from '../lib/githash.js';
|
|
6
6
|
import { table, info, warn } from '../lib/render.js';
|
|
7
|
+
import { L } from '../lib/i18n.js';
|
|
7
8
|
|
|
8
9
|
export async function run(ctx) {
|
|
9
10
|
const up = readUpstream(ctx.hub);
|
|
@@ -13,13 +14,13 @@ export async function run(ctx) {
|
|
|
13
14
|
const u = up.skills?.[name];
|
|
14
15
|
const localDir = path.join(ctx.hub, 'skills', name);
|
|
15
16
|
if (!u) {
|
|
16
|
-
rows.push({ name, status: s.source?.registry === 'adopted' || s.source?.registry === 'local' ? 'n/a (无上游)' : 'never checked — run update' });
|
|
17
|
+
rows.push({ name, status: s.source?.registry === 'adopted' || s.source?.registry === 'local' ? L('n/a (无上游)', 'n/a (no upstream)') : 'never checked — run update' });
|
|
17
18
|
continue;
|
|
18
19
|
}
|
|
19
20
|
const localTree = fs.existsSync(localDir) ? gitTreeHash(localDir) : null;
|
|
20
21
|
if (localTree && u.tree_hash && localTree !== u.tree_hash) {
|
|
21
22
|
outdated++;
|
|
22
|
-
rows.push({ name, status: `upstream changed (${u.ref?.slice(0, 6)}) — upgrade
|
|
23
|
+
rows.push({ name, status: `upstream changed (${u.ref?.slice(0, 6)})${L(' — upgrade 应用', ' — run upgrade to apply')}` });
|
|
23
24
|
} else {
|
|
24
25
|
rows.push({ name, status: 'clean' });
|
|
25
26
|
}
|
|
@@ -27,8 +28,8 @@ export async function run(ctx) {
|
|
|
27
28
|
if (ctx.flags.json) { console.log(JSON.stringify({ outdated, rows })); }
|
|
28
29
|
else {
|
|
29
30
|
if (rows.length) table(rows, [{ key: 'name', title: 'skill' }, { key: 'status', title: 'status' }]);
|
|
30
|
-
if (!Object.keys(up.skills || {}).length) warn('state/upstream.yml 为空——先跑 skillmkt update');
|
|
31
|
-
else info(`last refresh: ${up.refreshed_at ?? 'unknown'}(skillmkt update
|
|
31
|
+
if (!Object.keys(up.skills || {}).length) warn(L('state/upstream.yml 为空——先跑 skillmkt update', 'state/upstream.yml is empty — run skillmkt update first'));
|
|
32
|
+
else info(`last refresh: ${up.refreshed_at ?? 'unknown'}${L('(skillmkt update 刷新)', ' (skillmkt update to refresh)')}`);
|
|
32
33
|
}
|
|
33
34
|
return outdated ? 4 : 0;
|
|
34
35
|
}
|
package/client/commands/pack.js
CHANGED
|
@@ -4,12 +4,13 @@ import path from 'node:path';
|
|
|
4
4
|
import os from 'node:os';
|
|
5
5
|
import { execFileSync } from 'node:child_process';
|
|
6
6
|
import { ok, fail, info } from '../lib/render.js';
|
|
7
|
+
import { L } from '../lib/i18n.js';
|
|
7
8
|
|
|
8
9
|
export async function run(ctx) {
|
|
9
10
|
const name = ctx.args[0];
|
|
10
11
|
if (!name) { fail('usage: skillmkt pack <name>'); return 1; }
|
|
11
12
|
const src = path.join(ctx.hub, 'skills', name);
|
|
12
|
-
if (!fs.existsSync(path.join(src, 'SKILL.md'))) { fail(`未受管: ${name}`); return 1; }
|
|
13
|
+
if (!fs.existsSync(path.join(src, 'SKILL.md'))) { fail(L(`未受管: ${name}`, `not managed: ${name}`)); return 1; }
|
|
13
14
|
const ver = ctx.library.skills?.[name]?.version || '0.0.0';
|
|
14
15
|
const out = path.resolve(`${name}-${ver}.tar.gz`);
|
|
15
16
|
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'skillmkt-pack-'));
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// publish <name> --to <registry> — 二期适配器;一期友好报错(clawhub POST /skills)
|
|
2
2
|
import { fail } from '../lib/render.js';
|
|
3
|
+
import { L } from '../lib/i18n.js';
|
|
3
4
|
|
|
4
5
|
export async function run(ctx) {
|
|
5
6
|
const name = ctx.args[0];
|
|
6
7
|
const to = ctx.flags.raw.to;
|
|
7
8
|
if (!name || !to) { fail('usage: skillmkt publish <name> --to <registry>'); return 1; }
|
|
8
|
-
fail(`publish: '${to}' adapter 未实现(二期:clawhub POST /api/v1/skills / 企业 registry)——当前可用 skillmkt pack ${name}
|
|
9
|
+
fail(L(`publish: '${to}' adapter 未实现(二期:clawhub POST /api/v1/skills / 企业 registry)——当前可用 skillmkt pack ${name} 出包手动分发`,
|
|
10
|
+
`publish: '${to}' adapter not implemented (phase 2: clawhub POST /api/v1/skills / enterprise registry) — for now use skillmkt pack ${name} and distribute manually`));
|
|
9
11
|
return 1;
|
|
10
12
|
}
|
|
@@ -6,13 +6,14 @@ import { unproject, targetDirFor } from '../lib/project.js';
|
|
|
6
6
|
import { confirm } from '../lib/prompt.js';
|
|
7
7
|
import { ok, warn, fail, info } from '../lib/render.js';
|
|
8
8
|
import { rmDir } from '../lib/package.js';
|
|
9
|
+
import { L } from '../lib/i18n.js';
|
|
9
10
|
|
|
10
11
|
export async function run(ctx) {
|
|
11
12
|
const name = ctx.args[0];
|
|
12
13
|
if (!name) { fail('usage: skillmkt remove <name> [--purge] [--scope project]'); return 1; }
|
|
13
14
|
const flags = ctx.flags.raw;
|
|
14
15
|
const entry = ctx.library.skills?.[name];
|
|
15
|
-
if (!entry) { fail(`未受管: ${name}`); return 1; }
|
|
16
|
+
if (!entry) { fail(L(`未受管: ${name}`, `not managed: ${name}`)); return 1; }
|
|
16
17
|
|
|
17
18
|
const projectOnly = flags.scope === 'project';
|
|
18
19
|
const targets = Object.entries(ctx.lock.skills?.[name]?.targets || {})
|
|
@@ -26,7 +27,7 @@ export async function run(ctx) {
|
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
if (projectOnly) {
|
|
29
|
-
info('project copy removed; hub 不动');
|
|
30
|
+
info(L('project copy removed; hub 不动', 'project copy removed; hub copy kept'));
|
|
30
31
|
return 0;
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -38,7 +39,7 @@ export async function run(ctx) {
|
|
|
38
39
|
const trash = trashPath(ctx.hub, name);
|
|
39
40
|
rmDir(trash);
|
|
40
41
|
fs.renameSync(hubDir, trash);
|
|
41
|
-
info(`→ .trash(恢复: mv 回 skills/ 或 skillmkt install <path
|
|
42
|
+
info(L(`→ .trash(恢复: mv 回 skills/ 或 skillmkt install <path>)`, `→ .trash (restore: mv back to skills/ or skillmkt install <path>)`));
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
unregisterSkill(ctx.hub, name);
|
|
@@ -10,6 +10,7 @@ import { decide } from '../lib/decide.js';
|
|
|
10
10
|
import { autoArbitrate } from '../lib/autoarb.js';
|
|
11
11
|
import { maybeHandoff } from '../lib/daemon.js';
|
|
12
12
|
import { ok, fail, info, warn } from '../lib/render.js';
|
|
13
|
+
import { L } from '../lib/i18n.js';
|
|
13
14
|
|
|
14
15
|
const edit = (seed) => {
|
|
15
16
|
const f = path.join(os.tmpdir(), `skillmkt-merge-${Date.now()}.md`);
|
|
@@ -24,9 +25,9 @@ export async function run(ctx) {
|
|
|
24
25
|
let queue = loadConflicts(ctx.hub, { pendingOnly: true });
|
|
25
26
|
// --auto:fresh-context 仲裁先吃掉确定项,剩余真价值权衡留人
|
|
26
27
|
if (ctx.flags.raw.auto) {
|
|
27
|
-
if (!ctx.llm) { fail('--auto 需要 LLM(config.llm 或 OMLX_*)'); return 1; }
|
|
28
|
+
if (!ctx.llm) { fail(L('--auto 需要 LLM(config.llm 或 OMLX_*)', '--auto needs an LLM (config.llm or OMLX_*)')); return 1; }
|
|
28
29
|
const r = await autoArbitrate(ctx.hub, ctx.llm, queue, { onProgress: (c, x) => info(`${c.id}: ${x ? `${x.verdict}@${x.confidence}` : 'parse-fail'}`) });
|
|
29
|
-
ok(`auto-arbiter: ${r.auto}
|
|
30
|
+
ok(`auto-arbiter: ${r.auto} ${L('已决', 'decided')},${r.human} ${L('留人', 'left for you')},${r.errors} ${L('错误', 'errors')}`);
|
|
30
31
|
queue = loadConflicts(ctx.hub, { pendingOnly: true });
|
|
31
32
|
if (!queue.length) return 0;
|
|
32
33
|
}
|
|
@@ -34,14 +35,14 @@ export async function run(ctx) {
|
|
|
34
35
|
if (ctx.flags.raw.evidence) {
|
|
35
36
|
const { makeEvidence, isDesignDomain } = await import('../lib/evidence.js');
|
|
36
37
|
for (const c of queue.filter((x) => isDesignDomain(x.domain))) {
|
|
37
|
-
if (!ctx.llm) { warn('--evidence 需要 LLM'); break; }
|
|
38
|
+
if (!ctx.llm) { warn(L('--evidence 需要 LLM', '--evidence needs an LLM')); break; }
|
|
38
39
|
try { await makeEvidence(ctx.llm, ctx.hub, c); info(`${c.id}: evidence ${c.evidence}`); }
|
|
39
40
|
catch (e) { warn(`${c.id}: evidence failed — ${e.message.slice(0, 60)}`); }
|
|
40
41
|
}
|
|
41
42
|
}
|
|
42
43
|
const target = ctx.args[0] ? queue.filter((c) => c.id === ctx.args[0]) : queue;
|
|
43
|
-
if (!target.length) { info('无 pending 冲突'); return 0; }
|
|
44
|
-
if (!process.stdin.isTTY || ctx.flags.raw.cli === false) { info(`${target.length} pending(非 TTY 不裁决)— skillmkt resolve 终端交互 / --ui
|
|
44
|
+
if (!target.length) { info(L('无 pending 冲突', 'no pending conflicts')); return 0; }
|
|
45
|
+
if (!process.stdin.isTTY || ctx.flags.raw.cli === false) { info(L(`${target.length} pending(非 TTY 不裁决)— skillmkt resolve 终端交互 / --ui 网页`, `${target.length} pending (not resolved without a TTY) — run skillmkt resolve interactively, or the web UI`)); return 3; }
|
|
45
46
|
|
|
46
47
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
47
48
|
const ask = (q) => new Promise((r) => rl.question(q, r));
|
|
@@ -51,18 +52,18 @@ export async function run(ctx) {
|
|
|
51
52
|
console.log(` A(${c.sides[0].source}): ${c.sides[0].text}`);
|
|
52
53
|
console.log(` B(${c.sides[1].source}): ${c.sides[1].text}`);
|
|
53
54
|
for (;;) {
|
|
54
|
-
const a = (await ask(' [a][b][m][e 编辑合并][d 误报][s 跳过][q] > ')).trim().toLowerCase();
|
|
55
|
+
const a = (await ask(L(' [a][b][m][e 编辑合并][d 误报][s 跳过][q] > ', ' [a][b][m][e dit merge][d ismiss][s kip][q] > '))).trim().toLowerCase();
|
|
55
56
|
if (a === 'q') { rl.close(); return resolved ? 0 : 3; }
|
|
56
57
|
if (a === 's') break;
|
|
57
58
|
const res = { a: 'keep-a', b: 'keep-b', m: 'merge', e: 'merge', d: 'dismissed' }[a];
|
|
58
59
|
if (!res) continue;
|
|
59
60
|
let custom = null;
|
|
60
61
|
if (a === 'm' || a === 'e') {
|
|
61
|
-
custom = a === 'e' ? edit(`${c.sides[0].text}\n---\n${c.sides[1].text}\n`) : (await ask(' 合并文本 > ')).trim();
|
|
62
|
-
if (!custom) { info('空文本,跳过'); break; }
|
|
62
|
+
custom = a === 'e' ? edit(`${c.sides[0].text}\n---\n${c.sides[1].text}\n`) : (await ask(L(' 合并文本 > ', ' merged text > '))).trim();
|
|
63
|
+
if (!custom) { info(L('空文本,跳过', 'empty text — skipped')); break; }
|
|
63
64
|
}
|
|
64
65
|
const reason = (await ask(' reason > ')).trim();
|
|
65
|
-
if (!reason) { info('reason 必填'); continue; }
|
|
66
|
+
if (!reason) { info(L('reason 必填', 'reason is required')); continue; }
|
|
66
67
|
decide(ctx.hub, c, { resolution: res, custom, reason, by: process.env.USER || 'cli' });
|
|
67
68
|
c.status = 'resolved';
|
|
68
69
|
writeConflict(ctx.hub, c);
|
|
@@ -7,12 +7,13 @@ import { projectSkill, targetDirFor } from '../lib/project.js';
|
|
|
7
7
|
import { updateLock } from '../lib/hub.js';
|
|
8
8
|
import { treeHash } from '../lib/package.js';
|
|
9
9
|
import { ok, fail } from '../lib/render.js';
|
|
10
|
+
import { L } from '../lib/i18n.js';
|
|
10
11
|
|
|
11
12
|
export async function run(ctx) {
|
|
12
13
|
const name = ctx.args[0];
|
|
13
14
|
const s = ctx.library.skills?.[name];
|
|
14
|
-
if (!s) { fail(`未受管: ${name}`); return 1; }
|
|
15
|
-
if (!fs.existsSync(historyDir(ctx.hub, name))) { fail(`${name}: 无历史副本(upgrade
|
|
15
|
+
if (!s) { fail(L(`未受管: ${name}`, `not managed: ${name}`)); return 1; }
|
|
16
|
+
if (!fs.existsSync(historyDir(ctx.hub, name))) { fail(L(`${name}: 无历史副本(upgrade 后才有一版深度)`, `${name}: no history copy (one version deep, only after upgrade)`)); return 1; }
|
|
16
17
|
if (!ctx.flags.dryRun) {
|
|
17
18
|
historyRestore(ctx.hub, name);
|
|
18
19
|
const dest = path.join(ctx.hub, 'skills', name);
|
|
@@ -2,6 +2,7 @@
|
|
|
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';
|
|
5
|
+
import { L } from '../lib/i18n.js';
|
|
5
6
|
|
|
6
7
|
export async function run(ctx) {
|
|
7
8
|
const query = ctx.args.join(' ').trim();
|
|
@@ -35,7 +36,7 @@ export async function run(ctx) {
|
|
|
35
36
|
if (wantRemote) {
|
|
36
37
|
info('');
|
|
37
38
|
info(`REMOTE ${remote.base || ''}`);
|
|
38
|
-
if (remoteErr) warn(`remote search failed: ${remoteErr}
|
|
39
|
+
if (remoteErr) warn(`remote search failed: ${remoteErr}${L('(本地结果可用)', ' (local results still shown)')}`);
|
|
39
40
|
else if (remote.skills.length) {
|
|
40
41
|
table(remote.skills.slice(0, 15).map((s) => ({ name: s.name, id: s.slug, installs: s.installs })),
|
|
41
42
|
[{ key: 'name', title: 'skill' }, { key: 'id', title: 'id' }, { key: 'installs', title: 'installs' }]);
|