1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! `recover` subcommand - reconstruct a single file's history from a transcript.
//!
//! Where `files` only rolls up THAT a file was touched, `recover` rebuilds the file's
//! CONTENT, line by line, by replaying the transcript's Reads / Writes / Edits in
//! transcript order, and emits one of four views:
//!
//! - `--patches` (default) segmented unified-diff history of `--file`, split at INTEGRITY
//! BOUNDARIES (a point where reconstruction across it is invalid: a `File has been
//! modified since read` harness error, an `originalFile` that disagrees with the
//! replayed buffer, an external `edited_text_file`, or a heuristic Bash mutation).
//! - `--at` the PARTIAL, line-numbered "in the LLM's eyes" snapshot as of a cutoff;
//! unknown lines are EXPLICIT gaps, never fabricated.
//! - `--coverage` scope a recovery (recoverable ranges + boundaries + counts), no dump.
//!
//! ## The one new capability: jsonl line numbers
//!
//! No line-number tracking exists elsewhere in `src/`: [`crate::parse::scan_lines_bytes`]
//! hands the visitor only `&[u8]`. We add a LOCAL counter here (never touching the shared
//! signature, so `files`/`search` are unperturbed): `scan_lines_bytes` visits every
//! `\n`-delimited segment with no skipping, so incrementing on each visit yields an exact
//! 1:1 jsonl line map (blank + malformed lines are counted too). Every emitted reference
//! carries its `Lnnnnn` so a consumer can `Read` the raw jsonl directly.
//!
//! ## Never fabricate
//!
//! Reconstruction is necessarily PARTIAL. A line never Read/Edited is an explicit gap; an
//! edit whose `old_string` spans an unknown gap is an un-anchorable coverage hole; a Bash
//! touch is a HEURISTIC (soft) boundary, not authoritative. No silent truncation anywhere.
use BTreeMap;
use Path;
use ;
use memmem;
use *;
use crate;
use crate;
use cratemmap_bytes;
use cratepath;
use crateTimeWindow;
use crate;
/// Max characters of inline content shown before an explicit `… (+N chars)` marker in
/// HUMAN text output (JSON + `--out` are verbatim). Mirrors `search::EXCERPT_MAX`.
const EXCERPT_MAX: usize = 400;
// ─────────────────────────────────────────────────────────────────────────────
// Data model
// ─────────────────────────────────────────────────────────────────────────────
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;