// The fixture's enumerate total, as the MCP gives it: `enumerate_matches` // through createCorpusTools (the in-process tools Claude Code's and the // generation jobs' agents call) over a composed public dir. research.spec.ts // runs it with tsx and holds the page's total and ids to it. // // tsx e2e/fixtures/research-enumerate.ts [] // -> {"total": N, "ids": [...], "partial": false} import { createCorpusTools } from "yt-dlp-transcript-mcp/callTool"; const [dir, query, extra] = process.argv.slice(2); const tools = await createCorpusTools({ source: `local:${dir}` }); try { const text = await tools.call("enumerate_matches", { query, content_types: ["video"], ...(extra ? JSON.parse(extra) : {}) }); const total = Number(/(\d+) match\(es\);/.exec(text)?.[1] ?? "0"); const ids = [...text.matchAll(/^- ([^ |]+) \| /gm)].map((m) => m[1]); process.stdout.write(`${JSON.stringify({ total, ids, partial: /COVERAGE PARTIAL/.test(text) })}\n`); } finally { await tools.close(); }