mirror of
https://github.com/morluto/rea.git
synced 2026-11-18 04:34:13 +00:00
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.
31 lines
1.5 KiB
JavaScript
31 lines
1.5 KiB
JavaScript
import { writeFile } from "node:fs/promises";
|
|
import { dirname, join, resolve } from "node:path";
|
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
|
|
// Record built-in catalog profile digests into the compiled runtime. Run after
|
|
// `tsc` and before bundling, so the digests come from the same compiled
|
|
// contracts and pinned schema converter that the runtime serves.
|
|
const compiledRoot = resolve(
|
|
dirname(fileURLToPath(import.meta.url)),
|
|
"../dist",
|
|
);
|
|
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 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}});\nexport const RECORDED_DEFAULT_CATALOG_IDENTITY = Object.freeze({ counts: Object.freeze(${defaultCounts}), digests: Object.freeze(${defaultDigests}) });\n`,
|
|
"utf8",
|
|
);
|