Skip to content

abso-core

Public
Check passed

Versions 52 to 318

Compare

+40 −10 in 10 places
Lines 7–13 at 318 (were 7–13 at 52)
77// last commit that changed the mod's own files (0.1.0+702c616, or
88// 0.1.0+702c616.dirty when they differ from it), and hooks/stamp.ts says
99// the same, so the mod sends it with each call to the server
10−// (X-Avcs-Client). A commit that changes none of them changes nothing to
10+// (X-Abso-Client). A commit that changes none of them changes nothing to
1111// install, and nothing to restart for.
1212// 2. Checks the staged copy: `claude plugin validate`, then the mod's own
1313// tests in Claude Code's plugin test kit. If either fails, nothing in the
Lines 45–51 at 318 (were 45–51 at 52)
4545} from "node:fs";
4646import { homedir, tmpdir } from "node:os";
4747import { dirname, join, resolve } from "node:path";
48−import { CLIENT_DIR, clientPlace, clientVersion, headCommit } from "./client-version.ts";
48+import { builtCopy, CLIENT_DIR, clientPlace, clientVersion, headCommit } from "./client-version.ts";
4949
5050export interface ModSpec {
5151 /** The mod's name, as its plugin.json has it. */
Lines 94–101 at 318 (were 94–99 at 52)
9494 /** For tests: the rename that moves each file into place. */
9595 readonly rename?: (from: string, to: string) => void;
9696 readonly now?: Date;
97+ /** For tests: the command stamped as HOOK_COMMAND, instead of this client's own `abso hook`. */
98+ readonly hookCommand?: readonly string[];
9799}
98100
99101const RECORD = ".avcs-install.json";
Lines 134–148 at 318 (were 132–137 at 52)
132134 existsSync(at(skillsFolder(AVCS_MOD.name, env), MANIFEST)) ||
133135 existsSync(at(skillsFolder(OLD_MOD_NAMES[AVCS_MOD.name]!, env), MANIFEST));
134136
137+/** Whether the installed abso mod hands a local project's edits to abso hook: it was installed with a HOOK_COMMAND. */
138+export function modHandsLocal(env: Readonly<Record<string, string | undefined>> = process.env): boolean {
139+ try {
140+ return /HOOK_COMMAND[^=\n]*=\s*\[/.test(readFileSync(at(skillsFolder(AVCS_MOD.name, env), STAMP_FILE), "utf8"));
141+ } catch {
142+ return false;
143+ }
144+}
135146/**
136147 * After the new mod is in, the folder it replaces (skills/avcs, skills/avcs-view) would load beside it, so it
137148 * is moved, not deleted, to ~/.abso/retired-mods/<name>-<stamp>. Returns where it went, or undefined when there was none.
Lines 237–247 at 318 (were 226–233 at 52)
226237 return commit;
227238}
228239
229−/** The files to install, stamped with `version`, in install order. */
230−function filesFor(spec: ModSpec, version: string): Map<string, Buffer> {
240+/** The command that runs this checkout's `abso hook`: what the mod hands a local project's edits to. */
241+export const hookCommand = (): readonly string[] => [process.execPath, join(CLIENT_DIR, "abso.ts"), "hook"];
243+/** The files to install, stamped with `version` (and HOOK_COMMAND, where a stamp.ts has it), in install order. */
244+function filesFor(spec: ModSpec, version: string, hook: readonly string[] = hookCommand()): Map<string, Buffer> {
231245 if (!/^[\w.+-]+$/.test(version)) throw new Error(`can't stamp the version ${JSON.stringify(version)}`);
232246 const out = new Map<string, Buffer>();
233247 for (const rel of spec.files) {
Lines 253–261 at 318 (were 239–245 at 52)
239253 const text = data.toString("utf8");
240254 const stamped = text.replace(/(STAMP[^=\n]*=\s*)undefined/, `$1'${version}'`);
241255 if (stamped === text) throw new Error(`${rel} has no "STAMP ... = undefined" line to stamp`);
242− data = Buffer.from(stamped);
256+ data = Buffer.from(
257+ stamped.replace(/(HOOK_COMMAND[^=\n]*=\s*)undefined/, (_, head: string) => head + JSON.stringify(hook)),
258+ );
243259 }
244260 out.set(rel, data);
245261 }
Lines 402–408 at 318 (were 386–392 at 52)
386402export function installMod(spec: ModSpec, options: InstallOptions): Installed {
387403 const target = resolve(options.target);
388404 const version = versionFor(spec, options.commit);
389− const next = filesFor(spec, version);
405+ const next = filesFor(spec, version, options.hookCommand);
390406 const existed = existsSync(target);
391407 mkdirSync(target, { recursive: true });
392408 try {
Lines 533–550 at 318 (were 517–523 at 52)
517533 readonly current: string;
518534}
519535
520−/** `avcs --version`: this client, and the mods installed on this machine, compared with this client's. */
536+/**
537+ * The command that runs one of this client's installers (client/install-mod.ts or install-view.ts), by its full
538+ * path. They are .ts files, which Node runs itself from 22.18, so on an older Node it says which one it needs.
539+ */
540+export function installerCommand(installer: string): string {
541+ const command = `node ${join(CLIENT_DIR, installer)}`;
542+ return (process.features as { typescript?: unknown }).typescript
543+ ? command
544+ : `${command} (with Node 22.18 or later, which runs .ts files; this is Node ${process.versions.node})`;
545+}
547+/** `abso --version`: this client, and the mods installed on this machine, compared with this client's. */
521548export function versionReport(env: Readonly<Record<string, string | undefined>>): {
522549 text: string;
523550 json: Record<string, unknown>;
Lines 579–594 at 318 (were 552–564 at 52)
552579 })(),
553580 };
554581 mods.push(m);
582+ // A built copy has no mod files to compare with or install from: it reports what is installed.
555583 if (m.version === undefined) {
556− lines.push(`the ${m.name} mod: not installed (node client/${installer})`);
584+ lines.push(`the ${m.name} mod: not installed${builtCopy() ? "" : ` (${installerCommand(installer)})`}`);
557585 continue;
558586 }
559587 const when = m.at ? `, installed ${m.at.slice(0, 16).replace("T", " ")} UTC` : "";
560588 const behind =
561− m.version === m.current ? "" : `; this client has ${m.current}: node client/${installer} installs it`;
589+ builtCopy() || m.version === m.current
590+ ? ""
591+ : `; this client has ${m.current}: ${installerCommand(installer)} installs it`;
562592 lines.push(`the ${m.name} mod: ${m.version} in ${m.folder}${when}${behind}`);
563593 }
564594 return { text: lines.join("\n"), json: { client, folder: CLIENT_DIR, mods } };
Lines 606–611 at 318 (were 576–581 at 52)
576606 .filter((m) => m.version?.includes("+") && /\+[0-9a-f]{7}$/.test(m.current) && m.version !== m.current)
577607 .map(
578608 (m) =>
579− `The ${m.name} mod installed on this machine is ${m.version}, and this client has ${m.current}: node client/${installers[m.name]} installs it (new chats load it).`,
609+ `The ${m.name} mod installed on this machine is ${m.version}, and this client has ${m.current}: ${installerCommand(installers[m.name]!)} installs it (new chats load it).`,
580610 );
581611}
MCP
compare on this site's /mcp
CLI
abso diff 52 318 client/src/install.ts --json
JSON
/christopher/abso-core/compare/52..318?file=client%2Fsrc%2Finstall.ts&format=json