layermap 0.1.25 → 0.1.27

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
@@ -166,8 +166,9 @@ the agent can use the existing code instead of a copy. When the change takes awa
166
166
  declaration, as when new code replaces old, it names that declaration, so the agent can delete what
167
167
  the change left behind. It never writes or runs tests. In Claude Code and
168
168
  CodeBuddy Code the plugin asks the agent once, before it finishes, to run this check for each repository it edited code in
169
- and has not checked since, whether through its edit tools or shell commands (changes another session makes in the same
170
- work tree do not count); the Pi extension does the same after the agent's own edits. Set `LAYERMAP_STOP_CHECK=0` to turn that
169
+ and has not checked since, whether through its edit tools or shell commands, which count for the code files they name
170
+ (changes another session makes in the same work tree do not count); the Pi extension does the same after the agent's own
171
+ edits. Set `LAYERMAP_STOP_CHECK=0` to turn that
171
172
  off. Codex and DeepSeek Harness are told to run it.
172
173
 
173
174
  **Without plugins:** run `npx layermap setup claude` or `npx layermap setup codex`. Setup does three
@@ -31310,6 +31310,7 @@ async function extractProjectMap(project, input, trace) {
31310
31310
  };
31311
31311
  } else if (isPropertyAccessExpression(node) || isElementAccessExpression(node)) {
31312
31312
  const writes = isMapWrite(node);
31313
+ const readsState = isPropertyAccessExpression(node) && isIdentifier(node.expression) && state.namespaces.has(node.expression.text);
31313
31314
  if (writes) {
31314
31315
  reference = {
31315
31316
  node,
@@ -31325,9 +31326,10 @@ async function extractProjectMap(project, input, trace) {
31325
31326
  kind: "REFERENCES",
31326
31327
  target: node.name.text,
31327
31328
  holder: mapValueProperty(node),
31328
- ...route ? { argument: route } : {}
31329
+ ...route ? { argument: route } : {},
31330
+ ...readsState ? { readsState } : {}
31329
31331
  };
31330
- } else if (isPropertyAccessExpression(node) && isIdentifier(node.expression) && state.namespaces.has(node.expression.text)) {
31332
+ } else if (isPropertyAccessExpression(node) && readsState) {
31331
31333
  reference = {
31332
31334
  node,
31333
31335
  lookup: node.name,
@@ -31340,6 +31342,7 @@ async function extractProjectMap(project, input, trace) {
31340
31342
  const parent = node.parent;
31341
31343
  if (!((isCallExpression(parent) || isNewExpression(parent)) && parent.expression === node)) {
31342
31344
  const writes = isMapWrite(node);
31345
+ const readsState = state.names.has(node.text) && !(isPropertyAccessExpression(parent) && parent.name === node) && !NOT_STATE_READS.has(parent.kind) && !isImportSpecifier(parent);
31343
31346
  if (writes) reference = { node, lookup: node, kind: "WRITES", target: mapNodeLabel(node) };
31344
31347
  else if (mapValueUse(node)) {
31345
31348
  const route = registeredRoute(node, "REFERENCES");
@@ -31349,9 +31352,10 @@ async function extractProjectMap(project, input, trace) {
31349
31352
  kind: "REFERENCES",
31350
31353
  target: node.text,
31351
31354
  holder: mapValueProperty(node),
31352
- ...route ? { argument: route } : {}
31355
+ ...route ? { argument: route } : {},
31356
+ ...readsState ? { readsState } : {}
31353
31357
  };
31354
- } else if (state.names.has(node.text) && !(isPropertyAccessExpression(parent) && parent.name === node) && !NOT_STATE_READS.has(parent.kind) && !isImportSpecifier(parent))
31358
+ } else if (readsState)
31355
31359
  reference = { node, lookup: node, kind: "REFERENCES", target: node.text, state: true };
31356
31360
  }
31357
31361
  } else if (isShorthandPropertyAssignment(node)) {
@@ -31481,7 +31485,7 @@ async function extractProjectMap(project, input, trace) {
31481
31485
  for (const object2 of declared.values())
31482
31486
  if (object2.execution && object2.execution !== "MODULE") valueNames.add(object2.name);
31483
31487
  const linkable = pending.filter(
31484
- (item) => item.kind !== "REFERENCES" || item.state || valueNames.has(item.target) || isPropertyAccessExpression(item.node) && isIdentifier(item.node.expression) && namespaces.has(item.node.expression.text)
31488
+ (item) => item.kind !== "REFERENCES" || item.state || item.readsState || valueNames.has(item.target) || isPropertyAccessExpression(item.node) && isIdentifier(item.node.expression) && namespaces.has(item.node.expression.text)
31485
31489
  );
31486
31490
  for (let start = 0; start < linkable.length; start += 128) {
31487
31491
  const batch = linkable.slice(start, start + 128);
@@ -31489,7 +31493,7 @@ async function extractProjectMap(project, input, trace) {
31489
31493
  const symbols = await project.checker.getSymbolAtLocation(batch.map((item) => item.lookup));
31490
31494
  trace.phase = "RELATION_TARGETS";
31491
31495
  for (const [index, item] of batch.entries()) {
31492
- if (item.state) {
31496
+ const readState = async () => {
31493
31497
  for (const destination of await targets.resolveMapped(symbols[index], moduleVariable)) {
31494
31498
  const read = `${item.owner}\0${destination.id}`;
31495
31499
  if (stateReads.has(read)) continue;
@@ -31503,11 +31507,18 @@ async function extractProjectMap(project, input, trace) {
31503
31507
  basis: "TYPE_RESOLVED"
31504
31508
  });
31505
31509
  }
31510
+ };
31511
+ if (item.state) {
31512
+ await readState();
31506
31513
  continue;
31507
31514
  }
31508
31515
  if (item.kind === "REFERENCES") {
31509
31516
  const symbol2 = isShorthandPropertyAssignment(item.node) ? await project.checker.getShorthandAssignmentValueSymbol(item.node) : symbols[index];
31510
31517
  const callable = await targets.resolveCallable(symbol2);
31518
+ if (!callable?.objects.length && item.readsState) {
31519
+ await readState();
31520
+ continue;
31521
+ }
31511
31522
  const holder = callable && item.holder ? materialize(item.holder) : void 0;
31512
31523
  if (holder && item.holder) callableHolders.add(key(item.holder));
31513
31524
  for (const destination of callable?.objects ?? [])