{"draft":null,"from":175,"to":318,"files":[{"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 }"}],"unmatched":[]}