UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

28 lines • 1.45 kB
export type LineReplacement = { readonly start: number; readonly oldLength: number; readonly newLines: string[]; }; /** `[index in oldLines, index in newLines]` of a context line, which sits on both sides of a chunk. */ export type ContextLineIndex = readonly [number, number]; /** * Splits a matched chunk into replacements that skip its context lines, so those source lines keep * their exact text and ending (Codex `compute_replacements`, PreserveLineEndings mode). Context * indices past the matched region belong to a trailing empty line the matcher already dropped. */ export declare function replacementsAroundContext(start: number, oldLength: number, newLines: string[], contextLineIndices: readonly ContextLineIndex[]): LineReplacement[]; /** * A file split into lines that remember their own line ending, so an update rewrites only the lines a * patch touches. Mirrors Codex `codex-rs/apply-patch/src/text_file.rs`: unchanged lines keep their * endings, inserted lines take the file's first ending (LF when it has none), and every line ends with * an ending, which keeps apply_patch's trailing-newline behavior. */ export declare class SourceText { private readonly lines; private readonly preferredEnding; private constructor(); static parse(content: string): SourceText; get texts(): string[]; replace(replacements: readonly LineReplacement[]): string; } //# sourceMappingURL=line-endings.d.ts.map