@yawlabs/mcp 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -56,6 +56,14 @@ A `config.toml` that really does not parse is reported in TOML words by `doctor`
|
|
|
56
56
|
|
|
57
57
|
`MIN_OAM_VERSION` tracks the latest oam release as policy, and v0.16.1 is now current (published 2026-09-15); the floor was 0.15.2. A machine whose oam is older hosts its node/npx sidecars on node instead, and logs a warning naming both versions, `oam self-update` as the fix, and that yaw-mcp needs a restart afterwards. `release.sh` moved the floor and wrote this block; it did not re-run the oam hosting check that `src/oam-spawn.ts` describes.
|
|
58
58
|
|
|
59
|
+
**Changed -- the oam floor moves to 0.16.2**
|
|
60
|
+
|
|
61
|
+
`MIN_OAM_VERSION` tracks the latest oam release as policy, and v0.16.2 is now current (published 2026-09-18); the floor was 0.16.1. A machine whose oam is older hosts its node/npx sidecars on node instead, and logs a warning naming both versions, `oam self-update` as the fix, and that yaw-mcp needs a restart afterwards. `release.sh` moved the floor and wrote this block; it did not re-run the oam hosting check that `src/oam-spawn.ts` describes.
|
|
62
|
+
|
|
63
|
+
**Changed -- the oam floor moves to 0.16.3**
|
|
64
|
+
|
|
65
|
+
`MIN_OAM_VERSION` tracks the latest oam release as policy, and v0.16.3 is now current (published 2026-09-20); the floor was 0.16.2. A machine whose oam is older hosts its node/npx sidecars on node instead, and logs a warning naming both versions, `oam self-update` as the fix, and that yaw-mcp needs a restart afterwards. `release.sh` moved the floor and wrote this block; it did not re-run the oam hosting check that `src/oam-spawn.ts` describes.
|
|
66
|
+
|
|
59
67
|
## 1.0.2 -- `install --force` stops keeping the env it promised to overwrite, editing a client config stops rewriting the entry next to ours, and the install surfaces stop stating things that are not so
|
|
60
68
|
|
|
61
69
|
An audit of the install surface. Nothing in the install blocks changes how yaw-mcp brokers servers at runtime -- they are `yaw-mcp install` and the commands that share its config-writing code -- and the blocks after the `doctor` block are unrelated changes, each saying what it touches. The `--force` block is first, deliberately: it is the first of this section's script-visible changes, and the one whose difference is a credential that used to survive and no longer does. It is not the only one -- `install --all` now exits 2 where it exited 1 on a refusal-only run, `--force --repair` together now exits 2 instead of writing, and `install --list`'s STATUS column can now read `installed (other drive case)` for a Claude Code project whose entry an older version left under the other drive-letter spelling -- and each such change is called out in the block it belongs to.
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
closeSync,
|
|
8
8
|
openSync,
|
|
9
9
|
readFileSync as readFileSync3,
|
|
10
|
-
realpathSync as
|
|
10
|
+
realpathSync as realpathSync3,
|
|
11
11
|
renameSync,
|
|
12
12
|
statSync as statSync2,
|
|
13
13
|
unlinkSync,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
writeSync
|
|
16
16
|
} from "fs";
|
|
17
17
|
import { tmpdir } from "os";
|
|
18
|
-
import { dirname as
|
|
18
|
+
import { dirname as dirname3, join as join11, sep as sep2 } from "path";
|
|
19
19
|
|
|
20
20
|
// src/atomic-write.ts
|
|
21
21
|
import { chmod, lstat, mkdir, realpath, rename, stat, unlink, writeFile } from "fs/promises";
|
|
@@ -211,14 +211,14 @@ function createStreamWriter(stream) {
|
|
|
211
211
|
|
|
212
212
|
// src/upgrade-cmd.ts
|
|
213
213
|
import { spawn as spawn2 } from "child_process";
|
|
214
|
-
import { readFileSync as readFileSync2, realpathSync } from "fs";
|
|
214
|
+
import { readFileSync as readFileSync2, realpathSync as realpathSync2 } from "fs";
|
|
215
215
|
import { join as join10 } from "path";
|
|
216
216
|
|
|
217
217
|
// src/oam-spawn.ts
|
|
218
218
|
import { spawn } from "child_process";
|
|
219
|
-
import { accessSync, constants, existsSync as existsSync2, readdirSync, readFileSync, statSync } from "fs";
|
|
219
|
+
import { accessSync, constants, existsSync as existsSync2, readdirSync as readdirSync2, readFileSync, statSync } from "fs";
|
|
220
220
|
import { homedir as homedir4 } from "os";
|
|
221
|
-
import { dirname, isAbsolute as
|
|
221
|
+
import { dirname as dirname2, isAbsolute as isAbsolute7, join as join9, sep } from "path";
|
|
222
222
|
import { fileURLToPath } from "url";
|
|
223
223
|
|
|
224
224
|
// src/install-targets.ts
|
|
@@ -3452,6 +3452,104 @@ function guidePath(configDir) {
|
|
|
3452
3452
|
return path2.join(configDir, GUIDE_FILENAME);
|
|
3453
3453
|
}
|
|
3454
3454
|
|
|
3455
|
+
// src/stable-entry.ts
|
|
3456
|
+
import { lstatSync, readdirSync, realpathSync } from "fs";
|
|
3457
|
+
import { dirname, isAbsolute as isAbsolute6, resolve as resolve6 } from "path";
|
|
3458
|
+
function isEphemeralMountPath(p) {
|
|
3459
|
+
const posix = p.replace(/\\/g, "/");
|
|
3460
|
+
return posix.includes("/AppTranslocation/") || // AppImage's FUSE mount. Anchored on the `.mount_` segment the runtime
|
|
3461
|
+
// creates, NOT on `/tmp`: the mount lives under $TMPDIR, which is not
|
|
3462
|
+
// always /tmp. Matching the segment covers a relocated TMPDIR too, without
|
|
3463
|
+
// reading the AppImage runtime's own env var.
|
|
3464
|
+
/(^|\/)\.mount_/.test(posix) || // The OTHER AppImage shape, and the one easy to miss: when FUSE is
|
|
3465
|
+
// unavailable -- a container, a hardened or older distro, `--appimage-
|
|
3466
|
+
// extract-and-run` -- the runtime does not mount at all. It unpacks to
|
|
3467
|
+
// `$TMPDIR/appimage_extracted_<hash>` and deletes that on exit, so the
|
|
3468
|
+
// path is just as temporary while looking nothing like a mount. Covering
|
|
3469
|
+
// only `.mount_` meant those users had an ephemeral path baked into a
|
|
3470
|
+
// machine-global config, and no later pass could converge on it.
|
|
3471
|
+
/(^|\/)appimage_extracted_/i.test(posix);
|
|
3472
|
+
}
|
|
3473
|
+
function stableSpellingOf(entry, deps = {}) {
|
|
3474
|
+
const realpath3 = deps.realpath ?? realpathSync;
|
|
3475
|
+
let target;
|
|
3476
|
+
try {
|
|
3477
|
+
target = realpath3(entry);
|
|
3478
|
+
} catch {
|
|
3479
|
+
return entry;
|
|
3480
|
+
}
|
|
3481
|
+
const argv1 = deps.argv1 === void 0 ? process.argv[1] : deps.argv1;
|
|
3482
|
+
if (typeof argv1 === "string" && argv1.length > 0) {
|
|
3483
|
+
try {
|
|
3484
|
+
const abs = isAbsolute6(argv1) ? argv1 : resolve6(argv1);
|
|
3485
|
+
if (abs !== entry && realpath3(abs) === target) return abs;
|
|
3486
|
+
} catch {
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
return aliasSpellingOf(entry, target, deps) ?? entry;
|
|
3490
|
+
}
|
|
3491
|
+
function aliasSpellingOf(entry, target, deps) {
|
|
3492
|
+
const realpath3 = deps.realpath ?? realpathSync;
|
|
3493
|
+
const readdir = deps.readdir ?? ((p) => readdirSync(p));
|
|
3494
|
+
const isSymlink = deps.isSymlink ?? ((p) => {
|
|
3495
|
+
try {
|
|
3496
|
+
return lstatSync(p).isSymbolicLink();
|
|
3497
|
+
} catch {
|
|
3498
|
+
return false;
|
|
3499
|
+
}
|
|
3500
|
+
});
|
|
3501
|
+
for (const ancestor of ancestorsOf(entry)) {
|
|
3502
|
+
const parent = dirname(ancestor);
|
|
3503
|
+
if (parent === ancestor) continue;
|
|
3504
|
+
const sepChar = endsWithSeparator(parent) ? "" : ancestor.charAt(parent.length);
|
|
3505
|
+
const self = ancestor.slice(parent.length + sepChar.length);
|
|
3506
|
+
if (!looksLikeVersionDir(self)) continue;
|
|
3507
|
+
let names;
|
|
3508
|
+
try {
|
|
3509
|
+
names = readdir(parent);
|
|
3510
|
+
} catch {
|
|
3511
|
+
continue;
|
|
3512
|
+
}
|
|
3513
|
+
let ancestorReal;
|
|
3514
|
+
try {
|
|
3515
|
+
ancestorReal = realpath3(ancestor);
|
|
3516
|
+
} catch {
|
|
3517
|
+
continue;
|
|
3518
|
+
}
|
|
3519
|
+
for (const name of names) {
|
|
3520
|
+
if (name === self) continue;
|
|
3521
|
+
const link = parent + sepChar + name;
|
|
3522
|
+
if (!isSymlink(link)) continue;
|
|
3523
|
+
try {
|
|
3524
|
+
if (realpath3(link) !== ancestorReal) continue;
|
|
3525
|
+
const candidate = link + entry.slice(ancestor.length);
|
|
3526
|
+
if (realpath3(candidate) === target) return candidate;
|
|
3527
|
+
} catch {
|
|
3528
|
+
}
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
return null;
|
|
3532
|
+
}
|
|
3533
|
+
function endsWithSeparator(p) {
|
|
3534
|
+
const last = p.charAt(p.length - 1);
|
|
3535
|
+
return last === "/" || last === "\\";
|
|
3536
|
+
}
|
|
3537
|
+
function ancestorsOf(entry) {
|
|
3538
|
+
const out = [];
|
|
3539
|
+
let cur = dirname(entry);
|
|
3540
|
+
while (true) {
|
|
3541
|
+
const parent = dirname(cur);
|
|
3542
|
+
if (parent === cur) break;
|
|
3543
|
+
out.push(cur);
|
|
3544
|
+
cur = parent;
|
|
3545
|
+
}
|
|
3546
|
+
return out;
|
|
3547
|
+
}
|
|
3548
|
+
function looksLikeVersionDir(name) {
|
|
3549
|
+
const body = name.startsWith("v") ? name.slice(1) : name;
|
|
3550
|
+
return /^[0-9][0-9.]*([-+][0-9A-Za-z.-]+)?$/.test(body);
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3455
3553
|
// src/oam-spawn.ts
|
|
3456
3554
|
function packageName(spec) {
|
|
3457
3555
|
const start = spec.startsWith("@") ? 1 : 0;
|
|
@@ -3487,7 +3585,7 @@ function npxSpec(args) {
|
|
|
3487
3585
|
const spec = args[idx];
|
|
3488
3586
|
return spec.startsWith("-") ? null : spec;
|
|
3489
3587
|
}
|
|
3490
|
-
var MIN_OAM_VERSION = "0.16.
|
|
3588
|
+
var MIN_OAM_VERSION = "0.16.3";
|
|
3491
3589
|
var OAM_INSTALL_SH = "curl -fsSL https://oamjs.org/install.sh | sh";
|
|
3492
3590
|
var OAM_INSTALL_PS1 = "irm https://oamjs.org/install.ps1 | iex";
|
|
3493
3591
|
function oamInstallCommand(os) {
|
|
@@ -3578,7 +3676,7 @@ function isExecutableFile(candidate, platform) {
|
|
|
3578
3676
|
}
|
|
3579
3677
|
}
|
|
3580
3678
|
function resolveBinAbsolute(bin, env = process.env, platform = process.platform) {
|
|
3581
|
-
if (
|
|
3679
|
+
if (isAbsolute7(bin)) return isExecutableFile(bin, platform) ? winNormalize(bin, platform) : null;
|
|
3582
3680
|
if (bin.includes("/") || platform === "win32" && bin.includes("\\")) return null;
|
|
3583
3681
|
const pathVar = env.PATH ?? env.Path ?? env.path ?? "";
|
|
3584
3682
|
if (!pathVar) return null;
|
|
@@ -3590,7 +3688,7 @@ function resolveBinAbsolute(bin, env = process.env, platform = process.platform)
|
|
|
3590
3688
|
const clean = dir.replace(/^"|"$/g, "");
|
|
3591
3689
|
for (const ext of exts) {
|
|
3592
3690
|
const candidate = join9(clean, bin + ext);
|
|
3593
|
-
if (!
|
|
3691
|
+
if (!isAbsolute7(candidate)) continue;
|
|
3594
3692
|
if (isExecutableFile(candidate, platform)) return winNormalize(candidate, platform);
|
|
3595
3693
|
}
|
|
3596
3694
|
}
|
|
@@ -3638,7 +3736,7 @@ function createProbeCollector(max = OAM_PROBE_MAX_OUTPUT) {
|
|
|
3638
3736
|
};
|
|
3639
3737
|
}
|
|
3640
3738
|
function spawnVersionProbe(bin) {
|
|
3641
|
-
return new Promise((
|
|
3739
|
+
return new Promise((resolve7, reject) => {
|
|
3642
3740
|
let settled = false;
|
|
3643
3741
|
let timer;
|
|
3644
3742
|
const settle = (fn) => {
|
|
@@ -3671,7 +3769,7 @@ function spawnVersionProbe(bin) {
|
|
|
3671
3769
|
"close",
|
|
3672
3770
|
(code, signal) => settle(() => {
|
|
3673
3771
|
if (code === 0) {
|
|
3674
|
-
|
|
3772
|
+
resolve7(collector.result());
|
|
3675
3773
|
return;
|
|
3676
3774
|
}
|
|
3677
3775
|
const err = new Error(`oam exited ${code ?? signal}`);
|
|
@@ -3854,7 +3952,7 @@ function rewriteForOam(command, args, deps) {
|
|
|
3854
3952
|
var NPX_CACHE_MARKER = `${sep}_npx${sep}`;
|
|
3855
3953
|
function npxHashNodeModules(npxRoot) {
|
|
3856
3954
|
try {
|
|
3857
|
-
return
|
|
3955
|
+
return readdirSync2(npxRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => join9(npxRoot, e.name, "node_modules"));
|
|
3858
3956
|
} catch {
|
|
3859
3957
|
return [];
|
|
3860
3958
|
}
|
|
@@ -3941,15 +4039,15 @@ function resolveNpmCacheDir(fromUrl) {
|
|
|
3941
4039
|
const candidates = [join9(homedir4(), ".npmrc")];
|
|
3942
4040
|
for (const nodeModules of ownNodeModules(fromUrl)) {
|
|
3943
4041
|
candidates.push(
|
|
3944
|
-
join9(
|
|
4042
|
+
join9(dirname2(nodeModules), "etc", "npmrc"),
|
|
3945
4043
|
// <prefix>/node_modules (Windows)
|
|
3946
|
-
join9(
|
|
4044
|
+
join9(dirname2(dirname2(nodeModules)), "etc", "npmrc"),
|
|
3947
4045
|
// <prefix>/lib/node_modules (POSIX)
|
|
3948
4046
|
join9(nodeModules, "npm", "npmrc")
|
|
3949
4047
|
// builtin, beside npm itself
|
|
3950
4048
|
);
|
|
3951
4049
|
}
|
|
3952
|
-
const nodeDir =
|
|
4050
|
+
const nodeDir = dirname2(process.execPath);
|
|
3953
4051
|
candidates.push(
|
|
3954
4052
|
join9(nodeDir, "node_modules", "npm", "npmrc"),
|
|
3955
4053
|
// Windows layout
|
|
@@ -4001,7 +4099,7 @@ function packageEntry(pkgDir, pkg) {
|
|
|
4001
4099
|
}
|
|
4002
4100
|
if (!rel && typeof j.main === "string") rel = j.main;
|
|
4003
4101
|
if (typeof rel !== "string" || rel.length === 0) return null;
|
|
4004
|
-
const entry =
|
|
4102
|
+
const entry = isAbsolute7(rel) ? rel : join9(pkgDir, rel);
|
|
4005
4103
|
if (!existsSync2(entry)) return null;
|
|
4006
4104
|
return {
|
|
4007
4105
|
entry,
|
|
@@ -4094,11 +4192,12 @@ function notePinnedSidecar(pkg, version, source, from) {
|
|
|
4094
4192
|
}
|
|
4095
4193
|
);
|
|
4096
4194
|
}
|
|
4097
|
-
function resolveStableNpmEntry(pkg, fromUrl = import.meta.url) {
|
|
4195
|
+
function resolveStableNpmEntry(pkg, fromUrl = import.meta.url, deps = {}) {
|
|
4098
4196
|
for (const nodeModules of ownNodeModules(fromUrl)) {
|
|
4099
4197
|
if (nodeModules.includes(NPX_CACHE_MARKER)) continue;
|
|
4198
|
+
if (isEphemeralMountPath(nodeModules)) continue;
|
|
4100
4199
|
const hit = packageEntry(join9(nodeModules, ...pkg.split("/")), pkg);
|
|
4101
|
-
if (hit) return hit.entry;
|
|
4200
|
+
if (hit) return stableSpellingOf(hit.entry, deps);
|
|
4102
4201
|
}
|
|
4103
4202
|
return null;
|
|
4104
4203
|
}
|
|
@@ -4149,15 +4248,30 @@ function isOamLaunch(command, args = []) {
|
|
|
4149
4248
|
const first = args.find((a) => !/^\/[a-z]$/i.test(a));
|
|
4150
4249
|
return first !== void 0 && isOamCommand(first);
|
|
4151
4250
|
}
|
|
4152
|
-
if (
|
|
4251
|
+
if (POSIX_SHELL.test(base)) {
|
|
4153
4252
|
const dashC = args.indexOf("-c");
|
|
4154
4253
|
const payload = dashC >= 0 ? args[dashC + 1] : args[0];
|
|
4155
4254
|
if (payload === void 0) return false;
|
|
4156
4255
|
const firstToken = payload.trim().split(/\s+/)[0]?.replace(/^["']|["']$/g, "");
|
|
4157
4256
|
return firstToken !== void 0 && firstToken.length > 0 && isOamCommand(firstToken);
|
|
4158
4257
|
}
|
|
4258
|
+
if (POWERSHELL.test(base)) {
|
|
4259
|
+
const payload = powershellPayload(args);
|
|
4260
|
+
if (payload === null) return false;
|
|
4261
|
+
const firstToken = payload.trim().split(/\s+/)[0]?.replace(/^["']|["']$/g, "");
|
|
4262
|
+
return firstToken !== void 0 && firstToken.length > 0 && isOamCommand(firstToken);
|
|
4263
|
+
}
|
|
4159
4264
|
return false;
|
|
4160
4265
|
}
|
|
4266
|
+
var POSIX_SHELL = /^(sh|bash|zsh|dash|fish)$/i;
|
|
4267
|
+
var POWERSHELL = /^(pwsh|powershell)(\.exe)?$/i;
|
|
4268
|
+
var PS_COMMAND_SWITCH = /^-c(o(m(m(a(n(d)?)?)?)?)?)?$/i;
|
|
4269
|
+
function powershellPayload(args) {
|
|
4270
|
+
const i = args.findIndex((a) => PS_COMMAND_SWITCH.test(a));
|
|
4271
|
+
if (i < 0) return null;
|
|
4272
|
+
const payload = args.slice(i + 1).join(" ");
|
|
4273
|
+
return payload.trim().length > 0 ? payload : null;
|
|
4274
|
+
}
|
|
4161
4275
|
|
|
4162
4276
|
// src/upgrade-cmd.ts
|
|
4163
4277
|
var POSIX_GLOBAL_LIB_PREFIX = /^(?:[A-Za-z]:)?(?:\/usr(?:\/local)?|\/opt\/[^/]+)\/lib\/node_modules\/@yawlabs\/mcp\//;
|
|
@@ -4190,7 +4304,7 @@ ${UPGRADE_USAGE}` };
|
|
|
4190
4304
|
}
|
|
4191
4305
|
return { ok: true, options: opts };
|
|
4192
4306
|
}
|
|
4193
|
-
function detectInstallMethod(argvPath, realpath3 =
|
|
4307
|
+
function detectInstallMethod(argvPath, realpath3 = realpathSync2, resolveWhen = ["unknown"]) {
|
|
4194
4308
|
if (!argvPath) return "unknown";
|
|
4195
4309
|
const literal = classifyEntrypoint(argvPath);
|
|
4196
4310
|
if (!resolveWhen.includes(literal)) return literal;
|
|
@@ -4222,7 +4336,7 @@ function localInstallRoot(argvPath) {
|
|
|
4222
4336
|
const idx = argvPath.replace(/\\/g, "/").indexOf("/node_modules/");
|
|
4223
4337
|
return idx > 0 ? argvPath.slice(0, idx) : null;
|
|
4224
4338
|
}
|
|
4225
|
-
function runningPackageDir(argvPath, realpath3 =
|
|
4339
|
+
function runningPackageDir(argvPath, realpath3 = realpathSync2) {
|
|
4226
4340
|
if (!argvPath) return null;
|
|
4227
4341
|
const literal = packageDirOf(argvPath);
|
|
4228
4342
|
if (literal !== null) return literal;
|
|
@@ -4259,7 +4373,7 @@ function killProcessTree(child, platform = process.platform, spawnImpl = spawn2)
|
|
|
4259
4373
|
async function npmGlobalPrefix(spawnImpl) {
|
|
4260
4374
|
if (process.env.VITEST && !spawnImpl) return null;
|
|
4261
4375
|
const spawnFn = spawnImpl ?? spawn2;
|
|
4262
|
-
return new Promise((
|
|
4376
|
+
return new Promise((resolve7) => {
|
|
4263
4377
|
const child = spawnFn("npm", ["prefix", "-g"], {
|
|
4264
4378
|
shell: process.platform === "win32",
|
|
4265
4379
|
stdio: ["ignore", "pipe", "ignore"],
|
|
@@ -4270,25 +4384,25 @@ async function npmGlobalPrefix(spawnImpl) {
|
|
|
4270
4384
|
let out = "";
|
|
4271
4385
|
const timer = setTimeout(() => {
|
|
4272
4386
|
killProcessTree(child);
|
|
4273
|
-
|
|
4387
|
+
resolve7(null);
|
|
4274
4388
|
}, 3e3);
|
|
4275
4389
|
child.stdout?.on("data", (d) => {
|
|
4276
4390
|
out += String(d);
|
|
4277
4391
|
});
|
|
4278
4392
|
child.on("close", (code) => {
|
|
4279
4393
|
clearTimeout(timer);
|
|
4280
|
-
|
|
4394
|
+
resolve7(code === 0 && out.trim() ? out.trim() : null);
|
|
4281
4395
|
});
|
|
4282
4396
|
child.on("error", () => {
|
|
4283
4397
|
clearTimeout(timer);
|
|
4284
|
-
|
|
4398
|
+
resolve7(null);
|
|
4285
4399
|
});
|
|
4286
4400
|
});
|
|
4287
4401
|
}
|
|
4288
4402
|
function comparablePath(p) {
|
|
4289
4403
|
let real = p;
|
|
4290
4404
|
try {
|
|
4291
|
-
real =
|
|
4405
|
+
real = realpathSync2(p);
|
|
4292
4406
|
} catch {
|
|
4293
4407
|
}
|
|
4294
4408
|
const normalized = real.replace(/\\/g, "/");
|
|
@@ -4415,11 +4529,11 @@ async function oamFloorLines(probe) {
|
|
|
4415
4529
|
}
|
|
4416
4530
|
async function defaultRunningPrefix(argvPath) {
|
|
4417
4531
|
if (process.env.VITEST) return null;
|
|
4418
|
-
const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-
|
|
4532
|
+
const { detectRunningInstallPrefix: detectRunningInstallPrefix2 } = await import("./auto-upgrade-U5CXWGIO.js");
|
|
4419
4533
|
return detectRunningInstallPrefix2(argvPath);
|
|
4420
4534
|
}
|
|
4421
4535
|
async function defaultSpawn(cmd, args, cwd) {
|
|
4422
|
-
return new Promise((
|
|
4536
|
+
return new Promise((resolve7) => {
|
|
4423
4537
|
const child = spawn2(cmd, args, {
|
|
4424
4538
|
stdio: "inherit",
|
|
4425
4539
|
shell: process.platform === "win32",
|
|
@@ -4430,8 +4544,8 @@ async function defaultSpawn(cmd, args, cwd) {
|
|
|
4430
4544
|
// them. See internal-secret-env.ts.
|
|
4431
4545
|
env: stripInternalSecretsFromEnv(process.env)
|
|
4432
4546
|
});
|
|
4433
|
-
child.on("close", (code) =>
|
|
4434
|
-
child.on("error", () =>
|
|
4547
|
+
child.on("close", (code) => resolve7(typeof code === "number" ? code : 1));
|
|
4548
|
+
child.on("error", () => resolve7(1));
|
|
4435
4549
|
});
|
|
4436
4550
|
}
|
|
4437
4551
|
async function detectSea() {
|
|
@@ -4476,7 +4590,7 @@ async function runUpgrade(opts = {}) {
|
|
|
4476
4590
|
if (method === "global-npm") {
|
|
4477
4591
|
const rawPrefix = await (opts.runningPrefix ?? defaultRunningPrefix)(argvPath);
|
|
4478
4592
|
if (rawPrefix !== null) {
|
|
4479
|
-
const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-
|
|
4593
|
+
const { quoteArgForDisplay: quoteArgForDisplay2, quoteShellArgIfNeeded: quoteShellArgIfNeeded2 } = await import("./auto-upgrade-U5CXWGIO.js");
|
|
4480
4594
|
const spawnForm = quoteShellArgIfNeeded2(rawPrefix, opts.platform);
|
|
4481
4595
|
const displayForm = quoteArgForDisplay2(rawPrefix, opts.platform);
|
|
4482
4596
|
if (spawnForm !== null && displayForm !== null) {
|
|
@@ -4593,7 +4707,7 @@ async function runUpgrade(opts = {}) {
|
|
|
4593
4707
|
return { exitCode: 3, lines };
|
|
4594
4708
|
}
|
|
4595
4709
|
function readCurrentVersion() {
|
|
4596
|
-
return true ? "1.0.
|
|
4710
|
+
return true ? "1.0.10" : "dev";
|
|
4597
4711
|
}
|
|
4598
4712
|
|
|
4599
4713
|
// src/auto-upgrade.ts
|
|
@@ -4612,11 +4726,11 @@ function detectRunningInstallPrefix(argvPath) {
|
|
|
4612
4726
|
if (!argvPath) return null;
|
|
4613
4727
|
let resolved;
|
|
4614
4728
|
try {
|
|
4615
|
-
resolved =
|
|
4729
|
+
resolved = realpathSync3(argvPath);
|
|
4616
4730
|
} catch {
|
|
4617
4731
|
return null;
|
|
4618
4732
|
}
|
|
4619
|
-
const dir =
|
|
4733
|
+
const dir = dirname3(resolved);
|
|
4620
4734
|
const idx = dir.lastIndexOf(`${sep2}node_modules${sep2}`);
|
|
4621
4735
|
if (idx === -1) return null;
|
|
4622
4736
|
const candidate = dir.slice(0, idx);
|
|
@@ -4875,10 +4989,10 @@ function defaultSpawn2(cmd, args, onDone = () => {
|
|
|
4875
4989
|
async function maybeAutoUpgrade(deps = {}) {
|
|
4876
4990
|
const optOut = process.env.YAW_MCP_AUTO_UPGRADE;
|
|
4877
4991
|
if (optOut === "0" || optOut?.toLowerCase() === "false") return;
|
|
4878
|
-
const current = deps.currentVersion ?? (true ? "1.0.
|
|
4992
|
+
const current = deps.currentVersion ?? (true ? "1.0.10" : "dev");
|
|
4879
4993
|
if (current === "dev") return;
|
|
4880
4994
|
const argvPath = deps.argvPath ?? process.argv[1];
|
|
4881
|
-
const method = (deps.isSeaImpl ? await deps.isSeaImpl() : await detectSea()) ? "binary" : detectInstallMethod(argvPath,
|
|
4995
|
+
const method = (deps.isSeaImpl ? await deps.isSeaImpl() : await detectSea()) ? "binary" : detectInstallMethod(argvPath, realpathSync3, ["unknown", "local-node-modules"]);
|
|
4882
4996
|
const cached = (deps.checkedRecentlyImpl ?? defaultCheckedRecently)();
|
|
4883
4997
|
let latest;
|
|
4884
4998
|
if (cached !== null) {
|
|
@@ -5013,8 +5127,12 @@ export {
|
|
|
5013
5127
|
containerNounFor,
|
|
5014
5128
|
effectiveConfigFormat,
|
|
5015
5129
|
selectSites,
|
|
5130
|
+
addressOf,
|
|
5016
5131
|
unloadableConfigProblem,
|
|
5017
5132
|
unloadableConfigFix,
|
|
5133
|
+
launchOf,
|
|
5134
|
+
carryableEnvOf,
|
|
5135
|
+
carriedFieldsOf,
|
|
5018
5136
|
importViewOf,
|
|
5019
5137
|
composeEntry,
|
|
5020
5138
|
reloadDoneClause,
|
|
@@ -5064,6 +5182,9 @@ export {
|
|
|
5064
5182
|
resolveOamSpawn,
|
|
5065
5183
|
isOamCommand,
|
|
5066
5184
|
isOamLaunch,
|
|
5185
|
+
POSIX_SHELL,
|
|
5186
|
+
POWERSHELL,
|
|
5187
|
+
powershellPayload,
|
|
5067
5188
|
parseUpgradeArgs,
|
|
5068
5189
|
detectInstallMethod,
|
|
5069
5190
|
refineInstallMethod,
|
package/dist/index.js
CHANGED
|
@@ -10,13 +10,18 @@ import {
|
|
|
10
10
|
INTERNAL_SECRET_ENV_KEYS,
|
|
11
11
|
LEGACY_ENTRY_NAMES,
|
|
12
12
|
MIN_OAM_VERSION,
|
|
13
|
+
POSIX_SHELL,
|
|
14
|
+
POWERSHELL,
|
|
13
15
|
acquireUpgradeLock,
|
|
16
|
+
addressOf,
|
|
14
17
|
applyClientConfigEdits,
|
|
15
18
|
atomicWriteFile,
|
|
16
19
|
blockedContainerFix,
|
|
17
20
|
buildLaunchEntry,
|
|
18
21
|
buildUpgradePlan,
|
|
19
22
|
cacheDir,
|
|
23
|
+
carriedFieldsOf,
|
|
24
|
+
carryableEnvOf,
|
|
20
25
|
classifyClientConfig,
|
|
21
26
|
claudeCodeContainerPathVariants,
|
|
22
27
|
claudeCodeContainerPaths,
|
|
@@ -43,6 +48,7 @@ import {
|
|
|
43
48
|
isRegistrySpec,
|
|
44
49
|
isUnderHome,
|
|
45
50
|
isWin32TransientFsError,
|
|
51
|
+
launchOf,
|
|
46
52
|
log,
|
|
47
53
|
maybeAutoUpgrade,
|
|
48
54
|
nodeLaunchKind,
|
|
@@ -58,6 +64,7 @@ import {
|
|
|
58
64
|
packageName,
|
|
59
65
|
parseJsonc,
|
|
60
66
|
parseUpgradeArgs,
|
|
67
|
+
powershellPayload,
|
|
61
68
|
prepareClaudeCodeSettingsPatch,
|
|
62
69
|
probeOam,
|
|
63
70
|
quoteArgForDisplay,
|
|
@@ -93,7 +100,7 @@ import {
|
|
|
93
100
|
unparseableConfigFix,
|
|
94
101
|
userConfigDir,
|
|
95
102
|
yawModeOverlay
|
|
96
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-UTRRLFLD.js";
|
|
97
104
|
|
|
98
105
|
// src/audit-cmd.ts
|
|
99
106
|
import { homedir as homedir6 } from "os";
|
|
@@ -3196,7 +3203,7 @@ async function connectToUpstreamOnce(config, onDisconnect, onListChanged, bridge
|
|
|
3196
3203
|
if (downstreamCaps?.sampling) capabilities.sampling = downstreamCaps.sampling;
|
|
3197
3204
|
if (downstreamCaps?.roots) capabilities.roots = {};
|
|
3198
3205
|
const client = new Client(
|
|
3199
|
-
{ name: "yaw-mcp", version: true ? "1.0.
|
|
3206
|
+
{ name: "yaw-mcp", version: true ? "1.0.10" : "dev" },
|
|
3200
3207
|
{ capabilities }
|
|
3201
3208
|
);
|
|
3202
3209
|
if (bridge && capabilities.elicitation) {
|
|
@@ -6626,6 +6633,11 @@ var SUBCOMMAND_SPEC = [
|
|
|
6626
6633
|
flags: ["--json", "--help"]
|
|
6627
6634
|
},
|
|
6628
6635
|
{ name: "doctor", description: "Print diagnostic of yaw-mcp setup", flags: ["--json", "--help"] },
|
|
6636
|
+
{
|
|
6637
|
+
name: "heal",
|
|
6638
|
+
description: "Re-point client entries whose launch file no longer exists",
|
|
6639
|
+
flags: ["--json", "--dry-run", "--quiet", "--help"]
|
|
6640
|
+
},
|
|
6629
6641
|
// `servers` is not here because it no longer exists: it was deleted in
|
|
6630
6642
|
// 1.0.0, and typing it gets the retired-verb hint from RETIRED_SUBCOMMANDS
|
|
6631
6643
|
// in subcommands.ts. completion-cmd.test.ts pins it out of both this spec
|
|
@@ -11062,7 +11074,7 @@ function foldBundleWarnings(warnings, probe) {
|
|
|
11062
11074
|
const prefix = `${probe.path}:`;
|
|
11063
11075
|
return warnings.filter((w) => !w.startsWith(prefix));
|
|
11064
11076
|
}
|
|
11065
|
-
var VERSION = true ? "1.0.
|
|
11077
|
+
var VERSION = true ? "1.0.10" : "dev";
|
|
11066
11078
|
var DOCTOR_USAGE = `Usage: yaw-mcp doctor [--json]
|
|
11067
11079
|
|
|
11068
11080
|
Print a diagnostic of your yaw-mcp setup.
|
|
@@ -11144,7 +11156,8 @@ function clientLaunchWarnings(clients) {
|
|
|
11144
11156
|
for (const c of clients) {
|
|
11145
11157
|
if (!clientCannotLaunch(c)) continue;
|
|
11146
11158
|
const { client, status } = describeClient(c);
|
|
11147
|
-
const
|
|
11159
|
+
const fileLevel = c.malformed ? "malformed" : c.unreadable !== null ? "unreadable" : null;
|
|
11160
|
+
const key = fileLevel !== null ? `${c.path}\0${client}\0${fileLevel}` : `${c.path}\0${client}\0${c.containerPath.join(".")}`;
|
|
11148
11161
|
const seen = grouped.get(key);
|
|
11149
11162
|
if (seen) seen.scopes.push(c.scope);
|
|
11150
11163
|
else grouped.set(key, { path: c.path, client, scopes: [c.scope], status });
|
|
@@ -11510,6 +11523,7 @@ var DOCTOR_ENV_VARS = [
|
|
|
11510
11523
|
{ name: "YAW_MCP_DEFAULT_RUNTIME", defaultHint: "oam when installed" },
|
|
11511
11524
|
{ name: "YAW_MCP_TOOL_EXPOSURE", defaultHint: "gateway" },
|
|
11512
11525
|
{ name: "YAW_MCP_AUTO_UPGRADE", defaultHint: "default on" },
|
|
11526
|
+
{ name: "YAW_MCP_AUTO_HEAL", defaultHint: "default on" },
|
|
11513
11527
|
{ name: "YAW_MCP_SIDECAR_REFRESH", defaultHint: "default on" },
|
|
11514
11528
|
{ name: "YAW_MCP_CONFIG_RELOAD", defaultHint: "default on" },
|
|
11515
11529
|
{ name: "YAW_MCP_PREWARM", defaultHint: "default on" },
|
|
@@ -12025,6 +12039,7 @@ function* enumerateProbeSlots(opts) {
|
|
|
12025
12039
|
path: "(n/a)",
|
|
12026
12040
|
exists: false,
|
|
12027
12041
|
unavailable: true,
|
|
12042
|
+
containerPath: [],
|
|
12028
12043
|
...EMPTY_PROBE,
|
|
12029
12044
|
syntax: syntaxNameFor(effectiveConfigFormat(target.config, target.scopes[0])),
|
|
12030
12045
|
...why !== void 0 ? { unavailableReason: why } : {}
|
|
@@ -12061,7 +12076,8 @@ function* enumerateProbeSlots(opts) {
|
|
|
12061
12076
|
// The site's own format, resolved the one way the write path
|
|
12062
12077
|
// resolves it -- a row added to INSTALL_TARGETS is picked up here
|
|
12063
12078
|
// without touching this file.
|
|
12064
|
-
syntax: syntaxNameFor(site.format)
|
|
12079
|
+
syntax: syntaxNameFor(site.format),
|
|
12080
|
+
containerPath: addressOf(site).containerPath
|
|
12065
12081
|
},
|
|
12066
12082
|
read: exists2 ? { path: site.resolved.absolute, site, transform: target.entry } : null
|
|
12067
12083
|
};
|
|
@@ -12103,7 +12119,7 @@ function oamArgvTokens(command, args) {
|
|
|
12103
12119
|
if (i < 0 || !isOamCommand(args[i])) return null;
|
|
12104
12120
|
return { oam: args[i], rest: args.slice(i + 1) };
|
|
12105
12121
|
}
|
|
12106
|
-
if (
|
|
12122
|
+
if (POSIX_SHELL.test(base)) {
|
|
12107
12123
|
const dashC = args.indexOf("-c");
|
|
12108
12124
|
const payload = dashC >= 0 ? args[dashC + 1] : args[0];
|
|
12109
12125
|
if (payload === void 0) return null;
|
|
@@ -12112,11 +12128,23 @@ function oamArgvTokens(command, args) {
|
|
|
12112
12128
|
if (tokens[0] === void 0 || !isOamCommand(tokens[0])) return null;
|
|
12113
12129
|
return { oam: tokens[0], rest: tokens.slice(1) };
|
|
12114
12130
|
}
|
|
12131
|
+
if (POWERSHELL.test(base)) {
|
|
12132
|
+
const payload = powershellPayload(args);
|
|
12133
|
+
if (payload === null) return null;
|
|
12134
|
+
if (/["']/.test(payload)) return null;
|
|
12135
|
+
const tokens = payload.trim().split(/\s+/);
|
|
12136
|
+
if (tokens[0] === void 0 || !isOamCommand(tokens[0])) return null;
|
|
12137
|
+
return { oam: tokens[0], rest: tokens.slice(1) };
|
|
12138
|
+
}
|
|
12115
12139
|
return null;
|
|
12116
12140
|
}
|
|
12117
12141
|
function isForeignAbsoluteLaunch(command, platform = process.platform) {
|
|
12118
12142
|
return platform !== "win32" && /^[A-Za-z]:[\\/]/.test(command);
|
|
12119
12143
|
}
|
|
12144
|
+
function oamRunEntryPath(command, args) {
|
|
12145
|
+
const unwrapped = oamArgvTokens(command, args);
|
|
12146
|
+
return unwrapped === null ? null : oamRunEntryFromTokens(unwrapped.rest);
|
|
12147
|
+
}
|
|
12120
12148
|
function oamRunEntryFromTokens(tokens) {
|
|
12121
12149
|
const sub = tokens.findIndex((t) => !t.startsWith("-"));
|
|
12122
12150
|
if (sub < 0 || tokens[sub] !== "run") return null;
|
|
@@ -13036,6 +13064,209 @@ async function runFoundryExport(opts) {
|
|
|
13036
13064
|
return { exitCode: 0, lines };
|
|
13037
13065
|
}
|
|
13038
13066
|
|
|
13067
|
+
// src/heal-entries.ts
|
|
13068
|
+
import { statSync as statSync3 } from "fs";
|
|
13069
|
+
function norm(p, platform = process.platform) {
|
|
13070
|
+
const slashed = p.split("\\").join("/");
|
|
13071
|
+
return platform === "win32" ? slashed.toLowerCase() : slashed;
|
|
13072
|
+
}
|
|
13073
|
+
function isForeignEntry(command, entryPath, platform) {
|
|
13074
|
+
if (isForeignAbsoluteLaunch(command, platform)) return true;
|
|
13075
|
+
if (platform === "win32" && (entryPath.startsWith("/") || command.startsWith("/"))) return true;
|
|
13076
|
+
return false;
|
|
13077
|
+
}
|
|
13078
|
+
function isOwnBrokerEntry(entryPath) {
|
|
13079
|
+
return norm(entryPath).includes("/node_modules/@yawlabs/mcp/");
|
|
13080
|
+
}
|
|
13081
|
+
function isLaunchableFile(entryPath) {
|
|
13082
|
+
try {
|
|
13083
|
+
return statSync3(entryPath).isFile();
|
|
13084
|
+
} catch {
|
|
13085
|
+
return false;
|
|
13086
|
+
}
|
|
13087
|
+
}
|
|
13088
|
+
async function healStaleBrokerEntries(opts = {}) {
|
|
13089
|
+
const env = opts.env ?? process.env;
|
|
13090
|
+
if (isReadOnlyDiagnostics(env)) return { healed: [], unhealable: [] };
|
|
13091
|
+
const os = opts.os ?? CURRENT_OS;
|
|
13092
|
+
const platform = opts.platform ?? process.platform;
|
|
13093
|
+
const healed = [];
|
|
13094
|
+
const unhealable = [];
|
|
13095
|
+
let replacement = null;
|
|
13096
|
+
const replacementFor = async () => {
|
|
13097
|
+
if (replacement !== null) return replacement;
|
|
13098
|
+
let oamBinPath = null;
|
|
13099
|
+
try {
|
|
13100
|
+
oamBinPath = (await (opts.oamProbe ?? probeOam)()).binPath;
|
|
13101
|
+
} catch {
|
|
13102
|
+
oamBinPath = null;
|
|
13103
|
+
}
|
|
13104
|
+
const resolveEntry = opts.resolveOamEntry ?? resolveStableNpmEntry;
|
|
13105
|
+
replacement = { oamBinPath, oamEntry: oamBinPath === null ? null : resolveEntry("@yawlabs/mcp") };
|
|
13106
|
+
return replacement;
|
|
13107
|
+
};
|
|
13108
|
+
const seen = /* @__PURE__ */ new Set();
|
|
13109
|
+
for (const target of INSTALL_TARGETS) {
|
|
13110
|
+
for (const scope of target.scopes) {
|
|
13111
|
+
let site;
|
|
13112
|
+
try {
|
|
13113
|
+
site = resolveInstallSites({
|
|
13114
|
+
clientId: target.clientId,
|
|
13115
|
+
scope: scope.scope,
|
|
13116
|
+
os,
|
|
13117
|
+
home: opts.home,
|
|
13118
|
+
appData: opts.appData,
|
|
13119
|
+
projectDir: scope.requiresProjectDir ? opts.cwd ?? process.cwd() : void 0,
|
|
13120
|
+
claudeConfigDir: opts.claudeConfigDir
|
|
13121
|
+
})[0];
|
|
13122
|
+
} catch {
|
|
13123
|
+
continue;
|
|
13124
|
+
}
|
|
13125
|
+
if (site === void 0) continue;
|
|
13126
|
+
const resolvedSite = site;
|
|
13127
|
+
const key = `${norm(resolvedSite.resolved.absolute, platform)}::${addressOf(resolvedSite).containerPath.join(".")}`;
|
|
13128
|
+
if (seen.has(key)) continue;
|
|
13129
|
+
seen.add(key);
|
|
13130
|
+
try {
|
|
13131
|
+
const view = await readClientConfigFile(resolvedSite, { transform: target.entry });
|
|
13132
|
+
if (view.read.kind !== "ok") {
|
|
13133
|
+
if (view.read.kind !== "absent") {
|
|
13134
|
+
unhealable.push({
|
|
13135
|
+
clientId: target.clientId,
|
|
13136
|
+
scope: scope.scope,
|
|
13137
|
+
path: resolvedSite.resolved.absolute,
|
|
13138
|
+
reason: view.read.kind
|
|
13139
|
+
});
|
|
13140
|
+
}
|
|
13141
|
+
continue;
|
|
13142
|
+
}
|
|
13143
|
+
const stored = view.read.entries.find((e) => e.key === ENTRY_NAME);
|
|
13144
|
+
if (stored === void 0) continue;
|
|
13145
|
+
const launch = stored.launch ?? launchOf(stored.value);
|
|
13146
|
+
if (launch === null) continue;
|
|
13147
|
+
const entryPath = oamRunEntryPath(launch.command, launch.args);
|
|
13148
|
+
if (entryPath === null || !isOwnBrokerEntry(entryPath)) continue;
|
|
13149
|
+
if (isForeignEntry(launch.command, entryPath, platform)) continue;
|
|
13150
|
+
if (isLaunchableFile(entryPath)) continue;
|
|
13151
|
+
const { oamBinPath, oamEntry } = await replacementFor();
|
|
13152
|
+
const base = buildLaunchEntry({
|
|
13153
|
+
os,
|
|
13154
|
+
oamBinPath,
|
|
13155
|
+
oamEntry,
|
|
13156
|
+
windowsWrap: target.entry?.windowsLaunch?.broker !== "bare"
|
|
13157
|
+
});
|
|
13158
|
+
const next = composeEntry({
|
|
13159
|
+
base,
|
|
13160
|
+
transform: target.entry,
|
|
13161
|
+
os,
|
|
13162
|
+
purpose: "broker",
|
|
13163
|
+
env: carryableEnvOf(stored.value),
|
|
13164
|
+
carried: carriedFieldsOf(stored.value, target.entry)
|
|
13165
|
+
});
|
|
13166
|
+
const nextLaunch = launchOf(next);
|
|
13167
|
+
const nextEntry = nextLaunch === null ? null : oamRunEntryPath(nextLaunch.command, nextLaunch.args);
|
|
13168
|
+
if (nextEntry !== null && norm(nextEntry, platform) === norm(entryPath, platform)) continue;
|
|
13169
|
+
if (opts.dryRun !== true) {
|
|
13170
|
+
const text = applyClientConfigEdits(view, [{ op: "upsert", key: ENTRY_NAME, entry: next }], resolvedSite);
|
|
13171
|
+
await atomicWriteFile(resolvedSite.resolved.absolute, text);
|
|
13172
|
+
}
|
|
13173
|
+
healed.push({
|
|
13174
|
+
clientId: target.clientId,
|
|
13175
|
+
scope: scope.scope,
|
|
13176
|
+
path: resolvedSite.resolved.absolute,
|
|
13177
|
+
from: entryPath,
|
|
13178
|
+
to: nextEntry ?? "npx"
|
|
13179
|
+
});
|
|
13180
|
+
} catch (err) {
|
|
13181
|
+
log("warn", "Could not heal a stale yaw-mcp entry", {
|
|
13182
|
+
path: resolvedSite.resolved.absolute,
|
|
13183
|
+
error: err instanceof Error ? err.message : String(err)
|
|
13184
|
+
});
|
|
13185
|
+
}
|
|
13186
|
+
}
|
|
13187
|
+
}
|
|
13188
|
+
if (healed.length > 0) {
|
|
13189
|
+
log("info", "Re-pointed stale yaw-mcp entries whose launch file no longer existed", {
|
|
13190
|
+
count: healed.length,
|
|
13191
|
+
clients: healed.map((h) => `${h.clientId} (${h.scope})`)
|
|
13192
|
+
});
|
|
13193
|
+
}
|
|
13194
|
+
return { healed, unhealable };
|
|
13195
|
+
}
|
|
13196
|
+
async function maybeHealStaleBrokerEntries(opts = {}) {
|
|
13197
|
+
const env = opts.env ?? process.env;
|
|
13198
|
+
if (env.YAW_MCP_AUTO_HEAL === "0") return { healed: [], unhealable: [] };
|
|
13199
|
+
try {
|
|
13200
|
+
return await healStaleBrokerEntries(opts);
|
|
13201
|
+
} catch (err) {
|
|
13202
|
+
log("warn", "Stale-entry heal pass failed", {
|
|
13203
|
+
error: err instanceof Error ? err.message : String(err)
|
|
13204
|
+
});
|
|
13205
|
+
return { healed: [], unhealable: [] };
|
|
13206
|
+
}
|
|
13207
|
+
}
|
|
13208
|
+
|
|
13209
|
+
// src/heal-cmd.ts
|
|
13210
|
+
var USAGE2 = "Usage: yaw-mcp heal [--json] [--dry-run] [--quiet]\n\nRe-point yaw-mcp entries whose launch file no longer exists -- what an app\nupgrade leaves behind when it deletes the directory the entry named.\nOnly an entry yaw-mcp wrote AND that is currently broken is touched.\n\n --json Machine-readable result\n --dry-run Report what would change; write nothing\n --quiet No human transcript\n";
|
|
13211
|
+
function parseHealArgs(argv) {
|
|
13212
|
+
const options = {};
|
|
13213
|
+
for (const arg of argv) {
|
|
13214
|
+
if (arg === "--help" || arg === "-h") return { ok: false, error: USAGE2, help: true };
|
|
13215
|
+
else if (arg === "--json") options.json = true;
|
|
13216
|
+
else if (arg === "--dry-run") options.dryRun = true;
|
|
13217
|
+
else if (arg === "--quiet") options.quiet = true;
|
|
13218
|
+
else return { ok: false, error: `yaw-mcp heal: unknown option ${arg}
|
|
13219
|
+
|
|
13220
|
+
${USAGE2}` };
|
|
13221
|
+
}
|
|
13222
|
+
return { ok: true, options };
|
|
13223
|
+
}
|
|
13224
|
+
function describe(h) {
|
|
13225
|
+
return ` ${h.clientId} (${h.scope}): ${h.path}
|
|
13226
|
+
was -> ${h.from}
|
|
13227
|
+
now -> ${h.to}`;
|
|
13228
|
+
}
|
|
13229
|
+
async function runHeal(options = {}) {
|
|
13230
|
+
let result;
|
|
13231
|
+
try {
|
|
13232
|
+
result = await healStaleBrokerEntries({ dryRun: options.dryRun });
|
|
13233
|
+
} catch (err) {
|
|
13234
|
+
process.stderr.write(`yaw-mcp heal: ${err instanceof Error ? err.message : String(err)}
|
|
13235
|
+
`);
|
|
13236
|
+
return { exitCode: 1 };
|
|
13237
|
+
}
|
|
13238
|
+
const { healed, unhealable } = result;
|
|
13239
|
+
if (options.json === true) {
|
|
13240
|
+
process.stdout.write(
|
|
13241
|
+
`${JSON.stringify({ healed, unhealable, count: healed.length, dryRun: options.dryRun === true }, null, 2)}
|
|
13242
|
+
`
|
|
13243
|
+
);
|
|
13244
|
+
return { exitCode: 0 };
|
|
13245
|
+
}
|
|
13246
|
+
if (options.quiet !== true) {
|
|
13247
|
+
if (healed.length === 0) {
|
|
13248
|
+
process.stdout.write("No stale yaw-mcp entries found.\n");
|
|
13249
|
+
} else {
|
|
13250
|
+
const verb = options.dryRun === true ? "Would re-point" : "Re-pointed";
|
|
13251
|
+
process.stdout.write(
|
|
13252
|
+
`${verb} ${healed.length} stale ${healed.length === 1 ? "entry" : "entries"}:
|
|
13253
|
+
${healed.map(describe).join("\n")}
|
|
13254
|
+
` + (options.dryRun === true ? "" : "\nRestart the affected client(s) to pick this up.\n")
|
|
13255
|
+
);
|
|
13256
|
+
}
|
|
13257
|
+
if (unhealable.length > 0) {
|
|
13258
|
+
process.stdout.write(
|
|
13259
|
+
`
|
|
13260
|
+
${unhealable.length} config${unhealable.length === 1 ? "" : "s"} could not be checked:
|
|
13261
|
+
${unhealable.map((u) => ` ${u.clientId} (${u.scope}): ${u.path} -- ${u.reason}`).join("\n")}
|
|
13262
|
+
Run \`yaw-mcp doctor\` for what each one needs.
|
|
13263
|
+
`
|
|
13264
|
+
);
|
|
13265
|
+
}
|
|
13266
|
+
}
|
|
13267
|
+
return { exitCode: 0 };
|
|
13268
|
+
}
|
|
13269
|
+
|
|
13039
13270
|
// src/import-cmd.ts
|
|
13040
13271
|
import { homedir as homedir18 } from "os";
|
|
13041
13272
|
import { basename as basename3, resolve as resolvePath } from "path";
|
|
@@ -15904,7 +16135,7 @@ function pushToolCall(history, record, limit = HISTORY_LIMIT) {
|
|
|
15904
16135
|
}
|
|
15905
16136
|
|
|
15906
16137
|
// src/install-nudge.ts
|
|
15907
|
-
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync6, statSync as
|
|
16138
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync3, readFileSync as readFileSync6, statSync as statSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
15908
16139
|
import { dirname as dirname8, join as join15 } from "path";
|
|
15909
16140
|
var INSTALL_NUDGE_MIN_COUNT = 5;
|
|
15910
16141
|
var INSTALL_NUDGE_COOLDOWN_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
@@ -15925,7 +16156,7 @@ function readState(home) {
|
|
|
15925
16156
|
return { nudges: [] };
|
|
15926
16157
|
}
|
|
15927
16158
|
try {
|
|
15928
|
-
const st =
|
|
16159
|
+
const st = statSync4(path5);
|
|
15929
16160
|
if (stateMemo && stateMemo.path === path5 && stateMemo.mtimeMs === st.mtimeMs && stateMemo.size === st.size) {
|
|
15930
16161
|
return stateMemo.state;
|
|
15931
16162
|
}
|
|
@@ -15971,7 +16202,7 @@ function recordNudges(clis, home, now = Date.now) {
|
|
|
15971
16202
|
writeFileSync2(path5, `${JSON.stringify({ nudges: kept }, null, 2)}
|
|
15972
16203
|
`, "utf8");
|
|
15973
16204
|
try {
|
|
15974
|
-
const st =
|
|
16205
|
+
const st = statSync4(path5);
|
|
15975
16206
|
stateMemo = { path: path5, mtimeMs: st.mtimeMs, size: st.size, state: { nudges: kept } };
|
|
15976
16207
|
} catch {
|
|
15977
16208
|
stateMemo = null;
|
|
@@ -17928,7 +18159,7 @@ var ConnectServer = class _ConnectServer {
|
|
|
17928
18159
|
static SHUTDOWN_DRAIN_MS = 2e3;
|
|
17929
18160
|
constructor() {
|
|
17930
18161
|
this.server = new Server(
|
|
17931
|
-
{ name: "yaw-mcp", version: true ? "1.0.
|
|
18162
|
+
{ name: "yaw-mcp", version: true ? "1.0.10" : "dev" },
|
|
17932
18163
|
{
|
|
17933
18164
|
capabilities: {
|
|
17934
18165
|
tools: { listChanged: true },
|
|
@@ -18542,6 +18773,9 @@ var ConnectServer = class _ConnectServer {
|
|
|
18542
18773
|
maybeAutoUpgrade().catch((err) => log("warn", "Auto-upgrade check failed", { error: err?.message }));
|
|
18543
18774
|
maybeRefreshSidecars().catch((err) => log("warn", "Sidecar refresh check failed", { error: err?.message }));
|
|
18544
18775
|
maybeAutoPrewarmNpxCache().catch((err) => log("warn", "Auto-prewarm check failed", { error: err?.message }));
|
|
18776
|
+
maybeHealStaleBrokerEntries().catch(
|
|
18777
|
+
(err) => log("warn", "Stale-entry heal failed", { error: err?.message })
|
|
18778
|
+
);
|
|
18545
18779
|
log("info", "yaw-mcp started", {
|
|
18546
18780
|
servers: this.config?.servers.length ?? 0
|
|
18547
18781
|
});
|
|
@@ -21332,7 +21566,7 @@ function registerShutdownTriggers(shutdown, targets) {
|
|
|
21332
21566
|
// src/status-cmd.ts
|
|
21333
21567
|
import { existsSync as existsSync10 } from "fs";
|
|
21334
21568
|
import { homedir as homedir23 } from "os";
|
|
21335
|
-
var VERSION2 = true ? "1.0.
|
|
21569
|
+
var VERSION2 = true ? "1.0.10" : "dev";
|
|
21336
21570
|
var STATUS_SCHEMA_VERSION = 1;
|
|
21337
21571
|
var STATUS_USAGE = `Usage: yaw-mcp status [--json]
|
|
21338
21572
|
|
|
@@ -21514,6 +21748,7 @@ var KNOWN_SUBCOMMANDS = [
|
|
|
21514
21748
|
"list",
|
|
21515
21749
|
"status",
|
|
21516
21750
|
"doctor",
|
|
21751
|
+
"heal",
|
|
21517
21752
|
"reset-learning",
|
|
21518
21753
|
"sidecars",
|
|
21519
21754
|
"bundles",
|
|
@@ -21620,6 +21855,8 @@ if (subcommand === "compliance") {
|
|
|
21620
21855
|
);
|
|
21621
21856
|
} else if (subcommand === "doctor") {
|
|
21622
21857
|
run("doctor", parseDoctorArgs(process.argv.slice(3)), runDoctor);
|
|
21858
|
+
} else if (subcommand === "heal") {
|
|
21859
|
+
run("heal", parseHealArgs(process.argv.slice(3)), runHeal);
|
|
21623
21860
|
} else if (subcommand === "reset-learning") {
|
|
21624
21861
|
const parsed = parseResetLearningArgs(process.argv.slice(3));
|
|
21625
21862
|
if (parsed.kind === "help") {
|
|
@@ -21785,6 +22022,12 @@ if (subcommand === "compliance") {
|
|
|
21785
22022
|
local servers (ready vs. partially installed).
|
|
21786
22023
|
|
|
21787
22024
|
Maintenance:
|
|
22025
|
+
heal Re-point client entries whose launch file no
|
|
22026
|
+
longer exists -- what an app upgrade leaves
|
|
22027
|
+
behind when it deletes the directory the entry
|
|
22028
|
+
named. Only touches an entry yaw-mcp wrote that
|
|
22029
|
+
is currently broken. Runs automatically at
|
|
22030
|
+
startup; this is the manual form.
|
|
21788
22031
|
upgrade Show (or --run) the command that bumps
|
|
21789
22032
|
@yawlabs/mcp to the latest version.
|
|
21790
22033
|
sidecars install Install your servers into ~/.yaw-mcp/sidecars so
|
|
@@ -21850,6 +22093,12 @@ if (subcommand === "compliance") {
|
|
|
21850
22093
|
self-upgrade check at server startup (default:
|
|
21851
22094
|
stale global installs are upgraded in the
|
|
21852
22095
|
background -- npm, pnpm, and bun globals alike).
|
|
22096
|
+
YAW_MCP_AUTO_HEAL Set to \`0\` to disable the startup pass that
|
|
22097
|
+
re-points client entries whose launch file no
|
|
22098
|
+
longer exists -- what an app upgrade leaves
|
|
22099
|
+
behind when it deletes the directory the entry
|
|
22100
|
+
named (default: on; it only rewrites an entry
|
|
22101
|
+
yaw-mcp wrote AND that is currently broken).
|
|
21853
22102
|
YAW_MCP_CONFIG_RELOAD Set to \`0\` to stop re-reading bundles.json
|
|
21854
22103
|
while the session runs, restoring the pre-0.81
|
|
21855
22104
|
behaviour where an edit takes effect only after
|
|
@@ -22091,7 +22340,7 @@ if (subcommand === "compliance") {
|
|
|
22091
22340
|
`);
|
|
22092
22341
|
process.exitCode = 0;
|
|
22093
22342
|
} else if (subcommand === "--version" || subcommand === "-V") {
|
|
22094
|
-
process.stdout.write(`yaw-mcp ${true ? "1.0.
|
|
22343
|
+
process.stdout.write(`yaw-mcp ${true ? "1.0.10" : "dev"}
|
|
22095
22344
|
`);
|
|
22096
22345
|
process.exitCode = 0;
|
|
22097
22346
|
} else if (subcommand !== void 0 && !subcommand.startsWith("-")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yawlabs/mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"mcpName": "io.github.YawLabs/mcp",
|
|
5
5
|
"description": "MCP gateway and orchestrator: one local install fronts every MCP server for Claude Code, Cursor, and VS Code, loading tools on demand.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.md",
|