/**
 * Per-package data-root resolver (M3: the repo idiom, NOT a new shared seam).
 *
 * The trends/specifics/analytics packages each inline this same resolver
 * (`trends/src/store.ts:180`, `specifics-bank/src/bank.ts:150`,
 * `analytics/src/utils/storage.ts:54`) rather than importing a shared util —
 * there is no cross-package path map. SB-S0 matches that idiom, so it adds NO new
 * seam function and the `data-root.mjs ⇄ storage.ts` twin-sync stays untouched
 * (SC6). De-duplicating the now-four copies is an explicit out-of-scope refactor.
 */

import { homedir } from "node:os";
import { join } from "node:path";

/** Resolve `sub` under the per-user data dir; `LINKEDIN_STUDIO_DATA` overrides the root. */
export function dataRoot(sub: string): string {
  const root = process.env.LINKEDIN_STUDIO_DATA ?? join(homedir(), ".claude", "linkedin-studio");
  return join(root, sub);
}
