layermap 0.1.49 → 0.1.50

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
@@ -23096,6 +23096,8 @@ var LIST = Object.freeze({
23096
23096
  entries: 40,
23097
23097
  tests: 12,
23098
23098
  unclear: 20,
23099
+ /** Subjects named on the line of one kind of note to check by hand. */
23100
+ grouped: 8,
23099
23101
  stranded: 12,
23100
23102
  clients: 8,
23101
23103
  names: 6,
@@ -23534,8 +23536,17 @@ var Tracer = class {
23534
23536
  if (mapTestPath(object2.anchor.path) || this.routes.has(reached.ref)) continue;
23535
23537
  if (reached.depth === 0 && !mapMiniprogramTemplate(object2.anchor.path)) {
23536
23538
  const uses = this.usesWithoutCalls(reached.ref);
23539
+ const subject = this.where(reached.ref);
23537
23540
  this.unclear.push(
23538
- uses.length ? `${this.where(reached.ref)} has no callers in the map, and is used without a call: ${uses.join("; ")}` : mapIsShape(object2) ? `${this.where(reached.ref)} has no callers in the map, and a search for references found no use: it may be read through reflection, serialization or a value of unknown type, or be unused` : `${this.where(reached.ref)} has no callers in the map: it may be wired by a framework, called dynamically, or unused`
23541
+ uses.length ? {
23542
+ text: `${subject} has no callers in the map, and is used without a call: ${uses.join("; ")}`
23543
+ } : mapIsShape(object2) ? {
23544
+ text: `${subject} has no callers in the map, and a search for references found no use: it may be read through reflection, serialization or a value of unknown type, or be unused`,
23545
+ group: { kind: "NO_USE", subject }
23546
+ } : {
23547
+ text: `${subject} has no callers in the map: it may be wired by a framework, called dynamically, or unused`,
23548
+ group: { kind: "NO_CALLERS", subject }
23549
+ }
23539
23550
  );
23540
23551
  } else if (!mapIsShape(object2) || !reached.used && object2.kind === "PROPERTY")
23541
23552
  this.entry(this.where(reached.ref), false, reached, void 0, reached.certain, true);
@@ -23803,9 +23814,9 @@ var Tracer = class {
23803
23814
  if (object2.kind !== "METHOD" || !language || /^__\w+__$/u.test(object2.name)) return;
23804
23815
  const calls = this.memberCalls.get(`${language}\0${object2.name}`) ?? [];
23805
23816
  if (calls.length)
23806
- this.unclear.push(
23807
- `${calls.length} calls of a member named ${object2.name} on receivers of unknown type may reach ${this.graph.qualifiedName(ref)}; a text search finds them`
23808
- );
23817
+ this.unclear.push({
23818
+ text: `${calls.length} calls of a member named ${object2.name} on receivers of unknown type may reach ${this.graph.qualifiedName(ref)}; a text search finds them`
23819
+ });
23809
23820
  }
23810
23821
  entry(label, route, at, site, certain, top = false) {
23811
23822
  if (route) this.handlers.set(label, (this.handlers.get(label) ?? /* @__PURE__ */ new Set()).add(at.ref));
@@ -24505,9 +24516,9 @@ async function mapRemovedImpact(input) {
24505
24516
  for (const { shapes: inRemoved, inside, usedBy } of goneShapes)
24506
24517
  for (const shape of inRemoved) {
24507
24518
  if (beforeTracer.shapes.unread.has(shape))
24508
- unclear.push(
24509
- `${before.object(shape).anchor.path}: ${before.qualifiedName(shape)} was removed, and who used it was not read; search the code for its name`
24510
- );
24519
+ unclear.push({
24520
+ text: `${before.object(shape).anchor.path}: ${before.qualifiedName(shape)} was removed, and who used it was not read; search the code for its name`
24521
+ });
24511
24522
  const now = successors(shape);
24512
24523
  for (const { owner, anchor } of beforeTracer.shapes.uses.get(shape) ?? []) {
24513
24524
  const place = nowAt(anchor);
@@ -24526,13 +24537,13 @@ async function mapRemovedImpact(input) {
24526
24537
  }
24527
24538
  }
24528
24539
  if (unfollowed.size)
24529
- unclear.push(
24530
- `${unfollowed.size} removed fields or types are used on lines the diff left alone, and whether that code now uses what took their place was not read (${[
24540
+ unclear.push({
24541
+ text: `${unfollowed.size} removed fields or types are used on lines the diff left alone, and whether that code now uses what took their place was not read (${[
24531
24542
  ...unfollowed
24532
24543
  ].sort().slice(0, LIST.names).join(
24533
24544
  ", "
24534
24545
  )}${unfollowed.size > LIST.names ? ", \u2026" : ""}); project_find_references lists their uses`
24535
- );
24546
+ });
24536
24547
  const lost = /* @__PURE__ */ new Map();
24537
24548
  const changedAt = changedInWorkingTree(changes.files);
24538
24549
  for (const path20 of input.mappedPaths().filter(mapMiniprogramTemplate)) {
@@ -24552,9 +24563,9 @@ async function mapRemovedImpact(input) {
24552
24563
  const event = miniprogramEventOf(relation.target);
24553
24564
  const at = `${path20}:${relation.anchor.startLine}`;
24554
24565
  if (file2 && overlaps(file2.lines, relation.anchor.startLine, relation.anchor.endLine)) {
24555
- unclear.push(
24556
- event ? `${at} binds the ${event.event} event of <${event.tag}>, which it does not emit` : relation.kind === "REFERENCES" ? `${at} puts <${relation.target}>, which its registration does not find` : `${at} binds ${relation.target}, which its page or component does not register`
24557
- );
24566
+ unclear.push({
24567
+ text: event ? `${at} binds the ${event.event} event of <${event.tag}>, which it does not emit` : relation.kind === "REFERENCES" ? `${at} puts <${relation.target}>, which its registration does not find` : `${at} binds ${relation.target}, which its page or component does not register`
24568
+ });
24558
24569
  continue;
24559
24570
  }
24560
24571
  const reached = event ? links.find((link) => link.kind === "REFERENCES" && link.target === event.tag)?.to : earlier.find((link) => link.to !== void 0)?.to;
@@ -24658,11 +24669,11 @@ async function mapRemovedImpact(input) {
24658
24669
  }
24659
24670
  uncalled.sort();
24660
24671
  if (unknown2.length)
24661
- unclear.push(
24662
- `${unknown2.length} fields lost callers the diff removed, and whether others use them was not read (${unknown2.sort().slice(0, LIST.names).join(
24672
+ unclear.push({
24673
+ text: `${unknown2.length} fields lost callers the diff removed, and whether others use them was not read (${unknown2.sort().slice(0, LIST.names).join(
24663
24674
  ", "
24664
24675
  )}${unknown2.length > LIST.names ? ", \u2026" : ""}); project_find_references lists their uses`
24665
- );
24676
+ });
24666
24677
  return {
24667
24678
  removed: removed.map(({ declaration, usedBy }) => ({
24668
24679
  declaration,
@@ -24677,6 +24688,43 @@ async function mapRemovedImpact(input) {
24677
24688
  }
24678
24689
 
24679
24690
  // src/project-map-change-text.ts
24691
+ var GROUPED = {
24692
+ TOP_LEVEL: (count, subjects) => `top-level code of ${count} files changed (imports, constants or registrations): ${subjects}`,
24693
+ UNMAPPED: (count, subjects) => `${count} changed files are of kinds the map does not analyze, so their effects are not mapped: ${subjects}`,
24694
+ NO_CALLERS: (count, subjects) => `${count} changed declarations have no callers in the map: they may be wired by a framework, called dynamically, or unused (${subjects})`,
24695
+ NO_USE: (count, subjects) => `${count} changed fields or types have no callers in the map, and a search for references found no use: they may be read through reflection, serialization or a value of unknown type, or be unused (${subjects})`,
24696
+ REGISTRATION: (count, subjects) => `${count} route registrations changed; check that each route still reaches the right handler: ${subjects}`
24697
+ };
24698
+ function uncertainLines(notes) {
24699
+ const lines = [];
24700
+ const kinds = /* @__PURE__ */ new Map();
24701
+ for (const { text, group } of notes) {
24702
+ if (!group) {
24703
+ lines.push(text);
24704
+ continue;
24705
+ }
24706
+ let same3 = kinds.get(group.kind);
24707
+ if (!same3) {
24708
+ same3 = { kind: group.kind, texts: [], groups: [] };
24709
+ kinds.set(group.kind, same3);
24710
+ lines.push(same3);
24711
+ }
24712
+ same3.texts.push(text);
24713
+ same3.groups.push(group);
24714
+ }
24715
+ return lines.map((line) => {
24716
+ if (typeof line === "string") return line;
24717
+ if (line.texts.length === 1) return line.texts[0];
24718
+ const shown = line.groups.slice(0, LIST.grouped).map(
24719
+ ({ subject, route }) => route === void 0 ? subject : `${JSON.stringify(route)} at ${subject}`
24720
+ );
24721
+ const more2 = line.groups.length - shown.length;
24722
+ return GROUPED[line.kind](
24723
+ line.groups.length,
24724
+ `${shown.join(", ")}${more2 > 0 ? `, +${more2} more` : ""}`
24725
+ );
24726
+ });
24727
+ }
24680
24728
  function testNames(names, limit2 = LIST.names) {
24681
24729
  if (!names.length) return "";
24682
24730
  const tests = names.filter((name) => /(?:^|\.)(?:test|Test|should|it_)\w*$/u.test(name));
@@ -24719,7 +24767,7 @@ Nothing changed against ${changes.base}.`;
24719
24767
  );
24720
24768
  if (compile.missing.length)
24721
24769
  lines.push(
24722
- `PACKAGES NOT FOUND (${compile.missing.slice(0, LIST.names).join(", ")}${compile.missing.length > LIST.names ? `, +${compile.missing.length - LIST.names} more` : ""}): are dependencies installed in this directory? Values typed by them have no type to follow, so calls through them (framework page methods among them), their uses and compile errors are not seen, and this report can miss what the change reaches.`
24770
+ `PACKAGES NOT FOUND (${compile.missing.slice(0, LIST.names).join(", ")}${compile.missing.length > LIST.names ? `, +${compile.missing.length - LIST.names} more` : ""}): are dependencies installed in this directory? Without their types, calls through them (framework page methods among them), their uses and compile errors are not seen, so this report can miss what the change reaches.`
24723
24771
  );
24724
24772
  if (compile.unchecked.length)
24725
24773
  lines.push(
@@ -24793,7 +24841,26 @@ Nothing changed against ${changes.base}.`;
24793
24841
  `Decide for each whether it runs the way the project's layers do: code others build on (shared types, storage, utilities) should not import the features or interfaces built on it.${impact.dependencies.some((dependency) => dependency.back) ? " A cycle ties the modules together, so neither can change or be tested alone." : ""} If one runs the wrong way, move what both need into the lower module or pass it in, rather than import upward.`
24794
24842
  );
24795
24843
  }
24796
- const entry = (item) => `${item.route ? JSON.stringify(item.label) : item.label}${item.chain.length ? ` \u2192 ${item.chain.join(" \u2192 ")}` : ""}${item.removed ? ` (the diff removes it${item.site ? `; registered at ${item.site} before` : ""})` : item.site ? ` (registered at ${item.site})` : ""}`;
24844
+ const registrations = /* @__PURE__ */ new Map();
24845
+ for (const { group } of impact.unclear)
24846
+ if (group?.route !== void 0)
24847
+ registrations.set(group.route, [...registrations.get(group.route) ?? [], group.subject]);
24848
+ const certain = impact.entries.filter((e) => e.certain).slice(0, LIST.entries);
24849
+ const possible = impact.entries.filter((e) => !e.certain).slice(0, LIST.entries);
24850
+ const marked = new Set(
24851
+ [...certain, ...possible].filter((item) => item.route && !item.removed && registrations.has(item.label)).map((item) => item.label)
24852
+ );
24853
+ const label = (item) => item.route ? JSON.stringify(item.label) : item.label;
24854
+ const entry = (item) => {
24855
+ const changedAt = marked.has(item.label) ? registrations.get(item.label) ?? [] : [];
24856
+ const registered = item.site ? `registered at ${item.site}${changedAt.includes(item.site) ? ", a line the diff changed" : ""}` : "";
24857
+ const elsewhere = changedAt.filter((site) => site !== item.site);
24858
+ const where = [
24859
+ ...registered ? [registered] : [],
24860
+ ...elsewhere.length ? [`its registration at ${elsewhere.join(", ")} changed`] : []
24861
+ ];
24862
+ return `${label(item)}${item.chain.length ? ` \u2192 ${item.chain.join(" \u2192 ")}` : ""}${item.removed ? ` (the diff removes it${item.site ? `; registered at ${item.site} before` : ""})` : where.length ? ` (${where.join("; ")})` : ""}`;
24863
+ };
24797
24864
  list(
24798
24865
  "AFFECTED ENTRY POINTS (through resolved calls)",
24799
24866
  impact.entries.filter((e) => e.certain).map(entry),
@@ -24804,6 +24871,11 @@ Nothing changed against ${changes.base}.`;
24804
24871
  impact.entries.filter((e) => !e.certain).map(entry),
24805
24872
  LIST.entries
24806
24873
  );
24874
+ const listed = new Set([...certain, ...possible].map(entry));
24875
+ if (marked.size)
24876
+ lines.push(
24877
+ "Where the diff changed a route's registration, check that the route still reaches the right handler."
24878
+ );
24807
24879
  if (impact.untested) {
24808
24880
  const { changed, entries, throughRoutes, routes: routes2, missing, truncated } = impact.untested;
24809
24881
  const items = (shown, limit2) => {
@@ -24818,7 +24890,10 @@ Nothing changed against ${changes.base}.`;
24818
24890
  ` ${changed.length} of ${impact.changed.length} changed declarations are reached by none of the given tests; ${entries.length ? "the entry points above them, then the declarations:" : "the declarations:"}`
24819
24891
  );
24820
24892
  items(
24821
- entries.map((item) => `${entry(item)}${item.certain ? "" : " (possibly)"}`),
24893
+ entries.map((item) => {
24894
+ const full = entry(item);
24895
+ return `${listed.has(full) ? `${label(item)} (as listed above)` : full}${item.certain ? "" : " (possibly)"}`;
24896
+ }),
24822
24897
  LIST.entries
24823
24898
  );
24824
24899
  items(changed, LIST.changed);
@@ -24877,7 +24952,14 @@ Nothing changed against ${changes.base}.`;
24877
24952
  ];
24878
24953
  list(
24879
24954
  "CHECK BY HAND (the map cannot see these)",
24880
- [...incomplete, ...impact.unclear],
24955
+ [
24956
+ ...incomplete,
24957
+ ...uncertainLines(
24958
+ impact.unclear.filter(
24959
+ ({ group }) => group?.route === void 0 || !marked.has(group.route)
24960
+ )
24961
+ )
24962
+ ],
24881
24963
  incomplete.length + LIST.unclear
24882
24964
  );
24883
24965
  if (direct.length) {
@@ -24896,7 +24978,7 @@ Nothing changed against ${changes.base}.`;
24896
24978
  `RELATED TESTS: none call or import the changed code directly; ${indirect.length} test files import it through other modules, which a broader run covers.`
24897
24979
  );
24898
24980
  lines.push(
24899
- "Static estimate: calls through dependency injection, reflection, string dispatch, configuration and database coupling are not mapped, so an empty list does not prove the change is safe; confirm the entry points in source."
24981
+ "Static estimate: dependency injection, reflection, string dispatch, configuration and the database are not followed, so an empty list does not prove the change safe."
24900
24982
  );
24901
24983
  if (similar.length) {
24902
24984
  const declaration = (item) => `${item.path}: ${item.name} ${item.label}`;
@@ -25288,8 +25370,9 @@ async function mapChangeImpact(store, views, working, base, changes, links, shap
25288
25370
  let paths;
25289
25371
  const pathIndex = () => paths ??= mapPathIndex(mappedPaths());
25290
25372
  const topLevelChanged = (path20) => {
25291
- const note = `top-level code of ${path20} changed (imports, constants or registrations)`;
25292
- if (!unclear.includes(note)) unclear.push(note);
25373
+ const text = `top-level code of ${path20} changed (imports, constants or registrations)`;
25374
+ if (!unclear.some((note) => note.text === text))
25375
+ unclear.push({ text, group: { kind: "TOP_LEVEL", subject: path20 } });
25293
25376
  };
25294
25377
  for (const file2 of changes.files) {
25295
25378
  const objects2 = file2.status === "DELETED" || file2.binary ? [] : graph.objectsAt(file2.path);
@@ -25302,9 +25385,11 @@ async function mapChangeImpact(store, views, working, base, changes, links, shap
25302
25385
  const analyzed = file2.status === "DELETED" ? !file2.binary && (mapLanguageOf(file2.path) !== void 0 || template) : objects2.length > 0 && (mapLanguageOf(file2.path) !== void 0 || template && objects2.some((object2) => object2.parsing === "PARSED"));
25303
25386
  const kind = !analyzed || MAP_MIGRATION_PATH.test(file2.path) ? unmappedKind(file2.path, file2.binary) : void 0;
25304
25387
  if (kind) {
25305
- unclear.push(
25306
- `${file2.path} ${file2.status === "DELETED" ? "deleted" : "changed"} (${kind}): its effects are not mapped`
25307
- );
25388
+ const deleted = file2.status === "DELETED";
25389
+ unclear.push({
25390
+ text: `${file2.path} ${deleted ? "deleted" : "changed"} (${kind}): its effects are not mapped`,
25391
+ group: { kind: "UNMAPPED", subject: `${file2.path}${deleted ? " deleted" : ""} (${kind})` }
25392
+ });
25308
25393
  unmapped.push({ path: file2.path, kind });
25309
25394
  }
25310
25395
  if (!objects2.length) continue;
@@ -25322,10 +25407,13 @@ async function mapChangeImpact(store, views, working, base, changes, links, shap
25322
25407
  }
25323
25408
  for (const relation of graph.relationsFrom(objects2.map((object2) => object2.id))) {
25324
25409
  const route = mapRegisteredRoute(relation);
25325
- if (route && overlaps(file2.lines, relation.anchor.startLine, relation.anchor.endLine))
25326
- unclear.push(
25327
- `the registration of ${JSON.stringify(route)} at ${relation.anchor.path}:${relation.anchor.startLine} changed; check that the route still reaches the right handler`
25328
- );
25410
+ if (route && overlaps(file2.lines, relation.anchor.startLine, relation.anchor.endLine)) {
25411
+ const site = `${relation.anchor.path}:${relation.anchor.startLine}`;
25412
+ unclear.push({
25413
+ text: `the registration of ${JSON.stringify(route)} at ${site} changed; check that the route still reaches the right handler`,
25414
+ group: { kind: "REGISTRATION", subject: site, route }
25415
+ });
25416
+ }
25329
25417
  }
25330
25418
  if (analyzed && topLevel && file2.status !== "ADDED") topLevelChanged(file2.path);
25331
25419
  importerTests(graph, objects2, tracer, importers);
@@ -25378,11 +25466,11 @@ async function mapChangeImpact(store, views, working, base, changes, links, shap
25378
25466
  await tracer.release(climbing);
25379
25467
  }
25380
25468
  if (unfound.length)
25381
- unclear.push(
25382
- `no test is found to request ${unfound.length > 1 ? `${unfound.length} routes the change reaches (` : ""}${unfound.slice(0, LIST.names).map((label) => JSON.stringify(label)).join(
25469
+ unclear.push({
25470
+ text: `no test is found to request ${unfound.length > 1 ? `${unfound.length} routes the change reaches (` : ""}${unfound.slice(0, LIST.names).map((label) => JSON.stringify(label)).join(
25383
25471
  ", "
25384
25472
  )}${unfound.length > LIST.names ? ", \u2026" : ""}${unfound.length > 1 ? ")" : ""}: a test requesting ${unfound.length > 1 ? "them" : "it"} in a way the map does not read is not selected`
25385
- );
25473
+ });
25386
25474
  if (tracer.held.size) await unworkedRequests(routeRequests(), tracer, reaching);
25387
25475
  if (requests?.unsearched)
25388
25476
  incomplete.push(
@@ -25390,11 +25478,11 @@ async function mapChangeImpact(store, views, working, base, changes, links, shap
25390
25478
  );
25391
25479
  const unread = [...tracer.shapes.unread];
25392
25480
  if (unread.length)
25393
- unclear.push(
25394
- `who uses ${unread.length} fields or types the change reaches was not read, so what they affect is not known (${unread.slice(0, LIST.names).map((ref) => graph.qualifiedName(ref)).join(
25481
+ unclear.push({
25482
+ text: `who uses ${unread.length} fields or types the change reaches was not read, so what they affect is not known (${unread.slice(0, LIST.names).map((ref) => graph.qualifiedName(ref)).join(
25395
25483
  ", "
25396
25484
  )}${unread.length > LIST.names ? ", \u2026" : ""}); project_find_references lists their uses`
25397
- );
25485
+ });
25398
25486
  const untested = tests && await untestedChanges(graph, tracer, memberCalls, starts, changed, tests);
25399
25487
  supportTests(store, working, tracer);
25400
25488
  const taken = base ? await mapRemovedImpact({
@@ -25429,7 +25517,9 @@ async function mapChangeImpact(store, views, working, base, changes, links, shap
25429
25517
  through: [...known.through].sort(),
25430
25518
  tests: [...known.tests].map(([path20, names]) => ({ path: path20, names: [...names].sort() })).sort((left, right) => right.names.length - left.names.length)
25431
25519
  })).sort((left, right) => right.tests.length - left.tests.length),
25432
- unclear: [.../* @__PURE__ */ new Set([...unclear, ...tracer.unclear])],
25520
+ unclear: [
25521
+ ...new Map([...unclear, ...tracer.unclear].map((note) => [note.text, note])).values()
25522
+ ],
25433
25523
  incomplete: [
25434
25524
  ...incomplete,
25435
25525
  ...tracer.truncated ? [
@@ -25518,7 +25608,7 @@ function mapChangesData(changes, impact, edges) {
25518
25608
  tests: impact.tests,
25519
25609
  unmapped: impact.unmapped,
25520
25610
  incomplete: impact.incomplete,
25521
- checkByHand: impact.unclear,
25611
+ checkByHand: impact.unclear.map(({ text }) => text),
25522
25612
  truncated: impact.truncated,
25523
25613
  ...impact.untested ? { untested: impact.untested } : {},
25524
25614
  edges
@@ -26379,7 +26469,7 @@ var mapToolDescriptions = (host) => {
26379
26469
  return Object.freeze({
26380
26470
  search: `${lead("search")}Find declarations and files whose names, paths or source documentation match query terms. ANY (default) matches any term, ALL requires every term, LITERAL matches the exact text. Results are ranked by relevance and grouped by file with the declaration name, kind, 1-based line range and matched fields (${MAP_KINDS_LEGEND}). Zoom into a result with project_explore_map({path,name}) or ${host.readResult}. This is not a full-text search and does not prove absence; ${host.textSearch}. Continue with offset and unchanged conditions.`,
26381
26471
  explore: `${lead("explore")}Read the static project map, zooming from the whole project to one declaration. path "." or a directory lists modules, module imports, external packages and its files: with exported declarations when the listing is small, as file names and line counts by directory when larger, and as modules only when very large. Start here to see what exists before searching or reading. A file path lists its declarations and members, imports, importers and top-level statements. A file path with name (or Container.member), optionally narrowed by its start line, or with a line alone, shows that declaration's calls, callers (including uses as a value), writes, heritage, decorators and members, aggregated per related declaration with @line sites; closures and locals are folded into their named container. depth also expands the related declarations hop by hop: up to 8 in one direction, which traces callers up to entry points (INCOMING) or callees down (OUTGOING), and up to 3 for BOTH. To find what a change affects, select the declaration with direction INCOMING and a depth up to 8, continue from any NOT EXPANDED declarations the view names, then confirm the entry points in source. Test files and standard-library call targets are hidden and counted by default; includeTests and includeUnresolved show them. Views use ${MAP_KINDS_LEGEND}. In a declaration view, ${MAP_DECLARATION_LEGEND} ${host.readSource} The map is static: trace stops, possible callers by name, framework wiring and unresolved targets need source reading, and a missing relationship does not prove absence. When a page reports more entries, continue with offset and otherwise unchanged arguments.`,
26382
- check: `${lead("check")}Compares the working tree with a commit (HEAD by default, so uncommitted and untracked changes), finds the declarations the diff changed, removed or renamed, and follows their callers, and the code using a field or type, up to 8 levels. It reports, conclusion first: AFFECTED ENTRY POINTS reached through resolved calls, each route with its HTTP methods and full path and the chain to the change; POSSIBLY AFFECTED ones reached only through a call on an interface or base member, or through code that uses a changed field or type; REQUESTED BY, the code and templates outside the tests that request the path of a route whose handler the change reaches or a route it removed, found by text; EXISTING TESTS CHANGED, the tests that existed before the diff and whose code it changed or removed; SHARED BY, when tests reach the changed code through more than one area (package or module), so a change meant for one feature may change others; NAMES STILL USED ELSEWHERE, environment variables and configuration keys the diff removed from a file that other files still read or set, found by text; NEW MODULE DEPENDENCIES, imports between the modules of the project overview that the base did not have, and those that make two modules depend on each other, for you to judge against the project's layers; NEW COMPILE ERRORS, what the compiler reports on lines the diff left unchanged and did not report before, in code a tsconfig covers; PACKAGES NOT FOUND, packages the changed code needs that are not installed in this directory, whose types the trace then lacks; EXISTING CODE LIKE THE NEW CODE, declarations the diff adds whose code reads almost the same as code the project already has; LEFT WITHOUT CALLERS, declarations whose last callers outside the tests the diff removed or changed, and that nothing extends, implements, overrides or wires with a decorator; CHECK BY HAND for what a static map cannot follow (changed configuration, templates, migrations or dependency files, changed route registrations, declarations with no callers, calls by name on receivers of unknown type); and RELATED TESTS, closest first, the existing test files the diff changed, that call or use the changed code, request a route it reaches, may request one through a path the map does not work out, spell out a stretch of such a route's path in their text, may call it through a receiver of unknown type or through a test support file beside or above them, import a changed file, are named for its module or sit beside it; given tests, NOT REACHED BY THE GIVEN TESTS, the changed declarations none of them calls or requests through a route, or uses when it is a field or type, with the entry points above them, the other tests of the project that run them, and those the given tests may run through a request whose path the map does not work out. It does not run or write tests: run the related ones if the change needs verifying; a failing or rewritten test of a feature the request is not about means the change leaked, so restore the test and narrow the change; a new dependency that runs against the layers or closes a cycle means moving what both modules need down rather than importing upward; new code like existing code means using the existing code, removing the old if the new replaces it, or having the existing code use the new where it is the one that can, unless the two are meant to differ, and changing existing code only where it is part of the task while telling the user of the rest; code left without callers means deleting it, with the tests that only test it, when the change replaced it; call it once when the edits are done; and confirm the entry points in source, since an empty list does not prove a change safe.`,
26472
+ check: `${lead("check")}Compares the working tree with a commit (HEAD by default, so uncommitted and untracked changes), finds the declarations the diff changed, removed or renamed, and follows their callers, and the code using a field or type, up to 8 levels. It reports, conclusion first: AFFECTED ENTRY POINTS reached through resolved calls, each route with its HTTP methods and full path, the chain to the change and whether the diff changed its registration; POSSIBLY AFFECTED ones reached only through a call on an interface or base member, or through code that uses a changed field or type; REQUESTED BY, the code and templates outside the tests that request the path of a route whose handler the change reaches or a route it removed, found by text; EXISTING TESTS CHANGED, the tests that existed before the diff and whose code it changed or removed; SHARED BY, when tests reach the changed code through more than one area (package or module), so a change meant for one feature may change others; NAMES STILL USED ELSEWHERE, environment variables and configuration keys the diff removed from a file that other files still read or set, found by text; NEW MODULE DEPENDENCIES, imports between the modules of the project overview that the base did not have, and those that make two modules depend on each other, for you to judge against the project's layers; NEW COMPILE ERRORS, what the compiler reports on lines the diff left unchanged and did not report before, in code a tsconfig covers; PACKAGES NOT FOUND, packages the changed code needs that are not installed in this directory, whose types the trace then lacks; EXISTING CODE LIKE THE NEW CODE, declarations the diff adds whose code reads almost the same as code the project already has; LEFT WITHOUT CALLERS, declarations whose last callers outside the tests the diff removed or changed, and that nothing extends, implements, overrides or wires with a decorator; CHECK BY HAND for what a static map cannot follow (changed configuration, templates, migrations or dependency files, changed registrations of routes not listed above, declarations with no callers, calls by name on receivers of unknown type); and RELATED TESTS, closest first, the existing test files the diff changed, that call or use the changed code, request a route it reaches, may request one through a path the map does not work out, spell out a stretch of such a route's path in their text, may call it through a receiver of unknown type or through a test support file beside or above them, import a changed file, are named for its module or sit beside it; given tests, NOT REACHED BY THE GIVEN TESTS, the changed declarations none of them calls or requests through a route, or uses when it is a field or type, with the entry points above them, the other tests of the project that run them, and those the given tests may run through a request whose path the map does not work out. It does not run or write tests: run the related ones if the change needs verifying; a failing or rewritten test of a feature the request is not about means the change leaked, so restore the test and narrow the change; a new dependency that runs against the layers or closes a cycle means moving what both modules need down rather than importing upward; new code like existing code means using the existing code, removing the old if the new replaces it, or having the existing code use the new where it is the one that can, unless the two are meant to differ, and changing existing code only where it is part of the task while telling the user of the rest; code left without callers means deleting it, with the tests that only test it, when the change replaced it; call it once when the edits are done; and confirm the entry points in source, since an empty list does not prove a change safe.`,
26383
26473
  references: `${lead("references")}Compute usages of a mapped declaration from current source, including aliases, re-exports and non-call references. Select it as project_explore_map does, with path (its file) and name as printed by project_explore_map or project_search_map, and line (its start line) when names repeat; or with an entityRef or locator {path,start,kind}. Broader and more expensive than the cached callers in project_explore_map; file or unsupported declarations may lack a reference target. within and kinds filter usage locations before paging. ${host.grantRules}objects contains compact declarations; targetRef and reference ownerRef identify them. ${host.readReference} A file that several compiler contexts read (such as packages of one workspace) lists its references once per context, each with that context's configPath. Continue with nextCursor and unchanged conditions, including after an empty partial page. Filtered exhaustion and missing results do not prove absence.`
26384
26474
  });
26385
26475
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "layermap",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
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.49");
296
+ const tools = await next.start("0.1.50");
297
297
  for (const tool of tools) {
298
298
  if (registered.has(tool.name)) continue;
299
299
  registered.add(tool.name);