layermap 0.1.17 → 0.1.18

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
@@ -21059,14 +21059,18 @@ var CodeIndexStore = class {
21059
21059
  member.run(version2, path13, unit);
21060
21060
  }
21061
21061
  }
21062
- /** Earlier versions of a project's scope built by the same analyzer, most recent first. */
21063
- mapParentCandidates(version2, limit) {
21062
+ /**
21063
+ * Earlier versions of a project's scope built by the same analyzer, most recent first; with
21064
+ * another project, that project's versions of the same scope and analyzer as well.
21065
+ */
21066
+ mapParentCandidates(version2, limit, otherProjectRef) {
21064
21067
  return this.database.prepare(`SELECT version.version_ref FROM project_code_versions version
21065
21068
  JOIN project_code_index_state state ON state.version_ref = version.version_ref
21066
- WHERE version.project_ref = ? AND version.analyzer = ? AND version.scope_json = ?
21069
+ WHERE version.project_ref IN (?, ?) AND version.analyzer = ? AND version.scope_json = ?
21067
21070
  AND version.version_ref <> ?
21068
21071
  ORDER BY state.completed_at DESC LIMIT ?`).all(
21069
21072
  version2.projectRef,
21073
+ otherProjectRef ?? version2.projectRef,
21070
21074
  version2.analyzer,
21071
21075
  canonicalJson(version2.pathPrefixes),
21072
21076
  version2.version,
@@ -21732,7 +21736,7 @@ var CodeIndex = class {
21732
21736
  throw new ProjectEvidenceError("PROJECT_EVIDENCE_STORE_CONFLICT", false);
21733
21737
  return existing;
21734
21738
  }
21735
- await this.buildMap(result, source, combined);
21739
+ await this.buildMap(result, source, combined, options.startFromProjectRef);
21736
21740
  return this.store.requireVersion(result.version.version);
21737
21741
  }).catch((error51) => {
21738
21742
  if (error51 instanceof GitCommandStopUnconfirmedError || error51 instanceof ProjectMapStopUnconfirmedError)
@@ -21744,7 +21748,7 @@ var CodeIndex = class {
21744
21748
  this.captures.set(controller, completion);
21745
21749
  return completion;
21746
21750
  }
21747
- async buildMap(result, source, signal) {
21751
+ async buildMap(result, source, signal, startFromProjectRef) {
21748
21752
  this.assertAccepting(signal);
21749
21753
  const ref = result.version.version;
21750
21754
  const existing = this.mapBuilds.get(ref);
@@ -21755,7 +21759,7 @@ var CodeIndex = class {
21755
21759
  if (!(error51 instanceof ProjectEvidenceError) || error51.code !== "PROJECT_READ_CANCELLED")
21756
21760
  throw error51;
21757
21761
  }
21758
- return this.buildMap(result, source, signal);
21762
+ return this.buildMap(result, source, signal, startFromProjectRef);
21759
21763
  }
21760
21764
  if (existing) return this.awaitRebuild(existing, signal);
21761
21765
  if (this.store.getVersion(ref)) return;
@@ -21794,7 +21798,7 @@ var CodeIndex = class {
21794
21798
  this.store.discardMapStage(stage);
21795
21799
  }
21796
21800
  };
21797
- const completion = run2(this.mapParent(result)).finally(() => {
21801
+ const completion = run2(this.mapParent(result, startFromProjectRef)).finally(() => {
21798
21802
  if (this.mapBuilds.get(ref)?.completion === completion) this.mapBuilds.delete(ref);
21799
21803
  });
21800
21804
  const build = { controller, completion, waiters: /* @__PURE__ */ new Set() };
@@ -21802,13 +21806,18 @@ var CodeIndex = class {
21802
21806
  return this.awaitRebuild(build, signal);
21803
21807
  }
21804
21808
  /**
21805
- * The recent map of the same project scope and analyzer whose files differ least from the new
21806
- * revision's: its contexts whose inputs did not change are replayed rather than analyzed.
21809
+ * The recent map of the same project scope and analyzer, or of the project to start from, whose
21810
+ * files differ least from the new revision's: its contexts whose inputs did not change are
21811
+ * replayed rather than analyzed.
21807
21812
  */
21808
- mapParent(result) {
21813
+ mapParent(result, startFromProjectRef) {
21809
21814
  const digests = new Map(result.entries.map((entry) => [entry.path, entry.contentDigest]));
21810
21815
  let best;
21811
- for (const candidate of this.store.mapParentCandidates(result.version, 8)) {
21816
+ for (const candidate of this.store.mapParentCandidates(
21817
+ result.version,
21818
+ 8,
21819
+ startFromProjectRef
21820
+ )) {
21812
21821
  const entries2 = /* @__PURE__ */ new Map();
21813
21822
  for (const entry of this.store.listEntries(candidate))
21814
21823
  if (entry.contentDigest) entries2.set(entry.path, entry.contentDigest);
@@ -23678,16 +23687,16 @@ var SETUP_RULE = `mcp__${SERVER}`;
23678
23687
  var PLUGIN_RULE = `mcp__plugin_${SERVER}_${SERVER}`;
23679
23688
  var BEGIN = "<!-- layermap:begin -->";
23680
23689
  var END = "<!-- layermap:end -->";
23690
+ var npxServerArgs = (version2) => [
23691
+ "--prefer-offline",
23692
+ "-y",
23693
+ `layermap@${version2}`,
23694
+ "mcp"
23695
+ ];
23681
23696
  var mcpLaunchCommand = (version2, platform = process.platform) => {
23682
23697
  const script = path12.resolve(process.argv[1] ?? "");
23683
23698
  if (script.includes(`${path12.sep}_npx${path12.sep}`))
23684
- return [
23685
- ...platform === "win32" ? ["cmd", "/c"] : [],
23686
- "npx",
23687
- "-y",
23688
- `layermap@${version2}`,
23689
- "mcp"
23690
- ];
23699
+ return [...platform === "win32" ? ["cmd", "/c"] : [], "npx", ...npxServerArgs(version2)];
23691
23700
  const execArgv = [];
23692
23701
  for (let index = 0; index < process.execArgv.length; index++) {
23693
23702
  const argument = process.execArgv[index];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "layermap",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
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
@@ -128,7 +128,7 @@ export default function layermap(pi) {
128
128
  if (server && !server.dead) return server;
129
129
  starting ??= (async () => {
130
130
  const next = new MapServer(cwd);
131
- const tools = await next.start("0.1.17");
131
+ const tools = await next.start("0.1.18");
132
132
  for (const tool of tools) {
133
133
  if (registered.has(tool.name)) continue;
134
134
  registered.add(tool.name);