{"draft":null,"from":78,"to":79,"files":[{"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 {"}],"unmatched":[]}