layermap 0.1.51 → 0.1.52
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/analyzers/project-map-java/java-map.jar +0 -0
- package/dist/cli.mjs +184 -45
- package/package.json +1 -1
- package/pi/layermap.mjs +1 -1
|
Binary file
|
package/dist/cli.mjs
CHANGED
|
@@ -19126,7 +19126,6 @@ var TYPESCRIPT_MAP_LANGUAGE = Object.freeze({
|
|
|
19126
19126
|
reads: (path20) => path20.endsWith(".json") || path20.endsWith(".wxml") || path20 === "pnpm-workspace.yaml",
|
|
19127
19127
|
create: () => new TypeScriptMapAnalyzer()
|
|
19128
19128
|
});
|
|
19129
|
-
var CONFIGURATIONS_KEPT = 4;
|
|
19130
19129
|
var WORKERS_AT_ONCE = Math.min(4, availableParallelism());
|
|
19131
19130
|
function limit(atOnce) {
|
|
19132
19131
|
let running = 0;
|
|
@@ -19145,6 +19144,12 @@ function limit(atOnce) {
|
|
|
19145
19144
|
}
|
|
19146
19145
|
var MODULE_NAMES = /\b(?:from|import|require)\s*\(?\s*(["'`])([^"'`\n]+)\1|\/\/\/\s*<reference\s+(?:path|types|lib)\s*=\s*(["'])([^"'\n]+)\3/gu;
|
|
19147
19146
|
var moduleNames = (text) => digestValue([...text.matchAll(MODULE_NAMES)].map((match) => match[2] ?? match[4] ?? ""));
|
|
19147
|
+
var KeptDiscoverySchema = external_exports.object({
|
|
19148
|
+
key: external_exports.string(),
|
|
19149
|
+
discovered: MapConfigurationResultSchema,
|
|
19150
|
+
installed: external_exports.string(),
|
|
19151
|
+
files: external_exports.array(external_exports.tuple([external_exports.string(), external_exports.string().nullable(), external_exports.string().nullable()]))
|
|
19152
|
+
}).strict();
|
|
19148
19153
|
var sameShape = (left, right) => left.installed === right.installed && left.files.size === right.files.size && [...left.files].every(([path20, { shape }]) => right.files.get(path20)?.shape === shape);
|
|
19149
19154
|
var stopUnconfirmed = async (runs) => (await Promise.allSettled(runs)).flatMap((settled) => settled.status === "rejected" ? [settled.reason] : []).find((reason) => reason instanceof ProjectMapStopUnconfirmedError);
|
|
19150
19155
|
async function inOrder(tasks, take, signal, sizes) {
|
|
@@ -19178,11 +19183,6 @@ var TypeScriptMapAnalyzer = class {
|
|
|
19178
19183
|
id = TYPESCRIPT_MAP_LANGUAGE.id;
|
|
19179
19184
|
claims = TYPESCRIPT_MAP_LANGUAGE.claims;
|
|
19180
19185
|
reads = TYPESCRIPT_MAP_LANGUAGE.reads;
|
|
19181
|
-
// Discovery reads the texts of the files the language reads and what is installed, nothing else,
|
|
19182
|
-
// so a result stands while they are the same, as they are when only other languages' files changed.
|
|
19183
|
-
configurations = /* @__PURE__ */ new Map();
|
|
19184
|
-
// The last configuration discovered, and the shape of the code it was discovered from.
|
|
19185
|
-
last;
|
|
19186
19186
|
async operation(input, schema, signal, observe) {
|
|
19187
19187
|
const start = performance.now();
|
|
19188
19188
|
const event = {
|
|
@@ -19331,13 +19331,21 @@ var TypeScriptMapAnalyzer = class {
|
|
|
19331
19331
|
files: session.readable.map((entry) => [entry.path, entry.contentDigest ?? null]),
|
|
19332
19332
|
installed: installed.digest
|
|
19333
19333
|
});
|
|
19334
|
-
const
|
|
19334
|
+
const kept = session.kept === void 0 ? void 0 : KeptDiscoverySchema.parse(session.kept);
|
|
19335
|
+
const last = kept && {
|
|
19336
|
+
discovered: kept.discovered,
|
|
19337
|
+
shape: {
|
|
19338
|
+
installed: kept.installed,
|
|
19339
|
+
files: new Map(kept.files.map(([path20, digest, shape2]) => [path20, { digest, shape: shape2 }]))
|
|
19340
|
+
}
|
|
19341
|
+
};
|
|
19342
|
+
const known = kept?.key === configurationKey ? kept.discovered : void 0;
|
|
19335
19343
|
const shape = {
|
|
19336
19344
|
installed: installed.digest,
|
|
19337
19345
|
files: new Map(
|
|
19338
19346
|
session.readable.map((entry) => {
|
|
19339
19347
|
const digest = entry.contentDigest ?? null;
|
|
19340
|
-
const before =
|
|
19348
|
+
const before = last?.shape.files.get(entry.path);
|
|
19341
19349
|
return [
|
|
19342
19350
|
entry.path,
|
|
19343
19351
|
{
|
|
@@ -19348,7 +19356,7 @@ var TypeScriptMapAnalyzer = class {
|
|
|
19348
19356
|
})
|
|
19349
19357
|
)
|
|
19350
19358
|
};
|
|
19351
|
-
const guess = !known &&
|
|
19359
|
+
const guess = !known && last && sameShape(last.shape, shape) ? last.discovered : void 0;
|
|
19352
19360
|
const speculative = /* @__PURE__ */ new Map();
|
|
19353
19361
|
try {
|
|
19354
19362
|
if (guess && admitted(guess))
|
|
@@ -19381,11 +19389,12 @@ var TypeScriptMapAnalyzer = class {
|
|
|
19381
19389
|
signal,
|
|
19382
19390
|
observe
|
|
19383
19391
|
);
|
|
19384
|
-
|
|
19385
|
-
|
|
19386
|
-
|
|
19387
|
-
|
|
19388
|
-
|
|
19392
|
+
session.keep({
|
|
19393
|
+
key: configurationKey,
|
|
19394
|
+
discovered,
|
|
19395
|
+
installed: installed.digest,
|
|
19396
|
+
files: [...shape.files].map(([path20, file2]) => [path20, file2.digest, file2.shape])
|
|
19397
|
+
});
|
|
19389
19398
|
if (!admitted(discovered))
|
|
19390
19399
|
throw new ProjectEvidenceError("PROJECT_MAP_PROTOCOL_INVALID", false);
|
|
19391
19400
|
const { workspace } = discovered;
|
|
@@ -21412,6 +21421,21 @@ CREATE VIEW project_map_navigation AS
|
|
|
21412
21421
|
ON document.path = file.path AND document.unit_ref = coalesce(unit.unit_ref, '')
|
|
21413
21422
|
WHERE file.entry_state = 'TEXT';
|
|
21414
21423
|
`;
|
|
21424
|
+
var CODE_INDEX_COMPILE_RESULTS_MIGRATION = `
|
|
21425
|
+
CREATE TABLE project_map_compile_results (
|
|
21426
|
+
version_ref TEXT NOT NULL REFERENCES project_code_versions(version_ref) ON DELETE CASCADE,
|
|
21427
|
+
result_key TEXT NOT NULL,
|
|
21428
|
+
result_json TEXT NOT NULL CHECK (json_valid(result_json)),
|
|
21429
|
+
PRIMARY KEY (version_ref, result_key)
|
|
21430
|
+
);
|
|
21431
|
+
CREATE INDEX project_map_compile_result_key ON project_map_compile_results(result_key);
|
|
21432
|
+
CREATE TABLE project_map_language_states (
|
|
21433
|
+
version_ref TEXT NOT NULL REFERENCES project_code_versions(version_ref) ON DELETE CASCADE,
|
|
21434
|
+
language TEXT NOT NULL,
|
|
21435
|
+
state_json TEXT NOT NULL CHECK (json_valid(state_json)),
|
|
21436
|
+
PRIMARY KEY (version_ref, language)
|
|
21437
|
+
);
|
|
21438
|
+
`;
|
|
21415
21439
|
var MapReplayConflict = class extends Error {
|
|
21416
21440
|
};
|
|
21417
21441
|
var corrupt2 = () => {
|
|
@@ -21477,6 +21501,10 @@ var CodeIndexStore = class {
|
|
|
21477
21501
|
throw error51;
|
|
21478
21502
|
}
|
|
21479
21503
|
}
|
|
21504
|
+
/** Stages what a language keeps of the build for the next one, stored with the version. */
|
|
21505
|
+
appendMapLanguageState(buildRef, language, state) {
|
|
21506
|
+
this.database.prepare("INSERT INTO project_map_staging (build_ref, kind, value_json) VALUES (?, ?, ?)").run(buildRef, "states", canonicalJson({ language, state }));
|
|
21507
|
+
}
|
|
21480
21508
|
discardMapStage(buildRef) {
|
|
21481
21509
|
this.database.prepare("DELETE FROM project_map_staging WHERE build_ref = ?").run(buildRef);
|
|
21482
21510
|
}
|
|
@@ -21542,6 +21570,9 @@ var CodeIndexStore = class {
|
|
|
21542
21570
|
SELECT ?, json_extract(value_json, '$.ref'), json_extract(value_json, '$.requestDigest'),
|
|
21543
21571
|
value_json FROM project_map_staging
|
|
21544
21572
|
WHERE build_ref = ? AND kind = 'results' ORDER BY position`).run(version2.version, buildRef);
|
|
21573
|
+
this.database.prepare(`INSERT INTO project_map_language_states
|
|
21574
|
+
SELECT ?, value_json ->> '$.language', value_json -> '$.state'
|
|
21575
|
+
FROM project_map_staging WHERE build_ref = ? AND kind = 'states' ORDER BY position`).run(version2.version, buildRef);
|
|
21545
21576
|
this.commitUnits(version2.version, staged);
|
|
21546
21577
|
const member = this.database.prepare(
|
|
21547
21578
|
"INSERT INTO project_map_version_units VALUES (?, ?, ?)"
|
|
@@ -21726,6 +21757,42 @@ var CodeIndexStore = class {
|
|
|
21726
21757
|
WHERE version_ref = ? AND context_ref = ? AND json_type(result_json, '$.state') = 'object'`).get(version2, contextRef);
|
|
21727
21758
|
return row ? JSON.parse(String(row.state)) : void 0;
|
|
21728
21759
|
}
|
|
21760
|
+
/** What a language kept of a version's build, if anything. */
|
|
21761
|
+
mapLanguageState(version2, language) {
|
|
21762
|
+
const row = this.database.prepare(
|
|
21763
|
+
"SELECT state_json FROM project_map_language_states WHERE version_ref = ? AND language = ?"
|
|
21764
|
+
).get(version2, language);
|
|
21765
|
+
return row ? JSON.parse(String(row.state_json)) : void 0;
|
|
21766
|
+
}
|
|
21767
|
+
/**
|
|
21768
|
+
* The stored compile results of the given keys, whichever version stored them; a version reading
|
|
21769
|
+
* another's keeps a copy, so the result stays while either does.
|
|
21770
|
+
*/
|
|
21771
|
+
compileResults(version2, keys) {
|
|
21772
|
+
const own = this.database.prepare(
|
|
21773
|
+
"SELECT result_json FROM project_map_compile_results WHERE version_ref = ? AND result_key = ?"
|
|
21774
|
+
);
|
|
21775
|
+
const other = this.database.prepare(
|
|
21776
|
+
"SELECT result_json FROM project_map_compile_results WHERE result_key = ? LIMIT 1"
|
|
21777
|
+
);
|
|
21778
|
+
const copy = this.database.prepare(
|
|
21779
|
+
"INSERT OR IGNORE INTO project_map_compile_results VALUES (?, ?, ?)"
|
|
21780
|
+
);
|
|
21781
|
+
const found = /* @__PURE__ */ new Map();
|
|
21782
|
+
for (const key of new Set(keys)) {
|
|
21783
|
+
let row = own.get(version2, key);
|
|
21784
|
+
if (!row) {
|
|
21785
|
+
row = other.get(key);
|
|
21786
|
+
if (row) copy.run(version2, key, String(row.result_json));
|
|
21787
|
+
}
|
|
21788
|
+
if (row) found.set(key, JSON.parse(String(row.result_json)));
|
|
21789
|
+
}
|
|
21790
|
+
return found;
|
|
21791
|
+
}
|
|
21792
|
+
/** Keeps a compile result of a version, by the digest of what the compile read. */
|
|
21793
|
+
keepCompileResult(version2, key, result) {
|
|
21794
|
+
this.database.prepare("INSERT OR REPLACE INTO project_map_compile_results VALUES (?, ?, ?)").run(version2, key, canonicalJson(result));
|
|
21795
|
+
}
|
|
21729
21796
|
getVersion(version2) {
|
|
21730
21797
|
const row = this.database.prepare("SELECT * FROM project_code_versions WHERE version_ref = ?").get(version2);
|
|
21731
21798
|
if (!row) return void 0;
|
|
@@ -21976,7 +22043,7 @@ var ProjectMapAnalyzer = class {
|
|
|
21976
22043
|
diagnostics(input, path20, signal) {
|
|
21977
22044
|
return this.languages.find((language) => language.claims(path20))?.diagnostics?.(input, signal, this.observe);
|
|
21978
22045
|
}
|
|
21979
|
-
async analyze(reader, entries, installed, signal, consume, parent) {
|
|
22046
|
+
async analyze(reader, entries, installed, signal, consume, keep, parent) {
|
|
21980
22047
|
const result = {
|
|
21981
22048
|
gaps: [{ code: "MAP_COVERS_ADMITTED_SCOPE_AND_POLICY_ONLY" }],
|
|
21982
22049
|
parsedFiles: []
|
|
@@ -22110,6 +22177,8 @@ var ProjectMapAnalyzer = class {
|
|
|
22110
22177
|
replays,
|
|
22111
22178
|
previous,
|
|
22112
22179
|
configuration: (path20) => configurationInputs.add(path20),
|
|
22180
|
+
kept: parent?.kept(language.id),
|
|
22181
|
+
keep: (state) => keep(language.id, state),
|
|
22113
22182
|
observe: this.observe
|
|
22114
22183
|
},
|
|
22115
22184
|
signal
|
|
@@ -22195,14 +22264,93 @@ var ProjectMapReferenceQuery = class {
|
|
|
22195
22264
|
AND json_extract(c.context_json, '$.mode') != 'SYNTAX_ONLY'
|
|
22196
22265
|
ORDER BY c.context_ref`).all(version2, path20).map((value) => MapContextSchema.parse(JSON.parse(String(value.context_json))));
|
|
22197
22266
|
}
|
|
22198
|
-
// A context's
|
|
22199
|
-
|
|
22200
|
-
|
|
22267
|
+
// A context's files as the version captured them.
|
|
22268
|
+
entries(version2, context) {
|
|
22269
|
+
return context.inputFiles.map((file2) => {
|
|
22201
22270
|
const entry = this.store.getEntry(version2, file2);
|
|
22202
22271
|
if (entry?.state !== "TEXT")
|
|
22203
22272
|
throw new ProjectEvidenceError("PROJECT_EVIDENCE_STORE_CORRUPT", false);
|
|
22204
22273
|
return entry;
|
|
22205
22274
|
});
|
|
22275
|
+
}
|
|
22276
|
+
/**
|
|
22277
|
+
* The digest of everything a compile of a context reads: the analyzers, the context, its files'
|
|
22278
|
+
* contents and the packages installed now where they resolve them. A compile of equal inputs says
|
|
22279
|
+
* the same, so its stored result stands for it.
|
|
22280
|
+
*/
|
|
22281
|
+
compileInputs(version2, source, context) {
|
|
22282
|
+
const { ref, configPath, rootFiles, workspace, inputFiles } = context;
|
|
22283
|
+
return digestValue({
|
|
22284
|
+
analyzer: this.analyzer.id,
|
|
22285
|
+
context: {
|
|
22286
|
+
ref,
|
|
22287
|
+
configPath: configPath ?? null,
|
|
22288
|
+
rootFiles: rootFiles ?? null,
|
|
22289
|
+
workspace: workspace ?? null,
|
|
22290
|
+
inputFiles
|
|
22291
|
+
},
|
|
22292
|
+
contents: this.entries(version2, context).map((entry) => [entry.path, entry.contentDigest]),
|
|
22293
|
+
installed: mapInstalledDigest(source.directory.canonicalPath, inputFiles)
|
|
22294
|
+
});
|
|
22295
|
+
}
|
|
22296
|
+
/**
|
|
22297
|
+
* A context's compiler diagnostics: the stored result of a compile of the same inputs, or a
|
|
22298
|
+
* compile's, stored for the next. Undefined for a language without a compiler to ask.
|
|
22299
|
+
*/
|
|
22300
|
+
async compileDiagnostics(version2, source, context, path20, signal) {
|
|
22301
|
+
const key = digestValue({
|
|
22302
|
+
operation: "DIAGNOSTICS",
|
|
22303
|
+
inputs: this.compileInputs(version2, source, context)
|
|
22304
|
+
});
|
|
22305
|
+
const stored = this.store.compileResults(version2, [key]);
|
|
22306
|
+
if (stored.has(key)) return MapDiagnosticsSchema.parse(stored.get(key));
|
|
22307
|
+
const { reader, request } = await this.open(version2, source, context, signal);
|
|
22308
|
+
const result = await this.analyzer.diagnostics(request, path20, signal);
|
|
22309
|
+
await reader.assertStable();
|
|
22310
|
+
if (!result) return void 0;
|
|
22311
|
+
if (result.requiredFiles.length)
|
|
22312
|
+
throw new ProjectEvidenceError("PROJECT_MAP_CONTEXT_INCOMPLETE", false);
|
|
22313
|
+
this.store.keepCompileResult(version2, key, result);
|
|
22314
|
+
return result;
|
|
22315
|
+
}
|
|
22316
|
+
/**
|
|
22317
|
+
* A page for each request of one context, in order: stored pages of compiles of the same inputs,
|
|
22318
|
+
* and one compile for the rest, whose pages are stored for the next. A request the deadline left
|
|
22319
|
+
* unread has no page.
|
|
22320
|
+
*/
|
|
22321
|
+
async referencePages(version2, source, context, requests, signal, until) {
|
|
22322
|
+
const inputs = this.compileInputs(version2, source, context);
|
|
22323
|
+
const keys = requests.map(
|
|
22324
|
+
(request2) => digestValue({ operation: "REFERENCES", inputs, request: request2 })
|
|
22325
|
+
);
|
|
22326
|
+
const stored = this.store.compileResults(version2, keys);
|
|
22327
|
+
const pages = keys.map(
|
|
22328
|
+
(key) => stored.has(key) ? MapReferencePageSchema.nullable().parse(stored.get(key)) : void 0
|
|
22329
|
+
);
|
|
22330
|
+
const unread = keys.flatMap((_, at) => pages[at] === void 0 ? [at] : []);
|
|
22331
|
+
if (!unread.length) return pages;
|
|
22332
|
+
const { reader, files, request } = await this.open(version2, source, context, signal);
|
|
22333
|
+
const { pages: read, requiredFiles } = await this.analyzer.references(
|
|
22334
|
+
request,
|
|
22335
|
+
unread.map((at) => requests[at]),
|
|
22336
|
+
signal,
|
|
22337
|
+
until
|
|
22338
|
+
);
|
|
22339
|
+
if (requiredFiles.length)
|
|
22340
|
+
throw new ProjectEvidenceError("PROJECT_MAP_CONTEXT_INCOMPLETE", false);
|
|
22341
|
+
if (read.length > unread.length || read.some((page) => page?.references.some((reference) => !anchored(reference, files))))
|
|
22342
|
+
throw invalidProtocol();
|
|
22343
|
+
await reader.assertStable();
|
|
22344
|
+
for (const [index, page] of read.entries()) {
|
|
22345
|
+
const at = unread[index];
|
|
22346
|
+
pages[at] = page;
|
|
22347
|
+
this.store.keepCompileResult(version2, keys[at], page);
|
|
22348
|
+
}
|
|
22349
|
+
return pages;
|
|
22350
|
+
}
|
|
22351
|
+
// A context's sources, and the request for its compile.
|
|
22352
|
+
async open(version2, source, context, signal) {
|
|
22353
|
+
const entries = this.entries(version2, context);
|
|
22206
22354
|
const reader = await ProjectMapSourceReader.open(source, signal, false);
|
|
22207
22355
|
const files = /* @__PURE__ */ Object.create(null);
|
|
22208
22356
|
const contents = await reader.readAll(entries);
|
|
@@ -22258,12 +22406,8 @@ var ProjectMapReferenceQuery = class {
|
|
|
22258
22406
|
continue;
|
|
22259
22407
|
}
|
|
22260
22408
|
const [path20] = context.rootFiles ?? context.inputFiles;
|
|
22261
|
-
const
|
|
22262
|
-
const result = path20 === void 0 ? void 0 : await this.analyzer.diagnostics(request, path20, signal);
|
|
22263
|
-
await reader.assertStable();
|
|
22409
|
+
const result = path20 === void 0 ? void 0 : await this.compileDiagnostics(input.version, source, context, path20, signal);
|
|
22264
22410
|
if (!result) continue;
|
|
22265
|
-
if (result.requiredFiles.length)
|
|
22266
|
-
throw new ProjectEvidenceError("PROJECT_MAP_CONTEXT_INCOMPLETE", false);
|
|
22267
22411
|
const found = new Map(
|
|
22268
22412
|
result.diagnostics.map((item) => [
|
|
22269
22413
|
`${item.path}:${item.line}:${item.code}:${item.text}`,
|
|
@@ -22311,9 +22455,10 @@ var ProjectMapReferenceQuery = class {
|
|
|
22311
22455
|
}
|
|
22312
22456
|
for (const { context, targets } of compiles.values()) {
|
|
22313
22457
|
if (Date.now() > input.until) break;
|
|
22314
|
-
const
|
|
22315
|
-
|
|
22316
|
-
|
|
22458
|
+
const pages = await this.referencePages(
|
|
22459
|
+
input.version,
|
|
22460
|
+
source,
|
|
22461
|
+
context,
|
|
22317
22462
|
targets.map((object2) => ({
|
|
22318
22463
|
targetPath: object2.anchor.path,
|
|
22319
22464
|
symbolStart: object2.symbolStart,
|
|
@@ -22323,24 +22468,19 @@ var ProjectMapReferenceQuery = class {
|
|
|
22323
22468
|
signal,
|
|
22324
22469
|
input.until
|
|
22325
22470
|
);
|
|
22326
|
-
if (requiredFiles.length)
|
|
22327
|
-
throw new ProjectEvidenceError("PROJECT_MAP_CONTEXT_INCOMPLETE", false);
|
|
22328
|
-
if (pages.length > targets.length)
|
|
22329
|
-
throw new ProjectEvidenceError("PROJECT_MAP_PROTOCOL_INVALID", false);
|
|
22330
22471
|
for (const [at, page] of pages.entries()) {
|
|
22472
|
+
if (page === void 0) continue;
|
|
22331
22473
|
const read = found.get(targets[at]?.id ?? "");
|
|
22332
22474
|
read.waiting--;
|
|
22333
22475
|
if (!page || page.nextOffset !== void 0) read.complete = false;
|
|
22334
22476
|
for (const reference of page?.references ?? []) {
|
|
22335
22477
|
const location2 = canonicalJson(reference.anchor);
|
|
22336
|
-
if (!anchored(reference, files)) throw invalidProtocol();
|
|
22337
22478
|
if (read.locations.has(location2)) continue;
|
|
22338
22479
|
read.locations.add(location2);
|
|
22339
22480
|
const owner = this.owner(input.version, reference.anchor);
|
|
22340
22481
|
read.uses.push({ ...reference, ...owner ? { owner } : {} });
|
|
22341
22482
|
}
|
|
22342
22483
|
}
|
|
22343
|
-
await reader.assertStable();
|
|
22344
22484
|
if (signal.aborted) throw new ProjectEvidenceError("PROJECT_READ_CANCELLED", true);
|
|
22345
22485
|
}
|
|
22346
22486
|
return new Map(
|
|
@@ -22420,12 +22560,10 @@ ${scope}`, input.cursor, 2) : [];
|
|
|
22420
22560
|
}
|
|
22421
22561
|
const context = contexts[cursor.context];
|
|
22422
22562
|
if (!context) throw new ProjectEvidenceError("PROJECT_CONTINUATION_INVALID", false);
|
|
22423
|
-
const
|
|
22424
|
-
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
} = await this.analyzer.references(
|
|
22428
|
-
request,
|
|
22563
|
+
const [page] = await this.referencePages(
|
|
22564
|
+
input.version,
|
|
22565
|
+
source,
|
|
22566
|
+
context,
|
|
22429
22567
|
[
|
|
22430
22568
|
{
|
|
22431
22569
|
targetPath: object2.anchor.path,
|
|
@@ -22437,8 +22575,6 @@ ${scope}`, input.cursor, 2) : [];
|
|
|
22437
22575
|
],
|
|
22438
22576
|
signal
|
|
22439
22577
|
);
|
|
22440
|
-
if (requiredFiles.length)
|
|
22441
|
-
throw new ProjectEvidenceError("PROJECT_MAP_CONTEXT_INCOMPLETE", false);
|
|
22442
22578
|
if (page === void 0) throw invalidProtocol();
|
|
22443
22579
|
if (page === null)
|
|
22444
22580
|
throw new ProjectEvidenceError("PROJECT_MAP_REFERENCE_TARGET_UNAVAILABLE", false);
|
|
@@ -22448,14 +22584,13 @@ ${scope}`, input.cursor, 2) : [];
|
|
|
22448
22584
|
const locations = /* @__PURE__ */ new Set();
|
|
22449
22585
|
for (const reference of page.references) {
|
|
22450
22586
|
const location2 = canonicalJson(reference.anchor);
|
|
22451
|
-
if (!
|
|
22587
|
+
if (!mapPathAllowed(reference.anchor.path, prefixes) || !mapQueryPathMatches(reference.anchor.path, query.within) || !query.kinds.includes(reference.kind) || locations.has(location2))
|
|
22452
22588
|
throw invalidProtocol();
|
|
22453
22589
|
locations.add(location2);
|
|
22454
22590
|
const owner = this.owner(input.version, reference.anchor);
|
|
22455
22591
|
const item = { ...reference, contextRef: context.ref, ...owner ? { owner } : {} };
|
|
22456
22592
|
references.push(item);
|
|
22457
22593
|
}
|
|
22458
|
-
await reader.assertStable();
|
|
22459
22594
|
if (signal.aborted) throw new ProjectEvidenceError("PROJECT_READ_CANCELLED", true);
|
|
22460
22595
|
return mapQueryPage(
|
|
22461
22596
|
references.length,
|
|
@@ -22569,6 +22704,7 @@ var CodeIndex = class {
|
|
|
22569
22704
|
{ directory: source.directory.canonicalPath, digest: result.installedDigest },
|
|
22570
22705
|
controller.signal,
|
|
22571
22706
|
(unit, record2) => this.store.appendMapStage(stage, unit, record2),
|
|
22707
|
+
(language, state) => this.store.appendMapLanguageState(stage, language, state),
|
|
22572
22708
|
parent && { ...parent, link: (paths) => linked.push(...paths) }
|
|
22573
22709
|
);
|
|
22574
22710
|
await reader.readAll(result.entries);
|
|
@@ -22633,7 +22769,8 @@ var CodeIndex = class {
|
|
|
22633
22769
|
entries,
|
|
22634
22770
|
contexts: this.store.mapContexts(version2),
|
|
22635
22771
|
shell: (contextRef) => this.store.mapContextShell(version2, contextRef),
|
|
22636
|
-
state: (contextRef) => this.store.mapContextState(version2, contextRef)
|
|
22772
|
+
state: (contextRef) => this.store.mapContextState(version2, contextRef),
|
|
22773
|
+
kept: (language) => this.store.mapLanguageState(version2, language)
|
|
22637
22774
|
};
|
|
22638
22775
|
}
|
|
22639
22776
|
read(signal, operation) {
|
|
@@ -25863,7 +26000,7 @@ async function compileBreaks(input, views, changes, base, until, signal, phase,
|
|
|
25863
26000
|
}
|
|
25864
26001
|
|
|
25865
26002
|
// src/layermap.ts
|
|
25866
|
-
var SCHEMA_VERSION =
|
|
26003
|
+
var SCHEMA_VERSION = 4;
|
|
25867
26004
|
var KEEP_VERSIONS = 3;
|
|
25868
26005
|
var KEEP_COMMIT_VERSIONS = 2;
|
|
25869
26006
|
var HOLD_EXPIRY_MS = 10 * 60 * 1e3;
|
|
@@ -25913,9 +26050,11 @@ function openMapDatabase(file2) {
|
|
|
25913
26050
|
CODE_INDEX_SCHEMA,
|
|
25914
26051
|
CODE_INDEX_UNITS_MIGRATION,
|
|
25915
26052
|
CODE_INDEX_CONTEXT_RESULTS_MIGRATION,
|
|
25916
|
-
CODE_INDEX_SHARED_NAVIGATION_MIGRATION
|
|
26053
|
+
CODE_INDEX_SHARED_NAVIGATION_MIGRATION,
|
|
26054
|
+
CODE_INDEX_COMPILE_RESULTS_MIGRATION
|
|
25917
26055
|
])
|
|
25918
26056
|
database.exec(sql);
|
|
26057
|
+
else if (current < 4) database.exec(CODE_INDEX_COMPILE_RESULTS_MIGRATION);
|
|
25919
26058
|
if (current < 3) database.exec(LAYERMAP_TABLES);
|
|
25920
26059
|
if (database.prepare("PRAGMA foreign_key_check").get())
|
|
25921
26060
|
throw new ProjectEvidenceError("PROJECT_EVIDENCE_STORE_CORRUPT", false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "layermap",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.52",
|
|
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
|
@@ -293,7 +293,7 @@ function layermap(pi) {
|
|
|
293
293
|
if (server && !server.dead) return server;
|
|
294
294
|
starting ??= (async () => {
|
|
295
295
|
const next = new MapServer(cwd);
|
|
296
|
-
const tools = await next.start("0.1.
|
|
296
|
+
const tools = await next.start("0.1.52");
|
|
297
297
|
for (const tool of tools) {
|
|
298
298
|
if (registered.has(tool.name)) continue;
|
|
299
299
|
registered.add(tool.name);
|