13 KiB
Summary
-
Put the existing git and test workflows on rails: a repeatable, automated process that can run autonomously, with guardrails and a compact TUI for visibility.
-
Flow: for a selected task, create a branch named with the tag + task id → generate tests for the first subtask (red) using the Surgical Test Generator → implement code (green) → verify tests → commit → repeat per subtask → final verify → push → open PR against the default branch.
-
Build on existing rules: .cursor/rules/git_workflow.mdc, .cursor/rules/test_workflow.mdc, .claude/agents/surgical-test-generator.md, and existing CLI/core services.
Goals
-
Deterministic, resumable automation to execute the TDD loop per subtask with minimal human intervention.
-
Strong guardrails: never commit to the default branch; only commit when tests pass; enforce status transitions; persist logs/state for debuggability.
-
Visibility: a compact terminal UI (like lazygit) to pick tag, view tasks, and start work; right-side pane opens an executor terminal (via tmux) for agent coding.
-
Extensible: framework-agnostic test generation via the Surgical Test Generator; detect and use the repo’s test command for execution with coverage thresholds.
Non‑Goals (initial)
-
Full multi-language runner parity beyond detection and executing the project’s test command.
-
Complex GUI; start with CLI/TUI + tmux pane. IDE/extension can hook into the same state later.
-
Rich executor selection UX (codex/gemini/claude) — we’ll prompt per run; defaults can come later.
Success Criteria
-
One command can autonomously complete a task’s subtasks via TDD and open a PR when done.
-
All commits made on a branch that includes the tag and task id (see Branch Naming); no commits to the default branch directly.
-
Every subtask iteration: failing tests added first (red), then code added to pass them (green), commit only after green.
-
End-to-end logs + artifacts stored in .taskmaster/reports/runs//.
User Stories
-
As a developer, I can run tm autopilot and watch a structured, safe workflow execute.
-
As a reviewer, I can inspect commits per subtask, and a PR summarizing the work when the task completes.
-
As an operator, I can see current step, active subtask, tests status, and logs in a compact CLI view and read a final run report.
High‑Level Workflow
-
Pre‑flight
-
Verify clean working tree or confirm staging/commit policy (configurable).
-
Detect repo type and the project’s test command (e.g., npm test, pnpm test, pytest, go test).
-
Validate tools: git, gh (optional for PR), node/npm, and (if used) claude CLI.
-
Load TaskMaster state and selected task; if no subtasks exist, automatically run “expand” before working.
-
-
Branch & Tag Setup
-
Checkout default branch and update (optional), then create a branch using Branch Naming (below).
-
Map branch ↔ tag via existing tag management; explicitly set active tag to the branch’s tag.
-
-
Subtask Loop (for each pending/in-progress subtask in dependency order)
-
Select next eligible subtask using tm-core TaskService getNextTask() and subtask eligibility logic.
-
Red: generate or update failing tests for the subtask
-
Use the Surgical Test Generator system prompt .claude/agents/surgical-test-generator.md) to produce high-signal tests following project conventions.
-
Run tests to confirm red; record results. If not red (already passing), skip to next subtask or escalate.
-
-
Green: implement code to pass tests
-
Use executor to implement changes (initial: claude CLI prompt with focused context).
-
Re-run tests until green or timeout/backoff policy triggers.
-
-
Commit: when green
-
Commit tests + code with conventional commit message. Optionally update subtask status to done.
-
Persist run step metadata/logs.
-
-
-
Finalization
-
Run full test suite and coverage (if configured); optionally lint/format.
-
Commit any final adjustments.
-
Push branch (ask user to confirm); create PR (via gh pr create) targeting the default branch. Title format: Task # []:
-