layermap 0.1.28 → 0.1.29

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
@@ -23050,6 +23050,7 @@ var Tracer = class {
23050
23050
  var mapRunnableTest = (file2) => /_test\.(?:go|py)$|(?:^|\/)test_[^/]*\.py$|\.(?:test|spec)\.[cm]?[jt]sx?$|(?:Test|Tests|IT)\.(?:java|kt)$/u.test(
23051
23051
  file2
23052
23052
  );
23053
+ var renamedTemplate = (file2) => file2.status === "RENAMED" && file2.basePath !== void 0 && mapMiniprogramTemplate(file2.basePath);
23053
23054
  function mapChangeImpact(store, working, base, changes, project) {
23054
23055
  const graph = new MapViewGraph(store, working);
23055
23056
  const cache = new MapViewCache();
@@ -23058,6 +23059,7 @@ function mapChangeImpact(store, working, base, changes, project) {
23058
23059
  const unclear = [];
23059
23060
  const removed = [];
23060
23061
  const declarations2 = (g, path15) => g.objectsAt(path15).filter((object2) => !mapIsModule(object2) && g.isAddressable(object2));
23062
+ const units = (g, path15) => mapMiniprogramTemplate(path15) ? g.objectsAt(path15).filter((object2) => mapIsModule(object2) && object2.parsing === "PARSED") : declarations2(g, path15);
23061
23063
  let changedCount = 0;
23062
23064
  const starts = [];
23063
23065
  const importers = /* @__PURE__ */ new Map();
@@ -23082,7 +23084,7 @@ function mapChangeImpact(store, working, base, changes, project) {
23082
23084
  if (!objects2.length) continue;
23083
23085
  const hits = /* @__PURE__ */ new Set();
23084
23086
  let topLevel = false;
23085
- const inFile = template ? objects2.filter((object2) => mapIsModule(object2) && object2.parsing === "PARSED") : declarations2(graph, file2.path);
23087
+ const inFile = units(graph, file2.path);
23086
23088
  for (const [from, to] of file2.lines) {
23087
23089
  const containing = inFile.filter(
23088
23090
  (object2) => object2.anchor.startLine <= to && from <= object2.anchor.endLine
@@ -23150,21 +23152,22 @@ function mapChangeImpact(store, working, base, changes, project) {
23150
23152
  const now = graph.objectsAt(file2?.path ?? relation.anchor.path).find((object2) => same2(graph, object2.id) === name);
23151
23153
  if (!now || relation.to === void 0) return true;
23152
23154
  const used = same2(before, relation.to);
23155
+ const tag = mapIsModule(before.object(relation.to));
23153
23156
  return !graph.relationsFrom(graph.scope(now.id).refs).some(
23154
- (use) => NAMING_KINDS.has(use.kind) && use.to !== void 0 && same2(graph, use.to) === used
23157
+ (use) => NAMING_KINDS.has(use.kind) && use.to !== void 0 && (tag ? use.target === relation.target : same2(graph, use.to) === used)
23155
23158
  );
23156
23159
  };
23157
23160
  const gone = [];
23158
23161
  for (const file2 of changes.files) {
23159
- if (!file2.basePath || !file2.baseLines.length || file2.binary || testCode(file2.basePath))
23160
- continue;
23162
+ if (!file2.basePath || file2.binary || testCode(file2.basePath)) continue;
23163
+ const renamed = renamedTemplate(file2);
23164
+ if (!file2.baseLines.length && !renamed) continue;
23161
23165
  const now = new Set(
23162
- file2.status === "DELETED" ? [] : declarations2(graph, file2.path).map(
23163
- (o) => `${o.kind}\0${graph.qualifiedName(o.id)}`
23164
- )
23166
+ file2.status === "DELETED" ? [] : units(graph, file2.path).map((o) => `${o.kind}\0${graph.qualifiedName(o.id)}`)
23165
23167
  );
23166
- for (const object2 of declarations2(before, file2.basePath)) {
23167
- if (!overlaps(file2.baseLines, object2.anchor.startLine, object2.anchor.endLine)) continue;
23168
+ for (const object2 of units(before, file2.basePath)) {
23169
+ if (!renamed && !overlaps(file2.baseLines, object2.anchor.startLine, object2.anchor.endLine))
23170
+ continue;
23168
23171
  if (now.has(`${object2.kind}\0${before.qualifiedName(object2.id)}`)) continue;
23169
23172
  const parent = before.parent(object2.id);
23170
23173
  if (parent && !mapIsModule(before.object(parent)) && gone.includes(parent)) continue;
@@ -23183,11 +23186,11 @@ function mapChangeImpact(store, working, base, changes, project) {
23183
23186
  continue;
23184
23187
  const user = before.object(owner);
23185
23188
  usedBy.add(
23186
- `${user.anchor.path}: ${mapIsModule(user) ? "top-level code" : before.qualifiedName(owner)}`
23189
+ mapIsModule(user) ? `${user.anchor.path}${mapMiniprogramTemplate(user.anchor.path) ? " (template)" : ": top-level code"}` : `${user.anchor.path}: ${before.qualifiedName(owner)}`
23187
23190
  );
23188
23191
  }
23189
23192
  removed.push({
23190
- declaration: `${file2.basePath}: ${before.qualifiedName(object2.id)} ${mapDeclarationLabel(object2)}`,
23193
+ declaration: mapIsModule(object2) ? `${file2.basePath} (template)` : `${file2.basePath}: ${before.qualifiedName(object2.id)} ${mapDeclarationLabel(object2)}`,
23191
23194
  usedBy: [...usedBy].sort()
23192
23195
  });
23193
23196
  }
@@ -23446,7 +23449,7 @@ async function checkMapChanges(input, signal) {
23446
23449
  const changes = await readMapChanges(project, input.base, signal);
23447
23450
  await index.ensureIndex(working, signal);
23448
23451
  const base = changes.files.some(
23449
- (file2) => file2.basePath !== void 0 && (file2.baseLines.length || file2.baseText !== void 0)
23452
+ (file2) => file2.basePath !== void 0 && (file2.baseLines.length || file2.baseText !== void 0 || renamedTemplate(file2))
23450
23453
  ) ? await input.baseVersion(changes.commit, signal) : void 0;
23451
23454
  const impact = mapChangeImpact(index.store, working, base, changes, project);
23452
23455
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "layermap",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
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
@@ -268,7 +268,7 @@ function layermap(pi) {
268
268
  if (server && !server.dead) return server;
269
269
  starting ??= (async () => {
270
270
  const next = new MapServer(cwd);
271
- const tools = await next.start("0.1.28");
271
+ const tools = await next.start("0.1.29");
272
272
  for (const tool of tools) {
273
273
  if (registered.has(tool.name)) continue;
274
274
  registered.add(tool.name);