Problem Statement
The Proof of Done audit details, test metrics, and failure recovery traces are currently stored as raw JSON inside .terminal_agent/sessions/<id>.json. There is no command to export these results into a formatted GitHub pull request description or HTML report for CI pipelines and code reviews.
Proposed Architecture & Solution
- Export Command (
src/terminal_agent/cli/commands/export.py):
- Command syntax:
terminal-agent export [SESSION_ID] [--format markdown|html|json] [--output path]
- If
SESSION_ID is omitted, automatically defaults to the latest session.
- Report Contents:
- Task Contract Summary: Goal, constraints, and success criteria.
- Verification Results Table: Tests executed, tests passed/failed, assertion checklist.
- Git Diff & Files Changed: Summary statistics and file modification breakdown.
- Autonomous Recovery Timeline: Failures classified and repair hypotheses applied.
- Tamper-Evident Proof of Done Certificate: Session ID, timestamp, and verification badge.
- HTML / Markdown Templates:
- Markdown format optimized for direct copy-pasting into GitHub PR descriptions and issue summaries.
- HTML format styled with a clean dark/light theme suitable for CI artifacts.
Files to Modify / Create
src/terminal_agent/cli/commands/export.py (New)
src/terminal_agent/cli/main.py (Register export command)
src/terminal_agent/session/manager.py (Add report synthesis helper)
tests/unit/test_export_command.py (New)
Acceptance Criteria
Problem Statement
The Proof of Done audit details, test metrics, and failure recovery traces are currently stored as raw JSON inside
.terminal_agent/sessions/<id>.json. There is no command to export these results into a formatted GitHub pull request description or HTML report for CI pipelines and code reviews.Proposed Architecture & Solution
src/terminal_agent/cli/commands/export.py):SESSION_IDis omitted, automatically defaults to the latest session.Files to Modify / Create
src/terminal_agent/cli/commands/export.py(New)src/terminal_agent/cli/main.py(Registerexportcommand)src/terminal_agent/session/manager.py(Add report synthesis helper)tests/unit/test_export_command.py(New)Acceptance Criteria
terminal-agent exportgenerates valid GitHub-flavored Markdown by default.terminal-agent export --format html --output report.htmlwrites a standalone HTML report.