{"version":79,"agent":"pinch","message":"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).","time":1791613624472,"timeIso":"2026-10-10T06:27:04.472Z","changes":4,"change":889,"files":["client/src/main.ts","client/src/terminal-text.ts","client/test/help.test.ts","client/test/terminal-text.test.ts"],"draft":null,"diff":[{"path":"client/src/main.ts","added":53,"removed":13,"diff":"--- a/client/src/main.ts\n+++ b/client/src/main.ts\n@@ -5,6 +5,7 @@\n import { resolve } from \"node:path\";\n import { runAnnounce, runNews, runStart } from \"./announce.ts\";\n import { ApiError } from \"./api.ts\";\n+import { clientVersion } from \"./client-version.ts\";\n import { bool, type FlagSpec, type Parsed, parseArgs, str, UsageError } from \"./args.ts\";\n import { bodyFilesHelp, readBodyFiles, withBodyFiles } from \"./body-files.ts\";\n import { boxPublic, boxText, login, logout, readBox } from \"./box.ts\";\n@@ -790,22 +791,57 @@\n \t},\n };\n \n-function help(): string {\n+const HELP_INTRO = \"abso: version control for agents. This is its command-line client.\";\n+const HELP_NOTE =\n+\t\"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).\";\n+\n+/** Every command as help shows it, in order: the table's, then the three it doesn't hold. */\n+function helpEntries(): { name: string; usage: string; about: string; flags: FlagSpec }[] {\n \treturn [\n-\t\t\"abso: version control for agents. This is its command-line client.\",\n-\t\t\"\",\n-\t\t...Object.values(COMMANDS).flatMap((c) => [`  ${c.usage}`, `      ${c.about}`]),\n-\t\t\"  abso hook\",\n-\t\t\"      The Claude Code PostToolUse hook. Reads the hook JSON on stdin; never fails.\",\n-\t\t\"  abso mcp\",\n-\t\t\"      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).\",\n-\t\t\"  abso --version\",\n-\t\t\"      This client's version and commit, and the abso mods installed on this machine.\",\n-\t\t\"\",\n-\t\t\"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).\",\n-\t].join(\"\\n\");\n+\t\t...Object.entries(COMMANDS).map(([name, c]) => ({ name, usage: c.usage, about: c.about, flags: c.flags })),\n+\t\t{\n+\t\t\tname: \"hook\",\n+\t\t\tusage: \"abso hook\",\n+\t\t\tabout: \"The Claude Code PostToolUse hook. Reads the hook JSON on stdin; never fails.\",\n+\t\t\tflags: {},\n+\t\t},\n+\t\t{\n+\t\t\tname: \"mcp\",\n+\t\t\tusage: \"abso mcp\",\n+\t\t\tabout:\n+\t\t\t\t\"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).\",\n+\t\t\tflags: {},\n+\t\t},\n+\t\t{\n+\t\t\tname: \"--version\",\n+\t\t\tusage: \"abso --version\",\n+\t\t\tabout: \"This client's version and commit, and the abso mods installed on this machine.\",\n+\t\t\tflags: {},\n+\t\t},\n+\t];\n }\n \n+function help(): string {\n+\tconst entries = helpEntries().flatMap((c) => [`  ${c.usage}`, `      ${c.about}`]);\n+\treturn [HELP_INTRO, \"\", ...entries, \"\", HELP_NOTE].join(\"\\n\");\n+}\n+\n+/**\n+ * help --json: the same entries as data, for a command reference built from the client itself. A flag is\n+ * \"string\" (takes a value), \"boolean\" (stands alone) or \"optional\" (a value that may be left off); every\n+ * command also takes --json and --help.\n+ */\n+function helpJson(): Record<string, unknown> {\n+\treturn {\n+\t\tok: true,\n+\t\tcommand: \"help\",\n+\t\tversion: clientVersion(),\n+\t\tintro: HELP_INTRO,\n+\t\tnote: HELP_NOTE,\n+\t\tcommands: helpEntries(),\n+\t};\n+}\n+\n export interface MainResult {\n \treadonly stdout: string;\n \treadonly stderr: string;\n@@ -839,6 +875,10 @@\n \tconst command = argv[0];\n \tconst json = argv.includes(\"--json\") && command !== \"run\" && command !== \"logs\";\n \tif (command === undefined || command === \"help\" || command === \"--help\" || command === \"-h\") {\n+\t\tif (json) {\n+\t\t\tconst data = helpJson();\n+\t\t\treturn { stdout: `${JSON.stringify(data, null, 2)}\\n`, stderr: \"\", exit: EXIT.ok, data };\n+\t\t}\n \t\treturn { stdout: `${help()}\\n`, stderr: \"\", exit: EXIT.ok };\n \t}\n \ttry {"},{"path":"client/src/terminal-text.ts","added":20,"removed":1,"diff":"--- a/client/src/terminal-text.ts\n+++ b/client/src/terminal-text.ts\n@@ -21,6 +21,25 @@\n \treturn 0;\n }\n \n+/**\n+ * An SGR sequence without parameter 8 (conceal), which would hide the text after it from the reader. The 8 in an\n+ * 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.\n+ */\n+function withoutConceal(sgr: string): string {\n+\tconst parts = sgr.slice(2, -1).split(\";\");\n+\tconst kept: string[] = [];\n+\tfor (let i = 0; i < parts.length; i++) {\n+\t\tconst p = parts[i]!;\n+\t\tif ((p === \"38\" || p === \"48\" || p === \"58\") && (parts[i + 1] === \"5\" || parts[i + 1] === \"2\")) {\n+\t\t\tconst n = parts[i + 1] === \"5\" ? 3 : 5;\n+\t\t\tkept.push(...parts.slice(i, i + n));\n+\t\t\ti += n - 1;\n+\t\t} else if (p !== \"8\") kept.push(p);\n+\t}\n+\tif (kept.length === parts.length) return sgr;\n+\treturn kept.length === 0 ? \"\" : `\\x1b[${kept.join(\";\")}m`;\n+}\n+\n /** Whether a character code is one the terminal acts on: C0 but tab and newline, DEL, and C1. */\n const control = (c: number) => (c < 0x20 && c !== 0x09 && c !== 0x0a) || (c >= 0x7f && c <= 0x9f);\n \n@@ -38,7 +57,7 @@\n \t\t}\n \t\tconst sgr = sgrAt(text, i);\n \t\tif (sgr > 0) {\n-\t\t\tif (colors) out += text.slice(i, i + sgr);\n+\t\t\tif (colors) out += withoutConceal(text.slice(i, i + sgr));\n \t\t\ti += sgr - 1;\n \t\t} else if (c === 0x0d && text.charCodeAt(i + 1) === 0x0a) out += \"\\r\";\n \t\telse out += c < 0x80 ? `\\\\x${c.toString(16).padStart(2, \"0\")}` : `\\\\u${c.toString(16).padStart(4, \"0\")}`;"},{"path":"client/test/help.test.ts","added":46,"removed":0,"diff":"--- /dev/null\n+++ b/client/test/help.test.ts\n@@ -0,0 +1,46 @@\n+// abso help --json: every command help shows, as data, for a command reference built from the client.\n+\n+import assert from \"node:assert/strict\";\n+import { describe, it } from \"node:test\";\n+import { commandTable, main } from \"../src/main.ts\";\n+\n+interface HelpJson {\n+\tok: boolean;\n+\tcommand: string;\n+\tversion: string;\n+\tintro: string;\n+\tnote: string;\n+\tcommands: { name: string; usage: string; about: string; flags: Record<string, string> }[];\n+}\n+\n+describe(\"abso help --json\", () => {\n+\tit(\"lists every command help shows, with its usage, about and flags\", async () => {\n+\t\tconst out = await main([\"help\", \"--json\"], { cwd: process.cwd(), env: {}, write: () => {} });\n+\t\tassert.equal(out.exit, 0);\n+\t\tconst data = JSON.parse(out.stdout) as HelpJson;\n+\t\tassert.deepEqual(out.data, data);\n+\t\tassert.equal(data.ok, true);\n+\t\tassert.equal(data.command, \"help\");\n+\t\tassert.match(data.version, /\\S/);\n+\t\tconst names = data.commands.map((c) => c.name);\n+\t\tassert.deepEqual(names, [...Object.keys(commandTable()), \"hook\", \"mcp\", \"--version\"]);\n+\t\tconst join = data.commands.find((c) => c.name === \"join\")!;\n+\t\tassert.equal(join.usage, commandTable().join!.usage);\n+\t\tassert.equal(join.flags.reader, \"boolean\");\n+\t\tassert.equal(join.flags.agent, \"string\");\n+\t\tfor (const c of data.commands) {\n+\t\t\tassert.match(c.usage, /^abso /, c.name);\n+\t\t\tassert.ok(c.about.length > 0, c.name);\n+\t\t}\n+\t});\n+\n+\tit(\"help without --json says the same, as text\", async () => {\n+\t\tconst text = (await main([\"help\"], { cwd: process.cwd(), env: {}, write: () => {} })).stdout;\n+\t\tconst data = JSON.parse(\n+\t\t\t(await main([\"--help\", \"--json\"], { cwd: process.cwd(), env: {}, write: () => {} })).stdout,\n+\t\t) as HelpJson;\n+\t\tassert.ok(text.startsWith(`${data.intro}\\n`));\n+\t\tassert.ok(text.endsWith(`${data.note}\\n`));\n+\t\tfor (const c of data.commands) assert.ok(text.includes(`  ${c.usage}\\n      ${c.about}\\n`), c.name);\n+\t});\n+});"},{"path":"client/test/terminal-text.test.ts","added":8,"removed":0,"diff":"--- a/client/test/terminal-text.test.ts\n+++ b/client/test/terminal-text.test.ts\n@@ -24,6 +24,14 @@\n \t\tassert.equal(terminalText(red, false), \"failed and bold\");\n \t});\n \n+\tit(\"drops conceal (SGR 8), which would hide text, but keeps 8 as a color\", () => {\n+\t\tassert.equal(terminalText(`${ESC}[8mhidden${ESC}[0m`, true), `hidden${ESC}[0m`);\n+\t\tassert.equal(terminalText(`${ESC}[1;8;31mx`, true), `${ESC}[1;31mx`);\n+\t\tassert.equal(terminalText(`${ESC}[38;5;8;48;2;8;8;8mx`, true), `${ESC}[38;5;8;48;2;8;8;8mx`);\n+\t\tassert.equal(terminalText(`${ESC}[38;5;8;8mx`, true), `${ESC}[38;5;8mx`);\n+\t\tassert.equal(terminalText(`${ESC}[mx${ESC}[28m`, true), `${ESC}[mx${ESC}[28m`);\n+\t});\n+\n \tit(\"shows OSC 52 (the clipboard) and OSC 8 (links) as text, with or without colors\", () => {\n \t\tconst clip = `${ESC}]52;c;ZWNobyBoaQ==\\x07`;\n \t\tassert.equal(terminalText(clip, true), \"\\\\x1b]52;c;ZWNobyBoaQ==\\\\x07\");"}],"ci":null}