Build a minimal command-line bug tracker in Python. It must support: creating a bug (title, steps, severity, priority, environment), listing all bugs filtered by status (open/in-progress/closed) and severity, updating a bug's status and adding notes, and exporting all bugs as a Markdown report. Store bugs in a JSON file. The tracker should validate that required fields are present and that severity/priority values are from a fixed enum.
argparse with subparsers for add, list, update, close, export.BUG-{timestamp} or an incrementing counter stored in the JSON file.{bugs: [{id, title, steps, severity, priority, status, env, notes, created_at, updated_at}]}.{severity: [bugs]}, then iterate severity order: critical → high → medium → low.$ python bug_tracker.py add --title "Login returns 500 with + in email" \
--steps "1. Go to /login 2. Enter user+tag@example.com 3. Click login" \
--severity high --priority P2 --env "Chrome 124 / macOS"
Created bug: BUG-001
$ python bug_tracker.py list --status open
BUG-001 [HIGH/P2] Login returns 500 with + in email (open)
$ python bug_tracker.py update BUG-001 --status in-progress --note "Dev investigating — likely input sanitization"
Updated BUG-001: status=in-progress
$ python bug_tracker.py export
Exported 1 bug(s) to bugs_report.md
search subcommand: python bug_tracker.py search 'login' returns all bugs whose title or steps contain the search term.stats subcommand that prints: total bugs, breakdown by severity, breakdown by status, and average time from 'open' to 'closed' for resolved bugs.export --format html generates a bugs_report.html with a sortable table (sort by severity, priority, status).duplicate <id1> <id2> command that marks one bug as a duplicate of another and links them.