qualito 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.
Files changed (74) hide show
  1. qualito-0.1.0/.claude/CLAUDE.md +31 -0
  2. qualito-0.1.0/.env.example +18 -0
  3. qualito-0.1.0/.gitignore +37 -0
  4. qualito-0.1.0/CODEBASE.md +141 -0
  5. qualito-0.1.0/Dockerfile +35 -0
  6. qualito-0.1.0/LICENSE +21 -0
  7. qualito-0.1.0/PKG-INFO +116 -0
  8. qualito-0.1.0/README.md +69 -0
  9. qualito-0.1.0/env.example +16 -0
  10. qualito-0.1.0/pyproject.toml +85 -0
  11. qualito-0.1.0/railway.json +14 -0
  12. qualito-0.1.0/src/dqi/__init__.py +6 -0
  13. qualito-0.1.0/src/dqi/cli/__init__.py +0 -0
  14. qualito-0.1.0/src/dqi/cli/main.py +767 -0
  15. qualito-0.1.0/src/dqi/cloud.py +197 -0
  16. qualito-0.1.0/src/dqi/config.py +156 -0
  17. qualito-0.1.0/src/dqi/core/__init__.py +78 -0
  18. qualito-0.1.0/src/dqi/core/benchmark.py +464 -0
  19. qualito-0.1.0/src/dqi/core/db.py +556 -0
  20. qualito-0.1.0/src/dqi/core/dqi.py +175 -0
  21. qualito-0.1.0/src/dqi/core/evaluator.py +223 -0
  22. qualito-0.1.0/src/dqi/core/feedback_loop.py +210 -0
  23. qualito-0.1.0/src/dqi/core/incident_detector.py +644 -0
  24. qualito-0.1.0/src/dqi/core/measure.py +354 -0
  25. qualito-0.1.0/src/dqi/core/pattern_detector.py +232 -0
  26. qualito-0.1.0/src/dqi/core/stream_parser.py +217 -0
  27. qualito-0.1.0/src/dqi/dashboard/__init__.py +0 -0
  28. qualito-0.1.0/src/dqi/dashboard/api.py +819 -0
  29. qualito-0.1.0/src/dqi/dashboard/app.py +84 -0
  30. qualito-0.1.0/src/dqi/dashboard/auth.py +258 -0
  31. qualito-0.1.0/src/dqi/dashboard/auth_routes.py +175 -0
  32. qualito-0.1.0/src/dqi/dashboard/billing.py +183 -0
  33. qualito-0.1.0/src/dqi/dashboard/billing_routes.py +103 -0
  34. qualito-0.1.0/src/dqi/dashboard/frontend/.gitignore +3 -0
  35. qualito-0.1.0/src/dqi/dashboard/frontend/package-lock.json +2265 -0
  36. qualito-0.1.0/src/dqi/dashboard/frontend/package.json +29 -0
  37. qualito-0.1.0/src/dqi/dashboard/frontend/src/app.css +313 -0
  38. qualito-0.1.0/src/dqi/dashboard/frontend/src/app.html +15 -0
  39. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/api.ts +186 -0
  40. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/components/Badge.svelte +10 -0
  41. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/components/Breadcrumb.svelte +27 -0
  42. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/components/Card.svelte +27 -0
  43. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/components/Chart.svelte +61 -0
  44. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/components/DqiBreakdown.svelte +33 -0
  45. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/components/DqiGauge.svelte +56 -0
  46. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/components/SlidePanel.svelte +47 -0
  47. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/components/StatusBadge.svelte +28 -0
  48. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/dqi-constants.ts +27 -0
  49. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/format.ts +72 -0
  50. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/sse.ts +133 -0
  51. qualito-0.1.0/src/dqi/dashboard/frontend/src/lib/types.ts +187 -0
  52. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/+layout.svelte +220 -0
  53. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/+page.svelte +321 -0
  54. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/experiments/+page.svelte +134 -0
  55. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/experiments/[id]/+page.svelte +249 -0
  56. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/experiments/compare/[before_id]/[after_id]/+page.svelte +194 -0
  57. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/incidents/+page.svelte +153 -0
  58. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/incidents/[id]/+page.svelte +184 -0
  59. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/login/+page.svelte +118 -0
  60. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/metrics/+page.svelte +270 -0
  61. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/runs/+page.svelte +284 -0
  62. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/runs/[id]/+page.svelte +275 -0
  63. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/settings/+page.svelte +310 -0
  64. qualito-0.1.0/src/dqi/dashboard/frontend/src/routes/slo/+page.svelte +142 -0
  65. qualito-0.1.0/src/dqi/dashboard/frontend/svelte.config.js +26 -0
  66. qualito-0.1.0/src/dqi/dashboard/frontend/tsconfig.json +14 -0
  67. qualito-0.1.0/src/dqi/dashboard/frontend/vercel.json +8 -0
  68. qualito-0.1.0/src/dqi/dashboard/frontend/vite.config.ts +12 -0
  69. qualito-0.1.0/src/dqi/importer.py +286 -0
  70. qualito-0.1.0/src/dqi/mcp/__init__.py +0 -0
  71. qualito-0.1.0/src/dqi/mcp/server.py +625 -0
  72. qualito-0.1.0/tests/__init__.py +0 -0
  73. qualito-0.1.0/tests/test_config.py +90 -0
  74. qualito-0.1.0/tests/test_smoke.py +195 -0
@@ -0,0 +1,31 @@
1
+ # DQI — Delegation Quality Index
2
+
3
+ CLI tool + MCP server for measuring and improving AI agent delegation quality. Claude Code-specific.
4
+
5
+ ## Architecture
6
+
7
+ - `src/dqi/core/` — Core modules (DQI calculator, evaluator, stream parser, DB, measurement, benchmarks, pattern detector, feedback loop)
8
+ - `src/dqi/cli/` — Click CLI commands (`dqi init`, `dqi score`, `dqi delegate`, `dqi status`, `dqi costs`)
9
+ - `src/dqi/mcp/` — MCP server (5 tools: dqi_score, dqi_cost, dqi_patterns, dqi_warnings, dqi_templates)
10
+ - `tests/` — pytest tests
11
+
12
+ ## Stack
13
+
14
+ - **Python 3.11+**, managed with **uv**
15
+ - **click** for CLI
16
+ - **SQLite** for local data (`.dqi/dqi.db` per project)
17
+ - **mcp** Python SDK for MCP server
18
+ - **pytest + ruff** for testing/linting
19
+
20
+ ## Conventions
21
+
22
+ - All modules importable as `from dqi.core import ...`
23
+ - No hardcoded paths — everything configurable via env vars or `.dqi/config.toml`
24
+ - `DQI_DIR` env var overrides default `.dqi/` location
25
+ - Type hints on all public functions
26
+ - Docstrings on all modules and public functions
27
+
28
+ ## Entry Points
29
+
30
+ - CLI: `dqi = "dqi.cli.main:cli"`
31
+ - MCP: `dqi-mcp = "dqi.mcp.server:main"`
@@ -0,0 +1,18 @@
1
+ # DQI Dashboard Environment Variables
2
+
3
+ # JWT secret for auth tokens (auto-generated if not set)
4
+ # DQI_JWT_SECRET=your-secret-here
5
+
6
+ # Database directory (defaults to .dqi/ in current working directory)
7
+ # DQI_DIR=.dqi
8
+
9
+ # CORS origins (comma-separated, defaults to localhost:3000,5173,8090)
10
+ # CORS_ORIGINS=http://localhost:5173,https://your-domain.com
11
+
12
+ # Dashboard URL (for Stripe redirect URLs)
13
+ # DASHBOARD_URL=http://localhost:5173
14
+
15
+ # Stripe billing (required for Pro plan upgrades)
16
+ STRIPE_SECRET_KEY=sk_test_...
17
+ STRIPE_WEBHOOK_SECRET=whsec_...
18
+ STRIPE_PRO_PRICE_ID=price_...
@@ -0,0 +1,37 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+
9
+ # Virtual environments
10
+ .venv/
11
+ venv/
12
+
13
+ # Testing
14
+ .pytest_cache/
15
+ .coverage
16
+ htmlcov/
17
+
18
+ # IDE
19
+ .idea/
20
+ .vscode/
21
+ *.swp
22
+ *.swo
23
+
24
+ # DQI local data
25
+ .dqi/
26
+
27
+ # Environment files
28
+ .env
29
+ .env.local
30
+ .env.production
31
+
32
+ # OS
33
+ .DS_Store
34
+ Thumbs.db
35
+
36
+ # uv
37
+ uv.lock
@@ -0,0 +1,141 @@
1
+ # DQI Codebase Map
2
+
3
+ ## Project Structure
4
+
5
+ ```
6
+ dqi/
7
+ pyproject.toml # Package config (hatchling, click CLI, 4 optional dep groups)
8
+ Dockerfile # Railway deployment (Python 3.13-slim + uv)
9
+ railway.json # Railway build config
10
+ .env.example # Environment variables template
11
+ CODEBASE.md # This file
12
+ README.md # Product README with deployment instructions
13
+ src/dqi/
14
+ __init__.py # Package root, __version__
15
+ config.py # Config system: DqiConfig, load_config(), init_project()
16
+ importer.py # Session importer: scan ~/.claude/projects/, import JSONL
17
+ cloud.py # Cloud sync client: login, sync runs/incidents to hosted API
18
+ core/ # Core library modules (no CLI, no hardcoded paths)
19
+ __init__.py # Re-exports all public APIs
20
+ db.py # SQLite database: schema (12 tables), get_db(), CRUD
21
+ dqi.py # DQI calculator: calculate_dqi() (pure), store_dqi()
22
+ evaluator.py # Auto-eval engine: 8 checks, human_score()
23
+ stream_parser.py # Claude stream-json parser: parse_stream() -> ParsedStream
24
+ measure.py # Measurement: baselines, Bayesian comparison, CUSUM monitor
25
+ benchmark.py # Benchmark suites, experiment runner, statistical comparison
26
+ pattern_detector.py # Repeated task pattern detection + classification
27
+ feedback_loop.py # Warning generation for underperforming combos
28
+ incident_detector.py # Incident detection: 4 rules, workspace baselines, auto-resolve
29
+ cli/
30
+ __init__.py
31
+ main.py # Click CLI: 11 commands
32
+ mcp/
33
+ __init__.py
34
+ server.py # MCP server: 7 tools (FastMCP, stdio transport)
35
+ dashboard/
36
+ __init__.py
37
+ app.py # FastAPI application factory, CORS, static files
38
+ api.py # 17 API endpoints (dashboard, runs, metrics, experiments, incidents, SLO, config, sync)
39
+ auth.py # Auth service: JWT, bcrypt, API keys, user management
40
+ auth_routes.py # 8 auth endpoints (register, login, me, API keys, CLI token)
41
+ billing.py # Stripe integration: checkout, webhooks, subscription management
42
+ billing_routes.py # 4 billing endpoints (checkout, webhook, status, cancel)
43
+ frontend/ # SvelteKit 5 + Tailwind 4 dashboard
44
+ src/
45
+ app.css # DQI design system (teal #14b8a6 accent, dark theme)
46
+ app.html # Shell with Inter + JetBrains Mono fonts
47
+ routes/ # 12 pages + 1 layout
48
+ +layout.svelte # Sidebar nav, SSE, auth guard, incident badge
49
+ +page.svelte # Dashboard: DQI gauge, stats, trend chart, recent runs
50
+ login/ # Login/register form
51
+ runs/ # Run list (filters, table) + [id] detail (DQI breakdown)
52
+ metrics/ # Charts: DQI trend, cost trend, by-workspace, by-type
53
+ experiments/ # Experiment cards + [id] detail (scientific paper) + compare
54
+ incidents/ # Incident list + [id] detail (timeline, report slide panel)
55
+ slo/ # SLO gauges (quality, availability, cost)
56
+ settings/ # Account, API keys, billing, plan management
57
+ lib/
58
+ api.ts # Typed fetch wrappers (auth-aware, JWT in headers)
59
+ types.ts # TypeScript interfaces (Run, Experiment, Incident, User, etc.)
60
+ format.ts # Date, cost, duration, DQI color formatting
61
+ sse.ts # SSE client with auto-reconnect
62
+ dqi-constants.ts # Tier labels, colors, weights
63
+ components/ # 8 reusable Svelte components
64
+ Badge.svelte, Breadcrumb.svelte, Card.svelte, Chart.svelte,
65
+ DqiBreakdown.svelte, DqiGauge.svelte, SlidePanel.svelte, StatusBadge.svelte
66
+ vercel.json # Vercel deployment config (API rewrites)
67
+ tests/
68
+ __init__.py
69
+ test_smoke.py # 16 import + function tests
70
+ test_config.py # 8 config + CLI tests
71
+ ```
72
+
73
+ ## CLI Commands (11)
74
+
75
+ | Command | What |
76
+ |---|---|
77
+ | `dqi init` | Initialize .dqi/ in project |
78
+ | `dqi status` | Show config, DB, run count |
79
+ | `dqi import` | Import Claude Code sessions from ~/.claude/projects/ |
80
+ | `dqi score` | DQI scores table with trends |
81
+ | `dqi costs` | Cost breakdown + waste analysis |
82
+ | `dqi incidents` | Active quality incidents |
83
+ | `dqi slo` | SLO compliance (quality, availability, cost) |
84
+ | `dqi dashboard` | Launch web dashboard |
85
+ | `dqi login` | Authenticate with cloud API |
86
+ | `dqi sync` | Push local data to cloud |
87
+ | `dqi logout` | Remove cloud credentials |
88
+
89
+ ## API Endpoints (29)
90
+
91
+ | Method | Path | Purpose |
92
+ |---|---|---|
93
+ | GET | /api/dashboard | Hero metrics (avg DQI, run count, cost, incidents) |
94
+ | GET | /api/runs | Paginated run list with filters |
95
+ | GET | /api/runs/{id} | Run detail with evaluations |
96
+ | GET | /api/metrics | DQI trend, cost trend, breakdowns |
97
+ | GET | /api/experiments | List experiments |
98
+ | GET | /api/experiments/{id} | Experiment detail |
99
+ | GET | /api/experiments/{id}/transitions | Available state transitions |
100
+ | POST | /api/experiments/{id}/transition | Transition experiment status |
101
+ | GET | /api/experiments/compare/{before}/{after} | Comparison data |
102
+ | GET | /api/incidents | List incidents with filters |
103
+ | GET | /api/incidents/{id} | Incident detail with events |
104
+ | GET | /api/incidents/summary | Counts by severity |
105
+ | GET | /api/incidents/slo | SLO compliance |
106
+ | GET | /api/config | Current config |
107
+ | PUT | /api/config | Update SLO targets |
108
+ | POST | /api/sync/runs | Receive synced runs from CLI |
109
+ | POST | /api/sync/incidents | Receive synced incidents from CLI |
110
+ | POST | /api/auth/register | Create account |
111
+ | POST | /api/auth/login | Get JWT token |
112
+ | GET | /api/auth/me | Current user |
113
+ | POST | /api/auth/api-keys | Create API key |
114
+ | GET | /api/auth/api-keys | List API keys |
115
+ | DELETE | /api/auth/api-keys/{id} | Revoke API key |
116
+ | POST | /api/auth/cli-token | CLI auth token |
117
+ | GET | /api/auth/cli-callback | CLI auth callback |
118
+ | POST | /api/billing/checkout | Create Stripe checkout |
119
+ | POST | /api/billing/webhook | Stripe webhook handler |
120
+ | GET | /api/billing/status | Subscription status |
121
+ | POST | /api/billing/cancel | Cancel subscription |
122
+
123
+ ## MCP Tools (7)
124
+
125
+ dqi_score, dqi_cost, dqi_patterns, dqi_warnings, dqi_templates, dqi_incidents, dqi_slo
126
+
127
+ ## Database (12 tables)
128
+
129
+ runs, tool_calls, file_activity, evaluations, artifacts, baselines, system_changes, benchmark_suites, experiments, experiment_comparisons, incidents, incident_events
130
+
131
+ Auth tables (dashboard): users, api_keys
132
+
133
+ ## Key Design Decisions
134
+
135
+ - **Cloud-first**: CLI collects locally, syncs to hosted API, dashboard is hosted
136
+ - **No hardcoded paths**: All modules accept `conn` parameter or resolve via env vars
137
+ - **Connection management**: All DB functions accept optional `conn` — swappable for PostgreSQL
138
+ - **Pure functions where possible**: calculate_dqi() and parse_stream() are side-effect-free
139
+ - **Auth**: JWT + API keys, CLI authenticates via browser flow or --api-key flag
140
+ - **Billing**: Stripe checkout + webhooks, graceful degradation if stripe not available
141
+ - **Package vetting**: All deps must pass 7-day age rule + vulnerability scan before adding
@@ -0,0 +1,35 @@
1
+ FROM python:3.13-slim AS builder
2
+
3
+ WORKDIR /app
4
+
5
+ # Install uv
6
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
7
+
8
+ # Copy dependency files
9
+ COPY pyproject.toml uv.lock ./
10
+
11
+ # Install dependencies (dashboard extra)
12
+ RUN uv sync --frozen --no-dev --extra dashboard
13
+
14
+ # Copy source
15
+ COPY src/ src/
16
+
17
+ # Install the package itself
18
+ RUN uv pip install --no-deps -e .
19
+
20
+ # --- Runtime ---
21
+ FROM python:3.13-slim
22
+
23
+ WORKDIR /app
24
+
25
+ # Copy virtual env and source from builder
26
+ COPY --from=builder /app/.venv /app/.venv
27
+ COPY --from=builder /app/src /app/src
28
+ COPY --from=builder /app/pyproject.toml /app/pyproject.toml
29
+
30
+ ENV PATH="/app/.venv/bin:$PATH"
31
+ ENV PYTHONUNBUFFERED=1
32
+
33
+ EXPOSE 8090
34
+
35
+ CMD ["uvicorn", "dqi.dashboard.app:create_app", "--factory", "--host", "0.0.0.0", "--port", "8090"]
qualito-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mattia Papa
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.
qualito-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,116 @@
1
+ Metadata-Version: 2.4
2
+ Name: qualito
3
+ Version: 0.1.0
4
+ Summary: Quality metrics for AI-assisted development — measure and improve your Claude Code sessions
5
+ Project-URL: Homepage, https://qualito.ai
6
+ Project-URL: Repository, https://github.com/mp-web3/qualito
7
+ Project-URL: Issues, https://github.com/mp-web3/qualito/issues
8
+ Author: Mattia Papa
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: ai,claude,delegation,mcp,quality
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: click<8.3.2,>=8.1
21
+ Provides-Extra: all
22
+ Requires-Dist: bcrypt>=4.0; extra == 'all'
23
+ Requires-Dist: charset-normalizer<3.4.7,>=3.0; extra == 'all'
24
+ Requires-Dist: email-validator>=2.0; extra == 'all'
25
+ Requires-Dist: fastapi<0.135.3,>=0.115; extra == 'all'
26
+ Requires-Dist: jinja2>=3.1; extra == 'all'
27
+ Requires-Dist: mcp<1.27,>=1.0; extra == 'all'
28
+ Requires-Dist: python-jose[cryptography]>=3.3; extra == 'all'
29
+ Requires-Dist: stripe<15.0.1,>=7.0; extra == 'all'
30
+ Requires-Dist: uvicorn<0.43,>=0.31; extra == 'all'
31
+ Provides-Extra: dashboard
32
+ Requires-Dist: bcrypt>=4.0; extra == 'dashboard'
33
+ Requires-Dist: charset-normalizer<3.4.7,>=3.0; extra == 'dashboard'
34
+ Requires-Dist: email-validator>=2.0; extra == 'dashboard'
35
+ Requires-Dist: fastapi<0.135.3,>=0.115; extra == 'dashboard'
36
+ Requires-Dist: jinja2>=3.1; extra == 'dashboard'
37
+ Requires-Dist: python-jose[cryptography]>=3.3; extra == 'dashboard'
38
+ Requires-Dist: stripe<15.0.1,>=7.0; extra == 'dashboard'
39
+ Requires-Dist: uvicorn<0.43,>=0.31; extra == 'dashboard'
40
+ Provides-Extra: dev
41
+ Requires-Dist: pytest>=8.0; extra == 'dev'
42
+ Requires-Dist: ruff<0.15.9,>=0.4; extra == 'dev'
43
+ Provides-Extra: mcp
44
+ Requires-Dist: mcp<1.27,>=1.0; extra == 'mcp'
45
+ Requires-Dist: uvicorn<0.43,>=0.31; extra == 'mcp'
46
+ Description-Content-Type: text/markdown
47
+
48
+ # DQI — Delegation Quality Index
49
+
50
+ Measure and improve AI agent delegation quality. CLI tool + MCP server for Claude Code.
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ pip install dqi
56
+ # or with MCP server support:
57
+ pip install "dqi[mcp]"
58
+ ```
59
+
60
+ ## MCP Server Setup
61
+
62
+ Add to your `.claude.json` or `.mcp.json`:
63
+
64
+ ```json
65
+ {
66
+ "dqi": {
67
+ "command": "uvx",
68
+ "args": ["dqi-mcp"]
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### Available Tools
74
+
75
+ | Tool | Description |
76
+ |------|-------------|
77
+ | `dqi_score` | DQI score summary: average, trend, component breakdown, tier distribution |
78
+ | `dqi_cost` | Cost analysis: total spend, average per run, daily trend, waste estimate |
79
+ | `dqi_patterns` | Repeated task pattern detection with classification and recommendations |
80
+ | `dqi_warnings` | Underperforming workspace/task_type combos with actionable suggestions |
81
+ | `dqi_templates` | Task type inference and delegation template recommendations |
82
+ | `dqi_incidents` | Quality incidents: regressions, anomalies, severity tracking |
83
+ | `dqi_slo` | SLO compliance: quality, availability, and cost targets |
84
+
85
+ ## Deployment
86
+
87
+ The DQI dashboard deploys as a split-stack: **Railway** (API) + **Vercel** (frontend).
88
+
89
+ ### API (Railway)
90
+
91
+ 1. Connect the repo to Railway
92
+ 2. Set environment variables:
93
+ - `DQI_JWT_SECRET` — stable random secret for JWT signing
94
+ - `DQI_DIR` — data directory path (e.g. `/data/.dqi`)
95
+ - `CORS_ORIGINS` — comma-separated allowed origins (e.g. `https://dqi.dev,https://www.dqi.dev`)
96
+ 3. Railway will auto-detect the `Dockerfile` and `railway.json`
97
+
98
+ ### Frontend (Vercel)
99
+
100
+ 1. Set the root directory to `src/dqi/dashboard/frontend`
101
+ 2. Set environment variable:
102
+ - `VITE_API_URL` — Railway API URL (e.g. `https://api.dqi.dev`)
103
+ 3. The `vercel.json` rewrites `/api/*` requests to the Railway backend
104
+
105
+ ### Local Development
106
+
107
+ ```bash
108
+ # Copy and fill in env vars
109
+ cp env.example .env
110
+
111
+ # API (from repo root)
112
+ uv run uvicorn dqi.dashboard.app:create_app --factory --port 8090
113
+
114
+ # Frontend (from src/dqi/dashboard/frontend/)
115
+ npm install && npm run dev
116
+ ```
@@ -0,0 +1,69 @@
1
+ # DQI — Delegation Quality Index
2
+
3
+ Measure and improve AI agent delegation quality. CLI tool + MCP server for Claude Code.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install dqi
9
+ # or with MCP server support:
10
+ pip install "dqi[mcp]"
11
+ ```
12
+
13
+ ## MCP Server Setup
14
+
15
+ Add to your `.claude.json` or `.mcp.json`:
16
+
17
+ ```json
18
+ {
19
+ "dqi": {
20
+ "command": "uvx",
21
+ "args": ["dqi-mcp"]
22
+ }
23
+ }
24
+ ```
25
+
26
+ ### Available Tools
27
+
28
+ | Tool | Description |
29
+ |------|-------------|
30
+ | `dqi_score` | DQI score summary: average, trend, component breakdown, tier distribution |
31
+ | `dqi_cost` | Cost analysis: total spend, average per run, daily trend, waste estimate |
32
+ | `dqi_patterns` | Repeated task pattern detection with classification and recommendations |
33
+ | `dqi_warnings` | Underperforming workspace/task_type combos with actionable suggestions |
34
+ | `dqi_templates` | Task type inference and delegation template recommendations |
35
+ | `dqi_incidents` | Quality incidents: regressions, anomalies, severity tracking |
36
+ | `dqi_slo` | SLO compliance: quality, availability, and cost targets |
37
+
38
+ ## Deployment
39
+
40
+ The DQI dashboard deploys as a split-stack: **Railway** (API) + **Vercel** (frontend).
41
+
42
+ ### API (Railway)
43
+
44
+ 1. Connect the repo to Railway
45
+ 2. Set environment variables:
46
+ - `DQI_JWT_SECRET` — stable random secret for JWT signing
47
+ - `DQI_DIR` — data directory path (e.g. `/data/.dqi`)
48
+ - `CORS_ORIGINS` — comma-separated allowed origins (e.g. `https://dqi.dev,https://www.dqi.dev`)
49
+ 3. Railway will auto-detect the `Dockerfile` and `railway.json`
50
+
51
+ ### Frontend (Vercel)
52
+
53
+ 1. Set the root directory to `src/dqi/dashboard/frontend`
54
+ 2. Set environment variable:
55
+ - `VITE_API_URL` — Railway API URL (e.g. `https://api.dqi.dev`)
56
+ 3. The `vercel.json` rewrites `/api/*` requests to the Railway backend
57
+
58
+ ### Local Development
59
+
60
+ ```bash
61
+ # Copy and fill in env vars
62
+ cp env.example .env
63
+
64
+ # API (from repo root)
65
+ uv run uvicorn dqi.dashboard.app:create_app --factory --port 8090
66
+
67
+ # Frontend (from src/dqi/dashboard/frontend/)
68
+ npm install && npm run dev
69
+ ```
@@ -0,0 +1,16 @@
1
+ # DQI Dashboard — Environment Variables
2
+
3
+ # Database: PostgreSQL connection string for production, omit for SQLite
4
+ # DATABASE_URL=postgresql://user:pass@host:5432/dqi
5
+
6
+ # DQI data directory (SQLite fallback)
7
+ # DQI_DIR=/data/.dqi
8
+
9
+ # JWT secret for auth tokens (required in production — must be stable across deploys)
10
+ DQI_JWT_SECRET=change-me-to-a-random-secret
11
+
12
+ # CORS allowed origins (comma-separated)
13
+ CORS_ORIGINS=http://localhost:5173,http://localhost:3000
14
+
15
+ # Frontend API URL (set in Vercel env vars)
16
+ # VITE_API_URL=https://api.dqi.dev
@@ -0,0 +1,85 @@
1
+ [project]
2
+ name = "qualito"
3
+ version = "0.1.0"
4
+ description = "Quality metrics for AI-assisted development — measure and improve your Claude Code sessions"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ requires-python = ">=3.11"
8
+ authors = [
9
+ { name = "Mattia Papa" },
10
+ ]
11
+ keywords = ["ai", "claude", "delegation", "quality", "mcp"]
12
+ classifiers = [
13
+ "Development Status :: 3 - Alpha",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: MIT License",
16
+ "Programming Language :: Python :: 3.11",
17
+ "Programming Language :: Python :: 3.12",
18
+ "Programming Language :: Python :: 3.13",
19
+ "Topic :: Software Development :: Quality Assurance",
20
+ ]
21
+ dependencies = [
22
+ "click>=8.1,<8.3.2",
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://qualito.ai"
27
+ Repository = "https://github.com/mp-web3/qualito"
28
+ Issues = "https://github.com/mp-web3/qualito/issues"
29
+
30
+ [project.optional-dependencies]
31
+ mcp = [
32
+ "mcp>=1.0,<1.27",
33
+ "uvicorn>=0.31,<0.43",
34
+ ]
35
+ dashboard = [
36
+ "fastapi>=0.115,<0.135.3",
37
+ "uvicorn>=0.31,<0.43",
38
+ "jinja2>=3.1",
39
+ "python-jose[cryptography]>=3.3",
40
+ "bcrypt>=4.0",
41
+ "stripe>=7.0,<15.0.1",
42
+ "charset-normalizer>=3.0,<3.4.7",
43
+ "email-validator>=2.0",
44
+ ]
45
+ all = [
46
+ "qualito[mcp]",
47
+ "qualito[dashboard]",
48
+ ]
49
+ dev = [
50
+ "pytest>=8.0",
51
+ "ruff>=0.4,<0.15.9",
52
+ ]
53
+
54
+ [project.scripts]
55
+ dqi = "dqi.cli.main:cli"
56
+ dqi-mcp = "dqi.mcp.server:main"
57
+
58
+ [build-system]
59
+ requires = ["hatchling"]
60
+ build-backend = "hatchling.build"
61
+
62
+ [tool.hatch.build.targets.wheel]
63
+ packages = ["src/dqi"]
64
+ exclude = [
65
+ "src/dqi/dashboard/frontend/node_modules",
66
+ "src/dqi/dashboard/frontend/src",
67
+ "src/dqi/dashboard/frontend/.svelte-kit",
68
+ ]
69
+
70
+ [tool.hatch.build.targets.sdist]
71
+ exclude = [
72
+ "src/dqi/dashboard/frontend/node_modules",
73
+ "src/dqi/dashboard/frontend/.svelte-kit",
74
+ ]
75
+
76
+ [tool.ruff]
77
+ target-version = "py311"
78
+ line-length = 100
79
+
80
+ [tool.ruff.lint]
81
+ select = ["E", "F", "I", "W"]
82
+
83
+ [tool.pytest.ini_options]
84
+ testpaths = ["tests"]
85
+ pythonpath = ["src"]
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://railway.com/railway.schema.json",
3
+ "build": {
4
+ "builder": "DOCKERFILE",
5
+ "dockerfilePath": "Dockerfile"
6
+ },
7
+ "deploy": {
8
+ "startCommand": "uvicorn dqi.dashboard.app:create_app --factory --host 0.0.0.0 --port ${PORT:-8090}",
9
+ "healthcheckPath": "/api/dashboard",
10
+ "healthcheckTimeout": 30,
11
+ "restartPolicyType": "ON_FAILURE",
12
+ "restartPolicyMaxRetries": 5
13
+ }
14
+ }
@@ -0,0 +1,6 @@
1
+ """DQI — Delegation Quality Index.
2
+
3
+ Measure and improve AI agent delegation quality.
4
+ """
5
+
6
+ __version__ = "0.1.0"
File without changes