profit a304895249 Add bug status tracking with API and UI
Implements full bug lifecycle management (open → in_progress → resolved):

Bug Watcher (testing/oversight/bug_watcher.py):
- Add BugStatus enum with open/in_progress/resolved states
- Add SQLite persistence with status tracking and indexes
- New methods: update_bug_status(), get_bug(), log_bug()
- Extended CLI: update, get, log commands with filters

API Endpoints (ui/server.ts):
- GET /api/bugs - List bugs with status/severity/phase filters
- GET /api/bugs/summary - Bug statistics by status and severity
- GET /api/bugs/:id - Single bug details
- POST /api/bugs - Log new bug
- PATCH /api/bugs/:id - Update bug status

UI Dashboard:
- New "Bugs" tab with summary cards (Total/Open/In Progress/Resolved)
- Filter dropdowns for status and severity
- Bug list with status badges and severity indicators
- Detail panel with action buttons for status transitions
- WebSocket broadcasts for real-time updates

CLI Wrapper (bin/bugs):
- bugs list [--status X] [--severity Y]
- bugs get <id>
- bugs log -m "message" [--severity high]
- bugs update <id> <status> [--notes "..."]
- bugs status

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 17:17:43 -05:00

82 lines
2.2 KiB
Bash
Executable File

#!/bin/bash
# Bug Tracking CLI
# Usage: bugs <command> [options]
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
WATCHER_SCRIPT="/opt/agent-governance/testing/oversight/bug_watcher.py"
show_help() {
echo "Bug Tracking CLI"
echo ""
echo "Usage: bugs <command> [options]"
echo ""
echo "Commands:"
echo " list List all bugs"
echo " list --status open Filter by status (open/in_progress/resolved)"
echo " list --severity high Filter by severity (critical/high/medium/low)"
echo " get <id> Get details of a specific bug"
echo " log <message> Log a new bug"
echo " update <id> <status> Update bug status"
echo " scan Scan for anomalies"
echo " status Show bug summary"
echo ""
echo "Examples:"
echo " bugs list --status open"
echo " bugs log -m 'API timeout in pipeline' --severity high"
echo " bugs update anom-abc123 resolved --notes 'Fixed in commit xyz'"
echo " bugs get anom-abc123"
echo ""
}
case "$1" in
list)
shift
python3 "$WATCHER_SCRIPT" list "$@"
;;
get)
shift
if [ -z "$1" ]; then
echo "Error: Bug ID required"
echo "Usage: bugs get <bug-id>"
exit 1
fi
python3 "$WATCHER_SCRIPT" get --id "$1"
;;
log)
shift
python3 "$WATCHER_SCRIPT" log "$@"
;;
update)
shift
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Error: Bug ID and status required"
echo "Usage: bugs update <bug-id> <status> [--notes 'note']"
exit 1
fi
BUG_ID="$1"
STATUS="$2"
shift 2
python3 "$WATCHER_SCRIPT" update --id "$BUG_ID" --set-status "$STATUS" "$@"
;;
scan)
shift
python3 "$WATCHER_SCRIPT" scan "$@"
;;
status|summary)
shift
python3 "$WATCHER_SCRIPT" status "$@"
;;
help|--help|-h)
show_help
;;
*)
if [ -z "$1" ]; then
show_help
else
echo "Unknown command: $1"
echo "Run 'bugs help' for usage"
exit 1
fi
;;
esac