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 116 to 318

Compare

+48 −7 in 4 places
Lines 21–27 at 318 (were 21–27 at 116)
2121 server: SERVER,
2222 id: "box_1",
2323 credential: CREDENTIAL,
24− grant: { projects: [{ project: "web", role: "writer" }], max_agents: 3 },
24+ grant: { projects: [{ project: "web", role: "writer" }] },
2525 expiresAt: Date.now() + 86_400_000,
2626 },
2727 home,
Lines 31–44 at 318 (were 31–43 at 116)
3131
3232/** A stand-in server: answers from `routes` by path, and keeps what was asked. */
3333function server(routes: Record<string, { status: number; body: unknown }>) {
34− const asked: { url: string; method: string; auth: string | null }[] = [];
34+ const asked: { url: string; method: string; auth: string | null; body?: string }[] = [];
3535 const fetcher = (async (url: string | URL | Request, init?: RequestInit) => {
3636 const u = new URL(String(url));
3737 asked.push({
3838 url: String(url),
3939 method: init?.method ?? "GET",
4040 auth: new Headers(init?.headers).get("authorization"),
41+ ...(typeof init?.body === "string" ? { body: init.body } : {}),
4142 });
4243 const r = routes[u.pathname] ?? { status: 404, body: { error: "no such route" } };
4344 return new Response(JSON.stringify(r.body), { status: r.status });
Lines 157–169 at 318 (were 156–166 at 116)
156157 [["acme-labs", "--leave"], /--leave is on acme-labs's People tab/],
157158 [["acme-labs", "--members", "read"], /--members is on acme-labs's Settings tab/],
158159 [["acme-labs", "--projects-by", "owners"], /--projects-by is on acme-labs's Settings tab/],
159− [["new", "acme-labs", "--name", "Acme Labs"], /Make acme-labs at https:\/\/example\.dev\/orgs\/new\./],
160160 ];
161161 for (const [line, said] of cases) {
162162 await assert.rejects(runOrg(args(line), SERVER, { home, fetch: s.fetcher }), said, line.join(" "));
163− await assert.rejects(runOrg(args(line), SERVER, { home, fetch: s.fetcher }), /changed on the website for now/);
163+ await assert.rejects(
164+ runOrg(args(line), SERVER, { home, fetch: s.fetcher }),
165+ /Organizations are changed on the website/,
166+ );
164167 }
165168 assert.deepEqual(s.asked, []);
166169 });
Lines 191–239 at 318 (were 188–198 at 116)
188191 });
189192});
190193
191−describe("abso init --org", () => {
192− it("says the project is made on the website for now, with the org as its owner", () => {
194+describe("abso org new (abso 663)", () => {
195+ it("makes the org as the box's person, sending the box's sign-in and the shown name", async () => {
196+ const home = signedIn();
197+ const s = server({ "/box/orgs": { status: 200, body: { name: "acme-labs", displayName: "Acme Labs" } } });
198+ const out = await runOrg(args(["new", "acme-labs", "--name", "Acme Labs"]), SERVER, { home, fetch: s.fetcher });
199+ assert.match(
200+ out.text,
201+ /Made the organization acme-labs; you own it\. Its page: https:\/\/example\.dev\/acme-labs\./,
202+ );
203+ assert.equal(s.asked.length, 1);
204+ assert.equal(s.asked[0]?.method, "POST");
205+ assert.equal(s.asked[0]?.auth, `Box ${CREDENTIAL}`);
206+ assert.deepEqual(JSON.parse(s.asked[0]?.body ?? "{}"), { name: "acme-labs", displayName: "Acme Labs" });
207+ });
208+ it("says what the server says when the box's grant is a list, and never shows the credential", async () => {
209+ const home = signedIn();
210+ const s = server({
211+ "/box/orgs": { status: 403, body: { error: "only a box approved for all your projects makes organizations" } },
212+ });
213+ await assert.rejects(
214+ runOrg(args(["new", "acme-labs"]), SERVER, { home, fetch: s.fetcher }),
215+ (e: Error) =>
216+ /refused \(403\): only a box approved for all your projects/.test(e.message) && !e.message.includes(CREDENTIAL),
217+ );
218+ });
219+ it("needs a box signed in, and no other change flag", async () => {
220+ const empty = mkdtempSync(join(tmpdir(), "abso-orgs-"));
221+ await assert.rejects(
222+ runOrg(args(["new", "acme-labs"]), SERVER, { home: empty, fetch: server({}).fetcher }),
223+ /abso login signs it in/,
224+ );
225+ await assert.rejects(
226+ runOrg(args(["new", "acme-labs", "--leave"]), SERVER, { home: signedIn(), fetch: server({}).fetcher }),
227+ /takes --name only/,
228+ );
229+ });
230+});
232+describe("abso init --org with no box signed in", () => {
233+ it("says to sign in, or where the website makes it", () => {
193234 assert.throws(
194235 () => initInOrg("acme-labs", SERVER),
195− /made on the website for now: New project at https:\/\/example\.dev, with acme-labs as its owner/,
236+ /isn't signed in to https:\/\/api\.example\.dev.*abso init --org acme-labs again; or New project at https:\/\/example\.dev\./,
196237 );
197238 });
198239});
MCP
compare on this site's /mcp
CLI
abso diff 116 318 client/test/orgs.test.ts --json
JSON
/christopher/abso-core/compare/116..318?file=client%2Ftest%2Forgs.test.ts&format=json