{"file":"client/src/issues.ts","version":318,"total":967,"from":1,"to":967,"lines":[{"n":1,"text":"// Issues (#54): abso issues, abso issue, abso ask, abso waiting and avcs","atom":"a79","author":"review","version":16},{"n":2,"text":"// answer. The Issues Worker keeps them (avcs-issues beside avcs, or","atom":"a0","author":"init","version":0},{"n":3,"text":"// ABSO_ISSUES_SERVER), and takes the same token. Statuses come from the work: a start note naming","atom":"a208","author":"review","version":27},{"n":4,"text":"// an issue (abso start --issue N) puts it In progress, an open ask Blocked or","atom":"a79","author":"review","version":16},{"n":5,"text":"// In review, and publish --done closes it. Other agents' and people's words","atom":"a0","author":"init","version":0},{"n":6,"text":"// are quoted as JSON, so none can print as another line (#30).","atom":"a0","author":"init","version":0},{"n":7,"text":"","atom":"a0","author":"init","version":0},{"n":8,"text":"import { mkdirSync, readFileSync, statSync, writeFileSync } from \"node:fs\";","atom":"a224","author":"pinch","version":29},{"n":9,"text":"import { basename, join, resolve } from \"node:path\";","atom":"a224","author":"pinch","version":29},{"n":10,"text":"import {","atom":"a164","author":"pinch","version":23},{"n":11,"text":"\ttype Api,","atom":"a164","author":"pinch","version":23},{"n":12,"text":"\tApiError,","atom":"a164","author":"pinch","version":23},{"n":13,"text":"\ttype Ask,","atom":"a164","author":"pinch","version":23},{"n":14,"text":"\ttype Attachment,","atom":"a164","author":"pinch","version":23},{"n":15,"text":"\ttype CopyAnswer,","atom":"a164","author":"pinch","version":23},{"n":16,"text":"\ttype CopyBody,","atom":"a164","author":"pinch","version":23},{"n":17,"text":"\ttype Draft,","atom":"a164","author":"pinch","version":23},{"n":18,"text":"\ttype DraftBody,","atom":"a164","author":"pinch","version":23},{"n":19,"text":"\ttype IssuePage,","atom":"a164","author":"pinch","version":23},{"n":20,"text":"\ttype IssueRow,","atom":"a164","author":"pinch","version":23},{"n":21,"text":"\ttype IssueSearchHit,","atom":"a164","author":"pinch","version":23},{"n":22,"text":"} from \"./api.ts\";","atom":"a164","author":"pinch","version":23},{"n":23,"text":"import { bool, type Parsed, str, UsageError } from \"./args.ts\";","atom":"a0","author":"init","version":0},{"n":24,"text":"import { type Env, type Output, open, plural } from \"./commands.ts\";","atom":"a0","author":"init","version":0},{"n":25,"text":"import { type Config, readMachineServers, trustedServers } from \"./config.ts\";","atom":"a0","author":"init","version":0},{"n":26,"text":"import { issuesServerFor, tokenGoesToIssues } from \"./core.ts\";","atom":"a1494","author":"trials","version":151},{"n":27,"text":"import { fromEnv } from \"./env-names.ts\";","atom":"a208","author":"review","version":27},{"n":28,"text":"import { ignoredHere } from \"./fetch.ts\";","atom":"a224","author":"pinch","version":29},{"n":29,"text":"import { loadIgnore, relativeTo } from \"./folder.ts\";","atom":"a224","author":"pinch","version":29},{"n":30,"text":"import type { AskReply } from \"./issues-wire.ts\";","atom":"a660","author":"pinch","version":72},{"n":31,"text":"import { isLocal, LOCAL_BASE } from \"./local-store.ts\";","atom":"a2881","author":"pinch","version":294},{"n":32,"text":"import { queuedLines, standing } from \"./queue.ts\";","atom":"a305","author":"pinch","version":36},{"n":33,"text":"import { seenText, shortWhen } from \"./times.ts\";","atom":"a0","author":"init","version":0},{"n":34,"text":"","atom":"a0","author":"init","version":0},{"n":35,"text":"const q = (s: string): string => JSON.stringify(s);","atom":"a0","author":"init","version":0},{"n":36,"text":"","atom":"a0","author":"init","version":0},{"n":37,"text":"/** The folder, with its Api pointed at the Issues Worker: the token goes only where tokenGoesTo allows, as for the avcs server. */","atom":"a0","author":"init","version":0},{"n":38,"text":"export function openIssues(env: Env): { root: string; config: Config; api: Api } {","atom":"a2618","author":"groups","version":256},{"n":39,"text":"\tconst { root, config, api } = open(env);","atom":"a224","author":"pinch","version":29},{"n":40,"text":"\t// A local project's issues are in its store, where the open server keeps them: at /issues.","atom":"a2879","author":"pinch","version":294},{"n":41,"text":"\tif (isLocal(config.server)) {","atom":"a2879","author":"pinch","version":294},{"n":42,"text":"\t\tapi.issuesServer = `${LOCAL_BASE}/issues`;","atom":"a2879","author":"pinch","version":294},{"n":43,"text":"\t\treturn { root, config, api };","atom":"a2879","author":"pinch","version":294},{"n":44,"text":"\t}","atom":"a2879","author":"pinch","version":294},{"n":45,"text":"\t// An explicit --server goes to that server's own Issues Worker: ABSO_ISSUES_SERVER doesn't redirect it.","atom":"a1559","author":"speed","version":155},{"n":46,"text":"\tconst server =","atom":"a1559","author":"speed","version":155},{"n":47,"text":"\t\t(env.server === undefined ? fromEnv(env.env, \"ISSUES_SERVER\") : undefined) ||","atom":"a1559","author":"speed","version":155},{"n":48,"text":"\t\tissuesServerFor(config.server, readMachineServers(env.env));","atom":"a1559","author":"speed","version":155},{"n":49,"text":"\tif (server === undefined)","atom":"a0","author":"init","version":0},{"n":50,"text":"\t\tthrow new UsageError(","atom":"a0","author":"init","version":0},{"n":51,"text":"\t\t\t`${config.server} has no Issues Worker beside it that abso knows; ~/.abso/servers.json or ABSO_ISSUES_SERVER names one`,","atom":"a208","author":"review","version":27},{"n":52,"text":"\t\t);","atom":"a0","author":"init","version":0},{"n":53,"text":"\tif (config.token !== undefined && !tokenGoesToIssues(server, trustedServers(env.env))) {","atom":"a1494","author":"trials","version":151},{"n":54,"text":"\t\tthrow new UsageError(","atom":"a0","author":"init","version":0},{"n":55,"text":"\t\t\t`the Issues Worker is ${server}, and abso sends your token only to its own servers and this machine. If ${server} is yours, name it in ~/.abso/servers.json or ABSO_TRUSTED_SERVERS.`,","atom":"a208","author":"review","version":27},{"n":56,"text":"\t\t);","atom":"a0","author":"init","version":0},{"n":57,"text":"\t}","atom":"a0","author":"init","version":0},{"n":58,"text":"\tapi.issuesServer = server;","atom":"a0","author":"init","version":0},{"n":59,"text":"\treturn { root, config, api };","atom":"a224","author":"pinch","version":29},{"n":60,"text":"}","atom":"a0","author":"init","version":0},{"n":61,"text":"","atom":"a0","author":"init","version":0},{"n":62,"text":"function issueNumber(word: string | undefined, what = \"an issue number\"): number {","atom":"a0","author":"init","version":0},{"n":63,"text":"\tif (word === undefined || !/^#?\\d+$/.test(word)) throw new UsageError(`${what} is a number, like 12`);","atom":"a0","author":"init","version":0},{"n":64,"text":"\treturn Number(word.replace(\"#\", \"\"));","atom":"a0","author":"init","version":0},{"n":65,"text":"}","atom":"a0","author":"init","version":0},{"n":66,"text":"","atom":"a0","author":"init","version":0},{"n":67,"text":"/** One issue as a line. */","atom":"a0","author":"init","version":0},{"n":68,"text":"export function issueLine(i: IssueRow): string {","atom":"a0","author":"init","version":0},{"n":69,"text":"\tconst detail = [","atom":"a0","author":"init","version":0},{"n":70,"text":"\t\ti.agent !== null && !i.agents.includes(i.agent) ? `for ${i.agent}` : \"\",","atom":"a0","author":"init","version":0},{"n":71,"text":"\t\ti.agents.length > 0 ? i.agents.join(\", \") : \"\",","atom":"a0","author":"init","version":0},{"n":72,"text":"\t\ti.blockedBy.length > 0 ? `blocked by ${i.blockedBy.join(\", \")}` : \"\",","atom":"a0","author":"init","version":0},{"n":73,"text":"\t\t(i.labels ?? []).length > 0 ? `labels ${i.labels.join(\", \")}` : \"\",","atom":"a0","author":"init","version":0},{"n":74,"text":"\t\ti.versions.length > 0 ? `${i.versions.length === 1 ? \"version\" : \"versions\"} ${i.versions.join(\", \")}` : \"\",","atom":"a0","author":"init","version":0},{"n":75,"text":"\t\ti.waitingOn.length > 0 ? `waiting on ${i.waitingOn.join(\", \")}` : \"\",","atom":"a0","author":"init","version":0},{"n":76,"text":"\t\ti.parent !== null ? `under ${i.parent}` : \"\",","atom":"a0","author":"init","version":0},{"n":77,"text":"\t\ti.children > 0 ? plural(i.children, \"sub-issue\") : \"\",","atom":"a0","author":"init","version":0},{"n":78,"text":"\t\t`updated ${shortWhen(i.updated)}`,","atom":"a0","author":"init","version":0},{"n":79,"text":"\t].filter((d) => d !== \"\");","atom":"a0","author":"init","version":0},{"n":80,"text":"\treturn `  ${String(i.id).padStart(3)}  ${i.status.padEnd(11)}  ${q(i.title)}${detail.length > 0 ? ` (${detail.join(\"; \")})` : \"\"}`;","atom":"a0","author":"init","version":0},{"n":81,"text":"}","atom":"a0","author":"init","version":0},{"n":82,"text":"","atom":"a0","author":"init","version":0},{"n":83,"text":"/** The first line of a reply, for lists; abso ask <N> shows it whole. */","atom":"a660","author":"pinch","version":72},{"n":84,"text":"const firstLine = (text: string): string => {","atom":"a660","author":"pinch","version":72},{"n":85,"text":"\tconst line = text.split(\"\\n\")[0]!;","atom":"a660","author":"pinch","version":72},{"n":86,"text":"\treturn line.length < text.length ? `${line} ...` : line;","atom":"a660","author":"pinch","version":72},{"n":87,"text":"};","atom":"a660","author":"pinch","version":72},{"n":88,"text":"","atom":"a660","author":"pinch","version":72},{"n":89,"text":"/** One reply in an ask's thread. */","atom":"a660","author":"pinch","version":72},{"n":90,"text":"function replyLine(r: AskReply, indent: string, whole: boolean): string {","atom":"a660","author":"pinch","version":72},{"n":91,"text":"\treturn `${indent}${r.by}, ${shortWhen(r.at)}${r.question ? \", a question\" : \"\"}: ${q(whole ? r.text : firstLine(r.text))}`;","atom":"a660","author":"pinch","version":72},{"n":92,"text":"}","atom":"a660","author":"pinch","version":72},{"n":93,"text":"","atom":"a660","author":"pinch","version":72},{"n":94,"text":"/**","atom":"a660","author":"pinch","version":72},{"n":95,"text":" * An ask: its head line, its files and options, then, in a list, its newest reply, or with `thread`, every","atom":"a660","author":"pinch","version":72},{"n":96,"text":" * reply, oldest first; then its answer. Older servers send no thread, only the one asked's acknowledgement.","atom":"a660","author":"pinch","version":72},{"n":97,"text":" */","atom":"a660","author":"pinch","version":72},{"n":98,"text":"function askLine(a: Ask & { title?: string | null }, api?: Pick<Api, \"attachmentUrl\">, thread = false): string {","atom":"a660","author":"pinch","version":72},{"n":99,"text":"\tconst what = a.review ? \"a review\" : a.kind === \"task\" ? \"a task\" : \"a question\";","atom":"a0","author":"init","version":0},{"n":100,"text":"\tconst where = a.issue === null ? \"\" : ` on issue ${a.issue}${a.title ? ` (${q(a.title)})` : \"\"}`;","atom":"a0","author":"init","version":0},{"n":101,"text":"\tconst replies = a.replies;","atom":"a660","author":"pinch","version":72},{"n":102,"text":"\tconst extra = [","atom":"a0","author":"init","version":0},{"n":103,"text":"\t\t// Who answered, and when, on the ask's own line, so a handled ask can't pass for an open one.","atom":"a0","author":"init","version":0},{"n":104,"text":"\t\ta.answer","atom":"a63","author":"infra-split","version":14},{"n":105,"text":"\t\t\t? `${a.outcome === \"withdrawn\" ? \"withdrawn\" : \"answered\"} by ${a.answer.by}, ${shortWhen(a.answer.at)}`","atom":"a63","author":"infra-split","version":14},{"n":106,"text":"\t\t\t: \"\",","atom":"a63","author":"infra-split","version":14},{"n":107,"text":"\t\t!a.answer && a.ack && replies === undefined ? `acknowledged ${shortWhen(a.ack.at)}, not answered yet` : \"\",","atom":"a660","author":"pinch","version":72},{"n":108,"text":"\t\t!a.answer && !a.ack && a.seen !== undefined ? seenText(a.seen) : \"\",","atom":"a481","author":"pinch","version":53},{"n":109,"text":"\t\treplies && replies.length > 0 ? (replies.length === 1 ? \"1 reply\" : `${replies.length} replies`) : \"\",","atom":"a660","author":"pinch","version":72},{"n":110,"text":"\t\t// Whose turn it is, when it isn't the one asked's: they asked something back.","atom":"a660","author":"pinch","version":72},{"n":111,"text":"\t\t!a.answer && a.waitingOn && a.waitingOn !== a.of ? `waiting on ${a.waitingOn}` : \"\",","atom":"a660","author":"pinch","version":72},{"n":112,"text":"\t\ta.due ? `due ${a.due}` : \"\",","atom":"a0","author":"init","version":0},{"n":113,"text":"\t\ta.blocks.length > 0 ? `blocks ${a.blocks.join(\", \")}` : \"\",","atom":"a0","author":"init","version":0},{"n":114,"text":"\t].filter((x) => x !== \"\");","atom":"a0","author":"init","version":0},{"n":115,"text":"\tconst head = `  ask ${a.id}: ${a.by}, ${shortWhen(a.at)}, asks ${a.of} ${what}${where}${extra.length > 0 ? ` (${extra.join(\"; \")})` : \"\"}: ${q(a.question)}`;","atom":"a0","author":"init","version":0},{"n":116,"text":"\tconst lines = [head, ...attachmentLines(api, a.attachments, \"    \")];","atom":"a299","author":"pinch","version":35},{"n":117,"text":"\tif (a.options.length > 0) lines.push(`    options: ${a.options.map((o, i) => `${i + 1}. ${q(o)}`).join(\", \")}`);","atom":"a0","author":"init","version":0},{"n":118,"text":"\tif (a.recommendation) lines.push(`    ${a.recommendation.by} recommends: ${q(a.recommendation.text)}`);","atom":"a0","author":"init","version":0},{"n":119,"text":"\tif (replies === undefined) {","atom":"a660","author":"pinch","version":72},{"n":120,"text":"\t\tif (!a.answer && a.ack && a.ack.note !== \"\") lines.push(`    ${a.of} acknowledged: ${q(a.ack.note)}`);","atom":"a660","author":"pinch","version":72},{"n":121,"text":"\t} else if (thread) lines.push(...replies.map((r) => replyLine(r, \"    \", true)));","atom":"a660","author":"pinch","version":72},{"n":122,"text":"\telse if (replies.length > 0) lines.push(replyLine(replies[replies.length - 1]!, \"    last: \", false));","atom":"a660","author":"pinch","version":72},{"n":123,"text":"\tif (a.answer && a.outcome === \"withdrawn\") {","atom":"a64","author":"infra-split","version":14},{"n":124,"text":"\t\tif (a.answer.words !== \"\") lines.push(`    why: ${q(a.answer.words)}`);","atom":"a64","author":"infra-split","version":14},{"n":125,"text":"\t} else if (a.answer)","atom":"a299","author":"pinch","version":35},{"n":126,"text":"\t\tlines.push(`    answer: ${q(a.answer.words)}`, ...attachmentLines(api, a.answer.attachments, \"      \"));","atom":"a299","author":"pinch","version":35},{"n":127,"text":"\treturn lines.join(\"\\n\");","atom":"a0","author":"init","version":0},{"n":128,"text":"}","atom":"a0","author":"init","version":0},{"n":129,"text":"","atom":"a0","author":"init","version":0},{"n":130,"text":"/** One edit in an issue's activity: what changed, and who was told. */","atom":"a0","author":"init","version":0},{"n":131,"text":"function editLine(e: IssuePage[\"edits\"][number]): string {","atom":"a0","author":"init","version":0},{"n":132,"text":"\tconst c = e.changes;","atom":"a0","author":"init","version":0},{"n":133,"text":"\tconst said = [","atom":"a0","author":"init","version":0},{"n":134,"text":"\t\tc.title ? `title ${q(String(c.title.from))} to ${q(String(c.title.to))}` : \"\",","atom":"a0","author":"init","version":0},{"n":135,"text":"\t\tc.description ? \"the description\" : \"\",","atom":"a0","author":"init","version":0},{"n":136,"text":"\t\tc.parent ? (c.parent.to === null ? \"no parent\" : `parent issue ${String(c.parent.to)}`) : \"\",","atom":"a0","author":"init","version":0},{"n":137,"text":"\t\tc.agent ? (c.agent.to === null ? \"no Agent\" : `Agent ${String(c.agent.to)}`) : \"\",","atom":"a0","author":"init","version":0},{"n":138,"text":"\t\tc.blockedBy","atom":"a0","author":"init","version":0},{"n":139,"text":"\t\t\t? (c.blockedBy.to as number[]).length === 0","atom":"a0","author":"init","version":0},{"n":140,"text":"\t\t\t\t? \"blocked by nothing\"","atom":"a0","author":"init","version":0},{"n":141,"text":"\t\t\t\t: `blocked by ${(c.blockedBy.to as number[]).join(\", \")}`","atom":"a0","author":"init","version":0},{"n":142,"text":"\t\t\t: \"\",","atom":"a0","author":"init","version":0},{"n":143,"text":"\t\tc.labels","atom":"a0","author":"init","version":0},{"n":144,"text":"\t\t\t? (c.labels.to as string[]).length === 0","atom":"a0","author":"init","version":0},{"n":145,"text":"\t\t\t\t? \"no labels\"","atom":"a0","author":"init","version":0},{"n":146,"text":"\t\t\t\t: `labels ${(c.labels.to as string[]).join(\", \")}`","atom":"a0","author":"init","version":0},{"n":147,"text":"\t\t\t: \"\",","atom":"a0","author":"init","version":0},{"n":148,"text":"\t].filter((x) => x !== \"\");","atom":"a0","author":"init","version":0},{"n":149,"text":"\treturn `  ${e.by}, ${shortWhen(e.at)}: ${said.join(\"; \")} (${e.notified.length > 0 ? `told ${e.notified.join(\", \")}` : \"told nobody\"})`;","atom":"a0","author":"init","version":0},{"n":150,"text":"}","atom":"a0","author":"init","version":0},{"n":151,"text":"","atom":"a0","author":"init","version":0},{"n":152,"text":"/** Labels as typed, lower-cased, since the Worker refuses upper case: --label Friction means friction. */","atom":"a314","author":"infra-split","version":37},{"n":153,"text":"function labelList(value: string): string[] {","atom":"a0","author":"init","version":0},{"n":154,"text":"\treturn listOf(value).map((l) => l.toLowerCase());","atom":"a0","author":"init","version":0},{"n":155,"text":"}","atom":"a0","author":"init","version":0},{"n":156,"text":"","atom":"a0","author":"init","version":0},{"n":157,"text":"/** A comma-separated list of names or issue numbers; \"none\" is the empty list. */","atom":"a0","author":"init","version":0},{"n":158,"text":"function listOf(value: string): string[] {","atom":"a0","author":"init","version":0},{"n":159,"text":"\treturn value.trim() === \"none\"","atom":"a0","author":"init","version":0},{"n":160,"text":"\t\t? []","atom":"a0","author":"init","version":0},{"n":161,"text":"\t\t: value","atom":"a0","author":"init","version":0},{"n":162,"text":"\t\t\t\t.split(\",\")","atom":"a0","author":"init","version":0},{"n":163,"text":"\t\t\t\t.map((v) => v.trim())","atom":"a0","author":"init","version":0},{"n":164,"text":"\t\t\t\t.filter((v) => v !== \"\");","atom":"a0","author":"init","version":0},{"n":165,"text":"}","atom":"a0","author":"init","version":0},{"n":166,"text":"","atom":"a0","author":"init","version":0},{"n":167,"text":"/** \" with 2 attachments (a…, a…)\" after a write that carried some; nothing otherwise. */","atom":"a299","author":"pinch","version":35},{"n":168,"text":"function withFiles(ids: readonly string[]): string {","atom":"a299","author":"pinch","version":35},{"n":169,"text":"\treturn ids.length > 0 ? ` with ${plural(ids.length, \"attachment\")} (${ids.join(\", \")})` : \"\";","atom":"a299","author":"pinch","version":35},{"n":170,"text":"}","atom":"a299","author":"pinch","version":35},{"n":171,"text":"","atom":"a299","author":"pinch","version":35},{"n":172,"text":"/**","atom":"a299","author":"pinch","version":35},{"n":173,"text":" * What to say when a write sent files the server didn't keep: an Issues server from before asks carried","atom":"a299","author":"pinch","version":35},{"n":174,"text":" * attachments takes the words and leaves the files out. Nothing to say when it kept them, or none were sent.","atom":"a299","author":"pinch","version":35},{"n":175,"text":" */","atom":"a299","author":"pinch","version":35},{"n":176,"text":"function notKept(sent: readonly string[], kept: readonly string[] | undefined, what: string): string | undefined {","atom":"a299","author":"pinch","version":35},{"n":177,"text":"\tif (sent.length === 0 || (kept !== undefined && sent.every((id) => kept.includes(id)))) return undefined;","atom":"a299","author":"pinch","version":35},{"n":178,"text":"\treturn `The Issues server didn't keep the ${sent.length === 1 ? \"file\" : \"files\"} on ${what}: it is older than this client. The words went; the ${sent.length === 1 ? \"file goes\" : \"files go\"} on a comment instead (abso issue <N> --comment \"...\" --attach ...).`;","atom":"a299","author":"pinch","version":35},{"n":179,"text":"}","atom":"a299","author":"pinch","version":35},{"n":180,"text":"","atom":"a299","author":"pinch","version":35},{"n":181,"text":"/** The most one attachment may be: the Issues Worker's cap, checked here before sending (abso issue 171). */","atom":"a26","author":"pinch","version":5},{"n":182,"text":"const ATTACH_MAX = 10 * 1024 * 1024;","atom":"a26","author":"pinch","version":5},{"n":183,"text":"","atom":"a26","author":"pinch","version":5},{"n":184,"text":"/** Uploads each file --attach names (comma-separated), in order, and answers their ids. Nothing is sent if a file is missing or too big. */","atom":"a26","author":"pinch","version":5},{"n":185,"text":"async function uploadAttachments(api: Api, cwd: string, value: string | undefined): Promise<string[]> {","atom":"a26","author":"pinch","version":5},{"n":186,"text":"\tif (value === undefined) return [];","atom":"a26","author":"pinch","version":5},{"n":187,"text":"\tconst paths = listOf(value);","atom":"a26","author":"pinch","version":5},{"n":188,"text":"\tif (paths.length === 0) throw new UsageError(\"--attach names files, comma-separated: --attach shot.png,after.png\");","atom":"a26","author":"pinch","version":5},{"n":189,"text":"\tconst files = paths.map((p) => {","atom":"a26","author":"pinch","version":5},{"n":190,"text":"\t\tconst full = resolve(cwd, p);","atom":"a26","author":"pinch","version":5},{"n":191,"text":"\t\tlet size: number;","atom":"a26","author":"pinch","version":5},{"n":192,"text":"\t\ttry {","atom":"a26","author":"pinch","version":5},{"n":193,"text":"\t\t\tsize = statSync(full).size;","atom":"a26","author":"pinch","version":5},{"n":194,"text":"\t\t} catch {","atom":"a26","author":"pinch","version":5},{"n":195,"text":"\t\t\tthrow new UsageError(`--attach ${p}: no such file`);","atom":"a26","author":"pinch","version":5},{"n":196,"text":"\t\t}","atom":"a26","author":"pinch","version":5},{"n":197,"text":"\t\tif (size > ATTACH_MAX)","atom":"a26","author":"pinch","version":5},{"n":198,"text":"\t\t\tthrow new UsageError(`--attach ${p} is ${sizeText(size)}; one attachment is at most ${sizeText(ATTACH_MAX)}`);","atom":"a26","author":"pinch","version":5},{"n":199,"text":"\t\treturn { full, name: basename(full) };","atom":"a26","author":"pinch","version":5},{"n":200,"text":"\t});","atom":"a26","author":"pinch","version":5},{"n":201,"text":"\tconst ids: string[] = [];","atom":"a26","author":"pinch","version":5},{"n":202,"text":"\tfor (const f of files) ids.push((await api.attachmentUpload(readFileSync(f.full), f.name)).id);","atom":"a26","author":"pinch","version":5},{"n":203,"text":"\treturn ids;","atom":"a26","author":"pinch","version":5},{"n":204,"text":"}","atom":"a26","author":"pinch","version":5},{"n":205,"text":"","atom":"a26","author":"pinch","version":5},{"n":206,"text":"function sizeText(n: number): string {","atom":"a26","author":"pinch","version":5},{"n":207,"text":"\treturn n < 1024 ? `${n} B` : n < 1024 * 1024 ? `${Math.round(n / 1024)} KB` : `${(n / (1024 * 1024)).toFixed(1)} MB`;","atom":"a26","author":"pinch","version":5},{"n":208,"text":"}","atom":"a26","author":"pinch","version":5},{"n":209,"text":"","atom":"a26","author":"pinch","version":5},{"n":210,"text":"/** Attachments as lines under what carries them: name, size and where it's served. */","atom":"a26","author":"pinch","version":5},{"n":211,"text":"function attachmentLines(","atom":"a26","author":"pinch","version":5},{"n":212,"text":"\tapi: Pick<Api, \"attachmentUrl\"> | undefined,","atom":"a26","author":"pinch","version":5},{"n":213,"text":"\tfiles: readonly Attachment[] | undefined,","atom":"a26","author":"pinch","version":5},{"n":214,"text":"\tindent: string,","atom":"a26","author":"pinch","version":5},{"n":215,"text":"): string[] {","atom":"a26","author":"pinch","version":5},{"n":216,"text":"\treturn (files ?? []).flatMap((a) => [","atom":"a169","author":"pinch","version":24},{"n":217,"text":"\t\t`${indent}attached ${a.id}: ${q(a.name)}, ${sizeText(a.size)}${api ? `, ${api.attachmentUrl(a.id)}` : \"\"}`,","atom":"a169","author":"pinch","version":24},{"n":218,"text":"\t\t// An SVG is shown as the PNG drawn from it; its own file is a download beside it.","atom":"a169","author":"pinch","version":24},{"n":219,"text":"\t\t...(a.source","atom":"a169","author":"pinch","version":24},{"n":220,"text":"\t\t\t? [","atom":"a169","author":"pinch","version":24},{"n":221,"text":"\t\t\t\t\t`${indent}  drawn from ${q(a.source.name)}, ${sizeText(a.source.size)}${api ? `, ${api.attachmentUrl(a.id)}/source` : \"\"}`,","atom":"a169","author":"pinch","version":24},{"n":222,"text":"\t\t\t\t]","atom":"a169","author":"pinch","version":24},{"n":223,"text":"\t\t\t: []),","atom":"a169","author":"pinch","version":24},{"n":224,"text":"\t]);","atom":"a169","author":"pinch","version":24},{"n":225,"text":"}","atom":"a224","author":"pinch","version":29},{"n":226,"text":"","atom":"a224","author":"pinch","version":29},{"n":227,"text":"/** A saved attachment's file name: its id, then its own name with anything but letters, digits, . - _ made _. */","atom":"a224","author":"pinch","version":29},{"n":228,"text":"export function savedName(id: string, name: string): string {","atom":"a224","author":"pinch","version":29},{"n":229,"text":"\tconst own = (name.split(/[\\\\/]/).pop() ?? \"\")","atom":"a224","author":"pinch","version":29},{"n":230,"text":"\t\t.replace(/[^A-Za-z0-9._-]/g, \"_\")","atom":"a224","author":"pinch","version":29},{"n":231,"text":"\t\t.replace(/^\\.+/, \"_\")","atom":"a224","author":"pinch","version":29},{"n":232,"text":"\t\t.slice(0, 100);","atom":"a224","author":"pinch","version":29},{"n":233,"text":"\treturn `${id}-${own || \"file\"}`;","atom":"a224","author":"pinch","version":29},{"n":234,"text":"}","atom":"a224","author":"pinch","version":29},{"n":235,"text":"","atom":"a224","author":"pinch","version":29},{"n":236,"text":"/**","atom":"a224","author":"pinch","version":29},{"n":237,"text":" * abso issue N --save-attachments <folder>: every attachment on the issue, its","atom":"a299","author":"pinch","version":35},{"n":238,"text":" * comments and its asks and answers, written to that folder as <id>-<name>; an svg's own file","atom":"a299","author":"pinch","version":35},{"n":239,"text":" * beside the png drawn from it. Not into the abso folder unless abso leaves","atom":"a224","author":"pinch","version":29},{"n":240,"text":" * that place out, or the images would be recorded as edits.","atom":"a224","author":"pinch","version":29},{"n":241,"text":" */","atom":"a224","author":"pinch","version":29},{"n":242,"text":"async function saveAttachments(api: Api, root: string, cwd: string, dir: string, page: IssuePage): Promise<Output> {","atom":"a224","author":"pinch","version":29},{"n":243,"text":"\tconst target = resolve(cwd, dir);","atom":"a224","author":"pinch","version":29},{"n":244,"text":"\tconst inside = target === resolve(root) ? \"\" : relativeTo(root, target);","atom":"a224","author":"pinch","version":29},{"n":245,"text":"\tif (inside !== undefined && (inside === \"\" || !ignoredHere(loadIgnore(root), inside, true)))","atom":"a224","author":"pinch","version":29},{"n":246,"text":"\t\tthrow new UsageError(","atom":"a224","author":"pinch","version":29},{"n":247,"text":"\t\t\t`${dir} is inside this abso folder, so abso would record the images as your edits. Save them outside the folder, or into a folder .absoignore leaves out`,","atom":"a224","author":"pinch","version":29},{"n":248,"text":"\t\t);","atom":"a224","author":"pinch","version":29},{"n":249,"text":"\tconst seen = new Set<string>();","atom":"a224","author":"pinch","version":29},{"n":250,"text":"\tconst all = [","atom":"a299","author":"pinch","version":35},{"n":251,"text":"\t\t...(page.issue.attachments ?? []),","atom":"a299","author":"pinch","version":35},{"n":252,"text":"\t\t...page.comments.flatMap((c) => c.attachments ?? []),","atom":"a299","author":"pinch","version":35},{"n":253,"text":"\t\t...page.asks.flatMap((a) => [...(a.attachments ?? []), ...(a.answer?.attachments ?? [])]),","atom":"a299","author":"pinch","version":35},{"n":254,"text":"\t].filter((a) => !seen.has(a.id) && seen.add(a.id));","atom":"a299","author":"pinch","version":35},{"n":255,"text":"\tif (all.length === 0)","atom":"a224","author":"pinch","version":29},{"n":256,"text":"\t\treturn {","atom":"a247","author":"pinch","version":29},{"n":257,"text":"\t\t\ttext: `Issue ${page.issue.id} has no attachments.`,","atom":"a247","author":"pinch","version":29},{"n":258,"text":"\t\t\tjson: { issue: page.issue.id, folder: target, files: [] },","atom":"a247","author":"pinch","version":29},{"n":259,"text":"\t\t};","atom":"a247","author":"pinch","version":29},{"n":260,"text":"\tmkdirSync(target, { recursive: true });","atom":"a224","author":"pinch","version":29},{"n":261,"text":"\tconst files: { id: string; path: string; size: number }[] = [];","atom":"a224","author":"pinch","version":29},{"n":262,"text":"\tfor (const a of all) {","atom":"a224","author":"pinch","version":29},{"n":263,"text":"\t\tconst wanted = [{ name: a.name, source: false }, ...(a.source ? [{ name: a.source.name, source: true }] : [])];","atom":"a224","author":"pinch","version":29},{"n":264,"text":"\t\tfor (const w of wanted) {","atom":"a224","author":"pinch","version":29},{"n":265,"text":"\t\t\tconst bytes = await api.attachmentBytes(a.id, w.source, ATTACH_MAX);","atom":"a224","author":"pinch","version":29},{"n":266,"text":"\t\t\tconst path = join(target, savedName(a.id, w.name));","atom":"a224","author":"pinch","version":29},{"n":267,"text":"\t\t\twriteFileSync(path, bytes);","atom":"a224","author":"pinch","version":29},{"n":268,"text":"\t\t\tfiles.push({ id: a.id, path, size: bytes.length });","atom":"a224","author":"pinch","version":29},{"n":269,"text":"\t\t}","atom":"a224","author":"pinch","version":29},{"n":270,"text":"\t}","atom":"a224","author":"pinch","version":29},{"n":271,"text":"\treturn {","atom":"a224","author":"pinch","version":29},{"n":272,"text":"\t\ttext: [","atom":"a224","author":"pinch","version":29},{"n":273,"text":"\t\t\t`Saved ${plural(files.length, \"file\")} from issue ${page.issue.id} to ${target}:`,","atom":"a224","author":"pinch","version":29},{"n":274,"text":"\t\t\t...files.map((f) => `  ${basename(f.path)}, ${sizeText(f.size)}`),","atom":"a224","author":"pinch","version":29},{"n":275,"text":"\t\t].join(\"\\n\"),","atom":"a224","author":"pinch","version":29},{"n":276,"text":"\t\tjson: { issue: page.issue.id, folder: target, files },","atom":"a224","author":"pinch","version":29},{"n":277,"text":"\t};","atom":"a224","author":"pinch","version":29},{"n":278,"text":"}","atom":"a26","author":"pinch","version":5},{"n":279,"text":"","atom":"a26","author":"pinch","version":5},{"n":280,"text":"/** An issue's page, as text. */","atom":"a0","author":"init","version":0},{"n":281,"text":"export function issuePage(p: IssuePage, api?: Pick<Api, \"attachmentUrl\">): string[] {","atom":"a26","author":"pinch","version":5},{"n":282,"text":"\tconst i = p.issue;","atom":"a0","author":"init","version":0},{"n":283,"text":"\tconst facts = [","atom":"a0","author":"init","version":0},{"n":284,"text":"\t\ti.parent !== null ? `Under issue ${i.parent}.` : \"\",","atom":"a0","author":"init","version":0},{"n":285,"text":"\t\t`Opened by ${i.opened.by}, ${shortWhen(i.opened.at)}.`,","atom":"a0","author":"init","version":0},{"n":286,"text":"\t\ti.agent !== null ? `Agent: ${i.agent}.` : \"\",","atom":"a0","author":"init","version":0},{"n":287,"text":"\t\ti.agents.length > 0 ? `Working on it: ${i.agents.join(\", \")}.` : \"\",","atom":"a0","author":"init","version":0},{"n":288,"text":"\t\ti.blockedBy.length > 0 ? `Blocked by: issue${i.blockedBy.length === 1 ? \"\" : \"s\"} ${i.blockedBy.join(\", \")}.` : \"\",","atom":"a0","author":"init","version":0},{"n":289,"text":"\t\t(i.labels ?? []).length > 0 ? `Labels: ${i.labels.join(\", \")}.` : \"\",","atom":"a0","author":"init","version":0},{"n":290,"text":"\t\ti.versions.length > 0 ? `Versions: ${i.versions.join(\", \")}.` : \"\",","atom":"a0","author":"init","version":0},{"n":291,"text":"\t\ti.waitingOn.length > 0 ? `Waiting on: ${i.waitingOn.join(\", \")}.` : \"\",","atom":"a0","author":"init","version":0},{"n":292,"text":"\t\ti.closed","atom":"a0","author":"init","version":0},{"n":293,"text":"\t\t\t? `${i.closed.how === \"done\" ? \"Done\" : \"Dropped\"} by ${i.closed.by}${i.closed.version !== null ? ` in version ${i.closed.version}` : \"\"}, ${shortWhen(i.closed.at)}.`","atom":"a0","author":"init","version":0},{"n":294,"text":"\t\t\t: \"\",","atom":"a0","author":"init","version":0},{"n":295,"text":"\t].filter((f) => f !== \"\");","atom":"a0","author":"init","version":0},{"n":296,"text":"\t// The links below open for people signed in on the website; an agent's fetch of one is refused. Say the way in","atom":"a448","author":"pinch","version":47},{"n":297,"text":"\t// before the first link, so an agent reads the files instead of hunting for them.","atom":"a448","author":"pinch","version":47},{"n":298,"text":"\tconst files =","atom":"a448","author":"pinch","version":47},{"n":299,"text":"\t\t(i.attachments ?? []).length +","atom":"a448","author":"pinch","version":47},{"n":300,"text":"\t\tp.comments.reduce((n, c) => n + (c.attachments ?? []).length, 0) +","atom":"a448","author":"pinch","version":47},{"n":301,"text":"\t\tp.asks.reduce((n, a) => n + (a.attachments ?? []).length + (a.answer?.attachments ?? []).length, 0);","atom":"a448","author":"pinch","version":47},{"n":302,"text":"\treturn [","atom":"a0","author":"init","version":0},{"n":303,"text":"\t\t`Issue ${i.id}: ${q(i.title)} [${i.status}]`,","atom":"a0","author":"init","version":0},{"n":304,"text":"\t\tfacts.join(\" \"),","atom":"a0","author":"init","version":0},{"n":305,"text":"\t\t...(files > 0","atom":"a448","author":"pinch","version":47},{"n":306,"text":"\t\t\t? [","atom":"a448","author":"pinch","version":47},{"n":307,"text":"\t\t\t\t\t`${files === 1 ? \"1 file is\" : `${files} files are`} attached below. To read ${files === 1 ? \"it\" : \"them\"}: abso issue ${i.id} --save-attachments <folder> saves ${files === 1 ? \"it\" : \"every one\"} there, then open the files. The links are for people signed in on the website.`,","atom":"a448","author":"pinch","version":47},{"n":308,"text":"\t\t\t\t]","atom":"a448","author":"pinch","version":47},{"n":309,"text":"\t\t\t: []),","atom":"a448","author":"pinch","version":47},{"n":310,"text":"\t\t...(i.lines ? [`From ${i.lines.file} lines ${i.lines.from}-${i.lines.to} at version ${i.lines.version}.`] : []),","atom":"a0","author":"init","version":0},{"n":311,"text":"\t\t...(i.description !== \"\" ? [\"\", ...i.description.split(\"\\n\").map((l) => `  ${l}`)] : []),","atom":"a0","author":"init","version":0},{"n":312,"text":"\t\t...attachmentLines(api, i.attachments, \"  \"),","atom":"a26","author":"pinch","version":5},{"n":313,"text":"\t\t...(p.asks.length > 0 ? [\"\", \"Asks:\", ...p.asks.map((a) => askLine(a, api))] : []),","atom":"a299","author":"pinch","version":35},{"n":314,"text":"\t\t...(p.comments.length > 0","atom":"a0","author":"init","version":0},{"n":315,"text":"\t\t\t? [","atom":"a0","author":"init","version":0},{"n":316,"text":"\t\t\t\t\t\"\",","atom":"a0","author":"init","version":0},{"n":317,"text":"\t\t\t\t\t\"Comments:\",","atom":"a0","author":"init","version":0},{"n":318,"text":"\t\t\t\t\t...p.comments.flatMap((c) => [","atom":"a26","author":"pinch","version":5},{"n":319,"text":"\t\t\t\t\t\t`  ${c.by}${c.kind === \"objection\" ? \" objects\" : \"\"}, ${shortWhen(c.at)}: ${q(c.text)}`,","atom":"a26","author":"pinch","version":5},{"n":320,"text":"\t\t\t\t\t\t...attachmentLines(api, c.attachments, \"    \"),","atom":"a26","author":"pinch","version":5},{"n":321,"text":"\t\t\t\t\t]),","atom":"a26","author":"pinch","version":5},{"n":322,"text":"\t\t\t\t]","atom":"a0","author":"init","version":0},{"n":323,"text":"\t\t\t: []),","atom":"a0","author":"init","version":0},{"n":324,"text":"\t\t...((p.edits ?? []).length > 0 ? [\"\", \"Edits:\", ...p.edits.map(editLine)] : []),","atom":"a0","author":"init","version":0},{"n":325,"text":"\t\t...(p.children.length > 0 ? [\"\", \"Sub-issues:\", ...p.children.map(issueLine)] : []),","atom":"a0","author":"init","version":0},{"n":326,"text":"\t\t...((i.watchers ?? []).length > 0 ? [\"\", `Watchers: ${i.watchers.join(\", \")}.`] : []),","atom":"a0","author":"init","version":0},{"n":327,"text":"\t\t\"\",","atom":"a0","author":"init","version":0},{"n":328,"text":"\t\t`abso start \"...\" --issue ${i.id} starts on it; abso issue ${i.id} --comment \"...\" comments; abso ask <who> \"...\" --issue ${i.id} asks.`,","atom":"a79","author":"review","version":16},{"n":329,"text":"\t];","atom":"a0","author":"init","version":0},{"n":330,"text":"}","atom":"a0","author":"init","version":0},{"n":331,"text":"","atom":"a0","author":"init","version":0},{"n":332,"text":"export async function runIssues(args: Parsed, env: Env): Promise<Output> {","atom":"a0","author":"init","version":0},{"n":333,"text":"\tif (args.positionals.length > 0)","atom":"a0","author":"init","version":0},{"n":334,"text":"\t\tthrow new UsageError(","atom":"a0","author":"init","version":0},{"n":335,"text":"\t\t\t\"issues takes no words: abso issues [--open] [--status <s>] [--agent <a>] [--parent <N>] [--label <l,l>] | abso issues --labels; abso issue <N> shows one\",","atom":"a79","author":"review","version":16},{"n":336,"text":"\t\t);","atom":"a0","author":"init","version":0},{"n":337,"text":"\tconst { api } = openIssues(env);","atom":"a0","author":"init","version":0},{"n":338,"text":"\tif (bool(args, \"drafts\")) {","atom":"a0","author":"init","version":0},{"n":339,"text":"\t\tconst { drafts } = await api.drafts();","atom":"a0","author":"init","version":0},{"n":340,"text":"\t\treturn {","atom":"a0","author":"init","version":0},{"n":341,"text":"\t\t\ttext:","atom":"a0","author":"init","version":0},{"n":342,"text":"\t\t\t\tdrafts.length === 0","atom":"a0","author":"init","version":0},{"n":343,"text":"\t\t\t\t\t? 'No drafts. abso issue draft \"<title>\" saves one: only you see it, and nobody hears of it.'","atom":"a79","author":"review","version":16},{"n":344,"text":"\t\t\t\t\t: [","atom":"a0","author":"init","version":0},{"n":345,"text":"\t\t\t\t\t\t\t`${plural(drafts.length, \"draft\")}, newest first (only you see them):`,","atom":"a0","author":"init","version":0},{"n":346,"text":"\t\t\t\t\t\t\t...drafts.map(draftLine),","atom":"a0","author":"init","version":0},{"n":347,"text":"\t\t\t\t\t\t\t\"abso issue draft <D> --open opens one as an issue; --delete deletes it.\",","atom":"a79","author":"review","version":16},{"n":348,"text":"\t\t\t\t\t\t].join(\"\\n\"),","atom":"a0","author":"init","version":0},{"n":349,"text":"\t\t\tjson: { drafts },","atom":"a0","author":"init","version":0},{"n":350,"text":"\t\t};","atom":"a0","author":"init","version":0},{"n":351,"text":"\t}","atom":"a0","author":"init","version":0},{"n":352,"text":"\tif (bool(args, \"labels\")) {","atom":"a0","author":"init","version":0},{"n":353,"text":"\t\tconst { labels } = await api.issueLabels();","atom":"a0","author":"init","version":0},{"n":354,"text":"\t\treturn {","atom":"a0","author":"init","version":0},{"n":355,"text":"\t\t\ttext:","atom":"a0","author":"init","version":0},{"n":356,"text":"\t\t\t\tlabels.length === 0","atom":"a0","author":"init","version":0},{"n":357,"text":"\t\t\t\t\t? 'No labels yet. abso issue new \"<title>\" --label friction labels a new issue; abso issue <N> --label <l> labels one.'","atom":"a79","author":"review","version":16},{"n":358,"text":"\t\t\t\t\t: [","atom":"a0","author":"init","version":0},{"n":359,"text":"\t\t\t\t\t\t\t`${plural(labels.length, \"label\")} in use:`,","atom":"a0","author":"init","version":0},{"n":360,"text":"\t\t\t\t\t\t\t...labels.map((l) => `  ${l.label}: ${l.open} open of ${l.total}`),","atom":"a0","author":"init","version":0},{"n":361,"text":"\t\t\t\t\t\t\t\"abso issues --label <label> lists a label's issues.\",","atom":"a79","author":"review","version":16},{"n":362,"text":"\t\t\t\t\t\t].join(\"\\n\"),","atom":"a0","author":"init","version":0},{"n":363,"text":"\t\t\tjson: { labels },","atom":"a0","author":"init","version":0},{"n":364,"text":"\t\t};","atom":"a0","author":"init","version":0},{"n":365,"text":"\t}","atom":"a0","author":"init","version":0},{"n":366,"text":"\tconst parent = str(args, \"parent\");","atom":"a0","author":"init","version":0},{"n":367,"text":"\tconst filter = {","atom":"a0","author":"init","version":0},{"n":368,"text":"\t\t...(str(args, \"status\") ? { status: str(args, \"status\")! } : {}),","atom":"a0","author":"init","version":0},{"n":369,"text":"\t\t...(str(args, \"agent\") ? { agent: str(args, \"agent\")! } : {}),","atom":"a0","author":"init","version":0},{"n":370,"text":"\t\t...(parent !== undefined ? { parent: issueNumber(parent, \"--parent\") } : {}),","atom":"a0","author":"init","version":0},{"n":371,"text":"\t\t...(str(args, \"label\") !== undefined ? { labels: labelList(str(args, \"label\")!) } : {}),","atom":"a0","author":"init","version":0},{"n":372,"text":"\t\topen: bool(args, \"open\"),","atom":"a0","author":"init","version":0},{"n":373,"text":"\t};","atom":"a0","author":"init","version":0},{"n":374,"text":"\tconst { issues } = await api.issues(filter);","atom":"a0","author":"init","version":0},{"n":375,"text":"\tconst scope = [","atom":"a0","author":"init","version":0},{"n":376,"text":"\t\tfilter.open ? \"open \" : \"\",","atom":"a0","author":"init","version":0},{"n":377,"text":"\t\tfilter.status ? `${filter.status} ` : \"\",","atom":"a0","author":"init","version":0},{"n":378,"text":"\t\tfilter.labels ? `${filter.labels.join(\", \")} ` : \"\",","atom":"a0","author":"init","version":0},{"n":379,"text":"\t].join(\"\");","atom":"a0","author":"init","version":0},{"n":380,"text":"\treturn {","atom":"a0","author":"init","version":0},{"n":381,"text":"\t\ttext:","atom":"a0","author":"init","version":0},{"n":382,"text":"\t\t\tissues.length === 0","atom":"a0","author":"init","version":0},{"n":383,"text":"\t\t\t\t? `No ${scope}issues${filter.agent ? ` for ${filter.agent}` : \"\"}${parent !== undefined ? ` under ${parent}` : \"\"}. abso issue new \"<title>\" opens one.`","atom":"a79","author":"review","version":16},{"n":384,"text":"\t\t\t\t: [","atom":"a0","author":"init","version":0},{"n":385,"text":"\t\t\t\t\t\t`${plural(issues.length, `${scope}issue`)}, most recently updated first:`,","atom":"a0","author":"init","version":0},{"n":386,"text":"\t\t\t\t\t\t...issues.map(issueLine),","atom":"a0","author":"init","version":0},{"n":387,"text":"\t\t\t\t\t\t\"abso issue <N> shows one.\",","atom":"a79","author":"review","version":16},{"n":388,"text":"\t\t\t\t\t].join(\"\\n\"),","atom":"a0","author":"init","version":0},{"n":389,"text":"\t\tjson: { issues },","atom":"a0","author":"init","version":0},{"n":390,"text":"\t};","atom":"a0","author":"init","version":0},{"n":391,"text":"}","atom":"a0","author":"init","version":0},{"n":392,"text":"","atom":"a0","author":"init","version":0},{"n":393,"text":"/** A new issue's fields from the command line, as open and drafts take them; `title` only when words were given. */","atom":"a0","author":"init","version":0},{"n":394,"text":"function openFields(args: Parsed, title: string): DraftBody {","atom":"a0","author":"init","version":0},{"n":395,"text":"\tconst lines = str(args, \"lines\");","atom":"a0","author":"init","version":0},{"n":396,"text":"\tconst at = lines === undefined ? undefined : /^(.+):(\\d+)(?:-(\\d+))?@(\\d+)$/.exec(lines);","atom":"a0","author":"init","version":0},{"n":397,"text":"\tif (lines !== undefined && !at)","atom":"a0","author":"init","version":0},{"n":398,"text":"\t\tthrow new UsageError(\"--lines is <file>:<from>-<to>@<version>, like src/a.ts:10-14@140\");","atom":"a0","author":"init","version":0},{"n":399,"text":"\tconst parent = str(args, \"parent\");","atom":"a0","author":"init","version":0},{"n":400,"text":"\treturn {","atom":"a0","author":"init","version":0},{"n":401,"text":"\t\t...(title !== \"\" ? { title } : {}),","atom":"a0","author":"init","version":0},{"n":402,"text":"\t\t...(str(args, \"description\") ? { description: str(args, \"description\")! } : {}),","atom":"a0","author":"init","version":0},{"n":403,"text":"\t\t...(parent !== undefined ? { parent: issueNumber(parent, \"--parent\") } : {}),","atom":"a0","author":"init","version":0},{"n":404,"text":"\t\t...(at ? { lines: { file: at[1]!, from: Number(at[2]), to: Number(at[3] ?? at[2]), version: Number(at[4]) } } : {}),","atom":"a0","author":"init","version":0},{"n":405,"text":"\t\t...(str(args, \"agent\") ? { agent: str(args, \"agent\")! } : {}),","atom":"a0","author":"init","version":0},{"n":406,"text":"\t\t...(str(args, \"blocked-by\") !== undefined","atom":"a0","author":"init","version":0},{"n":407,"text":"\t\t\t? { blockedBy: listOf(str(args, \"blocked-by\")!).map((b) => issueNumber(b, \"--blocked-by\")) }","atom":"a0","author":"init","version":0},{"n":408,"text":"\t\t\t: {}),","atom":"a0","author":"init","version":0},{"n":409,"text":"\t\t...(str(args, \"notify\") !== undefined ? { notify: listOf(str(args, \"notify\")!) } : {}),","atom":"a0","author":"init","version":0},{"n":410,"text":"\t\t...(str(args, \"label\") !== undefined ? { labels: labelList(str(args, \"label\")!) } : {}),","atom":"a0","author":"init","version":0},{"n":411,"text":"\t};","atom":"a0","author":"init","version":0},{"n":412,"text":"}","atom":"a0","author":"init","version":0},{"n":413,"text":"","atom":"a0","author":"init","version":0},{"n":414,"text":"/** One draft as a line: its number, title, and what else it holds. */","atom":"a0","author":"init","version":0},{"n":415,"text":"function draftLine(d: Draft): string {","atom":"a0","author":"init","version":0},{"n":416,"text":"\tconst b = d.body;","atom":"a0","author":"init","version":0},{"n":417,"text":"\tconst more = [","atom":"a0","author":"init","version":0},{"n":418,"text":"\t\tb.agent ? `for ${b.agent}` : \"\",","atom":"a0","author":"init","version":0},{"n":419,"text":"\t\tb.parent ? `under ${b.parent}` : \"\",","atom":"a0","author":"init","version":0},{"n":420,"text":"\t\t(b.labels ?? []).length > 0 ? `labels ${b.labels!.join(\", \")}` : \"\",","atom":"a0","author":"init","version":0},{"n":421,"text":"\t\tb.description ? \"a description\" : \"\",","atom":"a0","author":"init","version":0},{"n":422,"text":"\t].filter((m) => m !== \"\");","atom":"a0","author":"init","version":0},{"n":423,"text":"\treturn `  draft ${d.id}: ${b.title ? q(b.title) : \"(no title yet)\"}${more.length > 0 ? ` (${more.join(\"; \")})` : \"\"}, saved ${shortWhen(d.saved)}`;","atom":"a0","author":"init","version":0},{"n":424,"text":"}","atom":"a0","author":"init","version":0},{"n":425,"text":"","atom":"a0","author":"init","version":0},{"n":426,"text":"/**","atom":"a0","author":"init","version":0},{"n":427,"text":" * Drafts (abso issue 3): an issue not opened yet, this agent's alone, with no","atom":"a0","author":"init","version":0},{"n":428,"text":" * number and no news. `abso issue draft \"<title>\" [fields]` saves a new one;","atom":"a0","author":"init","version":0},{"n":429,"text":" * `abso issue draft <D> [fields]` changes one; --open opens it as an issue;","atom":"a0","author":"init","version":0},{"n":430,"text":" * --delete deletes it. `abso issues --drafts` lists them.","atom":"a0","author":"init","version":0},{"n":431,"text":" */","atom":"a0","author":"init","version":0},{"n":432,"text":"async function runDraft(api: Api, args: Parsed, words: string[]): Promise<Output> {","atom":"a0","author":"init","version":0},{"n":433,"text":"\tconst [d, ...more] = words;","atom":"a0","author":"init","version":0},{"n":434,"text":"\tif (d !== undefined && /^\\d+$/.test(d) && more.length === 0) {","atom":"a0","author":"init","version":0},{"n":435,"text":"\t\tconst id = Number(d);","atom":"a0","author":"init","version":0},{"n":436,"text":"\t\tif (bool(args, \"delete\") && bool(args, \"open\")) throw new UsageError(\"--open or --delete, not both\");","atom":"a0","author":"init","version":0},{"n":437,"text":"\t\tif (bool(args, \"delete\")) {","atom":"a0","author":"init","version":0},{"n":438,"text":"\t\t\tawait api.deleteDraft(id);","atom":"a0","author":"init","version":0},{"n":439,"text":"\t\t\treturn { text: `Deleted draft ${id}.`, json: { draft: id, deleted: true } };","atom":"a0","author":"init","version":0},{"n":440,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":441,"text":"\t\tif (bool(args, \"open\")) {","atom":"a0","author":"init","version":0},{"n":442,"text":"\t\t\tconst r = await api.openDraft(id, openFields(args, \"\"));","atom":"a0","author":"init","version":0},{"n":443,"text":"\t\t\treturn {","atom":"a0","author":"init","version":0},{"n":444,"text":"\t\t\t\ttext: `Opened draft ${id} as issue ${r.id}. abso start \"...\" --issue ${r.id} starts on it.`,","atom":"a79","author":"review","version":16},{"n":445,"text":"\t\t\t\tjson: { draft: id, id: r.id },","atom":"a0","author":"init","version":0},{"n":446,"text":"\t\t\t};","atom":"a0","author":"init","version":0},{"n":447,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":448,"text":"\t\t// Saving replaces the draft's body, so the fields given go over what it holds.","atom":"a0","author":"init","version":0},{"n":449,"text":"\t\tconst found = (await api.drafts()).drafts.find((x) => x.id === id);","atom":"a0","author":"init","version":0},{"n":450,"text":"\t\tif (!found) throw new UsageError(`you have no draft ${id}; abso issues --drafts lists yours`);","atom":"a79","author":"review","version":16},{"n":451,"text":"\t\tawait api.saveDraft({ ...found.body, ...openFields(args, \"\"), id });","atom":"a0","author":"init","version":0},{"n":452,"text":"\t\treturn { text: `Saved draft ${id}.`, json: { draft: id } };","atom":"a0","author":"init","version":0},{"n":453,"text":"\t}","atom":"a0","author":"init","version":0},{"n":454,"text":"\tif (bool(args, \"open\") || bool(args, \"delete\"))","atom":"a0","author":"init","version":0},{"n":455,"text":"\t\tthrow new UsageError(\"--open and --delete take a draft's number: abso issue draft <D> --open\");","atom":"a79","author":"review","version":16},{"n":456,"text":"\tconst r = await api.saveDraft(openFields(args, words.join(\" \")));","atom":"a0","author":"init","version":0},{"n":457,"text":"\treturn {","atom":"a0","author":"init","version":0},{"n":458,"text":"\t\ttext: `Saved draft ${r.id}. Only you see it, and nobody hears of it. abso issue draft ${r.id} --open opens it as an issue.`,","atom":"a79","author":"review","version":16},{"n":459,"text":"\t\tjson: { draft: r.id },","atom":"a0","author":"init","version":0},{"n":460,"text":"\t};","atom":"a0","author":"init","version":0},{"n":461,"text":"}","atom":"a0","author":"init","version":0},{"n":462,"text":"","atom":"a0","author":"init","version":0},{"n":463,"text":"/** The flags --copy-to goes with: anything else on the same command is refused, so a copy is never half an edit. */","atom":"a164","author":"pinch","version":23},{"n":464,"text":"const COPY_FLAGS = new Set([\"copy-to\", \"clean\", \"dry-run\"]);","atom":"a164","author":"pinch","version":23},{"n":465,"text":"","atom":"a164","author":"pinch","version":23},{"n":466,"text":"/** abso issue <N> --copy-to <project>: the server reads the issue and writes the copy. */","atom":"a164","author":"pinch","version":23},{"n":467,"text":"async function runCopy(api: Api, id: number, to: string, args: Parsed, env: Env): Promise<Output> {","atom":"a164","author":"pinch","version":23},{"n":468,"text":"\tconst other = [...args.flags.keys()].filter((f) => !COPY_FLAGS.has(f) && f !== \"json\");","atom":"a164","author":"pinch","version":23},{"n":469,"text":"\tif (other.length > 0)","atom":"a164","author":"pinch","version":23},{"n":470,"text":"\t\tthrow new UsageError(`--copy-to goes alone (with --clean and --dry-run), not with --${other[0]}`);","atom":"a164","author":"pinch","version":23},{"n":471,"text":"\tif (to === api.config.project)","atom":"a164","author":"pinch","version":23},{"n":472,"text":"\t\tthrow new UsageError(`issue ${id} is already in ${to}; --copy-to names another project`);","atom":"a164","author":"pinch","version":23},{"n":473,"text":"\tconst clean = str(args, \"clean\");","atom":"a164","author":"pinch","version":23},{"n":474,"text":"\tconst texts = clean === undefined ? {} : readClean(resolve(env.cwd, clean), clean);","atom":"a164","author":"pinch","version":23},{"n":475,"text":"\tconst dryRun = bool(args, \"dry-run\");","atom":"a164","author":"pinch","version":23},{"n":476,"text":"\tconst from = api.config.project;","atom":"a164","author":"pinch","version":23},{"n":477,"text":"\tlet answer: CopyAnswer;","atom":"a164","author":"pinch","version":23},{"n":478,"text":"\ttry {","atom":"a164","author":"pinch","version":23},{"n":479,"text":"\t\tanswer = await api.issueCopy(to, { ...texts, from, issue: id, ...(dryRun ? { dryRun: true } : {}) });","atom":"a164","author":"pinch","version":23},{"n":480,"text":"\t} catch (e) {","atom":"a164","author":"pinch","version":23},{"n":481,"text":"\t\tif (e instanceof ApiError && e.status === 403 && !dryRun)","atom":"a164","author":"pinch","version":23},{"n":482,"text":"\t\t\tthrow new ApiError(`${e.message}. --dry-run still shows what would go.`, e.status);","atom":"a164","author":"pinch","version":23},{"n":483,"text":"\t\tthrow e;","atom":"a164","author":"pinch","version":23},{"n":484,"text":"\t}","atom":"a164","author":"pinch","version":23},{"n":485,"text":"\tif (\"dryRun\" in answer) {","atom":"a164","author":"pinch","version":23},{"n":486,"text":"\t\tconst p = answer.plan;","atom":"a164","author":"pinch","version":23},{"n":487,"text":"\t\tconst edited = (list: { edited: boolean }[]) => list.filter((x) => x.edited).length;","atom":"a164","author":"pinch","version":23},{"n":488,"text":"\t\tconst lines = [","atom":"a164","author":"pinch","version":23},{"n":489,"text":"\t\t\t`A dry run: nothing was written. Copying ${from} issue ${id} into ${to} would make:`,","atom":"a164","author":"pinch","version":23},{"n":490,"text":"\t\t\t`  ${q(p.title)}${p.closed ? `, ${p.closed.how}` : \"\"}${p.edited.length > 0 ? ` (${p.edited.join(\" and \")} edited when copied)` : \"\"}`,","atom":"a164","author":"pinch","version":23},{"n":491,"text":"\t\t\t`  ${plural(p.comments.length, \"comment\")}${edited(p.comments) > 0 ? ` (${edited(p.comments)} edited)` : \"\"}, ${plural(p.asks.length, \"answered ask\")}${edited(p.asks) > 0 ? ` (${edited(p.asks)} edited)` : \"\"}${p.labels.length > 0 ? `, labelled ${p.labels.join(\", \")}` : \"\"}`,","atom":"a164","author":"pinch","version":23},{"n":492,"text":"\t\t\t...skippedLines(p.skipped),","atom":"a164","author":"pinch","version":23},{"n":493,"text":"\t\t\t`Run it again without --dry-run to copy it.`,","atom":"a164","author":"pinch","version":23},{"n":494,"text":"\t\t];","atom":"a164","author":"pinch","version":23},{"n":495,"text":"\t\treturn { text: lines.join(\"\\n\"), json: answer };","atom":"a164","author":"pinch","version":23},{"n":496,"text":"\t}","atom":"a164","author":"pinch","version":23},{"n":497,"text":"\treturn {","atom":"a164","author":"pinch","version":23},{"n":498,"text":"\t\ttext: [","atom":"a164","author":"pinch","version":23},{"n":499,"text":"\t\t\t`Copied ${from} issue ${id} to ${to} issue ${answer.id}. Its comments and asks keep their authors and times, and issue ${id} has a comment saying where it went.`,","atom":"a164","author":"pinch","version":23},{"n":500,"text":"\t\t\t...skippedLines(answer.skipped),","atom":"a164","author":"pinch","version":23},{"n":501,"text":"\t\t].join(\"\\n\"),","atom":"a164","author":"pinch","version":23},{"n":502,"text":"\t\tjson: answer,","atom":"a164","author":"pinch","version":23},{"n":503,"text":"\t};","atom":"a164","author":"pinch","version":23},{"n":504,"text":"}","atom":"a164","author":"pinch","version":23},{"n":505,"text":"","atom":"a164","author":"pinch","version":23},{"n":506,"text":"function skippedLines(skipped: { comments: number[]; asks: number[] }): string[] {","atom":"a164","author":"pinch","version":23},{"n":507,"text":"\tconst parts = [","atom":"a164","author":"pinch","version":23},{"n":508,"text":"\t\t...(skipped.comments.length > 0 ? [`comments ${skipped.comments.join(\", \")}`] : []),","atom":"a164","author":"pinch","version":23},{"n":509,"text":"\t\t...(skipped.asks.length > 0 ? [`asks ${skipped.asks.join(\", \")}`] : []),","atom":"a164","author":"pinch","version":23},{"n":510,"text":"\t];","atom":"a164","author":"pinch","version":23},{"n":511,"text":"\treturn parts.length > 0 ? [`  not copied: ${parts.join(\"; \")} (open asks, and what --clean left out)`] : [];","atom":"a164","author":"pinch","version":23},{"n":512,"text":"}","atom":"a164","author":"pinch","version":23},{"n":513,"text":"","atom":"a164","author":"pinch","version":23},{"n":514,"text":"/** --clean's file: cleaned texts by source id. The server checks each id against the issue it reads. */","atom":"a164","author":"pinch","version":23},{"n":515,"text":"function readClean(path: string, given: string): Omit<CopyBody, \"from\" | \"issue\"> {","atom":"a164","author":"pinch","version":23},{"n":516,"text":"\tlet raw: unknown;","atom":"a164","author":"pinch","version":23},{"n":517,"text":"\ttry {","atom":"a164","author":"pinch","version":23},{"n":518,"text":"\t\traw = JSON.parse(readFileSync(path, \"utf8\"));","atom":"a164","author":"pinch","version":23},{"n":519,"text":"\t} catch (e) {","atom":"a164","author":"pinch","version":23},{"n":520,"text":"\t\tthrow new UsageError(","atom":"a164","author":"pinch","version":23},{"n":521,"text":"\t\t\t`--clean ${given}: ${(e as NodeJS.ErrnoException).code === \"ENOENT\" ? \"no such file\" : \"not JSON\"}`,","atom":"a164","author":"pinch","version":23},{"n":522,"text":"\t\t);","atom":"a164","author":"pinch","version":23},{"n":523,"text":"\t}","atom":"a164","author":"pinch","version":23},{"n":524,"text":"\tif (typeof raw !== \"object\" || raw === null || Array.isArray(raw))","atom":"a164","author":"pinch","version":23},{"n":525,"text":"\t\tthrow new UsageError(`--clean ${given}: a JSON object with title, description, comments or asks`);","atom":"a164","author":"pinch","version":23},{"n":526,"text":"\tconst known = new Set([\"title\", \"description\", \"comments\", \"asks\"]);","atom":"a164","author":"pinch","version":23},{"n":527,"text":"\tconst unknown = Object.keys(raw).filter((k) => !known.has(k));","atom":"a164","author":"pinch","version":23},{"n":528,"text":"\tif (unknown.length > 0)","atom":"a164","author":"pinch","version":23},{"n":529,"text":"\t\tthrow new UsageError(`--clean ${given}: ${unknown[0]} isn't one of title, description, comments, asks`);","atom":"a164","author":"pinch","version":23},{"n":530,"text":"\treturn raw as Omit<CopyBody, \"from\" | \"issue\">;","atom":"a164","author":"pinch","version":23},{"n":531,"text":"}","atom":"a164","author":"pinch","version":23},{"n":532,"text":"","atom":"a164","author":"pinch","version":23},{"n":533,"text":"export async function runIssue(args: Parsed, env: Env): Promise<Output> {","atom":"a0","author":"init","version":0},{"n":534,"text":"\tconst [first, ...rest] = args.positionals;","atom":"a0","author":"init","version":0},{"n":535,"text":"\tconst { root, api } = openIssues(env);","atom":"a225","author":"pinch","version":29},{"n":536,"text":"\tconst saveTo = str(args, \"save-attachments\");","atom":"a225","author":"pinch","version":29},{"n":537,"text":"\tif (saveTo !== undefined) {","atom":"a225","author":"pinch","version":29},{"n":538,"text":"\t\tconst other = [...args.flags.keys()].filter((f) => f !== \"save-attachments\" && f !== \"json\");","atom":"a225","author":"pinch","version":29},{"n":539,"text":"\t\tif (other.length > 0 || first === \"new\" || first === \"draft\")","atom":"a225","author":"pinch","version":29},{"n":540,"text":"\t\t\tthrow new UsageError(","atom":"a225","author":"pinch","version":29},{"n":541,"text":"\t\t\t\t`--save-attachments goes alone with an issue number: abso issue <N> --save-attachments <folder>${other.length > 0 ? `, not with --${other[0]}` : \"\"}`,","atom":"a225","author":"pinch","version":29},{"n":542,"text":"\t\t\t);","atom":"a225","author":"pinch","version":29},{"n":543,"text":"\t}","atom":"a225","author":"pinch","version":29},{"n":544,"text":"\tif (first === \"draft\") return runDraft(api, args, rest);","atom":"a0","author":"init","version":0},{"n":545,"text":"\tif (first === \"new\") {","atom":"a0","author":"init","version":0},{"n":546,"text":"\t\tif (rest.length === 0)","atom":"a0","author":"init","version":0},{"n":547,"text":"\t\t\tthrow new UsageError(","atom":"a0","author":"init","version":0},{"n":548,"text":"\t\t\t\t'abso issue new \"<title>\" [--description \"...\"] [--parent <N>] [--lines <file>:<from>-<to>@<version>] [--agent <agent>] [--blocked-by <N,N>] [--notify <who,who>] [--label <l,l>]',","atom":"a79","author":"review","version":16},{"n":549,"text":"\t\t\t);","atom":"a0","author":"init","version":0},{"n":550,"text":"\t\tconst fields = { ...openFields(args, rest.join(\" \")), title: rest.join(\" \") };","atom":"a26","author":"pinch","version":5},{"n":551,"text":"\t\tconst attachments = await uploadAttachments(api, env.cwd, str(args, \"attach\"));","atom":"a26","author":"pinch","version":5},{"n":552,"text":"\t\tconst r = await api.issueOpen({ ...fields, ...(attachments.length > 0 ? { attachments } : {}) });","atom":"a26","author":"pinch","version":5},{"n":553,"text":"\t\treturn {","atom":"a26","author":"pinch","version":5},{"n":554,"text":"\t\t\ttext: `Opened issue ${r.id}${attachments.length > 0 ? ` with ${plural(attachments.length, \"attachment\")} (${attachments.join(\", \")})` : \"\"}. abso start \"...\" --issue ${r.id} starts on it.`,","atom":"a79","author":"review","version":16},{"n":555,"text":"\t\t\tjson: { id: r.id, ...(attachments.length > 0 ? { attachments } : {}) },","atom":"a26","author":"pinch","version":5},{"n":556,"text":"\t\t};","atom":"a26","author":"pinch","version":5},{"n":557,"text":"\t}","atom":"a0","author":"init","version":0},{"n":558,"text":"\tif (first === undefined || rest.length > 0)","atom":"a0","author":"init","version":0},{"n":559,"text":"\t\tthrow new UsageError(","atom":"a0","author":"init","version":0},{"n":560,"text":"\t\t\t'abso issue <N> [--comment \"...\" | --object \"...\" | --drop | --reopen | --done [--done-by <version>] | an edit], or abso issue new \"<title>\"',","atom":"a79","author":"review","version":16},{"n":561,"text":"\t\t);","atom":"a0","author":"init","version":0},{"n":562,"text":"\tconst id = issueNumber(first);","atom":"a0","author":"init","version":0},{"n":563,"text":"\tconst copyTo = str(args, \"copy-to\");","atom":"a164","author":"pinch","version":23},{"n":564,"text":"\tif (copyTo !== undefined) return runCopy(api, id, copyTo, args, env);","atom":"a164","author":"pinch","version":23},{"n":565,"text":"\tif (str(args, \"clean\") !== undefined || bool(args, \"dry-run\"))","atom":"a164","author":"pinch","version":23},{"n":566,"text":"\t\tthrow new UsageError(\"--clean and --dry-run go with --copy-to <project>\");","atom":"a164","author":"pinch","version":23},{"n":567,"text":"\tconst comment = str(args, \"comment\");","atom":"a0","author":"init","version":0},{"n":568,"text":"\tconst object = str(args, \"object\");","atom":"a0","author":"init","version":0},{"n":569,"text":"\tconst doneBy = str(args, \"done-by\");","atom":"a0","author":"init","version":0},{"n":570,"text":"\tconst markingDone = bool(args, \"done\") || doneBy !== undefined;","atom":"a0","author":"init","version":0},{"n":571,"text":"\tconst edits = [\"title\", \"description\", \"parent\", \"agent\", \"blocked-by\", \"label\", \"unlabel\"].filter(","atom":"a0","author":"init","version":0},{"n":572,"text":"\t\t(f) => str(args, f) !== undefined,","atom":"a0","author":"init","version":0},{"n":573,"text":"\t);","atom":"a0","author":"init","version":0},{"n":574,"text":"\tif (","atom":"a0","author":"init","version":0},{"n":575,"text":"\t\t[","atom":"a0","author":"init","version":0},{"n":576,"text":"\t\t\tcomment !== undefined,","atom":"a0","author":"init","version":0},{"n":577,"text":"\t\t\tobject !== undefined,","atom":"a0","author":"init","version":0},{"n":578,"text":"\t\t\tbool(args, \"drop\"),","atom":"a0","author":"init","version":0},{"n":579,"text":"\t\t\tbool(args, \"reopen\"),","atom":"a0","author":"init","version":0},{"n":580,"text":"\t\t\tmarkingDone,","atom":"a0","author":"init","version":0},{"n":581,"text":"\t\t\tedits.length > 0,","atom":"a0","author":"init","version":0},{"n":582,"text":"\t\t].filter(Boolean).length > 1","atom":"a0","author":"init","version":0},{"n":583,"text":"\t)","atom":"a0","author":"init","version":0},{"n":584,"text":"\t\tthrow new UsageError(\"one of --comment, --object, --drop, --reopen, --done or an edit at a time\");","atom":"a0","author":"init","version":0},{"n":585,"text":"\tif (edits.length > 0) {","atom":"a0","author":"init","version":0},{"n":586,"text":"\t\tconst parent = str(args, \"parent\");","atom":"a0","author":"init","version":0},{"n":587,"text":"\t\tconst agent = str(args, \"agent\");","atom":"a0","author":"init","version":0},{"n":588,"text":"\t\tconst blockedBy = str(args, \"blocked-by\");","atom":"a0","author":"init","version":0},{"n":589,"text":"\t\tconst r = await api.issueEdit(id, {","atom":"a0","author":"init","version":0},{"n":590,"text":"\t\t\t...(str(args, \"title\") !== undefined ? { title: str(args, \"title\")! } : {}),","atom":"a0","author":"init","version":0},{"n":591,"text":"\t\t\t...(str(args, \"description\") !== undefined ? { description: str(args, \"description\")! } : {}),","atom":"a0","author":"init","version":0},{"n":592,"text":"\t\t\t...(parent !== undefined ? { parent: parent === \"none\" ? null : issueNumber(parent, \"--parent\") } : {}),","atom":"a0","author":"init","version":0},{"n":593,"text":"\t\t\t...(agent !== undefined ? { agent: agent === \"none\" ? null : agent } : {}),","atom":"a0","author":"init","version":0},{"n":594,"text":"\t\t\t...(blockedBy !== undefined ? { blockedBy: listOf(blockedBy).map((b) => issueNumber(b, \"--blocked-by\")) } : {}),","atom":"a0","author":"init","version":0},{"n":595,"text":"\t\t\t...(bool(args, \"quiet\") ? { notify: false } : {}),","atom":"a0","author":"init","version":0},{"n":596,"text":"\t\t\t...(str(args, \"notify\") !== undefined ? { also: listOf(str(args, \"notify\")!) } : {}),","atom":"a0","author":"init","version":0},{"n":597,"text":"\t\t\t...(str(args, \"label\") !== undefined ? { addLabels: labelList(str(args, \"label\")!) } : {}),","atom":"a0","author":"init","version":0},{"n":598,"text":"\t\t\t...(str(args, \"unlabel\") !== undefined ? { removeLabels: labelList(str(args, \"unlabel\")!) } : {}),","atom":"a0","author":"init","version":0},{"n":599,"text":"\t\t\t// A labels-only edit tells nobody unless --notify names people.","atom":"a0","author":"init","version":0},{"n":600,"text":"\t\t\t...(edits.every((f) => f === \"label\" || f === \"unlabel\") && str(args, \"notify\") !== undefined","atom":"a0","author":"init","version":0},{"n":601,"text":"\t\t\t\t? { notify: true }","atom":"a0","author":"init","version":0},{"n":602,"text":"\t\t\t\t: {}),","atom":"a0","author":"init","version":0},{"n":603,"text":"\t\t});","atom":"a0","author":"init","version":0},{"n":604,"text":"\t\treturn {","atom":"a0","author":"init","version":0},{"n":605,"text":"\t\t\ttext: `Edited issue ${id}. ${r.notified.length > 0 ? `Told ${r.notified.join(\", \")}.` : \"Told nobody.\"}`,","atom":"a0","author":"init","version":0},{"n":606,"text":"\t\t\tjson: { issue: id, edit: r.edit, notified: r.notified },","atom":"a0","author":"init","version":0},{"n":607,"text":"\t\t};","atom":"a0","author":"init","version":0},{"n":608,"text":"\t}","atom":"a0","author":"init","version":0},{"n":609,"text":"\tif (bool(args, \"quiet\") || str(args, \"notify\") !== undefined)","atom":"a0","author":"init","version":0},{"n":610,"text":"\t\tthrow new UsageError(","atom":"a0","author":"init","version":0},{"n":611,"text":"\t\t\t\"--quiet and --notify go with an edit (--title, --description, --parent, --agent, --blocked-by, --label or --unlabel)\",","atom":"a0","author":"init","version":0},{"n":612,"text":"\t\t);","atom":"a0","author":"init","version":0},{"n":613,"text":"\tif (str(args, \"attach\") !== undefined && comment === undefined && object === undefined)","atom":"a26","author":"pinch","version":5},{"n":614,"text":"\t\tthrow new UsageError(\"--attach goes with abso issue new or --comment (or --object)\");","atom":"a79","author":"review","version":16},{"n":615,"text":"\tif (comment !== undefined || object !== undefined) {","atom":"a0","author":"init","version":0},{"n":616,"text":"\t\t// Refused before anything goes up: an objection is one comment, and a part of one would read as a whole.","atom":"a808","author":"pinch","version":96},{"n":617,"text":"\t\tif (object !== undefined && object.length > COMMENT_MAX)","atom":"a808","author":"pinch","version":96},{"n":618,"text":"\t\t\tthrow new UsageError(","atom":"a808","author":"pinch","version":96},{"n":619,"text":"\t\t\t\t`an objection holds up to ${COMMENT_MAX} characters, and this one has ${object.length}: say it shorter, and put the rest in a --comment`,","atom":"a808","author":"pinch","version":96},{"n":620,"text":"\t\t\t);","atom":"a808","author":"pinch","version":96},{"n":621,"text":"\t\tconst parts = object !== undefined ? [object] : commentParts(comment!);","atom":"a808","author":"pinch","version":96},{"n":622,"text":"\t\tconst attachments = await uploadAttachments(api, env.cwd, str(args, \"attach\"));","atom":"a26","author":"pinch","version":5},{"n":623,"text":"\t\tconst ids: number[] = [];","atom":"a808","author":"pinch","version":96},{"n":624,"text":"\t\tfor (const [i, part] of parts.entries()) {","atom":"a808","author":"pinch","version":96},{"n":625,"text":"\t\t\t// The attachments go on the first part, which the rest follow.","atom":"a808","author":"pinch","version":96},{"n":626,"text":"\t\t\tids.push((await api.issueComment(id, part, object !== undefined, i === 0 ? attachments : [])).id);","atom":"a808","author":"pinch","version":96},{"n":627,"text":"\t\t}","atom":"a808","author":"pinch","version":96},{"n":628,"text":"\t\tconst inParts = parts.length > 1 ? ` in ${parts.length} parts (comments ${ids.join(\", \")})` : \"\";","atom":"a808","author":"pinch","version":96},{"n":629,"text":"\t\treturn {","atom":"a0","author":"init","version":0},{"n":630,"text":"\t\t\ttext: `${object !== undefined ? \"Objected\" : \"Commented\"} on issue ${id}${inParts}${attachments.length > 0 ? ` with ${plural(attachments.length, \"attachment\")} (${attachments.join(\", \")})` : \"\"}. Its agents hear it.`,","atom":"a808","author":"pinch","version":96},{"n":631,"text":"\t\t\tjson: {","atom":"a808","author":"pinch","version":96},{"n":632,"text":"\t\t\t\tid: ids[0],","atom":"a808","author":"pinch","version":96},{"n":633,"text":"\t\t\t\tissue: id,","atom":"a808","author":"pinch","version":96},{"n":634,"text":"\t\t\t\t...(parts.length > 1 ? { parts: ids } : {}),","atom":"a808","author":"pinch","version":96},{"n":635,"text":"\t\t\t\t...(attachments.length > 0 ? { attachments } : {}),","atom":"a808","author":"pinch","version":96},{"n":636,"text":"\t\t\t},","atom":"a808","author":"pinch","version":96},{"n":637,"text":"\t\t};","atom":"a0","author":"init","version":0},{"n":638,"text":"\t}","atom":"a0","author":"init","version":0},{"n":639,"text":"\tif (bool(args, \"drop\")) {","atom":"a0","author":"init","version":0},{"n":640,"text":"\t\tawait api.issueDrop(id);","atom":"a0","author":"init","version":0},{"n":641,"text":"\t\treturn { text: `Dropped issue ${id}.`, json: { issue: id, dropped: true } };","atom":"a0","author":"init","version":0},{"n":642,"text":"\t}","atom":"a0","author":"init","version":0},{"n":643,"text":"\tif (bool(args, \"reopen\")) {","atom":"a0","author":"init","version":0},{"n":644,"text":"\t\tawait api.issueReopen(id);","atom":"a0","author":"init","version":0},{"n":645,"text":"\t\treturn { text: `Reopened issue ${id}.`, json: { issue: id, reopened: true } };","atom":"a0","author":"init","version":0},{"n":646,"text":"\t}","atom":"a0","author":"init","version":0},{"n":647,"text":"\tif (markingDone) {","atom":"a0","author":"init","version":0},{"n":648,"text":"\t\tlet version: number | null = null;","atom":"a0","author":"init","version":0},{"n":649,"text":"\t\tif (doneBy !== undefined) {","atom":"a0","author":"init","version":0},{"n":650,"text":"\t\t\tversion = issueNumber(doneBy, \"--done-by\");","atom":"a0","author":"init","version":0},{"n":651,"text":"\t\t\tif (version < 1) throw new UsageError(\"--done-by is a pushed version, 1 or more\");","atom":"a843","author":"rename","version":100},{"n":652,"text":"\t\t\ttry {","atom":"a0","author":"init","version":0},{"n":653,"text":"\t\t\t\tawait api.show(version, { draft: null });","atom":"a0","author":"init","version":0},{"n":654,"text":"\t\t\t} catch {","atom":"a0","author":"init","version":0},{"n":655,"text":"\t\t\t\tthrow new UsageError(`no version ${version}`);","atom":"a0","author":"init","version":0},{"n":656,"text":"\t\t\t}","atom":"a0","author":"init","version":0},{"n":657,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":658,"text":"\t\tawait api.issueDone(id, version);","atom":"a0","author":"init","version":0},{"n":659,"text":"\t\treturn {","atom":"a0","author":"init","version":0},{"n":660,"text":"\t\t\ttext: version === null ? `Marked issue ${id} done.` : `Marked issue ${id} done in version ${version}.`,","atom":"a0","author":"init","version":0},{"n":661,"text":"\t\t\tjson: { issue: id, done: true, ...(version !== null ? { version } : {}) },","atom":"a0","author":"init","version":0},{"n":662,"text":"\t\t};","atom":"a0","author":"init","version":0},{"n":663,"text":"\t}","atom":"a0","author":"init","version":0},{"n":664,"text":"\tconst page = await api.issue(id);","atom":"a0","author":"init","version":0},{"n":665,"text":"\tif (saveTo !== undefined) return saveAttachments(api, root, env.cwd, saveTo, page);","atom":"a226","author":"pinch","version":29},{"n":666,"text":"\treturn { text: issuePage(page, api).join(\"\\n\"), json: { ...page } };","atom":"a26","author":"pinch","version":5},{"n":667,"text":"}","atom":"a0","author":"init","version":0},{"n":668,"text":"","atom":"a0","author":"init","version":0},{"n":669,"text":"export async function runAsk(args: Parsed, env: Env): Promise<Output> {","atom":"a0","author":"init","version":0},{"n":670,"text":"\tconst withdraw = str(args, \"withdraw\");","atom":"a65","author":"infra-split","version":14},{"n":671,"text":"\tif (withdraw !== undefined) return withdrawAsk(args, env, withdraw);","atom":"a65","author":"infra-split","version":14},{"n":672,"text":"\tif (str(args, \"note\") !== undefined)","atom":"a70","author":"infra-split","version":14},{"n":673,"text":"\t\tthrow new UsageError('--note goes with --withdraw: abso ask --withdraw <ask> --note \"why\"');","atom":"a79","author":"review","version":16},{"n":674,"text":"\tconst [of, ...words] = args.positionals;","atom":"a0","author":"init","version":0},{"n":675,"text":"\tif (of !== undefined && words.length === 0 && /^\\d+$/.test(of)) return showAsk(args, env, of);","atom":"a660","author":"pinch","version":72},{"n":676,"text":"\tif (of === undefined || words.length === 0)","atom":"a0","author":"init","version":0},{"n":677,"text":"\t\tthrow new UsageError(","atom":"a0","author":"init","version":0},{"n":678,"text":"\t\t\t'abso ask <who> \"<question>\" [--issue <N>] [--review | --task] [--due <YYYY-MM-DD>] [--blocks <N,N>] [--options \"A|B|C\"]; who is an agent, or person:<id>',","atom":"a79","author":"review","version":16},{"n":679,"text":"\t\t);","atom":"a0","author":"init","version":0},{"n":680,"text":"\tconst { api } = openIssues(env);","atom":"a0","author":"init","version":0},{"n":681,"text":"\tif (bool(args, \"review\") && bool(args, \"task\")) throw new UsageError(\"an ask is a review or a task, not both\");","atom":"a0","author":"init","version":0},{"n":682,"text":"\tconst issue = str(args, \"issue\");","atom":"a0","author":"init","version":0},{"n":683,"text":"\tconst blocks = str(args, \"blocks\");","atom":"a0","author":"init","version":0},{"n":684,"text":"\tconst options = str(args, \"options\");","atom":"a0","author":"init","version":0},{"n":685,"text":"\tconst attachments = await uploadAttachments(api, env.cwd, str(args, \"attach\"));","atom":"a299","author":"pinch","version":35},{"n":686,"text":"\tconst r = await api.ask({","atom":"a0","author":"init","version":0},{"n":687,"text":"\t\tof,","atom":"a0","author":"init","version":0},{"n":688,"text":"\t\tquestion: words.join(\" \"),","atom":"a0","author":"init","version":0},{"n":689,"text":"\t\t...(issue !== undefined ? { issue: issueNumber(issue, \"--issue\") } : {}),","atom":"a0","author":"init","version":0},{"n":690,"text":"\t\t...(bool(args, \"review\") ? { review: true } : {}),","atom":"a0","author":"init","version":0},{"n":691,"text":"\t\t...(bool(args, \"task\") ? { kind: \"task\" as const } : {}),","atom":"a0","author":"init","version":0},{"n":692,"text":"\t\t...(str(args, \"due\") ? { due: str(args, \"due\")! } : {}),","atom":"a0","author":"init","version":0},{"n":693,"text":"\t\t...(blocks !== undefined ? { blocks: blocks.split(\",\").map((b) => issueNumber(b.trim(), \"--blocks\")) } : {}),","atom":"a0","author":"init","version":0},{"n":694,"text":"\t\t...(options !== undefined","atom":"a0","author":"init","version":0},{"n":695,"text":"\t\t\t? {","atom":"a0","author":"init","version":0},{"n":696,"text":"\t\t\t\t\toptions: options","atom":"a0","author":"init","version":0},{"n":697,"text":"\t\t\t\t\t\t.split(\"|\")","atom":"a0","author":"init","version":0},{"n":698,"text":"\t\t\t\t\t\t.map((o) => o.trim())","atom":"a0","author":"init","version":0},{"n":699,"text":"\t\t\t\t\t\t.filter((o) => o !== \"\"),","atom":"a0","author":"init","version":0},{"n":700,"text":"\t\t\t\t}","atom":"a0","author":"init","version":0},{"n":701,"text":"\t\t\t: {}),","atom":"a0","author":"init","version":0},{"n":702,"text":"\t\t...(attachments.length > 0 ? { attachments } : {}),","atom":"a299","author":"pinch","version":35},{"n":703,"text":"\t});","atom":"a0","author":"init","version":0},{"n":704,"text":"\tconst lost = notKept(attachments, r.attachments, `ask ${r.id}`);","atom":"a299","author":"pinch","version":35},{"n":705,"text":"\treturn {","atom":"a299","author":"pinch","version":35},{"n":706,"text":"\t\ttext: `Asked ${of} (ask ${r.id})${withFiles(attachments)}. They hear it; abso waiting shows what's open.${lost ? ` ${lost}` : \"\"}`,","atom":"a299","author":"pinch","version":35},{"n":707,"text":"\t\tjson: { id: r.id, ...(attachments.length > 0 ? { attachments } : {}), ...(lost ? { notKept: lost } : {}) },","atom":"a299","author":"pinch","version":35},{"n":708,"text":"\t};","atom":"a299","author":"pinch","version":35},{"n":709,"text":"}","atom":"a0","author":"init","version":0},{"n":710,"text":"","atom":"a0","author":"init","version":0},{"n":711,"text":"/** abso ask <N>: one ask, open or closed, with its whole thread, its answer and whose turn it is. */","atom":"a660","author":"pinch","version":72},{"n":712,"text":"async function showAsk(args: Parsed, env: Env, word: string): Promise<Output> {","atom":"a660","author":"pinch","version":72},{"n":713,"text":"\tconst others = [\"issue\", \"due\", \"blocks\", \"options\", \"attach\"].filter((f) => str(args, f) !== undefined);","atom":"a660","author":"pinch","version":72},{"n":714,"text":"\tif (others.length > 0 || bool(args, \"review\") || bool(args, \"task\"))","atom":"a660","author":"pinch","version":72},{"n":715,"text":"\t\tthrow new UsageError('abso ask <N> shows ask N; to ask, say who and what: abso ask <who> \"<question>\"');","atom":"a660","author":"pinch","version":72},{"n":716,"text":"\tconst id = issueNumber(word, \"the ask number\");","atom":"a660","author":"pinch","version":72},{"n":717,"text":"\tconst { api, config } = openIssues(env);","atom":"a660","author":"pinch","version":72},{"n":718,"text":"\tconst { ask } = await api.askThread(id);","atom":"a660","author":"pinch","version":72},{"n":719,"text":"\tconst side = ask.of === config.agent || ask.by === config.agent;","atom":"a660","author":"pinch","version":72},{"n":720,"text":"\tconst turn = ask.waitingOn === config.agent ? \"you\" : ask.waitingOn;","atom":"a660","author":"pinch","version":72},{"n":721,"text":"\tconst steps = !side","atom":"a660","author":"pinch","version":72},{"n":722,"text":"\t\t? \"\"","atom":"a660","author":"pinch","version":72},{"n":723,"text":"\t\t: ask.answer","atom":"a660","author":"pinch","version":72},{"n":724,"text":"\t\t\t? `abso reply ${id} \"...\" still adds to it.`","atom":"a660","author":"pinch","version":72},{"n":725,"text":"\t\t\t: ask.of === config.agent","atom":"a660","author":"pinch","version":72},{"n":726,"text":"\t\t\t\t? `abso reply ${id} \"...\" adds to it; abso answer ${id} \"...\" answers and closes it.`","atom":"a660","author":"pinch","version":72},{"n":727,"text":"\t\t\t\t: `abso reply ${id} \"...\" adds to it.`;","atom":"a660","author":"pinch","version":72},{"n":728,"text":"\tconst next = [!ask.answer && turn ? `It waits on ${turn}.` : \"\", steps].join(\" \");","atom":"a660","author":"pinch","version":72},{"n":729,"text":"\treturn {","atom":"a660","author":"pinch","version":72},{"n":730,"text":"\t\ttext: [askLine(ask, api, true), next.trim()].filter((l) => l !== \"\").join(\"\\n\"),","atom":"a660","author":"pinch","version":72},{"n":731,"text":"\t\tjson: { ask },","atom":"a660","author":"pinch","version":72},{"n":732,"text":"\t};","atom":"a660","author":"pinch","version":72},{"n":733,"text":"}","atom":"a660","author":"pinch","version":72},{"n":734,"text":"","atom":"a660","author":"pinch","version":72},{"n":735,"text":"/** abso reply <ask> \"<words>\" [--question]: add to an ask's thread, as its asker or the one asked. */","atom":"a660","author":"pinch","version":72},{"n":736,"text":"export async function runReply(args: Parsed, env: Env): Promise<Output> {","atom":"a660","author":"pinch","version":72},{"n":737,"text":"\tconst [first, ...words] = args.positionals;","atom":"a660","author":"pinch","version":72},{"n":738,"text":"\tconst id = issueNumber(first, \"the ask number\");","atom":"a660","author":"pinch","version":72},{"n":739,"text":"\tif (words.length === 0)","atom":"a660","author":"pinch","version":72},{"n":740,"text":"\t\tthrow new UsageError(","atom":"a660","author":"pinch","version":72},{"n":741,"text":"\t\t\t`abso reply <ask> \"<words>\" [--question]: adds to an ask's thread, as its asker or the one asked`,","atom":"a660","author":"pinch","version":72},{"n":742,"text":"\t\t);","atom":"a660","author":"pinch","version":72},{"n":743,"text":"\tconst { api, config } = openIssues(env);","atom":"a660","author":"pinch","version":72},{"n":744,"text":"\tconst question = bool(args, \"question\");","atom":"a660","author":"pinch","version":72},{"n":745,"text":"\tconst r = await api.reply(id, { text: words.join(\" \"), ...(question ? { question: true } : {}) });","atom":"a660","author":"pinch","version":72},{"n":746,"text":"\tconst other = r.ask.by === config.agent ? r.ask.of : r.ask.by;","atom":"a660","author":"pinch","version":72},{"n":747,"text":"\tconst turn =","atom":"a660","author":"pinch","version":72},{"n":748,"text":"\t\t!r.ask.answer && r.ask.waitingOn","atom":"a660","author":"pinch","version":72},{"n":749,"text":"\t\t\t? ` It waits on ${r.ask.waitingOn === config.agent ? \"you\" : r.ask.waitingOn}.`","atom":"a660","author":"pinch","version":72},{"n":750,"text":"\t\t\t: \"\";","atom":"a660","author":"pinch","version":72},{"n":751,"text":"\treturn { text: `Replied on ask ${id}. ${other} hears it.${turn}`, json: { ask: r.ask } };","atom":"a660","author":"pinch","version":72},{"n":752,"text":"}","atom":"a660","author":"pinch","version":72},{"n":753,"text":"","atom":"a660","author":"pinch","version":72},{"n":754,"text":"/** abso ask --withdraw <ask> [--note \"why\"]: the asker takes an ask back. It closes like an answer, and the one asked hears it. */","atom":"a79","author":"review","version":16},{"n":755,"text":"async function withdrawAsk(args: Parsed, env: Env, word: string): Promise<Output> {","atom":"a66","author":"infra-split","version":14},{"n":756,"text":"\tconst others = [\"issue\", \"due\", \"blocks\", \"options\", \"attach\"].filter((f) => str(args, f) !== undefined);","atom":"a299","author":"pinch","version":35},{"n":757,"text":"\tif (args.positionals.length > 0 || others.length > 0 || bool(args, \"review\") || bool(args, \"task\"))","atom":"a66","author":"infra-split","version":14},{"n":758,"text":"\t\tthrow new UsageError('abso ask --withdraw <ask> [--note \"why\"] takes nothing else: it takes back an ask you made');","atom":"a79","author":"review","version":16},{"n":759,"text":"\tconst id = issueNumber(word, \"the ask number\");","atom":"a66","author":"infra-split","version":14},{"n":760,"text":"\tconst { api } = openIssues(env);","atom":"a66","author":"infra-split","version":14},{"n":761,"text":"\tconst note = str(args, \"note\");","atom":"a66","author":"infra-split","version":14},{"n":762,"text":"\tconst r = await api.withdraw(id, note !== undefined ? { note } : {});","atom":"a66","author":"infra-split","version":14},{"n":763,"text":"\treturn { text: `Withdrew ask ${id}. ${r.ask.of} hears it, and it no longer waits on them.`, json: { ask: r.ask } };","atom":"a66","author":"infra-split","version":14},{"n":764,"text":"}","atom":"a144","author":"devops","version":20},{"n":765,"text":"","atom":"a144","author":"devops","version":20},{"n":766,"text":"/** One search hit as two lines: the issue, then where it matched and the words around it. */","atom":"a144","author":"devops","version":20},{"n":767,"text":"export function searchLines(h: IssueSearchHit): string[] {","atom":"a144","author":"devops","version":20},{"n":768,"text":"\tconst where = h.meaning ? \"by meaning\" : h.where === \"comment\" ? `in comment ${h.comment}` : `in the ${h.where}`;","atom":"a144","author":"devops","version":20},{"n":769,"text":"\tconst words = h.snippet","atom":"a144","author":"devops","version":20},{"n":770,"text":"\t\t.replace(/[\\u0001\\u0002]/g, \"\")","atom":"a144","author":"devops","version":20},{"n":771,"text":"\t\t.replace(/\\s+/g, \" \")","atom":"a144","author":"devops","version":20},{"n":772,"text":"\t\t.trim();","atom":"a144","author":"devops","version":20},{"n":773,"text":"\treturn [","atom":"a144","author":"devops","version":20},{"n":774,"text":"\t\t`  ${String(h.issue.id).padStart(3)}  ${h.issue.status.padEnd(11)}  ${q(h.issue.title)}`,","atom":"a144","author":"devops","version":20},{"n":775,"text":"\t\t`       ${where}${words && words !== h.issue.title ? `: ${q(words)}` : \"\"}`,","atom":"a144","author":"devops","version":20},{"n":776,"text":"\t];","atom":"a144","author":"devops","version":20},{"n":777,"text":"}","atom":"a144","author":"devops","version":20},{"n":778,"text":"","atom":"a144","author":"devops","version":20},{"n":779,"text":"export async function runSearch(args: Parsed, env: Env): Promise<Output> {","atom":"a144","author":"devops","version":20},{"n":780,"text":"\tconst words = args.positionals.join(\" \").trim();","atom":"a144","author":"devops","version":20},{"n":781,"text":"\tif (words === \"\") throw new UsageError('search needs words: abso search \"<words>\" [--limit <N>]');","atom":"a144","author":"devops","version":20},{"n":782,"text":"\tconst limitWord = str(args, \"limit\");","atom":"a144","author":"devops","version":20},{"n":783,"text":"\tconst limit = limitWord === undefined ? undefined : Number(limitWord);","atom":"a144","author":"devops","version":20},{"n":784,"text":"\tif (limit !== undefined && !(Number.isInteger(limit) && limit >= 1 && limit <= 50))","atom":"a144","author":"devops","version":20},{"n":785,"text":"\t\tthrow new UsageError(\"--limit is a number from 1 to 50\");","atom":"a144","author":"devops","version":20},{"n":786,"text":"\tconst { api } = openIssues(env);","atom":"a144","author":"devops","version":20},{"n":787,"text":"\tconst { hits } = await api.issueSearch(words, limit);","atom":"a144","author":"devops","version":20},{"n":788,"text":"\treturn {","atom":"a144","author":"devops","version":20},{"n":789,"text":"\t\ttext:","atom":"a144","author":"devops","version":20},{"n":790,"text":"\t\t\thits.length === 0","atom":"a144","author":"devops","version":20},{"n":791,"text":"\t\t\t\t? `Nothing matches ${q(words)}.`","atom":"a144","author":"devops","version":20},{"n":792,"text":"\t\t\t\t: [","atom":"a144","author":"devops","version":20},{"n":793,"text":"\t\t\t\t\t\t`${plural(hits.length, \"issue\")} for ${q(words)}, best first:`,","atom":"a144","author":"devops","version":20},{"n":794,"text":"\t\t\t\t\t\t...hits.flatMap(searchLines),","atom":"a144","author":"devops","version":20},{"n":795,"text":"\t\t\t\t\t\t\"abso issue <N> shows one.\",","atom":"a144","author":"devops","version":20},{"n":796,"text":"\t\t\t\t\t].join(\"\\n\"),","atom":"a144","author":"devops","version":20},{"n":797,"text":"\t\tjson: { hits },","atom":"a144","author":"devops","version":20},{"n":798,"text":"\t};","atom":"a144","author":"devops","version":20},{"n":799,"text":"}","atom":"a66","author":"infra-split","version":14},{"n":800,"text":"","atom":"a66","author":"infra-split","version":14},{"n":801,"text":"export async function runWaiting(args: Parsed, env: Env): Promise<Output> {","atom":"a0","author":"init","version":0},{"n":802,"text":"\tif (args.positionals.length > 0)","atom":"a0","author":"init","version":0},{"n":803,"text":"\t\tthrow new UsageError(\"waiting takes no words: abso waiting [--of <agent or person:id>] [--mine] [--asked]\");","atom":"a660","author":"pinch","version":72},{"n":804,"text":"\tif (bool(args, \"asked\")) return askedOf(args, env);","atom":"a660","author":"pinch","version":72},{"n":805,"text":"\tconst { api, config } = openIssues(env);","atom":"a0","author":"init","version":0},{"n":806,"text":"\tconst mine = bool(args, \"mine\") || str(args, \"of\") === config.agent;","atom":"a0","author":"init","version":0},{"n":807,"text":"\tconst of = mine ? config.agent : str(args, \"of\");","atom":"a0","author":"init","version":0},{"n":808,"text":"\t// With --mine, your own publishes still in the merge queue are open work too. A server without a queue,","atom":"a305","author":"pinch","version":36},{"n":809,"text":"\t// or one that can't be read now, leaves them out rather than failing the asks.","atom":"a305","author":"pinch","version":36},{"n":810,"text":"\tconst [{ asks }, queue] = await Promise.all([","atom":"a305","author":"pinch","version":36},{"n":811,"text":"\t\tmine ? api.waitingMine() : api.waiting(of),","atom":"a305","author":"pinch","version":36},{"n":812,"text":"\t\tmine ? api.queueState().catch(() => undefined) : undefined,","atom":"a305","author":"pinch","version":36},{"n":813,"text":"\t]);","atom":"a305","author":"pinch","version":36},{"n":814,"text":"\tconst queued = queuedLines(queue, config.agent);","atom":"a305","author":"pinch","version":36},{"n":815,"text":"\tconst yours = (queue?.items ?? []).filter((q) => q.agent === config.agent);","atom":"a305","author":"pinch","version":36},{"n":816,"text":"\treturn {","atom":"a0","author":"init","version":0},{"n":817,"text":"\t\ttext: [","atom":"a305","author":"pinch","version":36},{"n":818,"text":"\t\t\t...queued,","atom":"a305","author":"pinch","version":36},{"n":819,"text":"\t\t\t...(asks.length === 0","atom":"a305","author":"pinch","version":36},{"n":820,"text":"\t\t\t\t? [queued.length > 0 ? `No open asks of ${of}.` : `Nothing is waiting${of ? ` on ${of}` : \"\"}.`]","atom":"a305","author":"pinch","version":36},{"n":821,"text":"\t\t\t\t: [","atom":"a0","author":"init","version":0},{"n":822,"text":"\t\t\t\t\t\t`${plural(asks.length, \"open ask\")}${of ? ` of ${of}` : \"\"}, soonest due first:`,","atom":"a0","author":"init","version":0},{"n":823,"text":"\t\t\t\t\t\t...asks.map((a) => askLine(a, api)),","atom":"a299","author":"pinch","version":35},{"n":824,"text":"\t\t\t\t\t\t'abso ask <N> shows one with its thread; abso reply <N> \"...\" adds to it; abso answer <N> \"...\" answers one asked of you.',","atom":"a660","author":"pinch","version":72},{"n":825,"text":"\t\t\t\t\t]),","atom":"a305","author":"pinch","version":36},{"n":826,"text":"\t\t].join(\"\\n\"),","atom":"a305","author":"pinch","version":36},{"n":827,"text":"\t\tjson: {","atom":"a305","author":"pinch","version":36},{"n":828,"text":"\t\t\tasks,","atom":"a305","author":"pinch","version":36},{"n":829,"text":"\t\t\t...(yours.length > 0","atom":"a305","author":"pinch","version":36},{"n":830,"text":"\t\t\t\t? { queued: yours.map((q) => ({ id: q.id, message: q.message, standing: standing(queue!.items, q.id) })) }","atom":"a305","author":"pinch","version":36},{"n":831,"text":"\t\t\t\t: {}),","atom":"a305","author":"pinch","version":36},{"n":832,"text":"\t\t},","atom":"a305","author":"pinch","version":36},{"n":833,"text":"\t};","atom":"a660","author":"pinch","version":72},{"n":834,"text":"}","atom":"a660","author":"pinch","version":72},{"n":835,"text":"","atom":"a660","author":"pinch","version":72},{"n":836,"text":"/** abso waiting --asked: the asks you sent, open ones first, then the latest answered, each with its newest reply. */","atom":"a660","author":"pinch","version":72},{"n":837,"text":"async function askedOf(args: Parsed, env: Env): Promise<Output> {","atom":"a660","author":"pinch","version":72},{"n":838,"text":"\tif (bool(args, \"mine\") || str(args, \"of\") !== undefined)","atom":"a660","author":"pinch","version":72},{"n":839,"text":"\t\tthrow new UsageError(\"--asked lists the asks you sent; it takes no --mine or --of\");","atom":"a660","author":"pinch","version":72},{"n":840,"text":"\tconst { api, config } = openIssues(env);","atom":"a660","author":"pinch","version":72},{"n":841,"text":"\tconst { asks } = await api.asked();","atom":"a660","author":"pinch","version":72},{"n":842,"text":"\tconst open = asks.filter((a) => !a.answer);","atom":"a660","author":"pinch","version":72},{"n":843,"text":"\tconst closed = asks.filter((a) => a.answer);","atom":"a660","author":"pinch","version":72},{"n":844,"text":"\treturn {","atom":"a660","author":"pinch","version":72},{"n":845,"text":"\t\ttext: [","atom":"a660","author":"pinch","version":72},{"n":846,"text":"\t\t\t...(asks.length === 0","atom":"a660","author":"pinch","version":72},{"n":847,"text":"\t\t\t\t? [`${config.agent} hasn't asked anything yet.`]","atom":"a660","author":"pinch","version":72},{"n":848,"text":"\t\t\t\t: [","atom":"a660","author":"pinch","version":72},{"n":849,"text":"\t\t\t\t\t\t...(open.length > 0","atom":"a660","author":"pinch","version":72},{"n":850,"text":"\t\t\t\t\t\t\t? [`${plural(open.length, \"open ask\")} you sent:`, ...open.map((a) => askLine(a, api))]","atom":"a660","author":"pinch","version":72},{"n":851,"text":"\t\t\t\t\t\t\t: []),","atom":"a660","author":"pinch","version":72},{"n":852,"text":"\t\t\t\t\t\t...(closed.length > 0","atom":"a660","author":"pinch","version":72},{"n":853,"text":"\t\t\t\t\t\t\t? [","atom":"a660","author":"pinch","version":72},{"n":854,"text":"\t\t\t\t\t\t\t\t\t`${closed.length === 1 ? \"The latest answered\" : `The latest ${closed.length} answered`}:`,","atom":"a660","author":"pinch","version":72},{"n":855,"text":"\t\t\t\t\t\t\t\t\t...closed.map((a) => askLine(a, api)),","atom":"a660","author":"pinch","version":72},{"n":856,"text":"\t\t\t\t\t\t\t\t]","atom":"a660","author":"pinch","version":72},{"n":857,"text":"\t\t\t\t\t\t\t: []),","atom":"a660","author":"pinch","version":72},{"n":858,"text":"\t\t\t\t\t\t\"abso ask <N> shows one with its whole thread.\",","atom":"a660","author":"pinch","version":72},{"n":859,"text":"\t\t\t\t\t]),","atom":"a660","author":"pinch","version":72},{"n":860,"text":"\t\t].join(\"\\n\"),","atom":"a660","author":"pinch","version":72},{"n":861,"text":"\t\tjson: { asks },","atom":"a660","author":"pinch","version":72},{"n":862,"text":"\t};","atom":"a481","author":"pinch","version":53},{"n":863,"text":"}","atom":"a481","author":"pinch","version":53},{"n":864,"text":"","atom":"a481","author":"pinch","version":53},{"n":865,"text":"/** abso ack <ask> [\"note\"]: tell the asker you have it, and answer later. The ask stays open until abso answer. */","atom":"a481","author":"pinch","version":53},{"n":866,"text":"export async function runAck(args: Parsed, env: Env): Promise<Output> {","atom":"a481","author":"pinch","version":53},{"n":867,"text":"\tconst [first, ...words] = args.positionals;","atom":"a481","author":"pinch","version":53},{"n":868,"text":"\tconst id = issueNumber(first, \"the ask number\");","atom":"a481","author":"pinch","version":53},{"n":869,"text":"\tconst { api } = openIssues(env);","atom":"a481","author":"pinch","version":53},{"n":870,"text":"\tconst note = words.join(\" \");","atom":"a481","author":"pinch","version":53},{"n":871,"text":"\tconst r = await api.ack(id, note !== \"\" ? { note } : {});","atom":"a481","author":"pinch","version":53},{"n":872,"text":"\treturn {","atom":"a481","author":"pinch","version":53},{"n":873,"text":"\t\ttext: `Acknowledged ask ${id}. ${r.ask.by} hears it; abso reply ${id} \"...\" adds more as you go, and the ask stays open until abso answer ${id} \"...\".`,","atom":"a660","author":"pinch","version":72},{"n":874,"text":"\t\tjson: { ask: r.ask },","atom":"a481","author":"pinch","version":53},{"n":875,"text":"\t};","atom":"a0","author":"init","version":0},{"n":876,"text":"}","atom":"a0","author":"init","version":0},{"n":877,"text":"","atom":"a0","author":"init","version":0},{"n":878,"text":"export async function runAnswer(args: Parsed, env: Env): Promise<Output> {","atom":"a0","author":"init","version":0},{"n":879,"text":"\tconst [first, ...words] = args.positionals;","atom":"a0","author":"init","version":0},{"n":880,"text":"\tconst id = issueNumber(first, \"the ask number\");","atom":"a0","author":"init","version":0},{"n":881,"text":"\tconst option = str(args, \"option\");","atom":"a0","author":"init","version":0},{"n":882,"text":"\tconst done = bool(args, \"done\");","atom":"a0","author":"init","version":0},{"n":883,"text":"\tif (words.length === 0 && option === undefined && !done)","atom":"a0","author":"init","version":0},{"n":884,"text":"\t\tthrow new UsageError('abso answer <ask> \"<words>\" | --option <N> [--note \"...\"] | --done [--note \"...\"]');","atom":"a79","author":"review","version":16},{"n":885,"text":"\tconst { api } = openIssues(env);","atom":"a0","author":"init","version":0},{"n":886,"text":"\tconst note = str(args, \"note\");","atom":"a0","author":"init","version":0},{"n":887,"text":"\tconst attachments = await uploadAttachments(api, env.cwd, str(args, \"attach\"));","atom":"a299","author":"pinch","version":35},{"n":888,"text":"\tconst r = await api.answer(id, {","atom":"a0","author":"init","version":0},{"n":889,"text":"\t\t...(words.length > 0 ? { words: words.join(\" \") } : {}),","atom":"a0","author":"init","version":0},{"n":890,"text":"\t\t...(option !== undefined ? { option: /^\\d+$/.test(option) ? Number(option) - 1 : option } : {}),","atom":"a0","author":"init","version":0},{"n":891,"text":"\t\t...(done ? { done: true } : {}),","atom":"a0","author":"init","version":0},{"n":892,"text":"\t\t...(note !== undefined ? { note } : {}),","atom":"a0","author":"init","version":0},{"n":893,"text":"\t\t...(attachments.length > 0 ? { attachments } : {}),","atom":"a299","author":"pinch","version":35},{"n":894,"text":"\t});","atom":"a0","author":"init","version":0},{"n":895,"text":"\tconst lost = notKept(","atom":"a299","author":"pinch","version":35},{"n":896,"text":"\t\tattachments,","atom":"a299","author":"pinch","version":35},{"n":897,"text":"\t\tr.ask.answer?.attachments?.map((a) => a.id),","atom":"a299","author":"pinch","version":35},{"n":898,"text":"\t\t`your answer to ask ${id}`,","atom":"a299","author":"pinch","version":35},{"n":899,"text":"\t);","atom":"a299","author":"pinch","version":35},{"n":900,"text":"\treturn {","atom":"a299","author":"pinch","version":35},{"n":901,"text":"\t\ttext: `Answered ask ${id}${withFiles(attachments)}. ${r.ask.by} hears it.${lost ? ` ${lost}` : \"\"}`,","atom":"a299","author":"pinch","version":35},{"n":902,"text":"\t\tjson: { ask: r.ask, ...(lost ? { notKept: lost } : {}) },","atom":"a299","author":"pinch","version":35},{"n":903,"text":"\t};","atom":"a299","author":"pinch","version":35},{"n":904,"text":"}","atom":"a808","author":"pinch","version":96},{"n":905,"text":"","atom":"a808","author":"pinch","version":96},{"n":906,"text":"/** What the Issues Worker takes in one comment (its LIMITS.text). */","atom":"a808","author":"pinch","version":96},{"n":907,"text":"export const COMMENT_MAX = 4000;","atom":"a808","author":"pinch","version":96},{"n":908,"text":"","atom":"a808","author":"pinch","version":96},{"n":909,"text":"/** Room a part keeps for its \"(i/n)\" line and blank line, and for closing a code block it ends inside. */","atom":"a808","author":"pinch","version":96},{"n":910,"text":"const PART_MARK = 12;","atom":"a808","author":"pinch","version":96},{"n":911,"text":"const FENCE_CLOSE = 5;","atom":"a808","author":"pinch","version":96},{"n":912,"text":"","atom":"a808","author":"pinch","version":96},{"n":913,"text":"/**","atom":"a808","author":"pinch","version":96},{"n":914,"text":" * A comment too long for one, as parts that each fit, each starting with \"(i/n)\". A part ends at the last","atom":"a808","author":"pinch","version":96},{"n":915,"text":" * paragraph break that fits, else the last line break, else the last space, else at the limit. A part that","atom":"a808","author":"pinch","version":96},{"n":916,"text":" * would end inside a fenced code block closes it, and the next part opens it again with the same fence line.","atom":"a808","author":"pinch","version":96},{"n":917,"text":" */","atom":"a808","author":"pinch","version":96},{"n":918,"text":"export function commentParts(text: string, max = COMMENT_MAX): string[] {","atom":"a808","author":"pinch","version":96},{"n":919,"text":"\tif (text.length <= max) return [text];","atom":"a808","author":"pinch","version":96},{"n":920,"text":"\tconst bodies: string[] = [];","atom":"a808","author":"pinch","version":96},{"n":921,"text":"\tlet rest = text;","atom":"a808","author":"pinch","version":96},{"n":922,"text":"\tlet reopen = \"\";","atom":"a808","author":"pinch","version":96},{"n":923,"text":"\twhile (rest !== \"\") {","atom":"a808","author":"pinch","version":96},{"n":924,"text":"\t\tconst room = max - PART_MARK - FENCE_CLOSE - reopen.length;","atom":"a808","author":"pinch","version":96},{"n":925,"text":"\t\tlet body: string;","atom":"a808","author":"pinch","version":96},{"n":926,"text":"\t\tif (reopen.length + rest.length <= max - PART_MARK) {","atom":"a808","author":"pinch","version":96},{"n":927,"text":"\t\t\tbody = rest;","atom":"a808","author":"pinch","version":96},{"n":928,"text":"\t\t\trest = \"\";","atom":"a808","author":"pinch","version":96},{"n":929,"text":"\t\t} else {","atom":"a808","author":"pinch","version":96},{"n":930,"text":"\t\t\tconst cut = cutAt(rest, room);","atom":"a808","author":"pinch","version":96},{"n":931,"text":"\t\t\tbody = rest.slice(0, cut).trimEnd();","atom":"a808","author":"pinch","version":96},{"n":932,"text":"\t\t\t// A space cut at goes with neither part; the line breaks between paragraphs go too.","atom":"a808","author":"pinch","version":96},{"n":933,"text":"\t\t\trest = rest.slice(rest[cut] === \" \" ? cut + 1 : cut).replace(/^\\n+/, \"\");","atom":"a808","author":"pinch","version":96},{"n":934,"text":"\t\t\tif (rest.trim() === \"\") rest = \"\";","atom":"a808","author":"pinch","version":96},{"n":935,"text":"\t\t}","atom":"a808","author":"pinch","version":96},{"n":936,"text":"\t\tlet part = reopen + body;","atom":"a808","author":"pinch","version":96},{"n":937,"text":"\t\tconst fence = openFence(part);","atom":"a808","author":"pinch","version":96},{"n":938,"text":"\t\tif (fence && rest !== \"\") {","atom":"a808","author":"pinch","version":96},{"n":939,"text":"\t\t\tpart += `\\n${fence.marker}`;","atom":"a808","author":"pinch","version":96},{"n":940,"text":"\t\t\treopen = `${fence.line}\\n`;","atom":"a808","author":"pinch","version":96},{"n":941,"text":"\t\t} else reopen = \"\";","atom":"a808","author":"pinch","version":96},{"n":942,"text":"\t\tbodies.push(part);","atom":"a808","author":"pinch","version":96},{"n":943,"text":"\t}","atom":"a808","author":"pinch","version":96},{"n":944,"text":"\treturn bodies.map((b, i) => `(${i + 1}/${bodies.length})\\n\\n${b}`);","atom":"a808","author":"pinch","version":96},{"n":945,"text":"}","atom":"a808","author":"pinch","version":96},{"n":946,"text":"","atom":"a808","author":"pinch","version":96},{"n":947,"text":"/** Where to end a part of at most `room` characters of `text`: a paragraph break, a line break, a space, or the limit. */","atom":"a808","author":"pinch","version":96},{"n":948,"text":"function cutAt(text: string, room: number): number {","atom":"a808","author":"pinch","version":96},{"n":949,"text":"\tconst head = text.slice(0, room);","atom":"a808","author":"pinch","version":96},{"n":950,"text":"\tconst floor = room / 4;","atom":"a808","author":"pinch","version":96},{"n":951,"text":"\tfor (const at of [head.lastIndexOf(\"\\n\\n\"), head.lastIndexOf(\"\\n\"), head.lastIndexOf(\" \")]) if (at > floor) return at;","atom":"a808","author":"pinch","version":96},{"n":952,"text":"\t// Not between the two halves of a character outside the Basic Multilingual Plane.","atom":"a808","author":"pinch","version":96},{"n":953,"text":"\tconst code = text.charCodeAt(room - 1);","atom":"a808","author":"pinch","version":96},{"n":954,"text":"\treturn code >= 0xd800 && code <= 0xdbff ? room - 1 : room;","atom":"a808","author":"pinch","version":96},{"n":955,"text":"}","atom":"a808","author":"pinch","version":96},{"n":956,"text":"","atom":"a808","author":"pinch","version":96},{"n":957,"text":"/** The fence line of a code block still open at the end of `text`, and the marker that closes it, or undefined. */","atom":"a808","author":"pinch","version":96},{"n":958,"text":"function openFence(text: string): { line: string; marker: string } | undefined {","atom":"a808","author":"pinch","version":96},{"n":959,"text":"\tlet open: { line: string; marker: string } | undefined;","atom":"a808","author":"pinch","version":96},{"n":960,"text":"\tfor (const line of text.split(\"\\n\")) {","atom":"a808","author":"pinch","version":96},{"n":961,"text":"\t\tconst m = /^\\s*(`{3,}|~{3,})/.exec(line);","atom":"a808","author":"pinch","version":96},{"n":962,"text":"\t\tif (!m) continue;","atom":"a808","author":"pinch","version":96},{"n":963,"text":"\t\tif (!open) open = { line, marker: m[1]! };","atom":"a808","author":"pinch","version":96},{"n":964,"text":"\t\telse if (m[1]!.startsWith(open.marker) && line.trim() === m[1]) open = undefined;","atom":"a808","author":"pinch","version":96},{"n":965,"text":"\t}","atom":"a808","author":"pinch","version":96},{"n":966,"text":"\treturn open;","atom":"a808","author":"pinch","version":96},{"n":967,"text":"}","atom":"a0","author":"init","version":0}],"atoms":[{"atom":"a0","author":"init","message":"Start the project","time":1791506895507,"timeIso":"2026-10-09T00:48:15.507Z","publish":{"draft":null,"version":0,"agent":"init","message":"Start the project","time":1791506895507,"timeIso":"2026-10-09T00:48:15.507Z"}},{"atom":"a26","author":"pinch","message":"","time":1791510162333,"timeIso":"2026-10-09T01:42:42.333Z","publish":{"draft":null,"version":5,"agent":"pinch","message":"abso issue new and abso issue N --comment take --attach <file,file> (abso issue 171). Each file goes up to the Issues Worker first (POST /p/:project/a/:agent/attachments, the bytes as the body and the name URI-encoded in X-Avcs-Name), and the write carries the ids the uploads answered. Nothing is sent if a file is missing or over 10 MB. --attach anywhere else is refused. The issue's page lists each attachment under the issue or comment carrying it: id, name, size and its link. The wire types gain Attachment and attachments?. MCP's issue tool takes attach too, since its parameters come from the flags. The server side is abso 621 (off until Cloud binds the bucket). Tests: client/test/attach.test.ts, against a stand-in Issues server. Checked: biome ci, npm run check (698 pass).","time":1791510167765,"timeIso":"2026-10-09T01:42:47.765Z"}},{"atom":"a63","author":"infra-split","message":"","time":1791514747191,"timeIso":"2026-10-09T02:59:07.191Z","publish":{"draft":null,"version":14,"agent":"infra-split","message":"An asker can take back an ask: abso ask --withdraw <ask> [--note \"why\"]\n\nAn ask that later decisions have overtaken used to sit in the asked person's waiting list for good. Only they could answer it, and \"none of these\" wasn't an option. Now the one who asked can withdraw it.\n\n- `abso ask --withdraw <ask> [--note \"why\"]` sends one call to the server's withdraw route. It's refused before any call when mixed with a question or the other ask flags. `--note-file` reads the note from a file or stdin, like every text flag.\n- A withdrawn ask closes the way an answered one does: it leaves the waiting list, and it stops holding its issue at Blocked. The ask keeps its question. The asker's note is kept as why, and the one asked hears it.\n- Ask gains `outcome?: \"withdrawn\"`. Older servers leave it out. The asks list and an issue's page show \"withdrawn by <asker>\" and the note, instead of \"answered by\".\n- The server side of the route comes with the hosted Issues service. Until it's there, the call answers with that server's error.\n\nTests: the new usage mistakes, and the single POST to the asker's own route. Checked: npx biome ci . and npm run check exit 0 (704 pass, 1 skipped).","time":1791514878707,"timeIso":"2026-10-09T03:01:18.707Z"}},{"atom":"a64","author":"infra-split","message":"","time":1791514747358,"timeIso":"2026-10-09T02:59:07.358Z","publish":{"draft":null,"version":14,"agent":"infra-split","message":"An asker can take back an ask: abso ask --withdraw <ask> [--note \"why\"]\n\nAn ask that later decisions have overtaken used to sit in the asked person's waiting list for good. Only they could answer it, and \"none of these\" wasn't an option. Now the one who asked can withdraw it.\n\n- `abso ask --withdraw <ask> [--note \"why\"]` sends one call to the server's withdraw route. It's refused before any call when mixed with a question or the other ask flags. `--note-file` reads the note from a file or stdin, like every text flag.\n- A withdrawn ask closes the way an answered one does: it leaves the waiting list, and it stops holding its issue at Blocked. The ask keeps its question. The asker's note is kept as why, and the one asked hears it.\n- Ask gains `outcome?: \"withdrawn\"`. Older servers leave it out. The asks list and an issue's page show \"withdrawn by <asker>\" and the note, instead of \"answered by\".\n- The server side of the route comes with the hosted Issues service. Until it's there, the call answers with that server's error.\n\nTests: the new usage mistakes, and the single POST to the asker's own route. Checked: npx biome ci . and npm run check exit 0 (704 pass, 1 skipped).","time":1791514878707,"timeIso":"2026-10-09T03:01:18.707Z"}},{"atom":"a65","author":"infra-split","message":"","time":1791514758506,"timeIso":"2026-10-09T02:59:18.506Z","publish":{"draft":null,"version":14,"agent":"infra-split","message":"An asker can take back an ask: abso ask --withdraw <ask> [--note \"why\"]\n\nAn ask that later decisions have overtaken used to sit in the asked person's waiting list for good. Only they could answer it, and \"none of these\" wasn't an option. Now the one who asked can withdraw it.\n\n- `abso ask --withdraw <ask> [--note \"why\"]` sends one call to the server's withdraw route. It's refused before any call when mixed with a question or the other ask flags. `--note-file` reads the note from a file or stdin, like every text flag.\n- A withdrawn ask closes the way an answered one does: it leaves the waiting list, and it stops holding its issue at Blocked. The ask keeps its question. The asker's note is kept as why, and the one asked hears it.\n- Ask gains `outcome?: \"withdrawn\"`. Older servers leave it out. The asks list and an issue's page show \"withdrawn by <asker>\" and the note, instead of \"answered by\".\n- The server side of the route comes with the hosted Issues service. Until it's there, the call answers with that server's error.\n\nTests: the new usage mistakes, and the single POST to the asker's own route. Checked: npx biome ci . and npm run check exit 0 (704 pass, 1 skipped).","time":1791514878707,"timeIso":"2026-10-09T03:01:18.707Z"}},{"atom":"a66","author":"infra-split","message":"","time":1791514758645,"timeIso":"2026-10-09T02:59:18.645Z","publish":{"draft":null,"version":14,"agent":"infra-split","message":"An asker can take back an ask: abso ask --withdraw <ask> [--note \"why\"]\n\nAn ask that later decisions have overtaken used to sit in the asked person's waiting list for good. Only they could answer it, and \"none of these\" wasn't an option. Now the one who asked can withdraw it.\n\n- `abso ask --withdraw <ask> [--note \"why\"]` sends one call to the server's withdraw route. It's refused before any call when mixed with a question or the other ask flags. `--note-file` reads the note from a file or stdin, like every text flag.\n- A withdrawn ask closes the way an answered one does: it leaves the waiting list, and it stops holding its issue at Blocked. The ask keeps its question. The asker's note is kept as why, and the one asked hears it.\n- Ask gains `outcome?: \"withdrawn\"`. Older servers leave it out. The asks list and an issue's page show \"withdrawn by <asker>\" and the note, instead of \"answered by\".\n- The server side of the route comes with the hosted Issues service. Until it's there, the call answers with that server's error.\n\nTests: the new usage mistakes, and the single POST to the asker's own route. Checked: npx biome ci . and npm run check exit 0 (704 pass, 1 skipped).","time":1791514878707,"timeIso":"2026-10-09T03:01:18.707Z"}},{"atom":"a70","author":"infra-split","message":"","time":1791514805580,"timeIso":"2026-10-09T03:00:05.580Z","publish":{"draft":null,"version":14,"agent":"infra-split","message":"An asker can take back an ask: abso ask --withdraw <ask> [--note \"why\"]\n\nAn ask that later decisions have overtaken used to sit in the asked person's waiting list for good. Only they could answer it, and \"none of these\" wasn't an option. Now the one who asked can withdraw it.\n\n- `abso ask --withdraw <ask> [--note \"why\"]` sends one call to the server's withdraw route. It's refused before any call when mixed with a question or the other ask flags. `--note-file` reads the note from a file or stdin, like every text flag.\n- A withdrawn ask closes the way an answered one does: it leaves the waiting list, and it stops holding its issue at Blocked. The ask keeps its question. The asker's note is kept as why, and the one asked hears it.\n- Ask gains `outcome?: \"withdrawn\"`. Older servers leave it out. The asks list and an issue's page show \"withdrawn by <asker>\" and the note, instead of \"answered by\".\n- The server side of the route comes with the hosted Issues service. Until it's there, the call answers with that server's error.\n\nTests: the new usage mistakes, and the single POST to the asker's own route. Checked: npx biome ci . and npm run check exit 0 (704 pass, 1 skipped).","time":1791514878707,"timeIso":"2026-10-09T03:01:18.707Z"}},{"atom":"a79","author":"review","message":"","time":1791520995119,"timeIso":"2026-10-09T04:43:15.119Z","publish":{"draft":null,"version":16,"agent":"review","message":"The client says abso, not avcs, in everything a person reads: the hints after an issue view and abso issue new, the help for issue, issues, ask, answer and waiting, the 'abso:' prefix on notices from run, publish --check, the queue and serve, the 'News from abso' header, the MCP server's name and the claude mcp add example, and the view mod's status line. Only printed words changed: file and folder names (avcs.json, .avcs/, ~/.avcs/token), environment variables and wire headers are as they were, and the tests were updated to the new words (704 pass, biome ci clean).","time":1791521002669,"timeIso":"2026-10-09T04:43:22.669Z"}},{"atom":"a144","author":"devops","message":"","time":1791528389952,"timeIso":"2026-10-09T06:46:29.952Z","publish":{"draft":null,"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"}},{"atom":"a164","author":"pinch","message":"","time":1791529997817,"timeIso":"2026-10-09T07:13:17.817Z","publish":{"draft":null,"version":23,"agent":"pinch","message":"abso issue <N> --copy-to <project>: copy an issue into another project, with its comments, answered asks and labels, each keeping its author and time. The Issues server reads the source issue itself; the client sends only which issue, and any cleaned texts.\n\n- --dry-run shows what the copy would make (title, how many comments and asks, which were edited, labels) and what's left behind. It writes nothing.\n- --clean <file> gives cleaned texts by source id, as JSON: {title, description, comments: [{id, text}], asks: [{id, question, answer}]}. A comment left out of a given list isn't copied.\n- --copy-to goes alone, so a copy is never half an edit. Copying into the project the issue is already in is refused before any call.\n- When a live server refuses the copy (copying out of a project there takes an owner of it), the message says --dry-run still works.\n- The MCP issue tool's clean input is a file too, so it's confined to the server's start folder like attach.\n\nTests: client/test/issues.test.ts, against a stand-in Issues server. The run --parallel test that sometimes times out under a full run passed when rerun.","time":1791530025571,"timeIso":"2026-10-09T07:13:45.571Z"}},{"atom":"a169","author":"pinch","message":"","time":1791530824018,"timeIso":"2026-10-09T07:27:04.018Z","publish":{"draft":null,"version":24,"agent":"pinch","message":"abso issue N lists an SVG attachment's own file. A server that takes SVG attachments draws each one as a PNG, and keeps the SVG only as a download. The issue page now shows that download under the image: 'drawn from \"logo.svg\", 512 B, <link>/source'. The --attach help says svg is taken, up to 1 MB, on servers that take it.","time":1791530831111,"timeIso":"2026-10-09T07:27:11.111Z"}},{"atom":"a208","author":"review","message":"","time":1791533506483,"timeIso":"2026-10-09T08:11:46.483Z","publish":{"draft":null,"version":27,"agent":"review","message":"Client: ABSO_ environment names (AVCS_ still read), .absoignore (.avcsignore still read), .abso-export.json, shot files; READMEs say abso (abso 224)","time":1791533840174,"timeIso":"2026-10-09T08:17:20.174Z"}},{"atom":"a224","author":"pinch","message":"","time":1791537923991,"timeIso":"2026-10-09T09:25:23.991Z","publish":{"draft":null,"version":29,"agent":"pinch","message":"Client: abso issue N --save-attachments <dir> saves each attachment on an issue and its comments once (an SVG's own file beside its drawing), outside the abso folder unless the place is ignored; MCP confines the folder like attach. abso export now stamps its folder with .abso-export, one line of JSON in a file with no extension, so the exported project's own formatter and linter pass it by; a folder stamped .abso-export.json or .avcs-export.json still counts as an export.","time":1791540340754,"timeIso":"2026-10-09T10:05:40.754Z"}},{"atom":"a225","author":"pinch","message":"","time":1791537991960,"timeIso":"2026-10-09T09:26:31.960Z","publish":{"draft":null,"version":29,"agent":"pinch","message":"Client: abso issue N --save-attachments <dir> saves each attachment on an issue and its comments once (an SVG's own file beside its drawing), outside the abso folder unless the place is ignored; MCP confines the folder like attach. abso export now stamps its folder with .abso-export, one line of JSON in a file with no extension, so the exported project's own formatter and linter pass it by; a folder stamped .abso-export.json or .avcs-export.json still counts as an export.","time":1791540340754,"timeIso":"2026-10-09T10:05:40.754Z"}},{"atom":"a226","author":"pinch","message":"","time":1791537993917,"timeIso":"2026-10-09T09:26:33.917Z","publish":{"draft":null,"version":29,"agent":"pinch","message":"Client: abso issue N --save-attachments <dir> saves each attachment on an issue and its comments once (an SVG's own file beside its drawing), outside the abso folder unless the place is ignored; MCP confines the folder like attach. abso export now stamps its folder with .abso-export, one line of JSON in a file with no extension, so the exported project's own formatter and linter pass it by; a folder stamped .abso-export.json or .avcs-export.json still counts as an export.","time":1791540340754,"timeIso":"2026-10-09T10:05:40.754Z"}},{"atom":"a247","author":"pinch","message":"","time":1791539259589,"timeIso":"2026-10-09T09:47:39.589Z","publish":{"draft":null,"version":29,"agent":"pinch","message":"Client: abso issue N --save-attachments <dir> saves each attachment on an issue and its comments once (an SVG's own file beside its drawing), outside the abso folder unless the place is ignored; MCP confines the folder like attach. abso export now stamps its folder with .abso-export, one line of JSON in a file with no extension, so the exported project's own formatter and linter pass it by; a folder stamped .abso-export.json or .avcs-export.json still counts as an export.","time":1791540340754,"timeIso":"2026-10-09T10:05:40.754Z"}},{"atom":"a299","author":"pinch","message":"","time":1791544558067,"timeIso":"2026-10-09T11:15:58.067Z","publish":{"draft":null,"version":35,"agent":"pinch","message":"Client: files on asks and answers. abso ask and abso answer take --attach (uploaded first, as on issues; not with --withdraw); an ask lists its question's files under it and its answer's under the answer; abso issue N --save-attachments takes them too. An Issues server from before asks carried files keeps the words and drops the files: abso says so (notKept in --json) instead of losing them quietly. Wire: Ask.attachments and answer.attachments, optional. Client tests 286/286, tsc and biome clean.","time":1791544592629,"timeIso":"2026-10-09T11:16:32.629Z"}},{"atom":"a305","author":"pinch","message":"","time":1791545326429,"timeIso":"2026-10-09T11:28:46.429Z","publish":{"draft":null,"version":36,"agent":"pinch","message":"waiting --mine lists your publishes still in the merge queue: where each stands (being checked, or how many wait ahead of it), whether the queue is paused, and that the outcome comes as news; --json carries them as queued. A server without a queue, or one that can't be read, leaves them out rather than failing the asks.","time":1791545326646,"timeIso":"2026-10-09T11:28:46.646Z"}},{"atom":"a314","author":"infra-split","message":"","time":1791546813593,"timeIso":"2026-10-09T11:53:33.593Z","publish":{"draft":null,"version":37,"agent":"infra-split","message":"Comments and test names give each reason in plain words, without naming who raised it\n\nNotes like \"(#37, Builder 5)\" or \"(AVCS - Security)\" become \"(#37)\" or go, and a private commit hash after a name goes with it. Issue numbers and references such as git's CVE-2019-1353 stay. Only comments and test names change; no behavior changes.","time":1791547035956,"timeIso":"2026-10-09T11:57:15.956Z"}},{"atom":"a448","author":"pinch","message":"","time":1791578852460,"timeIso":"2026-10-09T20:47:32.460Z","publish":{"draft":null,"version":47,"agent":"pinch","message":"abso issue: say how to read attached files before their links\n\nAn issue page lists each attachment with a link, but the link opens only for people signed in on the website; an agent that fetched it was refused and didn't know where else to look. When the issue, its comments, or its asks and answers carry files, the page now says so under the title, with the way in: \"3 files are attached below. To read them: abso issue 7 --save-attachments <folder> saves every one there, then open the files. The links are for people signed in on the website.\"\n\nThe abso skill gets the same as a line under \"Issues and asks\", in SKILL.md and in the copy the client carries. Tests in attach.test.ts cover the count across the issue, comments, questions and answers, and a page with no files saying nothing.","time":1791579053258,"timeIso":"2026-10-09T20:50:53.258Z"}},{"atom":"a481","author":"pinch","message":"","time":1791583010910,"timeIso":"2026-10-09T21:56:50.910Z","publish":{"draft":null,"version":53,"agent":"pinch","message":"abso ack <ask> [\"note\"]: the one asked says they have an ask and will answer later. The ask stays open and keeps blocking; abso issue shows it as acknowledged with the note, and the asker hears it. The Ask wire type gains ack, the API client gains ack(), and the skill mentions the command.","time":1791583024285,"timeIso":"2026-10-09T21:57:04.285Z"}},{"atom":"a660","author":"pinch","message":"","time":1791609963115,"timeIso":"2026-10-10T05:26:03.115Z","publish":{"draft":null,"version":72,"agent":"pinch","message":"Asks become threads: abso reply <ask> \"...\" adds to an ask from either side, open or answered, and --question hands the turn to the asker until they reply. abso ask <N> shows one ask with its whole thread and whose turn it is; abso waiting --asked lists the asks you sent. An ack's note is the thread's first reply. reply is an MCP tool too. Needs an Issues server with the reply, ask and asked routes.","time":1791609984916,"timeIso":"2026-10-10T05:26:24.916Z"}},{"atom":"a808","author":"pinch","message":"","time":1791642341455,"timeIso":"2026-10-10T14:25:41.455Z","publish":{"draft":null,"version":96,"agent":"pinch","message":"Issue comments over 4000 characters go up in parts: abso issue N --comment (or --comment-file) splits at paragraph breaks, else line breaks or spaces, marks each part (1/3), (2/3)..., never ends a part inside a code block it doesn't close, and puts attachments on the first part. An objection over the limit is refused before anything is sent. The help names the limit.","time":1791643087412,"timeIso":"2026-10-10T14:38:07.412Z"}},{"atom":"a843","author":"rename","message":"","time":1791659799126,"timeIso":"2026-10-10T19:16:39.126Z","publish":{"draft":null,"version":100,"agent":"rename","message":"abso publish is now abso push, abso sync is now abso pull (abso 427)\n\nCommands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; \"shared\" stays the noun (\"Pushed version N\"). No aliases, no notices. A queued push that was \"pulled\" is now \"turned back\", so pull means one thing.\n\npush -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch.\n\nKept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.","time":1791659833853,"timeIso":"2026-10-10T19:17:13.853Z"}},{"atom":"a1494","author":"trials","message":"","time":1791907494521,"timeIso":"2026-10-13T16:04:54.521Z","publish":{"draft":null,"version":151,"agent":"trials","message":"Open server: issues, asks and news, served at <server>/issues, and the client finds them there when no issues server is named","time":1791907770251,"timeIso":"2026-10-13T16:09:30.251Z"}},{"atom":"a1559","author":"speed","message":"","time":1791913488241,"timeIso":"2026-10-13T17:44:48.241Z","publish":{"draft":null,"version":155,"agent":"speed","message":"Every command that talks to a server now takes --server <url>, parsed and checked in one place (client/src/server-choice.ts). A missing, empty or malformed value is refused before anything is sent. In a joined folder, --server must be the folder's own server: another one is refused rather than swapped in, so a folder's work and key go only to the server it was joined on. Commands that pick their own server (join, init, login, whoami, doctor, box, logout, orgs, org, key) use the named one as given; doctor no longer swaps in the folder's server over an explicit one, and an explicit --server takes issues to that server's own Issues Worker instead of ABSO_ISSUES_SERVER. The five local-only commands refuse --server and say why. Help shows the same --server line for every command of a kind. For abso-core issue 10.","time":1791913490940,"timeIso":"2026-10-13T17:44:50.940Z"}},{"atom":"a2618","author":"groups","message":"","time":1792091357322,"timeIso":"2026-10-15T19:09:17.322Z","publish":{"draft":null,"version":256,"agent":"groups","message":"groups: abso groups and abso group, for a project's named groups of agents and people with one shared history. abso group <name> reads its settings, members and history (newest first; --before, --limit, --kind). --post adds a message, with news for every other member unless --news names some, --except leaves some out, or --news none keeps it in the history only. --join, --leave, --add, --remove, --rename, --private on|off and --joinable on|off change it; abso group new makes one. A retried post never posts twice (the Idempotency-Key every POST sends). Both are MCP tools; a visitor folder refuses them. Tests: client/test/group-commands.test.ts, visitor.test.ts.","time":1792091364906,"timeIso":"2026-10-15T19:09:24.906Z"}},{"atom":"a2879","author":"pinch","message":"","time":1792121459254,"timeIso":"2026-10-16T03:30:59.254Z","publish":{"draft":null,"version":294,"agent":"pinch","message":"Local projects: issues, asks and news. The open server's issues code runs in the client's process as the project's does, over issues.sqlite beside project.sqlite in the store; every call, issues ones too, holds the project file's lock, so local writers take one lock in one order. abso issue, issues, ask, answer, waiting, news and start --issue work with the network off. Attachments and news --stream don't yet.","time":1792121598859,"timeIso":"2026-10-16T03:33:18.859Z"}},{"atom":"a2881","author":"pinch","message":"","time":1792121598473,"timeIso":"2026-10-16T03:33:18.473Z","publish":{"draft":null,"version":294,"agent":"pinch","message":"Local projects: issues, asks and news. The open server's issues code runs in the client's process as the project's does, over issues.sqlite beside project.sqlite in the store; every call, issues ones too, holds the project file's lock, so local writers take one lock in one order. abso issue, issues, ask, answer, waiting, news and start --issue work with the network off. Attachments and news --stream don't yet.","time":1792121598859,"timeIso":"2026-10-16T03:33:18.859Z"}}]}