@compass-aiden/neo 0.2.0 → 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 CHANGED
@@ -1,6 +1,8 @@
1
1
  # @compass-aiden/neo
2
2
 
3
- 跨 Agent 技能角色管理 CLI(bin: `neo`)——用「角色(role)」为不同的 AI agent 挂载不同的技能集与系统提示词,继承全局底座(`roles/default`),底层安装复用 [`npx skills`](https://github.com/vercel-labs/skills)。
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 target add claude-code # 把你在用的 agent 配成挂载目标(交互式:neo init)
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 # 激活:default ∪ writer 的技能挂载到目标 agent
22
- neo status # 本地体检(挂载对账)
23
+ neo use writer # 把 writer 设为默认(不触任何 agent 全局目录)
24
+ neo run claude-code # 以隔离配置根启动:技能/提示词/MCP/登录态都在根内
23
25
  ```
24
26
 
25
- 全部命令与约定见 `neo --help`;完整文档与桌面端(Windows/macOS 安装包)见 [主仓库](https://github.com/Aiden-FE/neo)。
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 确认 / init 引导提问(缺省 readline y/N;测试注入)。 */
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.0";
11
+ var NEO_VERSION = "0.2.2";
12
12
 
13
13
  // ../core/dist/error.js
14
14
  var NeoError = class extends Error {
@@ -174,7 +174,7 @@ var isRecord = (value) => typeof value === "object" && value !== null && !Array.
174
174
  import path3 from "node:path";
175
175
  function resolveNeoHome({ env, homedir }) {
176
176
  const raw = env?.NEO_HOME?.trim();
177
- const value = raw ? expandTilde(raw, homedir) : path3.join(homedir, "neo");
177
+ const value = raw ? expandTilde(raw, homedir) : path3.join(homedir, ".neo");
178
178
  if (!path3.isAbsolute(value)) {
179
179
  throw new NeoError("state", `NEO_HOME must resolve to an absolute path, got: ${JSON.stringify(raw ?? value)}`);
180
180
  }
@@ -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; use "neo use <role> --global" or a project binding instead`);
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; use "neo use <role> --global" or a project binding instead`);
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({
@@ -3722,6 +3722,10 @@ async function statusAudit(ports, home, opts) {
3722
3722
  report.notes.push(`ledger still records unconfigured target ${dir} (agent ${entry.agent}); links left as-is`);
3723
3723
  }
3724
3724
  }
3725
+ const legacyHome = path15.join(opts.homedir, "neo");
3726
+ if (!samePath(home, legacyHome) && await fileExists(path15.join(legacyHome, "config.yaml"))) {
3727
+ report.notes.push("legacy neo home found at ~/neo; move it to ~/.neo (or set NEO_HOME=~/neo to keep using it)");
3728
+ }
3725
3729
  for (const [dir, entry] of Object.entries(ledger.targets)) {
3726
3730
  const skills = [...entry.skills ?? []].length;
3727
3731
  const agentsMd = isRecord(entry.agentsMd) && entry.agentsMd.mounted === true;
@@ -4743,13 +4747,13 @@ function defaultCliDeps() {
4743
4747
  var COMMANDS = [
4744
4748
  {
4745
4749
  name: "init",
4746
- summary: "interactive bootstrap: detect agents, suggest targets, write the config skeleton",
4750
+ summary: "interactive bootstrap: write the config skeleton, import existing global skills",
4747
4751
  usage: ["neo init"],
4748
4752
  flags: []
4749
4753
  },
4750
4754
  {
4751
4755
  name: "target",
4752
- summary: "list mount targets; add/remove to configure",
4756
+ summary: 'legacy global mount targets (only needed for "neo use --global"); list/add/remove',
4753
4757
  usage: [
4754
4758
  "neo target",
4755
4759
  "neo target add <agent-id> [--skills-dir <path>] [--agents-md]",
@@ -4767,7 +4771,7 @@ var COMMANDS = [
4767
4771
  "neo migrate [--apply] [--yes] [--strategy first|newest|skip] [--scan-agents] [--absorb-links] [--role <name>] [--json]"
4768
4772
  ],
4769
4773
  flags: [
4770
- "--apply execute the plan (no extra confirmation, \u51B3\u7B56\u7968 05)",
4774
+ "--apply execute the plan (no extra confirmation)",
4771
4775
  "--strategy <name> conflict winner: first | newest | skip (default: first)",
4772
4776
  "--scan-agents scan agent skill dirs for unmanaged installs",
4773
4777
  "--absorb-links absorb registry-scope links pointing into neo home",
@@ -4891,7 +4895,7 @@ function helpHome(deps) {
4891
4895
  }
4892
4896
  function printFullHelp(io, deps) {
4893
4897
  const lines = [`neo ${NEO_VERSION} \u2014 cross-agent skill role manager`, ""];
4894
- lines.push("usage: neo <command> [options]", "", "commands:");
4898
+ lines.push("usage: neo <command> [options]", "", "quick start: neo init -> neo run <agent>", "", "commands:");
4895
4899
  for (const spec of COMMANDS) {
4896
4900
  const alias = spec.aliases !== void 0 && spec.aliases.length > 0 ? ` (alias: ${spec.aliases.join(", ")})` : "";
4897
4901
  lines.push(` ${spec.name.padEnd(10)} ${spec.summary}${alias}`);
@@ -5052,7 +5056,7 @@ async function cmdInit(args, io, deps) {
5052
5056
  if (!isTty) {
5053
5057
  throw new NeoError(
5054
5058
  "usage",
5055
- "init requires an interactive terminal; configure targets manually with: neo target add <agent-id>"
5059
+ "init requires an interactive terminal; write the config skeleton by hand (see docs/schema/neo-home.md)"
5056
5060
  );
5057
5061
  }
5058
5062
  const home = resolveHome(deps);
@@ -5060,20 +5064,21 @@ async function cmdInit(args, io, deps) {
5060
5064
  const registry = await readRegistry(home);
5061
5065
  const port = deps.detect ?? nodeDetectPort();
5062
5066
  const detections = await detectAgents(registry, deps.homedir, port);
5063
- const configured = new Set(loaded.config.targets.map((target) => target.agent));
5064
- const confirm = deps.confirm ?? confirmOnTty;
5067
+ const detected = detections.filter((detection) => detection.signals.length > 0);
5065
5068
  io.stdout(`neo init: ${home}
5066
5069
  `);
5067
- if (loaded.config.targets.length > 0) {
5068
- io.stdout(`existing targets: ${[...configured].join(", ")}
5069
- `);
5070
+ if (home !== path21.join(deps.homedir, "neo")) {
5071
+ try {
5072
+ await fs23.stat(path21.join(deps.homedir, "neo", "config.yaml"));
5073
+ io.stderr(
5074
+ "hint: legacy home ~/neo still exists; this version uses ~/.neo \u2014 move it (mv ~/neo ~/.neo) or set NEO_HOME=~/neo\n"
5075
+ );
5076
+ } catch {
5077
+ }
5070
5078
  }
5071
- const suggestions = detections.filter(
5072
- (detection) => detection.signals.length > 0 && !configured.has(detection.id)
5073
- );
5074
- if (suggestions.length > 0) {
5079
+ if (loaded.config.targets.length > 0) {
5075
5080
  io.stdout(
5076
- `detected agents: ${suggestions.map((s) => `${s.id} (${s.signals.join(", ")})`).join(", ")}
5081
+ `existing targets (legacy global mounts): ${loaded.config.targets.map((target) => target.agent).join(", ")}
5077
5082
  `
5078
5083
  );
5079
5084
  }
@@ -5081,39 +5086,79 @@ async function cmdInit(args, io, deps) {
5081
5086
  io.stdout(`wrote config skeleton: ${configPath(home)}
5082
5087
  `);
5083
5088
  }
5084
- if (suggestions.length === 0) {
5085
- io.stdout(
5086
- 'no newly detected agents to suggest; see "neo list agents" for the full registry,\nor add a target manually: neo target add <agent-id>\n'
5087
- );
5088
- io.stdout('next: add skills with "neo add <source> -s <skill>", then activate with "neo use <role>"\n');
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");
5089
5117
  return 0;
5090
5118
  }
5091
- let failures = 0;
5092
- let added = 0;
5093
- for (const suggestion of suggestions) {
5094
- const entry = registry.find((candidate) => candidate.id === suggestion.id);
5095
- if (entry === void 0) continue;
5096
- const want = await confirm(`configure target ${entry.id} (skills -> ${entry.skillsDir})? [y/N]`);
5097
- if (!want) continue;
5098
- let agentsMd = false;
5099
- if (entry.agentsMd !== void 0) {
5100
- agentsMd = await confirm(`manage instruction file ${entry.agentsMd} for ${entry.id}? [y/N]`);
5101
- }
5102
- try {
5103
- await addTarget(home, deps.homedir, entry.id, { agentsMd });
5104
- added++;
5105
- io.stdout(`added target ${entry.id}${agentsMd ? " (agents-md)" : ""}
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)" : ""}
5106
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"}
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;
5107
5156
  } catch (error) {
5108
- if (!(error instanceof NeoError)) throw error;
5109
- failures++;
5110
- io.stderr(`warning: ${entry.id}: ${error.message}
5157
+ io.stderr(`${error.message}
5111
5158
  `);
5112
5159
  }
5113
5160
  }
5114
- if (added === 0 && failures === 0) io.stdout("no targets added\n");
5115
- io.stdout('next: add skills with "neo add <source> -s <skill>", then activate with "neo use <role>"\n');
5116
- return failures > 0 ? 1 : 0;
5161
+ throw new NeoError("usage", "init: invalid role name (expected ^[a-z0-9][a-z0-9-]{0,63}$)");
5117
5162
  }
5118
5163
  async function cmdAdd(args, io, deps) {
5119
5164
  const parsed = parseArgs(args, { valued: /* @__PURE__ */ new Set(["s", "role"]), boolean: bools("l") });
@@ -5169,8 +5214,11 @@ async function cmdCreate(args, io, deps) {
5169
5214
  const name = expectSinglePositional(parsed, "create <name>");
5170
5215
  const home = resolveHome(deps);
5171
5216
  await createRole(home, name);
5172
- io.stdout(`created role ${name}
5173
- `);
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
+ );
5174
5222
  return 0;
5175
5223
  }
5176
5224
  async function cmdList(args, io, deps) {
@@ -5235,6 +5283,9 @@ async function cmdList(args, io, deps) {
5235
5283
  );
5236
5284
  return 0;
5237
5285
  }
5286
+ if (view.some((row) => row.configured)) {
5287
+ io.stdout("* = configured as legacy global mount (neo use --global); detection is advisory\n");
5288
+ }
5238
5289
  for (const row of view) {
5239
5290
  const tail = [
5240
5291
  row.entry.skillsDir,
@@ -5271,7 +5322,7 @@ async function cmdTarget(args, io, deps) {
5271
5322
  if (sub === void 0) {
5272
5323
  const targets = await listConfiguredTargets(home, deps.homedir);
5273
5324
  if (targets.length === 0) {
5274
- io.stdout("no targets configured; run: neo target add <agent-id>\n");
5325
+ io.stdout('no targets configured (only needed for "neo use --global"; "neo run" does not use targets)\n');
5275
5326
  return 0;
5276
5327
  }
5277
5328
  for (const target of targets) {
@@ -5614,7 +5665,7 @@ function printProjectSyncReport(io, report) {
5614
5665
  function printConvergeReport(io, report) {
5615
5666
  const headline = report.role === null ? "off" : `use ${report.role}`;
5616
5667
  if (report.targets.length === 0) {
5617
- io.stdout(`${headline}: no targets configured (run: neo target add <agent-id>)
5668
+ io.stdout(`${headline}: no targets configured (targets are only used by "neo use --global")
5618
5669
  `);
5619
5670
  return 0;
5620
5671
  }
@@ -5986,6 +6037,16 @@ function confirmOnTty(question) {
5986
6037
  });
5987
6038
  });
5988
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
+ }
5989
6050
  function resolveHome(deps) {
5990
6051
  return resolveNeoHome({ env: deps.env, homedir: deps.homedir });
5991
6052
  }