Answer product-owner round 1: 0 🔴, 2 🟡 (0 misread); let the planner compare Scores in the file, name finish --no-changelog for a dropped item, name the plan's path in every refusal and exit 2 on a bad --release
This commit is contained in:
+22
-14
@@ -10,14 +10,15 @@ usage: todo-item list [--release <version>]
|
||||
todo-item finish <ID> [--changelog <bullet> | --no-changelog]
|
||||
|
||||
Run inside a checkout. Every command works on the plan the project's config names, which
|
||||
`project-config plan` prints, and names it in what it prints. Read and change the plan only through
|
||||
these commands: they work the same whatever holds it. Today that is a markdown file, todo.md, and
|
||||
each command that changes it ranks it as rank_todo.py does, so it also reads the goals file and
|
||||
docs/decisions.md, each where the config puts it.
|
||||
`project-config plan` prints. The commands work the same whatever holds the plan.
|
||||
Today a markdown file, todo.md, holds it. Each command that changes the file ranks it as rank_todo.py
|
||||
does, and so reads the goals file, docs/decisions.md and the comprehension history, each where the
|
||||
config puts it.
|
||||
The cells take the format rank_todo.py --help states; the letter flags take upper case too, as --L.
|
||||
|
||||
list prints `From <plan>, in its order:`, then one table row per item, without details: first the
|
||||
earliest release, and within a release the item to take first. --release prints one release's items.
|
||||
list prints `From <plan>, in its order:`, then the table's header and divider and one row per item,
|
||||
without details: first the earliest release, and within a release the item to take first.
|
||||
--release prints one release's items. Where no item fits, it prints `<plan> holds no item.`
|
||||
|
||||
show prints `From <plan>:`, then the table's header and divider, item <ID>'s row, and its detail under
|
||||
`### <ID>. <tagline>`, sub-headings included. It fails, saying so, where the plan holds no item <ID>.
|
||||
@@ -40,6 +41,7 @@ CHANGELOG.md's ## Unreleased, or a ## heading that says unreleased, creating the
|
||||
file, where missing. It refuses where that section holds ### subsections: add the bullet by hand.
|
||||
Where CHANGELOG.md holds text, finish needs --changelog or --no-changelog, so no bullet is left out by
|
||||
mistake. It prints `Finished item <ID> in <plan>.` It doesn't write anything while docs/decisions.md cites the item.
|
||||
finish <ID> --no-changelog also drops an item no chunk built.
|
||||
|
||||
Exit 2 on bad arguments, and 1, saying why, on any other failure. A message opening `not filed:`,
|
||||
`not edited:`, `not moved:` or `not finished:` means it didn't write anything.
|
||||
@@ -52,7 +54,7 @@ import typing
|
||||
from release_plan.todo_table import BLOCKED_BY, MOVES
|
||||
from failure import Failure
|
||||
from project_config.main import located
|
||||
from release_plan.release import parsed
|
||||
from release_plan.release import parsed, Release, version as release_version
|
||||
from plan_store.stores import store as plan_store, PlanStore, TAGLINE, Written
|
||||
from record_store.stores import RecordStore, store
|
||||
from todo_item.table import shown, table
|
||||
@@ -97,7 +99,7 @@ def main(argv: list[str], folder: pathlib.Path = pathlib.Path(), stdin: typing.T
|
||||
def parser() -> argparse.ArgumentParser:
|
||||
parsed_ = argparse.ArgumentParser(prog="todo-item")
|
||||
commands = parsed_.add_subparsers(dest="command", required=True)
|
||||
commands.add_parser("list").add_argument("--release")
|
||||
commands.add_parser("list").add_argument("--release", type=version)
|
||||
commands.add_parser("show").add_argument("id", type=int)
|
||||
adding = commands.add_parser("add")
|
||||
adding.add_argument("--release", required=True)
|
||||
@@ -121,6 +123,14 @@ def parser() -> argparse.ArgumentParser:
|
||||
return parsed_
|
||||
|
||||
|
||||
def version(text: str) -> Release:
|
||||
"""The release a --release value names; a bad argument where it is no semver version."""
|
||||
release = parsed(text)
|
||||
if release is None:
|
||||
raise argparse.ArgumentTypeError(f"{text!r} is not a semver version")
|
||||
return release
|
||||
|
||||
|
||||
def cell_flags(command: argparse.ArgumentParser, required: bool) -> None:
|
||||
"""The flags add and edit share. add needs each score; a flag edit is not given stays None, so its cell stays as it is."""
|
||||
for letter in LETTERS:
|
||||
@@ -150,14 +160,12 @@ def reported(written: Written | Failure, refusal: str, done: typing.Callable[[Wr
|
||||
|
||||
|
||||
def list_(args: argparse.Namespace, plan: PlanStore) -> str | Failure:
|
||||
if args.release is not None and parsed(args.release) is None:
|
||||
return Failure(f"--release {args.release!r} is not a semver version")
|
||||
read = plan.read()
|
||||
if isinstance(read, Failure):
|
||||
return read
|
||||
found = [item for item in read.items if args.release is None or item.release == parsed(args.release)]
|
||||
found = [item for item in read.items if args.release is None or item.release == args.release]
|
||||
if not found:
|
||||
return f"{plan.label} holds no item{'' if args.release is None else f' for release {args.release}'}."
|
||||
return f"{plan.label} holds no item{'' if args.release is None else f' for release {release_version(args.release)}'}."
|
||||
return f"From {plan.label}, in its order:\n\n{table(found)}"
|
||||
|
||||
|
||||
@@ -185,8 +193,8 @@ def finish(args: argparse.Namespace, plan: PlanStore, changelog: RecordStore) ->
|
||||
if isinstance(news, Failure):
|
||||
return Failure(f"not finished: {news.reason}")
|
||||
if news and args.changelog is None and not args.no_changelog:
|
||||
return Failure(f"not finished: {changelog.label} exists; pass --changelog <bullet>, or --no-changelog where the repo doesn't publish anything")
|
||||
# The bullet is checked before the plan changes, so a bullet finish refuses leaves both as they were.
|
||||
return Failure(f"not finished: {changelog.label} exists; pass --changelog <bullet>, or --no-changelog where the repo doesn't publish anything or no chunk built the item")
|
||||
# The bullet is checked before the plan changes: where finish refuses the bullet, the plan and the changelog stay as they were.
|
||||
added = None if args.changelog is None else with_bullet(news, args.changelog)
|
||||
if isinstance(added, Failure):
|
||||
return Failure(f"not finished: {added.reason}")
|
||||
|
||||
Reference in New Issue
Block a user