Name what the premises lack when loop-claude exits without them
This commit is contained in:
+7
-4
@@ -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']}"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user