Files
upstream-atomic-crm/.claude/hooks/lib/paths.mjs
upstream-mirror 93ecc1a6f8
Some checks failed
✅ Check / 🔬 ESLint (push) Failing after 21s
✅ Check / 🏷️ Typecheck (push) Failing after 11s
✅ Check / 🔎 Test (push) Failing after 11s
✅ Check / e2e-test (push) Failing after 11s
✅ Check / 🔨 Build (push) Failing after 11s
🚀 Deploy / 🚀 Deploy (doc) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (demo) (push) Failing after 12s
🚀 Deploy / 🚀 Deploy (supabase) (push) Failing after 18s
snapshot of https://github.com/marmelab/atomic-crm.git (main, 2026-09-18; blobs > 131072B omitted)
2026-09-18 01:48:50 +05:00

25 lines
931 B
JavaScript

import { join } from "node:path";
import { exec } from "./process.mjs";
// APP_DIR / CLAUDE_PROJECT_DIR override the detected root (used by hook tests).
function getRepo() {
if (process.env.APP_DIR) return process.env.APP_DIR;
if (process.env.CLAUDE_PROJECT_DIR) return process.env.CLAUDE_PROJECT_DIR;
const top = exec("git", ["rev-parse", "--show-toplevel"]);
if (top.status === 0 && top.stdout.trim()) return top.stdout.trim();
return process.cwd();
}
export const REPO = getRepo();
export const CONFIG_DIR =
process.env.CLAUDE_CONFIG_DIR || join(process.env.HOME || "/root", ".claude");
// HARNESS_TMP_ROOT is the neutral name; CRM_TMP_ROOT is the deprecated fallback
// kept for one release so existing launchers / tests keep working.
export const TMP_ROOT =
process.env.HARNESS_TMP_ROOT || process.env.CRM_TMP_ROOT || "/tmp";
export function sanitizePath(p) {
return String(p ?? "").replace(/\//g, "_");
}