layermap 0.1.11 → 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 CHANGED
@@ -71,7 +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 / +20–22% | 32 of 32 |
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 |
75
75
 
76
76
  With a tight budget, the map finds far more of the affected code, at about 24% more tokens. With
77
77
  no limit, both agents find nearly everything either way. Claude Code costs a third less with the
package/dist/cli.mjs CHANGED
@@ -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 text = (lines, object2) => lines.slice(object2.anchor.startLine - 1, object2.anchor.endLine).map((line) => line.trimEnd()).join("\n");
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 || text(baseLines, object2) !== text(workingLines, 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 before grep or reading files 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.",
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 after editing code and 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."
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
- }).strict();
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 before grep or reading files whenever a task asks what calls something, what a change affects, where something is used, or how the code is organized: 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.`;
23075
- var AGENT_MAP_NOTE = "The layermap MCP server is available here. For questions about what calls a function, what a change affects or where code is used, start with its project_explore_map tool (direction INCOMING, depth up to 8) before grep, then confirm in source. When the edits are done, call its project_check_changes tool once before reporting the work done.";
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.11",
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",