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

Compare

+24 −7 in 4 places
Lines 1–25 at 318 (were 1–24 at 29)
11// abso export <dir> [--version N]: one published version of this folder's
22// space, written to a folder of its own, for a build that doesn't move while
3−// shared does (#37, Playtester 1). The folder gets .abso-export naming the
3+// shared does (#37). The folder gets .abso-export naming the
44// version, to stamp the build with: JSON on one line, in a file with no
55// extension, so the exported project's own formatter and linter pass it by.
66// Exporting again replaces the folder, keeping node_modules (and what --keep
77// names) so a build needs no new install.
88//
99// The version is rebuilt as `abso run --at` rebuilds it (at.ts), from the
10−// known copies and one compare; the server's listing of that version (#37,
11−// Engine 522be7f) then checks that no file is left out.
10+// known copies and one compare; the server's listing of that version (#37)
11+// then checks that no file is left out.
1212
1313import { chmodSync, existsSync, mkdirSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
1414import { dirname, join, resolve } from "node:path";
1515import type { Where } from "./api.ts";
1616import { type Parsed, str, UsageError } from "./args.ts";
17−import { globTest, snapshotAt, snapshotEntries } from "./at.ts";
18−import { type Env, type Output, open, plural } from "./commands.ts";
17+import { applySide, globTest, snapshotAt, snapshotEntries } from "./at.ts";
18+import { type Env, EXIT, type Output, open, plural } from "./commands.ts";
1919import { ignoredHere } from "./fetch.ts";
2020import { loadIgnore, relativeTo } from "./folder.ts";
2121import { type Refused, unsafePath } from "./safety.ts";
22+import { refusalText, versionsText, withoutArg } from "./without.ts";
2223
2324/** The file an export leaves in its folder: what it holds, and the sign that the folder is one export may replace. */
2425export const EXPORT_STAMP = ".abso-export";
Lines 82–92 at 318 (were 81–88 at 29)
8182 const rawVersion = str(args, "version");
8283 if (rawVersion !== undefined && !/^\d+$/.test(rawVersion))
8384 throw new UsageError(`--version is a version number (got ${JSON.stringify(rawVersion)})`);
85+ const leave = withoutArg(args);
8486 const diff = await api.diff();
8587 const where: Where = { draft: diff.draft };
88+ if (leave !== undefined && diff.draft !== null)
89+ throw new UsageError(`--without reads shared, and this folder is on draft ${diff.draft}`);
8690 // The listing names the version (the newest by default) and every file it holds; a server from before it answers 404.
8791 const listing = await api
8892 .filesAt(diff.draft, rawVersion === undefined ? undefined : Number(rawVersion))
Lines 106–127 at 318 (were 102–111 at 29)
102106 else
103107 skipped.push({
104108 path: rel,
105− why: "a binary file this folder has no copy of; abso sync --full, then export again",
109+ why: "a binary file this folder has no copy of; abso pull --full, then export again",
106110 });
107111 }
108112 }
113+ // Without some versions: the server says what differs from this version, as it is without them.
114+ const without = leave === undefined ? undefined : await api.without(version, leave);
115+ if (without !== undefined && !without.ok)
116+ return {
117+ exit: EXIT.refused,
118+ text: refusalText(
119+ without,
120+ (vs) => `abso export ${args.positionals[0]} --version ${version} --without ${vs.join(",")}`,
121+ ),
122+ json: { ...without },
123+ };
124+ if (without !== undefined) applySide(snap, without.files, "after");
109125 const entries = await snapshotEntries(api, snap);
110126 // Built before anything is removed, so a failed export leaves an earlier one whole.
111127 const keepGlob = str(args, "keep");
Lines 151–164 at 318 (were 135–147 at 29)
135151 project: config.project,
136152 space: diff.draft ?? "shared",
137153 version,
154+ ...(without !== undefined ? { without: without.without.map((w) => w.version), tree: without.tree } : {}),
138155 files: written,
139156 exportedAt: new Date().toISOString(),
140157 };
141158 writeFileSync(join(target, EXPORT_STAMP), `${JSON.stringify(stamp)}\n`);
142159 return {
143160 text: [
144− `Exported version ${version} of ${space} to ${target}: ${plural(written, "file")}. ${EXPORT_STAMP} there names the version; abso export to the same folder replaces it.`,
161+ `Exported version ${version} of ${space}${without !== undefined ? ` without ${versionsText(without.without.map((w) => w.version))}` : ""} to ${target}: ${plural(written, "file")}. ${EXPORT_STAMP} there names the version; abso export to the same folder replaces it.`,
145162 ...(kept.length > 0 ? [`Kept from the earlier export: ${kept.join(", ")}.`] : []),
146163 ...(skipped.length > 0
147164 ? [`Not exported (${skipped.length}):`, ...skipped.map((s) => ` ${s.path}: ${s.why}`)]
MCP
compare on this site's /mcp
CLI
abso diff 29 318 client/src/export.ts --json
JSON
/christopher/abso-core/compare/29..318?file=client%2Fsrc%2Fexport.ts&format=json