7c64576524
- Replaced 4-hex content-derived file hashes with 3-hex opaque tags minted by InMemorySnapshotStore, making tags session-bound pointers rather than content fingerprints. - Removed lru-cache dependency; replaced LRU-bounded per-path rings with a flat 4096-slot global ring using a scrambled permutation to prevent LLM tag extrapolation. - Made SnapshotStore required in Patcher (was optional); tag resolution now drives stale-anchor detection instead of recomputing hashes at apply time. - Changed literal payload sigil from `|` to `+` and accepted `^A` shorthand for `^A-A`; added lenient recovery for bare bodies, lone `-` rows, and overlapping bare/concrete block pairs.
21 lines
700 B
TypeScript
21 lines
700 B
TypeScript
/**
|
|
* Format a single line of match output for grep/ast-grep style results.
|
|
*
|
|
* Matched lines are prefixed with `*`; context lines are prefixed with a single
|
|
* space so line numbers align in column. In hashline mode the line uses the
|
|
* editable `LINE:content` shape under a snapshot-tag header; in plain mode it
|
|
* keeps the legacy `LINE|content` display-only shape. Line numbers are never padded.
|
|
*/
|
|
export function formatMatchLine(
|
|
lineNumber: number,
|
|
line: string,
|
|
isMatch: boolean,
|
|
options: { useHashLines: boolean },
|
|
): string {
|
|
const marker = isMatch ? "*" : " ";
|
|
if (options.useHashLines) {
|
|
return `${marker}${lineNumber}:${line}`;
|
|
}
|
|
return `${marker}${lineNumber}|${line}`;
|
|
}
|