layermap 0.1.43 → 0.1.45
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 +1 -1
- package/analyzers/project-map-java/java-map.jar +0 -0
- package/dist/cli.mjs +221 -54
- package/package.json +1 -1
- package/pi/layermap.mjs +1 -1
package/README.md
CHANGED
|
@@ -225,7 +225,7 @@ npx layermap search "invoice total"
|
|
|
225
225
|
npx layermap refs src/billing/tax.ts calculateTax
|
|
226
226
|
npx layermap check --base main
|
|
227
227
|
npx layermap check test/billing.test.ts # also: what of the change this test does not run
|
|
228
|
-
npx layermap check --json # related tests by rank
|
|
228
|
+
npx layermap check --json # as JSON: related tests by rank, what the map cannot follow, the imports and calls it changes between files
|
|
229
229
|
```
|
|
230
230
|
|
|
231
231
|
## FAQ
|
|
Binary file
|
package/dist/cli.mjs
CHANGED
|
@@ -17931,7 +17931,9 @@ function runMapOperation(resources, input, schema, signal, observeTiming) {
|
|
|
17931
17931
|
}
|
|
17932
17932
|
return new Promise((resolve, reject) => {
|
|
17933
17933
|
const child = spawn2(process.execPath, [...resources.execArgv ?? [], resources.workerPath], {
|
|
17934
|
-
detached
|
|
17934
|
+
// POSIX stops the worker by its process group. A detached Windows process has no console, so
|
|
17935
|
+
// the console compilers it starts, which TypeScript's API does not hide, would open a window.
|
|
17936
|
+
detached: process.platform !== "win32",
|
|
17935
17937
|
windowsHide: true,
|
|
17936
17938
|
stdio: ["ignore", "pipe", "pipe", "ipc"],
|
|
17937
17939
|
env: childEnvironment({
|
|
@@ -19653,7 +19655,7 @@ function loadDirectoryFacts(store, version2) {
|
|
|
19653
19655
|
]);
|
|
19654
19656
|
}
|
|
19655
19657
|
for (const list of exported.values()) list.sort((left, right) => left.start - right.start);
|
|
19656
|
-
const
|
|
19658
|
+
const imports = loadImports(store, version2);
|
|
19657
19659
|
const calls = /* @__PURE__ */ new Map();
|
|
19658
19660
|
for (const row of store.database.prepare(`SELECT path, count(*) AS total, sum(to_ref IS NOT NULL) AS resolved,
|
|
19659
19661
|
sum(to_ref IS NULL AND json_extract(relation_json, '$.unresolvedReason')
|
|
@@ -19669,7 +19671,7 @@ function loadDirectoryFacts(store, version2) {
|
|
|
19669
19671
|
unresolved: Number(row.total) - resolved - external
|
|
19670
19672
|
});
|
|
19671
19673
|
}
|
|
19672
|
-
return { files, calls, exported, imports
|
|
19674
|
+
return { files, calls, exported, imports };
|
|
19673
19675
|
}
|
|
19674
19676
|
var MEMBER_NAME = /\.([A-Za-z_$][\w$]*)$/u;
|
|
19675
19677
|
var memberKey = (language, name) => `${language}\0${name}`;
|
|
@@ -20300,7 +20302,7 @@ function fileView(store, coverage, graph, input, path19, prefixes) {
|
|
|
20300
20302
|
` ${graph.qualifiedName(parent)} (${graph.object(parent).anchor.path}): ${list.sort((left, right) => left.anchor.start - right.anchor.start).map((object2) => `${object2.name} ${mapDeclarationLabel(object2)}`).join(", ")}`
|
|
20301
20303
|
);
|
|
20302
20304
|
if (declarations2.length) blocks.push(["DECLARATIONS (* exported)", ...declarations2].join("\n"));
|
|
20303
|
-
const
|
|
20305
|
+
const imports = /* @__PURE__ */ new Set();
|
|
20304
20306
|
const external = /* @__PURE__ */ new Set();
|
|
20305
20307
|
const fileObjects = graph.objectsAt(path19).map((object2) => object2.id);
|
|
20306
20308
|
for (const relation of graph.relationsFrom(fileObjects)) {
|
|
@@ -20308,7 +20310,7 @@ function fileView(store, coverage, graph, input, path19, prefixes) {
|
|
|
20308
20310
|
if (relation.to === void 0) external.add(relation.target);
|
|
20309
20311
|
else {
|
|
20310
20312
|
const target = graph.object(relation.to).anchor.path;
|
|
20311
|
-
if (mapPathAllowed(target, prefixes))
|
|
20313
|
+
if (mapPathAllowed(target, prefixes)) imports.add(mapImportTarget(target));
|
|
20312
20314
|
}
|
|
20313
20315
|
}
|
|
20314
20316
|
const importers = /* @__PURE__ */ new Set();
|
|
@@ -20321,7 +20323,7 @@ function fileView(store, coverage, graph, input, path19, prefixes) {
|
|
|
20321
20323
|
if (!mapPathAllowed(source, prefixes)) continue;
|
|
20322
20324
|
(!showTests && mapTestPath(source) ? testImporters : importers).add(source);
|
|
20323
20325
|
}
|
|
20324
|
-
if (
|
|
20326
|
+
if (imports.size) blocks.push(`IMPORTS \u2192 ${[...imports].sort(compareText2).join(", ")}`);
|
|
20325
20327
|
if (external.size)
|
|
20326
20328
|
blocks.push(`UNRESOLVED IMPORTS: ${[...external].sort(compareText2).join(", ")}`);
|
|
20327
20329
|
if (importers.size || testImporters.size)
|
|
@@ -22933,11 +22935,11 @@ function parseMapDiff(text) {
|
|
|
22933
22935
|
const names = line.slice("diff --git ".length);
|
|
22934
22936
|
const half = (names.length - 1) / 2;
|
|
22935
22937
|
const [from, to] = [names.slice(0, half), names.slice(half + 1)];
|
|
22936
|
-
const
|
|
22938
|
+
const same3 = from.startsWith("a/") && to.startsWith("b/") && from.slice(2) === to.slice(2) ? from.slice(2) : void 0;
|
|
22937
22939
|
const match = /^a\/(.+) b\/(.+)$/u.exec(names);
|
|
22938
22940
|
current = {
|
|
22939
|
-
path:
|
|
22940
|
-
basePath:
|
|
22941
|
+
path: same3 ?? match?.[2] ?? names,
|
|
22942
|
+
basePath: same3 ?? match?.[1] ?? names,
|
|
22941
22943
|
status: "MODIFIED",
|
|
22942
22944
|
lines: [],
|
|
22943
22945
|
baseLines: [],
|
|
@@ -22987,6 +22989,14 @@ function addHunk(file2, line) {
|
|
|
22987
22989
|
}
|
|
22988
22990
|
var changedInWorkingTree = (files) => new Map(files.map((file2) => [file2.path, file2]));
|
|
22989
22991
|
var changedInBase = (files) => new Map(files.flatMap((file2) => file2.basePath ? [[file2.basePath, file2]] : []));
|
|
22992
|
+
function mapPathNow(files) {
|
|
22993
|
+
const moved = new Map(
|
|
22994
|
+
files.flatMap(
|
|
22995
|
+
(file2) => file2.basePath !== void 0 && file2.status !== "DELETED" ? [[file2.basePath, file2.path]] : []
|
|
22996
|
+
)
|
|
22997
|
+
);
|
|
22998
|
+
return (path19) => moved.get(path19) ?? path19;
|
|
22999
|
+
}
|
|
22990
23000
|
var overlaps = (lines, start, end) => lines.some(([from, to]) => from <= end && start <= to);
|
|
22991
23001
|
var workingLine = (file2, line) => {
|
|
22992
23002
|
let shift = 0;
|
|
@@ -23021,10 +23031,6 @@ var unmappedKind = (path19, binary) => nonCodeKind(path19) ?? (binary ? "binary
|
|
|
23021
23031
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
23022
23032
|
import path13 from "node:path";
|
|
23023
23033
|
|
|
23024
|
-
// src/project-map-change-tests.ts
|
|
23025
|
-
import { readFile as readFile2 } from "node:fs/promises";
|
|
23026
|
-
import path12 from "node:path";
|
|
23027
|
-
|
|
23028
23034
|
// src/project-map-change-types.ts
|
|
23029
23035
|
var LIMITS = Object.freeze({
|
|
23030
23036
|
depth: 8,
|
|
@@ -23275,6 +23281,19 @@ var USED_BY = {
|
|
|
23275
23281
|
var runsTarget = (relation) => CALLER_KINDS.has(relation.kind) && !relation.event;
|
|
23276
23282
|
var IMPORT_KINDS2 = /* @__PURE__ */ new Set(["IMPORTS", "TEST_IMPORTS"]);
|
|
23277
23283
|
var changeUnits = (graph, path19) => mapMiniprogramTemplate(path19) ? graph.objectsAt(path19).filter((object2) => mapIsModule(object2) && object2.parsing === "PARSED") : graph.declarationsAt(path19);
|
|
23284
|
+
function changedUnits(graph, path19, lines) {
|
|
23285
|
+
const refs = /* @__PURE__ */ new Set();
|
|
23286
|
+
let topLevel = false;
|
|
23287
|
+
const inFile = changeUnits(graph, path19);
|
|
23288
|
+
for (const [from, to] of lines) {
|
|
23289
|
+
const containing = inFile.filter(
|
|
23290
|
+
(object2) => object2.anchor.startLine <= to && from <= object2.anchor.endLine
|
|
23291
|
+
);
|
|
23292
|
+
if (!containing.length && from <= to) topLevel = true;
|
|
23293
|
+
for (const object2 of mapInnermost(containing)) refs.add(object2.id);
|
|
23294
|
+
}
|
|
23295
|
+
return { refs, topLevel };
|
|
23296
|
+
}
|
|
23278
23297
|
var callerFrom = (ref, relation, certain) => ({
|
|
23279
23298
|
ref,
|
|
23280
23299
|
anchor: relation.anchor,
|
|
@@ -23832,6 +23851,179 @@ function findTestEntries(graph, ref) {
|
|
|
23832
23851
|
return found.length ? found : kept;
|
|
23833
23852
|
}
|
|
23834
23853
|
|
|
23854
|
+
// src/project-map-change-edges.ts
|
|
23855
|
+
var same2 = (path19) => path19;
|
|
23856
|
+
var compare = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
23857
|
+
function linksOf(side, path19) {
|
|
23858
|
+
const imports = /* @__PURE__ */ new Map();
|
|
23859
|
+
const calls = /* @__PURE__ */ new Map();
|
|
23860
|
+
if (path19 === void 0) return { imports, calls };
|
|
23861
|
+
const { graph } = side;
|
|
23862
|
+
for (const relation of graph.relationsFrom(graph.objectsAt(path19).map((object2) => object2.id))) {
|
|
23863
|
+
const line = relation.anchor.startLine;
|
|
23864
|
+
if (relation.to === void 0 || !side.counts(path19, line)) continue;
|
|
23865
|
+
if (IMPORT_KINDS2.has(relation.kind)) {
|
|
23866
|
+
const target = graph.object(relation.to).anchor.path;
|
|
23867
|
+
if (target === path19) continue;
|
|
23868
|
+
const to = side.pathNow(target);
|
|
23869
|
+
const found = imports.get(to) ?? { to, lines: [] };
|
|
23870
|
+
found.lines.push(line);
|
|
23871
|
+
imports.set(to, found);
|
|
23872
|
+
} else if (CALLER_KINDS.has(relation.kind)) {
|
|
23873
|
+
const ref = graph.owner(relation.to);
|
|
23874
|
+
const owner = graph.object(ref);
|
|
23875
|
+
if (owner.anchor.path === path19 || mapIsModule(owner)) continue;
|
|
23876
|
+
const to = side.pathNow(owner.anchor.path);
|
|
23877
|
+
const key = `${to}\0${graph.declarationKey(owner)}`;
|
|
23878
|
+
const found = calls.get(key) ?? { to, lines: [], ref };
|
|
23879
|
+
found.lines.push(line);
|
|
23880
|
+
calls.set(key, found);
|
|
23881
|
+
}
|
|
23882
|
+
}
|
|
23883
|
+
return { imports, calls };
|
|
23884
|
+
}
|
|
23885
|
+
function mapChangeLinks(store, working, base, files) {
|
|
23886
|
+
const graph = new MapViewGraph(store, working);
|
|
23887
|
+
const always = () => true;
|
|
23888
|
+
const now = {
|
|
23889
|
+
graph,
|
|
23890
|
+
pathNow: same2,
|
|
23891
|
+
counts: always,
|
|
23892
|
+
pathOf: (file2) => file2.status === "DELETED" ? void 0 : file2.path,
|
|
23893
|
+
declaration: (_, ref) => ref
|
|
23894
|
+
};
|
|
23895
|
+
let before;
|
|
23896
|
+
if (base !== void 0) {
|
|
23897
|
+
const baseGraph = new MapViewGraph(store, base);
|
|
23898
|
+
const pathOf = (file2) => file2.status === "ADDED" ? void 0 : file2.basePath;
|
|
23899
|
+
const declared = /* @__PURE__ */ new Map();
|
|
23900
|
+
before = {
|
|
23901
|
+
graph: baseGraph,
|
|
23902
|
+
pathNow: mapPathNow(files),
|
|
23903
|
+
counts: always,
|
|
23904
|
+
pathOf,
|
|
23905
|
+
declaration: (file2, ref) => {
|
|
23906
|
+
const path19 = pathOf(file2);
|
|
23907
|
+
if (path19 === void 0) return void 0;
|
|
23908
|
+
let keys = declared.get(path19);
|
|
23909
|
+
if (!keys) {
|
|
23910
|
+
keys = new Map(
|
|
23911
|
+
changeUnits(baseGraph, path19).map((object2) => [
|
|
23912
|
+
baseGraph.declarationKey(object2),
|
|
23913
|
+
object2.id
|
|
23914
|
+
])
|
|
23915
|
+
);
|
|
23916
|
+
declared.set(path19, keys);
|
|
23917
|
+
}
|
|
23918
|
+
return keys.get(graph.declarationKey(graph.object(ref)));
|
|
23919
|
+
}
|
|
23920
|
+
};
|
|
23921
|
+
} else {
|
|
23922
|
+
const changedAt = changedInWorkingTree(files);
|
|
23923
|
+
before = {
|
|
23924
|
+
graph,
|
|
23925
|
+
pathNow: same2,
|
|
23926
|
+
counts: (path19, line) => {
|
|
23927
|
+
const file2 = changedAt.get(path19);
|
|
23928
|
+
return !file2 || !overlaps(file2.lines, line, line);
|
|
23929
|
+
},
|
|
23930
|
+
pathOf: (file2) => file2.status === "ADDED" ? void 0 : file2.path,
|
|
23931
|
+
// A declaration lying wholly in added lines is new.
|
|
23932
|
+
declaration: (file2, ref) => {
|
|
23933
|
+
const { anchor } = graph.object(ref);
|
|
23934
|
+
return file2.status === "ADDED" || file2.lines.some(([from, to]) => from <= anchor.startLine && anchor.endLine <= to) ? void 0 : ref;
|
|
23935
|
+
}
|
|
23936
|
+
};
|
|
23937
|
+
}
|
|
23938
|
+
return {
|
|
23939
|
+
now,
|
|
23940
|
+
before,
|
|
23941
|
+
files: files.map((file2) => ({
|
|
23942
|
+
file: file2,
|
|
23943
|
+
now: linksOf(now, now.pathOf(file2)),
|
|
23944
|
+
before: linksOf(before, before.pathOf(file2))
|
|
23945
|
+
}))
|
|
23946
|
+
};
|
|
23947
|
+
}
|
|
23948
|
+
function exportedTop(graph, ref) {
|
|
23949
|
+
let top = graph.object(ref);
|
|
23950
|
+
for (const at of graph.lineage(ref)) {
|
|
23951
|
+
const object2 = graph.object(at);
|
|
23952
|
+
if (mapIsModule(object2)) break;
|
|
23953
|
+
top = object2;
|
|
23954
|
+
}
|
|
23955
|
+
return top.exported;
|
|
23956
|
+
}
|
|
23957
|
+
function callersOf(side, ref) {
|
|
23958
|
+
const home = side.graph.object(ref).anchor.path;
|
|
23959
|
+
const files = /* @__PURE__ */ new Set();
|
|
23960
|
+
for (const relation of side.graph.relationsTo([ref])) {
|
|
23961
|
+
const path19 = relation.anchor.path;
|
|
23962
|
+
if (!CALLER_KINDS.has(relation.kind) || path19 === home || mapTestPath(path19)) continue;
|
|
23963
|
+
if (side.counts(path19, relation.anchor.startLine)) files.add(side.pathNow(path19));
|
|
23964
|
+
}
|
|
23965
|
+
return [...files].sort();
|
|
23966
|
+
}
|
|
23967
|
+
function mapChangeEdges(links) {
|
|
23968
|
+
const { now, before } = links;
|
|
23969
|
+
const imports = [];
|
|
23970
|
+
const calls = [];
|
|
23971
|
+
const declarations2 = [];
|
|
23972
|
+
let truncated = false;
|
|
23973
|
+
const first = ({ lines }) => Math.min(...lines);
|
|
23974
|
+
for (const linked of links.files) {
|
|
23975
|
+
const { file: file2 } = linked;
|
|
23976
|
+
if (file2.binary || mapTestPath(file2.path)) continue;
|
|
23977
|
+
for (const [to, sites2] of linked.now.imports)
|
|
23978
|
+
if (!linked.before.imports.has(to))
|
|
23979
|
+
imports.push({ from: file2.path, to, line: first(sites2), change: "ADDED" });
|
|
23980
|
+
for (const [to, sites2] of linked.before.imports)
|
|
23981
|
+
if (!linked.now.imports.has(to))
|
|
23982
|
+
imports.push({ from: file2.path, to, line: first(sites2), change: "REMOVED" });
|
|
23983
|
+
for (const [key, sites2] of linked.now.calls)
|
|
23984
|
+
if (!linked.before.calls.has(key))
|
|
23985
|
+
calls.push({
|
|
23986
|
+
from: file2.path,
|
|
23987
|
+
line: first(sites2),
|
|
23988
|
+
to: sites2.to,
|
|
23989
|
+
declaration: now.graph.qualifiedName(sites2.ref),
|
|
23990
|
+
exported: exportedTop(now.graph, sites2.ref)
|
|
23991
|
+
});
|
|
23992
|
+
if (now.pathOf(file2) === void 0 || before.pathOf(file2) === void 0) continue;
|
|
23993
|
+
for (const ref of changedUnits(now.graph, file2.path, file2.lines).refs) {
|
|
23994
|
+
const object2 = now.graph.object(ref);
|
|
23995
|
+
if (mapIsModule(object2)) continue;
|
|
23996
|
+
const was = before.declaration(file2, ref);
|
|
23997
|
+
if (was === void 0) continue;
|
|
23998
|
+
if (declarations2.length >= LIMITS.changed) {
|
|
23999
|
+
truncated = true;
|
|
24000
|
+
break;
|
|
24001
|
+
}
|
|
24002
|
+
declarations2.push({
|
|
24003
|
+
path: file2.path,
|
|
24004
|
+
declaration: now.graph.qualifiedName(ref),
|
|
24005
|
+
line: object2.anchor.startLine,
|
|
24006
|
+
exported: exportedTop(now.graph, ref),
|
|
24007
|
+
callersBefore: callersOf(before, was),
|
|
24008
|
+
callersAfter: callersOf(now, ref)
|
|
24009
|
+
});
|
|
24010
|
+
}
|
|
24011
|
+
}
|
|
24012
|
+
const order = (left, right) => compare(left.from, right.from) || left.line - right.line || compare(left.to, right.to);
|
|
24013
|
+
return {
|
|
24014
|
+
imports: imports.sort(order),
|
|
24015
|
+
calls: calls.sort(order),
|
|
24016
|
+
declarations: declarations2.sort(
|
|
24017
|
+
(left, right) => compare(left.path, right.path) || left.line - right.line
|
|
24018
|
+
),
|
|
24019
|
+
truncated
|
|
24020
|
+
};
|
|
24021
|
+
}
|
|
24022
|
+
|
|
24023
|
+
// src/project-map-change-tests.ts
|
|
24024
|
+
import { readFile as readFile2 } from "node:fs/promises";
|
|
24025
|
+
import path12 from "node:path";
|
|
24026
|
+
|
|
23835
24027
|
// src/project-map-route-paths.ts
|
|
23836
24028
|
import {
|
|
23837
24029
|
isArrowFunction,
|
|
@@ -24691,17 +24883,6 @@ Nothing changed against ${changes.base}.`;
|
|
|
24691
24883
|
}
|
|
24692
24884
|
|
|
24693
24885
|
// src/project-map-dependencies.ts
|
|
24694
|
-
var IMPORT_KINDS3 = /* @__PURE__ */ new Set(["IMPORTS", "TEST_IMPORTS"]);
|
|
24695
|
-
function imports(graph, path19) {
|
|
24696
|
-
const found = [];
|
|
24697
|
-
for (const relation of graph.relationsFrom(graph.objectsAt(path19).map((object2) => object2.id)))
|
|
24698
|
-
if (IMPORT_KINDS3.has(relation.kind) && relation.to !== void 0)
|
|
24699
|
-
found.push({
|
|
24700
|
-
target: graph.object(relation.to).anchor.path,
|
|
24701
|
-
line: relation.anchor.startLine
|
|
24702
|
-
});
|
|
24703
|
-
return found;
|
|
24704
|
-
}
|
|
24705
24886
|
function pathBetween(edges, from, to) {
|
|
24706
24887
|
const via = /* @__PURE__ */ new Map([[from, from]]);
|
|
24707
24888
|
for (let frontier = [from]; frontier.length; ) {
|
|
@@ -24721,7 +24902,7 @@ function pathBetween(edges, from, to) {
|
|
|
24721
24902
|
}
|
|
24722
24903
|
return void 0;
|
|
24723
24904
|
}
|
|
24724
|
-
function newModuleDependencies(store, cache, working,
|
|
24905
|
+
function newModuleDependencies(store, cache, working, files, links) {
|
|
24725
24906
|
const entries = store.listEntries(working);
|
|
24726
24907
|
const moduleOf = mapProjectModules(entries);
|
|
24727
24908
|
const now = /* @__PURE__ */ new Map();
|
|
@@ -24742,18 +24923,10 @@ function newModuleDependencies(store, cache, working, base, files) {
|
|
|
24742
24923
|
add(now, row.source, row.target);
|
|
24743
24924
|
add(before, row.source, row.target);
|
|
24744
24925
|
}
|
|
24745
|
-
const
|
|
24746
|
-
|
|
24747
|
-
|
|
24748
|
-
const
|
|
24749
|
-
for (const { target, line } of current) add(now, file2.path, target, `${file2.path}:${line}`);
|
|
24750
|
-
if (!file2.basePath || file2.status === "ADDED") continue;
|
|
24751
|
-
if (baseGraph)
|
|
24752
|
-
for (const { target } of imports(baseGraph, file2.basePath)) add(before, file2.path, target);
|
|
24753
|
-
else
|
|
24754
|
-
for (const { target, line } of current)
|
|
24755
|
-
if (!file2.lines.some(([from, to]) => from <= line && line <= to))
|
|
24756
|
-
add(before, file2.path, target);
|
|
24926
|
+
for (const { file: file2, now: after, before: had } of links) {
|
|
24927
|
+
for (const [target, { lines }] of after.imports)
|
|
24928
|
+
for (const line of lines) add(now, file2.path, target, `${file2.path}:${line}`);
|
|
24929
|
+
for (const target of had.imports.keys()) add(before, file2.path, target);
|
|
24757
24930
|
}
|
|
24758
24931
|
const added = new Set(files.filter((file2) => file2.status === "ADDED").map((file2) => file2.path));
|
|
24759
24932
|
const kept = /* @__PURE__ */ new Set();
|
|
@@ -25031,7 +25204,7 @@ async function similarCode(store, working, base, files, read) {
|
|
|
25031
25204
|
}
|
|
25032
25205
|
|
|
25033
25206
|
// src/project-map-changes.ts
|
|
25034
|
-
async function mapChangeImpact(store, working, base, changes, shapes, until, project, tests) {
|
|
25207
|
+
async function mapChangeImpact(store, working, base, changes, links, shapes, until, project, tests) {
|
|
25035
25208
|
const graph = new MapViewGraph(store, working);
|
|
25036
25209
|
const cache = new MapViewCache();
|
|
25037
25210
|
const memberCalls = cache.memberCalls(store, working);
|
|
@@ -25085,16 +25258,7 @@ async function mapChangeImpact(store, working, base, changes, shapes, until, pro
|
|
|
25085
25258
|
unmapped.push({ path: file2.path, kind });
|
|
25086
25259
|
}
|
|
25087
25260
|
if (!objects2.length) continue;
|
|
25088
|
-
const hits
|
|
25089
|
-
let topLevel = false;
|
|
25090
|
-
const inFile = changeUnits(graph, file2.path);
|
|
25091
|
-
for (const [from, to] of file2.lines) {
|
|
25092
|
-
const containing = inFile.filter(
|
|
25093
|
-
(object2) => object2.anchor.startLine <= to && from <= object2.anchor.endLine
|
|
25094
|
-
);
|
|
25095
|
-
if (!containing.length && from <= to) topLevel = true;
|
|
25096
|
-
for (const object2 of mapInnermost(containing)) hits.add(object2.id);
|
|
25097
|
-
}
|
|
25261
|
+
const { refs: hits, topLevel } = changedUnits(graph, file2.path, file2.lines);
|
|
25098
25262
|
for (const ref of hits) {
|
|
25099
25263
|
if (changedCount++ >= LIMITS.changed) {
|
|
25100
25264
|
tracer.truncated = true;
|
|
@@ -25225,7 +25389,7 @@ async function mapChangeImpact(store, working, base, changes, shapes, until, pro
|
|
|
25225
25389
|
unmapped,
|
|
25226
25390
|
removedRoutes: taken?.removedRoutes ?? [],
|
|
25227
25391
|
uncalled: taken?.uncalled ?? [],
|
|
25228
|
-
dependencies: newModuleDependencies(store, cache, working,
|
|
25392
|
+
dependencies: newModuleDependencies(store, cache, working, changes.files, links.files),
|
|
25229
25393
|
...untested ? { untested } : {},
|
|
25230
25394
|
truncated: tracer.truncated
|
|
25231
25395
|
};
|
|
@@ -25292,7 +25456,7 @@ async function untestedChanges(graph, tracer, memberCalls, starts, changed, test
|
|
|
25292
25456
|
truncated: unreached.length > 0 && (truncated || above.truncated)
|
|
25293
25457
|
};
|
|
25294
25458
|
}
|
|
25295
|
-
function mapChangesData(changes, impact) {
|
|
25459
|
+
function mapChangesData(changes, impact, edges) {
|
|
25296
25460
|
return {
|
|
25297
25461
|
base: changes.base,
|
|
25298
25462
|
commit: changes.commit,
|
|
@@ -25306,7 +25470,8 @@ function mapChangesData(changes, impact) {
|
|
|
25306
25470
|
incomplete: impact.incomplete,
|
|
25307
25471
|
checkByHand: impact.unclear,
|
|
25308
25472
|
truncated: impact.truncated,
|
|
25309
|
-
...impact.untested ? { untested: impact.untested } : {}
|
|
25473
|
+
...impact.untested ? { untested: impact.untested } : {},
|
|
25474
|
+
edges
|
|
25310
25475
|
};
|
|
25311
25476
|
}
|
|
25312
25477
|
async function checkMapChanges(input, signal) {
|
|
@@ -25336,11 +25501,13 @@ async function checkMapChanges(input, signal) {
|
|
|
25336
25501
|
);
|
|
25337
25502
|
};
|
|
25338
25503
|
const until = mapShapeDeadline();
|
|
25504
|
+
const links = mapChangeLinks(index.store, working, base, changes.files);
|
|
25339
25505
|
const impact = await mapChangeImpact(
|
|
25340
25506
|
index.store,
|
|
25341
25507
|
working,
|
|
25342
25508
|
base,
|
|
25343
25509
|
changes,
|
|
25510
|
+
links,
|
|
25344
25511
|
{
|
|
25345
25512
|
working: usesIn(working, input.source),
|
|
25346
25513
|
base: usesIn(base ?? working, { ...input.source, kind: "COMMIT", commit: changes.commit })
|
|
@@ -25349,7 +25516,7 @@ async function checkMapChanges(input, signal) {
|
|
|
25349
25516
|
project,
|
|
25350
25517
|
input.tests
|
|
25351
25518
|
);
|
|
25352
|
-
const data = mapChangesData(changes, impact);
|
|
25519
|
+
const data = mapChangesData(changes, impact, mapChangeEdges(links));
|
|
25353
25520
|
if (input.format === "json") return { text: JSON.stringify(data), data };
|
|
25354
25521
|
return {
|
|
25355
25522
|
data,
|
|
@@ -25376,8 +25543,8 @@ function reusable(store, working, similar) {
|
|
|
25376
25543
|
if (!similar.length) return [];
|
|
25377
25544
|
const importsFor = mapReuseImports(store, new MapViewCache(), working);
|
|
25378
25545
|
return similar.flatMap((item) => {
|
|
25379
|
-
const
|
|
25380
|
-
return
|
|
25546
|
+
const imports = importsFor(item.path, item.like.path);
|
|
25547
|
+
return imports ? [{ ...item, imports }] : [];
|
|
25381
25548
|
});
|
|
25382
25549
|
}
|
|
25383
25550
|
async function mapRouteClients(project, store, working, impact, signal) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "layermap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
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.45");
|
|
297
297
|
for (const tool of tools) {
|
|
298
298
|
if (registered.has(tool.name)) continue;
|
|
299
299
|
registered.add(tool.name);
|