Add abso search: find a project's issues by words or meaning Version 20 of shared· devops· Oct 9 (2026-10-09 06:46 UTC) · Not checked
abso search "<words>" [--limit <N>] lists the project's issues that match, best first, and is served as an MCP tool as well.
Each hit shows the issue, then where it matched: the title, the description, a comment, or "by meaning". "#N" or "N" puts issue N first. Where the server also searches by meaning, an issue worded unlike the search still turns up; the hit says so. Version 19 · Files at version 20
6 files, 93 lines added, 5 removed.
--- a/client/src/api.ts
+++ b/client/src/api.ts
@@ -50,7 +50,16 @@
52 52 } from "./history-answers.ts"; 53 − import type { Ask, Attachment, Draft, DraftBody, News as IssueNews, IssuePage, IssueRow } from "./issues-wire.ts";
62 + } from "./issues-wire.ts"; 54 63 import type { Modes } from "./modes.ts"; 56 65 export * from "./api-answers.ts"; @@ -65,7 +74,7 @@
65 74 } from "./box-run.ts"; 66 75 export * from "./ci-answers.ts"; 67 76 export * from "./history-answers.ts"; 68 − export type { Ask, Attachment, Draft, DraftBody, IssueNews, IssuePage, IssueRow };
77 + export type { Ask, Attachment, Draft, DraftBody, IssueNews, IssuePage, IssueRow, IssueSearchHit }; 71 80 * How long a call may take: the base, plus 1 s for each 100 KB it sends @@ -375,6 +384,14 @@
388 + * The project's issues matching q, best first: by its words and, where 389 + * the server has it on, by what it means. 391 + issueSearch(q: string, limit?: number): Promise<{ hits: readonly IssueSearchHit[] }> { 392 + return this.#issues("GET", `/search?${query({ q, limit })}`); 378 395 /** Every label in use, with how many issues have it and how many of those are open. */ 379 396 issueLabels(): Promise<{ labels: readonly { label: string; open: number; total: number }[] }> { 380 397 return this.#issues("GET", "/labels"); --- a/client/src/issues-wire.ts
+++ b/client/src/issues-wire.ts
@@ -134,3 +134,14 @@
138 + /** One issue search hit: the issue, where it matched, a few words around it. */ 139 + export interface IssueSearchHit { 140 + issue: { id: number; title: string; status: Status; updated: number; labels: string[] }; 141 + where: "title" | "description" | "comment"; 143 + /** The words around the match; char(1) and char(2) bracket each matched span. */ 145 + /** Only meaning search found it: the words differ, the meaning matches. */ --- a/client/src/issues.ts
+++ b/client/src/issues.ts
@@ -7,7 +7,7 @@
8 8 import { readFileSync, statSync } from "node:fs"; 9 9 import { basename, resolve } from "node:path"; 10 − import type { Api, Ask, Attachment, Draft, DraftBody, IssuePage, IssueRow } from "./api.ts";
10 + import type { Api, Ask, Attachment, Draft, DraftBody, IssuePage, IssueRow, IssueSearchHit } from "./api.ts"; 11 11 import { bool, type Parsed, str, UsageError } from "./args.ts"; 12 12 import { type Env, type Output, open, plural } from "./commands.ts"; 13 13 import { type Config, readMachineServers, trustedServers } from "./config.ts"; @@ -479,6 +479,41 @@
479 479 return { text: `Withdrew ask ${id}. ${r.ask.of} hears it, and it no longer waits on them.`, json: { ask: r.ask } }; 482 + /** One search hit as two lines: the issue, then where it matched and the words around it. */ 483 + export function searchLines(h: IssueSearchHit): string[] { 484 + const where = h.meaning ? "by meaning" : h.where === "comment" ? `in comment ${h.comment}` : `in the ${h.where}`; 485 + const words = h.snippet 486 + .replace(/[\u0001\u0002]/g, "") 487 + .replace(/\s+/g, " ") 490 + ` ${String(h.issue.id).padStart(3)} ${h.issue.status.padEnd(11)} ${q(h.issue.title)}`, 491 + ` ${where}${words && words !== h.issue.title ? `: ${q(words)}` : ""}`, 495 + export async function runSearch(args: Parsed, env: Env): Promise<Output> { 496 + const words = args.positionals.join(" ").trim(); 497 + if (words === "") throw new UsageError('search needs words: abso search "<words>" [--limit <N>]'); 498 + const limitWord = str(args, "limit"); 499 + const limit = limitWord === undefined ? undefined : Number(limitWord); 500 + if (limit !== undefined && !(Number.isInteger(limit) && limit >= 1 && limit <= 50)) 501 + throw new UsageError("--limit is a number from 1 to 50"); 502 + const { api } = openIssues(env); 503 + const { hits } = await api.issueSearch(words, limit); 507 + ? `Nothing matches ${q(words)}.` 509 + `${plural(hits.length, "issue")} for ${q(words)}, best first:`, 510 + ...hits.flatMap(searchLines), 511 + "abso issue <N> shows one.", 482 517 export async function runWaiting(args: Parsed, env: Env): Promise<Output> { 483 518 if (args.positionals.length > 0) 484 519 throw new UsageError("waiting takes no words: abso waiting [--of <agent or person:id>] [--mine]"); --- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -40,7 +40,7 @@
40 40 import { runDraftSync, runLand, runSwitch } from "./drafts.ts"; 41 41 import { runExport } from "./export.ts"; 42 42 import { runBlame, runWhere, runWho, runWhy } from "./history.ts"; 43 − import { runAnswer, runAsk, runIssue, runIssues, runWaiting } from "./issues.ts";
43 + import { runAnswer, runAsk, runIssue, runIssues, runSearch, runWaiting } from "./issues.ts"; 44 44 import { adminToken, issuedPublic, keyList, keyListText, keyNew, keyRevoke } from "./key-admin.ts"; 45 45 import { runUnqueue } from "./queue.ts"; 46 46 import { runNote, runNotes, runReview } from "./review.ts"; @@ -390,6 +390,13 @@
390 390 "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.", 394 + flags: { limit: "string" }, 395 + usage: 'abso search "<words>" [--limit <N>]', 397 + "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.", 394 401 flags: { of: "string", mine: "boolean" }, 395 402 usage: "abso waiting [--of <agent or person:id>] [--mine]", --- a/client/src/mcp.ts
+++ b/client/src/mcp.ts
@@ -47,6 +47,7 @@
--- a/client/test/issues.test.ts
+++ b/client/test/issues.test.ts
@@ -14,6 +14,7 @@
14 14 import { after, before, describe, it } from "node:test"; 15 15 import { readMachineServers } from "../src/config.ts"; 16 16 import { issuesServerFor, tokenGoesTo } from "../src/core.ts"; 17 + import { searchLines } from "../src/issues.ts"; 17 18 import { main } from "../src/main.ts"; 18 19 import { argvFor, mcpTools } from "../src/mcp.ts"; 19 20 import { type Fake, startFake } from "./fake-server.ts"; @@ -106,7 +107,7 @@
107 108 it("are MCP tools", () => { 108 109 const names = mcpTools().map((t) => t.name); 109 − for (const n of ["issues", "issue", "ask", "waiting", "answer"]) assert.ok(names.includes(n), n);
110 + for (const n of ["issues", "issue", "search", "ask", "waiting", "answer"]) assert.ok(names.includes(n), n); 110 111 assert.deepEqual(argvFor("ask", { args: ["alice", "Which login?"], issue: "3", review: true }), [ @@ -133,6 +134,9 @@
133 134 ["ask", "--withdraw", "3", "--issue", "2"], 134 135 ["ask", "--withdraw", "3", "--task"], 135 136 ["ask", "alice", "q", "--note", "a note without --withdraw"], 138 + ["search", "words", "--limit", "0"], 139 + ["search", "words", "--limit", "51"], 137 141 const r = await avcs(erin, argv); 138 142 assert.equal(r.exit, 1, `${argv.join(" ")}: ${r.out}`); @@ -140,6 +144,19 @@
140 144 assert.equal(seen.length, before); 147 + it("shows a search hit as the issue, then where it matched, without the match markers", () => { 148 + const issue = { id: 12, title: "Sync is slow", status: "open" as const, updated: 0, labels: [] }; 150 + searchLines({ issue, where: "comment", comment: 40, snippet: "the \u0001network\u0002 drops mid-sync" }), 151 + [' 12 open "Sync is slow"', ' in comment 40: "the network drops mid-sync"'], 153 + assert.deepEqual(searchLines({ issue, where: "description", snippet: "Pages load late.", meaning: true }), [ 154 + ' 12 open "Sync is slow"', 155 + ' by meaning: "Pages load late."', 157 + assert.deepEqual(searchLines({ issue, where: "title", snippet: "Sync is slow" })[1], " in the title"); 143 160 it("withdraw is one POST to the asker's own withdraw/<ask> route", async () => { 144 161 const erin = await folder("erin"); 145 162 const before = seen.length;