Skip to content

The agent that grows with you

refactor(kanban-cli): parser — drop explicit default=None on optional flags (argparse default; action dump identical)

Tekniumea6d0b625de8
diff --git a/hermes_cli/kanban_parser.py b/hermes_cli/kanban_parser.py
index 1944cfc4158..d64f009c2f5 100644
--- a/hermes_cli/kanban_parser.py
+++ b/hermes_cli/kanban_parser.py
@@ -37,13 +37,13 @@ def _json_flag(**kw):
def _reason(help: str):
- return _arg("--reason", default=None, help=help)
+ return _arg("--reason", help=help)
def _run_state_args(type_help: str):
return (
- _arg("--state-type", choices=("status", "outcome"), default=None, help=f"With --state-name: {type_help}"),
- _arg("--state-name", default=None, metavar="VALUE",
+ _arg("--state-type", choices=("status", "outcome"), help=f"With --state-name: {type_help}"),
+ _arg("--state-name", metavar="VALUE",
help="With --state-type: keep runs whose column equals this value"),
)
@@ -51,33 +51,33 @@ def _run_state_args(type_help: str):
def _triage_sweep_args(verb: str, Verb: str, noun: str):
"""Shared ``specify`` / ``decompose`` arguments."""
return (
- _arg("task_id", nargs="?", default=None, help=f"Task id to {verb} (required unless --all is given)"),
+ _arg("task_id", nargs="?", help=f"Task id to {verb} (required unless --all is given)"),
_arg("--all", dest="all_triage", action="store_true", help=f"{Verb} every task currently in the triage column"),
- _arg("--tenant", default=None, help="When used with --all, restrict the sweep to this tenant"),
- _arg("--author", default=None,
+ _arg("--tenant", help="When used with --all, restrict the sweep to this tenant"),
+ _arg("--author",
help=f"Author name recorded on the audit comment (default: $HERMES_PROFILE or '{noun}')"),
_json_flag(help="Emit one JSON object per task on stdout"),
)
def _bulk_ids(verb: str):
- return _arg("--ids", nargs="+", default=None, help=f"Additional task ids to {verb} with the same reason (bulk mode)")
+ return _arg("--ids", nargs="+", help=f"Additional task ids to {verb} with the same reason (bulk mode)")
_TASK_ID = _arg("task_id")
_TASK_IDS = _arg("task_ids", nargs="+")
_SLUG = _arg("slug")
-_TENANT = _arg("--tenant", default=None, help="Tenant namespace")
+_TENANT = _arg("--tenant", help="Tenant namespace")
_PRIORITY = _arg("--priority", type=int, default=0, help="Priority tiebreaker")
_RECLAIM_REASON = _reason("Human-readable reason (recorded on the reclaimed event)")
_NOTIFY_TARGET = (
_arg("--platform", required=True),
_arg("--chat-id", required=True),
- _arg("--thread-id", default=None),
+ _arg("--thread-id"),
)
_STEP_HANDOFF = (
- _arg("--summary", default=None, help="Structured handoff summary. Falls back to --result if omitted."),
- _arg("--metadata", default=None, help="JSON dict of structured facts to store on the latest completed run."),
+ _arg("--summary", help="Structured handoff summary. Falls back to --result if omitted."),
+ _arg("--metadata", help="JSON dict of structured facts to store on the latest completed run."),
)
_BOARD_SPECS = [
@@ -87,12 +87,12 @@ _BOARD_SPECS = [
], aliases=["ls"], help="List all boards with task counts"),
_cmd("create", [
_arg("slug", help="Board slug (kebab-case, e.g. atm10-server)"),
- _arg("--name", default=None, help="Human-readable display name (defaults to Title Case of slug)"),
- _arg("--description", default=None, help="Optional description"),
- _arg("--icon", default=None, help="Optional emoji or single-character icon for the dashboard"),
- _arg("--color", default=None, help="Optional hex color (e.g. '#8b5cf6') for the dashboard"),
+ _arg("--name", help="Human-readable display name (defaults to Title Case of slug)"),
+ _arg("--description", help="Optional description"),
+ _arg("--icon", help="Optional emoji or single-character icon for the dashboard"),
+ _arg("--color", help="Optional hex color (e.g. '#8b5cf6') for the dashboard"),
_arg("--switch", action="store_true", help="Switch to the new board after creating it"),
- _arg("--default-workdir", default=None, help="Default workspace path for tasks created on this board"),
+ _arg("--default-workdir", help="Default workspace path for tasks created on this board"),
], aliases=["new"], help="Create a new board"),
_cmd("rm", [
_SLUG,
@@ -106,11 +106,11 @@ _BOARD_SPECS = [
help="Change a board's human-readable display name (slug is immutable)"),
_cmd("set-default-workdir", [
_SLUG,
- _arg("path", nargs="?", default=None, help="Absolute path to use as default workdir. Omit to clear."),
+ _arg("path", nargs="?", help="Absolute path to use as default workdir. Omit to clear."),
], help="Set the default workspace path for tasks on a board"),
_cmd("export", [
- _arg("slug", nargs="?", default=None, help="Board to export (default: the current board)"),
- _arg("-o", "--output", default=None, help="Archive path (default: ./<slug>.tar.gz)"),
+ _arg("slug", nargs="?", help="Board to export (default: the current board)"),
+ _arg("-o", "--output", help="Archive path (default: ./<slug>.tar.gz)"),
_arg("--no-attachments", action="store_true", help="Skip attachment files, keeping the archive small"),
_arg("--include-logs", action="store_true", help="Include per-task worker logs"),
_json_flag(),
@@ -122,7 +122,7 @@ _BOARD_SPECS = [
)),
_cmd("import", [
_arg("archive", help="Path to the .tar.gz archive"),
- _arg("--as", dest="as_slug", default=None, help="Slug for the imported board (default: from the archive)"),
+ _arg("--as", dest="as_slug", help="Slug for the imported board (default: from the archive)"),
_arg("--switch", action="store_true", help="Switch to the imported board afterwards"),
_json_flag(),
], help="Import a board archive as a new board", description=(
@@ -145,13 +145,13 @@ _SPECS = [
)),
_cmd("create", [
_arg("title", help="Task title"),
- _arg("--body", default=None, help="Optional opening post"),
- _arg("--assignee", default=None, help="Profile name to assign"),
+ _arg("--body", help="Optional opening post"),
+ _arg("--assignee", help="Profile name to assign"),
_arg("--parent", action="append", default=[], help="Parent task id (repeatable)"),
_arg("--workspace", default="scratch",
help="scratch | worktree | worktree:<path> | dir:<path> (default: scratch)"),
- _arg("--branch", default=None, help="Branch name for worktree tasks, e.g. wt/t6-wire"),
- _arg("--project", default=None,
+ _arg("--branch", help="Branch name for worktree tasks, e.g. wt/t6-wire"),
+ _arg("--project",
help="Link to a project (id or slug). Anchors the task's "
"worktree under the project's primary repo with a "
"deterministic branch. See `hermes project list`."),
@@ -159,10 +159,10 @@ _SPECS = [
_PRIORITY,
_arg("--triage", action="store_true",
help="Park in triage — a specifier will flesh out the spec and promote to todo"),
- _arg("--idempotency-key", default=None,
+ _arg("--idempotency-key",
help="Dedup key. If a non-archived task with this key exists, "
"its id is returned instead of creating a duplicate."),
- _arg("--max-runtime", default=None,
+ _arg("--max-runtime",
help="Per-task runtime cap. Accepts seconds (300) or durations (90s, "
"30m, 2h, 1d). When exceeded, the dispatcher SIGTERMs (then "
"SIGKILLs) the worker and re-queues the task."),
@@ -171,17 +171,17 @@ _SPECS = [
help="Skill to force-load into the worker (repeatable). The kanban "
"lifecycle is already injected automatically. Example: --skill "
"translation --skill github-code-review"),
- _arg("--max-retries", type=int, default=None, metavar="N",
+ _arg("--max-retries", type=int, metavar="N",
help="Per-task override for the consecutive-failure "
f"circuit breaker. Trip on the Nth failure — e.g. --max-retries 1 blocks on the "
f"first failure (no retries), --max-retries 3 allows two retries. Omit to use "
f"the dispatcher's kanban.failure_limit config (default "
f"{kb.DEFAULT_FAILURE_LIMIT})."),
- _arg("--model", default=None, dest="model_override",
+ _arg("--model", dest="model_override",
help="Pin the worker to this model (passed as -m <model>) without "
"changing the profile's configured model. Combine with --provider "
"when the model belongs to a different backend than the profile's default."),
- _arg("--provider", default=None, dest="provider_override",
+ _arg("--provider", dest="provider_override",
help="Provider the --model belongs to (passed as --provider <name> to "
"the worker). Requires --model."),
_arg("--goal", action="store_true", dest="goal_mode",
@@ -190,7 +190,7 @@ _SPECS = [
"keeps going in the same session until the judge agrees it's "
"complete (or the turn budget runs out, which blocks the card for "
"review). Best for open-ended cards one shot rarely finishes."),
- _arg("--goal-max-turns", type=int, default=None, metavar="N", dest="goal_max_turns",
+ _arg("--goal-max-turns", type=int, metavar="N", dest="goal_max_turns",
help="Turn budget for --goal workers (default 20). Ignored without --goal."),
_arg("--initial-status", choices=sorted(kb.VALID_INITIAL_STATUSES), default="running",
help="Initial card status. Use 'blocked' for cards "
@@ -206,23 +206,23 @@ _SPECS = [
_arg("--synthesizer", required=True, help="Synthesizer/writer profile"),
_TENANT,
_PRIORITY,
- _arg("--created-by", default=None, help="Creator/anchor profile"),
- _arg("--idempotency-key", default=None, help="Dedup key for the root card"),
+ _arg("--created-by", help="Creator/anchor profile"),
+ _arg("--idempotency-key", help="Dedup key for the root card"),
_json_flag(help="Emit JSON output"),
], help="Create a Kanban Swarm v1 graph (parallel workers → verifier → synthesizer)"),
_cmd("list", [
_arg("--mine", action="store_true", help="Filter by $HERMES_PROFILE as assignee"),
- _arg("--assignee", default=None),
- _arg("--status", default=None, choices=sorted(kb.VALID_STATUSES)),
- _arg("--tenant", default=None),
- _arg("--session", default=None,
+ _arg("--assignee"),
+ _arg("--status", choices=sorted(kb.VALID_STATUSES)),
+ _arg("--tenant"),
+ _arg("--session",
help="Filter by originating chat/agent session id (set on tasks created from inside an ACP loop)"),
_arg("--archived", action="store_true", help="Include archived tasks"),
_json_flag(),
- _arg("--sort", default=None, choices=sorted(kb.VALID_SORT_ORDERS.keys()),
+ _arg("--sort", choices=sorted(kb.VALID_SORT_ORDERS.keys()),
help="Sort order for listed tasks (default: priority)"),
- _arg("--workflow-template-id", default=None, metavar="ID", help="Restrict to tasks with this workflow_template_id"),
- _arg("--step-key", default=None, dest="current_step_key", metavar="KEY",
+ _arg("--workflow-template-id", metavar="ID", help="Restrict to tasks with this workflow_template_id"),
+ _arg("--step-key", dest="current_step_key", metavar="KEY",
help="Restrict to tasks with this current_step_key"),
], aliases=["ls"], help="List tasks"),
_cmd("show", [_TASK_ID, _json_flag(), *_run_state_args("filter listed runs by task_runs column")],
@@ -231,8 +231,8 @@ _SPECS = [
help="Assign or reassign a task"),
_cmd("set-model", [
_TASK_ID,
- _arg("model", nargs="?", default=None, help="Model to pin the worker to (or 'none' to clear the override)"),
- _arg("--provider", default=None,
+ _arg("model", nargs="?", help="Model to pin the worker to (or 'none' to clear the override)"),
+ _arg("--provider",
help="Provider the model belongs to (worker is spawned with "
"--provider <name>). Cleared together with the model."),
], help="Set or clear a task's model/provider override (takes effect on the next dispatch)"),
@@ -245,9 +245,9 @@ _SPECS = [
_RECLAIM_REASON,
], help="Reassign a task to a different profile, optionally reclaiming first"),
_cmd("diagnostics", [
- _arg("--severity", choices=["warning", "error", "critical"], default=None,
+ _arg("--severity", choices=["warning", "error", "critical"],
help="Only show diagnostics at or above this severity"),
- _arg("--task", default=None, help="Only show diagnostics for one task id"),
+ _arg("--task", help="Only show diagnostics for one task id"),
_json_flag(help="Emit JSON (structured) instead of the default human table"),
], aliases=["diag"], help="List active diagnostics on the current board"),
_cmd("link", [_arg("parent_id"), _arg("child_id")], help="Add a parent->child dependency"),
@@ -259,24 +259,24 @@ _SPECS = [
_cmd("comment", [
_TASK_ID,
_arg("text", nargs="+", help="Comment body"),
- _arg("--author", default=None, help="Author name (default: $HERMES_PROFILE or 'user')"),
- _arg("--max-len", type=int, default=None, help="Trim the stored comment body to this many characters"),
+ _arg("--author", help="Author name (default: $HERMES_PROFILE or 'user')"),
+ _arg("--max-len", type=int, help="Trim the stored comment body to this many characters"),
], help="Append a comment"),
_cmd("attach", [
_TASK_ID,
_arg("path", help="Path to the local file to attach"),
- _arg("--content-type", default=None, help="MIME type (default: guessed from the file extension)"),
- _arg("--name", default=None, help="Stored filename (default: the source file's basename)"),
- _arg("--author", default=None, help="uploaded_by label (default: $HERMES_PROFILE or 'user')"),
+ _arg("--content-type", help="MIME type (default: guessed from the file extension)"),
+ _arg("--name", help="Stored filename (default: the source file's basename)"),
+ _arg("--author", help="uploaded_by label (default: $HERMES_PROFILE or 'user')"),
], help="Attach a local file to a task"),
_cmd("attachments", [_TASK_ID, _json_flag()], help="List a task's attachments"),
_cmd("attach-rm", [_arg("attachment_id", type=int)], help="Delete an attachment by id"),
_cmd("complete", [
_arg("task_ids", nargs="+", help="One or more task ids (only --result applies to all of them)"),
- _arg("--result", default=None, help="Result summary"),
- _arg("--summary", default=None,
+ _arg("--result", help="Result summary"),
+ _arg("--summary",
help="Structured handoff summary for downstream tasks. Falls back to --result if omitted."),
- _arg("--metadata", default=None,
+ _arg("--metadata",
help='JSON dict of structured facts (e.g. \'{"changed_files": [...], '
'"tests_run": 12}\'). Stored on the closing run.'),
], help="Mark one or more tasks done"),
@@ -289,7 +289,7 @@ _SPECS = [
_TASK_ID,
_arg("reason", nargs="*", help="Reason (also appended as a comment)"),
_bulk_ids("block"),
- _arg("--kind", default=None, choices=sorted(kb.VALID_BLOCK_KINDS),
+ _arg("--kind", choices=sorted(kb.VALID_BLOCK_KINDS),
help="Typed block reason. 'dependency' waits in todo (auto-promoted when "
"parents finish, no human); 'needs_input'/'capability' go to "
"blocked for a human; 'transient' marks a maybe-flaky failure. "
@@ -307,9 +307,9 @@ _SPECS = [
], help="Return blocked/scheduled tasks to ready, or todo while parents remain open"),
_cmd("request-review", [
_TASK_ID,
- _arg("--summary", default=None, help="What was implemented and how it was verified — shown to the reviewer."),
- _arg("--reviewer", default=None, help="Optional reviewer profile; reassigns the task before review dispatch."),
- _arg("--metadata", default=None, help="JSON object with structured reviewer handoff facts."),
+ _arg("--summary", help="What was implemented and how it was verified — shown to the reviewer."),
+ _arg("--reviewer", help="Optional reviewer profile; reassigns the task before review dispatch."),
+ _arg("--metadata", help="JSON object with structured reviewer handoff facts."),
_arg("--force", action="store_true",
help="Override the live-claim guard: move a running, claimed "
"task to review even without owning its run (clears the worker's claim)."),
@@ -330,13 +330,13 @@ _SPECS = [
], help="Manually move one or more todo/blocked tasks to ready (recovery path)"),
_cmd("archive", [
_arg("task_ids", nargs="*", help="Task ids to archive (default mode)"),
- _arg("--rm", dest="purge_ids", nargs="+", default=None,
+ _arg("--rm", dest="purge_ids", nargs="+",
help="Permanently delete already-archived task ids from the board"),
], help="Archive one or more tasks"),
_cmd("tail", [_TASK_ID, _arg("--interval", type=float, default=1.0)], help="Follow a task's event stream"),
_cmd("dispatch", [
_arg("--dry-run", action="store_true", help="Don't actually spawn processes; just print what would happen"),
- _arg("--max", type=int, default=None, help="Cap number of spawns this pass"),
+ _arg("--max", type=int, help="Cap number of spawns this pass"),
_arg("--failure-limit", type=int, default=kb.DEFAULT_SPAWN_FAILURE_LIMIT,
help=f"Auto-block a task after this many consecutive non-success attempts "
f"(spawn_failed, timed_out, or crashed; default: {kb.DEFAULT_SPAWN_FAILURE_LIMIT})"),
@@ -344,18 +344,18 @@ _SPECS = [
], help="One dispatcher pass: reclaim stale, promote ready, spawn workers"),
_cmd("daemon", [
_arg("--interval", type=float, default=60.0, help="Seconds between dispatch ticks (default: 60)"),
- _arg("--max", type=int, default=None, help="Cap number of spawns per tick"),
+ _arg("--max", type=int, help="Cap number of spawns per tick"),
_arg("--failure-limit", type=int, default=kb.DEFAULT_SPAWN_FAILURE_LIMIT),
- _arg("--pidfile", default=None, help="Write the daemon's PID to this file on start"),
+ _arg("--pidfile", help="Write the daemon's PID to this file on start"),
_arg("--verbose", "-v", action="store_true", help="Log each tick's outcome to stdout"),
# Escape hatch for hosts that truly cannot run the gateway; hidden from
# --help so nobody casually keeps the double-dispatcher pattern alive.
_arg("--force", action="store_true", help=argparse.SUPPRESS),
], help="DEPRECATED — dispatcher now runs in the gateway. Use `hermes gateway start`."),
_cmd("watch", [
- _arg("--assignee", default=None, help="Only show events for tasks assigned to this profile"),
- _arg("--tenant", default=None, help="Only show events from tasks in this tenant"),
- _arg("--kinds", default=None,
+ _arg("--assignee", help="Only show events for tasks assigned to this profile"),
+ _arg("--tenant", help="Only show events from tasks in this tenant"),
+ _arg("--kinds",
help="Comma-separated event kinds to include (e.g. 'completed,blocked,gave_up,crashed,timed_out')"),
_arg("--interval", type=float, default=0.5, help="Poll interval in seconds (default: 0.5)"),
], help="Live-stream task_events to the terminal (Ctrl+C to exit)"),
@@ -363,16 +363,16 @@ _SPECS = [
_cmd("notify-subscribe", [
_TASK_ID,
*_NOTIFY_TARGET,
- _arg("--user-id", default=None),
- _arg("--user-id-alt", default=None),
- _arg("--chat-type", choices=("dm", "group", "channel", "thread"), default=None,
+ _arg("--user-id"),
+ _arg("--user-id-alt"),
+ _arg("--chat-type", choices=("dm", "group", "channel", "thread"),
help="Originating source chat_type, recorded so the active-wake delivery "
"modes resolve the operator's real session. Omit to leave an "
"existing sub unchanged (new subs default to 'dm')."),
- _arg("--notifier-profile", default=None,
+ _arg("--notifier-profile",
help="Profile gateway that owns/delivers this subscription (default: active profile)"),
# choices: single source of truth shared with the DB/watcher enum.
- _arg("--delivery-mode", choices=kb._NOTIFY_DELIVERY_MODES, default=None,
+ _arg("--delivery-mode", choices=kb._NOTIFY_DELIVERY_MODES,
help="How the kanban-notifier reacts to terminal events for this "
"subscription: 'notify' (passive message only; default), "
"'notify+wake' (message AND wake the destination gateway agent so "
@@ -380,16 +380,16 @@ _SPECS = [
"'wake' (wake the agent only, no passive message). Omit to leave an "
"existing subscription's mode unchanged (new subs default to 'notify')."),
], help="Subscribe a gateway source to a task's terminal events (used by /kanban subscribe in the gateway adapter)"),
- _cmd("notify-list", [_arg("task_id", nargs="?", default=None), _json_flag()],
+ _cmd("notify-list", [_arg("task_id", nargs="?"), _json_flag()],
help="List notification subscriptions (optionally for a single task)"),
_cmd("notify-unsubscribe", [_TASK_ID, *_NOTIFY_TARGET], help="Remove a gateway subscription from a task"),
- _cmd("log", [_TASK_ID, _arg("--tail", type=int, default=None, help="Only print the last N bytes")],
+ _cmd("log", [_TASK_ID, _arg("--tail", type=int, help="Only print the last N bytes")],
help="Print the worker log for a task (from <kanban-root>/kanban/logs/)"),
_cmd("runs", [_TASK_ID, _json_flag(), *_run_state_args("filter runs by task_runs column")],
help="Show attempt history for a task (one row per run: profile, outcome, elapsed, summary)"),
_cmd("heartbeat", [
_TASK_ID,
- _arg("--note", default=None, help="Optional short note attached to the heartbeat event"),
+ _arg("--note", help="Optional short note attached to the heartbeat event"),
], help="Emit a heartbeat event for a running task (worker liveness signal)"),
_cmd("assignees", [_json_flag()],
help="List known profiles + per-profile task counts (union of ~/.hermes/profiles/ and current assignees on the board)"),