- MCP
- show on this site's /mcp
- CLI
- abso show 185 --json
- JSON
- /christopher/abso-core/versions/185?format=json
abso init, init --org and org new from a signed-in box (abso 663). On a server this box is signed in to and with no token for it, abso init makes the project as the person who approved the box, through the server's POST /box/projects (the website's own create): its folder (up to 24 MB) is the first version, --public or --private picks visibility (private by default), --org makes it an organization's project, and one Idempotency-Key per folder (kept in .abso/init-key until it finishes) makes a retry the same project. The folder then joins at once with its own key from the box (--agent, else the box's name). abso org new <name> [--name] makes an organization through POST /box/orgs. abso box and login say 'all of yours, now and later' for a member-all grant. Without a box, init and init --org say to abso login. Tests: orgs, box, help; full suite passes.
of shared·box-grants··Not checked
Version 184 · Files at version 185
6 files, 310 lines added, 29 removed.
--- a/client/src/box.ts
+++ b/client/src/box.ts
@@ -21,8 +21,15 @@
24+ /** Version 2 grants (abso 663): member-all is every project of the approver's, now and later, at most this role. */
2527
28+/** The role a box has in all its approver's projects, now and later, or null when its grant is a list (abso 663). */
32+
2835 readonly projects?: readonly { readonly project: string; readonly role: "reader" | "writer" | "owner" }[];
@@ -154,6 +161,7 @@
@@ -162,6 +170,7 @@
@@ -316,6 +325,60 @@
318327
328+/** What a new project from this box starts with (abso 663): the website's own create, as the person who approved the box. */
338+
340+ * Makes a project as the person who approved this box (abso init, abso 663). One key for every try, so a retry after
358+ `${originOf(record.server)} is still making ${project.name}. Run the same abso init again in a minute: it picks up where this left off.`,
363+
381+
@@ -375,9 +438,12 @@
375438 if (!record) return `This box isn't signed in to ${originOf(server)}. abso login signs it in.`;
379443 `Signed in to ${record.server} as box ${record.id}${expired ? ", but the sign-in has expired. abso login renews it." : "."}`,
380− `Projects: ${g.projects.map((p) => `${p.project} (${p.role})`).join(", ")}.`,
446+ : `Projects: all of yours, now and later (${all} at most). abso init makes a new one; abso org new makes an organization.`,
--- a/client/src/join-commands.ts
+++ b/client/src/join-commands.ts
@@ -1,11 +1,20 @@
22
3−import { existsSync, mkdirSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
4+import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
8−import { defaultAgentName, mintFreeName, mintKey, readBox } from "./box.ts";
@@ -16,7 +25,7 @@
19−import { siteOf } from "./orgs.ts";
2029import { projectFileName, readProjectFile, startingProjectFileText, writeStartingProjectFile } from "./project-file.ts";
@@ -48,6 +57,15 @@
60+ if (bool(args, "public") && bool(args, "private")) throw new UsageError("--public or --private, not both");
61+ // A box signed in here, and no token for this server: the project is made as the person who approved the box,
@@ -99,7 +117,107 @@
101119
120+/** The most a new project's folder may be from a box: the server takes a body up to 25 MB, base64 and JSON included. */
122+/** The Idempotency-Key of an abso init that didn't finish, so running it again makes the same project (abso 663). */
124+
126+ * abso init from a signed-in box (abso 663): the server makes the project as the person who approved the box, the way the
127+ * website's New project does (owner, visibility, address), with the folder as its first version. This folder then
128+ * joins it like abso join, with its own key from the box, so it works at once with no new approval.
140+ `project names are letters, digits, dot, dash and underscore (got ${JSON.stringify(project)})`,
146+ const wroteIgnore = !asIs && !existsSync(absoignore) && !existsSync(join(root, ".avcsignore"));
167+ `${root} is over 24 MB to send. Make ${project} with abso init on a smaller folder (or on the website), then copy the rest in and push.`,
169+ // One key per folder until it finishes: running the same abso init again is the same project, never a second.
192+ `Created project ${project} (${visibility}, owned by ${owner}) at version ${synced.version} from ${plural(listed.length, "file")} in ${root}.`,
195+ ? ["Wrote a starting .absoignore (Claude Code state and operating system files); edit it like .gitignore."]
198+ `This folder is agent ${minted.agent}, with its own key, ${minted.id}, made from this box's sign-in. Settings are in .abso/config.json.`,
200+ ...(synced.written.length > 0 ? [`Wrote ${plural(synced.written.length, "file")} from shared.`] : []),
219+
103221 * Where abso join writes: --dir, else here when --agent is given (as before, so a folder prepared with
104222 * abso key install --server is joined where its key is). With no --agent: here when this folder is empty, else
105223 * ./<project>, which has to be new or empty so nobody's files are written over. A folder holding only abso's own
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -46,7 +46,7 @@
4646import { runAck, runAnswer, runAsk, runIssue, runIssues, runReply, runSearch, runWaiting } from "./issues.ts";
4747import { adminToken, issuedPublic, keyList, keyListText, keyNew, keyRevoke } from "./key-admin.ts";
49−import { initInOrg, runOrg, runOrgs } from "./orgs.ts";
@@ -97,14 +97,19 @@
9797
100− flags: { server: "string", project: "string", agent: "string", "as-is": "boolean", org: "string" },
101− usage: "abso init [folder] --project <name> --agent <name> [--as-is] [--org <org>]",
102− about:
103− "Create a project on the server from a folder's text files The folder becomes that agent's folder. It writes a starting .absoignore, and, when the folder has no avcs.json and package.json gives a check or a build to guess, an avcs.json (setup, check, build and out): what the server's CI runs on each new version of shared. Without one, CI runs what it can guess itself, or nothing. --as-is writes neither: the folder goes up exactly as it is (an import). --org <org> makes it an organization's project: for now that is done on the website, and abso says where.",
104− run: (args, env) => {
105− const org = str(args, "org");
106− return org === undefined ? runInit(args, env) : initInOrg(org, boxServer(args, env));
109+ usage: "abso init [folder] --project <name> [--agent <name>] [--as-is] [--org <org>] [--public|--private]",
111+ "Create a project on the server from a folder's text files The folder becomes that agent's folder. It writes a starting .absoignore, and, when the folder has no avcs.json and package.json gives a check or a build to guess, an avcs.json (setup, check, build and out): what the server's CI runs on each new version of shared. Without one, CI runs what it can guess itself, or nothing. --as-is writes neither: the folder goes up exactly as it is (an import). On a server this box is signed in to (abso login, approving all your projects), the project is made as you, the way the website's New project makes it: you own it, it's private unless you say --public, and the folder joins it at once with its own key (--agent names it; else the box's name). --org <org> makes it that organization's project. Elsewhere it needs --agent and the server's token.",
@@ -278,7 +283,7 @@
279284 "abso org <name> [--invite <person>|link [--as owner] | --role <person>=owner|member | --remove <person> | --leave | --members read|write | --projects-by members|owners] | abso org new <name> [--name <shown name>]",
281− "An organization: its projects, people, open invites and settings, as the person who approved this box's sign-in sees them (people and settings only to members). One change at a time. Changes and abso org new are made on the website for now, and abso says where.",
286+ "An organization: its projects, people, open invites and settings, as the person who approved this box's sign-in sees them (people and settings only to members). One change at a time. abso org new makes one as that person, from a box approved for all their projects; other changes are made on the website, and abso says where.",
--- a/client/src/orgs.ts
+++ b/client/src/orgs.ts
@@ -1,11 +1,12 @@
2−// person who approved this box's sign-in (abso login). Changing an org (new,
3−// invite, role, remove, leave, settings) and making a project in one are done on
4−// the website for now: a box sits where agents run, and its sign-in was given
5−// for project work, so the server takes only reads from it.
67
7−import { type Parsed, UsageError } from "./args.ts";
8−import { type Answer, boxGet, originOf, readBox } from "./box.ts";
1011
1112/** The website for an API server: api.<site> serves <site>; any other server serves its own pages. */
@@ -30,7 +31,7 @@
3132
33− "Organizations are changed on the website for now; from the CLI they can only be read, as the person who approved this box's sign-in";
34+ "Organizations are changed on the website; from the CLI they can be read, and made with abso org new, as the person who approved this box's sign-in";
3435
3536/** Where the box's sign-in is read from and how the server is reached; tests pass their own. */
@@ -114,7 +115,18 @@
116117 if (second === undefined || more.length > 0) throw new UsageError('abso org new <name> [--name "<shown name>"]');
117− throw new UsageError(`${WEBSITE_ONLY}. Make ${second} at ${siteOf(server)}/orgs/new.`);
122+ `this box isn't signed in to ${originOf(server)}. abso login signs it in; approve all your projects to make organizations from here`,
127+ text: `Made the organization ${name}; you own it. Its page: ${siteOf(server)}/${name}. abso init --org ${name} --project <name> makes a project in it.`,
@@ -166,9 +178,9 @@
168180
169−/** abso init --org: making a project in an org is a website step for now. */
181+/** abso init --org with no box signed in to the server: an org's project is made as the person who approved one (abso 663). */
172− `projects in an organization are made on the website for now: New project at ${siteOf(server)}, with ${org} as its owner.`,
184+ `this box isn't signed in to ${originOf(server)}, and a project in ${org} is made as a signed-in person. abso login, approving all your projects, then abso init --org ${org} again; or New project at ${siteOf(server)}.`,
--- a/client/test/box.test.ts
+++ b/client/test/box.test.ts
@@ -9,6 +9,7 @@
@@ -419,3 +420,41 @@
423+
424+test("abso init from a box (abso 663): one key for every try, waiting out a pending create; abso box says all projects", async () => {
425+ const record = { server: SERVER, id: "b_1", credential: CREDENTIAL, grant, expiresAt: Date.now() + 86_400_000 };
452+ assert.ok(seen.every((s) => s.path === "/box/projects" && s.key === "33333333-3333-4333-8333-333333333333"));
454+ assert.deepEqual(JSON.parse(seen[0]!.body), { name: "made", files: [{ path: "a.txt", text: "hi\n" }] });
455+ const all = { ...record, grant: { projects: [], scopes: [{ kind: "member-all", role: "writer" }] } };
--- a/client/test/orgs.test.ts
+++ b/client/test/orgs.test.ts
@@ -31,13 +31,14 @@
3131
34− const asked: { url: string; method: string; auth: string | null }[] = [];
@@ -156,11 +157,13 @@
159− [["new", "acme-labs", "--name", "Acme Labs"], /Make acme-labs at https:\/\/example\.dev\/orgs\/new\./],
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/);
@@ -188,11 +191,49 @@
190193
191−describe("abso init --org", () => {
192− it("says the project is made on the website for now, with the org as its owner", () => {
195+ it("makes the org as the box's person, sending the box's sign-in and the shown name", async () => {
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 });
206+ assert.deepEqual(JSON.parse(s.asked[0]?.body ?? "{}"), { name: "acme-labs", displayName: "Acme Labs" });
208+ it("says what the server says when the box's grant is a list, and never shows the credential", async () => {
211+ "/box/orgs": { status: 403, body: { error: "only a box approved for all your projects makes organizations" } },
216+ /refused \(403\): only a box approved for all your projects/.test(e.message) && !e.message.includes(CREDENTIAL),
226+ runOrg(args(["new", "acme-labs", "--leave"]), SERVER, { home: signedIn(), fetch: server({}).fetcher }),
231+
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\./,