lensmcp 1.14.0 → 1.15.0
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/lib/cli.d.ts.map +1 -1
- package/lib/cli.js +39 -1
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/scripts/gateway-restart.sh +16 -0
package/lib/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/lib/cli.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,qDAAqD;IACrD,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,gEAAgE;IAChE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/lib/cli.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,UAAU;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,qDAAqD;IACrD,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,gEAAgE;IAChE,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAqED,wBAAsB,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,CAwChE"}
|
package/lib/cli.js
CHANGED
|
@@ -33,7 +33,11 @@ Commands:
|
|
|
33
33
|
apps/services under their hosts) AND the per-workspace
|
|
34
34
|
lens dashboard at https://lensmcp.local/<key>/. \`start\`
|
|
35
35
|
spawns it detached (pid+log in .lensmcp/); \`stop\` ends it;
|
|
36
|
-
\`status\` reports liveness.
|
|
36
|
+
\`status\` reports liveness. \`restart\` does stop→start AND
|
|
37
|
+
refreshes the nx project graph (resets the daemon) so a
|
|
38
|
+
lib/app added since boot resolves — fixing the Vite
|
|
39
|
+
"Failed to resolve import" error after adding a module.
|
|
40
|
+
Binding :443 needs privilege.
|
|
37
41
|
bridge [--cwd <dir>] [--host <h>] [--port <n>]
|
|
38
42
|
Run the standalone browser-event bridge for hosts with
|
|
39
43
|
no LensMCP build plugin (webpack, Next.js, no build).
|
|
@@ -270,6 +274,11 @@ function runGateway(ctx, args, out, err) {
|
|
|
270
274
|
return stop();
|
|
271
275
|
case 'restart':
|
|
272
276
|
stop();
|
|
277
|
+
// The nx DAEMON survives `stop()` (the gateway never owned it), so the relaunched Vite/dev
|
|
278
|
+
// servers would re-read the SAME stale project graph — a lib/app added since boot still fails
|
|
279
|
+
// to resolve (`Failed to resolve import "@scope/new-lib"`). Bust the daemon graph here so the
|
|
280
|
+
// freshly-spawned `gateway:serve` recomputes it and newly-added projects resolve.
|
|
281
|
+
refreshNxGraph(cwd, ctx.env, out);
|
|
273
282
|
return start();
|
|
274
283
|
case 'status':
|
|
275
284
|
return status();
|
|
@@ -278,6 +287,35 @@ function runGateway(ctx, args, out, err) {
|
|
|
278
287
|
return { exitCode: 2 };
|
|
279
288
|
}
|
|
280
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Bust the nx project graph before the gateway relaunches its dev servers.
|
|
292
|
+
*
|
|
293
|
+
* The dev gateway spawns each app's Vite/dev server, whose `nxViteTsPaths` alias resolver reads the
|
|
294
|
+
* nx project graph from the long-running nx DAEMON — a process the gateway never owns. So a plain
|
|
295
|
+
* `restart` (kill the gateway tree, respawn `gateway:serve`) leaves the daemon — and its STALE
|
|
296
|
+
* in-memory graph — running: the fresh Vite asks the same daemon and a lib/app added since the daemon
|
|
297
|
+
* booted still 404s (`[plugin:vite:import-analysis] Failed to resolve import "@scope/new-lib"`).
|
|
298
|
+
* (`tsc` resolves it from tsconfig paths, which is why typecheck passes while Vite fails.)
|
|
299
|
+
*
|
|
300
|
+
* Stopping the daemon (+ clearing its cached graph) forces the very next nx invocation — the
|
|
301
|
+
* relaunched `gateway:serve` — to recompute the graph from disk, so new projects resolve. We prefer
|
|
302
|
+
* the targeted `nx reset --only-daemon` (keeps the computation cache → fast) and fall back to
|
|
303
|
+
* `nx daemon --stop` on older nx. Best-effort: a failure never blocks the restart.
|
|
304
|
+
*/
|
|
305
|
+
function refreshNxGraph(cwd, env, out) {
|
|
306
|
+
const nxBin = findNxBinary(cwd);
|
|
307
|
+
if (!nxBin) {
|
|
308
|
+
out(' (graph refresh skipped — no nx binary found in the workspace)');
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const runEnv = { ...process.env, ...(env ?? {}) };
|
|
312
|
+
const tryNx = (args) => spawnSync(nxBin, args, { cwd, env: runEnv, stdio: 'ignore' }).status === 0;
|
|
313
|
+
if (tryNx(['reset', '--only-daemon']) || tryNx(['daemon', '--stop'])) {
|
|
314
|
+
out(' nx project graph refreshed — a lib/app added since boot will now resolve.');
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
out(' (graph refresh best-effort failed — if a new project does not resolve, run `nx reset`)');
|
|
318
|
+
}
|
|
281
319
|
/** Scan every project.json for the first project carrying a target whose executor
|
|
282
320
|
* is `executor`. An explicit project+target short-circuits the scan; a partial
|
|
283
321
|
* override fills the missing half from the match. */
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "lensmcp",
|
|
3
3
|
"displayName": "LensMCP",
|
|
4
4
|
"description": "The observability lens for coding agents. One command brings up the dev cluster gateway (every project.json `cluster` decl → its host on :443), the per-project lens dashboard at https://lensmcp.local/<project>/, and the MCP server your agent connects to — scoped automatically to whatever project you opened Claude Code in.",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.15.0",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "David Antoon",
|
|
8
8
|
"email": "davidmantoon@gmail.com"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Restart the LensMCP dev cluster gateway for the current project — and REFRESH the nx project
|
|
3
|
+
# graph (reset the daemon) so a lib/app added since the gateway booted actually resolves. Fixes the
|
|
4
|
+
# Vite `[plugin:vite:import-analysis] Failed to resolve import "@scope/new-lib"` error you hit after
|
|
5
|
+
# adding a new module (a plain restart re-reads the same stale daemon graph; this one busts it).
|
|
6
|
+
set -euo pipefail
|
|
7
|
+
|
|
8
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$PWD}"
|
|
9
|
+
BIN="$PROJECT_DIR/node_modules/lensmcp/bin.js"
|
|
10
|
+
|
|
11
|
+
if [ ! -f "$BIN" ]; then
|
|
12
|
+
echo "✗ lensmcp is not installed in $PROJECT_DIR." >&2
|
|
13
|
+
exit 1
|
|
14
|
+
fi
|
|
15
|
+
|
|
16
|
+
exec node "$BIN" gateway restart --cwd "$PROJECT_DIR"
|