Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 19 to 20

Compare

+36 −1 in 2 places
Lines 7–13 at 20 (were 7–13 at 19)
77
88import { readFileSync, statSync } from "node:fs";
99import { 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";
1111import { bool, type Parsed, str, UsageError } from "./args.ts";
1212import { type Env, type Output, open, plural } from "./commands.ts";
1313import { type Config, readMachineServers, trustedServers } from "./config.ts";
Lines 479–519 at 20 (were 479–484 at 19)
479479 return { text: `Withdrew ask ${id}. ${r.ask.of} hears it, and it no longer waits on them.`, json: { ask: r.ask } };
480480}
481481
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, " ")
488+ .trim();
489+ return [
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)}` : ""}`,
492+ ];
493+}
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);
504+ return {
505+ text:
506+ hits.length === 0
507+ ? `Nothing matches ${q(words)}.`
508+ : [
509+ `${plural(hits.length, "issue")} for ${q(words)}, best first:`,
510+ ...hits.flatMap(searchLines),
511+ "abso issue <N> shows one.",
512+ ].join("\n"),
513+ json: { hits },
514+ };
515+}
482517export async function runWaiting(args: Parsed, env: Env): Promise<Output> {
483518 if (args.positionals.length > 0)
484519 throw new UsageError("waiting takes no words: abso waiting [--of <agent or person:id>] [--mine]");
MCP
compare on this site's /mcp
CLI
abso diff 19 20 client/src/issues.ts --json
JSON
/christopher/abso-core/compare/19..20?file=client%2Fsrc%2Fissues.ts&format=json