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

Compare

+338 −50 in 10 places
Lines 1–49 at 318 (were 1–37 at 97)
11// abso init and abso join: start a project from a folder, or join one into a folder.
22
3−import { existsSync, mkdirSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
4−import { join, relative, resolve } from "node:path";
5−import { Api, ApiError } from "./api.ts";
3+import { randomUUID } from "node:crypto";
4+import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
5+import { isAbsolute, join, relative, resolve, sep } from "node:path";
6+import { Api, ApiError, type SyncAnswer } from "./api.ts";
67import { bool, type Parsed, str, UsageError } from "./args.ts";
78import { writeKnownBlobs } from "./blobs.ts";
8−import { defaultAgentName, mintFreeName, mintKey, readBox, signedInServers } from "./box.ts";
9+import {
10+ type BoxRecord,
11+ boxCreateProject,
12+ defaultAgentName,
13+ mintFreeName,
14+ mintKey,
15+ type NewProject,
16+ readBox,
17+} from "./box.ts";
918import { STARTING_ABSOIGNORE } from "./check-ignore.ts";
10−import { CLIENT_DIR } from "./client-version.ts";
19+import { builtCopy } from "./client-version.ts";
1120import { type Env, type Output, plural } from "./command-env.ts";
12−import { leftOutText, syncFolder, uploadBlobs } from "./commands.ts";
13−import { findRoot, installKey, readConfig, type Settings, tokenFor, writeConfig } from "./config.ts";
14−import { TOKEN_SERVERS } from "./core.ts";
21+import { applyAnswer, leftOutText, pullAnswer, pullWritten, syncFolder, uploadBlobs } from "./commands.ts";
22+import {
23+ findRoot,
24+ installKey,
25+ readConfig,
26+ runKey,
27+ type Settings,
28+ tokenFile,
29+ trustedToken,
30+ writeConfig,
31+} from "./config.ts";
32+import { elsewhereText } from "./doctor.ts";
1533import { fromEnv } from "./env-names.ts";
1634import { clearKnown, loadIgnore, readFolder, writeKnown } from "./folder.ts";
17−import { modInstalled } from "./install.ts";
35+import { installerCommand, modHandsLocal, modInstalled } from "./install.ts";
36+import { LOCAL, NO_STORE, storeDir } from "./local-store.ts";
1837import { type FullMode, foldModes, writeKnownModes } from "./modes.ts";
19−import { siteOf } from "./orgs.ts";
38+import { initInOrg, siteOf } from "./orgs.ts";
2039import { projectFileName, readProjectFile, startingProjectFileText, writeStartingProjectFile } from "./project-file.ts";
2140import { refusedText } from "./safety.ts";
41+import { chooseServer, serverFlag } from "./server-choice.ts";
2242import { OLD_STATE_DIR, STATE_DIR, stateDir } from "./state-dir.ts";
2343
24−/**
25− * The server to join or start on: --server, then ABSO_SERVER, then the server this box is signed in
26− * to (abso login wrote it), then https://api.abso.dev. A box signed in to more than one server has to say which.
27− */
28−export function serverFrom(args: Parsed, env: Pick<Env, "env">, home?: string): string {
29− const named = str(args, "server") ?? fromEnv(env.env, "SERVER");
30− if (named) return named;
31− const signedIn = signedInServers(home);
32− if (signedIn.length > 1)
33− throw new UsageError(`this box is signed in to ${signedIn.join(" and ")}: say which with --server <url>`);
34− return signedIn[0] ?? TOKEN_SERVERS[0]!;
44+/** The server to join or start on, in the order every command picks one (server-choice.ts chooseServer). */
45+export function serverFrom(args: Parsed, env: Pick<Env, "env" | "cwd">): string {
46+ return chooseServer(serverFlag(args), env.cwd, env.env);
3547}
3648
3749const NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
Lines 60–152 at 318 (were 48–53 at 97)
4860 return { server: serverFrom(args, env), project, agent: agentFrom(args) };
4961}
5062
63+/**
64+ * A new project has nothing in it yet: say what comes next, since the join itself wrote nothing. Not for a reader, which
65+ * can't push, or when files were already in the folder (the join's own line names them).
66+ */
67+export function emptyHint(version: number, written: number, kept: number, reader: boolean): string[] {
68+ if (reader || version !== 0 || written > 0 || kept > 0) return [];
69+ return ['The project is empty. Put its files in this folder, then abso push -m "why" publishes them.'];
70+}
72+/** A credential other than the box's, and how init and join name it when they say what they sign in with. */
73+export interface Credential {
74+ readonly token: string | undefined;
75+ readonly words: string;
76+}
78+/**
79+ * What init and join sign in with when it isn't the box's sign-in. The machine's token file only with --token-file, and
80+ * never into a folder that already has a key; else a token the environment names (ABSO_TOKEN, or a pipeline run's
81+ * ABSO_KEY_FILE); else none. The token file is never read unasked, so a project is never made or joined with a shared
82+ * credential nobody chose.
83+ */
84+export function tokenCredential(
85+ args: Parsed,
86+ env: Env["env"],
87+ server: string,
88+ root: string,
89+ file: () => string | undefined = tokenFile,
90+): Credential | undefined {
91+ if (bool(args, "token-file")) {
92+ if (existsSync(join(stateDir(root), "key")))
93+ throw new UsageError(`${root} already has a key, so it signs in with that: leave off --token-file`);
94+ const token = trustedToken(server, env, file());
95+ if (!token) throw new UsageError("--token-file reads ~/.abso/token, and this machine has none");
96+ return { token, words: "the token file, ~/.abso/token, as --token-file asks" };
97+ }
98+ const named = fromEnv(env, "TOKEN")?.trim();
99+ if (named) return { token: trustedToken(server, env, named), words: "ABSO_TOKEN" };
100+ const run = runKey(env);
101+ if (run) return { token: trustedToken(server, env, run), words: "a pipeline run's key (ABSO_KEY_FILE)" };
102+ return undefined;
103+}
105+/**
106+ * --local (abso init, abso join): the project's history is in a store on this machine, not on a server. The store is
107+ * --store, else ABSO_STORE, else the OS's data folder; one given with --store is kept in the folder's config.
108+ */
109+function localFrom(args: Parsed, env: Env, command: string): { dir: string; settings: { store?: string } } | undefined {
110+ const store = str(args, "store");
111+ if (!bool(args, "local")) {
112+ if (store !== undefined)
113+ throw new UsageError("--store goes with --local: it says where a local project's history is");
114+ return undefined;
115+ }
116+ if (str(args, "server") !== undefined)
117+ throw new UsageError("--local or --server, not both: a local project has no server");
118+ if (str(args, "org") !== undefined || bool(args, "public") || bool(args, "private") || bool(args, "reader"))
119+ throw new UsageError(
120+ `abso ${command} --local takes --project, --agent, --store and --as-is; a local project has no server to share it`,
121+ );
122+ const dir = storeDir(env.env, store, env.cwd);
123+ if (dir === undefined) throw new UsageError(NO_STORE);
124+ return { dir, settings: store === undefined ? {} : { store: dir } };
125+}
127+/** A store inside the project folder is left out of its files: a line in .absoignore. Its relative path, if so. */
128+function ignoreStoreInside(root: string, dir: string): string | undefined {
129+ const rel = relative(root, dir);
130+ if (rel === "" || rel.startsWith("..") || isAbsolute(rel)) return undefined;
131+ const line = `/${rel.split(sep).join("/")}/`;
132+ const file = join(root, ".absoignore");
133+ const had = existsSync(file) ? readFileSync(file, "utf8") : "";
134+ const lines = had.split(/\r?\n/);
135+ if (!lines.includes(line)) {
136+ const gap = had === "" || had.endsWith("\n") ? "" : "\n";
137+ writeFileSync(file, `${had}${gap}${line}\n`);
138+ }
139+ return rel;
140+}
142+/** What init and join say about a local project's store. */
143+function localText(dir: string, project: string, ignored?: string): string {
144+ return `It's a local project: its history is in ${join(dir, project)}, on this machine, and no server is needed.${ignored === undefined ? "" : ` .absoignore leaves the store, ${ignored}, out of the project's files.`}`;
145+}
147+/** Why a token file is no fallback: said when one is here and nothing else signs in. */
148+const TOKEN_FILE_ASKED = "~/.abso/token is used only with --token-file.";
51150export async function runInit(args: Parsed, env: Env): Promise<Output> {
52151 if (args.positionals.length > 1) throw new UsageError("init takes one folder");
53152 const root = resolve(env.cwd, args.positionals[0] ?? ".");
Lines 154–214 at 318 (were 55–76 at 97)
55154 if (findRoot(root) === root) throw new UsageError(`${root} already has .abso/config.json`);
56155 const project = str(args, "project");
57156 if (!project) throw new UsageError("give the project a name with --project <name>");
58− const config = makeSettings(args, env, project);
157+ // Checked before any call: a name like ".." would otherwise go out as part of the request's path.
158+ if (!NAME.test(project))
159+ throw new UsageError(
160+ `project names are letters, digits, dot, dash and underscore (got ${JSON.stringify(project)})`,
161+ );
162+ if (bool(args, "public") && bool(args, "private")) throw new UsageError("--public or --private, not both");
163+ const local = localFrom(args, env, "init");
164+ // A box signed in here, and no other credential asked for: the project is made as the person who approved the box,
165+ // the way the website makes one (abso 663). The token file only with --token-file, never by itself.
166+ const server = local ? LOCAL : serverFrom(args, env);
167+ const box = local ? undefined : readBox(server);
168+ const credential = local ? undefined : tokenCredential(args, env.env, server, root);
169+ const say = env.writeErr ?? env.write;
170+ if (box && credential === undefined) {
171+ say(`Signing in with this box's sign-in, ${box.id}.
172+`);
173+ return initFromBox(args, env, root, project, server, box);
174+ }
175+ if (!local && credential === undefined && tokenFile() !== undefined)
176+ throw new UsageError(
177+ `abso init signs in with this box's sign-in, and this box isn't signed in to ${server}: abso login signs it in. ${TOKEN_FILE_ASKED}`,
178+ );
179+ const org = str(args, "org");
180+ if (org !== undefined) return initInOrg(org, server);
181+ const config: Settings = local
182+ ? { server: LOCAL, project, agent: agentFrom(args, str(args, "agent") ?? defaultAgentName()), ...local.settings }
183+ : makeSettings(args, env, project);
59184 const asIs = bool(args, "as-is");
60185 const absoignore = join(root, ".absoignore");
61186 const wroteIgnore = !asIs && !existsSync(absoignore) && !existsSync(join(root, ".avcsignore"));
62187 if (wroteIgnore) writeFileSync(absoignore, STARTING_ABSOIGNORE);
188+ // A store kept inside the project folder, like a virtual environment, isn't the project's files.
189+ const ignoredStore = local ? ignoreStoreInside(root, local.dir) : undefined;
63190 // What the server runs on each new version (#39), guessed from package.json; recorded with the rest.
64191 const wroteProject = asIs ? "exists" : writeStartingProjectFile(root);
65192 const { files, blobs, modes, leftOut } = readFolder(root, loadIgnore(root));
66− const token = tokenFor(config.server, env.env);
67− const api = new Api({ ...config, ...(token ? { token } : {}) });
68− await uploadBlobs(api, blobs);
69− const answer = await api.init(
70− Object.fromEntries(files),
71− modes,
72− Object.fromEntries([...blobs].map(([rel, b]) => [rel, b.sha])),
73− );
193+ const token = credential?.token;
194+ if (!local)
195+ say(`Signing in with ${credential?.words ?? `no credential: nothing here signs in to ${server}`}.
196+`);
197+ const api = new Api({ ...config, ...(token ? { token } : {}), ...(local ? { localStore: local.dir } : {}) });
198+ let answer: Awaited<ReturnType<Api["init"]>>;
199+ try {
200+ await uploadBlobs(api, blobs);
201+ answer = await api.init(
202+ Object.fromEntries(files),
203+ modes,
204+ Object.fromEntries([...blobs].map(([rel, b]) => [rel, b.sha])),
205+ );
206+ } catch (error) {
207+ // No project was made: the starting files init wrote go too, so the folder is as it was.
208+ if (wroteIgnore) rmSync(absoignore, { force: true });
209+ if (typeof wroteProject !== "string") rmSync(join(root, projectFileName(root)), { force: true });
210+ throw error;
211+ }
74212 writeConfig(root, config);
75213 clearKnown(root);
76214 for (const [rel, text] of files) writeKnown(root, rel, text);
Lines 224–237 at 318 (were 86–97 at 97)
86224 ...(wroteIgnore
87225 ? ["Wrote a starting .absoignore (Claude Code state and operating system files); edit it like .gitignore."]
88226 : []),
89− ...startingProjectFileText(wroteProject),
227+ // A local project has no CI to run abso.json, so no word about one that isn't there.
228+ ...(local && wroteProject === "nothing" ? [] : startingProjectFileText(wroteProject)),
90229 ...(answer.skipped && answer.skipped.length > 0 ? [`The server skipped: ${answer.skipped.join(", ")}.`] : []),
230+ ...(local ? [localText(local.dir, project, ignoredStore)] : []),
91231 `This folder is agent ${config.agent}. Settings are in .abso/config.json.`,
92232 ...refusedText(synced.refused),
93233 ...(synced.kept.length > 0 ? [`Kept your copy of ${synced.kept.join(", ")}.`] : []),
94− hookHint(env.env),
234+ hookHint(env.env, local !== undefined),
95235 ].join("\n"),
96236 json: {
97237 project,
Lines 242–353 at 318 (were 102–112 at 97)
102242 wroteAbsoignore: wroteIgnore,
103243 wroteProjectFile: typeof wroteProject === "string" ? null : wroteProject,
104244 leftOut,
245+ ...(local ? { store: local.dir } : {}),
105246 },
106247 };
107248}
108249
250+/** 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. */
251+const BOX_INIT_MAX = 24 * 1024 * 1024;
252+/** The Idempotency-Key of an abso init that didn't finish, so running it again makes the same project (abso 663). */
253+const INIT_KEY = "init-key";
109255/**
256+ * abso init from a signed-in box (abso 663): the server makes the project as the person who approved the box, the way the
257+ * website's New project does (owner, visibility, address), with the folder as its first version. This folder then
258+ * joins it like abso join, with its own key from the box, so it works at once with no new approval.
259+ */
260+async function initFromBox(
261+ args: Parsed,
262+ env: Env,
263+ root: string,
264+ project: string,
265+ server: string,
266+ box: BoxRecord,
267+): Promise<Output> {
268+ if (!NAME.test(project))
269+ throw new UsageError(
270+ `project names are letters, digits, dot, dash and underscore (got ${JSON.stringify(project)})`,
271+ );
272+ const named = str(args, "agent");
273+ if (named !== undefined) agentFrom(args);
274+ const asIs = bool(args, "as-is");
275+ const absoignore = join(root, ".absoignore");
276+ const wroteIgnore = !asIs && !existsSync(absoignore) && !existsSync(join(root, ".avcsignore"));
277+ if (wroteIgnore) writeFileSync(absoignore, STARTING_ABSOIGNORE);
278+ const wroteProject = asIs ? "exists" : writeStartingProjectFile(root);
279+ const { files, blobs, leftOut } = readFolder(root, loadIgnore(root));
280+ const listed: NonNullable<NewProject["files"]>[number][] = [
281+ ...[...files].map(([path, text]) => ({ path, text })),
282+ ...[...blobs].map(([path, b]) => ({ path, base64: Buffer.from(b.bytes).toString("base64") })),
283+ ];
284+ const org = str(args, "org");
285+ const body: NewProject = {
286+ name: project,
287+ ...(org === undefined ? {} : { owner: org }),
288+ ...(bool(args, "public")
289+ ? { visibility: "public" as const }
290+ : bool(args, "private")
291+ ? { visibility: "private" as const }
292+ : {}),
293+ ...(listed.length > 0 ? { files: listed } : {}),
294+ };
295+ if (JSON.stringify(body).length > BOX_INIT_MAX)
296+ throw new UsageError(
297+ `${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.`,
298+ );
299+ // One key per folder until it finishes: running the same abso init again is the same project, never a second.
300+ const keyPath = join(stateDir(root), INIT_KEY);
301+ let key = existsSync(keyPath) ? readFileSync(keyPath, "utf8").trim() : "";
302+ if (!/^[0-9a-f-]{36}$/.test(key)) {
303+ key = randomUUID();
304+ mkdirSync(stateDir(root), { recursive: true });
305+ writeFileSync(keyPath, key);
306+ }
307+ const made = await boxCreateProject(box, body, key);
308+ const visibility = typeof made.visibility === "string" ? made.visibility : "private";
309+ const minted =
310+ named !== undefined
311+ ? { ...(await mintKey(box, project, named)), agent: named }
312+ : await mintFreeName(box, project, defaultAgentName());
313+ const config = { server, project, agent: minted.agent };
314+ writeConfig(root, config);
315+ clearKnown(root);
316+ installKey(root, JSON.stringify({ key: minted.key, id: minted.id }));
317+ rmSync(keyPath, { force: true });
318+ const synced = await syncFolder(root, new Api(readConfig(root, env.env)), true);
319+ const owner = org ?? "you";
320+ return {
321+ text: [
322+ `Created project ${project} (${visibility}, owned by ${owner}) at version ${synced.version} from ${plural(listed.length, "file")} in ${root}.`,
323+ ...leftOutText(leftOut),
324+ ...(wroteIgnore
325+ ? ["Wrote a starting .absoignore (Claude Code state and operating system files); edit it like .gitignore."]
326+ : []),
327+ ...startingProjectFileText(wroteProject),
328+ `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.`,
329+ ...refusedText(synced.refused),
330+ ...(synced.written.length > 0 ? [`Wrote ${plural(synced.written.length, "file")} from shared.`] : []),
331+ hookHint(env.env),
332+ ].join("\n"),
333+ json: {
334+ project,
335+ id: made.id ?? null,
336+ owner: made.owner ?? null,
337+ visibility,
338+ version: synced.version,
339+ files: listed.length,
340+ root,
341+ agent: minted.agent,
342+ key_id: minted.id,
343+ wroteAbsoignore: wroteIgnore,
344+ wroteProjectFile: typeof wroteProject === "string" ? null : wroteProject,
345+ leftOut,
346+ },
347+ };
348+}
350+/**
110351 * Where abso join writes: --dir, else here when --agent is given (as before, so a folder prepared with
111352 * abso key install --server is joined where its key is). With no --agent: here when this folder is empty, else
112353 * ./<project>, which has to be new or empty so nobody's files are written over. A folder holding only abso's own
Lines 391–397 at 318 (were 150–156 at 97)
150391async function signedOut(server: string, project: string): Promise<string> {
151392 return (await isPublic(server, project))
152393 ? `${project} is public: read it at ${siteOf(server)}/${SITE_OWNER}/${project} (every page is also JSON), or here with abso join ${project} --reader. To work on it: abso login.`
153− : `This box isn't signed in to ${server}. abso login signs it in.`;
394+ : `This box isn't signed in to ${server}. abso login signs it in.${elsewhereText(server, `abso join ${project}`)}`;
154395}
155396
156397/** A folder that reads a public project signed out: no agent, no key, no copy of the files. */
Lines 416–431 at 318 (were 175–180 at 97)
175416 };
176417}
177418
419+/** A join that failed before writing files: its state goes, but a key (already here, or made for it) stays for the next try. */
420+function takeBackJoin(root: string): void {
421+ const dir = stateDir(root);
422+ if (!existsSync(join(dir, "key"))) {
423+ rmSync(dir, { recursive: true, force: true });
424+ return;
425+ }
426+ for (const entry of readdirSync(dir)) if (entry !== "key") rmSync(join(dir, entry), { recursive: true, force: true });
427+}
178429export async function runJoin(args: Parsed, env: Env): Promise<Output> {
179430 if (args.positionals.length !== 1) throw new UsageError("join takes the project name: abso join <project>");
180431 const project = args.positionals[0]!;
Lines 437–458 at 318 (were 186–199 at 97)
186437 mkdirSync(root, { recursive: true });
187438 if (findRoot(root) === root) throw new UsageError(`${root} already has .abso/config.json`);
188439 const reader = bool(args, "reader");
189− const server = serverFrom(args, env);
190− const box = readBox(server);
191− const hasKey = existsSync(join(stateDir(root), "key"));
440+ // A local project: no box, key or credential, and the agent is --agent or this computer's name.
441+ const local = localFrom(args, env, "join");
442+ const server = local ? LOCAL : serverFrom(args, env);
443+ const box = local ? undefined : readBox(server);
444+ const hasKey = !local && existsSync(join(stateDir(root), "key"));
445+ const credential = local ? undefined : tokenCredential(args, env.env, server, root);
446+ const tokenFileAsked = bool(args, "token-file");
192447 let agent: string;
193448 let minted: { key: string; id: string } | undefined;
194− if (str(args, "agent") !== undefined) {
449+ if (local) agent = agentFrom(args, str(args, "agent") ?? defaultAgentName());
450+ else if (str(args, "agent") !== undefined) {
195451 agent = agentFrom(args);
196− minted = box && !hasKey && !fromEnv(env.env, "KEY_FILE") ? await mintKey(box, project, agent) : undefined;
452+ minted =
453+ box && !hasKey && !fromEnv(env.env, "KEY_FILE") && !tokenFileAsked
454+ ? await mintKey(box, project, agent)
455+ : undefined;
197456 } else if (fromEnv(env.env, "KEY_FILE")) {
198457 // A pipeline run's key (ABSO_KEY_FILE) belongs to one agent, which the runner names in ABSO_AGENT.
199458 const named = fromEnv(env.env, "AGENT");
Lines 472–524 at 318 (were 213–246 at 97)
213472 agent = free.agent;
214473 minted = { key: free.key, id: free.id };
215474 }
216− const config = { server, project, agent, ...(reader ? { reader: true } : {}) };
475+ const config = { server, project, agent, ...(reader ? { reader: true } : {}), ...local?.settings };
217476 writeConfig(root, config);
218477 clearKnown(root);
219478 if (minted) installKey(root, JSON.stringify(minted));
220− const settings = readConfig(root, env.env);
479+ // The token file only with --token-file: readConfig reads it otherwise.
480+ let read: ReturnType<typeof readConfig>;
481+ try {
482+ read = readConfig(root, env.env, false);
483+ } catch (error) {
484+ takeBackJoin(root);
485+ throw error;
486+ }
487+ const settings = tokenFileAsked ? { ...read, token: credential?.token } : read;
488+ if (!local)
489+ (env.writeErr ?? env.write)(
490+ `Signing in with ${minted && box ? `a new key from this box's sign-in, ${box.id}` : hasKey ? "this folder's key" : (credential?.words ?? `no credential: nothing here signs in to ${server}`)}.
491+`,
492+ );
221493 const api = new Api(settings);
222− let synced: Awaited<ReturnType<typeof syncFolder>>;
494+ let answer: SyncAnswer;
223495 try {
224496 // Before the sync, so the server never takes a record from this folder.
225497 if (reader) await api.reader(true);
226498 // Every file, even when the server has seen this agent sync before: its plain sync answer would hold only what changed since (#37).
227− synced = await syncFolder(root, api, true);
499+ answer = await pullAnswer(root, api, true);
228500 } catch (error) {
501+ // Nothing is written yet: take back what join wrote so it can run again here.
502+ takeBackJoin(root);
229503 if (!(error instanceof ApiError && error.status === 401 && !box && !settings.token)) throw error;
230− rmSync(stateDir(root), { recursive: true, force: true });
231− throw new UsageError(await signedOut(config.server, project));
504+ const why = await signedOut(config.server, project);
505+ throw new UsageError(!tokenFileAsked && tokenFile() !== undefined ? `${why} ${TOKEN_FILE_ASKED}` : why);
232506 }
507+ const synced = await applyAnswer(root, api, answer);
508+ pullWritten(root);
233509 return {
234510 text: [
235− `Joined ${project} as ${config.agent} at version ${synced.version}: wrote ${plural(synced.written.length, "file")} into ${root}.${reader ? " It is a reader: status, sync, log, show, files and export work, and nothing it does is recorded or published." : ""}${minted ? ` It signs in with its own key, ${minted.id}, made from this box's sign-in.` : ""}`,
511+ `Joined ${project} as ${config.agent} at version ${synced.version}: wrote ${plural(synced.written.length, "file")} into ${root}.${reader ? " It is a reader: status, pull, log, show, files and export work, and nothing it does is recorded or pushed." : ""}${minted ? ` It signs in with its own key, ${minted.id}, made from this box's sign-in.` : ""}`,
236512 ...refusedText(synced.refused),
237513 ...(synced.kept.length > 0
238514 ? [
239515 `These files were already here and differ from shared, so they were left alone: ${synced.kept.join(", ")}. abso record sends them as your changes.`,
240516 ]
241517 : []),
518+ ...(local ? [localText(local.dir, project)] : []),
519+ ...emptyHint(synced.version, synced.written.length, synced.kept.length, reader),
242520 ...setupHint(root),
243− hookHint(env.env),
521+ hookHint(env.env, local !== undefined),
244522 ...(root === resolve(env.cwd) ? [] : [`cd ${relative(env.cwd, root) || root}`]),
245523 ].join("\n"),
246524 json: {
Lines 542–559 at 318 (were 264–271 at 97)
264542 : [`Nothing is installed yet. Before building or testing here, run ${projectFileName(root)}'s setup: ${setup}`];
265543}
266544
267−function hookHint(env: Readonly<Record<string, string | undefined>>): string {
268− return modInstalled(env)
269− ? "Edits made by Claude Code here are recorded by the abso mod on this machine, signed in as this folder. Anything else: abso record."
270− : `Edits made by Claude Code reach the server through the abso mod, which isn't on this machine yet: node ${join(CLIENT_DIR, "install-mod.ts")} installs it, and new chats load it. Anything else: abso record.`;
545+function hookHint(env: Readonly<Record<string, string | undefined>>, local = false): string {
546+ // A local project has no server: the mod hands its edits to abso hook, when it was installed with one to hand them to.
547+ if (local) {
548+ if (modHandsLocal(env))
549+ return "Edits made by Claude Code here are recorded by the abso mod on this machine, through abso hook. Anything else: abso record.";
550+ if (modInstalled(env) && !builtCopy())
551+ return `abso record sends the edits made here: the abso mod on this machine is older than local projects. ${installerCommand("install-mod.ts")} updates it, and new chats load it.`;
552+ return "abso record sends the edits made here, whoever made them.";
553+ }
554+ if (modInstalled(env))
555+ return "Edits made by Claude Code here are recorded by the abso mod on this machine, signed in as this folder. Anything else: abso record.";
556+ // A built copy (the npm package) has no installer to point at (abso-core 18).
557+ if (builtCopy()) return "abso record sends the edits made here, whoever made them.";
558+ return `Edits made by Claude Code reach the server through the abso mod, which isn't on this machine yet: ${installerCommand("install-mod.ts")} installs it, and new chats load it. Anything else: abso record.`;
271559}
MCP
compare on this site's /mcp
CLI
abso diff 97 318 client/src/join-commands.ts --json
JSON
/christopher/abso-core/compare/97..318?file=client%2Fsrc%2Fjoin-commands.ts&format=json