@nathan33/nao-skill 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/nao-fleet/SKILL.md +1 -1
- package/.agents/templates/AGENTS.md.example +1 -1
- package/README.md +6 -4
- package/bin/nao-skill.js +123 -41
- package/package.json +1 -1
|
@@ -31,7 +31,7 @@ nao 是一套「多角色 AI 开发舰队」:6 个分工明确的常驻会话
|
|
|
31
31
|
2. **拉起舰队**:`bash .agents/scripts/nao-fleet.sh ensure pm arch-designer rd-fe rd-be qa rd-infra`
|
|
32
32
|
- 任务派生(并行隔离):`ensure --task <编号> <别名>`
|
|
33
33
|
- 状态 / 回收:`status` / `close --task <编号> <别名>`
|
|
34
|
-
3. **迁移旧版安装**:`npx @nathan33/nao-skill migrate`(旧文件备份到 `.agents/.nao-obsolete
|
|
34
|
+
3. **迁移旧版安装**:`npx @nathan33/nao-skill migrate`(旧文件备份到 `.agents/.nao-obsolete/`)。是否写 shim 由**判定式**决定(旧脚本 / 已有 shim / 全仓 `nao-fleet|nao-skill|NAO_SKILLS` 引用 ⇒ 写);纯文档仓判定为跳过并显式告知,可用 `--shim` / `--no-shim` 覆盖。
|
|
35
35
|
|
|
36
36
|
## 硬约束(勿违反)
|
|
37
37
|
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
|
|
37
37
|
## 指针(勿复制内容)
|
|
38
38
|
|
|
39
|
-
> 项目内 `.agents/` **只有 shim**(`.agents/scripts/nao-fleet.sh`);机制单一事实来源在 **nao 机制包**内,包根由 `NAO_SKILLS` 给出(fleet 注入到会话系统提示)。所有机制引用一律以 `$NAO_SKILLS/.agents/`
|
|
39
|
+
> 项目内 `.agents/` **只有 shim**(`.agents/scripts/nao-fleet.sh`);机制单一事实来源在 **nao 机制包**内,包根由 `NAO_SKILLS` 给出(fleet 注入到会话系统提示)。所有机制引用一律以 `$NAO_SKILLS/.agents/` 为根解析。**例外:无脚本、无引用的纯文档仓不建 shim**(迁移判定式自动跳过,可用 `--shim` 覆盖)。
|
|
40
40
|
|
|
41
41
|
- 团队级协议/角色清单:`$NAO_SKILLS/.agents/common/` + `$NAO_SKILLS/.agents/roles.yaml`
|
|
42
42
|
- 角色卡:`$NAO_SKILLS/.agents/prompts/`
|
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ nao-skills 是一套 **角色卡 + 协作规矩 + 小工具**。装上以后,
|
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
cd 你的项目
|
|
27
|
-
pi install --local npm:@nathan33/nao-skill@0.
|
|
27
|
+
pi install --local npm:@nathan33/nao-skill@0.13.0 # 声明 pin + 把机制包物化到项目内 .pi/npm
|
|
28
28
|
npx @nathan33/nao-skill init # 写入转发 shim + 生成 AGENTS.md
|
|
29
29
|
```
|
|
30
30
|
|
|
@@ -39,9 +39,11 @@ nao-skills 是一套 **角色卡 + 协作规矩 + 小工具**。装上以后,
|
|
|
39
39
|
**老项目迁移**(曾在项目里铺开整套 `.agents/` 的):
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
npx @nathan33/nao-skill migrate # 旧文件备份到 .agents/.nao-obsolete
|
|
42
|
+
npx @nathan33/nao-skill migrate # 旧文件备份到 .agents/.nao-obsolete/,再按需写入转发入口
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
迁移默认按**判定式**决定是否写转发入口(shim):仓里还有旧的 `nao-fleet.sh`、或已存在 shim、或全仓有 `nao-fleet` / `nao-skill` / `NAO_SKILLS` 引用,就写;**无脚本、无引用的纯文档仓会被判定跳过**,并打印一行告知。要改变判定结果,显式加 `--shim`(强制写)或 `--no-shim`(强制不写),两者不能同时给(`exit 2`)。旧版的 `.agents/.nao-migrated` 标记**已废弃**:迁移不再读写它,可安全删除。`.agents/.nao-version` 的语义是「本机已安装机制包版本」(供升级检测),**不表达迁移状态**——迁移状态由「是否还有旧资产」推断。
|
|
46
|
+
|
|
45
47
|
## 用起来(3 步)
|
|
46
48
|
|
|
47
49
|
```bash
|
|
@@ -134,7 +136,7 @@ $NAO_SKILLS/.agents/scripts/qq-notify --dry-run "连通性自检" # 只取
|
|
|
134
136
|
|
|
135
137
|
- **旧的完整性判据已失效**:以前下游靠「项目内 `.agents/**` 与上游逐字节 sha 一致」证明机制没漏没改;现在项目内不再有机制副本,这条判据不再适用。
|
|
136
138
|
- **新的完整性判据:以 pin 的包版本为准**。`.pi/settings.json` 记录版本,`pi install/update` 从包物化;包里是什么就是什么,不存在「项目内被就地改动」的问题。转发入口是生成的固定文本,可用 `npx @nathan33/nao-skill init` 幂等重写核对。
|
|
137
|
-
- **版本权威口径**:`.pi/settings.json` 里的 pin 是**唯一权威**(`pi install/update` 据此物化到 `.pi/npm`);`.agents/.nao-version`
|
|
139
|
+
- **版本权威口径**:`.pi/settings.json` 里的 pin 是**唯一权威**(`pi install/update` 据此物化到 `.pi/npm`);`.agents/.nao-version` 的语义是**本机已安装机制包版本**(供升级检测),**不表达迁移状态**、**不作为版本依据**;两者不一致时**以 pin 为准**。
|
|
138
140
|
- **fmt 边界**:包内 `.agents/**` 仍以上游原始存储形态发布(部分 YAML / Markdown / MTS 未按 oxfmt / prettier 归一)。迁移期仍持有旧版全套 `.agents/**` 的仓库,继续把 `.agents/**` 排除出 fmt 校验即可,⛔ **不要为过 fmt 就地格式化**;新形态项目内只有转发入口,无需再处理。
|
|
139
141
|
|
|
140
142
|
### 物化与离线(CI / 无 pi 环境必读)
|
|
@@ -149,7 +151,7 @@ $NAO_SKILLS/.agents/scripts/qq-notify --dry-run "连通性自检" # 只取
|
|
|
149
151
|
|
|
150
152
|
- **迁移期零改动**:旧的全套 `.agents/scripts/nao-fleet.sh` 照常可用,这些仓库的 CI 目前不调用 `check`,不受影响。
|
|
151
153
|
- 想切到新形态时,在各仓执行 `npx @nathan33/nao-skill migrate`:只删**已知 nao 资产**(共享的 `.agents/skills/` 里项目自有的技能会保留),并把 `skills-lock.json` 里重复的 `frontend-design` 来源收敛为「机制包唯一来源」。
|
|
152
|
-
-
|
|
154
|
+
- **纯文档仓(如 `nao-todo-minimal`)特例**:无脚本、无 `nao-fleet`/`nao-skill` 引用 ⇒ 迁移判定为**纯文档迁移,不建转发入口**(可显式 `--shim` 强制;也可 `--no-shim` 强制不建);它的 `.agents/commands/`、`.agents/prompts/` 不在 pi 的 skill 扫描面(pi 只扫 `.agents/skills/**`)。
|
|
153
155
|
|
|
154
156
|
## 想深入
|
|
155
157
|
|
package/bin/nao-skill.js
CHANGED
|
@@ -42,8 +42,6 @@ const SHIM_SRC = fileURLToPath(new URL('./shim/nao-fleet.sh', import.meta.url));
|
|
|
42
42
|
const OBSOLETE = ['.agents/skills/checklists'];
|
|
43
43
|
// 安装版本标记(install/update 写入,供下次检测升级)
|
|
44
44
|
const VERSION_FILE = '.agents/.nao-version';
|
|
45
|
-
// 迁移一次性提示标记(BR4:每版本最多提示一次)
|
|
46
|
-
const MIGRATED_FILE = '.agents/.nao-migrated';
|
|
47
45
|
|
|
48
46
|
// 旧版全套安装的已知 nao 资产(迁移时**精准**备份+移除;共享目录不得整目录删)
|
|
49
47
|
const LEGACY_TOP_DIRS = ['prompts', 'common', 'checklists', 'templates'];
|
|
@@ -287,10 +285,67 @@ function detectLegacyAssets(target) {
|
|
|
287
285
|
return hits;
|
|
288
286
|
}
|
|
289
287
|
|
|
288
|
+
// ---------------------------------------------------------------------------
|
|
289
|
+
// F4 shim 判定式:needsShim = A ∨ A′ ∨ B(Node 实现,无 shell grep / 无网络时间依赖)
|
|
290
|
+
// A 旧版真脚本存在 · A′ 已存在 shim · B 存在外部调用点
|
|
291
|
+
// IGNORE = .git/** · node_modules/** · .pi/** · .agents/.nao-obsolete/** · 二进制 · >1MiB
|
|
292
|
+
// B 额外排除待移除旧资产(legacyAssetPaths);.pi/** 必须排除,否则已物化仓恒真
|
|
293
|
+
// ---------------------------------------------------------------------------
|
|
294
|
+
const SHIM_SCAN_IGNORE_TOP = new Set(['.git', 'node_modules', '.pi']);
|
|
295
|
+
const SHIM_REF_RE = /nao-fleet|nao-skill|NAO_SKILLS/;
|
|
296
|
+
|
|
297
|
+
function detectShimNeed(target) {
|
|
298
|
+
const shim = join(target, '.agents', 'scripts', 'nao-fleet.sh');
|
|
299
|
+
if (existsSync(shim)) return { needed: true, reason: isShimFile(shim) ? 'shim-present' : 'legacy-script' };
|
|
300
|
+
const legacyRel = detectLegacyAssets(target);
|
|
301
|
+
const isLegacyPath = (rel) => legacyRel.some((l) => (l.endsWith('/') ? rel.startsWith(l) : rel === l));
|
|
302
|
+
const stack = [target];
|
|
303
|
+
while (stack.length) {
|
|
304
|
+
const dir = stack.pop();
|
|
305
|
+
let entries;
|
|
306
|
+
try { entries = readdirSync(dir, { withFileTypes: true }); } catch { continue; }
|
|
307
|
+
for (const e of entries) {
|
|
308
|
+
const p = join(dir, e.name);
|
|
309
|
+
const rel = relative(target, p);
|
|
310
|
+
if (e.isSymbolicLink()) continue;
|
|
311
|
+
if (e.isDirectory()) {
|
|
312
|
+
if (SHIM_SCAN_IGNORE_TOP.has(rel.split('/')[0]) || e.name === 'node_modules') continue;
|
|
313
|
+
if (rel === '.agents/.nao-obsolete' || rel.startsWith('.agents/.nao-obsolete/')) continue;
|
|
314
|
+
stack.push(p);
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
if (!e.isFile() || isLegacyPath(rel)) continue;
|
|
318
|
+
let st;
|
|
319
|
+
try { st = statSync(p); } catch { continue; }
|
|
320
|
+
if (st.size > 1024 * 1024) continue;
|
|
321
|
+
let buf;
|
|
322
|
+
try { buf = readFileSync(p); } catch { continue; }
|
|
323
|
+
if (buf.includes(0)) continue; // 二进制(含 NUL 字节)
|
|
324
|
+
if (SHIM_REF_RE.test(buf.toString('utf8'))) return { needed: true, reason: `reference:${rel}` };
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return { needed: false, reason: 'no-reference' };
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
function resolveShim(target, mode) {
|
|
331
|
+
if (mode === 'shim') return { needed: true, reason: 'forced' };
|
|
332
|
+
if (mode === 'no-shim') return { needed: false, reason: 'forced-off' };
|
|
333
|
+
return detectShimNeed(target);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function applyShim(target, decision, verbose) {
|
|
337
|
+
if (decision.needed) { installShim(target, verbose); return; }
|
|
338
|
+
if (decision.reason === 'forced-off') {
|
|
339
|
+
warn('按 --no-shim 跳过 shim 安装(项目内将没有 .agents/scripts/nao-fleet.sh;需要时用 --shim 覆盖)。');
|
|
340
|
+
} else {
|
|
341
|
+
warn('未发现 nao 脚本/引用 → 判定为纯文档迁移,未写 shim(可用 --shim 强制)。');
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
290
345
|
// ---------------------------------------------------------------------------
|
|
291
346
|
// init:干净项目 —— 写 shim + AGENTS.md(不复制机制;机制在 .pi/npm 包内)
|
|
292
347
|
// ---------------------------------------------------------------------------
|
|
293
|
-
function init(target, force, verbose) {
|
|
348
|
+
function init(target, force, verbose, shimMode = 'shim', decision = null) {
|
|
294
349
|
const legacy = detectLegacyAssets(target);
|
|
295
350
|
if (legacy.length) {
|
|
296
351
|
if (!force) {
|
|
@@ -301,9 +356,9 @@ function init(target, force, verbose) {
|
|
|
301
356
|
}
|
|
302
357
|
// F2:--force 不得绕过迁移守卫(否则 shim 覆盖 + 旧副本残留 = 混装,违 BR5/AC1 双注册)
|
|
303
358
|
log('init --force 检测到旧版 .agents/:改走 migrate(备份 + 精准移除 + shim),避免混装。');
|
|
304
|
-
return migrate(target, true, verbose);
|
|
359
|
+
return migrate(target, true, verbose, shimMode === 'no-shim' ? 'no-shim' : 'shim');
|
|
305
360
|
}
|
|
306
|
-
|
|
361
|
+
applyShim(target, decision || resolveShim(target, shimMode), verbose);
|
|
307
362
|
writeVersion(target);
|
|
308
363
|
if (!hasNaoPackageDeclared(target)) {
|
|
309
364
|
warn(`未在 .pi/settings.json 发现 npm:${PKG.name} 声明;请先执行 pi install --local npm:${PKG.name}@<pin>。`);
|
|
@@ -399,69 +454,82 @@ function removeJsonProperty(raw, key) {
|
|
|
399
454
|
while (vs < raw.length && /\s/.test(raw[vs])) vs++;
|
|
400
455
|
const ve = findJsonValueEnd(raw, vs);
|
|
401
456
|
if (ve < 0) return null;
|
|
402
|
-
//
|
|
457
|
+
// 行级删除(保缩进/其余字节):仅当该属性独占一行(行首即 key)时适用
|
|
403
458
|
let lineStart = m.index;
|
|
404
459
|
while (lineStart > 0 && raw[lineStart - 1] !== '\n') lineStart--;
|
|
405
460
|
let nl = raw.indexOf('\n', lineStart);
|
|
406
461
|
if (nl === -1) nl = raw.length;
|
|
407
|
-
if (
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
462
|
+
if (raw.slice(lineStart, nl).trim().startsWith(`"${key}"`)) {
|
|
463
|
+
// 本属性值闭合所在行之后(含换行)
|
|
464
|
+
let lineEnd = ve;
|
|
465
|
+
while (lineEnd < raw.length && raw[lineEnd] !== '\n') lineEnd++;
|
|
466
|
+
if (lineEnd < raw.length) lineEnd++;
|
|
467
|
+
// 是否还有后续属性(值后跟逗号)
|
|
468
|
+
let after = ve;
|
|
469
|
+
while (after < raw.length && (raw[after] === ' ' || raw[after] === '\t')) after++;
|
|
470
|
+
if (raw[after] === ',') {
|
|
471
|
+
return raw.slice(0, lineStart) + raw.slice(lineEnd);
|
|
472
|
+
}
|
|
473
|
+
// 末位属性:删本行,并去掉前一属性末尾的逗号
|
|
474
|
+
let out = raw.slice(0, lineStart) + raw.slice(lineEnd);
|
|
475
|
+
let p = lineStart;
|
|
476
|
+
while (p > 0 && /[ \t\r\n]/.test(out[p - 1])) p--;
|
|
477
|
+
if (out[p - 1] === ',') out = out.slice(0, p - 1) + out.slice(p);
|
|
478
|
+
return out;
|
|
479
|
+
}
|
|
480
|
+
// F7 属性级回退(单行/异形格式):删「属性 token + 一个分隔逗号」,其余字节不动
|
|
413
481
|
let after = ve;
|
|
414
|
-
while (after < raw.length && (raw[after]
|
|
415
|
-
if (raw[after] === ',')
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
while (p > 0 && /[ \t\r\n]/.test(out[p - 1])) p--;
|
|
422
|
-
if (out[p - 1] === ',') out = out.slice(0, p - 1) + out.slice(p);
|
|
423
|
-
return out;
|
|
482
|
+
while (after < raw.length && /\s/.test(raw[after])) after++;
|
|
483
|
+
if (raw[after] === ',') return raw.slice(0, m.index) + raw.slice(after + 1);
|
|
484
|
+
// 末位属性:删前一个分隔逗号 + 本属性 token
|
|
485
|
+
let p = m.index;
|
|
486
|
+
while (p > 0 && /[ \t\r\n]/.test(raw[p - 1])) p--;
|
|
487
|
+
if (raw[p - 1] === ',') return raw.slice(0, p - 1) + raw.slice(ve);
|
|
488
|
+
return null;
|
|
424
489
|
}
|
|
425
490
|
|
|
426
491
|
// §12-C:nao 包为唯一来源 —— 移除 skills-lock.json 里重复的 frontend-design 条目(原文件先备份)
|
|
427
492
|
// F1:文本级删除单条,保留原缩进与其余字节(4 空格 / 2 空格均不重排)
|
|
493
|
+
// F7:三态返回 ok | absent | failed;failed 时恰一行 warn(不静默)且不改写
|
|
428
494
|
function stripLockDuplicate(target, stamp, verbose) {
|
|
429
495
|
const lock = join(target, 'skills-lock.json');
|
|
430
|
-
if (!existsSync(lock)) return
|
|
496
|
+
if (!existsSync(lock)) return 'absent';
|
|
431
497
|
const raw = readFileSync(lock, 'utf8');
|
|
432
498
|
let data;
|
|
433
|
-
try { data = JSON.parse(raw); } catch { return
|
|
434
|
-
if (!data.skills || !data.skills['frontend-design']) return
|
|
499
|
+
try { data = JSON.parse(raw); } catch { return 'absent'; }
|
|
500
|
+
if (!data.skills || !data.skills['frontend-design']) return 'absent';
|
|
501
|
+
const failWarn = () => warn('skills-lock.json 存在重复 frontend-design,但无法安全文本删除:请手工移除该条目;其余迁移步骤不受影响。');
|
|
435
502
|
const next = removeJsonProperty(raw, 'frontend-design');
|
|
436
|
-
if (next == null) return
|
|
503
|
+
if (next == null) { failWarn(); return 'failed'; }
|
|
437
504
|
try {
|
|
438
505
|
const parsed = JSON.parse(next);
|
|
439
|
-
if (!parsed.skills || 'frontend-design' in parsed.skills) return
|
|
440
|
-
} catch { return
|
|
506
|
+
if (!parsed.skills || 'frontend-design' in parsed.skills) { failWarn(); return 'failed'; }
|
|
507
|
+
} catch { failWarn(); return 'failed'; }
|
|
441
508
|
const bak = join(target, '.agents', '.nao-obsolete', stamp, 'skills-lock.json');
|
|
442
509
|
mkdirSync(join(bak, '..'), { recursive: true });
|
|
443
510
|
cpSync(lock, bak);
|
|
444
511
|
writeFileSync(lock, next);
|
|
445
512
|
if (verbose) log(' strip skills-lock.json → 文本级移除 frontend-design(其余字节不变)');
|
|
446
|
-
return
|
|
513
|
+
return 'ok';
|
|
447
514
|
}
|
|
448
515
|
|
|
449
|
-
function migrate(target, force, verbose) {
|
|
516
|
+
function migrate(target, force, verbose, shimMode = 'auto') {
|
|
450
517
|
const legacy = detectLegacyAssets(target);
|
|
451
518
|
const stamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
519
|
+
// F4 判定式必须在备份/移除之前采样(B 需排除待移除旧资产)
|
|
520
|
+
const decision = resolveShim(target, shimMode);
|
|
521
|
+
// B2:去重置于早退判断之前 —— 无 legacy 资产(走 init 路径)时同样生效
|
|
522
|
+
stripLockDuplicate(target, stamp, verbose);
|
|
452
523
|
if (!legacy.length) {
|
|
453
524
|
log('未发现旧版全套 .agents/ 机制副本;按 init 处理。');
|
|
454
|
-
return init(target, force, verbose);
|
|
525
|
+
return init(target, force, verbose, shimMode, decision);
|
|
455
526
|
}
|
|
456
527
|
log(`迁移:发现 ${legacy.length} 处旧版 nao 资产,备份到 .agents/.nao-obsolete/${stamp}/ 后移除。`);
|
|
457
528
|
const removed = migrateLegacy(target, stamp, verbose);
|
|
458
|
-
|
|
459
|
-
installShim(target, verbose);
|
|
529
|
+
applyShim(target, decision, verbose);
|
|
460
530
|
writeVersion(target);
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
log(`✔ 迁移完成:移除 ${removed.length} 项已知 nao 资产(备份在 .agents/.nao-obsolete/${stamp}/);shim 已就位。`);
|
|
464
|
-
log(' 旧命令照跑:bash .agents/scripts/nao-fleet.sh check / ensure ...');
|
|
531
|
+
log(`✔ 迁移完成:移除 ${removed.length} 项已知 nao 资产(备份在 .agents/.nao-obsolete/${stamp}/)。`);
|
|
532
|
+
if (decision.needed) log(' 旧命令照跑:bash .agents/scripts/nao-fleet.sh check / ensure ...');
|
|
465
533
|
}
|
|
466
534
|
|
|
467
535
|
// ---------------------------------------------------------------------------
|
|
@@ -484,8 +552,8 @@ function help() {
|
|
|
484
552
|
console.log(`nao-skill v${PKG.version} — nao 多角色 AI 开发舰队(pi 原生分发)
|
|
485
553
|
|
|
486
554
|
用法:
|
|
487
|
-
nao-skill init [dir] [-v]
|
|
488
|
-
nao-skill migrate [dir] [-v]
|
|
555
|
+
nao-skill init [dir] [-v] [--shim|--no-shim] 干净项目:写 shim + AGENTS.md(默认写)
|
|
556
|
+
nao-skill migrate [dir] [-v] [--shim|--no-shim] 迁移旧版全套 .agents/:备份 .nao-obsolete/ + 移除 + shim
|
|
489
557
|
nao-skill exec <参数...> 转发给包内 nao-fleet.sh(CI/脚本用;NAO_SKILLS=包根)
|
|
490
558
|
nao-skill plugins list 列出已知 pi 插件与安装状态
|
|
491
559
|
nao-skill plugins install <名...> 安装指定插件(intercom/ask-me/subagents/web-access/codegraph)
|
|
@@ -493,6 +561,11 @@ function help() {
|
|
|
493
561
|
nao-skill --version 显示版本
|
|
494
562
|
nao-skill --help 显示本帮助
|
|
495
563
|
|
|
564
|
+
shim 判定式(migrate 默认;init 默认装):
|
|
565
|
+
needsShim = A ∨ A′ ∨ B(Node 扫描,跳过 >1MiB 与二进制,排除 .git/.pi/node_modules/.nao-obsolete)
|
|
566
|
+
A 旧版真脚本存在 · A′ 已存在 shim · B 全仓有 nao-fleet|nao-skill|NAO_SKILLS 引用(排除待移除旧资产)
|
|
567
|
+
判定为纯文档迁移时不写 shim,并打印显式告知;用 --shim / --no-shim 覆盖(互斥 → exit 2)
|
|
568
|
+
|
|
496
569
|
兼容(旧流程,建议迁移到 init/migrate):
|
|
497
570
|
nao-skill install [dir] [--force] 复制全套 .agents/ 到项目(--plugins 顺带装插件)
|
|
498
571
|
nao-skill update [dir] 源优先覆盖升级旧版全套安装
|
|
@@ -517,20 +590,29 @@ if (cmd === '--version' || cmd === '-v' || cmd === 'version') {
|
|
|
517
590
|
let target = process.cwd();
|
|
518
591
|
let force = false;
|
|
519
592
|
let verbose = false;
|
|
593
|
+
let wantShim = false;
|
|
594
|
+
let wantNoShim = false;
|
|
520
595
|
const rest = args.slice(1);
|
|
521
596
|
for (let i = 0; i < rest.length; i++) {
|
|
522
597
|
if (rest[i] === '--force' || rest[i] === '-f') force = true;
|
|
523
598
|
else if (rest[i] === '--verbose' || rest[i] === '-v') verbose = true;
|
|
599
|
+
else if (rest[i] === '--shim') wantShim = true;
|
|
600
|
+
else if (rest[i] === '--no-shim') wantNoShim = true;
|
|
524
601
|
else if (rest[i] === '--target') target = resolve(rest[++i]);
|
|
525
602
|
else if (!rest[i].startsWith('-')) target = resolve(rest[i]);
|
|
526
603
|
else { warn(`未知参数: ${rest[i]}`); process.exit(2); }
|
|
527
604
|
}
|
|
605
|
+
if (wantShim && wantNoShim) {
|
|
606
|
+
warn('--shim 与 --no-shim 互斥,不能同时使用。');
|
|
607
|
+
process.exit(2);
|
|
608
|
+
}
|
|
528
609
|
if (!statIsDir(target)) {
|
|
529
610
|
warn(`目标目录无效: ${target}`);
|
|
530
611
|
process.exit(2);
|
|
531
612
|
}
|
|
532
|
-
|
|
533
|
-
|
|
613
|
+
const shimMode = wantShim ? 'shim' : wantNoShim ? 'no-shim' : (cmd === 'init' ? 'shim' : 'auto');
|
|
614
|
+
if (cmd === 'init') init(target, force, verbose, shimMode);
|
|
615
|
+
else migrate(target, force, verbose, shimMode);
|
|
534
616
|
} else if (cmd === 'exec') {
|
|
535
617
|
execFleet(args.slice(1));
|
|
536
618
|
} else if (cmd === 'install' || cmd === 'i') {
|