supavision 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- supavision-0.1.0/.dockerignore +11 -0
- supavision-0.1.0/.env.example +21 -0
- supavision-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +27 -0
- supavision-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +14 -0
- supavision-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +10 -0
- supavision-0.1.0/.github/workflows/ci.yml +33 -0
- supavision-0.1.0/.gitignore +35 -0
- supavision-0.1.0/.supervisor/locks/1d8a4060-d88b-4b94-ad1f-9791dccd14fa.lock +1 -0
- supavision-0.1.0/.supervisor/locks/5953f122-9413-403c-b10a-93b033ceef8c.lock +1 -0
- supavision-0.1.0/.supervisor/locks/be9de3af-f887-41ee-bc03-8bdaf0d5ee44.lock +0 -0
- supavision-0.1.0/.supervisor/locks/d575d0fb-b566-4b34-8844-12204d0fa1bd.lock +1 -0
- supavision-0.1.0/.supervisor/scheduler.lock +1 -0
- supavision-0.1.0/.supervisor/supervisor.db +0 -0
- supavision-0.1.0/.supervisor/supervisor.db-shm +0 -0
- supavision-0.1.0/.supervisor/supervisor.db-wal +0 -0
- supavision-0.1.0/.supervisor/supervisor_v2.db +0 -0
- supavision-0.1.0/ARCHITECTURE.md +60 -0
- supavision-0.1.0/CHANGELOG.md +29 -0
- supavision-0.1.0/CLAUDE.md +91 -0
- supavision-0.1.0/CODE_OF_CONDUCT.md +40 -0
- supavision-0.1.0/CONTRIBUTING.md +57 -0
- supavision-0.1.0/Dockerfile +34 -0
- supavision-0.1.0/LICENSE +21 -0
- supavision-0.1.0/PKG-INFO +231 -0
- supavision-0.1.0/README.md +198 -0
- supavision-0.1.0/SECURITY.md +108 -0
- supavision-0.1.0/docker-compose.yml +21 -0
- supavision-0.1.0/pyproject.toml +64 -0
- supavision-0.1.0/scanner_patterns/patterns.json +93 -0
- supavision-0.1.0/scripts/migrate_devos.py +257 -0
- supavision-0.1.0/src/supavision/__init__.py +3 -0
- supavision-0.1.0/src/supavision/agent_runner.py +606 -0
- supavision-0.1.0/src/supavision/blocklist.py +75 -0
- supavision-0.1.0/src/supavision/cli.py +1124 -0
- supavision-0.1.0/src/supavision/code_evaluator.py +197 -0
- supavision-0.1.0/src/supavision/codebase_engine.py +255 -0
- supavision-0.1.0/src/supavision/config.py +33 -0
- supavision-0.1.0/src/supavision/db.py +854 -0
- supavision-0.1.0/src/supavision/discovery_diff.py +175 -0
- supavision-0.1.0/src/supavision/engine.py +907 -0
- supavision-0.1.0/src/supavision/evaluator.py +175 -0
- supavision-0.1.0/src/supavision/executor.py +242 -0
- supavision-0.1.0/src/supavision/mcp.py +530 -0
- supavision-0.1.0/src/supavision/models/__init__.py +68 -0
- supavision-0.1.0/src/supavision/models/core.py +153 -0
- supavision-0.1.0/src/supavision/models/health.py +111 -0
- supavision-0.1.0/src/supavision/models/work.py +262 -0
- supavision-0.1.0/src/supavision/notifications.py +382 -0
- supavision-0.1.0/src/supavision/prompt_builder.py +149 -0
- supavision-0.1.0/src/supavision/resource_types.py +62 -0
- supavision-0.1.0/src/supavision/scanner.py +233 -0
- supavision-0.1.0/src/supavision/scheduler.py +227 -0
- supavision-0.1.0/src/supavision/templates.py +143 -0
- supavision-0.1.0/src/supavision/tools.py +502 -0
- supavision-0.1.0/src/supavision/web/__init__.py +0 -0
- supavision-0.1.0/src/supavision/web/app.py +123 -0
- supavision-0.1.0/src/supavision/web/auth.py +43 -0
- supavision-0.1.0/src/supavision/web/dashboard.py +1172 -0
- supavision-0.1.0/src/supavision/web/routes.py +412 -0
- supavision-0.1.0/src/supavision/web/static/style.css +521 -0
- supavision-0.1.0/src/supavision/web/static/supavision.js +174 -0
- supavision-0.1.0/src/supavision/web/templates/_finding_row.html +30 -0
- supavision-0.1.0/src/supavision/web/templates/base.html +33 -0
- supavision-0.1.0/src/supavision/web/templates/dashboard.html +22 -0
- supavision-0.1.0/src/supavision/web/templates/dashboard_overview.html +93 -0
- supavision-0.1.0/src/supavision/web/templates/error.html +9 -0
- supavision-0.1.0/src/supavision/web/templates/finding_detail.html +209 -0
- supavision-0.1.0/src/supavision/web/templates/findings.html +131 -0
- supavision-0.1.0/src/supavision/web/templates/report_detail.html +31 -0
- supavision-0.1.0/src/supavision/web/templates/resource_detail.html +263 -0
- supavision-0.1.0/src/supavision/web/templates/resource_edit.html +194 -0
- supavision-0.1.0/src/supavision/web/templates/resource_list.html +35 -0
- supavision-0.1.0/src/supavision/web/templates/resource_new.html +146 -0
- supavision-0.1.0/src/supavision/web/templates/settings.html +122 -0
- supavision-0.1.0/templates/aws_account/discovery.md +56 -0
- supavision-0.1.0/templates/aws_account/health_check.md +41 -0
- supavision-0.1.0/templates/codebase/discovery.md +28 -0
- supavision-0.1.0/templates/codebase/health_check.md +29 -0
- supavision-0.1.0/templates/database/discovery.md +58 -0
- supavision-0.1.0/templates/database/health_check.md +46 -0
- supavision-0.1.0/templates/example/discovery.md +42 -0
- supavision-0.1.0/templates/example/health_check.md +47 -0
- supavision-0.1.0/templates/github_org/discovery.md +53 -0
- supavision-0.1.0/templates/github_org/health_check.md +43 -0
- supavision-0.1.0/templates/server/discovery.md +60 -0
- supavision-0.1.0/templates/server/health_check.md +52 -0
- supavision-0.1.0/tests/__init__.py +0 -0
- supavision-0.1.0/tests/test_api.py +443 -0
- supavision-0.1.0/tests/test_blocklist.py +68 -0
- supavision-0.1.0/tests/test_cli_subset.py +194 -0
- supavision-0.1.0/tests/test_code_evaluator.py +116 -0
- supavision-0.1.0/tests/test_codebase_engine.py +147 -0
- supavision-0.1.0/tests/test_dashboard.py +144 -0
- supavision-0.1.0/tests/test_db.py +673 -0
- supavision-0.1.0/tests/test_engine_streaming.py +215 -0
- supavision-0.1.0/tests/test_evaluator.py +182 -0
- supavision-0.1.0/tests/test_executor.py +242 -0
- supavision-0.1.0/tests/test_health_grid.py +276 -0
- supavision-0.1.0/tests/test_lane_boundary.py +145 -0
- supavision-0.1.0/tests/test_mcp.py +383 -0
- supavision-0.1.0/tests/test_notifications.py +462 -0
- supavision-0.1.0/tests/test_prompt_builder.py +90 -0
- supavision-0.1.0/tests/test_scanner.py +157 -0
- supavision-0.1.0/tests/test_templates.py +290 -0
- supavision-0.1.0/tests/test_tools.py +559 -0
- supavision-0.1.0/tests/test_two_lane_integration.py +171 -0
- supavision-0.1.0/tests/test_work_db.py +222 -0
- supavision-0.1.0/tests/test_work_models.py +135 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Backend: claude_cli (default, free with subscription) or openrouter (API key)
|
|
2
|
+
# SUPAVISION_BACKEND=claude_cli
|
|
3
|
+
|
|
4
|
+
# Required ONLY if using openrouter backend
|
|
5
|
+
# OPENROUTER_API_KEY=sk-or-your-key-here
|
|
6
|
+
|
|
7
|
+
# Optional — Slack webhook for alerts (can also be set per-resource)
|
|
8
|
+
# SLACK_WEBHOOK=https://hooks.slack.com/services/xxx/yyy/zzz
|
|
9
|
+
|
|
10
|
+
# Optional — override defaults
|
|
11
|
+
# SUPAVISION_MODEL=anthropic/claude-sonnet-4
|
|
12
|
+
# SUPAVISION_CHECK_INTERVAL=60
|
|
13
|
+
# SUPAVISION_CLI_TIMEOUT=900
|
|
14
|
+
|
|
15
|
+
# Dashboard authentication (recommended for production)
|
|
16
|
+
# Set a password to require login. Leave unset for open access.
|
|
17
|
+
# SUPAVISION_PASSWORD=your-secure-password
|
|
18
|
+
# SUPAVISION_USER=admin
|
|
19
|
+
|
|
20
|
+
# Webhook security — restrict allowed webhook domains
|
|
21
|
+
# WEBHOOK_ALLOWED_DOMAINS=hooks.slack.com,discord.com
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Something isn't working as expected
|
|
4
|
+
labels: bug
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**What happened?**
|
|
8
|
+
A clear description of the bug.
|
|
9
|
+
|
|
10
|
+
**Steps to reproduce**
|
|
11
|
+
1. Go to '...'
|
|
12
|
+
2. Click on '...'
|
|
13
|
+
3. See error
|
|
14
|
+
|
|
15
|
+
**Expected behavior**
|
|
16
|
+
What you expected to happen.
|
|
17
|
+
|
|
18
|
+
**Environment**
|
|
19
|
+
- OS: [e.g. Ubuntu 24.04]
|
|
20
|
+
- Python: [e.g. 3.12]
|
|
21
|
+
- Backend: [claude_cli / openrouter]
|
|
22
|
+
- Version: [e.g. 0.1.0]
|
|
23
|
+
|
|
24
|
+
**Logs** (if applicable)
|
|
25
|
+
```
|
|
26
|
+
Paste relevant logs here
|
|
27
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest a new feature or improvement
|
|
4
|
+
labels: enhancement
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**What problem does this solve?**
|
|
8
|
+
Describe the use case.
|
|
9
|
+
|
|
10
|
+
**Proposed solution**
|
|
11
|
+
How you'd like it to work.
|
|
12
|
+
|
|
13
|
+
**Alternatives considered**
|
|
14
|
+
Other approaches you've thought about.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## What does this PR do?
|
|
2
|
+
|
|
3
|
+
Brief description of the change.
|
|
4
|
+
|
|
5
|
+
## Checklist
|
|
6
|
+
|
|
7
|
+
- [ ] Tests pass (`pytest tests/`)
|
|
8
|
+
- [ ] Lint passes (`ruff check src/ tests/`)
|
|
9
|
+
- [ ] Updated README if adding user-facing features
|
|
10
|
+
- [ ] No new dependencies unless discussed in an issue first
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main, master]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: |
|
|
26
|
+
python -m pip install --upgrade pip
|
|
27
|
+
pip install -e ".[dev]"
|
|
28
|
+
|
|
29
|
+
- name: Lint
|
|
30
|
+
run: ruff check src/ tests/
|
|
31
|
+
|
|
32
|
+
- name: Test
|
|
33
|
+
run: pytest tests/ -v --tb=short
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.pyc
|
|
4
|
+
*.pyo
|
|
5
|
+
*.egg-info/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.venv/
|
|
9
|
+
|
|
10
|
+
# Testing
|
|
11
|
+
.coverage
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
htmlcov/
|
|
14
|
+
|
|
15
|
+
# Build artifacts
|
|
16
|
+
*.egg-info/
|
|
17
|
+
.ruff_cache/
|
|
18
|
+
|
|
19
|
+
# IDE
|
|
20
|
+
.idea/
|
|
21
|
+
.vscode/
|
|
22
|
+
*.swp
|
|
23
|
+
*.swo
|
|
24
|
+
.DS_Store
|
|
25
|
+
|
|
26
|
+
# Supervisor runtime
|
|
27
|
+
.env
|
|
28
|
+
.supavision/
|
|
29
|
+
|
|
30
|
+
# Internal planning
|
|
31
|
+
.review-loop/
|
|
32
|
+
SUPERVISOR_NEXT_DIRECTION.md
|
|
33
|
+
|
|
34
|
+
# Logs
|
|
35
|
+
*.log
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
445889
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
274693
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
616038
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
630635
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Architecture: Two-Lane Design
|
|
2
|
+
|
|
3
|
+
Supavision monitors two kinds of resources: **infrastructure** (servers, AWS, databases) and **codebases** (local projects). These produce fundamentally different outputs and follow different lifecycles, so the data model splits into two parallel lanes.
|
|
4
|
+
|
|
5
|
+
## The Two Lanes
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Resource
|
|
9
|
+
/ \
|
|
10
|
+
┌─────────┘ └──────────┐
|
|
11
|
+
│ │
|
|
12
|
+
LANE 1: Health LANE 2: Work
|
|
13
|
+
(resource-level pulse) (per-issue lifecycle)
|
|
14
|
+
│ │
|
|
15
|
+
Run → Report → Evaluation WorkItem (Finding | ManualTask)
|
|
16
|
+
│ │
|
|
17
|
+
"Is this resource healthy?" "Is this specific issue real?
|
|
18
|
+
Severity: healthy/warning/ Should we fix it? Track it
|
|
19
|
+
critical. One per run. through eval → approve →
|
|
20
|
+
Aggregate narrative." implement → complete."
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Rules
|
|
24
|
+
|
|
25
|
+
### Lane 1 (Health)
|
|
26
|
+
- **Report** = aggregate narrative about a resource's overall state. One per Run. Used for health dashboards and alerting. Never contains per-issue lifecycle state.
|
|
27
|
+
- **Evaluation** = severity assessment of a Report. Answers "how healthy is this resource?" Uses `Severity` (healthy/warning/critical). Stored in the `evaluations` table.
|
|
28
|
+
|
|
29
|
+
### Lane 2 (Work)
|
|
30
|
+
- **WorkItem** = a single actionable issue with its own lifecycle. Has a stage (scanned/evaluated/approved/implementing/completed/rejected/dismissed), its own agent jobs, feedback, and transitions.
|
|
31
|
+
- **Finding-level evaluation** is stored as fields ON the WorkItem (`evaluation_verdict`, `evaluation_reasoning`, `fix_approach`), NOT as a row in the `evaluations` table.
|
|
32
|
+
|
|
33
|
+
### The Boundary
|
|
34
|
+
- Code that touches Lane 1 must never import WorkItem models.
|
|
35
|
+
- Code that touches Lane 2 must never write to the `evaluations` table.
|
|
36
|
+
- The only place both lanes appear together is the resource detail page in the UI.
|
|
37
|
+
|
|
38
|
+
## Import Rules
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
models/
|
|
42
|
+
├── core.py ← Shared: Resource, Run, Credential, Schedule (both lanes)
|
|
43
|
+
├── health.py ← Lane 1: Report, Evaluation, Severity, SystemContext, Checklist
|
|
44
|
+
└── work.py ← Lane 2: Finding, ManualTask, AgentJob, Transition, BlocklistEntry
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
| Domain | Imports from |
|
|
48
|
+
|--------|-------------|
|
|
49
|
+
| Infrastructure (engine.py, evaluator.py, tools.py, executor.py, discovery_diff.py) | `models.core` + `models.health` only |
|
|
50
|
+
| Codebase (scanner.py, blocklist.py, agent_runner.py, code_evaluator.py) | `models.core` + `models.work` only |
|
|
51
|
+
| Shared (db.py, web/, cli.py, scheduler.py, mcp.py) | All models (via `models.__init__`) |
|
|
52
|
+
|
|
53
|
+
Enforced by `tests/test_lane_boundary.py` (AST-based import verification).
|
|
54
|
+
|
|
55
|
+
## Anti-Patterns (Do Not)
|
|
56
|
+
|
|
57
|
+
1. **Do not add lifecycle stages to Reports.** Reports are snapshots, not workflows.
|
|
58
|
+
2. **Do not use WorkItems for infrastructure health.** "High CPU" is a Report with severity=warning, not a WorkItem.
|
|
59
|
+
3. **Do not nest WorkItems inside Reports.** They share a parent Resource and a Run ID, but are siblings, not parent-child.
|
|
60
|
+
4. **Do not write finding verdicts to the evaluations table.** Finding-level judgments live on the WorkItem model.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 (2026-03-31)
|
|
4
|
+
|
|
5
|
+
Initial release.
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
- AI-powered server discovery and health checks via Claude Code CLI
|
|
9
|
+
- Web dashboard with dark theme, resource management, real-time updates
|
|
10
|
+
- 5 resource types: Server, AWS Account, Database, GitHub Organization
|
|
11
|
+
- REST API with API key authentication and OpenAPI docs
|
|
12
|
+
- Slack webhook notifications with smart dedup (24h TTL)
|
|
13
|
+
- Rule-based severity evaluation (zero additional LLM cost)
|
|
14
|
+
- Type-aware resource creation wizard
|
|
15
|
+
- Resource pause/resume, search/filter, pagination
|
|
16
|
+
- Responsive design (desktop + mobile)
|
|
17
|
+
- Custom CSS design system (zero framework dependencies)
|
|
18
|
+
- 340 tests, CI with GitHub Actions
|
|
19
|
+
- Docker support with healthcheck
|
|
20
|
+
|
|
21
|
+
### Resource Types
|
|
22
|
+
- **Server** — SSH-based monitoring of Linux servers
|
|
23
|
+
- **AWS Account** — CloudWatch, Lambda, EC2, IAM, cost monitoring
|
|
24
|
+
- **Database** — PostgreSQL/MySQL health, schema, replication
|
|
25
|
+
- **GitHub Organization** — branch protection, security alerts, PRs
|
|
26
|
+
|
|
27
|
+
### Backends
|
|
28
|
+
- **claude_cli** (default) — uses Claude Code CLI, covered by Claude subscription
|
|
29
|
+
- **openrouter** — uses OpenRouter API, pay-per-token
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
## Commands
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
python -m venv .venv && .venv/bin/pip install -e ".[dev]"
|
|
7
|
+
.venv/bin/pytest tests/ -v
|
|
8
|
+
.venv/bin/ruff check src/ tests/
|
|
9
|
+
.venv/bin/uvicorn supervisor.web.app:create_app --factory --port 8080
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Architecture
|
|
13
|
+
|
|
14
|
+
Two-lane design. See `ARCHITECTURE.md` for the full rationale.
|
|
15
|
+
|
|
16
|
+
**Lane 1 (Health):** Resource → Run → Report → Evaluation → Alert
|
|
17
|
+
Infrastructure monitoring. CLI: `engine.py` → Claude CLI subprocess.
|
|
18
|
+
|
|
19
|
+
**Lane 2 (Work):** Resource → WorkItem (Finding | ManualTask) → AgentJob
|
|
20
|
+
Codebase improvement. CLI: `codebase_engine.py` → scanner + agent_runner.
|
|
21
|
+
|
|
22
|
+
Both lanes share: Resource, Run, Store (SQLite WAL), Scheduler, Notifications, MCP.
|
|
23
|
+
|
|
24
|
+
### Models package
|
|
25
|
+
```
|
|
26
|
+
models/
|
|
27
|
+
├── core.py — Shared: Resource, Run, Credential, Schedule
|
|
28
|
+
├── health.py — Lane 1: Report, Evaluation, Severity, SystemContext, Checklist
|
|
29
|
+
└── work.py — Lane 2: Finding, ManualTask, AgentJob, FindingStage, BlocklistEntry
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Import rules enforced by `tests/test_lane_boundary.py` (AST-based).
|
|
33
|
+
|
|
34
|
+
## Key files
|
|
35
|
+
|
|
36
|
+
### Infrastructure domain (Lane 1)
|
|
37
|
+
- `engine.py` — Core run logic, Claude CLI integration, SSE output streaming
|
|
38
|
+
- `evaluator.py` — Rule-based severity assessment (zero LLM cost)
|
|
39
|
+
- `executor.py` — SSH command execution with multiplexing
|
|
40
|
+
- `tools.py` — Scoped read-only tools for infrastructure investigation
|
|
41
|
+
- `discovery_diff.py` — Drift detection between baselines
|
|
42
|
+
|
|
43
|
+
### Codebase domain (Lane 2)
|
|
44
|
+
- `codebase_engine.py` — Orchestrates scan, evaluate, implement, scout
|
|
45
|
+
- `scanner.py` — 81 regex security patterns across 9 languages (zero cost)
|
|
46
|
+
- `blocklist.py` — False-positive learning from rejection feedback
|
|
47
|
+
- `agent_runner.py` — Background thread job executor (Claude Code subprocess)
|
|
48
|
+
- `code_evaluator.py` — Evaluation prompt generation
|
|
49
|
+
- `prompt_builder.py` — Implementation prompt generation
|
|
50
|
+
|
|
51
|
+
### Shared
|
|
52
|
+
- `mcp.py` — MCP server (9 tools: 4 health + 5 work), JSON-RPC over stdio
|
|
53
|
+
- `scheduler.py` — Cron-based job scheduling with `asyncio.Semaphore(3)`
|
|
54
|
+
- `notifications.py` — Slack + webhook alerts with SSRF protection and dedup
|
|
55
|
+
- `db.py` — SQLite store with WAL mode, thread-safe via RLock
|
|
56
|
+
- `web/dashboard.py` — All dashboard routes (resources, findings, settings, SSE)
|
|
57
|
+
- `web/routes.py` — REST API (resources CRUD + codebase scan endpoint)
|
|
58
|
+
|
|
59
|
+
## Adding resource types
|
|
60
|
+
|
|
61
|
+
1. Create `templates/{type_name}/discovery.md` and `templates/{type_name}/health_check.md`
|
|
62
|
+
2. Add entry to `resource_types.py`
|
|
63
|
+
3. Templates use `{{resource_name}}`, `{{ssh_host}}`, etc. as placeholders
|
|
64
|
+
|
|
65
|
+
## Codebase CLI commands
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
supavision scan <resource_id> # Run regex scan
|
|
69
|
+
supavision findings <resource_id> # List findings
|
|
70
|
+
supavision evaluate <work_item_id> # Create evaluation job
|
|
71
|
+
supavision implement <work_item_id> # Create implementation job
|
|
72
|
+
supavision scout <resource_id> # Launch scout agent
|
|
73
|
+
supavision approve <work_item_id> # Approve for implementation
|
|
74
|
+
supervisor reject <work_item_id> # Reject work item
|
|
75
|
+
supervisor blocklist # List blocklist entries
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Testing
|
|
79
|
+
|
|
80
|
+
Tests use real SQLite databases in tmp_path. No mocking of the store layer.
|
|
81
|
+
Engine and CLI tests mock the Claude CLI subprocess.
|
|
82
|
+
Lane boundary tests (`test_lane_boundary.py`) verify import isolation via AST parsing.
|
|
83
|
+
Run a single test: `.venv/bin/pytest tests/test_evaluator.py -v`
|
|
84
|
+
|
|
85
|
+
## Code Style
|
|
86
|
+
|
|
87
|
+
- Use ruff for linting
|
|
88
|
+
- Pydantic models for all data structures
|
|
89
|
+
- Type hints on all public functions
|
|
90
|
+
- Infrastructure domain imports from `models.core` + `models.health` only
|
|
91
|
+
- Codebase domain imports from `models.core` + `models.work` only
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to a positive environment:
|
|
15
|
+
|
|
16
|
+
* Using welcoming and inclusive language
|
|
17
|
+
* Being respectful of differing viewpoints and experiences
|
|
18
|
+
* Gracefully accepting constructive criticism
|
|
19
|
+
* Focusing on what is best for the community
|
|
20
|
+
* Showing empathy towards other community members
|
|
21
|
+
|
|
22
|
+
Examples of unacceptable behavior:
|
|
23
|
+
|
|
24
|
+
* The use of sexualized language or imagery and unwelcome sexual attention
|
|
25
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
26
|
+
* Public or private harassment
|
|
27
|
+
* Publishing others' private information without explicit permission
|
|
28
|
+
* Other conduct which could reasonably be considered inappropriate
|
|
29
|
+
|
|
30
|
+
## Enforcement
|
|
31
|
+
|
|
32
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
33
|
+
reported to the project maintainers. All complaints will be reviewed and
|
|
34
|
+
investigated and will result in a response that is deemed necessary and
|
|
35
|
+
appropriate to the circumstances.
|
|
36
|
+
|
|
37
|
+
## Attribution
|
|
38
|
+
|
|
39
|
+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
|
|
40
|
+
version 2.0.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Contributing to Supavision
|
|
2
|
+
|
|
3
|
+
## Development Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git clone https://github.com/devsquall/supavision.git
|
|
7
|
+
cd supavision
|
|
8
|
+
python -m venv .venv && source .venv/bin/activate
|
|
9
|
+
pip install -e ".[dev]"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The default backend (`claude_cli`) requires [Claude Code](https://claude.ai/code) installed. No API keys needed.
|
|
13
|
+
|
|
14
|
+
To use OpenRouter instead, copy `.env.example` to `.env` and set `OPENROUTER_API_KEY`.
|
|
15
|
+
|
|
16
|
+
## Running Tests
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pytest tests/ -v
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Code Style
|
|
23
|
+
|
|
24
|
+
This project uses [ruff](https://docs.astral.sh/ruff/) for linting:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
ruff check src/ tests/
|
|
28
|
+
ruff format src/ tests/
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Adding a Resource Type
|
|
32
|
+
|
|
33
|
+
1. Create a directory under `templates/` (e.g., `templates/my_type/`)
|
|
34
|
+
2. Add `discovery.md` — instructions for initial exploration
|
|
35
|
+
3. Add `health_check.md` — instructions for recurring health checks
|
|
36
|
+
4. If your type needs new tools, add them to `src/supavision/tools.py`:
|
|
37
|
+
- Define the tool in `TOOL_DEFINITIONS`
|
|
38
|
+
- Add a `_tool_<name>` method to `ToolDispatcher`
|
|
39
|
+
- Include input validation (never trust LLM-generated arguments)
|
|
40
|
+
5. Add tests for any new tools in `tests/`
|
|
41
|
+
|
|
42
|
+
## Adding Tools
|
|
43
|
+
|
|
44
|
+
Tools must be **read-only and safe**. Guidelines:
|
|
45
|
+
|
|
46
|
+
- Validate all inputs (paths, service names, commands)
|
|
47
|
+
- Use allowlists, not blocklists
|
|
48
|
+
- Never allow arbitrary command execution
|
|
49
|
+
- Return errors as strings, never raise exceptions
|
|
50
|
+
- Keep tool output under 10KB (truncate if needed)
|
|
51
|
+
|
|
52
|
+
## Pull Requests
|
|
53
|
+
|
|
54
|
+
- Keep PRs focused on a single change
|
|
55
|
+
- Include tests for new functionality
|
|
56
|
+
- Update README if adding user-facing features
|
|
57
|
+
- Run `ruff check` and `pytest` before submitting
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
FROM python:3.12-slim
|
|
2
|
+
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
|
|
5
|
+
# Install system deps (SSH client for remote monitoring)
|
|
6
|
+
RUN apt-get update && \
|
|
7
|
+
apt-get install -y --no-install-recommends openssh-client curl && \
|
|
8
|
+
rm -rf /var/lib/apt/lists/*
|
|
9
|
+
|
|
10
|
+
# Install Node.js + Claude Code CLI
|
|
11
|
+
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
|
|
12
|
+
apt-get install -y nodejs && \
|
|
13
|
+
npm install -g @anthropic-ai/claude-code@latest && \
|
|
14
|
+
rm -rf /var/lib/apt/lists/*
|
|
15
|
+
|
|
16
|
+
# Install Python dependencies
|
|
17
|
+
COPY pyproject.toml README.md ./
|
|
18
|
+
COPY src/ src/
|
|
19
|
+
RUN pip install --no-cache-dir -e .
|
|
20
|
+
|
|
21
|
+
# Copy templates
|
|
22
|
+
COPY templates/ templates/
|
|
23
|
+
|
|
24
|
+
# Data directory
|
|
25
|
+
VOLUME /app/.supavision
|
|
26
|
+
|
|
27
|
+
ENV SUPAVISION_BACKEND=claude_cli
|
|
28
|
+
EXPOSE 8080
|
|
29
|
+
|
|
30
|
+
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
31
|
+
CMD curl -f http://localhost:8080/api/v1/health || exit 1
|
|
32
|
+
|
|
33
|
+
ENTRYPOINT ["supavision"]
|
|
34
|
+
CMD ["serve", "--port", "8080"]
|
supavision-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Supervisor Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|