{"version":20,"agent":"devops","message":"Add abso search: find a project's issues by words or meaning\n\n`abso search \"<words>\" [--limit <N>]` lists the project's issues that\nmatch, best first, and is served as an MCP tool as well.\n\n- Each hit shows the issue, then where it matched: the title, the\n  description, a comment, or \"by meaning\".\n- \"#N\" or \"N\" puts issue N first.\n- Where the server also searches by meaning, an issue worded unlike\n  the search still turns up; the hit says so.","time":1791528391686,"timeIso":"2026-10-09T06:46:31.686Z","changes":9,"change":232,"files":["client/src/api.ts","client/src/issues-wire.ts","client/src/issues.ts","client/src/main.ts","client/src/mcp.ts","client/test/issues.test.ts"],"draft":null,"diff":[{"path":"client/src/api.ts","added":19,"removed":2,"diff":"--- a/client/src/api.ts\n+++ b/client/src/api.ts\n@@ -50,7 +50,16 @@\n \tWhereAnswer,\n \tWhyAnswer,\n } from \"./history-answers.ts\";\n-import type { Ask, Attachment, Draft, DraftBody, News as IssueNews, IssuePage, IssueRow } from \"./issues-wire.ts\";\n+import type {\n+\tAsk,\n+\tAttachment,\n+\tDraft,\n+\tDraftBody,\n+\tNews as IssueNews,\n+\tIssuePage,\n+\tIssueRow,\n+\tIssueSearchHit,\n+} from \"./issues-wire.ts\";\n import type { Modes } from \"./modes.ts\";\n \n export * from \"./api-answers.ts\";\n@@ -65,7 +74,7 @@\n } from \"./box-run.ts\";\n export * from \"./ci-answers.ts\";\n export * from \"./history-answers.ts\";\n-export type { Ask, Attachment, Draft, DraftBody, IssueNews, IssuePage, IssueRow };\n+export type { Ask, Attachment, Draft, DraftBody, IssueNews, IssuePage, IssueRow, IssueSearchHit };\n \n /**\n  * How long a call may take: the base, plus 1 s for each 100 KB it sends\n@@ -375,6 +384,14 @@\n \t\t);\n \t}\n \n+\t/**\n+\t * The project's issues matching q, best first: by its words and, where\n+\t * the server has it on, by what it means.\n+\t */\n+\tissueSearch(q: string, limit?: number): Promise<{ hits: readonly IssueSearchHit[] }> {\n+\t\treturn this.#issues(\"GET\", `/search?${query({ q, limit })}`);\n+\t}\n+\n \t/** Every label in use, with how many issues have it and how many of those are open. */\n \tissueLabels(): Promise<{ labels: readonly { label: string; open: number; total: number }[] }> {\n \t\treturn this.#issues(\"GET\", \"/labels\");"},{"path":"client/src/issues-wire.ts","added":11,"removed":0,"diff":"--- a/client/src/issues-wire.ts\n+++ b/client/src/issues-wire.ts\n@@ -134,3 +134,14 @@\n \tbody: DraftBody;\n \tsaved: number;\n }\n+\n+/** One issue search hit: the issue, where it matched, a few words around it. */\n+export interface IssueSearchHit {\n+\tissue: { id: number; title: string; status: Status; updated: number; labels: string[] };\n+\twhere: \"title\" | \"description\" | \"comment\";\n+\tcomment?: number;\n+\t/** The words around the match; char(1) and char(2) bracket each matched span. */\n+\tsnippet: string;\n+\t/** Only meaning search found it: the words differ, the meaning matches. */\n+\tmeaning?: true;\n+}"},{"path":"client/src/issues.ts","added":36,"removed":1,"diff":"--- a/client/src/issues.ts\n+++ b/client/src/issues.ts\n@@ -7,7 +7,7 @@\n \n import { readFileSync, statSync } from \"node:fs\";\n import { basename, resolve } from \"node:path\";\n-import type { Api, Ask, Attachment, Draft, DraftBody, IssuePage, IssueRow } from \"./api.ts\";\n+import type { Api, Ask, Attachment, Draft, DraftBody, IssuePage, IssueRow, IssueSearchHit } from \"./api.ts\";\n import { bool, type Parsed, str, UsageError } from \"./args.ts\";\n import { type Env, type Output, open, plural } from \"./commands.ts\";\n import { type Config, readMachineServers, trustedServers } from \"./config.ts\";\n@@ -479,6 +479,41 @@\n \treturn { text: `Withdrew ask ${id}. ${r.ask.of} hears it, and it no longer waits on them.`, json: { ask: r.ask } };\n }\n \n+/** One search hit as two lines: the issue, then where it matched and the words around it. */\n+export function searchLines(h: IssueSearchHit): string[] {\n+\tconst where = h.meaning ? \"by meaning\" : h.where === \"comment\" ? `in comment ${h.comment}` : `in the ${h.where}`;\n+\tconst words = h.snippet\n+\t\t.replace(/[\\u0001\\u0002]/g, \"\")\n+\t\t.replace(/\\s+/g, \" \")\n+\t\t.trim();\n+\treturn [\n+\t\t`  ${String(h.issue.id).padStart(3)}  ${h.issue.status.padEnd(11)}  ${q(h.issue.title)}`,\n+\t\t`       ${where}${words && words !== h.issue.title ? `: ${q(words)}` : \"\"}`,\n+\t];\n+}\n+\n+export async function runSearch(args: Parsed, env: Env): Promise<Output> {\n+\tconst words = args.positionals.join(\" \").trim();\n+\tif (words === \"\") throw new UsageError('search needs words: abso search \"<words>\" [--limit <N>]');\n+\tconst limitWord = str(args, \"limit\");\n+\tconst limit = limitWord === undefined ? undefined : Number(limitWord);\n+\tif (limit !== undefined && !(Number.isInteger(limit) && limit >= 1 && limit <= 50))\n+\t\tthrow new UsageError(\"--limit is a number from 1 to 50\");\n+\tconst { api } = openIssues(env);\n+\tconst { hits } = await api.issueSearch(words, limit);\n+\treturn {\n+\t\ttext:\n+\t\t\thits.length === 0\n+\t\t\t\t? `Nothing matches ${q(words)}.`\n+\t\t\t\t: [\n+\t\t\t\t\t\t`${plural(hits.length, \"issue\")} for ${q(words)}, best first:`,\n+\t\t\t\t\t\t...hits.flatMap(searchLines),\n+\t\t\t\t\t\t\"abso issue <N> shows one.\",\n+\t\t\t\t\t].join(\"\\n\"),\n+\t\tjson: { hits },\n+\t};\n+}\n+\n export async function runWaiting(args: Parsed, env: Env): Promise<Output> {\n \tif (args.positionals.length > 0)\n \t\tthrow new UsageError(\"waiting takes no words: abso waiting [--of <agent or person:id>] [--mine]\");"},{"path":"client/src/main.ts","added":8,"removed":1,"diff":"--- a/client/src/main.ts\n+++ b/client/src/main.ts\n@@ -40,7 +40,7 @@\n import { runDraftSync, runLand, runSwitch } from \"./drafts.ts\";\n import { runExport } from \"./export.ts\";\n import { runBlame, runWhere, runWho, runWhy } from \"./history.ts\";\n-import { runAnswer, runAsk, runIssue, runIssues, runWaiting } from \"./issues.ts\";\n+import { runAnswer, runAsk, runIssue, runIssues, runSearch, runWaiting } from \"./issues.ts\";\n import { adminToken, issuedPublic, keyList, keyListText, keyNew, keyRevoke } from \"./key-admin.ts\";\n import { runUnqueue } from \"./queue.ts\";\n import { runNote, runNotes, runReview } from \"./review.ts\";\n@@ -390,6 +390,13 @@\n \t\t\t\"Ask an agent, or a person (person:<id>), something; they hear it. On an issue, it holds the issue at Blocked (In review for --review) until answered. --task asks for something done instead of an answer; --options gives the choices; --blocks names the issues waiting on it. --withdraw takes back an ask you made that no longer needs an answer: it leaves their waiting list, stops holding the issue, keeps your --note as why, and they hear it.\",\n \t\trun: runAsk,\n \t},\n+\tsearch: {\n+\t\tflags: { limit: \"string\" },\n+\t\tusage: 'abso search \"<words>\" [--limit <N>]',\n+\t\tabout:\n+\t\t\t\"The project's issues that match, best first: by their words, and by what they mean where the server has meaning search on, so an issue worded differently from your search still turns up. #N or N puts issue N first. Each hit says where it matched; one only meaning search found says by meaning.\",\n+\t\trun: runSearch,\n+\t},\n \twaiting: {\n \t\tflags: { of: \"string\", mine: \"boolean\" },\n \t\tusage: \"abso waiting [--of <agent or person:id>] [--mine]\","},{"path":"client/src/mcp.ts","added":1,"removed":0,"diff":"--- a/client/src/mcp.ts\n+++ b/client/src/mcp.ts\n@@ -47,6 +47,7 @@\n \t\"notes\",\n \t\"issues\",\n \t\"issue\",\n+\t\"search\",\n \t\"ask\",\n \t\"waiting\",\n \t\"answer\","},{"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;"}],"ci":null}