@yawlabs/mcp 1.0.3 → 1.0.5

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/CHANGELOG.md CHANGED
@@ -12,9 +12,19 @@ In an augment pane, the line `uninstall` prints when it keeps the `~/.claude/set
12
12
 
13
13
  **Fixed -- on Windows, an audit stops failing on the lock the audit before it was releasing**
14
14
 
15
- A release run died in its test gate: `grades-cache.test.ts`'s concurrent-writes case threw `EPERM: operation not permitted, open '...\.yaw-mcp\grades.json.lock'`. It was not the test. On Windows, creating a file with `O_EXCL` while another thread or process is deleting the same path fails `EPERM` instead of succeeding or answering "already exists" -- 225 times in 2000 races on the machine that failed (Windows 11, Node 22.22.2). The grade cache's lock take treated every errno other than "already exists" as fatal, so a `yaw-mcp audit` whose wait happened to land inside the previous holder's release failed with exit 3, grade computed but not cached. The Yaw Terminal MCP panel grading two servers at once is exactly that shape. The take now retries `EPERM`, `EBUSY` and `EACCES` on Windows -- the codes `atomicWriteFile` already retries its rename on -- for up to a second, then reports the real errno rather than a lock-timeout message. POSIX is unchanged.
15
+ A release run died in its test gate: `grades-cache.test.ts`'s concurrent-writes case threw `EPERM: operation not permitted, open '...\.yaw-mcp\grades.json.lock'`. It was not the test. On Windows, creating a file with `O_EXCL` while another thread or process is deleting the same path fails `EPERM` instead of succeeding or answering "already exists". On the machine that failed (Windows 11, Node 22.22.2), a probe racing three creates against one delete 2000 times hit it in every one of 20 runs. The grade cache's lock take treated every errno other than "already exists" as fatal, so a `yaw-mcp audit` whose wait happened to land inside the previous holder's release failed with exit 3, grade computed but not cached. The Yaw Terminal MCP panel grading two servers at once is exactly that shape. The take now retries `EPERM`, `EBUSY` and `EACCES` on Windows -- the codes `atomicWriteFile` already retries its rename on -- for up to a second, then reports the real errno rather than a lock-timeout message. POSIX is unchanged.
16
16
 
17
- The same take backs the `bundles.json` write lock, the sidecars install lock and the self-upgrade lock, and there the misread was quieter: a lock it could not create was treated as "no lock possible here, proceed", so the same `EPERM` ran the write or the install unlocked beside whichever process took the lock next. It now retries those codes three times, 26 ms in all, before falling back to that best-effort answer.
17
+ The same take backs the `bundles.json` write lock, the sidecars install lock and the self-upgrade lock, and there the misread was quieter: a lock it could not create was treated as "no lock possible here, proceed", so the same `EPERM` ran the write or the install unlocked beside whichever process took the lock next. It now retries those codes three times before falling back to that best-effort answer. The backoffs add up to 26 ms on paper and measured 31-74 ms on an idle Windows machine, since short waits there overshoot.
18
+
19
+ **Fixed -- doctor and `install --list` read a Codex CLI config.toml as TOML, not as broken JSON**
20
+
21
+ `doctor` and `install --list` parsed every client file as JSON, so a valid `~/.codex/config.toml` -- the one `install codex-cli` writes included -- read as `exists but JSON is malformed` in `doctor` and `malformed` in `install --list`. Both now classify a non-JSON file through the same adapter `install` reads it with. A valid `config.toml` with a `[mcp_servers.mcp]` table reads `OK -- has "mcp" entry` in `doctor` and `installed` in `install --list`. JSON and JSONC clients are read exactly as before.
22
+
23
+ **`doctor`'s exit code changes**: a machine whose only warning was that Codex CLI line now exits 0. Once Yaw Terminal bundles this release, that clears its MCP panel's "Warnings need attention." **`install --list`'s STATUS for the Codex CLI rows moves off `malformed`** to `installed`, `no-entries` or `other-entries`, as the file says.
24
+
25
+ A `config.toml` that really does not parse is reported in TOML words by `doctor`, `install` and `import`: ``exists but TOML is malformed -- install refuses to overwrite it; fix the TOML by hand, or move the file aside, then run `yaw-mcp install codex-cli` ``. A `mcp_servers` key that is not a table reads `not a TOML table` and `make it a table (or remove the key)`. An `mcp` entry written as an inline table, as dotted keys, as an array of tables, or inside an inline `mcp_servers = { ... }` is reported as present but not editable -- install will not rewrite it, and doctor cannot check its launch command -- with the by-hand step for that spelling, and is not a warning. The step is per spelling because no one step fits all four: an entry inside an inline `mcp_servers` can neither be rewritten as its own `[mcp_servers.mcp]` table (a redefinition, which stops the file loading) nor deleted and re-installed (the header install writes is refused by the still-inline container); only converting the container works, and the line says that. Where the step is a new `[mcp_servers.mcp]` table, it says to put the table at the end of the file: written where the old line was, it would take in the keys below it, and the next install would delete them. An inline `mcp_servers = { ... }` holding other servers and no `mcp` entry reads as present with no `mcp` entry and names converting the container as the step, rather than `run install`, because an install run exits 1 on that file.
26
+
27
+ `add`'s "no client is wired" nudge stops for a user whose only wired client is Codex CLI. `try` without `--client` still does not pick a `config.toml`: a trial marker cannot yet clean one up, so auto-detect keeps to JSON-family files. `doctor --json`'s `clients[]` slots gain three additive fields: `syntax` (`"JSON"` or `"TOML"`), `entryUnspliceable` (`{ reason, fix }` for an `mcp` entry install will not edit, or `null`) and `containerUnspliceable` (the same shape for a container that cannot take the entry, or `null`). Every JSON-family slot carries `"JSON"` and two `null`s, so a reader that ignores unknown keys sees no other change; the text CLIENTS lines and the `install --list` rows for JSON and JSONC clients are byte-identical to 1.0.4's.
18
28
 
19
29
  ## 1.0.2 -- `install --force` stops keeping the env it promised to overwrite, editing a client config stops rewriting the entry next to ours, and the install surfaces stop stating things that are not so
20
30
 
@@ -112,7 +122,7 @@ Four clients are new install targets, landed after 1.0.1. `install`, `uninstall`
112
122
  - **Continue** (`install continue`, user and project scope): a file of yaw-mcp's own, `mcpServers/yaw-mcp.json`, under `~/.continue` (or `CONTINUE_GLOBAL_DIR`) or `<project>/.continue`. The Done line says to reload the IDE window. On Windows the entry is bare `npx`, because Continue adds the `cmd.exe` wrapper itself.
113
123
  - **Codex CLI** (`install codex-cli`, user and project scope): an `[mcp_servers.mcp]` table in `config.toml` under `CODEX_HOME` (default `~/.codex`), or `<project>/.codex/config.toml`, with `startup_timeout_sec` set to 60 seconds against Codex's own default of 10. On Windows the entry is bare `npx`, which needs Codex 0.59.0 or newer. A re-run without `--force` keeps `env_vars` and `enabled`; the Done line says to restart Codex.
114
124
 
115
- Two gaps ship with them. `install --list` and `doctor` still read every client file as JSON, so a Codex CLI `config.toml` -- the one `install codex-cli` just wrote included -- shows as `malformed` in `install --list`, and `doctor` warns about it and exits 2. And both report Cline by its shared file alone, not by the editor copies.
125
+ Two gaps ship with them. `install --list` and `doctor` still read every client file as JSON, so a Codex CLI `config.toml` -- the one `install codex-cli` just wrote included -- shows as `malformed` in `install --list`, and `doctor` warns about it and exits 2 -- the Unreleased section above closes that one. And both report Cline by its shared file alone, not by the editor copies.
116
126
 
117
127
  **`mcp`** is Claude Code's project scope under a second name: `install mcp`, `uninstall mcp` and `import mcp` act on the project-root `.mcp.json` exactly as `claude-code --scope project` does, and an explicit `--scope` beside it still wins. It is an alias rather than a row, so `install --list` and `doctor` do not show that file twice, and `try` does not take it.
118
128
 
@@ -9,7 +9,7 @@ import {
9
9
  readCheckMemo,
10
10
  recordAttemptAt,
11
11
  writeCheckMemo
12
- } from "./chunk-7AUZKQTT.js";
12
+ } from "./chunk-Y5LYJWUB.js";
13
13
  export {
14
14
  acquireUpgradeLock,
15
15
  attemptedRecentlyAt,
@@ -880,7 +880,20 @@ function resolveAppDataDir(opts) {
880
880
 
881
881
  // src/client-config.ts
882
882
  function syntaxNameFor(format) {
883
- return format === "toml" ? "TOML" : "JSON";
883
+ switch (format) {
884
+ case "json":
885
+ case "jsonc":
886
+ return "JSON";
887
+ case "toml":
888
+ return "TOML";
889
+ default: {
890
+ const _exhaustive = format;
891
+ return _exhaustive;
892
+ }
893
+ }
894
+ }
895
+ function containerNounFor(syntax) {
896
+ return syntax === "TOML" ? "a TOML table" : "a JSON object";
884
897
  }
885
898
  function effectiveConfigFormat(shape, scope) {
886
899
  return scope?.strictJson === true && shape.format === "jsonc" ? "json" : shape.format;
@@ -1944,7 +1957,7 @@ function readTomlConfig(raw, containerPath, entryNames = []) {
1944
1957
  let cursor = parsed;
1945
1958
  for (let i = 0; i < containerPath.length; i++) {
1946
1959
  const key = containerPath[i];
1947
- if (!(key in cursor)) return { kind: "ok", containerPresent: false, entries: [] };
1960
+ if (!(key in cursor)) return { kind: "ok", containerPresent: false, entries: [], containerUnspliceable: null };
1948
1961
  const next = cursor[key];
1949
1962
  if (!isTomlTable(next)) {
1950
1963
  return {
@@ -1965,12 +1978,18 @@ function readTomlConfig(raw, containerPath, entryNames = []) {
1965
1978
  key: name,
1966
1979
  shape: problem.shape,
1967
1980
  remedy: problem.remedy,
1981
+ fix: problem.fix,
1968
1982
  removable: problem.removable
1969
1983
  };
1970
1984
  }
1971
1985
  }
1972
1986
  const entries = Object.keys(cursor).map((key) => ({ key, value: cursor[key] }));
1973
- return { kind: "ok", containerPresent: true, entries };
1987
+ const first = entryNames[0];
1988
+ const containerUnspliceable = first !== void 0 && rootContainerIsInline(scan, containerPath) ? {
1989
+ shape: `an inline table (${containerPath.map(tomlKey).join(".")} = { ... }) that a later [${[...containerPath, first].map(tomlKey).join(".")}] header cannot extend`,
1990
+ fix: `convert it to [${[...containerPath, first].map(tomlKey).join(".")}]-style tables by hand`
1991
+ } : null;
1992
+ return { kind: "ok", containerPresent: true, entries, containerUnspliceable };
1974
1993
  }
1975
1994
  function tomlEntryFields(read, name) {
1976
1995
  if (read.kind !== "ok") return void 0;
@@ -1990,6 +2009,7 @@ function entryShapeProblem(scan, parsed, containerPath, name) {
1990
2009
  return {
1991
2010
  shape: `an array of tables ([[${entryPath.map(tomlKey).join(".")}]])`,
1992
2011
  remedy: `Codex reads a server as a single table, so make it one ${headerLabel} table (or remove it), then re-run`,
2012
+ fix: `rewrite it by hand as a single ${headerLabel} table (or delete it)`,
1993
2013
  removable: true
1994
2014
  };
1995
2015
  }
@@ -2002,6 +2022,7 @@ function entryShapeProblem(scan, parsed, containerPath, name) {
2002
2022
  return {
2003
2023
  shape: `written as dotted keys at the top level (${entryPath.join(".")}.command = ...)`,
2004
2024
  remedy: `only a ${headerLabel} table can be rewritten in place -- replace those lines with the table below by hand (or delete them and re-run)`,
2025
+ fix: `move those lines by hand into a ${headerLabel} table at the end of the file (or delete them)`,
2005
2026
  removable: false
2006
2027
  };
2007
2028
  }
@@ -2010,6 +2031,7 @@ function entryShapeProblem(scan, parsed, containerPath, name) {
2010
2031
  return {
2011
2032
  shape: `written as dotted keys under [${containerLabel}] (${name}.command = ...)`,
2012
2033
  remedy: `only a ${headerLabel} table can be rewritten in place -- replace those lines with the table below by hand (or delete them and re-run)`,
2034
+ fix: `move those lines by hand into a ${headerLabel} table at the end of the file (or delete them)`,
2013
2035
  removable: false
2014
2036
  };
2015
2037
  }
@@ -2017,6 +2039,7 @@ function entryShapeProblem(scan, parsed, containerPath, name) {
2017
2039
  return {
2018
2040
  shape: `an inline table under [${containerLabel}] (${name} = { ... })`,
2019
2041
  remedy: `only a ${headerLabel} table can be rewritten in place -- replace that line with the table below by hand (or delete it and re-run)`,
2042
+ fix: `move that line by hand into a ${headerLabel} table at the end of the file (or delete it)`,
2020
2043
  removable: false
2021
2044
  };
2022
2045
  }
@@ -2024,12 +2047,14 @@ function entryShapeProblem(scan, parsed, containerPath, name) {
2024
2047
  return {
2025
2048
  shape: `inside the inline table ${containerLabel} = { ... }`,
2026
2049
  remedy: `TOML cannot extend an inline table with a later table, so convert it to ${headerLabel}-style tables by hand, then re-run`,
2050
+ fix: `convert the inline ${containerLabel} = { ... } to ${headerLabel}-style tables by hand`,
2027
2051
  removable: false
2028
2052
  };
2029
2053
  }
2030
2054
  return {
2031
2055
  shape: `not written as a ${headerLabel} table`,
2032
2056
  remedy: `only a ${headerLabel} table can be rewritten in place -- replace it with the table below by hand (or delete it and re-run)`,
2057
+ fix: `move it by hand into a ${headerLabel} table at the end of the file (or delete it)`,
2033
2058
  removable: false
2034
2059
  };
2035
2060
  }
@@ -2297,13 +2322,16 @@ function classifyToml(raw, addr, transform) {
2297
2322
  }
2298
2323
  return { kind: "blocked", path: read.path, shape: read.shape, reparable: false, unloadable: null };
2299
2324
  case "unspliceable":
2300
- return { kind: "unspliceable", key: read.key, reason: read.shape };
2325
+ return { kind: "unspliceable", key: read.key, reason: read.shape, fix: read.fix };
2301
2326
  default:
2302
2327
  return {
2303
2328
  kind: "ok",
2304
2329
  containerPresent: read.containerPresent,
2305
2330
  entries: entryViewsOf(read, transform),
2306
- unloadable: null
2331
+ unloadable: null,
2332
+ ...read.containerUnspliceable === null ? {} : {
2333
+ containerUnspliceable: { reason: read.containerUnspliceable.shape, fix: read.containerUnspliceable.fix }
2334
+ }
2307
2335
  };
2308
2336
  }
2309
2337
  }
@@ -3312,11 +3340,11 @@ function describeJsonShape(value) {
3312
3340
  if (Array.isArray(value)) return value.length === 0 ? "an empty array" : `an array of ${value.length}`;
3313
3341
  return `a ${typeof value}`;
3314
3342
  }
3315
- function unparseableConfigFix(then) {
3316
- return `fix the JSON by hand, or move the file aside, then ${then}`;
3343
+ function unparseableConfigFix(then, syntax = "JSON") {
3344
+ return `fix the ${syntax} by hand, or move the file aside, then ${then}`;
3317
3345
  }
3318
- function blockedContainerFix(then) {
3319
- return `make it an object (or remove the key), then ${then}`;
3346
+ function blockedContainerFix(then, syntax = "JSON") {
3347
+ return `make it ${syntax === "TOML" ? "a table" : "an object"} (or remove the key), then ${then}`;
3320
3348
  }
3321
3349
 
3322
3350
  // src/paths.ts
@@ -4387,7 +4415,7 @@ async function oamFloorLines(probe) {
4387
4415
  }
4388
4416
  async function defaultRunningPrefix(argvPath) {
4389
4417
  if (process.env.VITEST) return null;
4390
- const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-S4MOIA6T.js");
4418
+ const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-2EFOO6XW.js");
4391
4419
  return detectRunningInstallPrefix2(argvPath);
4392
4420
  }
4393
4421
  async function defaultSpawn(cmd, args, cwd) {
@@ -4448,7 +4476,7 @@ async function runUpgrade(opts = {}) {
4448
4476
  if (method === "global-npm") {
4449
4477
  const rawPrefix = await (opts.runningPrefix ?? defaultRunningPrefix)(argvPath);
4450
4478
  if (rawPrefix !== null) {
4451
- const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-S4MOIA6T.js");
4479
+ const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-2EFOO6XW.js");
4452
4480
  const spawnForm = quoteShellArgIfNeeded2(rawPrefix, opts.platform);
4453
4481
  const displayForm = quoteArgForDisplay2(rawPrefix, opts.platform);
4454
4482
  if (spawnForm !== null && displayForm !== null) {
@@ -4565,7 +4593,7 @@ async function runUpgrade(opts = {}) {
4565
4593
  return { exitCode: 3, lines };
4566
4594
  }
4567
4595
  function readCurrentVersion() {
4568
- return true ? "1.0.3" : "dev";
4596
+ return true ? "1.0.5" : "dev";
4569
4597
  }
4570
4598
 
4571
4599
  // src/auto-upgrade.ts
@@ -4847,7 +4875,7 @@ function defaultSpawn2(cmd, args, onDone = () => {
4847
4875
  async function maybeAutoUpgrade(deps = {}) {
4848
4876
  const optOut = process.env.YAW_MCP_AUTO_UPGRADE;
4849
4877
  if (optOut === "0" || optOut?.toLowerCase() === "false") return;
4850
- const current = deps.currentVersion ?? (true ? "1.0.3" : "dev");
4878
+ const current = deps.currentVersion ?? (true ? "1.0.5" : "dev");
4851
4879
  if (current === "dev") return;
4852
4880
  const argvPath = deps.argvPath ?? process.argv[1];
4853
4881
  const method = (deps.isSeaImpl ? await deps.isSeaImpl() : await detectSea()) ? "binary" : detectInstallMethod(argvPath, realpathSync2, ["unknown", "local-node-modules"]);
@@ -4981,6 +5009,8 @@ export {
4981
5009
  ENTRY_NAME,
4982
5010
  LEGACY_ENTRY_NAMES,
4983
5011
  resolveAppDataDir,
5012
+ syntaxNameFor,
5013
+ containerNounFor,
4984
5014
  effectiveConfigFormat,
4985
5015
  selectSites,
4986
5016
  unloadableConfigProblem,
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ import {
23
23
  compareVersions,
24
24
  composeEntry,
25
25
  containerKeysAt,
26
+ containerNounFor,
26
27
  createStreamWriter,
27
28
  describeJsonShape,
28
29
  describeValueShape,
@@ -84,6 +85,7 @@ import {
84
85
  siteAt,
85
86
  specConstraint,
86
87
  stripInternalSecretsFromEnv,
88
+ syntaxNameFor,
87
89
  terminateWithNewline,
88
90
  tildePath,
89
91
  unloadableConfigFix,
@@ -91,7 +93,7 @@ import {
91
93
  unparseableConfigFix,
92
94
  userConfigDir,
93
95
  yawModeOverlay
94
- } from "./chunk-7AUZKQTT.js";
96
+ } from "./chunk-Y5LYJWUB.js";
95
97
 
96
98
  // src/audit-cmd.ts
97
99
  import { homedir as homedir6 } from "os";
@@ -561,6 +563,7 @@ async function withGradesLock(path5, opts, fn) {
561
563
  const lockPath = `${path5}${GRADES_LOCK_SUFFIX}`;
562
564
  const staleMs = opts.lockStaleMs ?? GRADES_LOCK_STALE_MS;
563
565
  const waitMs = opts.lockWaitMs ?? GRADES_LOCK_WAIT_MS;
566
+ const transientMs = opts.lockTransientMs ?? GRADES_LOCK_TRANSIENT_MS;
564
567
  const token = `${process.pid}-${++lockSeq}
565
568
  `;
566
569
  const isLive = (ageMs) => ageMs > -GRADES_LOCK_FUTURE_SKEW_MS && ageMs < staleMs;
@@ -575,7 +578,7 @@ async function withGradesLock(path5, opts, fn) {
575
578
  if (!isWin32TransientFsError(err)) throw err;
576
579
  const now = Date.now();
577
580
  transientSince ??= now;
578
- if (now >= deadline || now - transientSince >= GRADES_LOCK_TRANSIENT_MS) throw err;
581
+ if (now >= deadline || now - transientSince >= transientMs) throw err;
579
582
  await delay(GRADES_LOCK_POLL_MS);
580
583
  continue;
581
584
  }
@@ -3193,7 +3196,7 @@ async function connectToUpstreamOnce(config, onDisconnect, onListChanged, bridge
3193
3196
  if (downstreamCaps?.sampling) capabilities.sampling = downstreamCaps.sampling;
3194
3197
  if (downstreamCaps?.roots) capabilities.roots = {};
3195
3198
  const client = new Client(
3196
- { name: "yaw-mcp", version: true ? "1.0.3" : "dev" },
3199
+ { name: "yaw-mcp", version: true ? "1.0.5" : "dev" },
3197
3200
  { capabilities }
3198
3201
  );
3199
3202
  if (bridge && capabilities.elicitation) {
@@ -8464,7 +8467,7 @@ ${USAGE}`);
8464
8467
  }
8465
8468
  if (read.kind === "malformed") {
8466
8469
  err(
8467
- read.reason === "root" ? `yaw-mcp install: ${resolved.absolute} is not a ${read.syntax} object -- refusing to overwrite it; ${unparseableConfigFix("re-run")}.` : `yaw-mcp install: ${resolved.absolute} is not valid ${read.syntax} (${read.detail}) -- refusing to overwrite it; ${unparseableConfigFix("re-run")}.`
8470
+ read.reason === "root" ? `yaw-mcp install: ${resolved.absolute} is not a ${read.syntax} object -- refusing to overwrite it; ${unparseableConfigFix("re-run", read.syntax)}.` : `yaw-mcp install: ${resolved.absolute} is not valid ${read.syntax} (${read.detail}) -- refusing to overwrite it; ${unparseableConfigFix("re-run", read.syntax)}.`
8468
8471
  );
8469
8472
  return { written: [], wouldWrite: [], messages, exitCode: 1 };
8470
8473
  }
@@ -8648,7 +8651,7 @@ ${differs}
8648
8651
  const keyPath = read.path.join(".");
8649
8652
  if (!read.reparable) {
8650
8653
  err(
8651
- `yaw-mcp install: "${keyPath}" in ${resolved.absolute} is ${read.shape}, not a JSON object -- refusing to overwrite it; ${blockedContainerFix("re-run")}.`
8654
+ `yaw-mcp install: "${keyPath}" in ${resolved.absolute} is ${read.shape}, not ${containerNounFor(view.adapter.syntax)} -- refusing to overwrite it; ${blockedContainerFix("re-run", view.adapter.syntax)}.`
8652
8655
  );
8653
8656
  return { written: [], wouldWrite: [], messages, exitCode: 1 };
8654
8657
  }
@@ -10261,7 +10264,7 @@ async function autoDetectClient(opts) {
10261
10264
  appData: opts.appData
10262
10265
  });
10263
10266
  for (const p of probes) {
10264
- if (probeUsable(p)) return { clientId: p.clientId, scope: p.scope };
10267
+ if (probeUsable(p) && p.syntax === "JSON") return { clientId: p.clientId, scope: p.scope };
10265
10268
  }
10266
10269
  for (const p of probes) {
10267
10270
  if (!p.unavailable) return { clientId: p.clientId, scope: null };
@@ -11028,7 +11031,7 @@ function foldBundleWarnings(warnings, probe) {
11028
11031
  const prefix = `${probe.path}:`;
11029
11032
  return warnings.filter((w) => !w.startsWith(prefix));
11030
11033
  }
11031
- var VERSION = true ? "1.0.3" : "dev";
11034
+ var VERSION = true ? "1.0.5" : "dev";
11032
11035
  var DOCTOR_USAGE = `Usage: yaw-mcp doctor [--json]
11033
11036
 
11034
11037
  Print a diagnostic of your yaw-mcp setup.
@@ -11091,7 +11094,7 @@ function isTransientRead(c) {
11091
11094
  return c.unreadable !== null && c.unreadableCode !== null && TRANSIENT_READ_CODES.has(c.unreadableCode);
11092
11095
  }
11093
11096
  function probeUsable(c) {
11094
- return !c.unavailable && c.exists && !c.malformed && c.unreadable === null && c.unloadable === null;
11097
+ return !c.unavailable && c.exists && !c.malformed && c.unreadable === null && c.unloadable === null && c.entryUnspliceable === null && c.containerUnspliceable === null;
11095
11098
  }
11096
11099
  function clientCannotLaunch(c) {
11097
11100
  return c.unreadable !== null && !isTransientRead(c) || c.malformed || // Only WITH our entry in it. The file's client loads no server from it
@@ -11875,14 +11878,20 @@ function renderClientStatus(c, installCmd) {
11875
11878
  return `exists but could not be read (${c.unreadable}) -- check the file and its permissions, then rerun doctor`;
11876
11879
  }
11877
11880
  if (c.malformed) {
11878
- return `exists but JSON is malformed -- install refuses to overwrite it; ${unparseableConfigFix(`run \`${installCmd}\``)}`;
11881
+ return `exists but ${c.syntax} is malformed -- install refuses to overwrite it; ${unparseableConfigFix(`run \`${installCmd}\``, c.syntax)}`;
11879
11882
  }
11880
11883
  if (c.containerBlocked !== null) {
11881
- return `present, but ${c.containerBlocked}, not a JSON object -- install refuses to overwrite it; ${blockedContainerFix(`run \`${installCmd}\``)}`;
11884
+ return `present, but ${c.containerBlocked}, not ${containerNounFor(c.syntax)} -- install refuses to overwrite it; ${blockedContainerFix(`run \`${installCmd}\``, c.syntax)}`;
11882
11885
  }
11883
11886
  if (c.unloadable !== null) {
11884
11887
  return `exists but ${c.unloadable} -- install refuses to write into it; ${unloadableConfigFix(`run \`${installCmd}\``)}`;
11885
11888
  }
11889
+ if (c.entryUnspliceable !== null) {
11890
+ return `has "${ENTRY_NAME}" entry, but it is ${c.entryUnspliceable.reason} -- install will not edit it and doctor cannot check its launch command; ${c.entryUnspliceable.fix}, then run \`${installCmd}\``;
11891
+ }
11892
+ if (c.containerUnspliceable !== null) {
11893
+ return `present, no "${ENTRY_NAME}" entry, but the container is ${c.containerUnspliceable.reason} -- install refuses to write into it; ${c.containerUnspliceable.fix}, then run \`${installCmd}\``;
11894
+ }
11886
11895
  const legacy = c.hasLegacyEntry ? `; legacy "${c.legacyEntryName}" entry also present -- install removes it as it writes the working entry` : "";
11887
11896
  const keyNote = c.entryProjectKey ? `; found under projects[${JSON.stringify(c.entryProjectKey)}], the same directory spelled with the other drive-letter case -- only a Claude Code whose cwd is spelled that way reads it, and \`${installCmd}\` writes the canonical key` : "";
11888
11897
  if (c.launchCommandMissing) {
@@ -11924,7 +11933,9 @@ var EMPTY_PROBE = {
11924
11933
  launchOamNotAbsolute: null,
11925
11934
  launchOamEntryMissing: null,
11926
11935
  launchForeignPath: null,
11927
- entryProjectKey: null
11936
+ entryProjectKey: null,
11937
+ entryUnspliceable: null,
11938
+ containerUnspliceable: null
11928
11939
  };
11929
11940
  var MALFORMED = { ...EMPTY_PROBE, malformed: true };
11930
11941
  function unreadableProbe(err) {
@@ -11947,6 +11958,7 @@ function* enumerateProbeSlots(opts) {
11947
11958
  exists: false,
11948
11959
  unavailable: true,
11949
11960
  ...EMPTY_PROBE,
11961
+ syntax: syntaxNameFor(effectiveConfigFormat(target.config, target.scopes[0])),
11950
11962
  ...why !== void 0 ? { unavailableReason: why } : {}
11951
11963
  },
11952
11964
  read: null
@@ -11954,9 +11966,9 @@ function* enumerateProbeSlots(opts) {
11954
11966
  continue;
11955
11967
  }
11956
11968
  for (const scope of target.scopes) {
11957
- let resolved;
11969
+ let site;
11958
11970
  try {
11959
- resolved = resolveInstallPath({
11971
+ site = resolveInstallSites({
11960
11972
  clientId: target.clientId,
11961
11973
  scope: scope.scope,
11962
11974
  os: opts.os,
@@ -11965,29 +11977,25 @@ function* enumerateProbeSlots(opts) {
11965
11977
  projectDir: scope.requiresProjectDir ? opts.cwd : void 0,
11966
11978
  claudeConfigDir: opts.claudeConfigDir,
11967
11979
  clientEnv: opts.clientEnv
11968
- });
11980
+ })[0];
11969
11981
  } catch {
11970
11982
  continue;
11971
11983
  }
11972
- const exists2 = existsSync6(resolved.absolute);
11984
+ const exists2 = existsSync6(site.resolved.absolute);
11973
11985
  yield {
11974
11986
  result: {
11975
11987
  clientId: target.clientId,
11976
11988
  scope: scope.scope,
11977
- path: resolved.absolute,
11989
+ path: site.resolved.absolute,
11978
11990
  exists: exists2,
11979
11991
  unavailable: false,
11980
- ...EMPTY_PROBE
11992
+ ...EMPTY_PROBE,
11993
+ // The site's own format, resolved the one way the write path
11994
+ // resolves it -- a row added to INSTALL_TARGETS is picked up here
11995
+ // without touching this file.
11996
+ syntax: syntaxNameFor(site.format)
11981
11997
  },
11982
- read: exists2 ? {
11983
- path: resolved.absolute,
11984
- containerPath: resolved.containerPath,
11985
- // The scope's own strictness, resolved the one way the write
11986
- // path resolves it -- claude-code's `.mcp.json` is the single
11987
- // strict site today, and a row added to INSTALL_TARGETS is
11988
- // picked up here without touching this file.
11989
- strict: effectiveConfigFormat(target.config, scope) === "json"
11990
- } : null
11998
+ read: exists2 ? { path: site.resolved.absolute, site, transform: target.entry } : null
11991
11999
  };
11992
12000
  }
11993
12001
  }
@@ -12004,8 +12012,7 @@ function probeClients(opts) {
12004
12012
  } catch (err) {
12005
12013
  Object.assign(result, unreadableProbe(err));
12006
12014
  }
12007
- if (raw !== null)
12008
- Object.assign(result, classifyProbeContent(raw, read.containerPath, read.strict, existsSync6, platform));
12015
+ if (raw !== null) Object.assign(result, classifyProbe(raw, read, existsSync6, platform));
12009
12016
  }
12010
12017
  out.push(result);
12011
12018
  }
@@ -12047,8 +12054,96 @@ function oamRunEntryFromTokens(tokens) {
12047
12054
  if (sub < 0 || tokens[sub] !== "run") return null;
12048
12055
  return tokens.slice(sub + 1).find((t) => !t.startsWith("-")) ?? null;
12049
12056
  }
12050
- function classifyProbeContent(raw, containerPath, strict, exists2 = existsSync6, platform = process.platform) {
12057
+ var JSON_PROBE_FORMATS = /* @__PURE__ */ new Set(["json", "jsonc"]);
12058
+ function classifyProbe(raw, read, exists2, platform) {
12059
+ return JSON_PROBE_FORMATS.has(read.site.format) ? classifyProbeContent(raw, read.site.resolved.containerPath, read.site.format === "json", exists2, platform) : classifyProbeViaAdapter(raw, read.site, read.transform, exists2, platform);
12060
+ }
12061
+ function classifyProbeViaAdapter(raw, site, transform, exists2, platform) {
12062
+ const view = classifyClientConfig(raw, site, { transform });
12063
+ const read = view.read;
12064
+ const violation = view.unloadable();
12065
+ const unloadable = violation ? unloadableConfigProblem(violation) : null;
12066
+ switch (read.kind) {
12067
+ case "absent":
12068
+ return { ...EMPTY_PROBE };
12069
+ case "unreadable":
12070
+ return { ...EMPTY_PROBE, unreadable: read.message, unreadableCode: read.code };
12071
+ case "malformed":
12072
+ return { ...MALFORMED };
12073
+ case "blocked":
12074
+ return read.reparable ? { ...EMPTY_PROBE, unloadable } : { ...EMPTY_PROBE, unloadable, containerBlocked: `"${read.path.join(".")}" is ${read.shape}` };
12075
+ case "unspliceable":
12076
+ return {
12077
+ ...EMPTY_PROBE,
12078
+ hasMcpEntry: read.key === ENTRY_NAME,
12079
+ entryUnspliceable: {
12080
+ reason: read.reason,
12081
+ fix: read.fix ?? "rewrite it by hand as a table of its own (or delete it)"
12082
+ }
12083
+ };
12084
+ case "ok": {
12085
+ if (!read.containerPresent) return { ...EMPTY_PROBE, unloadable };
12086
+ const entry = view.entry();
12087
+ const legacy = view.legacyKey();
12088
+ const base = {
12089
+ ...EMPTY_PROBE,
12090
+ hasMcpEntry: entry !== void 0,
12091
+ containerEntries: view.count(),
12092
+ hasLegacyEntry: legacy !== null,
12093
+ legacyEntryName: legacy,
12094
+ unloadable,
12095
+ // Only meaningful with no entry: the adapter reports an entry INSIDE
12096
+ // such a container as unspliceable, so this and hasMcpEntry are never
12097
+ // both set.
12098
+ containerUnspliceable: read.containerUnspliceable ?? null
12099
+ };
12100
+ if (entry === void 0) return base;
12101
+ try {
12102
+ return { ...base, ...launchChecks(entry.value, exists2, platform) };
12103
+ } catch (e) {
12104
+ return { ...base, unreadable: `launch check failed: ${e.message}`, unreadableCode: null };
12105
+ }
12106
+ }
12107
+ default: {
12108
+ const _exhaustive = read;
12109
+ return _exhaustive;
12110
+ }
12111
+ }
12112
+ }
12113
+ function launchChecks(entry, exists2, platform) {
12051
12114
  const isAbsolute2 = platform === "win32" ? win32.isAbsolute : posix.isAbsolute;
12115
+ let launchCommandMissing = null;
12116
+ let launchRuntime = null;
12117
+ let launchOamNotAbsolute = null;
12118
+ let launchOamEntryMissing = null;
12119
+ let launchForeignPath = null;
12120
+ if (typeof entry === "object" && entry !== null && !Array.isArray(entry)) {
12121
+ const command = entry.command;
12122
+ if (typeof command === "string") {
12123
+ const entryArgs = entry.args;
12124
+ const args = Array.isArray(entryArgs) ? entryArgs.filter((a) => typeof a === "string") : [];
12125
+ launchRuntime = isOamLaunch(command, args) ? "oam" : "node";
12126
+ if (isForeignAbsoluteLaunch(command, platform)) {
12127
+ launchForeignPath = command;
12128
+ } else {
12129
+ if (isAbsolute2(command) && !exists2(command)) launchCommandMissing = command;
12130
+ if (launchRuntime === "oam") {
12131
+ const oamArgv = oamArgvTokens(command, args);
12132
+ if (oamArgv !== null) {
12133
+ if (isForeignAbsoluteLaunch(oamArgv.oam, platform)) launchForeignPath = oamArgv.oam;
12134
+ else if (!isAbsolute2(oamArgv.oam)) launchOamNotAbsolute = oamArgv.oam;
12135
+ const entryPath = oamRunEntryFromTokens(oamArgv.rest);
12136
+ if (entryPath !== null && isAbsolute2(entryPath) && !exists2(entryPath)) {
12137
+ launchOamEntryMissing = entryPath;
12138
+ }
12139
+ }
12140
+ }
12141
+ }
12142
+ }
12143
+ }
12144
+ return { launchCommandMissing, launchRuntime, launchOamNotAbsolute, launchOamEntryMissing, launchForeignPath };
12145
+ }
12146
+ function classifyProbeContent(raw, containerPath, strict, exists2 = existsSync6, platform = process.platform) {
12052
12147
  if (raw.trim().length === 0) {
12053
12148
  return { ...EMPTY_PROBE };
12054
12149
  }
@@ -12089,36 +12184,7 @@ function classifyProbeContent(raw, containerPath, strict, exists2 = existsSync6,
12089
12184
  return { ...EMPTY_PROBE, unloadable };
12090
12185
  }
12091
12186
  const legacyEntryName = findLegacyEntry(container);
12092
- const entry = container[ENTRY_NAME];
12093
- let launchCommandMissing = null;
12094
- let launchRuntime = null;
12095
- let launchOamNotAbsolute = null;
12096
- let launchOamEntryMissing = null;
12097
- let launchForeignPath = null;
12098
- if (typeof entry === "object" && entry !== null && !Array.isArray(entry)) {
12099
- const command = entry.command;
12100
- if (typeof command === "string") {
12101
- const entryArgs = entry.args;
12102
- const args = Array.isArray(entryArgs) ? entryArgs.filter((a) => typeof a === "string") : [];
12103
- launchRuntime = isOamLaunch(command, args) ? "oam" : "node";
12104
- if (isForeignAbsoluteLaunch(command, platform)) {
12105
- launchForeignPath = command;
12106
- } else {
12107
- if (isAbsolute2(command) && !exists2(command)) launchCommandMissing = command;
12108
- if (launchRuntime === "oam") {
12109
- const oamArgv = oamArgvTokens(command, args);
12110
- if (oamArgv !== null) {
12111
- if (isForeignAbsoluteLaunch(oamArgv.oam, platform)) launchForeignPath = oamArgv.oam;
12112
- else if (!isAbsolute2(oamArgv.oam)) launchOamNotAbsolute = oamArgv.oam;
12113
- const entryPath = oamRunEntryFromTokens(oamArgv.rest);
12114
- if (entryPath !== null && isAbsolute2(entryPath) && !exists2(entryPath)) {
12115
- launchOamEntryMissing = entryPath;
12116
- }
12117
- }
12118
- }
12119
- }
12120
- }
12121
- }
12187
+ const { launchCommandMissing, launchRuntime, launchOamNotAbsolute, launchOamEntryMissing, launchForeignPath } = launchChecks(container[ENTRY_NAME], exists2, platform);
12122
12188
  return {
12123
12189
  hasMcpEntry: ENTRY_NAME in container,
12124
12190
  containerEntries: Object.keys(container).length,
@@ -12137,7 +12203,10 @@ function classifyProbeContent(raw, containerPath, strict, exists2 = existsSync6,
12137
12203
  // Only when something is actually wired there: a bare sibling container
12138
12204
  // is not news, and naming it would send the user after a key that holds
12139
12205
  // nothing.
12140
- entryProjectKey: ENTRY_NAME in container || legacyEntryName !== null ? entryProjectKey : null
12206
+ entryProjectKey: ENTRY_NAME in container || legacyEntryName !== null ? entryProjectKey : null,
12207
+ // A JSON object key is always spliceable, and so is a JSON container.
12208
+ entryUnspliceable: null,
12209
+ containerUnspliceable: null
12141
12210
  };
12142
12211
  } catch {
12143
12212
  return { ...MALFORMED };
@@ -12154,8 +12223,7 @@ async function probeClientsAsync(opts) {
12154
12223
  } catch (err) {
12155
12224
  Object.assign(result, unreadableProbe(err));
12156
12225
  }
12157
- if (raw !== null)
12158
- Object.assign(result, classifyProbeContent(raw, read.containerPath, read.strict, existsSync6, platform));
12226
+ if (raw !== null) Object.assign(result, classifyProbe(raw, read, existsSync6, platform));
12159
12227
  }
12160
12228
  out.push(result);
12161
12229
  }
@@ -13093,17 +13161,18 @@ async function readContainer(ref) {
13093
13161
  state: "refused",
13094
13162
  clause: read.reason === "root" ? `${where} is not a ${read.syntax} object` : `${where} is not valid ${read.syntax}`,
13095
13163
  installSays: `refuses to overwrite ${where}`,
13096
- fix: unparseableConfigFix
13164
+ fix: (then) => unparseableConfigFix(then, read.syntax)
13097
13165
  };
13098
13166
  }
13099
13167
  if (read.kind === "blocked") {
13100
13168
  if (!read.reparable) {
13101
13169
  const keyPath = `"${read.path.join(".")}" in ${where}`;
13170
+ const syntax = view.adapter.syntax;
13102
13171
  return {
13103
13172
  state: "refused",
13104
- clause: `${keyPath} is ${read.shape}, not a JSON object`,
13173
+ clause: `${keyPath} is ${read.shape}, not ${containerNounFor(syntax)}`,
13105
13174
  installSays: `refuses to overwrite ${keyPath}`,
13106
- fix: blockedContainerFix
13175
+ fix: (then) => blockedContainerFix(then, syntax)
13107
13176
  };
13108
13177
  }
13109
13178
  return { state: "none" };
@@ -17659,7 +17728,7 @@ var ConnectServer = class _ConnectServer {
17659
17728
  static SHUTDOWN_DRAIN_MS = 2e3;
17660
17729
  constructor() {
17661
17730
  this.server = new Server(
17662
- { name: "yaw-mcp", version: true ? "1.0.3" : "dev" },
17731
+ { name: "yaw-mcp", version: true ? "1.0.5" : "dev" },
17663
17732
  {
17664
17733
  capabilities: {
17665
17734
  tools: { listChanged: true },
@@ -21062,7 +21131,7 @@ function registerShutdownTriggers(shutdown, targets) {
21062
21131
  // src/status-cmd.ts
21063
21132
  import { existsSync as existsSync10 } from "fs";
21064
21133
  import { homedir as homedir23 } from "os";
21065
- var VERSION2 = true ? "1.0.3" : "dev";
21134
+ var VERSION2 = true ? "1.0.5" : "dev";
21066
21135
  var STATUS_SCHEMA_VERSION = 1;
21067
21136
  var STATUS_USAGE = `Usage: yaw-mcp status [--json]
21068
21137
 
@@ -21814,7 +21883,7 @@ if (subcommand === "compliance") {
21814
21883
  `);
21815
21884
  process.exitCode = 0;
21816
21885
  } else if (subcommand === "--version" || subcommand === "-V") {
21817
- process.stdout.write(`yaw-mcp ${true ? "1.0.3" : "dev"}
21886
+ process.stdout.write(`yaw-mcp ${true ? "1.0.5" : "dev"}
21818
21887
  `);
21819
21888
  process.exitCode = 0;
21820
21889
  } else if (subcommand !== void 0 && !subcommand.startsWith("-")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yawlabs/mcp",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "mcpName": "io.github.YawLabs/mcp",
5
5
  "description": "MCP gateway and orchestrator: one local install fronts every MCP server for Claude Code, Cursor, and VS Code, loading tools on demand.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",