Answer principles round 1: 0 🔴, 3 🟡 (0 misread); hand the home folder, the clock and the output to larv-review's commands from their wiring

This commit is contained in:
2026-11-13 03:04:44 +01:00
parent 87d5023773
commit e6da7b0b9c
22 changed files with 155 additions and 131 deletions
+4 -7
View File
@@ -1,6 +1,5 @@
"""todo.md on disk: read it with the files ranking reads, at the paths the project's config names, then rank or check it, write it back, and print what ranking reports."""
import pathlib
import sys
from failure import Failure
from project_config.settings import ProjectConfig
@@ -9,7 +8,7 @@ from text_files.file_writes import replace_file
def rank_file(todo: pathlib.Path, config: ProjectConfig) -> Ranked | Failure:
"""Rank todo in place: rank what read_all reads, write todo where that changed it, and print the notes and under-bar lines on stderr."""
"""Rank todo in place: rank what read_all reads, and write todo where that changed it. The caller prints `report_lines`."""
texts = read_all(todo, config)
if isinstance(texts, Failure):
return texts
@@ -18,14 +17,12 @@ def rank_file(todo: pathlib.Path, config: ProjectConfig) -> Ranked | Failure:
return ranked
if ranked.text != texts[0] and (unwritten := write(todo, ranked.text)):
return unwritten
print_report(todo, ranked)
return ranked
def print_report(todo: pathlib.Path, ranked: Ranked) -> None:
"""Print ranking's notes and under-bar lines on stderr, each prefixed with todo's path."""
for line in ranked.notes + ranked.under_bar:
print(f"{todo}: {line}", file=sys.stderr)
def report_lines(todo: pathlib.Path, ranked: Ranked) -> list[str]:
"""Ranking's notes and under-bar lines, each prefixed with todo's path, as a tool prints them on stderr."""
return [f"{todo}: {line}" for line in ranked.notes + ranked.under_bar]
def check_failures(todo: pathlib.Path, config: ProjectConfig) -> list[str]: