UNPKG

@phren/cli

Version:

Knowledge layer for AI agents - CLI, MCP server, and data layer

24 lines (23 loc) • 1.43 kB
import { type Json } from "./protocol.js"; import type { ChangedFile } from "./changes.js"; /** One file's text at HEAD, in the index or at a commit. A path the tree does * not hold answers `missing: true` (an added or deleted side), a file larger * than 2 MB `tooLarge: true`, and bytes with a NUL `binary: true`, each with * no text. */ export declare function gitFile(cwd: string, ref: unknown, rawPath: unknown): Promise<Json>; /** The files a patch touches, from its `---`/`+++` lines. Rename, mode and * binary patches are refused: only text hunks are staged one at a time. */ export declare function patchFiles(patch: string): string[]; /** Apply a patch of one file's hunks to the index only: staging them, or with * `reverse` unstaging them. The working tree is never touched. Git checks the * patch first; a hunk that no longer applies (the file moved on) is Git's * refusal as `{ ok: false, output }`. */ export declare function gitApply(cwd: string, rawPatch: unknown, reverse: unknown): Promise<Json>; /** One session's recorded edits, oldest first, folded by file: how often each * file changed, the lines added and removed across those edits, and each * edit's patch. Only edits inside `root` (the session's repository) count; * `others` says how many touched other repositories. */ export declare function sessionChanges(root: string, history: { toolUseId: string; files: ChangedFile[]; }[]): Json;