Map each used bare entry id -> how the engine uses it.
()
| 151 | |
| 152 | /** Map each used bare entry id -> how the engine uses it. */ |
| 153 | function 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. */ |
| 167 | function loadTopicTitles(): Map<string, string> { |