framework
Version:
The (AI) Framework: turnkey, zero-config AI orchestration that wraps a coding-agent CLI (Claude Code) as a black box and takes you from an idea to a running app. Vite for AI.
23 lines • 969 B
JavaScript
import { join } from 'node:path';
import { nodeFs } from './node-fs.js';
/**
* The immediate subdirectories of `dir` that are git repos: a child directory holding a `.git`
* (a directory in a normal clone, a file in a worktree or submodule). Returns absolute paths, sorted.
*
* Only one level deep on purpose (#1123): the auto-grant's blast radius is "this directory of repos",
* not the whole tree beneath it. A missing `dir` yields `[]` (readdir already swallows that), so it
* never throws on boot.
*/
export async function listReposInDirectory(dir, fs = nodeFs()) {
const repos = [];
for (const name of (await fs.readdir(dir)).sort()) {
const child = join(dir, name);
if (!(await fs.isDirectory(child)))
continue;
const git = join(child, '.git');
if ((await fs.exists(git)) || (await fs.isDirectory(git)))
repos.push(child);
}
return repos;
}
//# sourceMappingURL=repos-directory.js.map