Fix every real lint finding and drop degenerate splice fragments

This commit is contained in:
2026-08-01 13:51:38 +07:00
parent 967b917001
commit 834d9e51b0
69 changed files with 10119 additions and 39 deletions
+52 -8
View File
@@ -1,11 +1,15 @@
import glob
import json
import os
import re
ROOT = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
LOG_PATH = os.path.join(ROOT, "docs", "progress-log.md")
README_PATH = os.path.join(ROOT, "README.md")
ADR_DIR = os.path.join(ROOT, "docs", "adr")
def latest_entry():
def latest_progress_entry():
try:
with open(LOG_PATH, encoding="utf-8") as f:
text = f.read()
@@ -16,16 +20,56 @@ def latest_entry():
return part.strip()
return ""
entry = latest_entry()
if entry:
context = (
"Project: Duoc Thu RAG medical chatbot (D:\\VSF-DUOCTHU). "
"Latest entry from docs/progress-log.md (read that file and "
"CLAUDE.md for full status before assuming anything):\n\n" + entry
def readme_text():
try:
with open(README_PATH, encoding="utf-8") as f:
return f.read().strip()
except FileNotFoundError:
return ""
def adr_index():
lines = []
for path in sorted(glob.glob(os.path.join(ADR_DIR, "*.md"))):
try:
with open(path, encoding="utf-8") as f:
first_line = f.readline().strip()
except OSError:
continue
title = re.sub(r"^#\s*", "", first_line)
lines.append(f"- `docs/adr/{os.path.basename(path)}`: {title}")
return "\n".join(lines)
sections = [
"Project: Duoc Thu RAG medical chatbot (D:\\VSF-DUOCTHU). "
"This is an automated orientation summary, not the full picture — read "
"the referenced files (README.md, docs/architecture.md, the specific "
"ADR, CLAUDE.md) before making claims about scope, architecture, or "
"what already exists."
]
readme = readme_text()
if readme:
sections.append("## README.md\n\n" + readme)
adrs = adr_index()
if adrs:
sections.append(
"## Architecture decision records (docs/adr/) — titles only, "
"read the full ADR before relying on its rationale/consequences:\n\n"
+ adrs
)
progress = latest_progress_entry()
if progress:
sections.append("## Latest entry from docs/progress-log.md\n\n" + progress)
if len(sections) > 1:
print(json.dumps({
"hookSpecificOutput": {
"hookEventName": "SessionStart",
"additionalContext": context,
"additionalContext": "\n\n".join(sections),
}
}))