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

Function resolveConfig

browse/src/config.ts:53–79  ·  view source on GitHub ↗
(
  env: Record<string, string | undefined> = process.env,
)

Source from the content-addressed store, hash-verified

51 * project root is detected via git or cwd.
52 */
53export function resolveConfig(
54 env: Record<string, string | undefined> = process.env,
55): BrowseConfig {
56 let stateFile: string;
57 let stateDir: string;
58 let projectDir: string;
59
60 if (env.BROWSE_STATE_FILE) {
61 stateFile = env.BROWSE_STATE_FILE;
62 stateDir = path.dirname(stateFile);
63 projectDir = path.dirname(stateDir); // parent of .gstack/
64 } else {
65 projectDir = getGitRoot() || process.cwd();
66 stateDir = path.join(projectDir, '.gstack');
67 stateFile = path.join(stateDir, 'browse.json');
68 }
69
70 return {
71 projectDir,
72 stateDir,
73 stateFile,
74 consoleLog: path.join(stateDir, 'browse-console.log'),
75 networkLog: path.join(stateDir, 'browse-network.log'),
76 dialogLog: path.join(stateDir, 'browse-dialog.log'),
77 auditLog: path.join(stateDir, 'browse-audit.jsonl'),
78 };
79}
80
81/**
82 * Create the .gstack/ state directory if it doesn't exist.

Callers 9

makeMinimalConfigFunction · 0.90
config.test.tsFile · 0.90
makeMinimalConfigFunction · 0.90
handleMetaCommandFunction · 0.90
cli.tsFile · 0.90
server.tsFile · 0.90
resolveConfigFromEnvFunction · 0.90
commands.test.tsFile · 0.85

Calls 1

getGitRootFunction · 0.70

Tested by 2

makeMinimalConfigFunction · 0.72
makeMinimalConfigFunction · 0.72