pub fn looks_like_source_code(content: &str) -> boolExpand description
Heuristic fallback: does this text look like source code (vs command output)?
Deliberately conservative — it only returns true when code signals clearly
dominate and shell/log signals are essentially absent, so genuine logs and
build output are still compressed. Used only when the tool name is unknown.
GH #628: the previous version under-counted real source — a decorative
separator comment (// ————, // ====) and the call-shaped scaffolding of a
test file (describe(…) {, });) scored as non-code, so a genuine source
read routed through an unrecognized tool was lossy-compressed and silently
lost those separator lines, breaking the model’s subsequent exact-match edit.
The fix: comment lines are neutral (never dilute the ratio) and top-level
call/closer shapes count as code even at column 0. The shell-signal veto is
untouched, so genuine logs and build output are still compressed.