Skip to content

abso-core

Public

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

Check passed

Versions 78 to 79

Compare

+46 −0 in 1 place
new file, 46 lines
1+// abso help --json: every command help shows, as data, for a command reference built from the client.
2+
3+import assert from "node:assert/strict";
4+import { describe, it } from "node:test";
5+import { commandTable, main } from "../src/main.ts";
6+
7+interface HelpJson {
8+ ok: boolean;
9+ command: string;
10+ version: string;
11+ intro: string;
12+ note: string;
13+ commands: { name: string; usage: string; about: string; flags: Record<string, string> }[];
14+}
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);
34+ }
35+ });
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,
41+ ) as HelpJson;
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);
45+ });
46+});
MCP
compare on this site's /mcp
CLI
abso diff 78 79 client/test/help.test.ts --json
JSON
/christopher/abso-core/compare/78..79?file=client%2Ftest%2Fhelp.test.ts&format=json