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

Compare

+17 −4 in 5 places
Lines 16–28 at 318 (were 16–26 at 0)
1616import { homedir } from "node:os";
1717import { dirname, isAbsolute, join, resolve } from "node:path";
1818import { Api, type News, newsLines } from "./api.ts";
19−import { AVCS_DIR, findRoot, isReader, readConfig } from "./config.ts";
19+import { findRoot, isReader, isVisitor, readConfig } from "./config.ts";
2020import { editBody, newsContext, normalize, spellingText, uncomposedText } from "./core.ts";
21+import { fromEnv } from "./env-names.ts";
2122import { forgetKnown, isPaused, loadIgnore, logNews, readKnown, readText, relativeTo, writeKnown } from "./folder.ts";
2223import { tryFolderLock } from "./lock.ts";
2324import { readKnownModes } from "./modes.ts";
25+import { stateDir } from "./state-dir.ts";
2426
2527/** The fields of Claude Code's PostToolUse input that the hook reads. */
2628interface HookInput {
Lines 44–54 at 318 (were 42–47 at 0)
4244
4345/** Where install-mod.ts puts the mod: Claude Code's skills folder, which every session loads. */
4446export function modDir(env: Readonly<Record<string, string | undefined>> = process.env): string {
47+ return join(env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude"), "skills", "abso-hooks");
48+}
50+/** Where the same mod lived before the rename. */
51+export function oldModDir(env: Readonly<Record<string, string | undefined>> = process.env): string {
4552 return join(env.CLAUDE_CONFIG_DIR || join(homedir(), ".claude"), "skills", "avcs");
4653}
4754
Lines 65–75 at 318 (were 58–64 at 0)
5865 }
5966 // With the abso mod installed, every Claude Code session on this machine sends
6067 // its edits in-process, so this hook stands down rather than send them twice.
61− if (env.AVCS_HOOK_FORCE !== "1" && existsSync(join(modDir(env), ".claude-plugin", "plugin.json"))) {
68+ if (
69+ fromEnv(env, "HOOK_FORCE") !== "1" &&
70+ (existsSync(join(modDir(env), ".claude-plugin", "plugin.json")) ||
71+ existsSync(join(oldModDir(env), ".claude-plugin", "plugin.json")))
72+ ) {
6273 return { stdout: "", outcome: "skipped: the abso mod sends edits" };
6374 }
6475 const tool = input.tool_name ?? "";
Lines 91–105 at 318 (were 80–92 at 0)
8091 outcome = "skipped: recording is paused (abso resume)";
8192 } else if (isReader(root)) {
8293 outcome = "skipped: this folder is a reader";
94+ } else if (isVisitor(root)) {
95+ outcome = "skipped: this folder reads signed out";
8396 } else if (rel === undefined || loadIgnore(root)(rel, false)) {
8497 outcome = "skipped: ignored path";
8598 } else if (readKnownModes(root).get(rel)?.link != null) {
8699 outcome = "skipped: a link (a file standing in for one); abso record sends links";
87100 } else {
88101 const config = readConfig(root, env);
89− const timeout = Number(env.AVCS_HOOK_TIMEOUT_MS) || DEFAULT_TIMEOUT_MS;
102+ const timeout = Number(fromEnv(env, "HOOK_TIMEOUT_MS")) || DEFAULT_TIMEOUT_MS;
90103 const api = new Api(config, timeout);
91104 const who = {
92105 ...(input.session_id ? { session: input.session_id } : {}),
Lines 202–208 at 318 (were 189–195 at 0)
189202
190203function log(root: string, line: string): void {
191204 try {
192− appendFileSync(join(root, AVCS_DIR, "hook.log"), `${line}\n`);
205+ appendFileSync(join(stateDir(root), "hook.log"), `${line}\n`);
193206 } catch {
194207 // Logging is best effort.
195208 }
MCP
compare on this site's /mcp
CLI
abso diff 0 318 client/src/hook.ts --json
JSON
/christopher/abso-core/compare/0..318?file=client%2Fsrc%2Fhook.ts&format=json