MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / loadUsage

Function loadUsage

scripts/fungrim/gen-reference-doc.ts:153–164  ·  view source on GitHub ↗

Map each used bare entry id -> how the engine uses it.

()

Source from the content-addressed store, hash-verified

151
152/** Map each used bare entry id -> how the engine uses it. */
153function loadUsage(): { usage: Map<string, Usage>; manifest: any } {
154 const artifact = JSON.parse(fs.readFileSync(ARTIFACT, 'utf8'));
155 const usage = new Map<string, Usage>();
156 for (const r of artifact.rules as { id: string; purpose: string; target: string }[]) {
157 const bare = r.id.replace(/^fungrim:/, '').replace(/:solve$/, '');
158 let u = usage.get(bare);
159 if (!u) usage.set(bare, (u = { purposes: new Set(), targets: new Set() }));
160 u.purposes.add(r.purpose);
161 u.targets.add(r.target);
162 }
163 return { usage, manifest: artifact.manifest };
164}
165
166/** topic id -> human title, read from each corpus file's header. */
167function loadTopicTitles(): Map<string, string> {

Callers 1

generateReferenceDocFunction · 0.85

Calls 5

parseMethod · 0.65
replaceMethod · 0.65
getMethod · 0.65
setMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected