MCPcopy
hub / github.com/garrytan/gstack / resolveStateFilePath

Function resolveStateFilePath

design/src/daemon-state.ts:29–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27export const CMDLINE_MARKER = "gstack-design-daemon";
28
29export 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
46export function resolveLockFilePath(stateFile: string = resolveStateFilePath()): string {
47 return `${stateFile}.lock`;

Callers 6

ensureDaemonFunction · 0.90
shutdownDaemonFunction · 0.90
resolveLockFilePathFunction · 0.85
readStateFileFunction · 0.85
writeStateFileFunction · 0.85
removeStateFileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected