{"draft":null,"from":19,"to":20,"files":[{"path":"client/test/issues.test.ts","added":18,"removed":1,"diff":"--- a/client/test/issues.test.ts\n+++ b/client/test/issues.test.ts\n@@ -14,6 +14,7 @@\n import { after, before, describe, it } from \"node:test\";\n import { readMachineServers } from \"../src/config.ts\";\n import { issuesServerFor, tokenGoesTo } from \"../src/core.ts\";\n+import { searchLines } from \"../src/issues.ts\";\n import { main } from \"../src/main.ts\";\n import { argvFor, mcpTools } from \"../src/mcp.ts\";\n import { type Fake, startFake } from \"./fake-server.ts\";\n@@ -106,7 +107,7 @@\n \n \tit(\"are MCP tools\", () => {\n \t\tconst names = mcpTools().map((t) => t.name);\n-\t\tfor (const n of [\"issues\", \"issue\", \"ask\", \"waiting\", \"answer\"]) assert.ok(names.includes(n), n);\n+\t\tfor (const n of [\"issues\", \"issue\", \"search\", \"ask\", \"waiting\", \"answer\"]) assert.ok(names.includes(n), n);\n \t\tassert.deepEqual(argvFor(\"ask\", { args: [\"alice\", \"Which login?\"], issue: \"3\", review: true }), [\n \t\t\t\"ask\",\n \t\t\t\"--issue=3\",\n@@ -133,6 +134,9 @@\n \t\t\t[\"ask\", \"--withdraw\", \"3\", \"--issue\", \"2\"],\n \t\t\t[\"ask\", \"--withdraw\", \"3\", \"--task\"],\n \t\t\t[\"ask\", \"alice\", \"q\", \"--note\", \"a note without --withdraw\"],\n+\t\t\t[\"search\"],\n+\t\t\t[\"search\", \"words\", \"--limit\", \"0\"],\n+\t\t\t[\"search\", \"words\", \"--limit\", \"51\"],\n \t\t]) {\n \t\t\tconst r = await avcs(erin, argv);\n \t\t\tassert.equal(r.exit, 1, `${argv.join(\" \")}: ${r.out}`);\n@@ -140,6 +144,19 @@\n \t\tassert.equal(seen.length, before);\n \t});\n \n+\tit(\"shows a search hit as the issue, then where it matched, without the match markers\", () => {\n+\t\tconst issue = { id: 12, title: \"Sync is slow\", status: \"open\" as const, updated: 0, labels: [] };\n+\t\tassert.deepEqual(\n+\t\t\tsearchLines({ issue, where: \"comment\", comment: 40, snippet: \"the \\u0001network\\u0002 drops mid-sync\" }),\n+\t\t\t['   12  open         \"Sync is slow\"', '       in comment 40: \"the network drops mid-sync\"'],\n+\t\t);\n+\t\tassert.deepEqual(searchLines({ issue, where: \"description\", snippet: \"Pages load late.\", meaning: true }), [\n+\t\t\t'   12  open         \"Sync is slow\"',\n+\t\t\t'       by meaning: \"Pages load late.\"',\n+\t\t]);\n+\t\tassert.deepEqual(searchLines({ issue, where: \"title\", snippet: \"Sync is slow\" })[1], \"       in the title\");\n+\t});\n+\n \tit(\"withdraw is one POST to the asker's own withdraw/<ask> route\", async () => {\n \t\tconst erin = await folder(\"erin\");\n \t\tconst before = seen.length;"}],"unmatched":[]}