layermap 0.1.56 → 0.1.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -7
- package/analyzers/project-map-java/java-map.jar +0 -0
- package/dist/cli.mjs +1085 -726
- package/dist/launcher.mjs +321 -47
- package/package.json +1 -1
- package/pi/layermap.mjs +1 -1
package/dist/launcher.mjs
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Claude Code plugin
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
1
|
+
// Starts LayerMap for an agent: its MCP server, or, given other arguments, its command line with
|
|
2
|
+
// them (the Claude Code plugin's layermap command and hooks, and the ~/.local/bin command). A machine
|
|
3
|
+
// runs one LayerMap, the version named in versions/current of its cache: every agent's plugin, the
|
|
4
|
+
// hooks and the command line start that one, so no two versions share the maps there, and a plugin
|
|
5
|
+
// names no version of its own.
|
|
6
|
+
//
|
|
7
|
+
// Only an update writes versions/current: it asks npm for the latest version, installs it beside
|
|
8
|
+
// the others, and names it once it has started and answered as a server, so a version that cannot
|
|
9
|
+
// run never becomes the machine's, and moving npm's latest back moves the machine back with it. A
|
|
10
|
+
// server's launcher updates once an hour; the command line updates only when there is no version to
|
|
11
|
+
// run, and a hook never does: it does nothing until a server or the command line has installed one.
|
|
12
|
+
//
|
|
13
|
+
// The server runs as a child of this process, which passes the agent's messages through. When
|
|
14
|
+
// versions/current names another version, this starts that one before passing on the agent's next
|
|
15
|
+
// request, introduces the session to it as the agent did to the old one, and sends the agent's
|
|
16
|
+
// requests to it from then on; the old one answers the calls it has and ends. One that cannot start
|
|
17
|
+
// leaves the session where it is. The agent starts this in the project, which stays the working
|
|
18
|
+
// directory the server maps; npm runs where it installs, so the project's own npm settings and
|
|
19
|
+
// packages play no part in it.
|
|
6
20
|
import { spawn } from "node:child_process";
|
|
7
21
|
import {
|
|
8
22
|
existsSync,
|
|
@@ -11,14 +25,24 @@ import {
|
|
|
11
25
|
readFileSync,
|
|
12
26
|
renameSync,
|
|
13
27
|
rmSync,
|
|
28
|
+
statSync,
|
|
29
|
+
utimesSync,
|
|
14
30
|
writeFileSync,
|
|
15
31
|
} from "node:fs";
|
|
16
32
|
import { homedir } from "node:os";
|
|
17
33
|
import path from "node:path";
|
|
34
|
+
import { createInterface } from "node:readline";
|
|
18
35
|
import { pathToFileURL } from "node:url";
|
|
19
36
|
|
|
20
|
-
const VERSION = __VERSION__;
|
|
21
37
|
const ARGUMENTS = __ARGUMENTS__;
|
|
38
|
+
// The oldest version this launcher starts: the first with the `layermap hook` command the plugin's
|
|
39
|
+
// hooks run, and that ends when the launcher retires it. npm must have it before a plugin with this
|
|
40
|
+
// launcher is released: a plugin that comes first finds no version it can start.
|
|
41
|
+
const MINIMUM = "0.1.57";
|
|
42
|
+
const CHECK_EVERY_MS = 60 * 60 * 1000;
|
|
43
|
+
// How long a server has to answer its introduction before this takes it for one that cannot run.
|
|
44
|
+
const START_WAIT_MS = 30_000;
|
|
45
|
+
const RETIRE = "notifications/layermap/retire";
|
|
22
46
|
|
|
23
47
|
// The same directory as installDirectory in src/agent/environment.ts: the user's cache, unless
|
|
24
48
|
// LAYERMAP_HOME names another. LAYERMAP_CACHE, which names where maps are kept, does not move it.
|
|
@@ -31,9 +55,41 @@ const directory = env.LAYERMAP_HOME
|
|
|
31
55
|
? path.join(env.LOCALAPPDATA || path.join(homedir(), "AppData", "Local"), "layermap", "Cache")
|
|
32
56
|
: path.join(env.XDG_CACHE_HOME || path.join(homedir(), ".cache"), "layermap");
|
|
33
57
|
const versions = path.join(directory, "versions");
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const
|
|
58
|
+
// Its time is when a launcher last asked npm for the latest version.
|
|
59
|
+
const checked = path.join(versions, "latest-checked");
|
|
60
|
+
const chosen = path.join(versions, "current");
|
|
61
|
+
const installed = (version) => path.join(versions, version, "node_modules", "layermap");
|
|
62
|
+
const manifest = (version) => path.join(installed(version), "package.json");
|
|
63
|
+
const entry = (version) =>
|
|
64
|
+
path.join(installed(version), JSON.parse(readFileSync(manifest(version), "utf8")).bin.layermap);
|
|
65
|
+
const log = (line) => process.stderr.write(`layermap: ${line}\n`);
|
|
66
|
+
const write = (stream, line) => stream.write(`${line}\n`);
|
|
67
|
+
// The first lines of an error, as one: npm's whole account is long.
|
|
68
|
+
const brief = (error) =>
|
|
69
|
+
String(error?.message ?? error)
|
|
70
|
+
.split("\n")
|
|
71
|
+
.slice(0, 2)
|
|
72
|
+
.join(": ");
|
|
73
|
+
|
|
74
|
+
const VERSION = /^\d+\.\d+\.\d+$/u;
|
|
75
|
+
const numbers = (version) => version.split(".").map(Number);
|
|
76
|
+
const compare = (left, right) => {
|
|
77
|
+
const [a, b] = [numbers(left), numbers(right)];
|
|
78
|
+
return a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
|
|
79
|
+
};
|
|
80
|
+
const runnable = (version) => version !== undefined && compare(version, MINIMUM) >= 0;
|
|
81
|
+
// The machine's version, when it is installed.
|
|
82
|
+
const current = () => {
|
|
83
|
+
const version = existsSync(chosen) ? readFileSync(chosen, "utf8").trim() : "";
|
|
84
|
+
return VERSION.test(version) && existsSync(manifest(version)) ? version : undefined;
|
|
85
|
+
};
|
|
86
|
+
// LayerMap removes a version other than the current one once nothing has used it for a week.
|
|
87
|
+
const touch = (version) => {
|
|
88
|
+
const file = path.join(versions, version, "last-used");
|
|
89
|
+
writeFileSync(file, "");
|
|
90
|
+
const now = new Date();
|
|
91
|
+
utimesSync(file, now, now);
|
|
92
|
+
};
|
|
37
93
|
|
|
38
94
|
// The npm of the Node running this, else the one on PATH.
|
|
39
95
|
const npm = () => {
|
|
@@ -46,63 +102,281 @@ const npm = () => {
|
|
|
46
102
|
if (process.platform === "win32") throw new Error(`no npm beside ${process.execPath}`);
|
|
47
103
|
return ["npm", []];
|
|
48
104
|
};
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// from half an install, and two starting at once both end up with the one that was renamed first.
|
|
52
|
-
// --prefer-online has npm ask the registry for the versions it has, which a cached list may lack.
|
|
53
|
-
async function install() {
|
|
54
|
-
mkdirSync(versions, { recursive: true, mode: 0o700 });
|
|
55
|
-
const staging = mkdtempSync(path.join(versions, `.${VERSION}-`));
|
|
56
|
-
process.stderr.write(`layermap: installing layermap@${VERSION} with npm\n`);
|
|
105
|
+
// --prefer-online has npm ask the registry, whose list of versions a cached one may lack.
|
|
106
|
+
const runNpm = (args, cwd) => {
|
|
57
107
|
const [command, prefix] = npm();
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"--prefix",
|
|
63
|
-
staging,
|
|
64
|
-
"--prefer-online",
|
|
65
|
-
"--omit=dev",
|
|
66
|
-
"--no-audit",
|
|
67
|
-
"--no-fund",
|
|
68
|
-
"--no-update-notifier",
|
|
69
|
-
"--loglevel=error",
|
|
70
|
-
];
|
|
71
|
-
await new Promise((resolve, reject) => {
|
|
72
|
-
const child = spawn(command, args, {
|
|
73
|
-
cwd: staging,
|
|
108
|
+
const flags = ["--prefer-online", "--no-update-notifier", "--loglevel=error"];
|
|
109
|
+
return new Promise((resolve, reject) => {
|
|
110
|
+
const child = spawn(command, [...prefix, ...args, ...flags], {
|
|
111
|
+
cwd,
|
|
74
112
|
stdio: ["ignore", "pipe", "pipe"],
|
|
75
113
|
windowsHide: true,
|
|
76
114
|
});
|
|
115
|
+
let stdout = "";
|
|
77
116
|
let output = "";
|
|
78
|
-
child.stdout.on("data", (data) =>
|
|
117
|
+
child.stdout.on("data", (data) => {
|
|
118
|
+
stdout += data;
|
|
119
|
+
output += data;
|
|
120
|
+
});
|
|
79
121
|
child.stderr.on("data", (data) => (output += data));
|
|
80
122
|
child.on("error", reject);
|
|
81
123
|
child.on("close", (code) =>
|
|
82
|
-
code === 0 ? resolve() : reject(new Error(`npm exited with ${code}\n${output.trim()}`)),
|
|
124
|
+
code === 0 ? resolve(stdout) : reject(new Error(`npm exited with ${code}\n${output.trim()}`)),
|
|
83
125
|
);
|
|
84
|
-
})
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
// npm installs into a directory of its own, renamed into place once complete, so no server starts
|
|
130
|
+
// from half an install, and two installing at once both end up with the one that was renamed first.
|
|
131
|
+
async function install(version) {
|
|
132
|
+
const staging = mkdtempSync(path.join(versions, `.${version}-`));
|
|
133
|
+
log(`installing layermap@${version} with npm`);
|
|
134
|
+
const args = ["install", `layermap@${version}`, "--prefix", staging, "--omit=dev"];
|
|
135
|
+
await runNpm([...args, "--no-audit", "--no-fund"], staging).catch((error) => {
|
|
85
136
|
rmSync(staging, { recursive: true, force: true });
|
|
86
137
|
throw error;
|
|
87
138
|
});
|
|
88
139
|
try {
|
|
89
|
-
renameSync(staging,
|
|
140
|
+
renameSync(staging, path.join(versions, version));
|
|
90
141
|
} catch (error) {
|
|
91
142
|
rmSync(staging, { recursive: true, force: true });
|
|
92
|
-
if (!existsSync(manifest)) throw error;
|
|
143
|
+
if (!existsSync(manifest(version))) throw error;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// A version's server, started with the arguments in the directory: its messages to this come to
|
|
148
|
+
// child.receive, a line at a time, its own log goes where this one's does unless kept.
|
|
149
|
+
const launch = (version, args, cwd, stderr = "inherit") => {
|
|
150
|
+
const child = spawn(process.execPath, [entry(version), ...args], {
|
|
151
|
+
cwd,
|
|
152
|
+
stdio: ["pipe", "pipe", stderr],
|
|
153
|
+
windowsHide: true,
|
|
154
|
+
});
|
|
155
|
+
child.version = version;
|
|
156
|
+
child.receive = () => {};
|
|
157
|
+
// A server that has ended takes no more lines; what this writes it then is dropped.
|
|
158
|
+
child.stdin.on("error", () => {});
|
|
159
|
+
createInterface({ input: child.stdout, crlfDelay: Infinity }).on("line", (line) =>
|
|
160
|
+
child.receive(line),
|
|
161
|
+
);
|
|
162
|
+
return child;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Sends the server an initialize request and waits for its answer: false when it ends first, or
|
|
166
|
+
// takes longer than START_WAIT_MS. Its other messages meanwhile go to `other`.
|
|
167
|
+
const INTRODUCTION = "layermap-launcher-initialize";
|
|
168
|
+
const introduce = (child, initialize, other = () => {}) =>
|
|
169
|
+
new Promise((resolve) => {
|
|
170
|
+
const done = (answered) => {
|
|
171
|
+
clearTimeout(timer);
|
|
172
|
+
child.receive = other;
|
|
173
|
+
resolve(answered);
|
|
174
|
+
};
|
|
175
|
+
const timer = setTimeout(() => done(false), START_WAIT_MS);
|
|
176
|
+
child.once("close", () => done(false));
|
|
177
|
+
child.receive = (line) => {
|
|
178
|
+
let message;
|
|
179
|
+
try {
|
|
180
|
+
message = JSON.parse(line);
|
|
181
|
+
} catch {}
|
|
182
|
+
if (message?.id === INTRODUCTION && message.method === undefined)
|
|
183
|
+
return done(message.result !== undefined);
|
|
184
|
+
other(line);
|
|
185
|
+
};
|
|
186
|
+
write(child.stdin, JSON.stringify({ ...initialize, id: INTRODUCTION }));
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
// Whether the version starts and answers as a server, outside any project.
|
|
190
|
+
async function starts(version) {
|
|
191
|
+
const child = launch(version, ["mcp"], versions, "pipe");
|
|
192
|
+
let output = "";
|
|
193
|
+
child.stderr.on("data", (data) => (output += data));
|
|
194
|
+
const answered = await introduce(child, {
|
|
195
|
+
jsonrpc: "2.0",
|
|
196
|
+
method: "initialize",
|
|
197
|
+
params: {
|
|
198
|
+
protocolVersion: "2025-06-18",
|
|
199
|
+
capabilities: {},
|
|
200
|
+
clientInfo: { name: "layermap-launcher", version: MINIMUM },
|
|
201
|
+
},
|
|
202
|
+
});
|
|
203
|
+
child.stdin.end();
|
|
204
|
+
setTimeout(() => child.kill(), 5_000).unref();
|
|
205
|
+
if (!answered)
|
|
206
|
+
throw new Error(
|
|
207
|
+
`layermap ${version} did not start as a server${output.trim() ? `\n${output.trim()}` : ""}`,
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// Asks npm for the latest version and makes it the machine's: installed, started once, named.
|
|
212
|
+
async function update() {
|
|
213
|
+
mkdirSync(versions, { recursive: true, mode: 0o700 });
|
|
214
|
+
writeFileSync(checked, "");
|
|
215
|
+
const latest = JSON.parse(
|
|
216
|
+
await runNpm(["view", "layermap@latest", "version", "--json"], versions),
|
|
217
|
+
);
|
|
218
|
+
if (typeof latest !== "string" || !VERSION.test(latest))
|
|
219
|
+
throw new Error(`npm names no version of layermap: ${JSON.stringify(latest)}`);
|
|
220
|
+
if (latest === current()) return;
|
|
221
|
+
if (!runnable(latest))
|
|
222
|
+
throw new Error(`npm's latest layermap is ${latest}; this launcher starts ${MINIMUM} or later`);
|
|
223
|
+
if (!existsSync(manifest(latest))) await install(latest);
|
|
224
|
+
await starts(latest);
|
|
225
|
+
writeFileSync(`${chosen}.${process.pid}`, `${latest}\n`);
|
|
226
|
+
renameSync(`${chosen}.${process.pid}`, chosen);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// The machine's version, updating first when it has none this can run, unless told not to.
|
|
230
|
+
async function machineVersion(updating) {
|
|
231
|
+
if (!runnable(current())) {
|
|
232
|
+
if (!updating) return undefined;
|
|
233
|
+
await update();
|
|
234
|
+
}
|
|
235
|
+
const version = current();
|
|
236
|
+
if (!runnable(version)) throw new Error(`no layermap ${MINIMUM} or later is installed`);
|
|
237
|
+
return version;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// The command line, in this process. A hook is optional: with no version installed it does nothing,
|
|
241
|
+
// and leaves installing to a server or the command line, as it has seconds to finish in.
|
|
242
|
+
async function command() {
|
|
243
|
+
const version = await machineVersion(ARGUMENTS[0] !== "hook");
|
|
244
|
+
if (!version) return;
|
|
245
|
+
touch(version);
|
|
246
|
+
process.argv = [process.argv[0], entry(version), ...ARGUMENTS];
|
|
247
|
+
await import(pathToFileURL(entry(version)).href);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// A message's id as a key, whatever JSON it is.
|
|
251
|
+
const key = (id) => JSON.stringify(id);
|
|
252
|
+
const parse = (line) => {
|
|
253
|
+
try {
|
|
254
|
+
return JSON.parse(line);
|
|
255
|
+
} catch {
|
|
256
|
+
return undefined;
|
|
93
257
|
}
|
|
258
|
+
};
|
|
259
|
+
const isRequest = (message) => message?.id !== undefined && message.method !== undefined;
|
|
260
|
+
const isResponse = (message) => message?.id !== undefined && message.method === undefined;
|
|
261
|
+
|
|
262
|
+
// The server, as children that this passes the agent's messages to and theirs back from.
|
|
263
|
+
async function serve() {
|
|
264
|
+
let server;
|
|
265
|
+
let initialize;
|
|
266
|
+
const servers = new Set();
|
|
267
|
+
// The server each of the agent's requests went to, for its cancellation; each server's requests
|
|
268
|
+
// to the agent, by the id this gives them, as two servers may use the same one.
|
|
269
|
+
const owners = new Map();
|
|
270
|
+
const asked = new Map();
|
|
271
|
+
let asks = 0;
|
|
272
|
+
// Versions that could not be introduced in this session, which it does not try again.
|
|
273
|
+
const failed = new Set();
|
|
274
|
+
|
|
275
|
+
const fromServer = (child) => (line) => {
|
|
276
|
+
const message = parse(line);
|
|
277
|
+
if (isRequest(message)) {
|
|
278
|
+
const id = `layermap-launcher-${++asks}`;
|
|
279
|
+
asked.set(id, { child, id: message.id });
|
|
280
|
+
return write(process.stdout, JSON.stringify({ ...message, id }));
|
|
281
|
+
}
|
|
282
|
+
if (isResponse(message)) owners.delete(key(message.id));
|
|
283
|
+
write(process.stdout, line);
|
|
284
|
+
};
|
|
285
|
+
const start = (version) => {
|
|
286
|
+
touch(version);
|
|
287
|
+
const child = launch(version, ARGUMENTS, process.cwd());
|
|
288
|
+
servers.add(child);
|
|
289
|
+
child.on("close", (code, signal) => {
|
|
290
|
+
servers.delete(child);
|
|
291
|
+
for (const [id, owner] of owners) if (owner === child) owners.delete(id);
|
|
292
|
+
for (const [id, ask] of asked) if (ask.child === child) asked.delete(id);
|
|
293
|
+
// The session ends with its server; one it has moved from goes quietly.
|
|
294
|
+
if (child === server) process.exit(code ?? (signal ? 1 : 0));
|
|
295
|
+
});
|
|
296
|
+
return child;
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
// Moves the session to the machine's version when that has changed.
|
|
300
|
+
const follow = async () => {
|
|
301
|
+
const next = current();
|
|
302
|
+
if (!runnable(next) || next === server.version || failed.has(next)) return;
|
|
303
|
+
const child = start(next);
|
|
304
|
+
if (!(await introduce(child, initialize, fromServer(child)))) {
|
|
305
|
+
failed.add(next);
|
|
306
|
+
child.kill();
|
|
307
|
+
return log(`LayerMap ${next} did not start; this session stays on ${server.version}`);
|
|
308
|
+
}
|
|
309
|
+
child.receive = fromServer(child);
|
|
310
|
+
write(child.stdin, JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" }));
|
|
311
|
+
const old = server;
|
|
312
|
+
server = child;
|
|
313
|
+
write(old.stdin, JSON.stringify({ jsonrpc: "2.0", method: RETIRE }));
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
const fromAgent = async (line) => {
|
|
317
|
+
const message = parse(line);
|
|
318
|
+
if (isRequest(message)) {
|
|
319
|
+
if (message.method === "initialize") initialize = message;
|
|
320
|
+
else if (initialize) await follow();
|
|
321
|
+
owners.set(key(message.id), server);
|
|
322
|
+
return write(server.stdin, line);
|
|
323
|
+
}
|
|
324
|
+
if (isResponse(message)) {
|
|
325
|
+
const ask = asked.get(message.id);
|
|
326
|
+
if (!ask) return write(server.stdin, line);
|
|
327
|
+
asked.delete(message.id);
|
|
328
|
+
return write(ask.child.stdin, JSON.stringify({ ...message, id: ask.id }));
|
|
329
|
+
}
|
|
330
|
+
const owner =
|
|
331
|
+
message?.method === "notifications/cancelled" && owners.get(key(message.params?.requestId));
|
|
332
|
+
write((owner || server).stdin, line);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
server = start(await machineVersion(true));
|
|
336
|
+
server.receive = fromServer(server);
|
|
337
|
+
let updating = false;
|
|
338
|
+
const tick = () => {
|
|
339
|
+
// A marker that cannot be written, in a cache someone emptied say, leaves the session running.
|
|
340
|
+
try {
|
|
341
|
+
touch(server.version);
|
|
342
|
+
} catch {}
|
|
343
|
+
const last = existsSync(checked) ? statSync(checked).mtimeMs : 0;
|
|
344
|
+
if (updating || Date.now() - last < CHECK_EVERY_MS) return;
|
|
345
|
+
updating = true;
|
|
346
|
+
update()
|
|
347
|
+
// A line, as it may fail each hour on a machine offline.
|
|
348
|
+
.catch((error) => log(`could not update LayerMap: ${brief(error)}`))
|
|
349
|
+
.finally(() => (updating = false));
|
|
350
|
+
};
|
|
351
|
+
tick();
|
|
352
|
+
setInterval(tick, 10 * 60 * 1000).unref();
|
|
353
|
+
|
|
354
|
+
// Messages are passed on in the order they come, each once the one before it is.
|
|
355
|
+
let passing = Promise.resolve();
|
|
356
|
+
const agent = createInterface({ input: process.stdin, crlfDelay: Infinity });
|
|
357
|
+
agent.on("line", (line) => {
|
|
358
|
+
passing = passing
|
|
359
|
+
.then(() => fromAgent(line))
|
|
360
|
+
.catch((error) => {
|
|
361
|
+
log(`could not pass a message to LayerMap: ${brief(error)}`);
|
|
362
|
+
process.exit(1);
|
|
363
|
+
});
|
|
364
|
+
});
|
|
365
|
+
agent.on("close", () => {
|
|
366
|
+
passing.then(() => {
|
|
367
|
+
for (const child of servers) child.stdin.end();
|
|
368
|
+
});
|
|
369
|
+
});
|
|
370
|
+
for (const signal of ["SIGTERM", "SIGINT"])
|
|
371
|
+
process.on(signal, () => {
|
|
372
|
+
for (const child of servers) child.kill(signal);
|
|
373
|
+
process.exit(1);
|
|
374
|
+
});
|
|
94
375
|
}
|
|
95
376
|
|
|
96
377
|
try {
|
|
97
|
-
|
|
98
|
-
// LayerMap removes a version once nothing has started it for a week.
|
|
99
|
-
writeFileSync(path.join(home, "last-used"), "");
|
|
100
|
-
const entry = path.join(installed, JSON.parse(readFileSync(manifest, "utf8")).bin.layermap);
|
|
101
|
-
process.argv = [process.argv[0], entry, ...ARGUMENTS];
|
|
102
|
-
await import(pathToFileURL(entry).href);
|
|
378
|
+
await (ARGUMENTS[0] === "mcp" ? serve() : command());
|
|
103
379
|
} catch (error) {
|
|
104
|
-
|
|
105
|
-
`layermap: could not start LayerMap ${VERSION}: ${error?.message ?? error}\n`,
|
|
106
|
-
);
|
|
380
|
+
log(`could not start LayerMap: ${brief(error)}`);
|
|
107
381
|
process.exit(1);
|
|
108
382
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "layermap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.57",
|
|
4
4
|
"mcpName": "io.github.coffeecoproject/layermap",
|
|
5
5
|
"description": "A layered map of a codebase for coding agents: directories, modules and call chains across TypeScript, JavaScript, Go, Python and Java.",
|
|
6
6
|
"license": "Apache-2.0",
|
package/pi/layermap.mjs
CHANGED
|
@@ -293,7 +293,7 @@ function layermap(pi) {
|
|
|
293
293
|
if (server && !server.dead) return server;
|
|
294
294
|
starting ??= (async () => {
|
|
295
295
|
const next = new MapServer(cwd);
|
|
296
|
-
const tools = await next.start("0.1.
|
|
296
|
+
const tools = await next.start("0.1.57");
|
|
297
297
|
for (const tool of tools) {
|
|
298
298
|
if (registered.has(tool.name)) continue;
|
|
299
299
|
registered.add(tool.name);
|