{"file":"client/src/project-file.ts","version":318,"total":121,"from":1,"to":121,"lines":[{"n":1,"text":"// avcs.json: what the project runs to check and build a version (#39). It is","atom":"a0","author":"init","version":0},{"n":2,"text":"// recorded and published like any file, so each version carries its own; the","atom":"a0","author":"init","version":0},{"n":3,"text":"// server's job for each new shared version reads it, and publish --check with","atom":"a0","author":"init","version":0},{"n":4,"text":"// no command runs its check.","atom":"a0","author":"init","version":0},{"n":5,"text":"","atom":"a0","author":"init","version":0},{"n":6,"text":"import { existsSync, readFileSync, writeFileSync } from \"node:fs\";","atom":"a0","author":"init","version":0},{"n":7,"text":"import { join } from \"node:path\";","atom":"a0","author":"init","version":0},{"n":8,"text":"","atom":"a0","author":"init","version":0},{"n":9,"text":"/** The project file's name: abso.json, or avcs.json from before the rename. A new one is written as abso.json. */","atom":"a236","author":"review","version":28},{"n":10,"text":"export const PROJECT_FILE = \"abso.json\";","atom":"a236","author":"review","version":28},{"n":11,"text":"export const OLD_PROJECT_FILE = \"avcs.json\";","atom":"a236","author":"review","version":28},{"n":12,"text":"","atom":"a0","author":"init","version":0},{"n":13,"text":"/** The name the folder's project file has: abso.json when it is there, else avcs.json when that is, else the new name. */","atom":"a236","author":"review","version":28},{"n":14,"text":"export function projectFileName(root: string): string {","atom":"a236","author":"review","version":28},{"n":15,"text":"\tif (existsSync(join(root, PROJECT_FILE))) return PROJECT_FILE;","atom":"a236","author":"review","version":28},{"n":16,"text":"\treturn existsSync(join(root, OLD_PROJECT_FILE)) ? OLD_PROJECT_FILE : PROJECT_FILE;","atom":"a236","author":"review","version":28},{"n":17,"text":"}","atom":"a236","author":"review","version":28},{"n":18,"text":"","atom":"a236","author":"review","version":28},{"n":19,"text":"/** Each key optional; an empty string counts as missing. */","atom":"a0","author":"init","version":0},{"n":20,"text":"export interface ProjectFile {","atom":"a0","author":"init","version":0},{"n":21,"text":"\treadonly setup: string;","atom":"a0","author":"init","version":0},{"n":22,"text":"\treadonly check: string;","atom":"a0","author":"init","version":0},{"n":23,"text":"\treadonly build: string;","atom":"a0","author":"init","version":0},{"n":24,"text":"\treadonly out: string;","atom":"a0","author":"init","version":0},{"n":25,"text":"\t/** The merge queue (#39): publishes to shared land only once the project's check passes on them. */","atom":"a0","author":"init","version":0},{"n":26,"text":"\treadonly queue?: boolean;","atom":"a0","author":"init","version":0},{"n":27,"text":"}","atom":"a0","author":"init","version":0},{"n":28,"text":"","atom":"a0","author":"init","version":0},{"n":29,"text":"const KEYS = [\"setup\", \"check\", \"build\", \"out\"] as const;","atom":"a0","author":"init","version":0},{"n":30,"text":"","atom":"a0","author":"init","version":0},{"n":31,"text":"/** The folder's abso.json (or avcs.json), or why it can't be read; null when there is none. */","atom":"a236","author":"review","version":28},{"n":32,"text":"export function readProjectFile(root: string): { file: ProjectFile } | { error: string } | null {","atom":"a0","author":"init","version":0},{"n":33,"text":"\tconst name = projectFileName(root);","atom":"a236","author":"review","version":28},{"n":34,"text":"\tconst path = join(root, name);","atom":"a236","author":"review","version":28},{"n":35,"text":"\tif (!existsSync(path)) return null;","atom":"a0","author":"init","version":0},{"n":36,"text":"\tlet raw: unknown;","atom":"a0","author":"init","version":0},{"n":37,"text":"\ttry {","atom":"a0","author":"init","version":0},{"n":38,"text":"\t\traw = JSON.parse(readFileSync(path, \"utf8\"));","atom":"a0","author":"init","version":0},{"n":39,"text":"\t} catch (e) {","atom":"a0","author":"init","version":0},{"n":40,"text":"\t\treturn { error: `${name} isn't valid JSON (${(e as Error).message})` };","atom":"a236","author":"review","version":28},{"n":41,"text":"\t}","atom":"a0","author":"init","version":0},{"n":42,"text":"\tif (typeof raw !== \"object\" || raw === null || Array.isArray(raw))","atom":"a0","author":"init","version":0},{"n":43,"text":"\t\treturn { error: `${name} should hold an object, like {\"check\": \"npm test\"}` };","atom":"a236","author":"review","version":28},{"n":44,"text":"\tconst o = raw as Record<string, unknown>;","atom":"a0","author":"init","version":0},{"n":45,"text":"\tfor (const k of KEYS) {","atom":"a0","author":"init","version":0},{"n":46,"text":"\t\tif (o[k] !== undefined && typeof o[k] !== \"string\") return { error: `\"${k}\" in ${name} should be a string` };","atom":"a236","author":"review","version":28},{"n":47,"text":"\t}","atom":"a0","author":"init","version":0},{"n":48,"text":"\tconst get = (k: (typeof KEYS)[number]) => ((o[k] as string | undefined) ?? \"\").trim();","atom":"a0","author":"init","version":0},{"n":49,"text":"\treturn {","atom":"a0","author":"init","version":0},{"n":50,"text":"\t\tfile: {","atom":"a0","author":"init","version":0},{"n":51,"text":"\t\t\tsetup: get(\"setup\"),","atom":"a0","author":"init","version":0},{"n":52,"text":"\t\t\tcheck: get(\"check\"),","atom":"a0","author":"init","version":0},{"n":53,"text":"\t\t\tbuild: get(\"build\"),","atom":"a0","author":"init","version":0},{"n":54,"text":"\t\t\tout: get(\"out\"),","atom":"a0","author":"init","version":0},{"n":55,"text":"\t\t\t...(o.queue === true ? { queue: true } : {}),","atom":"a0","author":"init","version":0},{"n":56,"text":"\t\t},","atom":"a0","author":"init","version":0},{"n":57,"text":"\t};","atom":"a0","author":"init","version":0},{"n":58,"text":"}","atom":"a0","author":"init","version":0},{"n":59,"text":"","atom":"a0","author":"init","version":0},{"n":60,"text":"/** npm's placeholder test script, which always fails. */","atom":"a0","author":"init","version":0},{"n":61,"text":"const NO_TEST = /no test specified/;","atom":"a0","author":"init","version":0},{"n":62,"text":"","atom":"a0","author":"init","version":0},{"n":63,"text":"/** A starting abso.json, guessed from package.json; empty where nothing can be guessed. */","atom":"a236","author":"review","version":28},{"n":64,"text":"export function guessProjectFile(root: string): ProjectFile {","atom":"a0","author":"init","version":0},{"n":65,"text":"\tlet pkg: {","atom":"a0","author":"init","version":0},{"n":66,"text":"\t\tscripts?: Record<string, unknown>;","atom":"a0","author":"init","version":0},{"n":67,"text":"\t\tdependencies?: Record<string, unknown>;","atom":"a0","author":"init","version":0},{"n":68,"text":"\t\tdevDependencies?: Record<string, unknown>;","atom":"a0","author":"init","version":0},{"n":69,"text":"\t} = {};","atom":"a0","author":"init","version":0},{"n":70,"text":"\tconst hasPkg = existsSync(join(root, \"package.json\"));","atom":"a0","author":"init","version":0},{"n":71,"text":"\tif (hasPkg) {","atom":"a0","author":"init","version":0},{"n":72,"text":"\t\ttry {","atom":"a0","author":"init","version":0},{"n":73,"text":"\t\t\tpkg = JSON.parse(readFileSync(join(root, \"package.json\"), \"utf8\")) ?? {};","atom":"a0","author":"init","version":0},{"n":74,"text":"\t\t} catch {","atom":"a0","author":"init","version":0},{"n":75,"text":"\t\t\tpkg = {};","atom":"a0","author":"init","version":0},{"n":76,"text":"\t\t}","atom":"a0","author":"init","version":0},{"n":77,"text":"\t}","atom":"a0","author":"init","version":0},{"n":78,"text":"\tconst scripts = typeof pkg.scripts === \"object\" && pkg.scripts !== null ? pkg.scripts : {};","atom":"a0","author":"init","version":0},{"n":79,"text":"\tconst has = (s: string) => typeof scripts[s] === \"string\" && !(s === \"test\" && NO_TEST.test(scripts[s] as string));","atom":"a0","author":"init","version":0},{"n":80,"text":"\tconst check = has(\"check\")","atom":"a0","author":"init","version":0},{"n":81,"text":"\t\t? \"npm run check\"","atom":"a0","author":"init","version":0},{"n":82,"text":"\t\t: [has(\"typecheck\") ? \"npm run typecheck\" : \"\", has(\"test\") ? \"npm test\" : \"\"].filter((c) => c !== \"\").join(\" && \");","atom":"a0","author":"init","version":0},{"n":83,"text":"\tconst vite = \"vite\" in (pkg.devDependencies ?? {}) || \"vite\" in (pkg.dependencies ?? {});","atom":"a0","author":"init","version":0},{"n":84,"text":"\tconst build = vite ? \"npx --no-install vite build --base ./ --outDir dist\" : has(\"build\") ? \"npm run build\" : \"\";","atom":"a0","author":"init","version":0},{"n":85,"text":"\tconst out = vite ? \"dist\" : \"\";","atom":"a0","author":"init","version":0},{"n":86,"text":"\tconst setup = existsSync(join(root, \"package-lock.json\")) ? \"npm ci\" : hasPkg ? \"npm install\" : \"\";","atom":"a0","author":"init","version":0},{"n":87,"text":"\treturn { setup, check, build, out };","atom":"a0","author":"init","version":0},{"n":88,"text":"}","atom":"a0","author":"init","version":0},{"n":89,"text":"","atom":"a0","author":"init","version":0},{"n":90,"text":"/**","atom":"a0","author":"init","version":0},{"n":91,"text":" * Writes a guessed abso.json (unless it has abso.json or avcs.json) when the folder has none and package.json gives","atom":"a236","author":"review","version":28},{"n":92,"text":" * a check or a build to guess (#39: a project with nothing to","atom":"a317","author":"infra-split","version":37},{"n":93,"text":" * check shouldn't start boxes; CI skips a version with nothing to run).","atom":"a0","author":"init","version":0},{"n":94,"text":" * Answers what it wrote; 'exists' or 'nothing' when it wrote none.","atom":"a0","author":"init","version":0},{"n":95,"text":" */","atom":"a0","author":"init","version":0},{"n":96,"text":"export function writeStartingProjectFile(root: string): ProjectFile | \"exists\" | \"nothing\" {","atom":"a0","author":"init","version":0},{"n":97,"text":"\tif (existsSync(join(root, PROJECT_FILE)) || existsSync(join(root, OLD_PROJECT_FILE))) return \"exists\";","atom":"a236","author":"review","version":28},{"n":98,"text":"\tconst guess = guessProjectFile(root);","atom":"a0","author":"init","version":0},{"n":99,"text":"\tif (guess.check === \"\" && guess.build === \"\") return \"nothing\";","atom":"a0","author":"init","version":0},{"n":100,"text":"\twriteFileSync(join(root, PROJECT_FILE), `${JSON.stringify(guess, null, 2)}\\n`);","atom":"a0","author":"init","version":0},{"n":101,"text":"\treturn guess;","atom":"a0","author":"init","version":0},{"n":102,"text":"}","atom":"a0","author":"init","version":0},{"n":103,"text":"","atom":"a0","author":"init","version":0},{"n":104,"text":"/** What init says about abso.json. */","atom":"a236","author":"review","version":28},{"n":105,"text":"export function startingProjectFileText(wrote: ProjectFile | \"exists\" | \"nothing\"): string[] {","atom":"a0","author":"init","version":0},{"n":106,"text":"\tif (wrote === \"exists\") return [];","atom":"a0","author":"init","version":0},{"n":107,"text":"\tif (wrote === \"nothing\") {","atom":"a0","author":"init","version":0},{"n":108,"text":"\t\treturn [","atom":"a0","author":"init","version":0},{"n":109,"text":"\t\t\t`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).`,","atom":"a846","author":"rename","version":100},{"n":110,"text":"\t\t];","atom":"a0","author":"init","version":0},{"n":111,"text":"\t}","atom":"a0","author":"init","version":0},{"n":112,"text":"\tconst set = KEYS.filter((k) => wrote[k] !== \"\").map((k) => `${k} \"${wrote[k]}\"`);","atom":"a0","author":"init","version":0},{"n":113,"text":"\tconst empty = KEYS.filter((k) => wrote[k] === \"\");","atom":"a0","author":"init","version":0},{"n":114,"text":"\treturn [","atom":"a0","author":"init","version":0},{"n":115,"text":"\t\t[","atom":"a0","author":"init","version":0},{"n":116,"text":"\t\t\t`Wrote ${PROJECT_FILE}: CI will run on every new version of shared (${set.join(\", \")}).`,","atom":"a0","author":"init","version":0},{"n":117,"text":"\t\t\tempty.length > 0 ? ` Fill in ${empty.join(\", \")} when the project has them.` : \"\",","atom":"a0","author":"init","version":0},{"n":118,"text":"\t\t\t\" abso push --check with no command runs its build and check.\",","atom":"a846","author":"rename","version":100},{"n":119,"text":"\t\t].join(\"\"),","atom":"a0","author":"init","version":0},{"n":120,"text":"\t];","atom":"a0","author":"init","version":0},{"n":121,"text":"}","atom":"a0","author":"init","version":0}],"atoms":[{"atom":"a0","author":"init","message":"Start the project","time":1791506895507,"timeIso":"2026-10-09T00:48:15.507Z","publish":{"draft":null,"version":0,"agent":"init","message":"Start the project","time":1791506895507,"timeIso":"2026-10-09T00:48:15.507Z"}},{"atom":"a236","author":"review","message":"","time":1791539181105,"timeIso":"2026-10-09T09:46:21.105Z","publish":{"draft":null,"version":28,"agent":"review","message":"Client: abso.json is the project file (avcs.json still read; a new project gets abso.json unless it has either); new folders get .abso when no installed mod is older than 0.2.0; both mods are 0.2.0 (abso 253, 224)","time":1791539181568,"timeIso":"2026-10-09T09:46:21.568Z"}},{"atom":"a317","author":"infra-split","message":"","time":1791546813593,"timeIso":"2026-10-09T11:53:33.593Z","publish":{"draft":null,"version":37,"agent":"infra-split","message":"Comments and test names give each reason in plain words, without naming who raised it\n\nNotes like \"(#37, Builder 5)\" or \"(AVCS - Security)\" become \"(#37)\" or go, and a private commit hash after a name goes with it. Issue numbers and references such as git's CVE-2019-1353 stay. Only comments and test names change; no behavior changes.","time":1791547035956,"timeIso":"2026-10-09T11:57:15.956Z"}},{"atom":"a846","author":"rename","message":"","time":1791659799126,"timeIso":"2026-10-10T19:16:39.126Z","publish":{"draft":null,"version":100,"agent":"rename","message":"abso publish is now abso push, abso sync is now abso pull (abso 427)\n\nCommands, help, flags, messages, MCP tool names and descriptions, hook text, README, SKILL.md and tests say push and pull; \"shared\" stays the noun (\"Pushed version N\"). No aliases, no notices. A queued push that was \"pulled\" is now \"turned back\", so pull means one thing.\n\npush -f/--force/-u/--all/--tags and pull --rebase/--ff-only/--squash refuse with one plain line naming the abso way; push and pull take no remote or branch.\n\nKept as stored: log entry kinds (publish, sync, pulled), HTTP route paths, the pipeline trigger on: publish, the yours (unpublished) marker, npm-publish.","time":1791659833853,"timeIso":"2026-10-10T19:17:13.853Z"}}]}