Answer stability round 1: 0 🔴, 2 🟡 (0 misread); show reuses item_details and reads todo.md alone, and the --calls file is owner-only

This commit is contained in:
2026-11-12 08:23:35 +01:00
parent 0ca23f5612
commit 9439d7ec5c
5 changed files with 80 additions and 38 deletions
+13 -7
View File
@@ -1,12 +1,12 @@
"""File an item in todo.md, or finish one, and rank the file as rank_todo.py does.
"""File an item in todo.md or finish one, ranking the file as rank_todo.py does, or show one.
usage: todo-item add --release <version> --l <L> --e <E> --i <I> --s <S> [--moves <moves>]
[--blocked-by <IDs>] [--exempt <reason>] <tagline> [<<'EOF' detail EOF]
todo-item finish <ID> [--changelog <bullet> | --no-changelog]
todo-item show <ID>
Works on the todo.md in the current folder and the CHANGELOG.md beside it, and reads the README.md
and docs/decisions.md beside todo.md.
All three work on the todo.md in the current folder. add and finish also use the CHANGELOG.md beside it,
and read the README.md and docs/decisions.md beside todo.md.
The cells take the format rank_todo.py --help states; the letter flags take upper case too, as --L.
add takes Next ID as the item's ID and raises Next ID by one. It writes the row, with the tagline
@@ -20,8 +20,9 @@ file, where missing. It refuses where that section holds ### subsections: add th
Where CHANGELOG.md exists, finish needs --changelog or --no-changelog, so no bullet is left out by
mistake. It prints `Finished item <ID>.` It writes nothing while docs/decisions.md cites the item.
show prints the items table's header, item <ID>'s row and its detail, from its ### heading to the next
item's, sub-headings included. It writes nothing, and fails, saying so, where todo.md has no such row.
show reads only todo.md. It prints the items table's header and divider, item <ID>'s row, and its detail
from its ### heading to the next item's, sub-headings included. It fails, saying so, where todo.md has
no row for <ID>.
Exit 2 on bad arguments, and 1, saying why, on any other failure. A message opening `not filed:`
or `not finished:` means it wrote nothing.
@@ -78,8 +79,13 @@ def parser() -> argparse.ArgumentParser:
def show(args: argparse.Namespace, folder: pathlib.Path) -> str | Failure:
texts = plan_file.read_all(folder / "todo.md")
return texts if isinstance(texts, Failure) else shown(texts[0], args.id)
todo = folder / "todo.md"
try:
return shown(todo.read_text(encoding="utf-8"), args.id)
except OSError as failure:
return Failure(f"{todo}: {failure.strerror}")
except UnicodeDecodeError:
return Failure(f"{todo}: not UTF-8")
def add(args: argparse.Namespace, folder: pathlib.Path, stdin: typing.TextIO) -> str | Failure: