import { existssync, mkdirsync, readfilesync, writefilesync } from 'node:fs';
import { homedir } from 'node:os';
import { join } from 'node:path';
const home = () => process.env.diffin_home ?? homedir();
export function claudesettingspath() { return join(home(), '.claude', 'settings.json'); }
export const allow_rule = 'bash(diffin capture:*)';
export function installclaudeallow() {
const p = claudesettingspath();
if (!existssync(join(home(), '.claude'))) return { installed: false, reason: 'no-claude' };
let settings = {};
if (existssync(p)) { try { settings = json.parse(readfilesync(p, 'utf8')); } catch { return { installed: false, reason: 'unreadable' }; } }
setting