{"version":185,"agent":"box-grants","message":"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.","time":1791994804231,"timeIso":"2026-10-14T16:20:04.231Z","changes":10,"change":3019,"files":["client/src/box.ts","client/src/join-commands.ts","client/src/main.ts","client/src/orgs.ts","client/test/box.test.ts","client/test/orgs.test.ts"],"draft":null,"diff":[{"path":"client/src/box.ts","added":67,"removed":1,"diff":"--- a/client/src/box.ts\n+++ b/client/src/box.ts\n@@ -21,8 +21,15 @@\n  */\n export interface Grant {\n \treadonly projects: readonly { readonly project: string; readonly role: string }[];\n+\t/** Version 2 grants (abso 663): member-all is every project of the approver's, now and later, at most this role. */\n+\treadonly scopes?: readonly { readonly kind: string; readonly role: string }[];\n }\n \n+/** The role a box has in all its approver's projects, now and later, or null when its grant is a list (abso 663). */\n+export function allProjectsRole(grant: Grant): string | null {\n+\treturn grant.scopes?.find((scope) => scope.kind === \"member-all\")?.role ?? null;\n+}\n+\n /** Requested access is a suggestion for the person approving, never an authorization. */\n export interface LoginRequest {\n \treadonly projects?: readonly { readonly project: string; readonly role: \"reader\" | \"writer\" | \"owner\" }[];\n@@ -154,6 +161,7 @@\n \tbody: unknown,\n \tcredential: string | undefined,\n \tfetcher: typeof fetch,\n+\theaders: Readonly<Record<string, string>> = {},\n ): Promise<Answer> {\n \tconst secrets = credential ? [credential] : [];\n \tlet response: Response;\n@@ -162,6 +170,7 @@\n \t\t\tmethod: \"POST\",\n \t\t\theaders: {\n \t\t\t\t\"content-type\": \"application/json\",\n+\t\t\t\t...headers,\n \t\t\t\t...(credential ? { authorization: `Box ${credential}` } : {}),\n \t\t\t},\n \t\t\tbody: JSON.stringify(body),\n@@ -316,6 +325,60 @@\n \treturn { key, id };\n }\n \n+/** What a new project from this box starts with (abso 663): the website's own create, as the person who approved the box. */\n+export interface NewProject {\n+\treadonly name: string;\n+\treadonly owner?: string;\n+\treadonly visibility?: \"public\" | \"private\";\n+\treadonly files?: readonly (\n+\t\t| { readonly path: string; readonly text: string }\n+\t\t| { readonly path: string; readonly base64: string }\n+\t)[];\n+}\n+\n+/**\n+ * Makes a project as the person who approved this box (abso init, abso 663). One key for every try, so a retry after\n+ * a lost answer or a pending one is the same project, never a second.\n+ */\n+export async function boxCreateProject(\n+\trecord: BoxRecord,\n+\tproject: NewProject,\n+\tkey: string,\n+\tfetcher: typeof fetch = fetch,\n+\tsleep: (ms: number) => Promise<void> = (ms) => new Promise((done) => setTimeout(done, ms)),\n+): Promise<Record<string, unknown>> {\n+\tfor (let attempt = 1; ; attempt++) {\n+\t\tconst a = await call(record.server, \"/box/projects\", project, record.credential, fetcher, {\n+\t\t\t\"Idempotency-Key\": key,\n+\t\t});\n+\t\tconst pending = (a.body.operation as { state?: unknown } | undefined)?.state === \"pending\";\n+\t\tif (!pending) return a.body;\n+\t\tif (attempt >= 10)\n+\t\t\tthrow new UsageError(\n+\t\t\t\t`${originOf(record.server)} is still making ${project.name}. Run the same abso init again in a minute: it picks up where this left off.`,\n+\t\t\t);\n+\t\tawait sleep(1000 * attempt);\n+\t}\n+}\n+\n+/** Makes an organization as the person who approved this box (abso org new, abso 663). */\n+export async function boxCreateOrg(\n+\trecord: BoxRecord,\n+\tname: string,\n+\tdisplayName: string | undefined,\n+\tfetcher: typeof fetch = fetch,\n+): Promise<Record<string, unknown>> {\n+\treturn (\n+\t\tawait call(\n+\t\t\trecord.server,\n+\t\t\t\"/box/orgs\",\n+\t\t\t{ name, ...(displayName === undefined ? {} : { displayName }) },\n+\t\t\trecord.credential,\n+\t\t\tfetcher,\n+\t\t)\n+\t).body;\n+}\n+\n /** The agent name abso join takes when none is given: the box's name, lower-cased. */\n export function defaultAgentName(): string {\n \treturn boxName().toLowerCase();\n@@ -375,9 +438,12 @@\n \tif (!record) return `This box isn't signed in to ${originOf(server)}. abso login signs it in.`;\n \tconst g = record.grant;\n \tconst expired = record.expiresAt <= now;\n+\tconst all = allProjectsRole(g);\n \treturn [\n \t\t`Signed in to ${record.server} as box ${record.id}${expired ? \", but the sign-in has expired. abso login renews it.\" : \".\"}`,\n-\t\t`Projects: ${g.projects.map((p) => `${p.project} (${p.role})`).join(\", \")}.`,\n+\t\tall === null\n+\t\t\t? `Projects: ${g.projects.map((p) => `${p.project} (${p.role})`).join(\", \")}.`\n+\t\t\t: `Projects: all of yours, now and later (${all} at most). abso init makes a new one; abso org new makes an organization.`,\n \t\t`${expired ? \"Expired\" : \"Expires\"} ${day(record.expiresAt)} UTC.`,\n \t].join(\"\\n\");\n }"},{"path":"client/src/join-commands.ts","added":121,"removed":3,"diff":"--- a/client/src/join-commands.ts\n+++ b/client/src/join-commands.ts\n@@ -1,11 +1,20 @@\n // abso init and abso join: start a project from a folder, or join one into a folder.\n \n-import { existsSync, mkdirSync, readdirSync, rmSync, statSync, writeFileSync } from \"node:fs\";\n+import { randomUUID } from \"node:crypto\";\n+import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from \"node:fs\";\n import { join, relative, resolve } from \"node:path\";\n import { Api, ApiError } from \"./api.ts\";\n import { bool, type Parsed, str, UsageError } from \"./args.ts\";\n import { writeKnownBlobs } from \"./blobs.ts\";\n-import { defaultAgentName, mintFreeName, mintKey, readBox } from \"./box.ts\";\n+import {\n+\ttype BoxRecord,\n+\tboxCreateProject,\n+\tdefaultAgentName,\n+\tmintFreeName,\n+\tmintKey,\n+\ttype NewProject,\n+\treadBox,\n+} from \"./box.ts\";\n import { STARTING_ABSOIGNORE } from \"./check-ignore.ts\";\n import { CLIENT_DIR } from \"./client-version.ts\";\n import { type Env, type Output, plural } from \"./command-env.ts\";\n@@ -16,7 +25,7 @@\n import { clearKnown, loadIgnore, readFolder, writeKnown } from \"./folder.ts\";\n import { modInstalled } from \"./install.ts\";\n import { type FullMode, foldModes, writeKnownModes } from \"./modes.ts\";\n-import { siteOf } from \"./orgs.ts\";\n+import { initInOrg, siteOf } from \"./orgs.ts\";\n import { projectFileName, readProjectFile, startingProjectFileText, writeStartingProjectFile } from \"./project-file.ts\";\n import { refusedText } from \"./safety.ts\";\n import { chooseServer, serverFlag } from \"./server-choice.ts\";\n@@ -48,6 +57,15 @@\n \tif (findRoot(root) === root) throw new UsageError(`${root} already has .abso/config.json`);\n \tconst project = str(args, \"project\");\n \tif (!project) throw new UsageError(\"give the project a name with --project <name>\");\n+\tif (bool(args, \"public\") && bool(args, \"private\")) throw new UsageError(\"--public or --private, not both\");\n+\t// A box signed in here, and no token for this server: the project is made as the person who approved the box,\n+\t// the way the website makes one (abso 663).\n+\tconst server = serverFrom(args, env);\n+\tconst box = readBox(server);\n+\tif (box && !tokenFor(server, env.env) && !fromEnv(env.env, \"KEY_FILE\"))\n+\t\treturn initFromBox(args, env, root, project, server, box);\n+\tconst org = str(args, \"org\");\n+\tif (org !== undefined) return initInOrg(org, server);\n \tconst config = makeSettings(args, env, project);\n \tconst asIs = bool(args, \"as-is\");\n \tconst absoignore = join(root, \".absoignore\");\n@@ -99,7 +117,107 @@\n \t};\n }\n \n+/** 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. */\n+const BOX_INIT_MAX = 24 * 1024 * 1024;\n+/** The Idempotency-Key of an abso init that didn't finish, so running it again makes the same project (abso 663). */\n+const INIT_KEY = \"init-key\";\n+\n /**\n+ * abso init from a signed-in box (abso 663): the server makes the project as the person who approved the box, the way the\n+ * website's New project does (owner, visibility, address), with the folder as its first version. This folder then\n+ * joins it like abso join, with its own key from the box, so it works at once with no new approval.\n+ */\n+async function initFromBox(\n+\targs: Parsed,\n+\tenv: Env,\n+\troot: string,\n+\tproject: string,\n+\tserver: string,\n+\tbox: BoxRecord,\n+): Promise<Output> {\n+\tif (!NAME.test(project))\n+\t\tthrow new UsageError(\n+\t\t\t`project names are letters, digits, dot, dash and underscore (got ${JSON.stringify(project)})`,\n+\t\t);\n+\tconst named = str(args, \"agent\");\n+\tif (named !== undefined) agentFrom(args);\n+\tconst asIs = bool(args, \"as-is\");\n+\tconst absoignore = join(root, \".absoignore\");\n+\tconst wroteIgnore = !asIs && !existsSync(absoignore) && !existsSync(join(root, \".avcsignore\"));\n+\tif (wroteIgnore) writeFileSync(absoignore, STARTING_ABSOIGNORE);\n+\tconst wroteProject = asIs ? \"exists\" : writeStartingProjectFile(root);\n+\tconst { files, blobs, leftOut } = readFolder(root, loadIgnore(root));\n+\tconst listed: NonNullable<NewProject[\"files\"]>[number][] = [\n+\t\t...[...files].map(([path, text]) => ({ path, text })),\n+\t\t...[...blobs].map(([path, b]) => ({ path, base64: Buffer.from(b.bytes).toString(\"base64\") })),\n+\t];\n+\tconst org = str(args, \"org\");\n+\tconst body: NewProject = {\n+\t\tname: project,\n+\t\t...(org === undefined ? {} : { owner: org }),\n+\t\t...(bool(args, \"public\")\n+\t\t\t? { visibility: \"public\" as const }\n+\t\t\t: bool(args, \"private\")\n+\t\t\t\t? { visibility: \"private\" as const }\n+\t\t\t\t: {}),\n+\t\t...(listed.length > 0 ? { files: listed } : {}),\n+\t};\n+\tif (JSON.stringify(body).length > BOX_INIT_MAX)\n+\t\tthrow new UsageError(\n+\t\t\t`${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.`,\n+\t\t);\n+\t// One key per folder until it finishes: running the same abso init again is the same project, never a second.\n+\tconst keyPath = join(stateDir(root), INIT_KEY);\n+\tlet key = existsSync(keyPath) ? readFileSync(keyPath, \"utf8\").trim() : \"\";\n+\tif (!/^[0-9a-f-]{36}$/.test(key)) {\n+\t\tkey = randomUUID();\n+\t\tmkdirSync(stateDir(root), { recursive: true });\n+\t\twriteFileSync(keyPath, key);\n+\t}\n+\tconst made = await boxCreateProject(box, body, key);\n+\tconst visibility = typeof made.visibility === \"string\" ? made.visibility : \"private\";\n+\tconst minted =\n+\t\tnamed !== undefined\n+\t\t\t? { ...(await mintKey(box, project, named)), agent: named }\n+\t\t\t: await mintFreeName(box, project, defaultAgentName());\n+\tconst config = { server, project, agent: minted.agent };\n+\twriteConfig(root, config);\n+\tclearKnown(root);\n+\tinstallKey(root, JSON.stringify({ key: minted.key, id: minted.id }));\n+\trmSync(keyPath, { force: true });\n+\tconst synced = await syncFolder(root, new Api(readConfig(root, env.env)), true);\n+\tconst owner = org ?? \"you\";\n+\treturn {\n+\t\ttext: [\n+\t\t\t`Created project ${project} (${visibility}, owned by ${owner}) at version ${synced.version} from ${plural(listed.length, \"file\")} in ${root}.`,\n+\t\t\t...leftOutText(leftOut),\n+\t\t\t...(wroteIgnore\n+\t\t\t\t? [\"Wrote a starting .absoignore (Claude Code state and operating system files); edit it like .gitignore.\"]\n+\t\t\t\t: []),\n+\t\t\t...startingProjectFileText(wroteProject),\n+\t\t\t`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.`,\n+\t\t\t...refusedText(synced.refused),\n+\t\t\t...(synced.written.length > 0 ? [`Wrote ${plural(synced.written.length, \"file\")} from shared.`] : []),\n+\t\t\thookHint(env.env),\n+\t\t].join(\"\\n\"),\n+\t\tjson: {\n+\t\t\tproject,\n+\t\t\tid: made.id ?? null,\n+\t\t\towner: made.owner ?? null,\n+\t\t\tvisibility,\n+\t\t\tversion: synced.version,\n+\t\t\tfiles: listed.length,\n+\t\t\troot,\n+\t\t\tagent: minted.agent,\n+\t\t\tkey_id: minted.id,\n+\t\t\twroteAbsoignore: wroteIgnore,\n+\t\t\twroteProjectFile: typeof wroteProject === \"string\" ? null : wroteProject,\n+\t\t\tleftOut,\n+\t\t},\n+\t};\n+}\n+\n+/**\n  * Where abso join writes: --dir, else here when --agent is given (as before, so a folder prepared with\n  * abso key install --server is joined where its key is). With no --agent: here when this folder is empty, else\n  * ./<project>, which has to be new or empty so nobody's files are written over. A folder holding only abso's own"},{"path":"client/src/main.ts","added":14,"removed":9,"diff":"--- a/client/src/main.ts\n+++ b/client/src/main.ts\n@@ -46,7 +46,7 @@\n import { runAck, runAnswer, runAsk, runIssue, runIssues, runReply, runSearch, runWaiting } from \"./issues.ts\";\n import { adminToken, issuedPublic, keyList, keyListText, keyNew, keyRevoke } from \"./key-admin.ts\";\n import { browserSkip, openInBrowser } from \"./open-browser.ts\";\n-import { initInOrg, runOrg, runOrgs } from \"./orgs.ts\";\n+import { runOrg, runOrgs } from \"./orgs.ts\";\n import { runUnqueue } from \"./queue.ts\";\n import { runNote, runNotes, runReview } from \"./review.ts\";\n import {\n@@ -97,14 +97,19 @@\n \n const COMMANDS: Readonly<Record<string, CommandDef>> = {\n \tinit: {\n-\t\tflags: { server: \"string\", project: \"string\", agent: \"string\", \"as-is\": \"boolean\", org: \"string\" },\n-\t\tusage: \"abso init [folder] --project <name> --agent <name> [--as-is] [--org <org>]\",\n-\t\tabout:\n-\t\t\t\"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.\",\n-\t\trun: (args, env) => {\n-\t\t\tconst org = str(args, \"org\");\n-\t\t\treturn org === undefined ? runInit(args, env) : initInOrg(org, boxServer(args, env));\n+\t\tflags: {\n+\t\t\tserver: \"string\",\n+\t\t\tproject: \"string\",\n+\t\t\tagent: \"string\",\n+\t\t\t\"as-is\": \"boolean\",\n+\t\t\torg: \"string\",\n+\t\t\tpublic: \"boolean\",\n+\t\t\tprivate: \"boolean\",\n \t\t},\n+\t\tusage: \"abso init [folder] --project <name> [--agent <name>] [--as-is] [--org <org>] [--public|--private]\",\n+\t\tabout:\n+\t\t\t\"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.\",\n+\t\trun: (args, env) => runInit(args, env),\n \t},\n \tkey: {\n \t\tflags: {\n@@ -278,7 +283,7 @@\n \t\tusage:\n \t\t\t\"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>]\",\n \t\tabout:\n-\t\t\t\"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.\",\n+\t\t\t\"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.\",\n \t\trun: (args, env) => runOrg(args, boxServer(args, env)),\n \t},\n \tskill: {"},{"path":"client/src/orgs.ts","added":22,"removed":10,"diff":"--- a/client/src/orgs.ts\n+++ b/client/src/orgs.ts\n@@ -1,11 +1,12 @@\n // Organizations from the CLI: abso orgs and abso org <name>. They read as the\n-// person who approved this box's sign-in (abso login). Changing an org (new,\n-// invite, role, remove, leave, settings) and making a project in one are done on\n-// the website for now: a box sits where agents run, and its sign-in was given\n-// for project work, so the server takes only reads from it.\n+// person who approved this box's sign-in (abso login). abso org new makes one, and\n+// abso init --org makes a project in one, from a box approved for all its\n+// person's projects (abso 663). Changing an org (invite, role, remove, leave,\n+// settings) stays on the website: a box sits where agents run, so the server takes\n+// no other org change from it.\n \n-import { type Parsed, UsageError } from \"./args.ts\";\n-import { type Answer, boxGet, originOf, readBox } from \"./box.ts\";\n+import { type Parsed, str, UsageError } from \"./args.ts\";\n+import { type Answer, boxCreateOrg, boxGet, originOf, readBox } from \"./box.ts\";\n import type { Output } from \"./commands.ts\";\n \n /** The website for an API server: api.<site> serves <site>; any other server serves its own pages. */\n@@ -30,7 +31,7 @@\n ];\n \n const WEBSITE_ONLY =\n-\t\"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\";\n+\t\"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\";\n \n /** Where the box's sign-in is read from and how the server is reached; tests pass their own. */\n export interface OrgIo {\n@@ -114,7 +115,18 @@\n \tconst asked = CHANGES.filter((c) => args.flags.has(c.flag));\n \tif (first === \"new\") {\n \t\tif (second === undefined || more.length > 0) throw new UsageError('abso org new <name> [--name \"<shown name>\"]');\n-\t\tthrow new UsageError(`${WEBSITE_ONLY}. Make ${second} at ${siteOf(server)}/orgs/new.`);\n+\t\tif (asked.length > 0) throw new UsageError(\"abso org new takes --name only\");\n+\t\tconst record = io.home === undefined ? readBox(server) : readBox(server, io.home);\n+\t\tif (!record)\n+\t\t\tthrow new UsageError(\n+\t\t\t\t`this box isn't signed in to ${originOf(server)}. abso login signs it in; approve all your projects to make organizations from here`,\n+\t\t\t);\n+\t\tconst made = await boxCreateOrg(record, second, str(args, \"name\"), io.fetch);\n+\t\tconst name = typeof made.name === \"string\" ? made.name : second;\n+\t\treturn {\n+\t\t\ttext: `Made the organization ${name}; you own it. Its page: ${siteOf(server)}/${name}. abso init --org ${name} --project <name> makes a project in it.`,\n+\t\t\tjson: { org: made },\n+\t\t};\n \t}\n \tif (first === undefined || second !== undefined)\n \t\tthrow new UsageError(\"abso org <name> [one change], or abso org new <name>\");\n@@ -166,9 +178,9 @@\n \treturn { text: lines.join(\"\\n\"), json: { org } };\n }\n \n-/** abso init --org: making a project in an org is a website step for now. */\n+/** 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). */\n export function initInOrg(org: string, server: string): never {\n \tthrow new UsageError(\n-\t\t`projects in an organization are made on the website for now: New project at ${siteOf(server)}, with ${org} as its owner.`,\n+\t\t`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)}.`,\n \t);\n }"},{"path":"client/test/box.test.ts","added":39,"removed":0,"diff":"--- a/client/test/box.test.ts\n+++ b/client/test/box.test.ts\n@@ -9,6 +9,7 @@\n import { test } from \"node:test\";\n import { parseArgs } from \"../src/args.ts\";\n import {\n+\tboxCreateProject,\n \tboxPublic,\n \tboxText,\n \tforgetBox,\n@@ -419,3 +420,41 @@\n \t\t\"snow is this box's already: never minted again, which would replace its key\",\n \t);\n });\n+\n+test(\"abso init from a box (abso 663): one key for every try, waiting out a pending create; abso box says all projects\", async () => {\n+\tconst record = { server: SERVER, id: \"b_1\", credential: CREDENTIAL, grant, expiresAt: Date.now() + 86_400_000 };\n+\tconst seen: { path: string; key: string | null; auth: string | null; body: string }[] = [];\n+\tlet calls = 0;\n+\tconst fetcher = (async (url: string | URL | Request, init?: RequestInit) => {\n+\t\tconst headers = new Headers(init?.headers);\n+\t\tseen.push({\n+\t\t\tpath: new URL(String(url)).pathname,\n+\t\t\tkey: headers.get(\"idempotency-key\"),\n+\t\t\tauth: headers.get(\"authorization\"),\n+\t\t\tbody: String(init?.body),\n+\t\t});\n+\t\tcalls++;\n+\t\tconst body =\n+\t\t\tcalls < 3\n+\t\t\t\t? { operation: { id: \"op\", state: \"pending\" } }\n+\t\t\t\t: { project: \"made\", id: \"proj_1\", visibility: \"private\" };\n+\t\treturn new Response(JSON.stringify(body), { status: calls < 3 ? 202 : 200 });\n+\t}) as typeof fetch;\n+\tconst made = await boxCreateProject(\n+\t\trecord,\n+\t\t{ name: \"made\", files: [{ path: \"a.txt\", text: \"hi\\n\" }] },\n+\t\t\"33333333-3333-4333-8333-333333333333\",\n+\t\tfetcher,\n+\t\tasync () => {},\n+\t);\n+\tassert.equal(made.id, \"proj_1\");\n+\tassert.equal(seen.length, 3);\n+\tassert.ok(seen.every((s) => s.path === \"/box/projects\" && s.key === \"33333333-3333-4333-8333-333333333333\"));\n+\tassert.ok(seen.every((s) => s.auth === `Box ${CREDENTIAL}`));\n+\tassert.deepEqual(JSON.parse(seen[0]!.body), { name: \"made\", files: [{ path: \"a.txt\", text: \"hi\\n\" }] });\n+\tconst all = { ...record, grant: { projects: [], scopes: [{ kind: \"member-all\", role: \"writer\" }] } };\n+\tassert.match(\n+\t\tboxText(all, SERVER),\n+\t\t/Projects: all of yours, now and later \\(writer at most\\)\\. abso init makes a new one/,\n+\t);\n+});"},{"path":"client/test/orgs.test.ts","added":47,"removed":6,"diff":"--- a/client/test/orgs.test.ts\n+++ b/client/test/orgs.test.ts\n@@ -31,13 +31,14 @@\n \n /** A stand-in server: answers from `routes` by path, and keeps what was asked. */\n function server(routes: Record<string, { status: number; body: unknown }>) {\n-\tconst asked: { url: string; method: string; auth: string | null }[] = [];\n+\tconst asked: { url: string; method: string; auth: string | null; body?: string }[] = [];\n \tconst fetcher = (async (url: string | URL | Request, init?: RequestInit) => {\n \t\tconst u = new URL(String(url));\n \t\tasked.push({\n \t\t\turl: String(url),\n \t\t\tmethod: init?.method ?? \"GET\",\n \t\t\tauth: new Headers(init?.headers).get(\"authorization\"),\n+\t\t\t...(typeof init?.body === \"string\" ? { body: init.body } : {}),\n \t\t});\n \t\tconst r = routes[u.pathname] ?? { status: 404, body: { error: \"no such route\" } };\n \t\treturn new Response(JSON.stringify(r.body), { status: r.status });\n@@ -156,11 +157,13 @@\n \t\t\t[[\"acme-labs\", \"--leave\"], /--leave is on acme-labs's People tab/],\n \t\t\t[[\"acme-labs\", \"--members\", \"read\"], /--members is on acme-labs's Settings tab/],\n \t\t\t[[\"acme-labs\", \"--projects-by\", \"owners\"], /--projects-by is on acme-labs's Settings tab/],\n-\t\t\t[[\"new\", \"acme-labs\", \"--name\", \"Acme Labs\"], /Make acme-labs at https:\\/\\/example\\.dev\\/orgs\\/new\\./],\n \t\t];\n \t\tfor (const [line, said] of cases) {\n \t\t\tawait assert.rejects(runOrg(args(line), SERVER, { home, fetch: s.fetcher }), said, line.join(\" \"));\n-\t\t\tawait assert.rejects(runOrg(args(line), SERVER, { home, fetch: s.fetcher }), /changed on the website for now/);\n+\t\t\tawait assert.rejects(\n+\t\t\t\trunOrg(args(line), SERVER, { home, fetch: s.fetcher }),\n+\t\t\t\t/Organizations are changed on the website/,\n+\t\t\t);\n \t\t}\n \t\tassert.deepEqual(s.asked, []);\n \t});\n@@ -188,11 +191,49 @@\n \t});\n });\n \n-describe(\"abso init --org\", () => {\n-\tit(\"says the project is made on the website for now, with the org as its owner\", () => {\n+describe(\"abso org new (abso 663)\", () => {\n+\tit(\"makes the org as the box's person, sending the box's sign-in and the shown name\", async () => {\n+\t\tconst home = signedIn();\n+\t\tconst s = server({ \"/box/orgs\": { status: 200, body: { name: \"acme-labs\", displayName: \"Acme Labs\" } } });\n+\t\tconst out = await runOrg(args([\"new\", \"acme-labs\", \"--name\", \"Acme Labs\"]), SERVER, { home, fetch: s.fetcher });\n+\t\tassert.match(\n+\t\t\tout.text,\n+\t\t\t/Made the organization acme-labs; you own it\\. Its page: https:\\/\\/example\\.dev\\/acme-labs\\./,\n+\t\t);\n+\t\tassert.equal(s.asked.length, 1);\n+\t\tassert.equal(s.asked[0]?.method, \"POST\");\n+\t\tassert.equal(s.asked[0]?.auth, `Box ${CREDENTIAL}`);\n+\t\tassert.deepEqual(JSON.parse(s.asked[0]?.body ?? \"{}\"), { name: \"acme-labs\", displayName: \"Acme Labs\" });\n+\t});\n+\tit(\"says what the server says when the box's grant is a list, and never shows the credential\", async () => {\n+\t\tconst home = signedIn();\n+\t\tconst s = server({\n+\t\t\t\"/box/orgs\": { status: 403, body: { error: \"only a box approved for all your projects makes organizations\" } },\n+\t\t});\n+\t\tawait assert.rejects(\n+\t\t\trunOrg(args([\"new\", \"acme-labs\"]), SERVER, { home, fetch: s.fetcher }),\n+\t\t\t(e: Error) =>\n+\t\t\t\t/refused \\(403\\): only a box approved for all your projects/.test(e.message) && !e.message.includes(CREDENTIAL),\n+\t\t);\n+\t});\n+\tit(\"needs a box signed in, and no other change flag\", async () => {\n+\t\tconst empty = mkdtempSync(join(tmpdir(), \"abso-orgs-\"));\n+\t\tawait assert.rejects(\n+\t\t\trunOrg(args([\"new\", \"acme-labs\"]), SERVER, { home: empty, fetch: server({}).fetcher }),\n+\t\t\t/abso login signs it in/,\n+\t\t);\n+\t\tawait assert.rejects(\n+\t\t\trunOrg(args([\"new\", \"acme-labs\", \"--leave\"]), SERVER, { home: signedIn(), fetch: server({}).fetcher }),\n+\t\t\t/takes --name only/,\n+\t\t);\n+\t});\n+});\n+\n+describe(\"abso init --org with no box signed in\", () => {\n+\tit(\"says to sign in, or where the website makes it\", () => {\n \t\tassert.throws(\n \t\t\t() => initInOrg(\"acme-labs\", SERVER),\n-\t\t\t/made on the website for now: New project at https:\\/\\/example\\.dev, with acme-labs as its owner/,\n+\t\t\t/isn't signed in to https:\\/\\/api\\.example\\.dev.*abso init --org acme-labs again; or New project at https:\\/\\/example\\.dev\\./,\n \t\t);\n \t});\n });"}],"ci":null}