UNPKG

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.

42 lines 2.18 kB
/** Cap what a hover card renders, whether it is a patch or a file. */ export declare const MAX_PREVIEW_LINES = 500; /** One unchanged file's contents for the tree's hover card (#828). */ export interface FileContent { /** The repo-relative path asked for. */ path: string; /** The file's text, cut at {@link MAX_PREVIEW_LINES}. Empty when binary. */ text: string; /** The file was longer than the cap and was cut. */ truncated: boolean; /** Not UTF-8 text, so there is nothing to render. */ binary: boolean; } /** * Whether a client-supplied path may be read: repo-relative, no traversal, no absolute path, no * leading `-` (git would read it as a flag), and never into `.git` (config and credentials live * there). Rejecting is the whole contract; the caller resolves it against a checkout it chose. */ export declare function safeRepoPath(path: string): boolean; /** * Read a repo-relative file from `cwd`, or null when it is unsafe, outside the checkout, or * unreadable. * * The confinement check is a `realpath` on both sides, not a string compare on the resolved path. * `resolve` does not follow symlinks, so `src/link.txt -> /etc/passwd` resolves to a path that sits * happily under `cwd` and passes a textual check while the read leaves the repo. `realpath` is what * makes the containment real; it also normalizes the platform's own links (macOS `/tmp`), which is * why `cwd` goes through it too rather than being compared raw. */ export declare function readConfinedFile(cwd: string, path: string): Promise<Buffer | null>; /** Cut a body to {@link MAX_PREVIEW_LINES}, reporting whether anything was dropped. */ export declare function cutToPreview(body: string): { body: string; truncated: boolean; }; /** * One unchanged file's contents (#828). Null when the path is unsafe, outside the checkout, or * unreadable. A file git has not touched still reads from the resolved checkout, so a session's * hover shows its worktree's copy rather than the project root's (#815). */ export declare function readFileContent(cwd: string, path: string): Promise<FileContent | null>; //# sourceMappingURL=file-read.d.ts.map