layermap 0.1.41 → 0.1.42

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/cli.mjs CHANGED
@@ -24081,7 +24081,7 @@ async function mapRemovedImpact(input) {
24081
24081
  );
24082
24082
  };
24083
24083
  const removed = [];
24084
- const gone = /* @__PURE__ */ new Set();
24084
+ const gone2 = /* @__PURE__ */ new Set();
24085
24085
  const goneShapes = [];
24086
24086
  for (const file2 of changes.files) {
24087
24087
  if (!file2.basePath || file2.binary || mapTestPath(file2.basePath)) continue;
@@ -24096,7 +24096,7 @@ async function mapRemovedImpact(input) {
24096
24096
  const kept = now.has(before.declarationKey(object2));
24097
24097
  if (kept && !renamed) continue;
24098
24098
  const parent = before.parent(object2.id);
24099
- if (parent && !mapIsModule(before.object(parent)) && gone.has(parent)) continue;
24099
+ if (parent && !mapIsModule(before.object(parent)) && gone2.has(parent)) continue;
24100
24100
  const inside = (ref) => before.lineage(ref).includes(object2.id);
24101
24101
  const usedBy = /* @__PURE__ */ new Set();
24102
24102
  for (const relation of before.relationsTo(
@@ -24110,7 +24110,7 @@ async function mapRemovedImpact(input) {
24110
24110
  );
24111
24111
  }
24112
24112
  if (kept && !usedBy.size) continue;
24113
- gone.add(object2.id);
24113
+ gone2.add(object2.id);
24114
24114
  goneShapes.push({
24115
24115
  shapes: mapIsShape(object2) ? [object2.id] : before.objectsAt(file2.basePath).filter((member) => inside(member.id) && mapIsShape(member)).map((member) => member.id),
24116
24116
  inside,
@@ -24198,7 +24198,7 @@ async function mapRemovedImpact(input) {
24198
24198
  continue;
24199
24199
  }
24200
24200
  const reached = event ? links.find((link) => link.kind === "REFERENCES" && link.target === event.tag)?.to : earlier.find((link) => link.to !== void 0)?.to;
24201
- if (reached === void 0 || before.lineage(reached).some((at2) => gone.has(at2))) continue;
24201
+ if (reached === void 0 || before.lineage(reached).some((at2) => gone2.has(at2))) continue;
24202
24202
  const object2 = before.object(reached);
24203
24203
  const name = mapIsModule(object2) ? `${object2.anchor.path} (template)${event ? `: ${event.event} event` : ""}` : `${object2.anchor.path}: ${before.qualifiedName(reached)} ${mapDeclarationLabel(object2)}`;
24204
24204
  const users = lost.get(name) ?? /* @__PURE__ */ new Set();
@@ -24216,8 +24216,8 @@ async function mapRemovedImpact(input) {
24216
24216
  ))
24217
24217
  topLevel.push(file2.path);
24218
24218
  }
24219
- if (gone.size) {
24220
- await beforeTracer.trace([...gone], [...gone], true);
24219
+ if (gone2.size) {
24220
+ await beforeTracer.trace([...gone2], [...gone2], true);
24221
24221
  const siteNow = (site) => {
24222
24222
  const at = site.lastIndexOf(":");
24223
24223
  const line = Number(site.slice(at + 1));
@@ -24274,7 +24274,7 @@ async function mapRemovedImpact(input) {
24274
24274
  const candidates = [];
24275
24275
  for (const ref of called) {
24276
24276
  const object2 = before.object(ref);
24277
- if (mapIsModule(object2) || mapTestPath(object2.anchor.path) || gone.has(ref)) continue;
24277
+ if (mapIsModule(object2) || mapTestPath(object2.anchor.path) || gone2.has(ref)) continue;
24278
24278
  const path19 = pathNow(object2.anchor.path);
24279
24279
  if (path19 === void 0) continue;
24280
24280
  const key = before.declarationKey(object2);
@@ -25282,7 +25282,7 @@ async function mapRouteClients(project, store, working, impact, signal) {
25282
25282
  async function compileBreaks(input, changes, base, until, signal) {
25283
25283
  const { index, working } = input;
25284
25284
  const present = changes.files.filter((file2) => file2.status !== "DELETED").map((file2) => file2.path);
25285
- const gone = changes.files.flatMap((file2) => file2.basePath ? [file2.basePath] : []);
25285
+ const gone2 = changes.files.flatMap((file2) => file2.basePath ? [file2.basePath] : []);
25286
25286
  const after = await index.findDiagnostics(
25287
25287
  {
25288
25288
  version: working,
@@ -25290,7 +25290,7 @@ async function compileBreaks(input, changes, base, until, signal) {
25290
25290
  configurations: [
25291
25291
  .../* @__PURE__ */ new Set([
25292
25292
  ...index.contextConfigurations(working, present),
25293
- ...base ? index.contextConfigurations(base, gone) : []
25293
+ ...base ? index.contextConfigurations(base, gone2) : []
25294
25294
  ])
25295
25295
  ],
25296
25296
  until
@@ -25865,14 +25865,15 @@ var DAY = 24 * 60 * 60 * 1e3;
25865
25865
  async function pruneCache(cache, project, now = Date.now(), installed = packageRoot, env = process.env) {
25866
25866
  const used = path15.join(path15.dirname(mapDatabasePath(cache, project)), "last-used");
25867
25867
  await mkdir(path15.dirname(used), { recursive: true, mode: 448 });
25868
- await writeFile(used, "");
25868
+ await writeFile(used, project);
25869
25869
  await utimes(used, now / 1e3, now / 1e3);
25870
25870
  const projects = path15.join(cache, "projects");
25871
25871
  for (const name of await readdir(projects).catch(() => [])) {
25872
25872
  const directory = path15.join(projects, name);
25873
25873
  const marker = path15.join(directory, "last-used");
25874
25874
  const last = (await stat(existsSync6(marker) ? marker : directory).catch(() => void 0))?.mtimeMs;
25875
- if (last !== void 0 && now - last > 30 * DAY)
25875
+ const owner = await readFile4(marker, "utf8").catch(() => "");
25876
+ if (last !== void 0 && now - last > 30 * DAY || owner !== "" && await gone(owner))
25876
25877
  await rm(directory, { recursive: true, force: true });
25877
25878
  }
25878
25879
  const builds = path15.join(cache, "analyzers");
@@ -25894,6 +25895,10 @@ async function pruneCache(cache, project, now = Date.now(), installed = packageR
25894
25895
  if (path15.basename(path15.dirname(installed)) === "node_modules" && path15.basename(npx) === "_npx")
25895
25896
  await pruneNpxInstalls(npx, installed, now);
25896
25897
  }
25898
+ var gone = (directory) => stat(directory).then(
25899
+ () => false,
25900
+ (error51) => error51.code === "ENOENT"
25901
+ );
25897
25902
  async function pruneVersions(versions, own, now) {
25898
25903
  const used = path15.join(own, "last-used");
25899
25904
  await writeFile(used, "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "layermap",
3
- "version": "0.1.41",
3
+ "version": "0.1.42",
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.41");
296
+ const tools = await next.start("0.1.42");
297
297
  for (const tool of tools) {
298
298
  if (registered.has(tool.name)) continue;
299
299
  registered.add(tool.name);