abso help --json: every command help shows, with its usage, about and flags, as data, so a command reference can be built from the client itself. And the terminal filter drops SGR 8 (conceal), which could hide text, keeping 8 where it's a color (38;5;8). Version 79 of shared· pinch· Oct 10 (2026-10-10 06:27 UTC) · Not checked
Version 78 · Files at version 79
4 files, 127 lines added, 14 removed.
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -5,6 +5,7 @@
5 5 import { resolve } from "node:path"; 6 6 import { runAnnounce, runNews, runStart } from "./announce.ts"; 7 7 import { ApiError } from "./api.ts"; 8 + import { clientVersion } from "./client-version.ts"; 8 9 import { bool, type FlagSpec, type Parsed, parseArgs, str, UsageError } from "./args.ts"; 9 10 import { bodyFilesHelp, readBodyFiles, withBodyFiles } from "./body-files.ts"; 10 11 import { boxPublic, boxText, login, logout, readBox } from "./box.ts"; @@ -790,22 +791,57 @@
793 − function help(): string {
794 + const HELP_INTRO = "abso: version control for agents. This is its command-line client."; 796 + "Every command takes --json. Settings live in .abso/config.json (.avcs/config.json in a folder from before the rename). The token comes from ABSO_TOKEN, or else ~/.abso/token (or ~/.avcs/token from before)."; 798 + /** Every command as help shows it, in order: the table's, then the three it doesn't hold. */ 799 + function helpEntries(): { name: string; usage: string; about: string; flags: FlagSpec }[] { 795 − "abso: version control for agents. This is its command-line client.",
796 − "",
797 − ...Object.values(COMMANDS).flatMap((c) => [` ${c.usage}`, ` ${c.about}`]),
798 − " abso hook",
799 − " The Claude Code PostToolUse hook. Reads the hook JSON on stdin; never fails.",
800 − " abso mcp",
801 − " An MCP server on stdin and stdout: the reading commands and the everyday writing ones as tools, answering with the same text as here. Add it with claude mcp add abso -- abso mcp (on Windows, claude mcp add abso -- cmd /c abso mcp).",
802 − " abso --version",
803 − " This client's version and commit, and the abso mods installed on this machine.",
804 − "",
805 − "Every command takes --json. Settings live in .abso/config.json (.avcs/config.json in a folder from before the rename). The token comes from ABSO_TOKEN, or else ~/.abso/token (or ~/.avcs/token from before).",
806 − ].join("\n");
801 + ...Object.entries(COMMANDS).map(([name, c]) => ({ name, usage: c.usage, about: c.about, flags: c.flags })), 805 + about: "The Claude Code PostToolUse hook. Reads the hook JSON on stdin; never fails.", 812 + "An MCP server on stdin and stdout: the reading commands and the everyday writing ones as tools, answering with the same text as here. Add it with claude mcp add abso -- abso mcp (on Windows, claude mcp add abso -- cmd /c abso mcp).", 817 + usage: "abso --version", 818 + about: "This client's version and commit, and the abso mods installed on this machine.", 824 + function help(): string { 825 + const entries = helpEntries().flatMap((c) => [` ${c.usage}`, ` ${c.about}`]); 826 + return [HELP_INTRO, "", ...entries, "", HELP_NOTE].join("\n"); 830 + * help --json: the same entries as data, for a command reference built from the client itself. A flag is 831 + * "string" (takes a value), "boolean" (stands alone) or "optional" (a value that may be left off); every 832 + * command also takes --json and --help. 834 + function helpJson(): Record<string, unknown> { 838 + version: clientVersion(), 841 + commands: helpEntries(), 809 845 export interface MainResult { 810 846 readonly stdout: string; 811 847 readonly stderr: string; @@ -839,6 +875,10 @@
839 875 const command = argv[0]; 840 876 const json = argv.includes("--json") && command !== "run" && command !== "logs"; 841 877 if (command === undefined || command === "help" || command === "--help" || command === "-h") { 879 + const data = helpJson(); 880 + return { stdout: `${JSON.stringify(data, null, 2)}\n`, stderr: "", exit: EXIT.ok, data }; 842 882 return { stdout: `${help()}\n`, stderr: "", exit: EXIT.ok }; --- a/client/src/terminal-text.ts
+++ b/client/src/terminal-text.ts
@@ -21,6 +21,25 @@
25 + * An SGR sequence without parameter 8 (conceal), which would hide the text after it from the reader. The 8 in an 26 + * extended color (38;5;8, 48;2;8;8;8) is a color, so those are copied whole. Nothing is left when 8 was all it said. 28 + function withoutConceal(sgr: string): string { 29 + const parts = sgr.slice(2, -1).split(";"); 30 + const kept: string[] = []; 31 + for (let i = 0; i < parts.length; i++) { 33 + if ((p === "38" || p === "48" || p === "58") && (parts[i + 1] === "5" || parts[i + 1] === "2")) { 34 + const n = parts[i + 1] === "5" ? 3 : 5; 35 + kept.push(...parts.slice(i, i + n)); 37 + } else if (p !== "8") kept.push(p); 39 + if (kept.length === parts.length) return sgr; 40 + return kept.length === 0 ? "" : `\x1b[${kept.join(";")}m`; 24 43 /** Whether a character code is one the terminal acts on: C0 but tab and newline, DEL, and C1. */ 25 44 const control = (c: number) => (c < 0x20 && c !== 0x09 && c !== 0x0a) || (c >= 0x7f && c <= 0x9f); @@ -38,7 +57,7 @@
39 58 const sgr = sgrAt(text, i); 41 − if (colors) out += text.slice(i, i + sgr);
60 + if (colors) out += withoutConceal(text.slice(i, i + sgr)); 43 62 } else if (c === 0x0d && text.charCodeAt(i + 1) === 0x0a) out += "\r"; 44 63 else out += c < 0x80 ? `\\x${c.toString(16).padStart(2, "0")}` : `\\u${c.toString(16).padStart(4, "0")}`; --- /dev/null
+++ b/client/test/help.test.ts
@@ -0,0 +1,46 @@
1 + // abso help --json: every command help shows, as data, for a command reference built from the client. 3 + import assert from "node:assert/strict"; 4 + import { describe, it } from "node:test"; 5 + import { commandTable, main } from "../src/main.ts"; 13 + commands: { name: string; usage: string; about: string; flags: Record<string, string> }[]; 16 + describe("abso help --json", () => { 17 + it("lists every command help shows, with its usage, about and flags", async () => { 18 + const out = await main(["help", "--json"], { cwd: process.cwd(), env: {}, write: () => {} }); 19 + assert.equal(out.exit, 0); 20 + const data = JSON.parse(out.stdout) as HelpJson; 21 + assert.deepEqual(out.data, data); 22 + assert.equal(data.ok, true); 23 + assert.equal(data.command, "help"); 24 + assert.match(data.version, /\S/); 25 + const names = data.commands.map((c) => c.name); 26 + assert.deepEqual(names, [...Object.keys(commandTable()), "hook", "mcp", "--version"]); 27 + const join = data.commands.find((c) => c.name === "join")!; 28 + assert.equal(join.usage, commandTable().join!.usage); 29 + assert.equal(join.flags.reader, "boolean"); 30 + assert.equal(join.flags.agent, "string"); 31 + for (const c of data.commands) { 32 + assert.match(c.usage, /^abso /, c.name); 33 + assert.ok(c.about.length > 0, c.name); 37 + it("help without --json says the same, as text", async () => { 38 + const text = (await main(["help"], { cwd: process.cwd(), env: {}, write: () => {} })).stdout; 39 + const data = JSON.parse( 40 + (await main(["--help", "--json"], { cwd: process.cwd(), env: {}, write: () => {} })).stdout, 42 + assert.ok(text.startsWith(`${data.intro}\n`)); 43 + assert.ok(text.endsWith(`${data.note}\n`)); 44 + for (const c of data.commands) assert.ok(text.includes(` ${c.usage}\n ${c.about}\n`), c.name); --- a/client/test/terminal-text.test.ts
+++ b/client/test/terminal-text.test.ts
@@ -24,6 +24,14 @@
24 24 assert.equal(terminalText(red, false), "failed and bold"); 27 + it("drops conceal (SGR 8), which would hide text, but keeps 8 as a color", () => { 28 + assert.equal(terminalText(`${ESC}[8mhidden${ESC}[0m`, true), `hidden${ESC}[0m`); 29 + assert.equal(terminalText(`${ESC}[1;8;31mx`, true), `${ESC}[1;31mx`); 30 + assert.equal(terminalText(`${ESC}[38;5;8;48;2;8;8;8mx`, true), `${ESC}[38;5;8;48;2;8;8;8mx`); 31 + assert.equal(terminalText(`${ESC}[38;5;8;8mx`, true), `${ESC}[38;5;8mx`); 32 + assert.equal(terminalText(`${ESC}[mx${ESC}[28m`, true), `${ESC}[mx${ESC}[28m`); 27 35 it("shows OSC 52 (the clipboard) and OSC 8 (links) as text, with or without colors", () => { 28 36 const clip = `${ESC}]52;c;ZWNobyBoaQ==\x07`; 29 37 assert.equal(terminalText(clip, true), "\\x1b]52;c;ZWNobyBoaQ==\\x07");