Name what the premises lack when loop-claude exits without them

This commit is contained in:
2026-09-25 08:21:57 +02:00
parent e13623838c
commit 17dd447056
4 changed files with 36 additions and 7 deletions
+7 -4
View File
@@ -93,16 +93,19 @@ def sections(text):
current = None
elif current and line.strip():
found[current].append(line)
return {name: "\n".join(body) for name, body in found.items() if body}
return {name: "\n".join(body) for name, body in found.items()}
def read_premises():
try:
found = sections(open("README.md", encoding="utf-8").read())
except OSError:
found = {}
if not found.get("Goals") or not found.get("Audience"):
sys.exit("README.md needs ## Goals and ## Audience - no premises.")
sys.exit(f"no README.md in {os.getcwd()} - no premises.")
for name in ("Goals", "Audience"):
if name not in found:
sys.exit(f"README.md has no ## {name} heading - no premises.")
if not found[name]:
sys.exit(f"README.md has nothing under ## {name} - no premises.")
return f"## Goals\n{found['Goals']}\n\n## Audience\n{found['Audience']}"