MCPcopy Create free account
hub / github.com/coder/mux / resolveProjectDir

Function resolveProjectDir

src/cli/trust.ts:44–55  ·  view source on GitHub ↗
(input: ResolveProjectDirInput)

Source from the content-addressed store, hash-verified

42 * --dir wins; otherwise the git toplevel of cwd (falling back to cwd itself).
43 */
44export async function resolveProjectDir(input: ResolveProjectDirInput): Promise<string> {
45 if (input.explicitDir != null) {
46 const explicitDir = path.resolve(input.cwd, input.explicitDir);
47 await ensureDirectory(explicitDir);
48 return explicitDir;
49 }
50
51 const cwd = path.resolve(input.cwd);
52 await ensureDirectory(cwd);
53 const gitRoot = await findGitRoot(cwd);
54 return gitRoot ?? cwd;
55}
56
57async function ensureDirectory(dirPath: string): Promise<void> {
58 const stats = await fs.stat(dirPath);

Callers 3

runWorkflowFunction · 0.90
trust.test.tsFile · 0.90
runTrustFunction · 0.85

Calls 3

findGitRootFunction · 0.85
resolveMethod · 0.80
ensureDirectoryFunction · 0.70

Tested by

no test coverage detected