last progress before ending last session
This commit is contained in:
+18
-3
@@ -129,9 +129,24 @@ def _summarise_generic(path: Path, content: str) -> str:
|
||||
line_count = len(lines)
|
||||
suffix = path.suffix.lstrip(".").upper() or "TEXT"
|
||||
parts = [f"**{suffix}** — {line_count} lines"]
|
||||
preview = lines[:8]
|
||||
if preview:
|
||||
parts.append("preview:\n```\n" + "\n".join(preview) + "\n```")
|
||||
|
||||
# Heuristic for C-style languages
|
||||
important_lines = []
|
||||
for line in lines[:200]:
|
||||
trimmed = line.strip()
|
||||
if not trimmed or trimmed.startswith("//") or trimmed.startswith("/*") or trimmed.startswith("*"):
|
||||
continue
|
||||
if re.match(r'^\s*(class|struct|namespace|enum|template|void|int|float|double|char|bool|virtual|static|inline|extern|#define|#include)\b', line):
|
||||
important_lines.append(trimmed)
|
||||
if len(important_lines) >= 15:
|
||||
break
|
||||
|
||||
if important_lines:
|
||||
parts.append("Key elements / Outline:\n- " + "\n- ".join(important_lines))
|
||||
else:
|
||||
preview = [l for l in lines[:10] if l.strip()]
|
||||
if preview:
|
||||
parts.append("preview:\n```\n" + "\n".join(preview) + "\n```")
|
||||
return "\n".join(parts)
|
||||
|
||||
_SUMMARISERS: dict[str, Callable[[Path, str], str]] = {
|
||||
|
||||
Reference in New Issue
Block a user