@compass-aiden/neo 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/dist/cli.d.ts +3 -1
- package/dist/index.js +113 -65
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @compass-aiden/neo
|
|
2
2
|
|
|
3
|
-
跨 Agent 技能角色管理 CLI(bin: `neo`)——用「角色(role)」为不同的 AI agent
|
|
3
|
+
跨 Agent 技能角色管理 CLI(bin: `neo`)——用「角色(role)」为不同的 AI agent 提供不同的技能集与系统提示词,继承全局底座(`roles/default`),底层安装复用 [`npx skills`](https://github.com/vercel-labs/skills)。
|
|
4
|
+
|
|
5
|
+
0.2 起默认是**启动隔离**:`neo run <agent>` 为 `角色 × agent` 物化独立的配置根,不写用户全局目录;`neo use <role> --global` 才回到 0.1.x 的全局挂载。
|
|
4
6
|
|
|
5
7
|
## 安装
|
|
6
8
|
|
|
@@ -14,12 +16,16 @@ npm i -g @compass-aiden/neo # 满意再全局安装
|
|
|
14
16
|
## 快速上手
|
|
15
17
|
|
|
16
18
|
```pwsh
|
|
17
|
-
neo
|
|
19
|
+
neo init # 写 ~/.neo/config.yaml;发现存量技能会问是否导入
|
|
18
20
|
neo add anthropics/skills -s pdf # 往全局底座角色 default 装技能
|
|
19
21
|
neo create writer # 建一个新角色
|
|
20
22
|
neo add anthropics/skills -s docx --role writer
|
|
21
|
-
neo use writer #
|
|
22
|
-
neo
|
|
23
|
+
neo use writer # 把 writer 设为默认(不触任何 agent 全局目录)
|
|
24
|
+
neo run claude-code # 以隔离配置根启动:技能/提示词/MCP/登录态都在根内
|
|
23
25
|
```
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
- `neo init` 会扫描 `~/.agents/skills` 与各 agent 技能目录:有存量技能时询问导入 `default`(所有角色继承)或一个新角色;拒绝则原样不动。
|
|
28
|
+
- 想自己控制收编节奏:`neo migrate`(预览)→ `neo migrate --scan-agents --apply`。
|
|
29
|
+
- 仍需要 0.1 的全局挂载:`neo use writer --global`;卸载:`neo off --global`。
|
|
30
|
+
|
|
31
|
+
全部命令与约定见 `neo --help`;完整文档见 [主仓库](https://github.com/Aiden-FE/neo)。
|
package/dist/cli.d.ts
CHANGED
|
@@ -20,8 +20,10 @@ export interface CliDeps {
|
|
|
20
20
|
stagingRoot?: string;
|
|
21
21
|
/** remove 确认 / init 引导:当前是否交互终端(缺省 process.stdout.isTTY)。 */
|
|
22
22
|
isTty?: boolean;
|
|
23
|
-
/** remove 确认
|
|
23
|
+
/** remove 确认(缺省 readline y/N;测试注入)。 */
|
|
24
24
|
confirm?: (question: string) => Promise<boolean>;
|
|
25
|
+
/** init 的文本提问(缺省 readline,空输入回退 fallback;测试注入)。 */
|
|
26
|
+
ask?: (question: string, fallback: string) => Promise<string>;
|
|
25
27
|
/** 工作目录(项目绑定 cwd 上溯发现基准;缺省 process.cwd())。 */
|
|
26
28
|
cwd?: string;
|
|
27
29
|
/** agent 探测端口(init 建议 / list agents 探测态;缺省 node 实现 = fs + PATH)。 */
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { spawn as spawn2 } from "node:child_process";
|
|
|
8
8
|
import fs23 from "node:fs/promises";
|
|
9
9
|
|
|
10
10
|
// ../core/dist/version.js
|
|
11
|
-
var NEO_VERSION = "0.2.
|
|
11
|
+
var NEO_VERSION = "0.2.2";
|
|
12
12
|
|
|
13
13
|
// ../core/dist/error.js
|
|
14
14
|
var NeoError = class extends Error {
|
|
@@ -2329,7 +2329,7 @@ function entryFor(registry, agent) {
|
|
|
2329
2329
|
function isolationFor(entry) {
|
|
2330
2330
|
const isolate = entry.isolate;
|
|
2331
2331
|
if (isolate === void 0 || !isolate.supports.includes("launch")) {
|
|
2332
|
-
throw new NeoError("state", `agent "${entry.id}" does not support isolated launch;
|
|
2332
|
+
throw new NeoError("state", `agent "${entry.id}" does not support isolated launch; bind it to a project (neo use <role> --project) or use legacy global mounts (neo use <role> --global)`);
|
|
2333
2333
|
}
|
|
2334
2334
|
return isolate;
|
|
2335
2335
|
}
|
|
@@ -2732,7 +2732,7 @@ async function planLaunch(ports, home, homedir, opts) {
|
|
|
2732
2732
|
}
|
|
2733
2733
|
const isolate = entry.isolate;
|
|
2734
2734
|
if (isolate === void 0 || !isolate.supports.includes("launch")) {
|
|
2735
|
-
throw new NeoError("state", `agent "${entry.id}" does not support isolated launch;
|
|
2735
|
+
throw new NeoError("state", `agent "${entry.id}" does not support isolated launch; bind it to a project (neo use <role> --project) or use legacy global mounts (neo use <role> --global)`);
|
|
2736
2736
|
}
|
|
2737
2737
|
const env = opts.env ?? {};
|
|
2738
2738
|
const ephemeral = opts.ephemeral === true;
|
|
@@ -3443,23 +3443,23 @@ async function auditAgentsMd(report, opts) {
|
|
|
3443
3443
|
return desiredBlocks.length > 0 ? "opt-in, not mounted" : "no blocks expected";
|
|
3444
3444
|
}
|
|
3445
3445
|
if (accounting2 !== void 0 && content === null) {
|
|
3446
|
-
finding("file-missing", planned.file, `instruction file is missing but the ledger records an agentsMd mount; re-run "neo use"`);
|
|
3446
|
+
finding("file-missing", planned.file, `instruction file is missing but the ledger records an agentsMd mount; re-run "neo use --global"`);
|
|
3447
3447
|
return "drift (file missing)";
|
|
3448
3448
|
}
|
|
3449
3449
|
if (desiredBlocks.length === 0 && hasBlocks) {
|
|
3450
|
-
finding("blocks-residual", planned.file, `neo blocks remain but activeRole expects none${activeRole === null ? " (off)" : ""}; run "neo off" or re-run "neo use"`);
|
|
3450
|
+
finding("blocks-residual", planned.file, `neo blocks remain but activeRole expects none${activeRole === null ? " (off)" : ""}; run "neo off --global" or re-run "neo use --global"`);
|
|
3451
3451
|
return "drift (residual blocks)";
|
|
3452
3452
|
}
|
|
3453
3453
|
if (accounting2 === void 0) {
|
|
3454
|
-
finding("residual-blocks", planned.file, `neo blocks present without ledger accounting; re-run "neo use" to re-account`);
|
|
3454
|
+
finding("residual-blocks", planned.file, `neo blocks present without ledger accounting; re-run "neo use --global" to re-account`);
|
|
3455
3455
|
return "drift (unaccounted blocks)";
|
|
3456
3456
|
}
|
|
3457
3457
|
if (!hasBlocks) {
|
|
3458
|
-
finding("blocks-missing", planned.file, `ledger records an agentsMd mount but the file has no neo blocks; re-run "neo use"`);
|
|
3458
|
+
finding("blocks-missing", planned.file, `ledger records an agentsMd mount but the file has no neo blocks; re-run "neo use --global"`);
|
|
3459
3459
|
return "drift (blocks missing)";
|
|
3460
3460
|
}
|
|
3461
3461
|
if (applyNeoBlocks(content ?? "", desiredBlocks).changed) {
|
|
3462
|
-
finding("blocks-corrupt", planned.file, `neo blocks do not match the expected render for activeRole ${JSON.stringify(activeRole)} (stale role content, manual edits, or orphan markers); re-run "neo use"`);
|
|
3462
|
+
finding("blocks-corrupt", planned.file, `neo blocks do not match the expected render for activeRole ${JSON.stringify(activeRole)} (stale role content, manual edits, or orphan markers); re-run "neo use --global"`);
|
|
3463
3463
|
return "drift (blocks mismatch)";
|
|
3464
3464
|
}
|
|
3465
3465
|
return "mounted (verified)";
|
|
@@ -3469,7 +3469,7 @@ async function auditAgentsMd(report, opts) {
|
|
|
3469
3469
|
const file = path15.resolve(expandTilde(accounting.file, homedir));
|
|
3470
3470
|
const content = await readTextOrNull(file);
|
|
3471
3471
|
if (content !== null && containsNeoBlocks(content)) {
|
|
3472
|
-
finding("residual-blocks", file, `agentsMd opt-in removed in config but blocks remain (ledger accounting still present); re-enable the opt-in and run "neo off", or strip manually`);
|
|
3472
|
+
finding("residual-blocks", file, `agentsMd opt-in removed in config but blocks remain (ledger accounting still present); re-enable the opt-in and run "neo off --global", or strip manually`);
|
|
3473
3473
|
return "drift (residual blocks)";
|
|
3474
3474
|
}
|
|
3475
3475
|
finding("stale-accounting", file, `agentsMd accounting in ledger but the target is not opted in and no blocks remain; stale ledger entry`);
|
|
@@ -3482,7 +3482,7 @@ async function auditAgentsMd(report, opts) {
|
|
|
3482
3482
|
const file = path15.resolve(expanded);
|
|
3483
3483
|
const content = await readTextOrNull(file);
|
|
3484
3484
|
if (content !== null && containsNeoBlocks(content)) {
|
|
3485
|
-
finding("residual-blocks", file, `neo blocks present without opt-in or ledger accounting; strip manually or opt in and re-run "neo use"`);
|
|
3485
|
+
finding("residual-blocks", file, `neo blocks present without opt-in or ledger accounting; strip manually or opt in and re-run "neo use --global"`);
|
|
3486
3486
|
return "drift (unaccounted blocks)";
|
|
3487
3487
|
}
|
|
3488
3488
|
}
|
|
@@ -3553,7 +3553,7 @@ async function auditRecordedSlots(report, ports, opts) {
|
|
|
3553
3553
|
try {
|
|
3554
3554
|
const info = await ports.link.lstat(slot);
|
|
3555
3555
|
if (info === null) {
|
|
3556
|
-
push("missing-slot", "absent", slot, `recorded skill slot is absent; re-run "neo use" to re-mount`);
|
|
3556
|
+
push("missing-slot", "absent", slot, `recorded skill slot is absent; re-run "neo use --global" to re-mount`);
|
|
3557
3557
|
continue;
|
|
3558
3558
|
}
|
|
3559
3559
|
if (!info.symlink) {
|
|
@@ -3568,19 +3568,19 @@ async function auditRecordedSlots(report, ports, opts) {
|
|
|
3568
3568
|
continue;
|
|
3569
3569
|
}
|
|
3570
3570
|
if (!resolution.exists) {
|
|
3571
|
-
push("repointed-slot", "dangling", slot, `dangling link -> ${resolution.final}${resolution.broken === "cycle" ? " (link cycle)" : " (target missing)"}; re-run "neo use" to re-mount`);
|
|
3571
|
+
push("repointed-slot", "dangling", slot, `dangling link -> ${resolution.final}${resolution.broken === "cycle" ? " (link cycle)" : " (target missing)"}; re-run "neo use --global" to re-mount`);
|
|
3572
3572
|
continue;
|
|
3573
3573
|
}
|
|
3574
3574
|
const source = parseNeoSkillSource(home, resolution.final);
|
|
3575
3575
|
if (source === null || source.name !== name) {
|
|
3576
3576
|
const kind = isInsidePath(home, resolution.final) ? "unexpected-target" : registryDirs.some((dir) => isInsidePath(dir, resolution.final)) ? "mirror" : "external";
|
|
3577
|
-
push("repointed-slot", kind, slot, `repointed to ${kind === "mirror" ? "registry mirror" : kind === "external" ? "external target" : "unexpected path inside neo home"} -> ${resolution.final}; re-run "neo use" to re-mount`);
|
|
3577
|
+
push("repointed-slot", kind, slot, `repointed to ${kind === "mirror" ? "registry mirror" : kind === "external" ? "external target" : "unexpected path inside neo home"} -> ${resolution.final}; re-run "neo use --global" to re-mount`);
|
|
3578
3578
|
continue;
|
|
3579
3579
|
}
|
|
3580
3580
|
if (expectedRole === null) {
|
|
3581
|
-
push("active-role", "off-but-mounted", slot, `config.activeRole is null (off) but recorded link remains -> ${resolution.final}; run "neo off"`);
|
|
3581
|
+
push("active-role", "off-but-mounted", slot, `config.activeRole is null (off) but recorded link remains -> ${resolution.final}; run "neo off --global"`);
|
|
3582
3582
|
} else {
|
|
3583
|
-
push("active-role", "role-mismatch", slot, `activeRole "${activeRole}" expects ${expectedPath} but link points to ${resolution.final}; re-run "neo use"`);
|
|
3583
|
+
push("active-role", "role-mismatch", slot, `activeRole "${activeRole}" expects ${expectedPath} but link points to ${resolution.final}; re-run "neo use --global"`);
|
|
3584
3584
|
}
|
|
3585
3585
|
} catch (error) {
|
|
3586
3586
|
report.errors.push(`cannot audit recorded slot ${slot}: ${error.message}`);
|
|
@@ -3625,11 +3625,11 @@ async function auditUnrecordedEntries(report, ports, opts) {
|
|
|
3625
3625
|
}
|
|
3626
3626
|
const resolution = await resolveLinkTarget(ports.link, slot);
|
|
3627
3627
|
if (!resolution.exists) {
|
|
3628
|
-
push("dangling-entry", slot, `unrecorded dangling link -> ${resolution.final}; "neo off" sweeps it if it points into the neo home`);
|
|
3628
|
+
push("dangling-entry", slot, `unrecorded dangling link -> ${resolution.final}; "neo off --global" sweeps it if it points into the neo home`);
|
|
3629
3629
|
continue;
|
|
3630
3630
|
}
|
|
3631
3631
|
if (isInsidePath(home, resolution.final)) {
|
|
3632
|
-
push("orphan-link", slot, `unrecorded link into neo home -> ${resolution.final}; re-run "neo use" (or "neo off" to sweep) to re-account`);
|
|
3632
|
+
push("orphan-link", slot, `unrecorded link into neo home -> ${resolution.final}; re-run "neo use --global" (or "neo off --global" to sweep) to re-account`);
|
|
3633
3633
|
continue;
|
|
3634
3634
|
}
|
|
3635
3635
|
if (registryDirs.some((dir) => isInsidePath(dir, resolution.final)))
|
|
@@ -3699,13 +3699,13 @@ async function statusAudit(ports, home, opts) {
|
|
|
3699
3699
|
if (activeRole !== null) {
|
|
3700
3700
|
const unrecorded = [...desiredSkills2].filter((name) => !recordedSet.has(name)).length;
|
|
3701
3701
|
if (unrecorded > 0) {
|
|
3702
|
-
report.notes.push(`${target.agent}: ${unrecorded} desired skill(s) not recorded (run: neo use to converge)`);
|
|
3702
|
+
report.notes.push(`${target.agent}: ${unrecorded} desired skill(s) not recorded (run: neo use --global to converge)`);
|
|
3703
3703
|
}
|
|
3704
3704
|
if (ledger.targets[target.skillsDir] === void 0) {
|
|
3705
|
-
report.notes.push(`${target.agent}: no mounts recorded (run: neo use)`);
|
|
3705
|
+
report.notes.push(`${target.agent}: no mounts recorded (run: neo use --global)`);
|
|
3706
3706
|
}
|
|
3707
3707
|
if (agentsMdState === "opt-in, not mounted") {
|
|
3708
|
-
report.notes.push(`${target.agent}: agentsMd opt-in not mounted yet (run: neo use)`);
|
|
3708
|
+
report.notes.push(`${target.agent}: agentsMd opt-in not mounted yet (run: neo use --global)`);
|
|
3709
3709
|
}
|
|
3710
3710
|
}
|
|
3711
3711
|
report.targets.push({
|
|
@@ -4747,13 +4747,13 @@ function defaultCliDeps() {
|
|
|
4747
4747
|
var COMMANDS = [
|
|
4748
4748
|
{
|
|
4749
4749
|
name: "init",
|
|
4750
|
-
summary: "interactive bootstrap:
|
|
4750
|
+
summary: "interactive bootstrap: write the config skeleton, import existing global skills",
|
|
4751
4751
|
usage: ["neo init"],
|
|
4752
4752
|
flags: []
|
|
4753
4753
|
},
|
|
4754
4754
|
{
|
|
4755
4755
|
name: "target",
|
|
4756
|
-
summary:
|
|
4756
|
+
summary: 'legacy global mount targets (only needed for "neo use --global"); list/add/remove',
|
|
4757
4757
|
usage: [
|
|
4758
4758
|
"neo target",
|
|
4759
4759
|
"neo target add <agent-id> [--skills-dir <path>] [--agents-md]",
|
|
@@ -4771,7 +4771,7 @@ var COMMANDS = [
|
|
|
4771
4771
|
"neo migrate [--apply] [--yes] [--strategy first|newest|skip] [--scan-agents] [--absorb-links] [--role <name>] [--json]"
|
|
4772
4772
|
],
|
|
4773
4773
|
flags: [
|
|
4774
|
-
"--apply execute the plan (no extra confirmation
|
|
4774
|
+
"--apply execute the plan (no extra confirmation)",
|
|
4775
4775
|
"--strategy <name> conflict winner: first | newest | skip (default: first)",
|
|
4776
4776
|
"--scan-agents scan agent skill dirs for unmanaged installs",
|
|
4777
4777
|
"--absorb-links absorb registry-scope links pointing into neo home",
|
|
@@ -4895,7 +4895,7 @@ function helpHome(deps) {
|
|
|
4895
4895
|
}
|
|
4896
4896
|
function printFullHelp(io, deps) {
|
|
4897
4897
|
const lines = [`neo ${NEO_VERSION} \u2014 cross-agent skill role manager`, ""];
|
|
4898
|
-
lines.push("usage: neo <command> [options]", "", "commands:");
|
|
4898
|
+
lines.push("usage: neo <command> [options]", "", "quick start: neo init -> neo run <agent>", "", "commands:");
|
|
4899
4899
|
for (const spec of COMMANDS) {
|
|
4900
4900
|
const alias = spec.aliases !== void 0 && spec.aliases.length > 0 ? ` (alias: ${spec.aliases.join(", ")})` : "";
|
|
4901
4901
|
lines.push(` ${spec.name.padEnd(10)} ${spec.summary}${alias}`);
|
|
@@ -5056,7 +5056,7 @@ async function cmdInit(args, io, deps) {
|
|
|
5056
5056
|
if (!isTty) {
|
|
5057
5057
|
throw new NeoError(
|
|
5058
5058
|
"usage",
|
|
5059
|
-
"init requires an interactive terminal;
|
|
5059
|
+
"init requires an interactive terminal; write the config skeleton by hand (see docs/schema/neo-home.md)"
|
|
5060
5060
|
);
|
|
5061
5061
|
}
|
|
5062
5062
|
const home = resolveHome(deps);
|
|
@@ -5064,8 +5064,7 @@ async function cmdInit(args, io, deps) {
|
|
|
5064
5064
|
const registry = await readRegistry(home);
|
|
5065
5065
|
const port = deps.detect ?? nodeDetectPort();
|
|
5066
5066
|
const detections = await detectAgents(registry, deps.homedir, port);
|
|
5067
|
-
const
|
|
5068
|
-
const confirm = deps.confirm ?? confirmOnTty;
|
|
5067
|
+
const detected = detections.filter((detection) => detection.signals.length > 0);
|
|
5069
5068
|
io.stdout(`neo init: ${home}
|
|
5070
5069
|
`);
|
|
5071
5070
|
if (home !== path21.join(deps.homedir, "neo")) {
|
|
@@ -5078,15 +5077,8 @@ async function cmdInit(args, io, deps) {
|
|
|
5078
5077
|
}
|
|
5079
5078
|
}
|
|
5080
5079
|
if (loaded.config.targets.length > 0) {
|
|
5081
|
-
io.stdout(`existing targets: ${[...configured].join(", ")}
|
|
5082
|
-
`);
|
|
5083
|
-
}
|
|
5084
|
-
const suggestions = detections.filter(
|
|
5085
|
-
(detection) => detection.signals.length > 0 && !configured.has(detection.id)
|
|
5086
|
-
);
|
|
5087
|
-
if (suggestions.length > 0) {
|
|
5088
5080
|
io.stdout(
|
|
5089
|
-
`
|
|
5081
|
+
`existing targets (legacy global mounts): ${loaded.config.targets.map((target) => target.agent).join(", ")}
|
|
5090
5082
|
`
|
|
5091
5083
|
);
|
|
5092
5084
|
}
|
|
@@ -5094,39 +5086,79 @@ async function cmdInit(args, io, deps) {
|
|
|
5094
5086
|
io.stdout(`wrote config skeleton: ${configPath(home)}
|
|
5095
5087
|
`);
|
|
5096
5088
|
}
|
|
5097
|
-
if (
|
|
5098
|
-
io.stdout(
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
io.stdout('
|
|
5089
|
+
if (detected.length > 0) {
|
|
5090
|
+
io.stdout(`detected: ${detected.map((detection) => detection.id).join(", ")}
|
|
5091
|
+
`);
|
|
5092
|
+
} else {
|
|
5093
|
+
io.stdout('no agents detected; see "neo list agents" for the full registry\n');
|
|
5094
|
+
}
|
|
5095
|
+
const importExit = await importExistingSkills(home, io, deps);
|
|
5096
|
+
if (importExit !== 0) return importExit;
|
|
5097
|
+
io.stdout('next: add skills with "neo add <source> -s <skill>", then launch with "neo run <agent>"\n');
|
|
5098
|
+
return 0;
|
|
5099
|
+
}
|
|
5100
|
+
async function importExistingSkills(home, io, deps) {
|
|
5101
|
+
const ports = { link: nodeLinkPort(), now: deps.now };
|
|
5102
|
+
const common = { homedir: deps.homedir, scanAgents: true };
|
|
5103
|
+
const preview = await runMigrate(ports, home, { ...common, role: "default", apply: false });
|
|
5104
|
+
const importable = preview.items.filter((item) => item.disposition === "absorb");
|
|
5105
|
+
if (importable.length === 0) return 0;
|
|
5106
|
+
const sample = importable.slice(0, 6).map((item) => item.skill).join(", ");
|
|
5107
|
+
const more = importable.length > 6 ? `, \u2026 (+${importable.length - 6})` : "";
|
|
5108
|
+
io.stdout(`found ${importable.length} existing skill(s) outside neo: ${sample}${more}
|
|
5109
|
+
`);
|
|
5110
|
+
const ask = deps.ask ?? askOnTty;
|
|
5111
|
+
const answer = await ask(
|
|
5112
|
+
"import them into a neo role? (default is inherited by every role) [Y/n]",
|
|
5113
|
+
"y"
|
|
5114
|
+
);
|
|
5115
|
+
if (!/^(y|yes)$/i.test(answer.trim())) {
|
|
5116
|
+
io.stdout("left untouched; import later with: neo migrate --scan-agents\n");
|
|
5102
5117
|
return 0;
|
|
5103
5118
|
}
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
+
const role = await askImportRole(io, ask);
|
|
5120
|
+
const created = role !== "default" && !await pathExists(roleDir(home, role));
|
|
5121
|
+
if (created) await createRole(home, role);
|
|
5122
|
+
const report = await runMigrate(ports, home, {
|
|
5123
|
+
...common,
|
|
5124
|
+
role,
|
|
5125
|
+
strategy: "first",
|
|
5126
|
+
apply: true
|
|
5127
|
+
});
|
|
5128
|
+
const imported = report.items.filter((item) => item.disposition === "absorb").length;
|
|
5129
|
+
const failed = report.items.filter((item) => item.disposition === "error");
|
|
5130
|
+
io.stdout(`imported ${imported} skill(s) into role ${role}${created ? " (role created)" : ""}
|
|
5131
|
+
`);
|
|
5132
|
+
if (report.quarantineDir !== null) {
|
|
5133
|
+
io.stdout(`duplicate/conflicting copies preserved in ${report.quarantineDir}
|
|
5134
|
+
`);
|
|
5135
|
+
}
|
|
5136
|
+
for (const item of failed) io.stderr(`import ${item.skill}: ${item.error ?? "failed"}
|
|
5119
5137
|
`);
|
|
5138
|
+
if (failed.length > 0) {
|
|
5139
|
+
io.stderr(`import incomplete; retry with: neo migrate --scan-agents --apply --role ${role}
|
|
5140
|
+
`);
|
|
5141
|
+
return 1;
|
|
5142
|
+
}
|
|
5143
|
+
if (role !== "default") {
|
|
5144
|
+
io.stdout(`hint: role "${role}" is not the default; launch with: neo run <agent> --role ${role}
|
|
5145
|
+
`);
|
|
5146
|
+
}
|
|
5147
|
+
return 0;
|
|
5148
|
+
}
|
|
5149
|
+
async function askImportRole(io, ask) {
|
|
5150
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
5151
|
+
const name = (await ask("role to import into [default]:", "default")).trim();
|
|
5152
|
+
if (name.length === 0 || name === "default") return "default";
|
|
5153
|
+
try {
|
|
5154
|
+
validateRoleName(name);
|
|
5155
|
+
return name;
|
|
5120
5156
|
} catch (error) {
|
|
5121
|
-
|
|
5122
|
-
failures++;
|
|
5123
|
-
io.stderr(`warning: ${entry.id}: ${error.message}
|
|
5157
|
+
io.stderr(`${error.message}
|
|
5124
5158
|
`);
|
|
5125
5159
|
}
|
|
5126
5160
|
}
|
|
5127
|
-
|
|
5128
|
-
io.stdout('next: add skills with "neo add <source> -s <skill>", then activate with "neo use <role>"\n');
|
|
5129
|
-
return failures > 0 ? 1 : 0;
|
|
5161
|
+
throw new NeoError("usage", "init: invalid role name (expected ^[a-z0-9][a-z0-9-]{0,63}$)");
|
|
5130
5162
|
}
|
|
5131
5163
|
async function cmdAdd(args, io, deps) {
|
|
5132
5164
|
const parsed = parseArgs(args, { valued: /* @__PURE__ */ new Set(["s", "role"]), boolean: bools("l") });
|
|
@@ -5182,8 +5214,11 @@ async function cmdCreate(args, io, deps) {
|
|
|
5182
5214
|
const name = expectSinglePositional(parsed, "create <name>");
|
|
5183
5215
|
const home = resolveHome(deps);
|
|
5184
5216
|
await createRole(home, name);
|
|
5185
|
-
io.stdout(
|
|
5186
|
-
`
|
|
5217
|
+
io.stdout(
|
|
5218
|
+
`created role ${name}
|
|
5219
|
+
next: make it the default with "neo use ${name}", or launch with "neo run <agent> --role ${name}"
|
|
5220
|
+
`
|
|
5221
|
+
);
|
|
5187
5222
|
return 0;
|
|
5188
5223
|
}
|
|
5189
5224
|
async function cmdList(args, io, deps) {
|
|
@@ -5248,6 +5283,9 @@ async function cmdList(args, io, deps) {
|
|
|
5248
5283
|
);
|
|
5249
5284
|
return 0;
|
|
5250
5285
|
}
|
|
5286
|
+
if (view.some((row) => row.configured)) {
|
|
5287
|
+
io.stdout("* = configured as legacy global mount (neo use --global); detection is advisory\n");
|
|
5288
|
+
}
|
|
5251
5289
|
for (const row of view) {
|
|
5252
5290
|
const tail = [
|
|
5253
5291
|
row.entry.skillsDir,
|
|
@@ -5284,7 +5322,7 @@ async function cmdTarget(args, io, deps) {
|
|
|
5284
5322
|
if (sub === void 0) {
|
|
5285
5323
|
const targets = await listConfiguredTargets(home, deps.homedir);
|
|
5286
5324
|
if (targets.length === 0) {
|
|
5287
|
-
io.stdout(
|
|
5325
|
+
io.stdout('no targets configured (only needed for "neo use --global"; "neo run" does not use targets)\n');
|
|
5288
5326
|
return 0;
|
|
5289
5327
|
}
|
|
5290
5328
|
for (const target of targets) {
|
|
@@ -5627,7 +5665,7 @@ function printProjectSyncReport(io, report) {
|
|
|
5627
5665
|
function printConvergeReport(io, report) {
|
|
5628
5666
|
const headline = report.role === null ? "off" : `use ${report.role}`;
|
|
5629
5667
|
if (report.targets.length === 0) {
|
|
5630
|
-
io.stdout(`${headline}: no targets configured (
|
|
5668
|
+
io.stdout(`${headline}: no targets configured (targets are only used by "neo use --global")
|
|
5631
5669
|
`);
|
|
5632
5670
|
return 0;
|
|
5633
5671
|
}
|
|
@@ -5999,6 +6037,16 @@ function confirmOnTty(question) {
|
|
|
5999
6037
|
});
|
|
6000
6038
|
});
|
|
6001
6039
|
}
|
|
6040
|
+
function askOnTty(question, fallback) {
|
|
6041
|
+
return new Promise((resolve) => {
|
|
6042
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
6043
|
+
rl.question(`${question} `, (answer) => {
|
|
6044
|
+
rl.close();
|
|
6045
|
+
const trimmed = answer.trim();
|
|
6046
|
+
resolve(trimmed.length === 0 ? fallback : trimmed);
|
|
6047
|
+
});
|
|
6048
|
+
});
|
|
6049
|
+
}
|
|
6002
6050
|
function resolveHome(deps) {
|
|
6003
6051
|
return resolveNeoHome({ env: deps.env, homedir: deps.homedir });
|
|
6004
6052
|
}
|