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.
70 lines • 3.85 kB
TypeScript
import { type CliRunner } from './cli-exec.js';
/**
* Project-level repo helpers (#380): the activation marker check and a
* `git ls-files` crawl. Read-only
* building blocks for the sidebars (#314); activation/install (writing the
* marker, the install commit) is a separate, deferred concern.
*/
/** Minimal fs seam so activation is unit-testable without touching disk. */
export interface ProjectFs {
/** True when `path` exists AND is a file. */
exists(path: string): Promise<boolean>;
}
/** A {@link ProjectFs} backed by `node:fs/promises`. See {@link nodeFs}. */
export declare function nodeProjectFs(): ProjectFs;
/**
* A repo is "activated"/installed for The Framework when it has the
* `.the-framework/.gitignore` install writes — the same marker install's own
* no-op check reads (#1600), so a `.the-framework/` directory something else
* created can never read as activated while the repo still lacks the ignore
* file that keeps framework state off its branches. Read-only check; writing
* the marker + the install commit is a separate, deferred concern.
*/
export declare function isActivated(cwd: string, fs?: ProjectFs): Promise<boolean>;
/** Runs `git` in `cwd` and resolves stdout. Injectable so the crawl is testable. */
export type GitRunner = CliRunner;
/**
* A local read: the index, a ref, or objects already on disk. Kept at the budget that used to
* cover everything, so a hung read still fails fast instead of holding the daemon longer (#997).
*/
export declare const GIT_READ_TIMEOUT_MS = 10000;
/** A local mutation. Bounded by disk, but an index write on a large repo outlives a read. */
export declare const GIT_WRITE_TIMEOUT_MS = 30000;
/**
* The network, or a whole checkout. `git worktree add` writes every tracked file and `git push`
* uploads a packfile; on a large repo both routinely pass 10s, which is what #997 is about. Well
* past the 60s `gh` allows its write actions (dashboard/gh.ts), because those are API calls.
*/
export declare const GIT_SLOW_TIMEOUT_MS = 120000;
/**
* The timeout for one git invocation, chosen by subcommand (#997). One flat 10s budget covered
* the repo's ~20 call sites, so the slowest two ran under what is really a read's budget: a
* SIGTERM'd `worktree add` drops an agent into the user's main checkout, a SIGTERM'd `push` may
* have half-landed. Mirrors the read/write split `gh` already has (dashboard/gh.ts).
*/
export declare function gitTimeoutMs(args: string[]): number;
/**
* A {@link GitRunner} backed by `execFile('git', ...)`. Rejects on any git error, and with a
* `CliTimeoutError` when the operation outran its {@link gitTimeoutMs} budget.
*
* The buffer is raised well past the default because a repo crawl (`git ls-files`) prints a
* line per file, and a large checkout overruns it.
*/
export declare function nodeGitRunner(): GitRunner;
/**
* Whether `cwd` sits inside a git working tree (#997). Lets a caller tell "this project cannot
* host a worktree at all" from "git was there and the operation failed", which are the same
* rejection out of `git worktree add` but call for opposite handling.
*
* Forgiving in one direction only: an unreadable / missing git reads as "no repo", which is the
* conservative answer for the caller that treats a repo's failure as fatal.
*/
export declare function isGitRepo(cwd: string, agent?: GitRunner): Promise<boolean>;
/**
* List every file git sees in the repo at `cwd`: tracked + untracked, honoring
* .gitignore. Uses `git ls-files -z --cached --others --exclude-standard` (the
* same approach Vike uses). Returns repo-relative paths, deduped and sorted.
* Forgiving: a non-repo / missing git / any failure yields `[]`, never throws.
*/
export declare function crawlRepoFiles(cwd: string, agent?: GitRunner): Promise<string[]>;
//# sourceMappingURL=project.d.ts.map