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

Compare

+22 −14 in 5 places
Lines 6–21 at 318 (were 6–13 at 14)
66import { existsSync, readFileSync, writeFileSync } from "node:fs";
77import { join } from "node:path";
88
9−export const PROJECT_FILE = "avcs.json";
9+/** The project file's name: abso.json, or avcs.json from before the rename. A new one is written as abso.json. */
10+export const PROJECT_FILE = "abso.json";
11+export const OLD_PROJECT_FILE = "avcs.json";
1012
13+/** The name the folder's project file has: abso.json when it is there, else avcs.json when that is, else the new name. */
14+export function projectFileName(root: string): string {
15+ if (existsSync(join(root, PROJECT_FILE))) return PROJECT_FILE;
16+ return existsSync(join(root, OLD_PROJECT_FILE)) ? OLD_PROJECT_FILE : PROJECT_FILE;
17+}
1119/** Each key optional; an empty string counts as missing. */
1220export interface ProjectFile {
1321 readonly setup: string;
Lines 28–49 at 318 (were 20–41 at 14)
2028
2129const KEYS = ["setup", "check", "build", "out"] as const;
2230
23−/** The folder's avcs.json, or why it can't be read; null when there is none. */
31+/** The folder's abso.json (or avcs.json), or why it can't be read; null when there is none. */
2432export function readProjectFile(root: string): { file: ProjectFile } | { error: string } | null {
25− const path = join(root, PROJECT_FILE);
33+ const name = projectFileName(root);
34+ const path = join(root, name);
2635 if (!existsSync(path)) return null;
2736 let raw: unknown;
2837 try {
2938 raw = JSON.parse(readFileSync(path, "utf8"));
3039 } catch (e) {
31− return { error: `${PROJECT_FILE} isn't valid JSON (${(e as Error).message})` };
40+ return { error: `${name} isn't valid JSON (${(e as Error).message})` };
3241 }
3342 if (typeof raw !== "object" || raw === null || Array.isArray(raw))
34− return { error: `${PROJECT_FILE} should hold an object, like {"check": "npm test"}` };
43+ return { error: `${name} should hold an object, like {"check": "npm test"}` };
3544 const o = raw as Record<string, unknown>;
3645 for (const k of KEYS) {
37− if (o[k] !== undefined && typeof o[k] !== "string")
38− return { error: `"${k}" in ${PROJECT_FILE} should be a string` };
46+ if (o[k] !== undefined && typeof o[k] !== "string") return { error: `"${k}" in ${name} should be a string` };
3947 }
4048 const get = (k: (typeof KEYS)[number]) => ((o[k] as string | undefined) ?? "").trim();
4149 return {
Lines 60–66 at 318 (were 52–58 at 14)
5260/** npm's placeholder test script, which always fails. */
5361const NO_TEST = /no test specified/;
5462
55−/** A starting avcs.json, guessed from package.json; empty where nothing can be guessed. */
63+/** A starting abso.json, guessed from package.json; empty where nothing can be guessed. */
5664export function guessProjectFile(root: string): ProjectFile {
5765 let pkg: {
5866 scripts?: Record<string, unknown>;
Lines 88–112 at 318 (were 80–104 at 14)
8088}
8189
8290/**
83− * Writes a guessed avcs.json when the folder has none and package.json gives
84− * a check or a build to guess (#39, Agent VCS: a project with nothing to
91+ * Writes a guessed abso.json (unless it has abso.json or avcs.json) when the folder has none and package.json gives
92+ * a check or a build to guess (#39: a project with nothing to
8593 * check shouldn't start boxes; CI skips a version with nothing to run).
8694 * Answers what it wrote; 'exists' or 'nothing' when it wrote none.
8795 */
8896export function writeStartingProjectFile(root: string): ProjectFile | "exists" | "nothing" {
89− if (existsSync(join(root, PROJECT_FILE))) return "exists";
97+ if (existsSync(join(root, PROJECT_FILE)) || existsSync(join(root, OLD_PROJECT_FILE))) return "exists";
9098 const guess = guessProjectFile(root);
9199 if (guess.check === "" && guess.build === "") return "nothing";
92100 writeFileSync(join(root, PROJECT_FILE), `${JSON.stringify(guess, null, 2)}\n`);
93101 return guess;
94102}
95103
96−/** What init says about avcs.json. */
104+/** What init says about abso.json. */
97105export function startingProjectFileText(wrote: ProjectFile | "exists" | "nothing"): string[] {
98106 if (wrote === "exists") return [];
99107 if (wrote === "nothing") {
100108 return [
101− `No ${PROJECT_FILE} written: package.json gives no check or build to guess, so CI has nothing to run on each new version. To give it a check, publish an ${PROJECT_FILE} like {"check": "npm test"} (abso ci --help says what it runs).`,
109+ `No ${PROJECT_FILE} written: package.json gives no check or build to guess, so CI has nothing to run on each new version. To give it a check, push an ${PROJECT_FILE} like {"check": "npm test"} (abso ci --help says what it runs).`,
102110 ];
103111 }
104112 const set = KEYS.filter((k) => wrote[k] !== "").map((k) => `${k} "${wrote[k]}"`);
Lines 115–121 at 318 (were 107–113 at 14)
107115 [
108116 `Wrote ${PROJECT_FILE}: CI will run on every new version of shared (${set.join(", ")}).`,
109117 empty.length > 0 ? ` Fill in ${empty.join(", ")} when the project has them.` : "",
110− " abso publish --check with no command runs its build and check.",
118+ " abso push --check with no command runs its build and check.",
111119 ].join(""),
112120 ];
113121}
MCP
compare on this site's /mcp
CLI
abso diff 14 318 client/src/project-file.ts --json
JSON
/christopher/abso-core/compare/14..318?file=client%2Fsrc%2Fproject-file.ts&format=json