refactor(kanban-cli): split the subcommand spec list so no function exceeds 300 LOC

This commit is contained in:
Teknium
2026-09-02 16:40:44 -07:00
parent f9f87d9876
commit 37e0e1a76d

View File

@@ -132,8 +132,8 @@ def _board_specs():
]
def _specs():
"""Top-level ``hermes kanban <action>`` records, in ``--help`` order."""
def _task_specs():
"""``init`` … ``attach-rm``: creation, listing, inspection and attachment verbs."""
return [
_cmd("init", help="Create kanban.db if missing (idempotent)"),
_cmd("boards", children=("boards_action", _board_specs()),
@@ -291,6 +291,12 @@ def _specs():
], help="Attach a local file to a task"),
_cmd("attachments", [_arg("task_id"), _json_flag()], help="List a task's attachments"),
_cmd("attach-rm", [_arg("attachment_id", type=int)], help="Delete an attachment by id"),
]
def _lifecycle_specs():
"""``complete`` … ``repair``: state transitions, dispatcher, notify and maintenance verbs."""
return [
_cmd("complete", [
_arg("task_ids", nargs="+",
help="One or more task ids (only --result applies to all of them)"),
@@ -484,6 +490,11 @@ def _specs():
]
def _specs():
"""Top-level ``hermes kanban <action>`` records, in ``--help`` order."""
return _task_specs() + _lifecycle_specs()
def build_parser(parent_subparsers: argparse._SubParsersAction) -> argparse.ArgumentParser:
"""Attach the ``kanban`` subcommand tree; returns the ``kanban`` parser."""
kanban_parser = parent_subparsers.add_parser(