Skip to content

feat(ai-sre): incidents/show/apply/report commands, SQLite persistence, Slack alerts - #16

Merged
onkar717 merged 1 commit into
mainfrom
feat/ai-sre-cli-db
Jun 17, 2026
Merged

feat(ai-sre): incidents/show/apply/report commands, SQLite persistence, Slack alerts#16
onkar717 merged 1 commit into
mainfrom
feat/ai-sre-cli-db

Conversation

@onkar717

Copy link
Copy Markdown
Owner

Summary

  • SQLite DB at ~/.visualeyes/incidents.db — persists every scan result
  • 4 new CLI commands: incidents, show, apply, report
  • Slack webhook notification for SEV1/SEV2 incidents

New file: db.py

  • init_db() — creates tables incidents + cluster_snapshots with WAL mode
  • save_incident(report) — upsert by ID, stores full raw JSON
  • get_incidents(severity, status, hours, limit) — filtered query
  • get_incident_by_id(id) — returns deserialized dict
  • update_status(id, status) — sets mitigated_at/resolved_at timestamps
  • get_mttr_stats() — avg MTTR per severity from resolved incidents

New CLI commands (cli.py)

  • incidents — Rich table: SEV / status / confidence / title / detected, MTTR header row
  • show <id> — full incident detail via _render_report()
  • apply <id> [--dry-run] — interactive per-step remediation [y/N/dry], marks MITIGATED in DB
  • report <id> [-o file] — JSON export to stdout or file

Auto-persistence

  • scan + watch both call db.save_incident() after every pipeline run

Slack

  • _notify_slack(report) fires on SEV1/SEV2 via SLACK_WEBHOOK_URL env var
  • stdlib urllib.request only — no extra dependency

Test plan

  • veye-ai scan → row appears in ~/.visualeyes/incidents.db
  • veye-ai incidents lists it with correct severity
  • veye-ai show <id> renders full panel
  • veye-ai report <id> -o /tmp/out.json produces valid JSON
  • SLACK_WEBHOOK_URL=... veye-ai scan on SEV1 alert sends Slack message

…ack alerts

db.py (new):
- SQLite persistence at ~/.visualeyes/incidents.db
- save_incident(), get_incidents(severity, status, hours, limit), get_incident_by_id()
- update_status(), get_mttr_stats(), open_incident_count()
- WAL mode, indexed on severity/status/created_at

cli.py:
- incidents: Rich table with SEV/status/confidence/title/detected, MTTR summary header
- show <id>: full incident detail panel via _render_report()
- apply <id>: interactive per-step remediation [y/N/dry], marks incident MITIGATED in DB
- report <id>: JSON export to stdout or --output file
- scan/watch: auto-save every incident to DB after pipeline completes
- Slack webhook: _notify_slack() fires on SEV1/SEV2 via SLACK_WEBHOOK_URL env var
  (stdlib urllib only, no extra dependency)
@onkar717 onkar717 closed this Jun 17, 2026
@onkar717 onkar717 reopened this Jun 17, 2026
@onkar717
onkar717 merged commit 74e0b7a into main Jun 17, 2026
26 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant