Exit with a message when README.md is not UTF-8
This commit is contained in:
+1
-1
@@ -13,4 +13,4 @@
|
||||
- `loop-claude --help` names the Claude Code version its transcript, session and trust handling were observed on; check it first when an upgrade breaks a cycle.
|
||||
- `loop-claude` runs the model each project's settings pick; `LOOP_CLAUDE_WORKER_MODEL` and `LOOP_CLAUDE_JUDGE_MODEL` override it.
|
||||
- `settings.json`, the agents and the status line run on any machine unedited; the status line shows reset times in the machine's own time zone.
|
||||
- `loop-claude`'s no-premises exit names what is wrong: `README.md` the OS cannot open, a `## Goals` or `## Audience` heading missing or repeated, or nothing under one.
|
||||
- `loop-claude`'s no-premises exit names what is wrong: `README.md` the OS cannot open or that is not UTF-8, a `## Goals` or `## Audience` heading missing or repeated, or nothing under one.
|
||||
|
||||
@@ -165,6 +165,8 @@ def read_premises(root):
|
||||
found = sections(open(os.path.join(root, "README.md"), encoding="utf-8").read())
|
||||
except OSError as failure:
|
||||
sys.exit(f"README.md in {root}: {failure.strerror} - no premises.")
|
||||
except UnicodeDecodeError as failure:
|
||||
sys.exit(f"README.md is not UTF-8 at byte {failure.start} - no premises.")
|
||||
for name in ("Goals", "Audience"):
|
||||
bodies = found.get(name, [])
|
||||
if not bodies:
|
||||
|
||||
@@ -57,6 +57,8 @@ class ReadPremises(unittest.TestCase):
|
||||
os.mkdir(readme)
|
||||
self.assertIn("Is a directory", self.exit_message(root))
|
||||
os.rmdir(readme)
|
||||
open(readme, "wb").write(b"# T\n## Goals\n1. g\xff\n## Audience\nme\n")
|
||||
self.assertIn("README.md is not UTF-8 at byte 17", self.exit_message(root))
|
||||
for text, missing in texts.items():
|
||||
with self.subTest(missing=missing):
|
||||
open(readme, "w").write(text)
|
||||
|
||||
@@ -4,6 +4,5 @@
|
||||
|
||||
Ordered by how many seats of the 2026-09-25 scoring panel (`docs/decisions.md`) named the place; each is one chunk.
|
||||
|
||||
- Exit `loop-claude` with a message, today a traceback, when `README.md` is not UTF-8.
|
||||
- Say under `CLAUDE.md` → "One spelling per goal" that one spelling in two places is the same case, and what its rejection names.
|
||||
- Say `could not read` when `~/.claude.json` parses to anything but an object whose `projects` maps paths to objects, today a traceback before the interrupt.
|
||||
|
||||
Reference in New Issue
Block a user