feat(ai-sre): incidents/show/apply/report commands, SQLite persistence, Slack alerts - #16
Merged
Conversation
…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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~/.visualeyes/incidents.db— persists every scan resultincidents,show,apply,reportNew file: db.py
init_db()— creates tablesincidents+cluster_snapshotswith WAL modesave_incident(report)— upsert by ID, stores full raw JSONget_incidents(severity, status, hours, limit)— filtered queryget_incident_by_id(id)— returns deserialized dictupdate_status(id, status)— setsmitigated_at/resolved_attimestampsget_mttr_stats()— avg MTTR per severity from resolved incidentsNew CLI commands (cli.py)
incidents— Rich table: SEV / status / confidence / title / detected, MTTR header rowshow <id>— full incident detail via_render_report()apply <id> [--dry-run]— interactive per-step remediation [y/N/dry], marks MITIGATED in DBreport <id> [-o file]— JSON export to stdout or fileAuto-persistence
scan+watchboth calldb.save_incident()after every pipeline runSlack
_notify_slack(report)fires on SEV1/SEV2 viaSLACK_WEBHOOK_URLenv varurllib.requestonly — no extra dependencyTest plan
veye-ai scan→ row appears in~/.visualeyes/incidents.dbveye-ai incidentslists it with correct severityveye-ai show <id>renders full panelveye-ai report <id> -o /tmp/out.jsonproduces valid JSONSLACK_WEBHOOK_URL=... veye-ai scanon SEV1 alert sends Slack message