- MCP
- code on this site's /mcp
- CLI
- none: the JSON below is the answer
- JSON
- /christopher/abso-core/files/client/test/group-commands.test.ts?format=json
50 linesgroups 100%Last change groups in version 256, 1 version changed it
1// Groups, the client's part: how history reads, what's refused before any call, and that MCP serves both commands.
2// The commands against the real store are on the platform side.
4import assert from "node:assert/strict";
5import { describe, it } from "node:test";
6import { eventLine } from "../src/group-commands.ts";
7import type { GroupEvent } from "../src/issues-wire.ts";
8import { main } from "../src/main.ts";
9import { mcpTools } from "../src/mcp.ts";
11const at = Date.parse("2026-10-15T19:12:00Z");
12const base = { at, membershipRevision: 1, policyRevision: 1 };
14describe("groups, the client's part", () => {
15 it("reads each kind of event as one line, words quoted", () => {
16 const e = (x: Partial<GroupEvent>): string =>
17 eventLine({ n: 7, kind: "message", by: "ann", ...base, ...x } as GroupEvent, at);
18 assert.equal(e({ text: 'hi\nthere "you"' }), ' 7 19:12 UTC ann: "hi\\nthere \\"you\\""');
19 assert.equal(
20 e({ text: "re", replyTo: 3, news: [] }),
21 ' 7 19:12 UTC ann (re 3): "re" (history only, no news)',
22 );
23 assert.equal(e({ kind: "joined" }), " 7 19:12 UTC ann joined");
24 assert.equal(e({ kind: "added", who: "bob" }), " 7 19:12 UTC ann added bob");
25 assert.equal(
26 e({ kind: "removed", by: "abso", who: "bob" }),
27 " 7 19:12 UTC abso removed bob (no longer in the project)",
28 );
29 assert.equal(
30 e({ kind: "settings", detail: { private: { from: false, to: true } } }),
31 " 7 19:12 UTC ann set private true",
32 );
33 });
35 it("asks for a name before anything else", async () => {
36 const r = await main(["group"], { cwd: process.cwd(), env: {}, write: () => {} });
37 assert.equal(r.exit, 1);
38 assert.match(r.stdout + r.stderr, /abso group <name> reads a group/);
39 });
41 it("serves groups and group as MCP tools, with group's flags", () => {
42 const tools = mcpTools();
43 const group = tools.find((t) => t.name === "group");
44 assert.ok(tools.some((t) => t.name === "groups"));
45 assert.ok(group);
46 const props = (group.inputSchema as { properties: Record<string, unknown> }).properties;
47 for (const flag of ["post", "news", "except", "join", "leave", "add", "remove", "before", "kind"])
48 assert.ok(flag in props, flag);
49 });
50});