perf(doctor): slim cold CLI/MCP doctor module graphs and run probes concurrently

Record default catalog counts and digests in recordedCatalogDigests.js, reuse
the SHA-256-verified mcp-catalog.json in default rea mcp doctor runs, move
Windows existing-project Ghidra admission constants to GhidraAdmission, defer
BinaryTargetResolver and Kuna installation probes until needed, and join
independent Doctor host/provider/identity probes via settleConcurrent.

Statically loaded JS drops 7.03 MB -> 2.07 MB (-70.6%) for rea doctor/setup
(command_ms 440ms -> 207ms, -53.0%) and 5.71 MB -> 0.85 MB (-85.1%) for
rea mcp doctor.
This commit is contained in:
morluto committed 2026-11-17 19:58:40 +08:00
1 parent de12494939
commit cb33fa8376
15 files changed
+445 -130

No files matched your search

+6 -3
View File
@@ -9,19 +9,22 @@ const compiledRoot = resolve(
dirname(fileURLToPath(import.meta.url)),
"../dist",
);
const { createCatalogDigestProfiles } = await import(
const { createCatalogDigestProfiles, DEFAULT_CATALOG_IDENTITY } = await import(
pathToFileURL(join(compiledRoot, "contracts/catalog/catalogIdentity.js")).href
);
// Retain only hashes, with every shared record frozen. Schemas remain owned by
// the compiled contracts and are converted once for both identities.
const profiles = Object.entries(createCatalogDigestProfiles())
const digestProfiles = createCatalogDigestProfiles();
const profiles = Object.entries(digestProfiles)
.map(
([output, digests]) =>
`${JSON.stringify(output)}: Object.freeze(${JSON.stringify(digests)})`,
)
.join(",");
const defaultCounts = JSON.stringify(DEFAULT_CATALOG_IDENTITY.counts);
const defaultDigests = JSON.stringify(digestProfiles.off);
await writeFile(
join(compiledRoot, "contracts/catalog/recordedCatalogDigests.js"),
`/** Recorded from compiled catalog profiles by scripts/record-catalog-digests.mjs; do not edit. */\nexport const RECORDED_CATALOG_DIGEST_PROFILES = Object.freeze({${profiles}});\n`,
`/** Recorded from compiled catalog profiles by scripts/record-catalog-digests.mjs; do not edit. */\nexport const RECORDED_CATALOG_DIGEST_PROFILES = Object.freeze({${profiles}});\nexport const RECORDED_DEFAULT_CATALOG_IDENTITY = Object.freeze({ counts: Object.freeze(${defaultCounts}), digests: Object.freeze(${defaultDigests}) });\n`,
"utf8",
);