()
| 27 | export const CMDLINE_MARKER = "gstack-design-daemon"; |
| 28 | |
| 29 | export function resolveStateFilePath(): string { |
| 30 | // Env override has highest precedence so tests can point both client and |
| 31 | // spawned daemon at a per-test path without a shared cwd. |
| 32 | const envOverride = process.env.DESIGN_DAEMON_STATE_FILE; |
| 33 | if (envOverride) return envOverride; |
| 34 | try { |
| 35 | const root = execFileSync("git", ["rev-parse", "--show-toplevel"], { |
| 36 | encoding: "utf8", |
| 37 | stdio: ["ignore", "pipe", "ignore"], |
| 38 | }).trim(); |
| 39 | if (root) return path.join(root, ".gstack", "design.json"); |
| 40 | } catch { |
| 41 | // not in a git repo — fall through |
| 42 | } |
| 43 | return path.join(process.cwd(), ".gstack", "design.json"); |
| 44 | } |
| 45 | |
| 46 | export function resolveLockFilePath(stateFile: string = resolveStateFilePath()): string { |
| 47 | return `${stateFile}.lock`; |
no outgoing calls
no test coverage detected