codex-supervisor-mcp 0.9.0 → 0.9.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/README.en.md CHANGED
@@ -43,7 +43,7 @@ Prerequisites: Node.js 22.13.0 or newer, `codex` on `PATH`. macOS, Linux and Win
43
43
  npm install -g codex-supervisor-mcp
44
44
  ```
45
45
 
46
- `postinstall` installs the skill and registers the MCP. If `claude mcp list` does not show it (`npx`, pnpm and `--ignore-scripts` skip `postinstall`), add it by hand:
46
+ A global npm install runs `postinstall` when lifecycle scripts are enabled, installing the skill and registering MCP with detected Claude Code/Codex clients. `--ignore-scripts`, disabled lifecycle scripts, and running through npx do not guarantee registration; run `codex-supervisor-setup` and inspect both clients with `mcp get`. Manual registration also works:
47
47
 
48
48
  ```bash
49
49
  claude mcp add -s user codex-supervisor -- npx -y codex-supervisor-mcp
@@ -62,7 +62,7 @@ What the main thread does underneath (you can call the tools yourself):
62
62
 
63
63
  ```
64
64
  create_codex_worker ×3 each with session_id, session_title, ownedPaths, goal
65
- wait_codex_workers two minutes by default, then a snapshot, call again until done
65
+ wait_codex_workers 60 seconds by default, then a snapshot, call again until done
66
66
  get_worker_result ×3 each worker's report, with the commands it really ran
67
67
  ```
68
68
 
@@ -115,7 +115,7 @@ What the main brain calls in one round:
115
115
  ```
116
116
  search_works has this batch been dispatched before
117
117
  create_codex_worker one worker per step, same session_id, ownedPaths disjoint
118
- wait_codex_workers two minutes a round, compact: true, call again until done
118
+ wait_codex_workers 60 seconds a round, compact: true, call again until done
119
119
  get_worker_result what it says it did; verification is what it really ran
120
120
  get_worker_diff what it actually did
121
121
  ask_codex_worker when the two differ, ask why; read-only, its thread untouched
@@ -150,7 +150,7 @@ Twenty-one.
150
150
  | `create_codex_worker` | `task`, `cwd`, **`ownedPaths`**, **`goal`**, `forbid`, `allowedCommands`, `context`, `contracts`, `externalOutputs`, `networkAccess`, `maxRunMs`, `maxTotalMs`, `acceptance`, `session_id`, `session_title`, `session_note`, `dependsOn`, `baseRef`, `sandbox`, `model`, `reasoningEffort`, `title`, `skipGitRepoCheck` | Start a worker. `acceptance` lists the commands the supervisor runs in the worktree once the worker exits; exit 0 on every one passes. `baseRef` picks the commit the worktree is cut from (default `HEAD`); pass another worker's `codex/<id>` to build on it |
151
151
  | `create_codex_followup_worker` | `task_id`, `followup_prompt`, `session_id`, plus the above | A new session seeded with the old worker's prompt, status and recent events |
152
152
  | `resume_codex_worker` | `task_id`, `prompt`, `rebaseOnto`, `acceptance`, `context` | Continue the same Codex conversation; `thread_id` stays. `rebaseOnto` first moves the worktree onto the project's newer commit (stash, skip integrated patches, replay new commits, unstash); a conflict puts it back and does not start the worker |
153
- | `wait_codex_workers` | `task_ids`, `mode` (any/all), `timeoutMinutes`, `timeoutMs`, `compact`, `includeEvents`, `eventLimit`, `eventMaxChars`, `eventKinds` | Wait for terminal states. Two minutes by default, then a snapshot while the workers keep running; `compact` returns one line per worker with `idle_seconds` / `command_running`, so a long command and a stuck worker look different |
153
+ | `wait_codex_workers` | `task_ids`, `mode` (any/all), `timeoutMinutes`, `timeoutMs`, `compact`, `includeEvents`, `eventLimit`, `eventMaxChars`, `eventKinds` | Wait for terminal states. 60 seconds by default, then a snapshot while the workers keep running; `compact` returns one line per worker with `idle_seconds` / `command_running`, so a long command and a stuck worker look different |
154
154
  | `get_orchestration_overview` | `status`, `limit` | Every worker in one table, capped at 7000 bytes. Carries `version` and `update` |
155
155
  | `get_worker_result` | `task_id`, `limit`, `maxChars`, `includeFiles` | The worker's own report, clipped past 6000 bytes with `truncated` and the size to ask for. `acceptance` is whether the supervisor's own checks passed, `verification` the commands the worker ran with exit codes, `base_behind` how far main has moved |
156
156
  | `get_worker_diff` | `task_id`, `maxChars`, `paths` | What the worker actually changed: patches from the worktree's start to its working tree, committed or not. `maxChars` bounds the answer; files past it are listed without a patch |
@@ -253,7 +253,7 @@ A terminal state lands in two steps: `turn.completed` sets `completed`, the proc
253
253
  | `CODEX_SUPERVISOR_SKIP_SETUP` | unset | `1` skips the `postinstall` setup |
254
254
  | `CODEX_SUPERVISOR_NPM` | unset | npm for the auto-update; default is the one shipped with the running node |
255
255
 
256
- GUI clients (Claude Desktop, Cursor, Windsurf) do not run `postinstall`: add this to their MCP config file, and since their `PATH` often lacks `codex`, give `CODEX_BIN` explicitly:
256
+ GUI clients (Claude Desktop, Cursor, Windsurf) are not automatic registration targets of this installer: add this to their MCP config file, and since their `PATH` often lacks `codex`, give `CODEX_BIN` explicitly:
257
257
 
258
258
  ```json
259
259
  {
@@ -271,7 +271,7 @@ GUI clients (Claude Desktop, Cursor, Windsurf) do not run `postinstall`: add thi
271
271
 
272
272
  Nothing to do by hand. At start the server asks the registry in the background; a newer version is installed by a detached `npm i -g` into the same global path, the running session is untouched and the next session starts on it. Only a copy that `npm i -g` installed is touched; a git checkout or an `npx` copy is left alone. The skill does the same: every start copies it into the existing skill directories, backing up an edited file as `SKILL.md.bak-<timestamp>`.
273
273
 
274
- When the install fails (a global directory that needs sudo) the `update` field says why and `npm install -g codex-supervisor-mcp@latest` by hand still works. Versions up to 0.6.1 only notify; upgrade by hand once and it is automatic from then on. A Node version switch breaks the registered path: `claude mcp remove -s user codex-supervisor`, `codex mcp remove codex-supervisor`, reinstall. To run the setup again: `codex-supervisor-setup` (`--skill-only` / `--mcp-only` / `--dry-run`).
274
+ When the install fails (a global directory that needs sudo) the `update` field says why and `npm install -g codex-supervisor-mcp@latest` by hand still works. Versions up to 0.6.1 only notify; upgrade by hand once and it is automatic from then on. After changing Node versions/install prefixes, setup repairs old package-generated paths and verifies command/args through client read-back. Custom, disabled and project registrations are preserved with a repair warning. To run the setup again: `codex-supervisor-setup` (`--skill-only` / `--mcp-only` / `--dry-run`). Manual registration failures exit nonzero; automatic installs warn without failing npm. A skill write failure does not prevent MCP registration. Set `CLAUDE_BIN` / `CODEX_BIN` for off-PATH CLIs. Skill locations follow `CLAUDE_CONFIG_DIR` / `CODEX_HOME`.
275
275
 
276
276
  Uninstall:
277
277
 
package/README.md CHANGED
@@ -43,7 +43,7 @@ worker 跑的是 `codex exec`,`model` 透传:主线程留在 Claude,worker
43
43
  npm install -g codex-supervisor-mcp
44
44
  ```
45
45
 
46
- `postinstall` 装 skill、注册 MCP。`claude mcp list` 里没看到(`npx`、pnpm、`--ignore-scripts` 不跑 `postinstall`)就手动补:
46
+ npm 全局安装在允许执行安装脚本时,会运行 `postinstall`,给检测到的 Claude Code/Codex 装 skill 并注册 MCP。`--ignore-scripts`、禁用安装脚本或只运行 npx 不保证自动注册;没看到时先运行 `codex-supervisor-setup`,再查两端 `mcp get`。手动注册也可以:
47
47
 
48
48
  ```bash
49
49
  claude mcp add -s user codex-supervisor -- npx -y codex-supervisor-mcp
@@ -62,7 +62,7 @@ codex mcp add codex-supervisor -- npx -y codex-supervisor-mcp
62
62
 
63
63
  ```
64
64
  create_codex_worker ×3 每路带 session_id、session_title、ownedPaths、goal
65
- wait_codex_workers 默认等 2 分钟,到点返回快照,没完就接着等
65
+ wait_codex_workers 默认等 60 秒,到点返回快照,没完就接着等
66
66
  get_worker_result ×3 收每路的汇报,带它真跑过的命令和退出码
67
67
  ```
68
68
 
@@ -115,7 +115,7 @@ npx -p codex-supervisor-mcp codex-supervisor-web
115
115
  ```
116
116
  search_works 查这批活派过没有
117
117
  create_codex_worker 一步一个 worker,同一个 session_id,ownedPaths 不重叠
118
- wait_codex_workers 2 分钟一轮,compact: true,没完接着调
118
+ wait_codex_workers 60 秒一轮,compact: true,没完接着调
119
119
  get_worker_result 它说自己做了什么,verification 里是它真跑过的命令
120
120
  get_worker_diff 它实际做了什么
121
121
  ask_codex_worker 对不上就问它为什么,只读,不动它的线程
@@ -150,7 +150,7 @@ land_codex_worker 核过了,落进集成分支
150
150
  | `create_codex_worker` | `task`, `cwd`, **`ownedPaths`**, **`goal`**, `forbid`, `allowedCommands`, `context`, `contracts`, `externalOutputs`, `networkAccess`, `maxRunMs`, `maxTotalMs`, `acceptance`, `session_id`, `session_title`, `session_note`, `dependsOn`, `baseRef`, `sandbox`, `model`, `reasoningEffort`, `title`, `skipGitRepoCheck` | 起一个 worker。`acceptance` 是验收命令,worker 退出后 supervisor 在它的 worktree 里跑,退出码 0 算过。`baseRef` 指定 worktree 从哪个提交切,默认 `HEAD`,接另一路填它的 `codex/<id>` |
151
151
  | `create_codex_followup_worker` | `task_id`, `followup_prompt`, `session_id`, 其余同上 | 开一个新会话,把老 worker 的 prompt、状态、近期事件拼进去 |
152
152
  | `resume_codex_worker` | `task_id`, `prompt`, `rebaseOnto`, `acceptance`, `context` | 接同一个 Codex 会话继续跑,`thread_id` 不变。`rebaseOnto` 先把 worktree 挪到主线新头(stash、跳过已合入补丁、重放新增提交、放回),冲突原样退回不起 worker |
153
- | `wait_codex_workers` | `task_ids`, `mode`(any/all), `timeoutMinutes`, `timeoutMs`, `compact`, `includeEvents`, `eventLimit`, `eventMaxChars`, `eventKinds` | 等终态。默认 2 分钟,到点带快照返回,worker 照跑;`compact` 每路只回一行,带 `idle_seconds` / `command_running`,分得清长命令和卡住 |
153
+ | `wait_codex_workers` | `task_ids`, `mode`(any/all), `timeoutMinutes`, `timeoutMs`, `compact`, `includeEvents`, `eventLimit`, `eventMaxChars`, `eventKinds` | 等终态。默认 60 秒,到点带快照返回,worker 照跑;`compact` 每路只回一行,带 `idle_seconds` / `command_running`,分得清长命令和卡住 |
154
154
  | `get_orchestration_overview` | `status`, `limit` | 全部 worker 的状态表,封顶 7000 字节。带 `version` 和 `update` |
155
155
  | `get_worker_result` | `task_id`, `limit`, `maxChars`, `includeFiles` | worker 自己的汇报,默认截 6000 字节、`truncated` 提示读全。`acceptance` 是 supervisor 替你跑的验收过没过,`verification` 是它自己跑过的命令和退出码,`base_behind` 是主线走了多远 |
156
156
  | `get_worker_diff` | `task_id`, `maxChars`, `paths` | worker 实际改了什么:从 worktree 起点到工作区的 patch,提交没提交都算。`maxChars` 管总量,超了的文件只列名 |
@@ -253,7 +253,7 @@ ownedPaths预留和任务入库在同一事务内,跨MCP并发派单/恢复不
253
253
  | `CODEX_SUPERVISOR_SKIP_SETUP` | 未设 | `1` 跳过 `postinstall` 的自动安装 |
254
254
  | `CODEX_SUPERVISOR_NPM` | 未设 | 自动更新用的 npm,默认用当前 node 自带的 |
255
255
 
256
- GUI 客户端(Claude Desktop、Cursor、Windsurf)不跑 `postinstall`,自己把这段加进它的 MCP 配置文件,`PATH` 里常常没有 `codex`,显式给 `CODEX_BIN`:
256
+ GUI 客户端(Claude Desktop、Cursor、Windsurf)不在本安装器的自动注册目标中,自己把这段加进它的 MCP 配置文件,`PATH` 里常常没有 `codex`,显式给 `CODEX_BIN`:
257
257
 
258
258
  ```json
259
259
  {
@@ -271,7 +271,7 @@ GUI 客户端(Claude Desktop、Cursor、Windsurf)不跑 `postinstall`,自
271
271
 
272
272
  不用手动更。server 启动时后台查一次 registry,有新版就起独立进程 `npm i -g` 到同一个全局路径;正在跑的会话不受影响,下一个新会话就是新版。只对 `npm i -g` 装的那份生效,git 源码和 `npx` 起的不碰。skill 也一样,每次启动刷到已有的 skill 目录,改过的先备份成 `SKILL.md.bak-<时间戳>`。
273
273
 
274
- 装失败(全局目录要 sudo)时 `update` 字段带原因,手动 `npm install -g codex-supervisor-mcp@latest`。0.6.1 及以前只提醒不自动装,手动升一次就进自动了。换了 Node 版本注册的路径会失效,`claude mcp remove -s user codex-supervisor`、`codex mcp remove codex-supervisor` 后重装。重跑安装:`codex-supervisor-setup`(`--skill-only` / `--mcp-only` / `--dry-run`)。
274
+ 装失败(全局目录要 sudo)时 `update` 字段带原因,手动 `npm install -g codex-supervisor-mcp@latest`。0.6.1 及以前只提醒不自动装,手动升一次就进自动了。换 Node/安装前缀后,setup 会修复本包生成的旧入口,并读回核对 command/args;已有自定义、disabled、project配置保留并提示处理,不擅自覆盖。重跑安装:`codex-supervisor-setup`(`--skill-only` / `--mcp-only` / `--dry-run`)。手动注册失败返回非0,自动安装保持成功但打印warning;skill写入失败仍继续尝试MCP注册;没找到CLI时可设 `CLAUDE_BIN` / `CODEX_BIN`。skill路径跟随 `CLAUDE_CONFIG_DIR` / `CODEX_HOME`。
275
275
 
276
276
  卸载:
277
277
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-supervisor-mcp",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "mcpName": "io.github.zriyox/codex-supervisor-mcp",
5
5
  "type": "module",
6
6
  "description": "MCP server that dispatches and supervises parallel Codex CLI workers, one isolated Git worktree each, with a persisted work state machine.",
@@ -117,3 +117,5 @@ overview、派单回执、`wait` 返回里出现 `update` 且 `update_available:
117
117
  ## 看板
118
118
 
119
119
  用户想用眼睛看就让他起 `codex-supervisor-web`(或 `npx -p codex-supervisor-mcp codex-supervisor-web`),开 `http://127.0.0.1:7877`。按 session 分组,每路有「旁问」tab,用户可以自己问 worker。
120
+
121
+ 安装后没工具:先查Claude/Codex的mcp get codex-supervisor;运行codex-supervisor-setup修复本包旧入口,手动失败非0,skill写入失败仍尝试注册。CLI不在PATH设CLAUDE_BIN/CODEX_BIN;skill跟随CLAUDE_CONFIG_DIR/CODEX_HOME。禁用安装脚本时不会自动注册,自定义/disabled/project配置保留并提示处理;重开会话加载新工具和skill。
package/src/setup.js CHANGED
@@ -12,7 +12,7 @@
12
12
  import { execFile } from "node:child_process";
13
13
  import { existsSync, readdirSync } from "node:fs";
14
14
  import { homedir } from "node:os";
15
- import { dirname, join } from "node:path";
15
+ import { basename, dirname, isAbsolute, join } from "node:path";
16
16
  import { fileURLToPath } from "node:url";
17
17
  import { promisify } from "node:util";
18
18
  import {
@@ -42,7 +42,7 @@ const CLIENTS = [
42
42
  {
43
43
  ...SKILL_ROOTS.claude,
44
44
  binary: "claude",
45
- binEnv: null,
45
+ binEnv: "CLAUDE_BIN",
46
46
  npmEntry: { pkg: "@anthropic-ai/claude-code", bin: "bin/claude.exe" }
47
47
  },
48
48
  { ...SKILL_ROOTS.agents, binary: null },
@@ -151,7 +151,9 @@ function versionManagerBinDirs() {
151
151
  // instead (see bin-resolver.js).
152
152
  function locateClient(binary) {
153
153
  if (!binary) return null;
154
- const path = findBinaryPath(binary, {
154
+ const client = CLIENTS.find((entry) => entry.binary === binary);
155
+ const configured = client?.binEnv && process.env[client.binEnv]?.trim();
156
+ const path = findBinaryPath(configured || binary, {
155
157
  extraDirs: [...EXTRA_BIN_DIRS, ...versionManagerBinDirs()]
156
158
  });
157
159
  if (!path) return null;
@@ -167,25 +169,34 @@ function selectClients(options) {
167
169
  return CLIENTS.filter((client) => {
168
170
  if (options.targets && !options.targets.includes(client.id)) return false;
169
171
  if (client.binary && locateClient(client.binary)) return true;
170
- return existsSync(client.skillRoot);
172
+ return existsSync(client.skillRoot) || (client.binary && existsSync(dirname(client.skillRoot)));
171
173
  });
172
174
  }
173
175
 
174
- async function mcpAlreadyRegistered(target, options) {
175
- if (options.dryRun) return false;
176
+ async function registeredMcp(target, client) {
176
177
  try {
177
- await runClient(target, ["mcp", "get", MCP_NAME], { timeout: CLIENT_TIMEOUT_MS });
178
- return true;
179
- } catch {
180
- return false;
178
+ const { stdout } = await runClient(target, ["mcp", "get", MCP_NAME, ...(client.id === "codex" ? ["--json"] : [])], { timeout: CLIENT_TIMEOUT_MS });
179
+ if (client.id === "codex") {
180
+ const value = JSON.parse(stdout);
181
+ const transport = value.transport ?? value;
182
+ return { command: transport.command, args: transport.args ?? [], env: transport.env ?? {}, cwd: transport.cwd, enabled: value.enabled !== false, userScope: true };
183
+ }
184
+ const command = stdout.match(/^\s*Command: (.+)$/m)?.[1]?.trim();
185
+ const args = stdout.match(/^\s*Args: (.*)$/m)?.[1]?.trim();
186
+ const environment = stdout.split(/\n[ \t]*Environment:[ \t]*\r?\n/)[1]?.split(/(?:^|\n)[ \t]*To remove/)[0]?.trim();
187
+ return { command, args: args ? [args] : [], env: environment ? { custom: true } : {}, enabled: !/Status:.*Disabled/i.test(stdout), userScope: /Scope: User config/.test(stdout) };
188
+ } catch (error) {
189
+ const message = `${error.stdout ?? ""}${error.stderr ?? ""}${error.message}`;
190
+ if (/not found|no mcp server|could not find|does not exist/i.test(message)) return null;
191
+ throw new Error(`cannot read ${client.label} MCP registration: ${error.message.split("\n")[0]}`);
181
192
  }
182
193
  }
183
194
 
184
195
  async function registerMcp(client, options, log, warn) {
185
196
  const target = locateClient(client.binary);
186
197
  if (!target) {
187
- log(`mcp ${client.label}: skipped (no ${client.binary} found)`);
188
- return "skipped";
198
+ warn(`mcp ${client.label}: no ${client.binary} CLI found; install it or set ${client.binEnv} to its executable, then run "codex-supervisor-setup"`);
199
+ return "failed";
189
200
  }
190
201
  if (target.shim) {
191
202
  warn(
@@ -193,9 +204,21 @@ async function registerMcp(client, options, log, warn) {
193
204
  );
194
205
  return "failed";
195
206
  }
196
- if (await mcpAlreadyRegistered(target, options)) {
197
- log(`mcp ${client.label}: already registered`);
198
- return "unchanged";
207
+ let previous;
208
+ try { previous = options.dryRun ? null : await registeredMcp(target, client); }
209
+ catch (error) { warn(`mcp ${client.label}: ${error.message}`); return "failed"; }
210
+ if (previous) {
211
+ const same = previous.userScope && previous.command === process.execPath && previous.args.length === 1 && previous.args[0] === serverEntry;
212
+ if (same && previous.enabled) { log(`mcp ${client.label}: already registered at this installation`); return "unchanged"; }
213
+ const managed = previous.userScope && previous.enabled && !previous.cwd && Object.keys(previous.env).length === 0
214
+ && ["node", "node.exe"].includes(basename(previous.command ?? "").toLowerCase())
215
+ && previous.args.length === 1 && isAbsolute(previous.args[0])
216
+ && /(?:^|[\\/])codex-supervisor-mcp[\\/]src[\\/]mcp-server\.js$/.test(previous.args[0])
217
+ && (/[\\/]node_modules[\\/]/.test(previous.args[0]) || !existsSync(previous.args[0]));
218
+ if (!managed) {
219
+ warn(`mcp ${client.label}: existing custom, disabled or project registration preserved; inspect "${client.binary} mcp get ${MCP_NAME}" before replacing it`);
220
+ return "failed";
221
+ }
199
222
  }
200
223
 
201
224
  const args =
@@ -204,14 +227,25 @@ async function registerMcp(client, options, log, warn) {
204
227
  : ["mcp", "add", MCP_NAME, "--", process.execPath, serverEntry];
205
228
 
206
229
  if (options.dryRun) {
230
+ if (previous) log(`mcp ${client.label}: would repair stale package registration`);
207
231
  log(`mcp ${client.label}: would run ${client.binary} ${args.join(" ")}`);
208
232
  return "would-register";
209
233
  }
210
234
  try {
235
+ if (previous) await runClient(target, client.id === "claude" ? ["mcp", "remove", "-s", "user", MCP_NAME] : ["mcp", "remove", MCP_NAME], { timeout: CLIENT_TIMEOUT_MS });
211
236
  await runClient(target, args, { timeout: CLIENT_TIMEOUT_MS });
212
- log(`mcp ${client.label}: registered`);
237
+ const actual = await registeredMcp(target, client);
238
+ if (!actual || actual.command !== process.execPath || actual.args.length !== 1 || actual.args[0] !== serverEntry || !actual.enabled) throw new Error("registration command succeeded but read-back does not match this package");
239
+ log(`mcp ${client.label}: ${previous ? "repaired" : "registered"}`);
213
240
  return "registered";
214
241
  } catch (error) {
242
+ if (previous) {
243
+ try {
244
+ await runClient(target, client.id === "claude" ? ["mcp", "remove", "-s", "user", MCP_NAME] : ["mcp", "remove", MCP_NAME], { timeout: CLIENT_TIMEOUT_MS }).catch(() => {});
245
+ const restore = client.id === "claude" ? ["mcp", "add", "-s", "user", MCP_NAME, "--", previous.command, ...previous.args] : ["mcp", "add", MCP_NAME, "--", previous.command, ...previous.args];
246
+ await runClient(target, restore, { timeout: CLIENT_TIMEOUT_MS });
247
+ } catch (restoreError) { warn(`mcp ${client.label}: restoring the original registration failed (${restoreError.message.split("\n")[0]})`); }
248
+ }
215
249
  warn(
216
250
  `mcp ${client.label}: registration failed (${error.message.split("\n")[0]}) ` +
217
251
  `- run "codex-supervisor-setup" once ${client.label} is working`
@@ -240,27 +274,31 @@ async function main() {
240
274
  const log = options.quiet ? () => {} : (line) => console.log(line);
241
275
  const warn = (line) => console.error(line);
242
276
  const clients = selectClients(options);
277
+ const missingTargets = options.targets?.filter((id) => !clients.some((client) => client.id === id)) ?? [];
278
+ if (missingTargets.length) warn(`setup: requested client(s) not detected: ${missingTargets.join(", ")}; install the CLI or set CLAUDE_BIN / CODEX_BIN`);
243
279
 
244
280
  if (clients.length === 0) {
245
- log("setup: no Claude Code / Codex client detected; nothing to do");
246
- return 0;
281
+ warn("setup: no Claude Code / Codex client detected; MCP was not registered. Install a client, then run codex-supervisor-setup.");
282
+ return options.targets?.length && !options.auto ? 1 : 0;
247
283
  }
248
284
 
249
285
  log(`setup: ${options.dryRun ? "dry run against" : "configuring"} ${clients.map((client) => client.label).join(", ")}`);
250
286
 
287
+ let failures = missingTargets.length;
251
288
  if (options.skills) {
252
289
  for (const client of clients) {
253
- await installSkill(client, options, log);
290
+ try { await installSkill(client, options, log); }
291
+ catch (error) { failures += 1; warn(`skill ${client.label}: install failed (${error.message.split("\n")[0]}); MCP registration will still be attempted`); }
254
292
  }
255
293
  }
256
294
  if (options.mcp) {
257
295
  for (const client of clients.filter((client) => client.binary)) {
258
- await registerMcp(client, options, log, warn);
296
+ if (await registerMcp(client, options, log, warn) === "failed") failures += 1;
259
297
  }
260
298
  }
261
299
 
262
- log("setup: done");
263
- return 0;
300
+ log(failures ? `setup: ${failures} setup step(s) require repair` : "setup: done");
301
+ return failures && !options.auto ? 1 : 0;
264
302
  }
265
303
 
266
304
  try {
package/src/skill-sync.js CHANGED
@@ -18,9 +18,9 @@ export const skillSource = join(packageRoot, "skills", SKILL_NAME, "SKILL.md");
18
18
  export function skillRoots() {
19
19
  const home = homedir();
20
20
  return {
21
- claude: { id: "claude", label: "Claude Code", skillRoot: join(home, ".claude", "skills") },
21
+ claude: { id: "claude", label: "Claude Code", skillRoot: join(process.env.CLAUDE_CONFIG_DIR?.trim() || join(home, ".claude"), "skills") },
22
22
  agents: { id: "agents", label: "~/.agents", skillRoot: join(home, ".agents", "skills") },
23
- codex: { id: "codex", label: "Codex", skillRoot: join(home, ".codex", "skills") }
23
+ codex: { id: "codex", label: "Codex", skillRoot: join(process.env.CODEX_HOME?.trim() || join(home, ".codex"), "skills") }
24
24
  };
25
25
  }
26
26