layermap 0.1.24 → 0.1.26
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 +6 -5
- package/analyzers/project-map-java/java-map.jar +0 -0
- package/analyzers/project-map-worker.mjs +17 -6
- package/dist/cli.mjs +600 -234
- package/dist/launcher.mjs +105 -0
- package/package.json +1 -1
- package/pi/layermap.mjs +29 -22
package/README.md
CHANGED
|
@@ -143,9 +143,9 @@ This adds LayerMap to every dsh profile. Each session maps the project dsh was s
|
|
|
143
143
|
|
|
144
144
|
In every agent, start a new session in a Git repository and ask as usual. LayerMap tells the agent
|
|
145
145
|
when the map helps. A session started in a folder holding several repositories, or one that moves
|
|
146
|
-
to another repository, works too: each map tool call maps the repository its path names.
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
to another repository, works too: each map tool call maps the repository its path names. The first
|
|
147
|
+
time a session starts a version of LayerMap, npm installs that pinned `layermap` package into
|
|
148
|
+
LayerMap's cache; later sessions start it from there, even offline.
|
|
149
149
|
|
|
150
150
|
Claude Code asks once before each map tool runs in a project. Choose "don't ask again", or run
|
|
151
151
|
`npx layermap allow claude` to allow the plugin's read-only tools everywhere.
|
|
@@ -177,8 +177,9 @@ things:
|
|
|
177
177
|
- lets its read-only tools run without a prompt;
|
|
178
178
|
- adds one marked sentence to the agent's instructions file.
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
other MCP client, run `npx -y layermap mcp` as a stdio server in the
|
|
180
|
+
Setup is for one machine; for a whole team, have each member install the plugin. `npx layermap
|
|
181
|
+
remove …` undoes it. For any other MCP client, run `npx -y layermap mcp` as a stdio server in the
|
|
182
|
+
repository.
|
|
182
183
|
|
|
183
184
|
**Requirements:**
|
|
184
185
|
|
|
Binary file
|
|
@@ -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) &&
|
|
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 (
|
|
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
|
-
|
|
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 ?? [])
|