mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-14 04:02:26 +00:00
fix(kanban): preserve dashboard completion summaries
This commit is contained in:
parent
cca8587d35
commit
354502ee48
6 changed files with 236 additions and 4 deletions
|
|
@ -343,6 +343,27 @@ def build_parser(parent_subparsers: argparse._SubParsersAction) -> argparse.Argu
|
|||
help='JSON dict of structured facts (e.g. \'{"changed_files": [...], '
|
||||
'"tests_run": 12}\'). Stored on the closing run.')
|
||||
|
||||
p_edit = sub.add_parser(
|
||||
"edit",
|
||||
help="Edit recovery fields on an already-completed task",
|
||||
)
|
||||
p_edit.add_argument("task_id")
|
||||
p_edit.add_argument(
|
||||
"--result",
|
||||
required=True,
|
||||
help="Backfilled task result text for a done task",
|
||||
)
|
||||
p_edit.add_argument(
|
||||
"--summary",
|
||||
default=None,
|
||||
help="Structured handoff summary. Falls back to --result if omitted.",
|
||||
)
|
||||
p_edit.add_argument(
|
||||
"--metadata",
|
||||
default=None,
|
||||
help="JSON dict of structured facts to store on the latest completed run.",
|
||||
)
|
||||
|
||||
p_block = sub.add_parser("block", help="Mark one or more tasks blocked")
|
||||
p_block.add_argument("task_id")
|
||||
p_block.add_argument("reason", nargs="*", help="Reason (also appended as a comment)")
|
||||
|
|
@ -581,6 +602,7 @@ def kanban_command(args: argparse.Namespace) -> int:
|
|||
"claim": _cmd_claim,
|
||||
"comment": _cmd_comment,
|
||||
"complete": _cmd_complete,
|
||||
"edit": _cmd_edit,
|
||||
"block": _cmd_block,
|
||||
"unblock": _cmd_unblock,
|
||||
"archive": _cmd_archive,
|
||||
|
|
@ -1187,6 +1209,34 @@ def _cmd_complete(args: argparse.Namespace) -> int:
|
|||
return 0 if not failed else 1
|
||||
|
||||
|
||||
def _cmd_edit(args: argparse.Namespace) -> int:
|
||||
raw_meta = getattr(args, "metadata", None)
|
||||
metadata = None
|
||||
if raw_meta:
|
||||
try:
|
||||
metadata = json.loads(raw_meta)
|
||||
if not isinstance(metadata, dict):
|
||||
raise ValueError("must be a JSON object")
|
||||
except (ValueError, json.JSONDecodeError) as exc:
|
||||
print(f"kanban: --metadata: {exc}", file=sys.stderr)
|
||||
return 2
|
||||
with kb.connect() as conn:
|
||||
if not kb.edit_completed_task_result(
|
||||
conn,
|
||||
args.task_id,
|
||||
result=args.result,
|
||||
summary=getattr(args, "summary", None),
|
||||
metadata=metadata,
|
||||
):
|
||||
print(
|
||||
f"cannot edit {args.task_id} (unknown id or task is not done)",
|
||||
file=sys.stderr,
|
||||
)
|
||||
return 1
|
||||
print(f"Edited {args.task_id}")
|
||||
return 0
|
||||
|
||||
|
||||
def _cmd_block(args: argparse.Namespace) -> int:
|
||||
reason = " ".join(args.reason).strip() if args.reason else None
|
||||
author = _profile_author()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue