layermap 0.1.10 → 0.1.12
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 +3 -1
- package/analyzers/go/darwin-arm64/go-map +0 -0
- package/analyzers/go/darwin-x64/go-map +0 -0
- package/analyzers/go/linux-arm64/go-map +0 -0
- package/analyzers/go/linux-x64/go-map +0 -0
- package/analyzers/project-map-java/java-map.jar +0 -0
- package/analyzers/project-map-python-worker.mjs +9 -1
- package/analyzers/project-map-worker.mjs +6 -1
- package/dist/cli.mjs +16 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -71,6 +71,7 @@ projects, graded blind against truth sets cross-checked with each language's own
|
|
|
71
71
|
| Time, no request limit (Claude Code / Codex) | +25% / +20% | |
|
|
72
72
|
| Failing tests the change check lists (Go / Python, functions made to fail) | **100% / 94–98%** | — |
|
|
73
73
|
| Ripple tasks: runs leaving other features' tests passing (Codex / Claude Code, 4 tasks × 6 runs with, × 3 without) | **23 of 24** / 11 of 24 | 3 of 12 / 4 of 12 |
|
|
74
|
+
| Everyday tasks, no impact analysis needed: done right / time (Claude Code and Codex, 8 tasks × 2 runs) | 32 of 32 / +12–31% | 32 of 32 |
|
|
74
75
|
|
|
75
76
|
With a tight budget, the map finds far more of the affected code, at about 24% more tokens. With
|
|
76
77
|
no limit, both agents find nearly everything either way. Claude Code costs a third less with the
|
|
@@ -78,7 +79,8 @@ map. Codex's current defaults already search lean, so the map no longer saves it
|
|
|
78
79
|
reasoning effort max, in the first round, it saved 55%. Agents with the map explore more widely,
|
|
79
80
|
which takes longer. On requests whose obvious change breaks another feature, the change check
|
|
80
81
|
helped Codex keep to the requested feature. Claude Code saw which tests of other features it had
|
|
81
|
-
changed but often kept the broader change on purpose, so it showed no clear difference.
|
|
82
|
+
changed but often kept the broader change on purpose, so it showed no clear difference. On small
|
|
83
|
+
local tasks the map changed nothing but cost about a fifth more time and money. These are small samples on tasks written by LayerMap's authors.
|
|
82
84
|
The [report](https://github.com/coffeecoproject/layermap/blob/main/docs/benchmark.md) has the
|
|
83
85
|
setup, the published tasks and the limitations.
|
|
84
86
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -121442,6 +121442,8 @@ var Relater = class extends ParseTreeWalker {
|
|
|
121442
121442
|
super();
|
|
121443
121443
|
this.x = x2;
|
|
121444
121444
|
this.path = path3;
|
|
121445
|
+
// Module variables each declaration reads, recorded once.
|
|
121446
|
+
this.reads = /* @__PURE__ */ new Set();
|
|
121445
121447
|
this.scopes = [];
|
|
121446
121448
|
this.callees = /* @__PURE__ */ new Set();
|
|
121447
121449
|
// Names a function declares global.
|
|
@@ -121708,9 +121710,15 @@ var Relater = class extends ParseTreeWalker {
|
|
|
121708
121710
|
const to = this.x.objectOf(declaration);
|
|
121709
121711
|
if (to === void 0) continue;
|
|
121710
121712
|
if (read && this.x.global(this.x.object(to).path, name.d.value) !== to) continue;
|
|
121713
|
+
const from = this.top(this.declared);
|
|
121714
|
+
if (read && !value) {
|
|
121715
|
+
const key = `${from}\0${to}`;
|
|
121716
|
+
if (this.reads.has(key)) return;
|
|
121717
|
+
this.reads.add(key);
|
|
121718
|
+
}
|
|
121711
121719
|
this.relation({
|
|
121712
121720
|
kind: "REFERENCES",
|
|
121713
|
-
from
|
|
121721
|
+
from,
|
|
121714
121722
|
to,
|
|
121715
121723
|
start: expression.start,
|
|
121716
121724
|
end: end(expression),
|
|
@@ -31126,6 +31126,7 @@ async function extractProjectMap(project, input, trace) {
|
|
|
31126
31126
|
const exportedSymbols = /* @__PURE__ */ new Map();
|
|
31127
31127
|
const pending = [];
|
|
31128
31128
|
const moduleVariables = /* @__PURE__ */ new Set();
|
|
31129
|
+
const stateReads = /* @__PURE__ */ new Set();
|
|
31129
31130
|
const contracts = [];
|
|
31130
31131
|
const callableHolders = /* @__PURE__ */ new Set();
|
|
31131
31132
|
const valueNames = /* @__PURE__ */ new Set();
|
|
@@ -31471,7 +31472,10 @@ async function extractProjectMap(project, input, trace) {
|
|
|
31471
31472
|
trace.phase = "RELATION_TARGETS";
|
|
31472
31473
|
for (const [index, item] of batch.entries()) {
|
|
31473
31474
|
if (item.state) {
|
|
31474
|
-
for (const destination of await targets.resolveMapped(symbols[index], moduleVariable))
|
|
31475
|
+
for (const destination of await targets.resolveMapped(symbols[index], moduleVariable)) {
|
|
31476
|
+
const read = `${item.owner}\0${destination.id}`;
|
|
31477
|
+
if (stateReads.has(read)) continue;
|
|
31478
|
+
stateReads.add(read);
|
|
31475
31479
|
collect.relation({
|
|
31476
31480
|
from: item.owner,
|
|
31477
31481
|
to: destination.id,
|
|
@@ -31480,6 +31484,7 @@ async function extractProjectMap(project, input, trace) {
|
|
|
31480
31484
|
target: item.target,
|
|
31481
31485
|
basis: "TYPE_RESOLVED"
|
|
31482
31486
|
});
|
|
31487
|
+
}
|
|
31483
31488
|
continue;
|
|
31484
31489
|
}
|
|
31485
31490
|
if (item.kind === "REFERENCES") {
|
package/dist/cli.mjs
CHANGED
|
@@ -17765,7 +17765,7 @@ function runMapOperation(resources, input, schema, signal, observeTiming) {
|
|
|
17765
17765
|
var goModule = /(?:^|\/)go\.mod$/u;
|
|
17766
17766
|
var codeHosts = /* @__PURE__ */ new Set(["github.com", "gitlab.com", "bitbucket.org"]);
|
|
17767
17767
|
var GO_MAP_LANGUAGE = Object.freeze({
|
|
17768
|
-
id: "go-1.24-map-
|
|
17768
|
+
id: "go-1.24-map-v9",
|
|
17769
17769
|
claims: (path11) => path11.endsWith(".go"),
|
|
17770
17770
|
reads: (path11) => goModule.test(path11),
|
|
17771
17771
|
// A module path, or the standard library, whose first path element has no dot.
|
|
@@ -17918,7 +17918,7 @@ var nameOf = (path11) => path11.slice(path11.lastIndexOf("/") + 1);
|
|
|
17918
17918
|
var DEFAULT_RELEASE = 21;
|
|
17919
17919
|
var platformPackage = /^(?:java|jdk|sun|com\.sun|javax\.(?:annotation\.processing|crypto|imageio|lang\.model|management|naming|net|print|script|security|sound|sql|swing|tools|transaction\.xa|xml))(?:\.|$)/u;
|
|
17920
17920
|
var JAVA_MAP_LANGUAGE = Object.freeze({
|
|
17921
|
-
id: "javac-lombok-1.18.48-map-
|
|
17921
|
+
id: "javac-lombok-1.18.48-map-v8",
|
|
17922
17922
|
claims: (path11) => path11.endsWith(".java"),
|
|
17923
17923
|
reads: (path11) => buildFile.test(path11),
|
|
17924
17924
|
// A package of the Java platform, or a library named by its first two package segments.
|
|
@@ -18470,7 +18470,7 @@ var pythonConfig = /(?:^|\/)(?:pyrightconfig\.json|pyproject\.toml|setup\.cfg)$/
|
|
|
18470
18470
|
var directoryOf2 = (path11) => path11.slice(0, path11.lastIndexOf("/") + 1);
|
|
18471
18471
|
var DEFAULT_PYTHON = { major: 3, minor: 13 };
|
|
18472
18472
|
var PYTHON_MAP_LANGUAGE = Object.freeze({
|
|
18473
|
-
id: "pyright-1.1.414-map-
|
|
18473
|
+
id: "pyright-1.1.414-map-v13",
|
|
18474
18474
|
claims: (path11) => /\.pyi?$/u.test(path11),
|
|
18475
18475
|
reads: (path11) => pythonConfig.test(path11),
|
|
18476
18476
|
// An absolute import names the standard library or a distribution's top-level package.
|
|
@@ -18625,7 +18625,7 @@ var PythonMapAnalyzer = class {
|
|
|
18625
18625
|
|
|
18626
18626
|
// src/project-map-language-typescript.ts
|
|
18627
18627
|
var TYPESCRIPT_MAP_LANGUAGE = Object.freeze({
|
|
18628
|
-
id: "typescript-7.0.2-map-
|
|
18628
|
+
id: "typescript-7.0.2-map-v17",
|
|
18629
18629
|
claims: (path11) => /\.[cm]?[jt]sx?$/u.test(path11),
|
|
18630
18630
|
reads: (path11) => path11.endsWith(".json") || path11 === "pnpm-workspace.yaml",
|
|
18631
18631
|
create: () => new TypeScriptMapAnalyzer()
|
|
@@ -22361,13 +22361,18 @@ function existingTestsChanged(before, after, file2, project) {
|
|
|
22361
22361
|
} catch {
|
|
22362
22362
|
}
|
|
22363
22363
|
const key = (graph, object2) => `${object2.kind}\0${graph.qualifiedName(object2.id)}`;
|
|
22364
|
-
const
|
|
22364
|
+
const body = (lines, object2) => lines.slice(object2.anchor.startLine - 1, object2.anchor.endLine).map((line) => line.trimEnd());
|
|
22365
|
+
const extended = (before2, after2) => {
|
|
22366
|
+
let at = 0;
|
|
22367
|
+
for (const line of after2) if (at < before2.length && line === before2[at]) at++;
|
|
22368
|
+
return at === before2.length;
|
|
22369
|
+
};
|
|
22365
22370
|
const now = new Map(
|
|
22366
22371
|
(file2.status === "DELETED" ? [] : after.objectsAt(file2.path)).filter((object2) => !mapIsModule(object2) && after.isAddressable(object2)).map((object2) => [key(after, object2), object2])
|
|
22367
22372
|
);
|
|
22368
22373
|
const changed = before.objectsAt(file2.basePath).filter((object2) => !mapIsModule(object2) && before.isAddressable(object2)).filter((object2) => {
|
|
22369
22374
|
const counterpart = now.get(key(before, object2));
|
|
22370
|
-
return !counterpart ||
|
|
22375
|
+
return !counterpart || !extended(body(baseLines, object2), body(workingLines, counterpart));
|
|
22371
22376
|
});
|
|
22372
22377
|
return changed.filter(
|
|
22373
22378
|
(object2) => !changed.some(
|
|
@@ -22907,10 +22912,10 @@ var AGENT_MAP_TOOL_HOST = Object.freeze({
|
|
|
22907
22912
|
scope: "project",
|
|
22908
22913
|
// Agents reach for grep by habit; these say which questions the map answers in one call.
|
|
22909
22914
|
lead: {
|
|
22910
|
-
explore: "Use this
|
|
22915
|
+
explore: "Use this instead of grep to answer what calls a function or method, what changing it affects (callers traced up to entry points such as HTTP routes, handlers, jobs and commands), what it calls, and what a directory or file contains: one call returns the callers or callees up to 8 levels deep, with file paths and line numbers, for TypeScript, JavaScript, Go, Python and Java.",
|
|
22911
22916
|
search: "Use this to find where a function, method, class or type is declared, by name or by words in its name, path or documentation, before exploring its callers with project_explore_map.",
|
|
22912
22917
|
references: "Use this to list every place a declaration is used (calls, imports, re-exports, reads and writes), compiled from current source: more complete than searching for its name.",
|
|
22913
|
-
check: "Use this
|
|
22918
|
+
check: "Use this once the edits are done, before reporting the work done: it lists what the uncommitted changes affect, from the changed functions up to the HTTP routes, jobs and commands that reach them, plus the existing tests related to them."
|
|
22914
22919
|
}
|
|
22915
22920
|
});
|
|
22916
22921
|
var MAP_TOOL_NAMES = Object.freeze({
|
|
@@ -22948,7 +22953,7 @@ var ProjectMapCheckInputSchema = external_exports.object({
|
|
|
22948
22953
|
base: external_exports.string().min(1).max(200).default("HEAD").describe(
|
|
22949
22954
|
"Commit, branch or tag to compare the working tree with (HEAD, so the uncommitted changes, by default; main for a whole branch)."
|
|
22950
22955
|
)
|
|
22951
|
-
}).
|
|
22956
|
+
}).strip();
|
|
22952
22957
|
var locatorSchema = MapObjectLocatorSchema.describe(
|
|
22953
22958
|
"Declaration location: path and UTF-16 start offset; include kind to distinguish declarations at the same offset."
|
|
22954
22959
|
);
|
|
@@ -23071,8 +23076,8 @@ async function runMapTool(map2, name, args, signal) {
|
|
|
23071
23076
|
throw error51;
|
|
23072
23077
|
}
|
|
23073
23078
|
}
|
|
23074
|
-
var AGENT_MAP_INSTRUCTIONS = `Use the LayerMap tools
|
|
23075
|
-
var AGENT_MAP_NOTE = "The layermap MCP server is available here.
|
|
23079
|
+
var AGENT_MAP_INSTRUCTIONS = `Use the LayerMap tools instead of grep whenever a task needs to know what calls something, what a change could affect beyond the code at hand, where something is used, or how the code is organized; a change confined to code you have read does not need them: project_explore_map on a declaration with direction INCOMING and depth up to 8 traces its callers up to the entry points (HTTP routes, handlers, jobs, commands) in one call, which grep can only approximate one name at a time. LayerMap is a static, layered map of this repository for TypeScript/JavaScript, Go, Python and Java: directories and modules, each file's declarations, and each declaration's callers and callees up to 8 hops. path "." shows what exists. Continue from any NOT EXPANDED declarations a view names, then confirm entry points in source. When the edits are done, call project_check_changes once before reporting the work done, not after every edit: it lists the entry points and existing tests the changes reach, and the existing tests the diff rewrote. The map is static: dynamic dispatch, framework wiring and unresolved targets need source reading, and a missing relationship does not prove absence. The first call on a project builds its map, which can take minutes on a large repository; later calls update only what changed.`;
|
|
23080
|
+
var AGENT_MAP_NOTE = "The layermap MCP server is available here. When a task needs to know what calls a function, what a change could affect beyond the code you are editing, or where code is used, use its project_explore_map tool (direction INCOMING, depth up to 8) instead of grep, then confirm in source; a change confined to code you have read does not need it. When the edits are done, call its project_check_changes tool once before reporting the work done.";
|
|
23076
23081
|
|
|
23077
23082
|
// src/agent/mcp.ts
|
|
23078
23083
|
function serveMcp(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "layermap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
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",
|