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"; 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)
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"); 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"); Lines 65–75 at 318 (were 58–64 at 0)
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"))) {
69+ fromEnv(env, "HOOK_FORCE") !== "1" && 70+ (existsSync(join(modDir(env), ".claude-plugin", "plugin.json")) || 71+ existsSync(join(oldModDir(env), ".claude-plugin", "plugin.json"))) 6273 return { stdout: "", outcome: "skipped: the abso mod sends edits" }; 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"; 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); 92105 ...(input.session_id ? { session: input.session_id } : {}), Lines 202–208 at 318 (were 189–195 at 0)
190203function log(root: string, line: string): void { 192− appendFileSync(join(root, AVCS_DIR, "hook.log"), `${line}\n`);
205+ appendFileSync(join(stateDir(root), "hook.log"), `${line}\n`); 194207 // Logging is best effort.