Lines 6–21 at 28 (were 6–13 at 27)
66import { existsSync, readFileSync, writeFileSync } from "node:fs"; 77import { join } from "node:path"; 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"; 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; 1119/** Each key optional; an empty string counts as missing. */ 1220export interface ProjectFile { 1321 readonly setup: string; Lines 28–49 at 28 (were 20–41 at 27)
2129const KEYS = ["setup", "check", "build", "out"] as const; 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; 2938 raw = JSON.parse(readFileSync(path, "utf8")); 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})` }; 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` }; 4048 const get = (k: (typeof KEYS)[number]) => ((o[k] as string | undefined) ?? "").trim(); Lines 60–66 at 28 (were 52–58 at 27)
5260/** npm's placeholder test script, which always fails. */ 5361const NO_TEST = /no test specified/; 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 { 5866 scripts?: Record<string, unknown>; Lines 88–107 at 28 (were 80–99 at 27)
83− * Writes a guessed avcs.json when the folder has none and package.json gives
91+ * Writes a guessed abso.json (unless it has abso.json or avcs.json) when the folder has none and package.json gives 8492 * a check or a build to guess (#39, Agent VCS: 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. 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`); 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") {