| 223 | } |
| 224 | |
| 225 | function printReport(fixture, report, evaluated) { |
| 226 | const { checks, delivered, allocated } = evaluated; |
| 227 | const env = report.envelope; |
| 228 | say(''); |
| 229 | say(`── ${fixture.id} — ${fixture.title}`); |
| 230 | say(` query "${report.query}"`); |
| 231 | say(` project ${report.projectRoot} · ${num(report.indexedFileCount)} files indexed`); |
| 232 | say( |
| 233 | ` envelope ${num(env.chars)} delivered · ${num(env.allocatedChars)} allocated` + |
| 234 | ` of ${num(report.budget.maxOutputChars)} budget (hard ceiling ${num(report.budget.hardCeiling)})` + |
| 235 | `${env.overBudget ? ' [over budget]' : ''}${env.truncated ? ' [TRUNCATED]' : ''}`, |
| 236 | ); |
| 237 | say(''); |
| 238 | say(' group alloc% deliv%'); |
| 239 | for (const g of ['answer', 'incidental', 'other']) { |
| 240 | if (!delivered.has(g) && !allocated.has(g)) continue; |
| 241 | say(` ${g.padEnd(12)} ${pct(allocated.get(g) ?? 0).padStart(6)} ${pct(delivered.get(g) ?? 0).padStart(6)}`); |
| 242 | } |
| 243 | say(''); |
| 244 | say(' # alloc% deliv% bytes score graph hits gen render file'); |
| 245 | for (const f of report.files.filter((f) => f.emittedChars > 0 || f.finalChars > 0)) { |
| 246 | say( |
| 247 | ' ' + String(f.rank).padStart(2) + ' ' + |
| 248 | pct(f.allocatedShare).padStart(6) + ' ' + |
| 249 | pct(f.share).padStart(6) + ' ' + |
| 250 | num(f.emittedChars).padStart(7) + ' ' + |
| 251 | String(f.score).padStart(5) + ' ' + |
| 252 | f.graphScore.toFixed(5).padStart(7) + ' ' + |
| 253 | String(f.termHits).padStart(4) + ' ' + |
| 254 | (f.generated ? ' ✓ ' : ' ') + ' ' + |
| 255 | ((f.render ?? '-') + (f.clipped ? '*' : '')).padEnd(9) + ' ' + |
| 256 | f.path, |
| 257 | ); |
| 258 | } |
| 259 | say(''); |
| 260 | for (const c of checks) say(` ${c.pass ? 'PASS' : 'FAIL'} ${c.name}\n ${c.detail}`); |
| 261 | } |
| 262 | |
| 263 | async function main() { |
| 264 | const spec = JSON.parse(readFileSync(SPEC_PATH, 'utf-8')); |