/** * Hashline format primitives: sigils, separators, regex fragments, and * display helpers. These are the single source of truth for the parser, the * tokenizer, the prompt, and the formal grammar. */ import type { Cursor } from "./types.js"; /** File-section header delimiters: `[path#hash]`. */ export declare const HL_FILE_PREFIX = "["; export declare const HL_FILE_SUFFIX = "]"; /** Payload sigil for literal body rows. */ export declare const HL_PAYLOAD_REPLACE = "+"; /** Hunk-header keyword for concrete line replacement. */ export declare const HL_REPLACE_KEYWORD = "replace"; /** Hunk-header sub-keyword: `replace block N:` resolves N to a tree-sitter block range. */ export declare const HL_BLOCK_KEYWORD = "block"; /** Hunk-header keyword for concrete line deletion. */ export declare const HL_DELETE_KEYWORD = "delete"; /** Hunk-header keyword for insertion operations. */ export declare const HL_INSERT_KEYWORD = "insert"; /** Insert position keyword for inserting before a concrete line. */ export declare const HL_INSERT_BEFORE = "before"; /** Insert position keyword for inserting after a concrete line. */ export declare const HL_INSERT_AFTER = "after"; /** Insert position keyword for inserting at the start of the file. */ export declare const HL_INSERT_HEAD = "head"; /** Insert position keyword for inserting at the end of the file. */ export declare const HL_INSERT_TAIL = "tail"; /** Hunk-header terminator for body-bearing operations. */ export declare const HL_HEADER_COLON = ":"; /** Separator between a hashline file path and its opaque snapshot tag. */ export declare const HL_FILE_HASH_SEP = "#"; /** Separator between two line numbers in a range, e.g. `5..10`. */ export declare const HL_RANGE_SEP = ".."; /** Maximum number of concrete lines a numeric range may expand into. */ export declare const HL_MAX_EXPANDED_RANGE_LINES = 100000; /** Separator between a line number and displayed line content in hashline mode. */ export declare const HL_LINE_BODY_SEP = ":"; /** Bare positive line-number Lid (no decorations, no captures, no anchors). */ export declare const HL_LINE_RE_RAW = "[1-9]\\d*"; /** Capture-group form of {@link HL_LINE_RE_RAW}. */ export declare const HL_LINE_CAPTURE_RE_RAW = "([1-9]\\d*)"; /** Format a concrete replacement hunk header. */ export declare function formatReplaceHeader(start: number, end: number): string; /** Format a concrete deletion hunk header. */ export declare function formatDeleteHeader(start: number, end?: number): string; /** Format an insertion hunk header for a cursor position. */ export declare function formatInsertHeader(cursor: Cursor): string; /** Number of hex characters in a content-derived file-hash tag. */ export declare const HL_FILE_HASH_LENGTH = 4; /** Canonical uppercase hexadecimal content-hash tag carried by a hashline section header. */ export declare const HL_FILE_HASH_RE_RAW = "[0-9A-F]{4}"; /** Capture-group form of {@link HL_FILE_HASH_RE_RAW}. */ export declare const HL_FILE_HASH_CAPTURE_RE_RAW = "([0-9A-F]{4})"; /** Regex-escaped form of {@link HL_LINE_BODY_SEP}, safe for embedding inside a regex. */ export declare const HL_LINE_BODY_SEP_RE_RAW: string; /** * Representative file-hash tags for use in user-facing error messages and * prompt examples. */ export declare const HL_FILE_HASH_EXAMPLES: readonly ["1A2B", "3C4D", "9F3E"]; export declare function computeFileHash(text: string): string; /** * Format a comma-separated list of example anchors with an optional line-number * prefix, quoted for inclusion in error messages: `"160", "42", "7"`. */ export declare function describeAnchorExamples(linePrefix?: string): string; /** Format a hashline section header for a file path and snapshot tag. */ export declare function formatHashlineHeader(filePath: string, fileHash: string): string; /** Formats a single numbered line as `LINE:TEXT`. */ export declare function formatNumberedLine(lineNumber: number, line: string): string; /** Format file text with hashline-mode line-number prefixes for display. */ export declare function formatNumberedLines(text: string, startLine?: number): string; //# sourceMappingURL=format.d.ts.map