@yawlabs/mcp 1.0.15 → 1.0.17

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/dist/index.js CHANGED
@@ -3,7 +3,9 @@ import {
3
3
  ALLOW_UNOWNED_ENV,
4
4
  BINARY_RETIRED_HINT,
5
5
  CLAUDE_CODE_ALLOW_PATTERN,
6
+ CLIENT_ENV_VARS,
6
7
  CONFIG_DIRNAME,
8
+ CONFIG_FORMATS,
7
9
  CURRENT_OS,
8
10
  ENTRY_NAME,
9
11
  INSTALL_TARGETS,
@@ -29,6 +31,7 @@ import {
29
31
  containerKeysAt,
30
32
  containerNounFor,
31
33
  createStreamWriter,
34
+ decodeClientConfigBytes,
32
35
  describeJsonShape,
33
36
  describeValueShape,
34
37
  detectInstallMethod,
@@ -40,6 +43,7 @@ import {
40
43
  findLegacyEntry,
41
44
  findProjectConfigDir,
42
45
  guidePath,
46
+ hasConfigAdapter,
43
47
  importViewOf,
44
48
  isFeatureDisabled,
45
49
  isInternalSecretEnvKey,
@@ -65,8 +69,10 @@ import {
65
69
  packageName,
66
70
  parseJsonc,
67
71
  parseUpgradeArgs,
72
+ planRootDefaults,
68
73
  powershellPayload,
69
74
  prepareClaudeCodeSettingsPatch,
75
+ previewRootDefaults,
70
76
  probeOam,
71
77
  quoteArgForDisplay,
72
78
  readClientConfigFile,
@@ -101,7 +107,7 @@ import {
101
107
  unparseableConfigFix,
102
108
  userConfigDir,
103
109
  yawModeOverlay
104
- } from "./chunk-RCDMJJCW.js";
110
+ } from "./chunk-Z66T6Z6Z.js";
105
111
 
106
112
  // src/audit-cmd.ts
107
113
  import { homedir as homedir6 } from "os";
@@ -3265,7 +3271,7 @@ async function connectToUpstreamOnce(config, onDisconnect, onListChanged, bridge
3265
3271
  if (downstreamCaps?.sampling) capabilities.sampling = downstreamCaps.sampling;
3266
3272
  if (downstreamCaps?.roots) capabilities.roots = {};
3267
3273
  const client = new Client(
3268
- { name: "yaw-mcp", version: true ? "1.0.15" : "dev" },
3274
+ { name: "yaw-mcp", version: true ? "1.0.17" : "dev" },
3269
3275
  { capabilities }
3270
3276
  );
3271
3277
  if (bridge && capabilities.elicitation) {
@@ -6918,14 +6924,16 @@ var SUBCOMMAND_SPEC = [
6918
6924
  },
6919
6925
  // Same client list as install/uninstall -- one INSTALL_CLIENTS constant
6920
6926
  // feeds all three, so a new client cannot appear in one and not the others.
6921
- // --remove-originals / --keep-originals are the two ways to answer the
6922
- // duplicate-run question without a prompt, which is the only way to script
6923
- // an import at all. Mirrors parseImportArgs in src/import-cmd.ts.
6927
+ // --remove-originals / --keep-originals answer the duplicate-run question
6928
+ // without a prompt, and --force answers the other one -- whether to change
6929
+ // a server bundles.json already has -- which off a TTY is refused without
6930
+ // it. A script needs both answers, so all three MUST be completable.
6931
+ // Mirrors parseImportArgs in src/import-cmd.ts.
6924
6932
  {
6925
6933
  name: "import",
6926
6934
  description: "Adopt a client's existing MCP servers into bundles.json",
6927
6935
  positional: [[...INSTALL_CLIENTS]],
6928
- flags: ["--scope", "--project-dir", "--dry-run", "--remove-originals", "--keep-originals", "--help"]
6936
+ flags: ["--scope", "--project-dir", "--dry-run", "--remove-originals", "--keep-originals", "--force", "--help"]
6929
6937
  },
6930
6938
  // --force / --yes gate the destructive removal (confirm on a TTY, refuse off
6931
6939
  // one), so they MUST be completable -- a user who cannot tab --force will not
@@ -7279,7 +7287,7 @@ ${caseBranches}
7279
7287
  import { closeSync, existsSync as existsSync6, fstatSync, openSync, readFileSync as readFileSync3, readSync } from "fs";
7280
7288
  import { readFile as readFile13 } from "fs/promises";
7281
7289
  import { homedir as homedir15 } from "os";
7282
- import { join as join14, posix, resolve as resolve7, win32 } from "path";
7290
+ import { join as join14, posix as posix2, resolve as resolve7, win32 as win322 } from "path";
7283
7291
 
7284
7292
  // src/cli-shadows.ts
7285
7293
  var EMPTY = [];
@@ -8638,6 +8646,91 @@ import { readFile as readFile11, stat as stat5 } from "fs/promises";
8638
8646
  import { homedir as homedir13 } from "os";
8639
8647
  import { dirname as dirname7, join as join12, resolve as resolve5, sep } from "path";
8640
8648
  import { createInterface as createInterface2 } from "readline/promises";
8649
+
8650
+ // src/write-failure.ts
8651
+ import { statSync as statSync3 } from "fs";
8652
+ import { posix, win32 } from "path";
8653
+ function describeWriteFailure(file, err, options = {}) {
8654
+ const disk = diskOf(options);
8655
+ const errno = typeof err === "object" && err !== null ? err : {};
8656
+ const code = typeof errno.code === "string" ? errno.code : void 0;
8657
+ const syscall = typeof errno.syscall === "string" ? errno.syscall : void 0;
8658
+ const errPath = typeof errno.path === "string" ? errno.path : void 0;
8659
+ const message = err instanceof Error ? err.message : String(err);
8660
+ const head = `failed to write ${file}`;
8661
+ if (code === "EEXIST" && syscall === "mkdir" || code === "ENOTDIR") {
8662
+ const inTheWay = describeFileInTheWay(file, options);
8663
+ if (inTheWay !== null) return `${head}: ${inTheWay}`;
8664
+ }
8665
+ if (code === "EPERM" || code === "EACCES" || code === "EBUSY") {
8666
+ const target = code === "EBUSY" ? null : disk.stat(file);
8667
+ if (target !== null && !target.directory && target.readOnly && (disk.win || errPath === file)) {
8668
+ const clear = disk.win ? `clear its read-only attribute (\`attrib -R "${file}"\`)` : `make it writable (\`chmod u+w "${file}"\`)`;
8669
+ return `${head}: it is read-only -- ${clear}, then re-run`;
8670
+ }
8671
+ const creatingSibling = syscall === "open" && errPath !== void 0 && errPath !== file;
8672
+ if (code !== "EBUSY" && (creatingSibling || !disk.win && syscall === "rename")) {
8673
+ return `${head}: your account may not create or replace files in ${disk.paths.dirname(file)} (${code}) -- fix that directory's permissions, then re-run`;
8674
+ }
8675
+ if (disk.win && (syscall === "rename" || errPath === file)) {
8676
+ return `${head}: another program may be holding it open, or your account may not replace it (${code}) -- close whatever has it open (an editor, a sync client, a virus scanner) or fix its permissions, then re-run`;
8677
+ }
8678
+ }
8679
+ const env = options.env;
8680
+ if (env !== void 0 && syscall === "mkdir" && errPath !== void 0 && disk.atOrAbove(errPath, env.value)) {
8681
+ return `${head}: ${message} -- ${env.name} is set to ${env.value}; check that it names a directory that can be created, then re-run`;
8682
+ }
8683
+ return `${head}: ${message}`;
8684
+ }
8685
+ function describeFileInTheWay(file, options = {}) {
8686
+ const disk = diskOf(options);
8687
+ let blocker = null;
8688
+ let cursor = disk.paths.dirname(file);
8689
+ while (true) {
8690
+ const state = disk.stat(cursor);
8691
+ if (state !== null) {
8692
+ blocker = state.directory ? null : cursor;
8693
+ break;
8694
+ }
8695
+ const parent = disk.paths.dirname(cursor);
8696
+ if (parent === cursor) break;
8697
+ cursor = parent;
8698
+ }
8699
+ if (blocker === null) return null;
8700
+ const env = options.env;
8701
+ if (env !== void 0 && disk.atOrAbove(blocker, env.value)) {
8702
+ return `${blocker} is a file, not a directory, and ${env.name} (set to ${env.value}) puts ${disk.paths.basename(file)} under it -- point ${env.name} at a directory, then re-run`;
8703
+ }
8704
+ return `${blocker} is a file, not a directory -- move or rename it, then re-run`;
8705
+ }
8706
+ function diskOf(options) {
8707
+ const win = (options.platform ?? process.platform) === "win32";
8708
+ const paths = win ? win32 : posix;
8709
+ const fold = (p) => {
8710
+ const resolved = paths.resolve(p);
8711
+ return win ? resolved.toLowerCase() : resolved;
8712
+ };
8713
+ return {
8714
+ win,
8715
+ paths,
8716
+ stat: options.statPath ?? statOnDisk,
8717
+ atOrAbove: (a, b) => {
8718
+ const top = fold(a);
8719
+ const under = fold(b);
8720
+ return under === top || under.startsWith(top.endsWith(paths.sep) ? top : `${top}${paths.sep}`);
8721
+ }
8722
+ };
8723
+ }
8724
+ function statOnDisk(path5) {
8725
+ try {
8726
+ const st = statSync3(path5);
8727
+ return { directory: st.isDirectory(), readOnly: (st.mode & 128) === 0 };
8728
+ } catch {
8729
+ return null;
8730
+ }
8731
+ }
8732
+
8733
+ // src/install-cmd.ts
8641
8734
  function oamAbsentNote(os, publishesBinary = oamPublishesBinaryForThisMachine) {
8642
8735
  const head = "Runtime: node (oam is not installed, which is fine -- node is the supported default. ";
8643
8736
  if (os === CURRENT_OS && !publishesBinary()) {
@@ -8660,6 +8753,29 @@ function describeContainer(file, containerPath) {
8660
8753
  const tail = containerPath.slice(2).map((k) => `.${k}`).join("");
8661
8754
  return `${file} under ${containerPath[0]}[${JSON.stringify(containerPath[1])}]${tail}`;
8662
8755
  }
8756
+ function spellRootDefault(rootDefault) {
8757
+ return `${rootDefault.key} = ${JSON.stringify(rootDefault.value)}`;
8758
+ }
8759
+ function spellRootValue(value, syntax) {
8760
+ if (typeof value === "string") return JSON.stringify(value);
8761
+ if (typeof value === "number" || typeof value === "bigint" || typeof value === "boolean") return String(value);
8762
+ if (value instanceof Date) return value.toISOString();
8763
+ return Array.isArray(value) ? describeValueShape(value) : containerNounFor(syntax);
8764
+ }
8765
+ var KEPT_ROOT_VALUE_STEP = "Edit that value by hand to change it.";
8766
+ function rootLinePlacement(syntax) {
8767
+ return syntax === "TOML" ? "above the first table in the file" : "at the top level of the file";
8768
+ }
8769
+ function keptRootShapeStep(syntax) {
8770
+ return `To change it, delete it by hand and set the key on one line ${rootLinePlacement(syntax)}.`;
8771
+ }
8772
+ function keptRootStep(value, syntax) {
8773
+ const scalar = typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean" || value instanceof Date;
8774
+ return scalar ? KEPT_ROOT_VALUE_STEP : keptRootShapeStep(syntax);
8775
+ }
8776
+ function unspliceableFix(read) {
8777
+ return read.fix ?? "rewrite it by hand as a table of its own (or delete it)";
8778
+ }
8663
8779
  function logInstallTail(log2, err, direct, bundles) {
8664
8780
  const n = direct.names.length;
8665
8781
  if (n > 0) {
@@ -8688,6 +8804,23 @@ function logInstallTail(log2, err, direct, bundles) {
8688
8804
  function resolveAppData(opts) {
8689
8805
  return resolveAppDataDir({ appData: opts.appData, home: opts.home });
8690
8806
  }
8807
+ function rootDefaultsForUsage() {
8808
+ return INSTALL_TARGETS.filter((t) => (t.config.rootDefaults?.length ?? 0) > 0).map(
8809
+ (t) => `${t.label}: ${(t.config.rootDefaults ?? []).map(spellRootDefault).join(", ")}`
8810
+ );
8811
+ }
8812
+ function rerunUsage() {
8813
+ const defaults = rootDefaultsForUsage();
8814
+ if (defaults.length === 0) {
8815
+ return " Re-running install over an entry that already matches is a no-op (exit 0, no prompt).\n";
8816
+ }
8817
+ return " Re-running install over an entry that already matches is a no-op (exit 0, no\n prompt) -- unless the file lacks a top-level setting its client needs:\n" + defaults.map((d) => ` ${d}
8818
+ `).join("") + " The re-run then adds that setting (--dry-run previews it). It is add-only:\n a value you set is left alone, and install says so.\n";
8819
+ }
8820
+ function refusalUsage() {
8821
+ const setting = rootDefaultsForUsage().length > 0 ? " one that sets a top-level setting above to a value no release of its client\n loads (an integer outside the range a TOML integer holds). The message\n says what to change by hand.\n" : " one that its client cannot load. The message says what to change by hand.\n";
8822
+ return " A file install will not write into exits 1 with nothing written, under\n --dry-run and --skip too: one that does not parse, for example, or\n" + setting;
8823
+ }
8691
8824
  var USAGE = (
8692
8825
  // DERIVED, never a hand-kept list: `parseInstallArgs` validates against
8693
8826
  // `clientChoices("install")`, so a literal synopsis is a promise the parser
@@ -8699,15 +8832,21 @@ var USAGE = (
8699
8832
  yaw-mcp install --list (detect clients; no writes)
8700
8833
  yaw-mcp install --all (install into every client yaw-mcp supports on this OS)
8701
8834
 
8702
- Re-running install over an entry that already matches is a no-op (exit 0, no prompt).
8703
- Undo it with \`yaw-mcp uninstall <client>\`.
8835
+ ` + rerunUsage() + // Uninstall takes entries out and never a top-level key (see
8836
+ // keptRootDefaultLines), so "undo" has to say what it leaves.
8837
+ ` Undo it with \`yaw-mcp uninstall <client>\`${rootDefaultsForUsage().length > 0 ? ", which leaves such a setting in place" : ""}.
8704
8838
 
8705
- When a different \`` + ENTRY_NAME + "` entry is already in the config, install asks on a TTY\n and refuses without one, showing what differs (exit 2; a real failure, such\n as a malformed config, exits 1). Under --all the run exits 2 when every\n client that did not succeed was refused this way, and 1 if any one failed.\n Answer up front with:\n --force Overwrite whatever is there, env included: the new entry keeps\n none of the old entry's env, and install names each key it drops.\n --repair Replace an entry that has DRIFTED from what install writes,\n keeping the old entry's string-valued env; a no-op when it\n already matches, so a fixup script can run it unconditionally.\n --skip Leave the existing entry untouched and exit 0.\n --dry-run Print the entry (and any permissions patch) that WOULD be\n written, and exit 0 without touching a file.\n\n Deprecated (accepted, ignored, warns): --token <mcp_pat_...>, --no-yaw-mcp-config.\n yaw-mcp is local-only -- it stores no token and never writes ~/.yaw-mcp/config.json.\n Configure servers in ~/.yaw-mcp/bundles.json (see `yaw-mcp add <slug>`)."
8839
+ When a different \`` + ENTRY_NAME + "` entry is already in the config, install asks on a TTY\n and refuses without one, showing what differs (exit 2; a real failure, such\n as a malformed config, exits 1). Under --all the run exits 2 when every\n client that did not succeed was refused this way, and 1 if any one failed.\n Answer up front with:\n --force Overwrite whatever is there, env included: the new entry keeps\n none of the old entry's env, and install names each key it drops.\n --repair Replace an entry that has DRIFTED from what install writes,\n keeping the old entry's string-valued env; over one that\n already matches it does what a re-run does (above), so a\n fixup script can run it unconditionally.\n --skip Leave the existing entry, and the rest of the file, untouched\n and exit 0.\n --dry-run Print what WOULD be written -- the entry, a top-level setting\n it adds, any permissions patch -- and exit 0 without touching\n a file.\n\n" + refusalUsage() + "\n Deprecated (accepted, ignored, warns): --token <mcp_pat_...>, --no-yaw-mcp-config.\n yaw-mcp is local-only -- it stores no token and never writes ~/.yaw-mcp/config.json.\n Configure servers in ~/.yaw-mcp/bundles.json (see `yaw-mcp add <slug>`)."
8706
8840
  );
8707
- function describeUnreadableConfig(cmd, path5, err) {
8708
- if (err.code === "EISDIR") {
8841
+ function describeUnreadableConfig(cmd, path5, err, env) {
8842
+ const code = err.code;
8843
+ if (code === "EISDIR") {
8709
8844
  return `yaw-mcp ${cmd}: ${path5} is a directory, not a file -- move or remove it, then re-run.`;
8710
8845
  }
8846
+ if (code === "ENOTDIR") {
8847
+ const inTheWay = describeFileInTheWay(path5, { env });
8848
+ if (inTheWay !== null) return `yaw-mcp ${cmd}: cannot read ${path5}: ${inTheWay}.`;
8849
+ }
8711
8850
  return `yaw-mcp ${cmd}: cannot read ${path5}: ${err.message}`;
8712
8851
  }
8713
8852
  function clientUnavailableMessage(cmd, target, os, genericFix) {
@@ -8851,6 +8990,8 @@ ${USAGE}`);
8851
8990
  const { target, os, scope, projectDir, resolved } = plan;
8852
8991
  log2(`Target: ${target.label} (${scope})`);
8853
8992
  log2(`File: ${resolved.absolute}`);
8993
+ const rowArgs = rowResolveArgs(opts, os, projectDir);
8994
+ const home = rowArgs.home;
8854
8995
  const containerPath = resolved.containerPath;
8855
8996
  const selectedSites = selectSites(plan.sites);
8856
8997
  const site = selectedSites[0];
@@ -8860,7 +9001,14 @@ ${USAGE}`);
8860
9001
  const view = await readClientConfigFile(site, { transform: target.entry });
8861
9002
  const read = view.read;
8862
9003
  if (read.kind === "unreadable") {
8863
- err(describeUnreadableConfig("install", resolved.absolute, { code: read.code, message: read.message }));
9004
+ err(
9005
+ describeUnreadableConfig(
9006
+ "install",
9007
+ resolved.absolute,
9008
+ { code: read.code, message: read.message },
9009
+ locationEnvHint(target, scope, rowArgs, resolved.absolute)
9010
+ )
9011
+ );
8864
9012
  return { written: [], wouldWrite: [], messages, exitCode: 1 };
8865
9013
  }
8866
9014
  if (read.kind === "malformed") {
@@ -8876,6 +9024,20 @@ ${USAGE}`);
8876
9024
  );
8877
9025
  return { written: [], wouldWrite: [], messages, exitCode: 1 };
8878
9026
  }
9027
+ if (read.kind === "unspliceable") {
9028
+ err(
9029
+ `yaw-mcp install: the "${read.key}" entry in ${resolved.absolute} is ${read.reason}, which install will not edit -- refusing to overwrite it; ${unspliceableFix(read)}, then re-run.`
9030
+ );
9031
+ return { written: [], wouldWrite: [], messages, exitCode: 1 };
9032
+ }
9033
+ const rootPlan = planRootDefaults(view, target.config.rootDefaults);
9034
+ for (const { rootDefault, value, float, refused } of rootPlan.kept) {
9035
+ if (refused?.everyRelease === void 0) continue;
9036
+ err(
9037
+ `yaw-mcp install: ${resolved.absolute} sets ${rootDefault.key} to ${float ?? spellRootValue(value, view.adapter.syntax)}, ${refused.everyRelease}, so ${target.label} will not load the file -- refusing to write into it; change that value by hand to ${refused.needs} (${JSON.stringify(rootDefault.value)} is recommended), then re-run.`
9038
+ );
9039
+ return { written: [], wouldWrite: [], messages, exitCode: 1 };
9040
+ }
8879
9041
  const variantPaths = claudeCodeContainerPathVariants(
8880
9042
  containerPath,
8881
9043
  (prefix) => containerKeysAt(view.raw, site, prefix)
@@ -8969,15 +9131,6 @@ ${USAGE}`);
8969
9131
  runtimeLines.push(`Kept existing env on the ${ENTRY_NAME} entry: ${keys}`);
8970
9132
  }
8971
9133
  }
8972
- const home = opts.home ?? homedir13();
8973
- const rowArgs = {
8974
- os,
8975
- home,
8976
- appData: resolveAppDataDir({ appData: opts.appData, home: opts.home }),
8977
- projectDir,
8978
- claudeConfigDir: opts.claudeConfigDir,
8979
- clientEnv: opts.clientEnv
8980
- };
8981
9134
  if (launchesViaNpx(entryToWrite)) {
8982
9135
  const shadowed = await shadowedLocalLaunch(target, scope, rowArgs);
8983
9136
  if (shadowed !== null) {
@@ -9039,9 +9192,25 @@ ${differs}
9039
9192
  } else {
9040
9193
  for (const line of runtimeLines) log2(line);
9041
9194
  }
9195
+ const rootSets = rootPlan.set;
9196
+ for (const { rootDefault, value, float, refused } of rootPlan.kept) {
9197
+ const spelled = float ?? spellRootValue(value, view.adapter.syntax);
9198
+ const recommended = JSON.stringify(rootDefault.value);
9199
+ const step = keptRootStep(value, view.adapter.syntax);
9200
+ if (refused !== void 0) {
9201
+ const kind = refused.kind === void 0 ? "" : `${refused.kind} `;
9202
+ err(
9203
+ `yaw-mcp install: warning -- ${resolved.absolute} already sets ${rootDefault.key} to ${spelled}, ${kind}where ${target.label} needs ${refused.needs}, and install leaves a value you set alone. A ${target.label} release that reads the key will not load the file with that value; ${recommended} is recommended. ${step}`
9204
+ );
9205
+ } else {
9206
+ log2(
9207
+ `Note: ${resolved.absolute} already sets ${rootDefault.key} to ${spelled}, and install leaves a value you set alone. ${recommended} is recommended: ${rootDefault.why}. ${step}`
9208
+ );
9209
+ }
9210
+ }
9042
9211
  let clientJson = null;
9043
9212
  let repairedContainer = null;
9044
- if (skipEntryWrite && !trimLegacy) {
9213
+ if (skipEntryWrite && !trimLegacy && rootSets.length === 0) {
9045
9214
  clientJson = null;
9046
9215
  } else {
9047
9216
  const edits = [];
@@ -9058,12 +9227,17 @@ ${differs}
9058
9227
  }
9059
9228
  if (!skipEntryWrite) edits.push({ op: "upsert", key: ENTRY_NAME, entry: entryToWrite });
9060
9229
  if (trimLegacy) edits.push({ op: "remove", key: legacyEntry });
9230
+ for (const rootDefault of rootSets) {
9231
+ edits.push({ op: "rootDefault", key: rootDefault.key, value: rootDefault.value });
9232
+ }
9061
9233
  try {
9062
9234
  clientJson = terminateWithNewline(applyClientConfigEdits(view, edits, site));
9063
9235
  } catch (e) {
9064
- err(
9065
- skipEntryWrite ? `yaw-mcp install: failed to remove the legacy "${legacyEntry}" entry from ${resolved.absolute} (${e.message}). Refusing to overwrite.` : `yaw-mcp install: failed to splice the "${ENTRY_NAME}" entry into ${resolved.absolute} (${e.message}). Refusing to overwrite.`
9066
- );
9236
+ const settings = rootSets.map(spellRootDefault).join(" and ");
9237
+ const attempted = !skipEntryWrite ? `splice the "${ENTRY_NAME}" entry into ${resolved.absolute}` : trimLegacy && rootSets.length > 0 ? `remove the legacy "${legacyEntry}" entry from ${resolved.absolute} and set ${settings} in it` : trimLegacy ? `remove the legacy "${legacyEntry}" entry from ${resolved.absolute}` : `set ${settings} in ${resolved.absolute}`;
9238
+ const byHand = `add ${settings} ${rootLinePlacement(view.adapter.syntax)}`;
9239
+ const remedy = !skipEntryWrite || rootSets.length === 0 ? "" : trimLegacy ? ` The "${ENTRY_NAME}" entry is already correct, and the legacy "${legacyEntry}" entry is still in the file; to finish by hand, delete that entry and ${byHand}.` : ` The "${ENTRY_NAME}" entry is already correct; to finish by hand, ${byHand}.`;
9240
+ err(`yaw-mcp install: failed to ${attempted} (${e.message}). Refusing to overwrite.${remedy}`);
9067
9241
  return { written: [], wouldWrite: [], messages, exitCode: 1 };
9068
9242
  }
9069
9243
  }
@@ -9110,7 +9284,7 @@ ${differs}
9110
9284
  );
9111
9285
  if (opts.dryRun) {
9112
9286
  const extraPreview = [];
9113
- const extraWouldWrite = await applyToExtraSites({
9287
+ const extraWouldWrite = (await applyToExtraSites({
9114
9288
  cmd: "install",
9115
9289
  sites: extraSites,
9116
9290
  transform: target.entry,
@@ -9122,7 +9296,7 @@ ${differs}
9122
9296
  dryRun: true,
9123
9297
  log: (s) => extraPreview.push([log2, s]),
9124
9298
  err: (s) => extraPreview.push([err, s])
9125
- });
9299
+ })).touched;
9126
9300
  const flushExtraPreview = () => {
9127
9301
  for (const [sink, line] of extraPreview) sink(line);
9128
9302
  };
@@ -9134,16 +9308,19 @@ Nothing to do: ${target.label} (${scope}) is already configured.`);
9134
9308
  }
9135
9309
  if (repairedContainer) log2(containerRepairNote(repairedContainer, "would replace"));
9136
9310
  log2("\n--- dry run: would add the following (the rest of each file is left as-is) ---");
9137
- if (clientJson !== null && !skipEntryWrite) {
9138
- const previewEntry = envCarried && entryToWrite.env ? {
9139
- ...entryToWrite,
9140
- env: Object.fromEntries(Object.keys(entryToWrite.env).map((k) => [k, DRY_RUN_ENV_PLACEHOLDER]))
9141
- } : entryToWrite;
9142
- log2(
9143
- `
9311
+ if (clientJson !== null && (!skipEntryWrite || rootSets.length > 0)) {
9312
+ const blocks = [];
9313
+ if (rootSets.length > 0) blocks.push(previewRootDefaults(view, rootSets));
9314
+ if (!skipEntryWrite) {
9315
+ const previewEntry = envCarried && entryToWrite.env ? {
9316
+ ...entryToWrite,
9317
+ env: Object.fromEntries(Object.keys(entryToWrite.env).map((k) => [k, DRY_RUN_ENV_PLACEHOLDER]))
9318
+ } : entryToWrite;
9319
+ blocks.push(view.adapter.renderPreview(view.address, ENTRY_NAME, previewEntry, read.kind === "absent"));
9320
+ }
9321
+ log2(`
9144
9322
  # ${resolved.absolute}
9145
- ${view.adapter.renderPreview(view.address, ENTRY_NAME, previewEntry, read.kind === "absent")}`
9146
- );
9323
+ ${blocks.join("\n")}`);
9147
9324
  }
9148
9325
  for (const settingsPatch of settingsPatches) {
9149
9326
  if (settingsPatch.changed) {
@@ -9151,6 +9328,9 @@ ${view.adapter.renderPreview(view.address, ENTRY_NAME, previewEntry, read.kind =
9151
9328
  permissions.allow += ${JSON.stringify(settingsPatch.added)}`);
9152
9329
  }
9153
9330
  }
9331
+ for (const rootDefault of rootSets) {
9332
+ log2(`Would add ${spellRootDefault(rootDefault)} to ${resolved.absolute}: ${rootDefault.why}.`);
9333
+ }
9154
9334
  const freshNote2 = yawFreshPaneNote({
9155
9335
  grantPatches: settingsPatches,
9156
9336
  target,
@@ -9200,7 +9380,9 @@ permissions.allow += ${JSON.stringify(settingsPatch.added)}`);
9200
9380
  try {
9201
9381
  await atomicWriteFile(resolved.absolute, clientJson);
9202
9382
  } catch (e) {
9203
- err(`yaw-mcp install: failed to write ${resolved.absolute}: ${e.message}`);
9383
+ err(
9384
+ `yaw-mcp install: ${describeWriteFailure(resolved.absolute, e, { env: locationEnvHint(target, scope, rowArgs, resolved.absolute) })}.`
9385
+ );
9204
9386
  return { written, wouldWrite: [], messages, exitCode: 1 };
9205
9387
  }
9206
9388
  log2(`Wrote ${resolved.absolute}`);
@@ -9209,22 +9391,25 @@ permissions.allow += ${JSON.stringify(settingsPatch.added)}`);
9209
9391
  if (trimLegacy) {
9210
9392
  log2(`Removed the legacy "${legacyEntry}" entry -- it would have run yaw-mcp a second time.`);
9211
9393
  }
9394
+ for (const rootDefault of rootSets) {
9395
+ log2(`Added ${spellRootDefault(rootDefault)} to ${resolved.absolute}: ${rootDefault.why}.`);
9396
+ }
9212
9397
  }
9213
- written.push(
9214
- ...await applyToExtraSites({
9215
- cmd: "install",
9216
- sites: extraSites,
9217
- transform: target.entry,
9218
- // The BASE entry, not `entryToWrite`: each copy composes its own from
9219
- // its own carry. See applyToExtraSites.
9220
- compose: { base: newEntry, os, force: opts.force === true },
9221
- keepLegacy: opts.keepLegacy === true,
9222
- authorised: overwriteAuthorised,
9223
- dryRun: false,
9224
- log: log2,
9225
- err
9226
- })
9227
- );
9398
+ const extras = await applyToExtraSites({
9399
+ cmd: "install",
9400
+ sites: extraSites,
9401
+ transform: target.entry,
9402
+ // The BASE entry, not `entryToWrite`: each copy composes its own from
9403
+ // its own carry. See applyToExtraSites.
9404
+ compose: { base: newEntry, os, force: opts.force === true },
9405
+ keepLegacy: opts.keepLegacy === true,
9406
+ authorised: overwriteAuthorised,
9407
+ dryRun: false,
9408
+ log: log2,
9409
+ err
9410
+ });
9411
+ written.push(...extras.touched);
9412
+ const entryWritten = clientJson !== null && !skipEntryWrite || extras.entryWrites.length > 0;
9228
9413
  for (const settingsPatch of settingsPatches) {
9229
9414
  if (!settingsPatch.changed) continue;
9230
9415
  if (!sameFingerprint(settingsPatch.fingerprint, await fileFingerprint(settingsPatch.path))) {
@@ -9283,9 +9468,17 @@ Done: ${target.label} is configured. Restart it in this project and approve the
9283
9468
  // line's: a client that watches its config file must not be told to
9284
9469
  // restart, and one that needs a window reload must not be told the
9285
9470
  // editor. `reload` defaults to "restart", whose clause is what every
9286
- // pre-existing row printed, byte for byte.
9471
+ // pre-existing row printed, byte for byte. A run in which no file got
9472
+ // a new or changed entry -- its writes were a legacy trim, a top-level
9473
+ // default (Codex's startup grace) and/or a permissions.allow grant, on
9474
+ // the primary or on an editor copy -- names "the change", never a new
9475
+ // server. Any entry written anywhere keeps the server wording.
9287
9476
  `
9288
- Done: ${target.label} is configured. ${reloadDoneClause(target.reload, target.label)}`
9477
+ Done: ${target.label} is configured. ${reloadDoneClause(
9478
+ target.reload,
9479
+ target.label,
9480
+ entryWritten ? "server" : "change"
9481
+ )}`
9289
9482
  )
9290
9483
  );
9291
9484
  return { written, wouldWrite: [], messages, exitCode: 0 };
@@ -9427,6 +9620,7 @@ function describeEntryDiff(stored, nextEntry) {
9427
9620
  async function applyToExtraSites(args) {
9428
9621
  const { cmd, compose, log: log2, err } = args;
9429
9622
  const touched = [];
9623
+ const entryWrites = [];
9430
9624
  for (const site of args.sites) {
9431
9625
  const where = site.resolved.absolute;
9432
9626
  const named = `${where} (${site.label})`;
@@ -9474,11 +9668,12 @@ async function applyToExtraSites(args) {
9474
9668
  carried: compose.force ? {} : view.carried()
9475
9669
  });
9476
9670
  const stored = view.normalized();
9477
- if (hasEntry && deepEqualJson(stored, entry) && !trimLegacy) {
9671
+ const entryChanges = !hasEntry || !deepEqualJson(stored, entry);
9672
+ if (!entryChanges && !trimLegacy) {
9478
9673
  log2(`The "${ENTRY_NAME}" entry in ${named} is already correct.`);
9479
9674
  continue;
9480
9675
  }
9481
- if (hasEntry && !deepEqualJson(stored, entry) && !args.authorised) {
9676
+ if (hasEntry && entryChanges && !args.authorised) {
9482
9677
  err(
9483
9678
  `yaw-mcp ${cmd}: warning -- ${named} already has a differing "${ENTRY_NAME}" entry; left untouched. Re-run with --repair to bring every copy up to date, or --force to overwrite them.`
9484
9679
  );
@@ -9508,19 +9703,21 @@ async function applyToExtraSites(args) {
9508
9703
  if (args.dryRun) {
9509
9704
  log2(`Would also write the "${ENTRY_NAME}" entry to ${named}.`);
9510
9705
  touched.push(where);
9706
+ if (entryChanges) entryWrites.push(where);
9511
9707
  continue;
9512
9708
  }
9513
9709
  try {
9514
9710
  await atomicWriteFile(where, next);
9515
9711
  log2(`Wrote ${named}`);
9516
9712
  touched.push(where);
9713
+ if (entryChanges) entryWrites.push(where);
9517
9714
  } catch (e) {
9518
9715
  err(
9519
9716
  `yaw-mcp ${cmd}: warning -- failed to write ${named} (${e.message}); left unchanged. That copy of the client will not see yaw-mcp.`
9520
9717
  );
9521
9718
  }
9522
9719
  }
9523
- return touched;
9720
+ return { touched, entryWrites };
9524
9721
  }
9525
9722
  function looksLikeFlag(value) {
9526
9723
  return value.startsWith("-");
@@ -9660,7 +9857,7 @@ async function runInstallList(opts, log2, messages) {
9660
9857
  const home = opts.home ?? homedir13();
9661
9858
  const cwd = resolve5(opts.cwd ?? process.cwd(), opts.projectDir ?? ".");
9662
9859
  const os = opts.os ?? CURRENT_OS;
9663
- const probes = await probeClientsAsync({
9860
+ const where = {
9664
9861
  home,
9665
9862
  os,
9666
9863
  cwd,
@@ -9670,12 +9867,15 @@ async function runInstallList(opts, log2, messages) {
9670
9867
  // show "not installed" beside an entry sitting at the redirected path.
9671
9868
  clientEnv: opts.clientEnv,
9672
9869
  appData: resolveAppData(opts)
9673
- });
9674
- const rows = probes.map((p) => ({
9870
+ };
9871
+ const probes = await probeClientsAsync(where);
9872
+ const rootPlans = [];
9873
+ for (const p of probes) rootPlans.push(await listRootPlan(p, where));
9874
+ const rows = probes.map((p, i) => ({
9675
9875
  client: INSTALL_TARGETS.find((t) => t.clientId === p.clientId)?.label ?? p.clientId,
9676
9876
  scope: p.scope,
9677
9877
  path: displayPath(p.path, home, os),
9678
- status: statusFor(p)
9878
+ status: statusFor(p, rootPlans[i])
9679
9879
  }));
9680
9880
  const installed = probes.filter((p) => p.hasMcpEntry && p.unloadable === null).length;
9681
9881
  const available = probes.filter((p) => !p.unavailable).length;
@@ -9703,17 +9903,84 @@ async function runInstallList(opts, log2, messages) {
9703
9903
  );
9704
9904
  log2("");
9705
9905
  }
9906
+ for (const [i, p] of probes.entries()) {
9907
+ const plan = rootPlans[i];
9908
+ if (plan === null) continue;
9909
+ for (const line of listRootNotes(p, plan, { home, os, cwd, projectDirGiven: opts.projectDir !== void 0 })) {
9910
+ log2(line);
9911
+ }
9912
+ log2("");
9913
+ }
9706
9914
  log2("Install into a specific client: `yaw-mcp install <client> [--scope user|project|local]`");
9707
9915
  log2("Install into every supported client (user scope where supported): `yaw-mcp install --all`");
9708
9916
  return { written: [], wouldWrite: [], messages, exitCode: 0 };
9709
9917
  }
9710
- function statusFor(p) {
9918
+ async function listRootPlan(p, where) {
9919
+ if (p.unavailable || !p.hasMcpEntry || p.unloadable !== null) return null;
9920
+ const target = INSTALL_TARGETS.find((t) => t.clientId === p.clientId);
9921
+ const defaults = target?.config.rootDefaults;
9922
+ if (target === void 0 || defaults === void 0 || defaults.length === 0) return null;
9923
+ const spec = target.scopes.find((s) => s.scope === p.scope);
9924
+ if (spec === void 0) return null;
9925
+ let site;
9926
+ try {
9927
+ site = resolveInstallSites({
9928
+ clientId: target.clientId,
9929
+ scope: p.scope,
9930
+ os: where.os,
9931
+ home: where.home,
9932
+ appData: where.appData,
9933
+ projectDir: spec.requiresProjectDir ? where.cwd : void 0,
9934
+ claudeConfigDir: where.claudeConfigDir,
9935
+ clientEnv: where.clientEnv
9936
+ })[0];
9937
+ } catch {
9938
+ return null;
9939
+ }
9940
+ if (site.resolved.absolute !== p.path) return null;
9941
+ const plan = planRootDefaults(await readClientConfigFile(site, { transform: target.entry }), defaults);
9942
+ return plan.set.length > 0 || plan.kept.some((k) => k.refused !== void 0) ? plan : null;
9943
+ }
9944
+ function listRootNotes(p, plan, at) {
9945
+ const target = INSTALL_TARGETS.find((t) => t.clientId === p.clientId);
9946
+ const label = target?.label ?? p.clientId;
9947
+ const file = displayPath(p.path, at.home, at.os);
9948
+ const lines = [];
9949
+ for (const { rootDefault, value, float, refused } of plan.kept) {
9950
+ if (refused === void 0) continue;
9951
+ const spelled = float ?? spellRootValue(value, p.syntax);
9952
+ const recommended = JSON.stringify(rootDefault.value);
9953
+ if (refused.everyRelease !== void 0) {
9954
+ lines.push(
9955
+ `Note: ${file} sets ${rootDefault.key} to ${spelled}, ${refused.everyRelease}, so ${label} will not load the file -- change that value by hand to ${refused.needs} (${recommended} is recommended).`
9956
+ );
9957
+ continue;
9958
+ }
9959
+ const kind = refused.kind === void 0 ? "" : `${refused.kind} `;
9960
+ lines.push(
9961
+ `Note: ${file} sets ${rootDefault.key} to ${spelled}, ${kind}where ${label} needs ${refused.needs} -- a ${label} release that reads the key will not load the file with that value; ${recommended} is recommended. ${keptRootStep(value, p.syntax)}`
9962
+ );
9963
+ }
9964
+ if (plan.set.length > 0) {
9965
+ const scopeSpec = target?.scopes.find((s) => s.scope === p.scope);
9966
+ const projectFlag = at.projectDirGiven && scopeSpec?.requiresProjectDir === true ? ` --project-dir ${quoteArgForDisplay(at.cwd) ?? at.cwd}` : "";
9967
+ const run2 = `yaw-mcp install ${p.clientId}${p.scope === "user" ? "" : ` --scope ${p.scope}`}${projectFlag}`;
9968
+ for (const rootDefault of plan.set) {
9969
+ lines.push(
9970
+ `Note: ${file} has the ${label} (${p.scope}) entry but does not set ${spellRootDefault(rootDefault)}: ${rootDefault.why}. \`${run2}\` adds it.`
9971
+ );
9972
+ }
9973
+ }
9974
+ return lines;
9975
+ }
9976
+ function statusFor(p, rootPlan = null) {
9711
9977
  if (p.unavailable) return p.unavailableReason !== void 0 ? "not supported yet" : "unavailable";
9712
9978
  if (p.malformed) return "malformed";
9713
9979
  if (p.unreadable) return `unreadable: ${p.unreadable}`;
9714
9980
  if (p.unloadable) return "not loading (comments or trailing commas)";
9715
9981
  const keySuffix = p.entryProjectKey ? " (other drive case)" : "";
9716
- if (p.hasMcpEntry) return `installed${keySuffix}`;
9982
+ const rootSuffix = rootPlan === null ? "" : rootPlan.kept.some((k) => k.refused !== void 0) ? " (setting refused)" : rootPlan.set.length > 0 ? " (setting missing)" : "";
9983
+ if (p.hasMcpEntry) return `installed${keySuffix}${rootSuffix}`;
9717
9984
  if (p.hasLegacyEntry) return `legacy: ${p.legacyEntryName ?? "unknown"}${keySuffix}`;
9718
9985
  if (!p.exists) return "not installed";
9719
9986
  return p.containerEntries > 0 ? "other-entries" : "no-entries";
@@ -9973,6 +10240,39 @@ function launchesViaNpx(entry) {
9973
10240
  const launcher = (command.split(/[\\/]/).pop() ?? command).toLowerCase();
9974
10241
  return (launcher === "cmd" || launcher === "cmd.exe") && Array.isArray(args) && typeof args[0] === "string" && args[0].toLowerCase() === "/c" && typeof args[1] === "string" && nodeLaunchKind(args[1]) === "npx";
9975
10242
  }
10243
+ function rowResolveArgs(opts, os, projectDir) {
10244
+ return {
10245
+ os,
10246
+ home: opts.home ?? homedir13(),
10247
+ appData: resolveAppDataDir({ appData: opts.appData, home: opts.home }),
10248
+ projectDir,
10249
+ claudeConfigDir: opts.claudeConfigDir,
10250
+ clientEnv: opts.clientEnv
10251
+ };
10252
+ }
10253
+ function locationEnvHint(target, scope, where, file) {
10254
+ const env = where.clientEnv ?? {};
10255
+ for (const name of CLIENT_ENV_VARS) {
10256
+ const key = Object.keys(readClientEnv({ [name]: "set" }))[0];
10257
+ if (key === void 0) continue;
10258
+ const value = key === "claudeConfigDir" ? where.claudeConfigDir ?? env.claudeConfigDir : env[key];
10259
+ if (value === void 0 || value.length === 0) continue;
10260
+ let unmoved;
10261
+ try {
10262
+ unmoved = resolveInstallPath({
10263
+ clientId: target.clientId,
10264
+ scope,
10265
+ ...where,
10266
+ claudeConfigDir: key === "claudeConfigDir" ? void 0 : where.claudeConfigDir,
10267
+ clientEnv: { ...env, [key]: void 0 }
10268
+ }).absolute;
10269
+ } catch {
10270
+ continue;
10271
+ }
10272
+ if (samePathKey(unmoved) !== samePathKey(file)) return { name, value };
10273
+ }
10274
+ return void 0;
10275
+ }
9976
10276
  async function shadowedLocalLaunch(target, scope, where) {
9977
10277
  if (!target.hooks?.alsoReads) return null;
9978
10278
  let sites;
@@ -10092,7 +10392,14 @@ ${UNINSTALL_USAGE}`);
10092
10392
  const view = await readClientConfigFile(site, { transform: target.entry });
10093
10393
  const read = view.read;
10094
10394
  if (read.kind === "unreadable") {
10095
- err(describeUnreadableConfig("uninstall", resolved.absolute, { code: read.code, message: read.message }));
10395
+ err(
10396
+ describeUnreadableConfig(
10397
+ "uninstall",
10398
+ resolved.absolute,
10399
+ { code: read.code, message: read.message },
10400
+ locationEnvHint(target, scope, rowResolveArgs(opts, os, projectDir), resolved.absolute)
10401
+ )
10402
+ );
10096
10403
  return { written: [], wouldWrite: [], messages, exitCode: 1 };
10097
10404
  }
10098
10405
  if (read.kind === "malformed") {
@@ -10101,6 +10408,12 @@ ${UNINSTALL_USAGE}`);
10101
10408
  );
10102
10409
  return { written: [], wouldWrite: [], messages, exitCode: 1 };
10103
10410
  }
10411
+ if (read.kind === "unspliceable") {
10412
+ err(
10413
+ `yaw-mcp uninstall: the "${read.key}" entry in ${resolved.absolute} is ${read.reason}, which uninstall will not edit -- nothing was removed; ${unspliceableFix(read)}, then re-run.`
10414
+ );
10415
+ return { written: [], wouldWrite: [], messages, exitCode: 1 };
10416
+ }
10104
10417
  const variantPaths = claudeCodeContainerPathVariants(
10105
10418
  containerPath,
10106
10419
  (prefix) => containerKeysAt(view.raw, site, prefix)
@@ -10141,14 +10454,7 @@ ${UNINSTALL_USAGE}`);
10141
10454
  `yaw-mcp uninstall: warning -- could not patch ${settingsPatch.path} (${settingsPatch.malformedReason}); left unchanged. Remove "${CLAUDE_CODE_ALLOW_PATTERN}" from permissions.allow by hand.`
10142
10455
  );
10143
10456
  }
10144
- const rowArgs = {
10145
- os,
10146
- home,
10147
- appData: resolveAppDataDir({ appData: opts.appData, home: opts.home }),
10148
- projectDir,
10149
- claudeConfigDir: opts.claudeConfigDir,
10150
- clientEnv: opts.clientEnv
10151
- };
10457
+ const rowArgs = rowResolveArgs(opts, os, projectDir);
10152
10458
  const primaryPatch = grant.patches.find((p) => !p.yawHome) ?? null;
10153
10459
  const scopedGrantNote = grant.overlay !== null || primaryPatch === null ? null : configDirScopedGrantNote({
10154
10460
  cmd: "uninstall",
@@ -10208,7 +10514,7 @@ ${UNINSTALL_USAGE}`);
10208
10514
  }
10209
10515
  if (scopedGrantNote !== null) log2(scopedGrantNote);
10210
10516
  const extraPreview = [];
10211
- const extraWouldRemove = await applyToExtraSites({
10517
+ const extraWouldRemove = (await applyToExtraSites({
10212
10518
  cmd: "uninstall",
10213
10519
  sites: extraSites,
10214
10520
  transform: target.entry,
@@ -10218,7 +10524,7 @@ ${UNINSTALL_USAGE}`);
10218
10524
  dryRun: true,
10219
10525
  log: (line) => extraPreview.push({ stream: "log", line }),
10220
10526
  err: (line) => extraPreview.push({ stream: "err", line })
10221
- });
10527
+ })).touched;
10222
10528
  const flushExtraPreview = (warnings) => {
10223
10529
  for (const { stream, line } of extraPreview) {
10224
10530
  if (stream === "err" && !warnings) continue;
@@ -10254,6 +10560,9 @@ Nothing to do: ${target.label} (${scope}) has no yaw-mcp entry.`
10254
10560
  log2(`
10255
10561
  --- dry run: would remove the following (the rest of each file is left as-is) ---`);
10256
10562
  for (const line of preview) log2(` ${line}`);
10563
+ if (removals.length > 0) {
10564
+ for (const line of keptRootDefaultLines(target, view, resolved.absolute, "dry-run")) log2(line);
10565
+ }
10257
10566
  flushExtraPreview(true);
10258
10567
  const wouldWrite = [];
10259
10568
  if (removals.length > 0) wouldWrite.push(resolved.absolute);
@@ -10322,7 +10631,9 @@ Nothing to do: ${target.label} (${scope}) has no yaw-mcp entry.`
10322
10631
  try {
10323
10632
  await atomicWriteFile(resolved.absolute, clientJson);
10324
10633
  } catch (e) {
10325
- err(`yaw-mcp uninstall: failed to write ${resolved.absolute}: ${e.message}`);
10634
+ err(
10635
+ `yaw-mcp uninstall: ${describeWriteFailure(resolved.absolute, e, { env: locationEnvHint(target, scope, rowArgs, resolved.absolute) })}.`
10636
+ );
10326
10637
  return { written, wouldWrite: [], messages, exitCode: 1 };
10327
10638
  }
10328
10639
  log2(`Wrote ${resolved.absolute}`);
@@ -10331,9 +10642,11 @@ Nothing to do: ${target.label} (${scope}) has no yaw-mcp entry.`
10331
10642
  if (s.hasEntry) log2(`Removed the "${ENTRY_NAME}" entry${where(s)}.`);
10332
10643
  if (trimsLegacy(s)) log2(`Removed the legacy "${s.legacyEntry}" entry${where(s)}.`);
10333
10644
  }
10645
+ const after = classifyClientConfig(clientJson, site, { transform: target.entry });
10646
+ for (const line of keptRootDefaultLines(target, after, resolved.absolute, "live")) log2(line);
10334
10647
  }
10335
10648
  written.push(
10336
- ...await applyToExtraSites({
10649
+ ...(await applyToExtraSites({
10337
10650
  cmd: "uninstall",
10338
10651
  sites: extraSites,
10339
10652
  transform: target.entry,
@@ -10343,7 +10656,7 @@ Nothing to do: ${target.label} (${scope}) has no yaw-mcp entry.`
10343
10656
  dryRun: false,
10344
10657
  log: log2,
10345
10658
  err
10346
- })
10659
+ })).touched
10347
10660
  );
10348
10661
  for (const settingsPatch of settingsPatches) {
10349
10662
  if (!settingsPatch.changed) continue;
@@ -10381,6 +10694,15 @@ function uninstallDoneLine(target, display) {
10381
10694
  return `
10382
10695
  Done: ${head} ${reloadRemovalClause(target.reload, target.label)}${note === void 0 ? "" : ` ${note}`} Your servers in ~/.yaw-mcp/bundles.json are untouched -- \`yaw-mcp install ${target.clientId}\` wires it back.`;
10383
10696
  }
10697
+ function keptRootDefaultLines(target, view, file, mode) {
10698
+ const defaults = target.config.rootDefaults;
10699
+ if (defaults === void 0 || defaults.length === 0 || view.read.kind !== "ok") return [];
10700
+ const plan = planRootDefaults(view, defaults);
10701
+ const verb = mode === "dry-run" ? "Would keep" : "Keeping";
10702
+ return defaults.filter((d) => !plan.set.includes(d) && !plan.kept.some((k) => k.rootDefault === d)).map(
10703
+ (d) => `${verb} ${d.key} at ${JSON.stringify(d.value)} in ${file}: uninstall leaves top-level settings alone -- this one is not a server, and it may be your own. Delete the line that sets it by hand if you no longer want it.`
10704
+ );
10705
+ }
10384
10706
 
10385
10707
  // src/try-cmd.ts
10386
10708
  var USAGE_INDENT = " ".repeat(23);
@@ -10566,8 +10888,14 @@ function rejectUntrustedMarker(marker) {
10566
10888
  if (typeof marker.schemaVersion === "number" && marker.schemaVersion > TRIAL_SCHEMA_VERSION) {
10567
10889
  return `was written by a newer yaw-mcp (schemaVersion ${marker.schemaVersion} > ${TRIAL_SCHEMA_VERSION})`;
10568
10890
  }
10891
+ if (marker.format !== void 0 && !isReadableFormat(marker.format)) {
10892
+ return `records a config format this yaw-mcp cannot read (${JSON.stringify(marker.format)})`;
10893
+ }
10569
10894
  return null;
10570
10895
  }
10896
+ function isReadableFormat(value) {
10897
+ return typeof value === "string" && CONFIG_FORMATS.includes(value) && hasConfigAdapter(value);
10898
+ }
10571
10899
  function trialLaunchFingerprint(entry) {
10572
10900
  const command = typeof entry.command === "string" ? entry.command : "";
10573
10901
  const args = Array.isArray(entry.args) ? entry.args.filter((a) => typeof a === "string") : [];
@@ -10589,8 +10917,9 @@ async function readTrialMarker(markerPath) {
10589
10917
  return null;
10590
10918
  }
10591
10919
  }
10592
- async function peelEntryFromConfig(clientPath, containerPath, entryName, dryRun = false, expectFingerprint) {
10593
- const site = markerSite(clientPath, containerPath);
10920
+ async function peelEntryFromConfig(marker, dryRun = false) {
10921
+ const { clientPath, entryName, entryFingerprint: expectFingerprint } = marker;
10922
+ const site = markerSite(marker);
10594
10923
  const view = await readClientConfigFile(site);
10595
10924
  const read = view.read;
10596
10925
  if (read.kind === "absent") return "absent";
@@ -10613,28 +10942,29 @@ async function peelEntryFromConfig(clientPath, containerPath, entryName, dryRun
10613
10942
  await atomicWriteFile(clientPath, terminateWithNewline(next));
10614
10943
  return "removed";
10615
10944
  }
10616
- function markerSite(clientPath, containerPath) {
10945
+ function markerFormat(marker) {
10946
+ if (marker.format !== void 0) return marker.format;
10947
+ return /\.toml$/i.test(marker.clientPath) ? "toml" : "jsonc";
10948
+ }
10949
+ function markerSite(marker) {
10617
10950
  return {
10618
10951
  id: "trial",
10619
10952
  label: "trial entry",
10620
- resolved: { absolute: clientPath, display: clientPath, containerPath: [...containerPath] },
10621
- format: "jsonc",
10953
+ resolved: { absolute: marker.clientPath, display: marker.clientPath, containerPath: [...marker.containerPath] },
10954
+ format: markerFormat(marker),
10622
10955
  detectDir: null
10623
10956
  };
10624
10957
  }
10958
+ function notAContainer(marker) {
10959
+ return `${marker.clientPath} is not ${containerNounFor(syntaxNameFor(markerFormat(marker)))}`;
10960
+ }
10625
10961
  function configHasEntry(raw, site, entryName) {
10626
10962
  return classifyClientConfig(raw, site).entry(entryName) !== void 0;
10627
10963
  }
10628
10964
  async function peelTrialEntry(marker, dryRun = false) {
10629
10965
  if (rejectUntrustedMarker(marker) !== null) return "failed";
10630
10966
  try {
10631
- const outcome = await peelEntryFromConfig(
10632
- marker.clientPath,
10633
- marker.containerPath,
10634
- marker.entryName,
10635
- dryRun,
10636
- marker.entryFingerprint
10637
- );
10967
+ const outcome = await peelEntryFromConfig(marker, dryRun);
10638
10968
  return outcome === "not-object" ? "failed" : outcome;
10639
10969
  } catch {
10640
10970
  return "failed";
@@ -10821,7 +11151,11 @@ async function runTry(opts) {
10821
11151
  // actually written -- not from `server`, so the Windows `cmd /c` wrap that
10822
11152
  // buildLaunchEntry adds is inside the fingerprint, exactly as it will be
10823
11153
  // read back out of the config.
10824
- entryFingerprint: trialLaunchFingerprint(entryToWrite)
11154
+ entryFingerprint: trialLaunchFingerprint(entryToWrite),
11155
+ // The syntax of the file the entry goes into -- the SAME site the read and
11156
+ // the splice below use -- so try-cleanup and doctor's GC read it back with
11157
+ // that adapter (see TrialMarker.format). "toml" for Codex CLI.
11158
+ format: site.format
10825
11159
  };
10826
11160
  const readClientView = async () => {
10827
11161
  const view = await readClientConfigFile(site);
@@ -11037,14 +11371,9 @@ async function runTryCleanup(opts) {
11037
11371
  }
11038
11372
  const written = [];
11039
11373
  let leftReplacedEntry = false;
11374
+ let peelFailure = null;
11040
11375
  try {
11041
- const outcome = await peelEntryFromConfig(
11042
- marker.clientPath,
11043
- marker.containerPath,
11044
- marker.entryName,
11045
- false,
11046
- marker.entryFingerprint
11047
- );
11376
+ const outcome = await peelEntryFromConfig(marker);
11048
11377
  if (outcome === "replaced") {
11049
11378
  leftReplacedEntry = true;
11050
11379
  printErr(
@@ -11055,14 +11384,19 @@ async function runTryCleanup(opts) {
11055
11384
  written.push(marker.clientPath);
11056
11385
  print(`Removed ${marker.entryName} from ${marker.clientPath}`);
11057
11386
  } else if (outcome === "not-object") {
11058
- printErr(
11059
- `yaw-mcp try-cleanup: warning -- couldn't strip ${marker.entryName} from ${marker.clientPath} (${marker.clientPath} is not a JSON object).`
11060
- );
11387
+ peelFailure = notAContainer(marker);
11061
11388
  }
11062
11389
  } catch (e) {
11390
+ peelFailure = e.message;
11391
+ }
11392
+ if (peelFailure !== null) {
11063
11393
  printErr(
11064
- `yaw-mcp try-cleanup: warning -- couldn't strip ${marker.entryName} from ${marker.clientPath} (${e.message}).`
11394
+ `yaw-mcp try-cleanup: couldn't strip ${marker.entryName} from ${marker.clientPath} (${peelFailure}) -- it may still be wired in, so the trial marker was kept.`
11065
11395
  );
11396
+ printErr(
11397
+ ` Fix that file (or remove the ${marker.entryName} entry from it by hand), then re-run: yaw-mcp try-cleanup ${slug}`
11398
+ );
11399
+ return { exitCode: 1, written: [] };
11066
11400
  }
11067
11401
  try {
11068
11402
  await unlink2(markerPath);
@@ -11133,13 +11467,7 @@ async function gcExpiredTrials(opts) {
11133
11467
  for (const { marker, path: path5 } of scan.expired) {
11134
11468
  let stage = "peel";
11135
11469
  try {
11136
- const outcome = await peelEntryFromConfig(
11137
- marker.clientPath,
11138
- marker.containerPath,
11139
- marker.entryName,
11140
- false,
11141
- marker.entryFingerprint
11142
- );
11470
+ const outcome = await peelEntryFromConfig(marker);
11143
11471
  if (outcome === "replaced") {
11144
11472
  stage = "replaced";
11145
11473
  let markerRemoved = true;
@@ -11161,7 +11489,7 @@ async function gcExpiredTrials(opts) {
11161
11489
  continue;
11162
11490
  }
11163
11491
  if (outcome === "not-object") {
11164
- throw new Error(`${marker.clientPath} is not a JSON object`);
11492
+ throw new Error(notAContainer(marker));
11165
11493
  }
11166
11494
  stage = "unlink";
11167
11495
  await unlink2(path5);
@@ -11429,7 +11757,7 @@ function foldBundleWarnings(warnings, probe) {
11429
11757
  const prefix = `${probe.path}:`;
11430
11758
  return warnings.filter((w) => !w.startsWith(prefix));
11431
11759
  }
11432
- var VERSION = true ? "1.0.15" : "dev";
11760
+ var VERSION = true ? "1.0.17" : "dev";
11433
11761
  var DOCTOR_USAGE = `Usage: yaw-mcp doctor [--json]
11434
11762
 
11435
11763
  Print a diagnostic of your yaw-mcp setup.
@@ -11485,9 +11813,12 @@ async function collectStateStatus(opts) {
11485
11813
  return { disabled, filePath, peek, persisted };
11486
11814
  }
11487
11815
  function describeClient(c) {
11488
- const installCmd = `yaw-mcp install ${c.clientId}${c.scope === "user" ? "" : ` --scope ${c.scope}`}`;
11816
+ const installCmd = installCommandFor(c);
11489
11817
  const client = INSTALL_TARGETS.find((t) => t.clientId === c.clientId)?.label ?? c.clientId;
11490
- return { client, label: `${client} (${c.scope})`, status: renderClientStatus(c, installCmd) };
11818
+ return { client, label: `${client} (${c.scope})`, status: renderClientStatus(c, installCmd, client) };
11819
+ }
11820
+ function installCommandFor(c) {
11821
+ return `yaw-mcp install ${c.clientId}${c.scope === "user" ? "" : ` --scope ${c.scope}`}`;
11491
11822
  }
11492
11823
  var TRANSIENT_READ_CODES = /* @__PURE__ */ new Set(["EBUSY", "EAGAIN"]);
11493
11824
  function isTransientRead(c) {
@@ -11504,7 +11835,28 @@ function clientCannotLaunch(c) {
11504
11835
  // exit 2); a strict file that HOLDS the "mcp" entry is the state this
11505
11836
  // fold exists for -- the CLIENTS row says the entry is not loading while
11506
11837
  // DIAGNOSIS said "All good", on --json too.
11507
- c.unloadable !== null && c.hasMcpEntry || c.launchCommandMissing !== null || c.launchOamEntryMissing !== null || c.launchOamNotAbsolute !== null;
11838
+ c.unloadable !== null && c.hasMcpEntry || // The same fold one level up the file: our entry sits in a file whose
11839
+ // client refuses to load it over a TOP-LEVEL setting -- Codex's
11840
+ // `mcp_optional_startup_grace_ms` at -1, "0" or 0.0, which a Codex that
11841
+ // reads the key (0.151 on, whose source types it as a u64) stops on at
11842
+ // startup, measured on 0.156.1: "failed to load bootstrap configuration",
11843
+ // exit 1 -- or at an integer no release loads. The client starts nothing
11844
+ // from that file, ours included, which is this fold's definition, and the
11845
+ // CLIENTS line no longer reads OK. Only WITH our entry, for the reason the
11846
+ // strict-file line above gives: a file yaw-mcp was never installed to is
11847
+ // advice (the CLIENTS line carries it), not a fault of this setup.
11848
+ //
11849
+ // A MISSING top-level setting is not here, on the precedent of a legacy
11850
+ // entry beside a working one: the file loads and yaw-mcp starts, and what
11851
+ // the missing key costs depends on the client (Codex 0.151 and later give
11852
+ // optional servers one shared second to start and leave a slower yaw-mcp
11853
+ // out of that whole session; an older Codex does not read the key) -- a
11854
+ // degraded setup with an install run that fixes it, which the CLIENTS line
11855
+ // and DIAGNOSIS (rootDefaultSteps) name, not one that cannot launch. Folding
11856
+ // it would take every Codex setup installed before the key existed to exit
11857
+ // 2, and the Yaw Terminal panel that polls `doctor --json` to "Warnings
11858
+ // need attention", over a step the report already gives.
11859
+ c.hasMcpEntry && c.rootDefaults.some((d) => d.state === "refused" || d.state === "refused-every-release") || c.launchCommandMissing !== null || c.launchOamEntryMissing !== null || c.launchOamNotAbsolute !== null;
11508
11860
  }
11509
11861
  function clientLaunchWarnings(clients) {
11510
11862
  const grouped = /* @__PURE__ */ new Map();
@@ -11519,6 +11871,22 @@ function clientLaunchWarnings(clients) {
11519
11871
  }
11520
11872
  return [...grouped.values()].map((g) => `${g.path}: ${g.client} (${g.scopes.join(", ")}) ${g.status}`);
11521
11873
  }
11874
+ function rootDefaultSteps(clients) {
11875
+ const steps = /* @__PURE__ */ new Map();
11876
+ for (const c of clients) {
11877
+ if (!c.hasMcpEntry || c.launchForeignPath !== null) continue;
11878
+ for (const d of c.rootDefaults) {
11879
+ if (d.state !== "missing") continue;
11880
+ const key = `${c.path}\0${d.key}`;
11881
+ if (steps.has(key)) continue;
11882
+ steps.set(
11883
+ key,
11884
+ `Run \`${installCommandFor(c)}\` to add ${d.key} = ${JSON.stringify(d.recommended)} to ${c.path}: ${d.why}.`
11885
+ );
11886
+ }
11887
+ }
11888
+ return [...steps.values()];
11889
+ }
11522
11890
  async function runDoctor(opts = {}) {
11523
11891
  if (opts.json) return runDoctorJson(opts);
11524
11892
  const lines = [];
@@ -11655,6 +12023,7 @@ async function runDoctor(opts = {}) {
11655
12023
  print(" Add one with `yaw-mcp add <slug>`; `yaw-mcp search <text>` finds slugs.");
11656
12024
  }
11657
12025
  }
12026
+ for (const step of rootDefaultSteps(clients)) print(` ${step}`);
11658
12027
  return { exitCode, lines, snapshot: { version: VERSION, config, clients } };
11659
12028
  }
11660
12029
  async function runDoctorJson(opts) {
@@ -11830,6 +12199,7 @@ async function runDoctorJson(opts) {
11830
12199
  summary += " No MCP servers are configured yet -- add one with `yaw-mcp add <slug>`.";
11831
12200
  }
11832
12201
  }
12202
+ for (const step of rootDefaultSteps(clients)) summary += ` ${step}`;
11833
12203
  const snapshotJson = {
11834
12204
  timestamp,
11835
12205
  version: VERSION,
@@ -12338,7 +12708,7 @@ function schemaSuffix(f) {
12338
12708
  return ` (schema v${f.version}, this yaw-mcp supports v${CURRENT_SCHEMA_VERSION})`;
12339
12709
  return ` (schema v${f.version})`;
12340
12710
  }
12341
- function renderClientStatus(c, installCmd) {
12711
+ function renderClientStatus(c, installCmd, client) {
12342
12712
  if (c.unavailable) {
12343
12713
  return c.unavailableReason !== void 0 ? `not supported on this OS yet -- ${c.unavailableReason}` : "unavailable on this OS";
12344
12714
  }
@@ -12349,7 +12719,8 @@ function renderClientStatus(c, installCmd) {
12349
12719
  return `exists but could not be read (${c.unreadable}) -- check the file and its permissions, then rerun doctor`;
12350
12720
  }
12351
12721
  if (c.malformed) {
12352
- return `exists but ${c.syntax} is malformed -- install refuses to overwrite it; ${unparseableConfigFix(`run \`${installCmd}\``, c.syntax)}`;
12722
+ const detail = c.malformedDetail !== null ? ` (${c.malformedDetail})` : "";
12723
+ return `exists but ${c.syntax} is malformed${detail} -- install refuses to overwrite it; ${unparseableConfigFix(`run \`${installCmd}\``, c.syntax)}`;
12353
12724
  }
12354
12725
  if (c.containerBlocked !== null) {
12355
12726
  return `present, but ${c.containerBlocked}, not ${containerNounFor(c.syntax)} -- install refuses to overwrite it; ${blockedContainerFix(`run \`${installCmd}\``, c.syntax)}`;
@@ -12357,6 +12728,12 @@ function renderClientStatus(c, installCmd) {
12357
12728
  if (c.unloadable !== null) {
12358
12729
  return `exists but ${c.unloadable} -- install refuses to write into it; ${unloadableConfigFix(`run \`${installCmd}\``)}`;
12359
12730
  }
12731
+ const noReleaseLoads = c.rootDefaults.find(
12732
+ (d) => d.state === "refused-every-release"
12733
+ );
12734
+ if (noReleaseLoads !== void 0) {
12735
+ return `exists but sets ${noReleaseLoads.key} to ${noReleaseLoads.value}, ${noReleaseLoads.everyRelease}, so ${client} will not load the file -- install refuses to write into it; ${noReleaseLoads.fix}, then run \`${installCmd}\``;
12736
+ }
12360
12737
  if (c.entryUnspliceable !== null) {
12361
12738
  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}\``;
12362
12739
  }
@@ -12365,23 +12742,25 @@ function renderClientStatus(c, installCmd) {
12365
12742
  }
12366
12743
  const legacy = c.hasLegacyEntry ? `; legacy "${c.legacyEntryName}" entry also present -- install removes it as it writes the working entry` : "";
12367
12744
  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` : "";
12745
+ const rootClause = (remedy) => c.rootDefaults.map((d) => rootDefaultClause(d, { client, installCmd, remedy, syntax: c.syntax })).join("");
12368
12746
  if (c.launchCommandMissing) {
12369
- return `has "${ENTRY_NAME}" entry, but its launch command does not exist: ${c.launchCommandMissing} -- the client cannot start yaw-mcp; rerun \`${installCmd}\`${legacy}${keyNote}`;
12747
+ return `has "${ENTRY_NAME}" entry, but its launch command does not exist: ${c.launchCommandMissing} -- the client cannot start yaw-mcp; rerun \`${installCmd}\`${legacy}${rootClause("rerun")}${keyNote}`;
12370
12748
  }
12371
12749
  if (c.launchOamEntryMissing) {
12372
- return `has "${ENTRY_NAME}" entry running on oam, but its entry file does not exist: ${c.launchOamEntryMissing} -- oam cannot fetch it on demand the way npx would; rerun \`${installCmd}\`${legacy}${keyNote}`;
12750
+ return `has "${ENTRY_NAME}" entry running on oam, but its entry file does not exist: ${c.launchOamEntryMissing} -- oam cannot fetch it on demand the way npx would; rerun \`${installCmd}\`${legacy}${rootClause("rerun")}${keyNote}`;
12373
12751
  }
12374
12752
  if (c.launchOamNotAbsolute) {
12375
- return `has "${ENTRY_NAME}" entry with a bare "${c.launchOamNotAbsolute}" command -- it resolves against the client's PATH, which a GUI-launched client does not inherit from your shell; rerun \`${installCmd}\` to write an absolute path (set OAM_BIN to oam's full path first if install cannot find it)${legacy}${keyNote}`;
12753
+ return `has "${ENTRY_NAME}" entry with a bare "${c.launchOamNotAbsolute}" command -- it resolves against the client's PATH, which a GUI-launched client does not inherit from your shell; rerun \`${installCmd}\` to write an absolute path (set OAM_BIN to oam's full path first if install cannot find it)${legacy}${rootClause("rerun")}${keyNote}`;
12376
12754
  }
12377
12755
  if (c.launchForeignPath) {
12378
- return `has "${ENTRY_NAME}" entry${c.launchRuntime === "oam" ? " (runs on oam)" : ""} whose launch path is for another OS: ${c.launchForeignPath} -- not verified from here${c.hasLegacyEntry ? `; legacy "${c.legacyEntryName}" entry also present -- remove it to avoid running yaw-mcp twice` : ""}${keyNote}`;
12756
+ return `has "${ENTRY_NAME}" entry${c.launchRuntime === "oam" ? " (runs on oam)" : ""} whose launch path is for another OS: ${c.launchForeignPath} -- not verified from here${c.hasLegacyEntry ? `; legacy "${c.legacyEntryName}" entry also present -- remove it to avoid running yaw-mcp twice` : ""}${rootClause("by-hand")}${keyNote}`;
12379
12757
  }
12758
+ const ok = c.rootDefaults.some((d) => d.state === "refused") ? "" : "OK -- ";
12380
12759
  if (c.hasMcpEntry && c.hasLegacyEntry) {
12381
- return `OK -- has "${ENTRY_NAME}" entry${c.launchRuntime === "oam" ? " (runs on oam)" : ""}; legacy "${c.legacyEntryName}" entry also present -- remove it to avoid running yaw-mcp twice${keyNote}`;
12760
+ return `${ok}has "${ENTRY_NAME}" entry${c.launchRuntime === "oam" ? " (runs on oam)" : ""}; legacy "${c.legacyEntryName}" entry also present -- remove it to avoid running yaw-mcp twice${rootClause("run")}${keyNote}`;
12382
12761
  }
12383
12762
  if (c.hasMcpEntry) {
12384
- return `OK -- has "${ENTRY_NAME}" entry${c.launchRuntime === "oam" ? " (runs on oam)" : ""}${keyNote}`;
12763
+ return `${ok}has "${ENTRY_NAME}" entry${c.launchRuntime === "oam" ? " (runs on oam)" : ""}${rootClause("run")}${keyNote}`;
12385
12764
  }
12386
12765
  if (c.hasLegacyEntry) {
12387
12766
  return `legacy "${c.legacyEntryName}" entry present -- run \`${installCmd}\` to migrate; install removes the legacy entry as it writes the new one${keyNote}`;
@@ -12389,12 +12768,27 @@ function renderClientStatus(c, installCmd) {
12389
12768
  if (c.exists) return `present, no "${ENTRY_NAME}" entry -- run \`${installCmd}\``;
12390
12769
  return `not configured -- run \`${installCmd}\``;
12391
12770
  }
12771
+ function rootDefaultClause(d, line) {
12772
+ switch (d.state) {
12773
+ case "missing": {
12774
+ const setting = `${d.key} = ${JSON.stringify(d.recommended)}`;
12775
+ const step = line.remedy === "rerun" ? `install adds ${setting} as it writes the working entry` : line.remedy === "run" ? `run \`${line.installCmd}\` to add ${setting}` : `set ${setting} by hand, on one line ${rootLinePlacement2(line.syntax)}`;
12776
+ return `; the file does not set ${d.key} -- ${step}`;
12777
+ }
12778
+ case "refused":
12779
+ return `; the file sets ${d.key} to ${d.value}, ${d.kind === null ? "" : `${d.kind} `}where ${line.client} needs ${d.needs} -- a ${line.client} release that reads the key will not load the file with that value, and install leaves a value you set alone; ${d.fix}`;
12780
+ case "other":
12781
+ case "refused-every-release":
12782
+ return "";
12783
+ }
12784
+ }
12392
12785
  var EMPTY_PROBE = {
12393
12786
  hasMcpEntry: false,
12394
12787
  containerEntries: 0,
12395
12788
  hasLegacyEntry: false,
12396
12789
  legacyEntryName: null,
12397
12790
  malformed: false,
12791
+ malformedDetail: null,
12398
12792
  unloadable: null,
12399
12793
  unreadable: null,
12400
12794
  unreadableCode: null,
@@ -12406,9 +12800,13 @@ var EMPTY_PROBE = {
12406
12800
  launchForeignPath: null,
12407
12801
  entryProjectKey: null,
12408
12802
  entryUnspliceable: null,
12409
- containerUnspliceable: null
12803
+ containerUnspliceable: null,
12804
+ rootDefaults: []
12410
12805
  };
12411
12806
  var MALFORMED = { ...EMPTY_PROBE, malformed: true };
12807
+ function malformedProbe(read) {
12808
+ return { ...MALFORMED, malformedDetail: read.reason === "encoding" ? read.detail : null };
12809
+ }
12412
12810
  function unreadableProbe(err) {
12413
12811
  const code = err?.code;
12414
12812
  return {
@@ -12468,24 +12866,24 @@ function* enumerateProbeSlots(opts) {
12468
12866
  syntax: syntaxNameFor(site.format),
12469
12867
  containerPath: addressOf(site).containerPath
12470
12868
  },
12471
- read: exists2 ? { path: site.resolved.absolute, site, transform: target.entry } : null
12869
+ read: exists2 ? { path: site.resolved.absolute, site, transform: target.entry, rootDefaults: target.config.rootDefaults } : null
12472
12870
  };
12473
12871
  }
12474
12872
  }
12475
12873
  }
12476
12874
  function probeClients(opts) {
12477
12875
  const out = [];
12478
- const readConfig = opts.readClientConfig ?? ((p) => readFileSync3(p, "utf8"));
12876
+ const readConfig = opts.readClientConfig ?? ((p) => readFileSync3(p));
12479
12877
  const platform = opts.platform ?? process.platform;
12480
12878
  for (const { result, read } of enumerateProbeSlots(opts)) {
12481
12879
  if (read) {
12482
- let raw = null;
12880
+ let loaded = null;
12483
12881
  try {
12484
- raw = readConfig(read.path);
12882
+ loaded = readConfig(read.path);
12485
12883
  } catch (err) {
12486
12884
  Object.assign(result, unreadableProbe(err));
12487
12885
  }
12488
- if (raw !== null) Object.assign(result, classifyProbe(raw, read, existsSync6, platform));
12886
+ if (loaded !== null) Object.assign(result, classifyProbeRead(loaded, read, existsSync6, platform));
12489
12887
  }
12490
12888
  out.push(result);
12491
12889
  }
@@ -12540,11 +12938,19 @@ function oamRunEntryFromTokens(tokens) {
12540
12938
  return tokens.slice(sub + 1).find((t) => !t.startsWith("-")) ?? null;
12541
12939
  }
12542
12940
  var JSON_PROBE_FORMATS = /* @__PURE__ */ new Set(["json", "jsonc"]);
12941
+ function classifyProbeRead(loaded, read, exists2, platform) {
12942
+ if (typeof loaded === "string") return classifyProbe(loaded, read, exists2, platform);
12943
+ const decoded = decodeClientConfigBytes(loaded, read.site.format);
12944
+ return decoded.malformed === null ? classifyProbe(decoded.text, read, exists2, platform) : malformedProbe(decoded.malformed);
12945
+ }
12543
12946
  function classifyProbe(raw, read, exists2, platform) {
12544
- 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);
12947
+ 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, read.rootDefaults, exists2, platform);
12545
12948
  }
12546
- function classifyProbeViaAdapter(raw, site, transform, exists2, platform) {
12949
+ function classifyProbeViaAdapter(raw, site, transform, rootDefaults, exists2, platform) {
12547
12950
  const view = classifyClientConfig(raw, site, { transform });
12951
+ return { ...classifyAdapterView(view, exists2, platform), rootDefaults: probeRootDefaults(view, rootDefaults) };
12952
+ }
12953
+ function classifyAdapterView(view, exists2, platform) {
12548
12954
  const read = view.read;
12549
12955
  const violation = view.unloadable();
12550
12956
  const unloadable = violation ? unloadableConfigProblem(violation) : null;
@@ -12554,7 +12960,7 @@ function classifyProbeViaAdapter(raw, site, transform, exists2, platform) {
12554
12960
  case "unreadable":
12555
12961
  return { ...EMPTY_PROBE, unreadable: read.message, unreadableCode: read.code };
12556
12962
  case "malformed":
12557
- return { ...MALFORMED };
12963
+ return malformedProbe(read);
12558
12964
  case "blocked":
12559
12965
  return read.reparable ? { ...EMPTY_PROBE, unloadable } : { ...EMPTY_PROBE, unloadable, containerBlocked: `"${read.path.join(".")}" is ${read.shape}` };
12560
12966
  case "unspliceable":
@@ -12595,8 +13001,63 @@ function classifyProbeViaAdapter(raw, site, transform, exists2, platform) {
12595
13001
  }
12596
13002
  }
12597
13003
  }
13004
+ function probeRootDefaults(view, defaults) {
13005
+ if (defaults === void 0 || defaults.length === 0) return [];
13006
+ const plan = planRootDefaults(view, defaults);
13007
+ const syntax = view.adapter.syntax;
13008
+ const out = [];
13009
+ for (const rootDefault of defaults) {
13010
+ const base = { key: rootDefault.key, recommended: rootDefault.value, why: rootDefault.why };
13011
+ if (plan.set.includes(rootDefault)) {
13012
+ out.push({ ...base, state: "missing", value: null, kind: null, needs: null, everyRelease: null, fix: null });
13013
+ continue;
13014
+ }
13015
+ const kept = plan.kept.find((k) => k.rootDefault === rootDefault);
13016
+ if (kept === void 0) continue;
13017
+ const { value, float, refused } = kept;
13018
+ const spelled = float ?? spellRootValue2(value, syntax);
13019
+ if (refused === void 0) {
13020
+ out.push({ ...base, state: "other", value: spelled, kind: null, needs: null, everyRelease: null, fix: null });
13021
+ continue;
13022
+ }
13023
+ const recommended = `(${JSON.stringify(rootDefault.value)} is recommended)`;
13024
+ const kind = refused.kind ?? null;
13025
+ if (refused.everyRelease !== void 0) {
13026
+ out.push({
13027
+ ...base,
13028
+ state: "refused-every-release",
13029
+ value: spelled,
13030
+ kind,
13031
+ needs: refused.needs,
13032
+ everyRelease: refused.everyRelease,
13033
+ fix: `change that value by hand to ${refused.needs} ${recommended}`
13034
+ });
13035
+ continue;
13036
+ }
13037
+ const scalar = typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean" || value instanceof Date;
13038
+ out.push({
13039
+ ...base,
13040
+ state: "refused",
13041
+ value: spelled,
13042
+ kind,
13043
+ needs: refused.needs,
13044
+ everyRelease: null,
13045
+ fix: scalar ? `edit that value by hand ${recommended}` : `delete it by hand and set the key on one line ${rootLinePlacement2(syntax)} ${recommended}`
13046
+ });
13047
+ }
13048
+ return out;
13049
+ }
13050
+ function spellRootValue2(value, syntax) {
13051
+ if (typeof value === "string") return JSON.stringify(value);
13052
+ if (typeof value === "number" || typeof value === "bigint" || typeof value === "boolean") return String(value);
13053
+ if (value instanceof Date) return value.toISOString();
13054
+ return Array.isArray(value) ? describeValueShape(value) : containerNounFor(syntax);
13055
+ }
13056
+ function rootLinePlacement2(syntax) {
13057
+ return syntax === "TOML" ? "above the first table in the file" : "at the top level of the file";
13058
+ }
12598
13059
  function launchChecks(entry, exists2, platform) {
12599
- const isAbsolute2 = platform === "win32" ? win32.isAbsolute : posix.isAbsolute;
13060
+ const isAbsolute2 = platform === "win32" ? win322.isAbsolute : posix2.isAbsolute;
12600
13061
  let launchCommandMissing = null;
12601
13062
  let launchRuntime = null;
12602
13063
  let launchOamNotAbsolute = null;
@@ -12676,6 +13137,7 @@ function classifyProbeContent(raw, containerPath, strict, exists2 = existsSync6,
12676
13137
  hasLegacyEntry: legacyEntryName !== null,
12677
13138
  legacyEntryName,
12678
13139
  malformed: false,
13140
+ malformedDetail: null,
12679
13141
  unloadable,
12680
13142
  unreadable: null,
12681
13143
  unreadableCode: null,
@@ -12691,7 +13153,11 @@ function classifyProbeContent(raw, containerPath, strict, exists2 = existsSync6,
12691
13153
  entryProjectKey: ENTRY_NAME in container || legacyEntryName !== null ? entryProjectKey : null,
12692
13154
  // A JSON object key is always spliceable, and so is a JSON container.
12693
13155
  entryUnspliceable: null,
12694
- containerUnspliceable: null
13156
+ containerUnspliceable: null,
13157
+ // No JSON-family row declares a top-level default: their adapters
13158
+ // implement neither readRootKey nor insertRootKey, and a row may declare
13159
+ // one only on a format whose adapter does (ConfigShape.rootDefaults).
13160
+ rootDefaults: []
12695
13161
  };
12696
13162
  } catch {
12697
13163
  return { ...MALFORMED };
@@ -12702,13 +13168,13 @@ async function probeClientsAsync(opts) {
12702
13168
  const platform = opts.platform ?? process.platform;
12703
13169
  for (const { result, read } of enumerateProbeSlots(opts)) {
12704
13170
  if (read) {
12705
- let raw = null;
13171
+ let loaded = null;
12706
13172
  try {
12707
- raw = opts.readClientConfig ? opts.readClientConfig(read.path) : await readFile13(read.path, "utf8");
13173
+ loaded = opts.readClientConfig ? opts.readClientConfig(read.path) : await readFile13(read.path);
12708
13174
  } catch (err) {
12709
13175
  Object.assign(result, unreadableProbe(err));
12710
13176
  }
12711
- if (raw !== null) Object.assign(result, classifyProbe(raw, read, existsSync6, platform));
13177
+ if (loaded !== null) Object.assign(result, classifyProbeRead(loaded, read, existsSync6, platform));
12712
13178
  }
12713
13179
  out.push(result);
12714
13180
  }
@@ -13454,7 +13920,7 @@ async function runFoundryExport(opts) {
13454
13920
  }
13455
13921
 
13456
13922
  // src/heal-entries.ts
13457
- import { statSync as statSync3 } from "fs";
13923
+ import { statSync as statSync4 } from "fs";
13458
13924
  function norm(p, platform = process.platform) {
13459
13925
  const slashed = p.split("\\").join("/");
13460
13926
  return platform === "win32" ? slashed.toLowerCase() : slashed;
@@ -13469,18 +13935,20 @@ function isOwnBrokerEntry(entryPath) {
13469
13935
  }
13470
13936
  function isLaunchableFile(entryPath) {
13471
13937
  try {
13472
- return statSync3(entryPath).isFile();
13938
+ return statSync4(entryPath).isFile();
13473
13939
  } catch {
13474
13940
  return false;
13475
13941
  }
13476
13942
  }
13477
13943
  async function healStaleBrokerEntries(opts = {}) {
13478
13944
  const env = opts.env ?? process.env;
13479
- if (isReadOnlyDiagnostics(env)) return { healed: [], unhealable: [] };
13945
+ if (isReadOnlyDiagnostics(env)) return { healed: [], unhealable: [], failed: [] };
13480
13946
  const os = opts.os ?? CURRENT_OS;
13481
13947
  const platform = opts.platform ?? process.platform;
13482
13948
  const healed = [];
13483
13949
  const unhealable = [];
13950
+ const failed = [];
13951
+ const writeConfig = opts.writeConfig ?? atomicWriteFile;
13484
13952
  let replacement = null;
13485
13953
  const replacementFor = async () => {
13486
13954
  if (replacement !== null) return replacement;
@@ -13538,17 +14006,32 @@ async function healStaleBrokerEntries(opts = {}) {
13538
14006
  const nextLaunch = launchOf(next);
13539
14007
  const nextEntry = nextLaunch === null ? null : oamRunEntryPath(nextLaunch.command, nextLaunch.args);
13540
14008
  if (nextEntry !== null && norm(nextEntry, platform) === norm(entryPath, platform)) return;
13541
- if (opts.dryRun !== true) {
13542
- const text = applyClientConfigEdits(view, [{ op: "upsert", key: ENTRY_NAME, entry: next }], site);
13543
- await atomicWriteFile(site.resolved.absolute, text);
13544
- }
13545
- healed.push({
14009
+ const outcome = {
13546
14010
  clientId: target.clientId,
13547
14011
  scope,
13548
14012
  path: site.resolved.absolute,
13549
14013
  from: entryPath,
13550
14014
  to: nextEntry ?? "npx"
13551
- });
14015
+ };
14016
+ let text;
14017
+ try {
14018
+ text = applyClientConfigEdits(view, [{ op: "upsert", key: ENTRY_NAME, entry: next }], site);
14019
+ } catch (err) {
14020
+ failed.push({
14021
+ ...outcome,
14022
+ error: `failed to splice the "${ENTRY_NAME}" entry into ${site.resolved.absolute} (${err instanceof Error ? err.message : String(err)})`
14023
+ });
14024
+ return;
14025
+ }
14026
+ if (opts.dryRun !== true) {
14027
+ try {
14028
+ await writeConfig(site.resolved.absolute, terminateWithNewline(text));
14029
+ } catch (err) {
14030
+ failed.push({ ...outcome, error: describeWriteFailure(site.resolved.absolute, err) });
14031
+ return;
14032
+ }
14033
+ }
14034
+ healed.push(outcome);
13552
14035
  } catch (err) {
13553
14036
  log("warn", "Could not heal a stale yaw-mcp entry", {
13554
14037
  path: site.resolved.absolute,
@@ -13589,19 +14072,28 @@ async function healStaleBrokerEntries(opts = {}) {
13589
14072
  clients: healed.map((h) => `${h.clientId} (${h.scope})`)
13590
14073
  });
13591
14074
  }
13592
- return { healed, unhealable };
14075
+ return { healed, unhealable, failed };
13593
14076
  }
13594
14077
  async function maybeHealStaleBrokerEntries(opts = {}) {
13595
14078
  const env = opts.env ?? process.env;
13596
- if (isFeatureDisabled("YAW_MCP_AUTO_HEAL", env)) return { healed: [], unhealable: [] };
14079
+ if (isFeatureDisabled("YAW_MCP_AUTO_HEAL", env)) return { healed: [], unhealable: [], failed: [] };
14080
+ let result;
13597
14081
  try {
13598
- return await healStaleBrokerEntries(opts);
14082
+ result = await healStaleBrokerEntries(opts);
13599
14083
  } catch (err) {
13600
14084
  log("warn", "Stale-entry heal pass failed", {
13601
14085
  error: err instanceof Error ? err.message : String(err)
13602
14086
  });
13603
- return { healed: [], unhealable: [] };
14087
+ return { healed: [], unhealable: [], failed: [] };
13604
14088
  }
14089
+ for (const f of result.failed) {
14090
+ log("warn", "Could not heal a stale yaw-mcp entry", {
14091
+ client: `${f.clientId} (${f.scope})`,
14092
+ path: f.path,
14093
+ error: f.error
14094
+ });
14095
+ }
14096
+ return result;
13605
14097
  }
13606
14098
 
13607
14099
  // src/heal-cmd.ts
@@ -13624,26 +14116,45 @@ function describe(h) {
13624
14116
  was -> ${h.from}
13625
14117
  now -> ${h.to}`;
13626
14118
  }
13627
- async function runHeal(options = {}) {
14119
+ function describeFailures(failed, dryRun) {
14120
+ const one = failed.length === 1;
14121
+ const rows = failed.map((f) => ` ${f.clientId} (${f.scope}): ${f.path}
14122
+ still -> ${f.from}
14123
+ ${f.error}`);
14124
+ return `yaw-mcp heal: ${dryRun ? "cannot" : "could not"} re-point ${failed.length} stale ${one ? "entry" : "entries"}:
14125
+ ${rows.join("\n")}
14126
+ ` + (one ? "It still names a launch file that no longer exists, so its client cannot start yaw-mcp -- fix what the line above says, then re-run `yaw-mcp heal`.\n" : "Each still names a launch file that no longer exists, so its client cannot start yaw-mcp -- fix what each entry's last line says, then re-run `yaw-mcp heal`.\n");
14127
+ }
14128
+ async function runHeal(options = {}, sweep = healStaleBrokerEntries) {
13628
14129
  let result;
13629
14130
  try {
13630
- result = await healStaleBrokerEntries({ dryRun: options.dryRun });
14131
+ result = await sweep({ dryRun: options.dryRun });
13631
14132
  } catch (err) {
13632
14133
  process.stderr.write(`yaw-mcp heal: ${err instanceof Error ? err.message : String(err)}
13633
14134
  `);
13634
14135
  return { exitCode: 1 };
13635
14136
  }
13636
- const { healed, unhealable } = result;
14137
+ const { healed, unhealable, failed } = result;
14138
+ const exitCode = failed.length > 0 ? 1 : 0;
14139
+ const reportFailures = (afterTranscript) => {
14140
+ if (failed.length === 0) return;
14141
+ process.stderr.write(`${afterTranscript ? "\n" : ""}${describeFailures(failed, options.dryRun === true)}`);
14142
+ };
13637
14143
  if (options.json === true) {
13638
14144
  process.stdout.write(
13639
- `${JSON.stringify({ healed, unhealable, count: healed.length, dryRun: options.dryRun === true }, null, 2)}
14145
+ `${JSON.stringify({ healed, unhealable, failed, count: healed.length, dryRun: options.dryRun === true }, null, 2)}
13640
14146
  `
13641
14147
  );
13642
- return { exitCode: 0 };
14148
+ reportFailures(false);
14149
+ return { exitCode };
13643
14150
  }
14151
+ let printed = false;
13644
14152
  if (options.quiet !== true) {
13645
14153
  if (healed.length === 0) {
13646
- process.stdout.write("No stale yaw-mcp entries found.\n");
14154
+ if (failed.length === 0) {
14155
+ process.stdout.write("No stale yaw-mcp entries found.\n");
14156
+ printed = true;
14157
+ }
13647
14158
  } else {
13648
14159
  const verb = options.dryRun === true ? "Would re-point" : "Re-pointed";
13649
14160
  process.stdout.write(
@@ -13651,23 +14162,26 @@ async function runHeal(options = {}) {
13651
14162
  ${healed.map(describe).join("\n")}
13652
14163
  ` + (options.dryRun === true ? "" : "\nRestart the affected client(s) to pick this up.\n")
13653
14164
  );
14165
+ printed = true;
13654
14166
  }
13655
14167
  if (unhealable.length > 0) {
13656
14168
  process.stdout.write(
13657
- `
13658
- ${unhealable.length} config${unhealable.length === 1 ? "" : "s"} could not be checked:
14169
+ `${printed ? "\n" : ""}${unhealable.length} config${unhealable.length === 1 ? "" : "s"} could not be checked:
13659
14170
  ${unhealable.map((u) => ` ${u.clientId} (${u.scope}): ${u.path} -- ${u.reason}`).join("\n")}
13660
14171
  Run \`yaw-mcp doctor\` for what each one needs.
13661
14172
  `
13662
14173
  );
14174
+ printed = true;
13663
14175
  }
13664
14176
  }
13665
- return { exitCode: 0 };
14177
+ reportFailures(printed);
14178
+ return { exitCode };
13666
14179
  }
13667
14180
 
13668
14181
  // src/import-cmd.ts
13669
14182
  import { homedir as homedir18 } from "os";
13670
14183
  import { basename as basename3, resolve as resolvePath } from "path";
14184
+ import { createInterface as createInterface3 } from "readline/promises";
13671
14185
  var IMPORT_USAGE = `Usage: yaw-mcp import <client> [flags]
13672
14186
 
13673
14187
  Read the MCP servers a client already has configured and add them to your
@@ -13685,7 +14199,11 @@ var IMPORT_USAGE = `Usage: yaw-mcp import <client> [flags]
13685
14199
 
13686
14200
  A server already in bundles.json is MERGED, with the client's copy winning,
13687
14201
  so the plan names every entry that would be replaced and shows the launch
13688
- command it would replace. A VS Code server written with a \${input:...} or
14202
+ command it would replace. When the merge would change the stored entry, a
14203
+ terminal run asks first -- [o]verwrite, [s]kip or [a]bort, and a bare Enter
14204
+ skips that server -- and a run off one writes nothing and exits 2 unless you
14205
+ pass --force. A stored entry the merge would leave as it is is not asked
14206
+ about. A VS Code server written with a \${input:...} or
13689
14207
  \${env:...} variable is skipped by name: VS Code expands those itself and
13690
14208
  yaw-mcp does not, so importing one would produce a server that cannot start.
13691
14209
 
@@ -13702,10 +14220,14 @@ Flags:
13702
14220
  one config file. Defaults to the client's user scope.
13703
14221
  --project-dir <dir> Project root for a project/workspace scope
13704
14222
  (default: the current directory).
13705
- --dry-run Show what would be imported. Writes nothing.
14223
+ --dry-run Show what would be imported -- and, with
14224
+ --remove-originals, which client entries would be
14225
+ removed. Writes nothing.
13706
14226
  --remove-originals Remove the imported entries from the client config
13707
14227
  without asking.
13708
- --keep-originals Leave the client config alone without asking.`;
14228
+ --keep-originals Leave the client config alone without asking.
14229
+ --force Overwrite a bundles.json entry the import would change
14230
+ without asking.`;
13709
14231
  var SELF_ENTRY_NAMES = /* @__PURE__ */ new Set([ENTRY_NAME, ...LEGACY_ENTRY_NAMES, "mcp-connect"]);
13710
14232
  function isSelfEntry(key) {
13711
14233
  return SELF_ENTRY_NAMES.has(key) || key.startsWith(TRIAL_ENTRY_PREFIX);
@@ -13825,6 +14347,48 @@ function renderLaunch2(shape) {
13825
14347
  }
13826
14348
  return shape.url ? `HTTP ${displaySafe(shape.url)}` : "(no launch command)";
13827
14349
  }
14350
+ async function storedEntryChanges(preview, home, warnOnce) {
14351
+ const unreadable = ["the stored entry could not be read back to compare, so it is treated as changed"];
14352
+ if (preview.namespace === void 0) return unreadable;
14353
+ try {
14354
+ const stored = await previewUpsertUserBundle({ namespace: preview.namespace }, { home });
14355
+ for (const w of stored.warnings) warnOnce(w);
14356
+ if (!stored.replaced || JSON.stringify(stored.replacing) !== JSON.stringify(preview.replacing)) return unreadable;
14357
+ if (deepEqualJson(stored.entry, preview.entry)) return null;
14358
+ return describeEntryDiff(stored.entry, preview.entry).map(displaySafe);
14359
+ } catch {
14360
+ return unreadable;
14361
+ }
14362
+ }
14363
+ function indentLines(lines, indent) {
14364
+ return lines.map((l) => `${indent}${l}`).join("\n");
14365
+ }
14366
+ async function askBundleCollisions(changing, bundlesFile, io) {
14367
+ const rl = createInterface3({
14368
+ input: io?.stdin ?? process.stdin,
14369
+ output: io?.stdout ?? process.stdout,
14370
+ terminal: io?.terminal
14371
+ });
14372
+ const answers = /* @__PURE__ */ new Map();
14373
+ try {
14374
+ for (const c of changing) {
14375
+ const diff = indentLines(c.changes ?? [], " ");
14376
+ const raw = await questionOrEmpty(
14377
+ rl,
14378
+ `${bundlesFile} already has an entry "${displaySafe(c.plannedNamespace)}" that differs from the one importing ${displayArg(c.key)} would write:
14379
+ ${diff}
14380
+ [o]verwrite, [s]kip, or [a]bort? (default: skip) `
14381
+ );
14382
+ if (raw === QUESTION_CANCELLED) return "cancelled";
14383
+ const answer = raw.trim().toLowerCase();
14384
+ if (answer.startsWith("a")) return "abort";
14385
+ answers.set(c, answer.startsWith("o") ? "overwrite" : "skip");
14386
+ }
14387
+ return answers;
14388
+ } finally {
14389
+ rl.close();
14390
+ }
14391
+ }
13828
14392
  function describeContainer2(ref) {
13829
14393
  return `${displaySafe(ref.resolved.absolute)} (${ref.resolved.containerPath.join(".")})`;
13830
14394
  }
@@ -13934,6 +14498,12 @@ ${IMPORT_USAGE}` };
13934
14498
  case "--keep-originals":
13935
14499
  opts.keepOriginals = true;
13936
14500
  break;
14501
+ // install's word for the same answer: replace a differing entry without
14502
+ // asking. Unrelated to the two flags above, which answer the question
14503
+ // about the CLIENT config.
14504
+ case "--force":
14505
+ opts.force = true;
14506
+ break;
13937
14507
  case "-h":
13938
14508
  case "--help":
13939
14509
  return { ok: false, error: IMPORT_USAGE, help: true };
@@ -13970,6 +14540,81 @@ function isInteractive3(opts) {
13970
14540
  if (opts.promptAnswer !== void 0) return true;
13971
14541
  return Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY);
13972
14542
  }
14543
+ async function searchForBroker(site, sourceRef, source, opts, home) {
14544
+ const { target } = site;
14545
+ const searched = [sourceRef];
14546
+ let installRef = site.scope === "user" ? searched[0] : null;
14547
+ for (const spec of target.scopes) {
14548
+ if (spec.scope === site.scope) continue;
14549
+ try {
14550
+ const others = resolveInstallSites({
14551
+ clientId: target.clientId,
14552
+ scope: spec.scope,
14553
+ os: site.os,
14554
+ home,
14555
+ appData: resolveAppDataDir({ appData: opts.appData, home }),
14556
+ // Same env the target scope resolved with, so an env-redirected client
14557
+ // is searched at its REAL other-scope path rather than the default one.
14558
+ clientEnv: opts.clientEnv,
14559
+ // The project the user is standing in -- the same resolution
14560
+ // resolveInstallSite would have made had that scope been the target.
14561
+ projectDir: spec.requiresProjectDir ? site.projectDir ?? resolvePath(opts.cwd ?? process.cwd(), ".") : void 0,
14562
+ claudeConfigDir: opts.claudeConfigDir
14563
+ });
14564
+ for (const other of others) {
14565
+ const already = searched.find(
14566
+ (r) => r.resolved.absolute === other.resolved.absolute && r.resolved.containerPath.join(".") === other.resolved.containerPath.join(".")
14567
+ );
14568
+ const ref = already ?? other;
14569
+ if (!already) searched.push(ref);
14570
+ if (spec.scope === "user" && installRef === null) installRef = ref;
14571
+ }
14572
+ } catch {
14573
+ }
14574
+ }
14575
+ let wiredIn = null;
14576
+ const refused = /* @__PURE__ */ new Map();
14577
+ for (let i = 0; i < searched.length; i++) {
14578
+ const read = i === 0 ? { state: "container", wired: isWiredIn(source) } : await readContainer(searched[i]);
14579
+ if (read.state === "container" && read.wired) {
14580
+ wiredIn = searched[i];
14581
+ break;
14582
+ }
14583
+ if (read.state === "refused") refused.set(searched[i], read);
14584
+ }
14585
+ return { searched, wiredIn, refused, installRef };
14586
+ }
14587
+ function removalRefusal(search, target) {
14588
+ const { searched, refused, installRef } = search;
14589
+ const noEntry = searched.filter((r) => !refused.has(r));
14590
+ const clauses = [`no yaw-mcp entry in ${noEntry.map(describeContainer2).join(" or ")}`];
14591
+ for (const r of refused.values()) if (!clauses.includes(r.clause)) clauses.push(r.clause);
14592
+ const installCmd = `yaw-mcp install ${target.clientId}`;
14593
+ const blocking = installRef ? refused.get(installRef) : void 0;
14594
+ const next = blocking ? `\`${installCmd}\` ${blocking.installSays}; ${blocking.fix(`run \`${installCmd}\` and re-run this with --remove-originals`)}.` : `Run \`${installCmd}\` first, then re-run this with --remove-originals.`;
14595
+ return `${clauses.join(", and ")}, so ${target.label} would be left with no way to reach them. ${next}`;
14596
+ }
14597
+ function spliceOutOriginals(raw, site, keys, transform) {
14598
+ let next = raw;
14599
+ const removed = [];
14600
+ const unremovable = [];
14601
+ for (const key of keys) {
14602
+ try {
14603
+ const at = classifyClientConfig(next, site, { transform });
14604
+ const edits = [{ op: "remove", key }];
14605
+ const after = applyClientConfigEdits(at, edits, site);
14606
+ if (after !== next) removed.push(key);
14607
+ next = after;
14608
+ } catch (e) {
14609
+ unremovable.push(`${displayArg(key)} (${e instanceof Error ? e.message : String(e)})`);
14610
+ }
14611
+ }
14612
+ return { next, removed, unremovable };
14613
+ }
14614
+ function unremovableNote(outcome, file, unremovable, label) {
14615
+ const one = unremovable.length === 1;
14616
+ return `yaw-mcp import: ${outcome} from ${file}: ${unremovable.join("; ")}. Remove ${one ? "that entry" : "those entries"} by hand; ${label} would otherwise keep launching ${one ? "it" : "them"} alongside yaw-mcp.`;
14617
+ }
13973
14618
  async function runImport(opts) {
13974
14619
  const out = opts.out ?? createStreamWriter(process.stdout);
13975
14620
  const errOut = opts.err ?? createStreamWriter(process.stderr);
@@ -14076,13 +14721,16 @@ Nothing to import: no servers in ${displaySafe(resolved.absolute)} beyond yaw-mc
14076
14721
  reportSkips();
14077
14722
  return { exitCode: 0, written: [] };
14078
14723
  }
14724
+ const unpreviewed = /* @__PURE__ */ new Set();
14079
14725
  for (const c of candidates) {
14080
14726
  try {
14081
14727
  const preview = await previewUpsertUserBundle(c.entry, { home });
14082
14728
  for (const w of preview.warnings) warnOnce(w);
14083
14729
  c.plannedNamespace = preview.namespace ?? c.namespace;
14084
14730
  c.replacing = preview.replaced ? preview.replacing : void 0;
14731
+ if (preview.replaced) c.changes = await storedEntryChanges(preview, home, warnOnce) ?? void 0;
14085
14732
  } catch (e) {
14733
+ unpreviewed.add(c);
14086
14734
  warnOnce(`could not preview the write against bundles.json: ${e instanceof Error ? e.message : String(e)}`);
14087
14735
  }
14088
14736
  }
@@ -14115,15 +14763,107 @@ Skipped yaw-mcp's own entries: ${skippedSelf.map(displayArg).join(", ")}`);
14115
14763
  `warning: namespace collision -- ${keys.map(displayArg).join(" and ")} both derive "${ns}", so only the last one imported keeps that namespace. Rename one in ${displaySafe(resolved.absolute)} and re-run, or edit the namespace in bundles.json.`
14116
14764
  );
14117
14765
  }
14766
+ const changing = candidates.filter((c) => c.changes !== void 0);
14118
14767
  if (opts.dryRun) {
14768
+ if (changing.length > 0) print("");
14769
+ for (const c of changing) {
14770
+ const how = opts.force ? "--force" : "a real run asks first, and off a terminal needs --force";
14771
+ print(`Would overwrite the "${displaySafe(c.plannedNamespace)}" entry in bundles.json (${how}):`);
14772
+ for (const d of c.changes ?? []) print(` ${d}`);
14773
+ }
14774
+ if (opts.removeOriginals && !opts.keepOriginals) {
14775
+ const file = displaySafe(resolved.absolute);
14776
+ const planned = /* @__PURE__ */ new Map();
14777
+ for (const c of candidates) if (!unpreviewed.has(c)) planned.set(c.plannedNamespace, c);
14778
+ if (planned.size === 0) {
14779
+ printErr(
14780
+ `yaw-mcp import: would remove nothing from ${file} -- none of these servers would be imported, because their write to bundles.json could not be previewed (the warning above says why).`
14781
+ );
14782
+ } else {
14783
+ const broker = await searchForBroker(site, siteAt(targetSite, sourcePath), source, opts, home);
14784
+ if (broker.wiredIn === null) {
14785
+ printErr(`Would not remove the originals: ${removalRefusal(broker, target)}`);
14786
+ } else {
14787
+ const keys = [...planned.values()].map((c) => c.key);
14788
+ const preview = spliceOutOriginals(view.raw ?? "", siteAt(targetSite, sourcePath), keys, target.entry);
14789
+ if (preview.unremovable.length > 0) {
14790
+ printErr(unremovableNote("would not be removed", file, preview.unremovable, target.label));
14791
+ }
14792
+ const count = preview.removed.length;
14793
+ if (count === 0) {
14794
+ printErr(
14795
+ `yaw-mcp import: would remove nothing from ${file}; it would be left unchanged. The servers would be imported either way.`
14796
+ );
14797
+ } else {
14798
+ print("");
14799
+ if (broker.wiredIn !== broker.searched[0]) {
14800
+ print(`Reached through the yaw-mcp entry in ${describeContainer2(broker.wiredIn)}.`);
14801
+ }
14802
+ print(`Would remove ${count} ${count === 1 ? "entry" : "entries"} from ${file} (--remove-originals):`);
14803
+ for (const key of preview.removed) print(` ${displayArg(key)}`);
14804
+ }
14805
+ }
14806
+ }
14807
+ }
14119
14808
  print("\n--- dry run: nothing was written ---");
14120
14809
  return { exitCode: 0, written: [] };
14121
14810
  }
14811
+ const bundlesFile = displaySafe(localBundlesPath(userConfigDir(home)));
14812
+ const declined = /* @__PURE__ */ new Set();
14813
+ if (changing.length > 0) {
14814
+ let answers = null;
14815
+ if (!opts.force) {
14816
+ if (!isInteractive3(opts)) {
14817
+ const one = changing.length === 1;
14818
+ const blocks = changing.map(
14819
+ (c) => ` "${displaySafe(c.plannedNamespace)}" differs from the one importing ${displayArg(c.key)} would write:
14820
+ ` + indentLines(c.changes ?? [], " ")
14821
+ );
14822
+ printErr(
14823
+ `yaw-mcp import: ${bundlesFile} already has ${changing.length === 1 ? "an entry" : `${changing.length} entries`} this import would change, and there is no terminal to ask on. Nothing was written.
14824
+ ${blocks.join("\n")}
14825
+ Re-run with --force to overwrite ${one ? "it" : "them"}, or --dry-run to preview.`
14826
+ );
14827
+ return { exitCode: 2, written: [] };
14828
+ }
14829
+ const asked = await askBundleCollisions(changing, bundlesFile, opts.io);
14830
+ if (asked === "abort") {
14831
+ printErr("yaw-mcp import: Aborted. Nothing was written.");
14832
+ return { exitCode: 1, written: [] };
14833
+ }
14834
+ if (asked === "cancelled") {
14835
+ printErr("yaw-mcp import: Cancelled. Nothing was written.");
14836
+ return { exitCode: 130, written: [] };
14837
+ }
14838
+ answers = asked;
14839
+ }
14840
+ print("");
14841
+ for (const c of changing) {
14842
+ const ns = displaySafe(c.plannedNamespace);
14843
+ if (answers === null) {
14844
+ print(`Overwriting the "${ns}" entry in bundles.json (--force):`);
14845
+ for (const d of c.changes ?? []) print(` ${d}`);
14846
+ } else if (answers.get(c) === "overwrite") {
14847
+ print(`Overwriting the "${ns}" entry in bundles.json.`);
14848
+ } else {
14849
+ declined.add(c);
14850
+ print(`Left the "${ns}" entry in bundles.json as it is -- ${displayArg(c.key)} is not imported.`);
14851
+ }
14852
+ }
14853
+ }
14854
+ const toWrite = candidates.filter((c) => !declined.has(c));
14855
+ if (toWrite.length === 0) {
14856
+ print(
14857
+ `
14858
+ Nothing imported: every server was skipped, so bundles.json and ${displaySafe(resolved.absolute)} are unchanged.`
14859
+ );
14860
+ return { exitCode: 0, written: [] };
14861
+ }
14122
14862
  const written = [];
14123
14863
  const results = [];
14124
14864
  const writtenNamespaces = /* @__PURE__ */ new Set();
14125
14865
  let updated = 0;
14126
- for (const c of candidates) {
14866
+ for (const c of toWrite) {
14127
14867
  try {
14128
14868
  const res = await upsertUserBundle(c.entry, { home });
14129
14869
  for (const w of res.warnings) warnOnce(w);
@@ -14179,59 +14919,13 @@ If the previous entry was a different server you meant to keep, restore it from
14179
14919
  print(`Left ${displaySafe(resolved.absolute)} alone (--keep-originals).`);
14180
14920
  return { exitCode: 0, written };
14181
14921
  }
14182
- const searched = [siteAt(targetSite, sourcePath)];
14183
- let installRef = site.scope === "user" ? searched[0] : null;
14184
- for (const spec of target.scopes) {
14185
- if (spec.scope === site.scope) continue;
14186
- try {
14187
- const others = resolveInstallSites({
14188
- clientId: target.clientId,
14189
- scope: spec.scope,
14190
- os: site.os,
14191
- home,
14192
- appData: resolveAppDataDir({ appData: opts.appData, home }),
14193
- // Same env the target scope resolved with, so an env-redirected client
14194
- // is searched at its REAL other-scope path rather than the default one.
14195
- clientEnv: opts.clientEnv,
14196
- // The project the user is standing in -- the same resolution
14197
- // resolveInstallSite would have made had that scope been the target.
14198
- projectDir: spec.requiresProjectDir ? site.projectDir ?? resolvePath(opts.cwd ?? process.cwd(), ".") : void 0,
14199
- claudeConfigDir: opts.claudeConfigDir
14200
- });
14201
- for (const other of others) {
14202
- const already = searched.find(
14203
- (r) => r.resolved.absolute === other.resolved.absolute && r.resolved.containerPath.join(".") === other.resolved.containerPath.join(".")
14204
- );
14205
- const ref = already ?? other;
14206
- if (!already) searched.push(ref);
14207
- if (spec.scope === "user" && installRef === null) installRef = ref;
14208
- }
14209
- } catch {
14210
- }
14211
- }
14212
- let wiredIn = null;
14213
- const refused = /* @__PURE__ */ new Map();
14214
- for (let i = 0; i < searched.length; i++) {
14215
- const read2 = i === 0 ? { state: "container", wired: isWiredIn(source) } : await readContainer(searched[i]);
14216
- if (read2.state === "container" && read2.wired) {
14217
- wiredIn = searched[i];
14218
- break;
14219
- }
14220
- if (read2.state === "refused") refused.set(searched[i], read2);
14221
- }
14922
+ const search = await searchForBroker(site, siteAt(targetSite, sourcePath), source, opts, home);
14923
+ const wiredIn = search.wiredIn;
14222
14924
  if (!wiredIn) {
14223
- const noEntry = searched.filter((r) => !refused.has(r));
14224
- const clauses = [`no yaw-mcp entry in ${noEntry.map(describeContainer2).join(" or ")}`];
14225
- for (const r of refused.values()) if (!clauses.includes(r.clause)) clauses.push(r.clause);
14226
- const installCmd = `yaw-mcp install ${target.clientId}`;
14227
- const blocking = installRef ? refused.get(installRef) : void 0;
14228
- const next2 = blocking ? `\`${installCmd}\` ${blocking.installSays}; ${blocking.fix(`run \`${installCmd}\` and re-run this with --remove-originals`)}.` : `Run \`${installCmd}\` first, then re-run this with --remove-originals.`;
14229
- printErr(
14230
- `Not removing the originals: ${clauses.join(", and ")}, so ${target.label} would be left with no way to reach them. ${next2}`
14231
- );
14925
+ printErr(`Not removing the originals: ${removalRefusal(search, target)}`);
14232
14926
  return { exitCode: 0, written };
14233
14927
  }
14234
- if (wiredIn !== searched[0]) {
14928
+ if (wiredIn !== search.searched[0]) {
14235
14929
  print(`Reached through the yaw-mcp entry in ${describeContainer2(wiredIn)}.`);
14236
14930
  }
14237
14931
  if (!opts.removeOriginals) {
@@ -14254,26 +14948,16 @@ If the previous entry was a different server you meant to keep, restore it from
14254
14948
  return { exitCode: 0, written };
14255
14949
  }
14256
14950
  }
14257
- const removalSite = siteAt(targetSite, sourcePath);
14258
- let next = view.raw ?? "";
14259
- let removed = 0;
14260
- const unremovable = [];
14261
- for (const r of imported) {
14262
- try {
14263
- const at = classifyClientConfig(next, removalSite, { transform: target.entry });
14264
- const edits = [{ op: "remove", key: r.candidate.key }];
14265
- const after = applyClientConfigEdits(at, edits, removalSite);
14266
- if (after !== next) removed++;
14267
- next = after;
14268
- } catch (e) {
14269
- unremovable.push(`${displayArg(r.candidate.key)} (${e instanceof Error ? e.message : String(e)})`);
14270
- }
14271
- }
14272
- if (unremovable.length > 0) {
14273
- printErr(
14274
- `yaw-mcp import: could not be removed from ${displaySafe(resolved.absolute)}: ${unremovable.join("; ")}. Remove ${unremovable.length === 1 ? "that entry" : "those entries"} by hand; ${target.label} would otherwise keep launching ${unremovable.length === 1 ? "it" : "them"} alongside yaw-mcp.`
14275
- );
14951
+ const splice = spliceOutOriginals(
14952
+ view.raw ?? "",
14953
+ siteAt(targetSite, sourcePath),
14954
+ imported.map((r) => r.candidate.key),
14955
+ target.entry
14956
+ );
14957
+ if (splice.unremovable.length > 0) {
14958
+ printErr(unremovableNote("could not be removed", displaySafe(resolved.absolute), splice.unremovable, target.label));
14276
14959
  }
14960
+ const removed = splice.removed.length;
14277
14961
  if (removed === 0) {
14278
14962
  printErr(
14279
14963
  `yaw-mcp import: nothing was removed from ${displaySafe(resolved.absolute)}; it was left unchanged. The servers are imported either way.`
@@ -14281,7 +14965,7 @@ If the previous entry was a different server you meant to keep, restore it from
14281
14965
  return { exitCode: 0, written };
14282
14966
  }
14283
14967
  try {
14284
- await atomicWriteFile(resolved.absolute, terminateWithNewline(next));
14968
+ await atomicWriteFile(resolved.absolute, terminateWithNewline(splice.next));
14285
14969
  } catch (e) {
14286
14970
  printErr(
14287
14971
  `yaw-mcp import: could not write ${displaySafe(resolved.absolute)} (${e.message}). It was left unchanged; the servers are imported either way.`
@@ -16412,7 +17096,7 @@ function pushToolCall(history, record, limit = HISTORY_LIMIT) {
16412
17096
  }
16413
17097
 
16414
17098
  // src/install-nudge.ts
16415
- import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync6, statSync as statSync4, writeFileSync as writeFileSync2 } from "fs";
17099
+ import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync6, statSync as statSync5, writeFileSync as writeFileSync2 } from "fs";
16416
17100
  import { dirname as dirname8, join as join15 } from "path";
16417
17101
  var INSTALL_NUDGE_MIN_COUNT = 5;
16418
17102
  var INSTALL_NUDGE_COOLDOWN_MS = 7 * 24 * 60 * 60 * 1e3;
@@ -16433,7 +17117,7 @@ function readState(home) {
16433
17117
  return { nudges: [] };
16434
17118
  }
16435
17119
  try {
16436
- const st = statSync4(path5);
17120
+ const st = statSync5(path5);
16437
17121
  if (stateMemo && stateMemo.path === path5 && stateMemo.mtimeMs === st.mtimeMs && stateMemo.size === st.size) {
16438
17122
  return stateMemo.state;
16439
17123
  }
@@ -16479,7 +17163,7 @@ function recordNudges(clis, home, now = Date.now) {
16479
17163
  writeFileSync2(path5, `${JSON.stringify({ nudges: kept }, null, 2)}
16480
17164
  `, "utf8");
16481
17165
  try {
16482
- const st = statSync4(path5);
17166
+ const st = statSync5(path5);
16483
17167
  stateMemo = { path: path5, mtimeMs: st.mtimeMs, size: st.size, state: { nudges: kept } };
16484
17168
  } catch {
16485
17169
  stateMemo = null;
@@ -17994,7 +18678,7 @@ async function bestOfNViaSampling(server, intent, candidates, n) {
17994
18678
  import { spawn as spawn4 } from "child_process";
17995
18679
  import { randomBytes as randomBytes3, randomUUID, timingSafeEqual as timingSafeEqual2 } from "crypto";
17996
18680
  import { createServer } from "http";
17997
- import { win32 as win322 } from "path";
18681
+ import { win32 as win323 } from "path";
17998
18682
  var SECRET_ENTRY_PAGE_TTL_MS = 3 * 6e4;
17999
18683
  var MAX_BODY_BYTES = 16 * 1024;
18000
18684
  var REPLY_DRAIN_MS = 2e3;
@@ -18047,7 +18731,7 @@ ${body}
18047
18731
  function browserCommand(url, platform = process.platform, env = process.env) {
18048
18732
  if (platform === "win32") {
18049
18733
  const systemRoot = env.SystemRoot ?? env.SYSTEMROOT ?? env.windir ?? env.WINDIR ?? "C:\\Windows";
18050
- return { command: win322.join(systemRoot, "System32", "rundll32.exe"), args: ["url.dll,FileProtocolHandler", url] };
18734
+ return { command: win323.join(systemRoot, "System32", "rundll32.exe"), args: ["url.dll,FileProtocolHandler", url] };
18051
18735
  }
18052
18736
  if (platform === "darwin") return { command: "/usr/bin/open", args: [url] };
18053
18737
  if (!env.DISPLAY && !env.WAYLAND_DISPLAY) return null;
@@ -18791,7 +19475,7 @@ var ConnectServer = class _ConnectServer {
18791
19475
  static SHUTDOWN_DRAIN_MS = 2e3;
18792
19476
  constructor() {
18793
19477
  this.server = new Server(
18794
- { name: "yaw-mcp", version: true ? "1.0.15" : "dev" },
19478
+ { name: "yaw-mcp", version: true ? "1.0.17" : "dev" },
18795
19479
  {
18796
19480
  capabilities: {
18797
19481
  tools: { listChanged: true },
@@ -22579,7 +23263,7 @@ function registerShutdownTriggers(shutdown, targets) {
22579
23263
  // src/status-cmd.ts
22580
23264
  import { existsSync as existsSync10 } from "fs";
22581
23265
  import { homedir as homedir23 } from "os";
22582
- var VERSION2 = true ? "1.0.15" : "dev";
23266
+ var VERSION2 = true ? "1.0.17" : "dev";
22583
23267
  var STATUS_SCHEMA_VERSION = 1;
22584
23268
  var STATUS_USAGE = `Usage: yaw-mcp status [--json]
22585
23269
 
@@ -22935,6 +23619,11 @@ if (subcommand === "compliance") {
22935
23619
  aggregator into the client; it does NOT add a
22936
23620
  server (for that, see \`add\` below). <client> is
22937
23621
  one of: ${wrapHelpList(clientChoices("install"))}.
23622
+ For codex-cli it also adds
23623
+ mcp_optional_startup_grace_ms = 0 to config.toml
23624
+ when the file lacks it, even on a re-run over an
23625
+ entry that is already correct, and leaves a value
23626
+ you set alone (\`install --help\` has the rest).
22938
23627
  install --list Show every MCP client config location on this
22939
23628
  machine and whether yaw-mcp is wired into each.
22940
23629
  The STATUS column is about YAW-MCP, not about the
@@ -22958,8 +23647,14 @@ if (subcommand === "compliance") {
22958
23647
  \`installed\` or \`legacy\` row can add \`(other
22959
23648
  drive case)\`, for a Claude Code local-scope entry
22960
23649
  an older version left under the other
22961
- drive-letter spelling of this directory
22962
- (read-only; no writes).
23650
+ drive-letter spelling of this directory. An
23651
+ \`installed\` row can also add \`(setting
23652
+ missing)\` or \`(setting refused)\`: its file
23653
+ lacks a top-level setting install adds (Codex
23654
+ CLI's mcp_optional_startup_grace_ms), or sets it
23655
+ to a value the client will not load, and a note
23656
+ under the table says what to do. Read-only; no
23657
+ writes.
22963
23658
  install --all Install into every client yaw-mcp supports on this
22964
23659
  OS. It plans from that list, not from a probe of
22965
23660
  what you have installed (--list is the detecting
@@ -22980,8 +23675,10 @@ if (subcommand === "compliance") {
22980
23675
  you already had instead of starting empty. The
22981
23676
  client keeps launching them itself until you say
22982
23677
  otherwise, so this offers to remove the originals
22983
- (never silently). --dry-run, --scope,
22984
- --remove-originals, --keep-originals.
23678
+ (never silently). A server bundles.json already
23679
+ has in another form is asked about first, and
23680
+ off a terminal needs --force. --dry-run, --scope,
23681
+ --remove-originals, --keep-originals, --force.
22985
23682
  remove <slug> Remove a server (by slug, namespace or name) from
22986
23683
  bundles.json. Shows the server and the command it
22987
23684
  launches, then confirms; --force skips the prompt
@@ -23359,7 +24056,7 @@ if (subcommand === "compliance") {
23359
24056
  `);
23360
24057
  process.exitCode = 0;
23361
24058
  } else if (subcommand === "--version" || subcommand === "-V") {
23362
- process.stdout.write(`yaw-mcp ${true ? "1.0.15" : "dev"}
24059
+ process.stdout.write(`yaw-mcp ${true ? "1.0.17" : "dev"}
23363
24060
  `);
23364
24061
  process.exitCode = 0;
23365
24062
  } else if (subcommand !== void 0 && !subcommand.startsWith("-")) {