Edit a Jira issue the loop filed, and score a teammate's with a comment saying why
CI / tests (pull_request) Successful in 1m48s

This commit is contained in:
2026-11-16 01:55:57 +01:00
parent 0681e9be17
commit 2e9d9dd714
13 changed files with 326 additions and 27 deletions
+15 -6
View File
@@ -6,12 +6,12 @@ usage: todo-item list [--release <version>]
[--blocked-by <IDs>] [--exempt <reason>] <tagline> [<<'EOF' detail EOF]
todo-item edit <ID> [--tagline <tagline>] [--l <L>] [--e <E>] [--i <I>] [--s <S>] [--moves <moves>]
[--blocked-by <IDs>] [--exempt <reason>] [--detail <<'EOF' detail EOF | --clear-detail]
[--comment <why>]
todo-item move <ID> --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: a markdown file, todo.md, or a Jira epic. In a Jira epic, list,
show, add and finish work, and edit and move fail so far. Each command that changes
`project-config plan` prints: a markdown file, todo.md, or a Jira epic. Each command that changes
a todo.md 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.
@@ -39,8 +39,16 @@ empties the cell. --detail replaces the detail with the text on stdin, and --cle
Text on stdin without --detail, and --detail without text on stdin, are refused, so no detail is
dropped or wiped by mistake. It prints `Edited item <ID> in <plan>.` It doesn't write anything where
ranking fails or scores the item under the bar.
In a Jira epic, edit changes an issue the loop filed: its summary, description, scores and Fix
Version, and the label `security` with --exempt. It doesn't change a link, so --blocked-by fails.
Of an issue a person filed it sets only the scores, --moves and --exempt, and only with --comment.
--comment is posted as a comment on the Jira issue, for the client's team: say why the edit is
made, in the project's language. A todo.md keeps no comment, so there the flag doesn't do anything.
Where Jira takes the edit and then refuses the comment, edit still prints `Edited item <ID> …`,
and says on stderr to post the comment in Jira.
move sets the item's release, as edit sets a cell. It prints `Moved item <ID> to release <version> in <plan>.`
In a Jira epic, move sets the Fix Version of an issue the loop filed; a person moves their own.
finish removes the item and its detail. With --changelog it adds the bullet first under
CHANGELOG.md's ## Unreleased, or a ## heading that says unreleased, creating the section, or the
@@ -56,9 +64,9 @@ from its present status, or where the transition leads to another status or to o
count as done. An issue that no chunk built is dropped in Jira, not with finish, which would mark it done.
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. The one exception is an add to, or a
finish in, a Jira epic that Jira didn't answer or answered brokenly: the message then says the issue
may exist, or may have moved.
`not edited:`, `not moved:` or `not finished:` means it didn't write anything. The one exception is an add,
an edit or a finish in a Jira epic that Jira didn't answer or answered brokenly: the message then
says the issue may exist, may have changed or may have moved.
"""
import argparse
import pathlib
@@ -126,6 +134,7 @@ def parser() -> argparse.ArgumentParser:
detail = editing.add_mutually_exclusive_group()
detail.add_argument("--detail", action="store_true")
detail.add_argument("--clear-detail", action="store_true")
editing.add_argument("--comment")
moving = commands.add_parser("move")
moving.add_argument("id", type=int)
moving.add_argument("--release", required=True)
@@ -199,7 +208,7 @@ def edit(args: argparse.Namespace, plan: PlanStore, text: str) -> str | Failure:
detail = text if args.detail else "" if args.clear_detail else None
if not fields(args) and detail is None:
return Failure("not edited: no flag names a change; todo-item --help lists them")
return reported(plan.edit(args.id, fields(args), detail), "not edited", lambda written: f"Edited item {written.id} in {plan.label}.")
return reported(plan.edit(args.id, fields(args), detail, args.comment), "not edited", lambda written: f"Edited item {written.id} in {plan.label}.")
def finish(args: argparse.Namespace, plan: PlanStore, changelog: RecordStore) -> str | Failure: