feat(TASK-005): wire project state and agent handoff into start/complete commands

- Add update_project_state() helper: updates Current Task + Last Updated
  in PROJECT_STATE.md via regex sub, preserving all surrounding formatting.
- Add update_agent_handoff() helper: updates Current Stage + Current Task
  sections in AGENT_HANDOFF.md, auto-detected from project_stage().
- Wire both helpers into rdb start TASK-ID and rdb complete TASK-ID CLI
  commands so task lifecycle transitions propagate to all control files.
- ADDING test_status.py with 5 tests: update_project_state task/timestamp
  updates, missing-file false return, agent handoff update and miss.

Acceptance criteria met:
- rdb start/complete now update PROJECT_STATE.md
- rdb start/complete now update AGENT_HANDOFF.md
- RUN_LOG.md already updated (pre-existing)
- Task formatting preserved (regex sub targets single line only)
This commit is contained in:
2026-06-02 10:37:38 +01:00
parent 9536f5d0ff
commit 21611b7c4e
4 changed files with 115 additions and 2 deletions
+5 -1
View File
@@ -9,7 +9,7 @@ from rich.table import Table
from .discovery import append_discovery_answer, append_followup_answer, core_questions, read_discovery_answers
from .handoff import build_handoff
from .status import project_stage, task_counts
from .status import project_stage, task_counts, update_project_state, update_agent_handoff
from .tasks import generate_agent_prompt, get_next_task, update_task_status
from .templates import CONTEXT_FILES, write_file_if_missing
@@ -155,6 +155,8 @@ def start(task_id: str) -> None:
console.print(f"[red]Task not found:[/red] {task_id}")
raise typer.Exit(code=1)
append_run_log(root, "Task started", task_id=task_id)
update_project_state(root, task_id)
update_agent_handoff(root, task_id)
console.print(f"[green]Started {task_id}.[/green]")
@@ -167,6 +169,8 @@ def complete(task_id: str) -> None:
console.print(f"[red]Task not found:[/red] {task_id}")
raise typer.Exit(code=1)
append_run_log(root, "Task completed", task_id=task_id, notes=notes)
update_project_state(root, task_id)
update_agent_handoff(root, task_id)
console.print(f"[green]Completed {task_id}.[/green]")