arbiter-dev 0.2.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 (35) hide show
  1. arbiter_dev-0.2.0/LICENSE +21 -0
  2. arbiter_dev-0.2.0/PKG-INFO +216 -0
  3. arbiter_dev-0.2.0/README.md +191 -0
  4. arbiter_dev-0.2.0/pyproject.toml +36 -0
  5. arbiter_dev-0.2.0/setup.cfg +4 -0
  6. arbiter_dev-0.2.0/src/arbiter/__init__.py +3 -0
  7. arbiter_dev-0.2.0/src/arbiter/__main__.py +570 -0
  8. arbiter_dev-0.2.0/src/arbiter/agent_registry.py +120 -0
  9. arbiter_dev-0.2.0/src/arbiter/analyzers/__init__.py +1 -0
  10. arbiter_dev-0.2.0/src/arbiter/analyzers/base.py +44 -0
  11. arbiter_dev-0.2.0/src/arbiter/analyzers/complexity_analyzer.py +66 -0
  12. arbiter_dev-0.2.0/src/arbiter/analyzers/dead_code_analyzer.py +52 -0
  13. arbiter_dev-0.2.0/src/arbiter/analyzers/duplication_analyzer.py +96 -0
  14. arbiter_dev-0.2.0/src/arbiter/analyzers/ruff_analyzer.py +78 -0
  15. arbiter_dev-0.2.0/src/arbiter/analyzers/security_analyzer.py +64 -0
  16. arbiter_dev-0.2.0/src/arbiter/api.py +173 -0
  17. arbiter_dev-0.2.0/src/arbiter/bus_bridge.py +82 -0
  18. arbiter_dev-0.2.0/src/arbiter/diff_analyzer.py +161 -0
  19. arbiter_dev-0.2.0/src/arbiter/git_historian.py +209 -0
  20. arbiter_dev-0.2.0/src/arbiter/scoring.py +127 -0
  21. arbiter_dev-0.2.0/src/arbiter/store.py +249 -0
  22. arbiter_dev-0.2.0/src/arbiter_dev.egg-info/PKG-INFO +216 -0
  23. arbiter_dev-0.2.0/src/arbiter_dev.egg-info/SOURCES.txt +33 -0
  24. arbiter_dev-0.2.0/src/arbiter_dev.egg-info/dependency_links.txt +1 -0
  25. arbiter_dev-0.2.0/src/arbiter_dev.egg-info/entry_points.txt +2 -0
  26. arbiter_dev-0.2.0/src/arbiter_dev.egg-info/requires.txt +12 -0
  27. arbiter_dev-0.2.0/src/arbiter_dev.egg-info/top_level.txt +1 -0
  28. arbiter_dev-0.2.0/tests/test_agent_registry.py +72 -0
  29. arbiter_dev-0.2.0/tests/test_analyzers.py +106 -0
  30. arbiter_dev-0.2.0/tests/test_api.py +124 -0
  31. arbiter_dev-0.2.0/tests/test_cli.py +48 -0
  32. arbiter_dev-0.2.0/tests/test_diff_analyzer.py +125 -0
  33. arbiter_dev-0.2.0/tests/test_new_analyzers.py +146 -0
  34. arbiter_dev-0.2.0/tests/test_scoring.py +102 -0
  35. arbiter_dev-0.2.0/tests/test_store.py +84 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Reuben Bowlby, Daniel Matha / HUMMBL LLC
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.
@@ -0,0 +1,216 @@
1
+ Metadata-Version: 2.4
2
+ Name: arbiter-dev
3
+ Version: 0.2.0
4
+ Summary: Agent-aware code quality system for multi-agent codebases
5
+ Author: Reuben Bowlby, Daniel Matha
6
+ License-Expression: MIT
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Requires-Python: >=3.11
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Provides-Extra: analyzers
16
+ Requires-Dist: ruff>=0.4.0; extra == "analyzers"
17
+ Requires-Dist: radon>=6.0; extra == "analyzers"
18
+ Requires-Dist: vulture>=2.10; extra == "analyzers"
19
+ Requires-Dist: bandit>=1.7.0; extra == "analyzers"
20
+ Provides-Extra: test
21
+ Requires-Dist: pytest>=7.0; extra == "test"
22
+ Provides-Extra: all
23
+ Requires-Dist: arbiter[analyzers,test]; extra == "all"
24
+ Dynamic: license-file
25
+
26
+ # Arbiter
27
+
28
+ **Agent-aware code quality system for multi-agent codebases.**
29
+
30
+ In 2026, code is written by fleets of AI agents. Arbiter knows *who* wrote each line — human or AI — and scores quality accordingly.
31
+
32
+ ## What Makes Arbiter Different
33
+
34
+ | Feature | Traditional Tools | Arbiter |
35
+ |---------|------------------|---------|
36
+ | Agent attribution | None | First-class: tracks Claude, Codex, Gemini, Copilot, humans |
37
+ | Per-commit scoring | Repo-wide only | Scores each commit's changed files individually |
38
+ | Diff analysis | N/A | Score only what changed in a PR/branch |
39
+ | Transparency | Opaque score | Every score decomposes into lint + security + complexity |
40
+ | Agent-specific gates | N/A | Different quality thresholds per agent trust tier |
41
+ | Tool integration | Proprietary | Wraps tools you already trust: ruff, Bandit, radon, vulture |
42
+ | Dashboard | SaaS login | Single HTML file with per-agent timelines, commit feed, fleet view |
43
+ | Dependencies | Heavy | Analysis tools only; core is stdlib Python |
44
+
45
+ ## Quick Start
46
+
47
+ ```bash
48
+ git clone https://github.com/hummbl-dev/arbiter.git
49
+ cd arbiter
50
+
51
+ # Install (makes `arbiter` command available)
52
+ pip install ".[analyzers]"
53
+
54
+ # Quick score (no persistence)
55
+ arbiter score /path/to/your/repo
56
+
57
+ # Full analysis with per-commit agent attribution
58
+ arbiter analyze /path/to/your/repo
59
+
60
+ # Score only files changed since main
61
+ arbiter diff /path/to/your/repo --base main
62
+
63
+ # Agent leaderboard
64
+ arbiter agents
65
+
66
+ # Start dashboard
67
+ arbiter serve --port 8080
68
+ # Open http://localhost:8080
69
+ ```
70
+
71
+ ### Without install (PYTHONPATH)
72
+
73
+ ```bash
74
+ PYTHONPATH=src python -m arbiter score /path/to/your/repo
75
+ ```
76
+
77
+ ### With Docker
78
+
79
+ ```bash
80
+ docker build -t arbiter .
81
+ docker run -p 8080:8080 -v /path/to/repo:/repo:ro arbiter
82
+ ```
83
+
84
+ ## Architecture
85
+
86
+ ```
87
+ Git Repo ──→ [Git Historian] ──→ [Analyzer Runner] ──→ [Scoring Engine] ──→ [SQLite Store]
88
+ │ │ │ │
89
+ agent attribution tool invocation weighted rubric trend data
90
+ (Co-Authored-By, (ruff, radon, (lint 35%, │
91
+ email matching) vulture, bandit) security 30%, ├──→ REST API
92
+ complexity 35%) └──→ Dashboard
93
+ ┌────────────┐
94
+ │Diff Analyzer│ ←── v0.2: scores only changed files per commit/branch
95
+ └────────────┘
96
+ ```
97
+
98
+ ### Per-Commit Scoring (v0.2)
99
+
100
+ Every commit is scored against only the files it changed, not the entire repo. This makes the agent leaderboard meaningful — a commit that touches 1 clean file scores differently than one that touches 10 messy files.
101
+
102
+ ### Diff Mode (v0.2)
103
+
104
+ `arbiter diff` scores only files changed since a base branch. Ideal for CI/PR quality gates — fast, scoped, actionable.
105
+
106
+ ### Agent Attribution
107
+
108
+ Arbiter identifies which agent authored each commit:
109
+
110
+ 1. **Co-Authored-By trailer** — `Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>`
111
+ 2. **Author email** — maps `noreply@anthropic.com` → claude, `codex@openai.com` → codex
112
+ 3. **Default** — "human" if no agent pattern matches
113
+
114
+ Configure in `agents.yml`:
115
+ ```yaml
116
+ agents:
117
+ - name: claude
118
+ emails: [noreply@anthropic.com]
119
+ co_author_patterns: ["Claude\\s+(Opus|Sonnet|Haiku)"]
120
+ trust_tier: verified
121
+ quality_threshold: 70.0
122
+ - name: gemini
123
+ trust_tier: probation
124
+ quality_threshold: 80.0 # Higher bar for probationary agents
125
+ ```
126
+
127
+ ### Analyzers (pluggable)
128
+
129
+ | Analyzer | Tool | What It Finds |
130
+ |----------|------|--------------|
131
+ | Lint | ruff | Style violations, import errors, bugbear patterns |
132
+ | Complexity | radon | Cyclomatic complexity (grade A-F per function) |
133
+ | Security | bandit | Hardcoded secrets, shell injection, dangerous patterns |
134
+ | Dead Code | vulture | Unused functions, imports, variables |
135
+ | Duplication | AST hash | Near-duplicate function bodies |
136
+
137
+ ### Scoring
138
+
139
+ Deterministic. Same code → same score. Always.
140
+
141
+ ```
142
+ Overall = Lint (35%) + Security (30%) + Complexity (35%)
143
+
144
+ Penalty points by severity:
145
+ CRITICAL: 50 | HIGH: 20 | MEDIUM: 5 | LOW: 1
146
+
147
+ Score = 100 - (total_penalty / LOC) * normalization_factor
148
+ ```
149
+
150
+ Grades: A (90+) | B (80+) | C (70+) | D (60+) | F (<60)
151
+
152
+ ### Dashboard (v2)
153
+
154
+ Single HTML file with Chart.js. No build step, no React, no npm.
155
+
156
+ - **Score Card** — Big number + breakdown bars
157
+ - **Agent Leaderboard** — Who writes the best code? Color-coded by agent
158
+ - **Per-Agent Quality Timeline** — Score over time per agent (not just repo-wide)
159
+ - **Commit Feed** — Recent commits with agent, score, changes, timestamp
160
+ - **Hotspot Files** — Ranked by finding count
161
+ - **Fleet View** — Multi-repo quality grid with color-coded scores
162
+ - **Tabbed UI** — Overview, Commits, Fleet tabs
163
+
164
+ ### API
165
+
166
+ ```
167
+ GET /api/score Current repo score
168
+ GET /api/agents Agent leaderboard
169
+ GET /api/agents/{name}/trend Per-agent quality over time
170
+ GET /api/trend?days=30 Quality over time
171
+ GET /api/worst?limit=20 Worst files
172
+ GET /api/commits Recent commits with scores
173
+ GET /api/commits/{hash} Detail for one commit
174
+ GET /api/fleet Fleet report (multi-repo)
175
+ GET /api/health System health
176
+ ```
177
+
178
+ ## CLI Commands
179
+
180
+ ```bash
181
+ arbiter analyze <repo> # Full analysis + per-commit scoring + persist
182
+ arbiter score <repo> [--json] [--exclude] # Quick score (no persist)
183
+ arbiter diff <repo> [--base main] [--json] # Score only changed files vs base branch
184
+ arbiter agents # Agent leaderboard
185
+ arbiter trend [--days 30] # Quality trend
186
+ arbiter worst [--limit 20] # Worst files
187
+ arbiter commits [--agent claude] # Recent commits
188
+ arbiter audit-fleet <directory> # Audit all repos in a directory
189
+ arbiter fleet-report # Fleet quality summary
190
+ arbiter triage # Auto-classify repos: green/yellow/red/archive
191
+ arbiter fix <repo> [--dry-run] # Auto-fix ruff findings + before/after score
192
+ arbiter serve [--port 8080] # API + dashboard
193
+ ```
194
+
195
+ ## Tests
196
+
197
+ ```bash
198
+ pip install ".[test]"
199
+ PYTHONPATH=src python -m pytest tests/ -v
200
+ # 78 tests, <7 seconds
201
+ ```
202
+
203
+ ## Requirements
204
+
205
+ - Python 3.11+
206
+ - git (for historian)
207
+ - Optional: ruff, radon, vulture, bandit (for full analysis)
208
+ - Docker (for containerized deployment)
209
+
210
+ ## License
211
+
212
+ MIT — see [LICENSE](LICENSE).
213
+
214
+ ---
215
+
216
+ Built by [HUMMBL LLC](https://hummbl.io) from production experience coordinating Claude, Codex, Gemini, and human engineers on a 6,000+ test codebase.
@@ -0,0 +1,191 @@
1
+ # Arbiter
2
+
3
+ **Agent-aware code quality system for multi-agent codebases.**
4
+
5
+ In 2026, code is written by fleets of AI agents. Arbiter knows *who* wrote each line — human or AI — and scores quality accordingly.
6
+
7
+ ## What Makes Arbiter Different
8
+
9
+ | Feature | Traditional Tools | Arbiter |
10
+ |---------|------------------|---------|
11
+ | Agent attribution | None | First-class: tracks Claude, Codex, Gemini, Copilot, humans |
12
+ | Per-commit scoring | Repo-wide only | Scores each commit's changed files individually |
13
+ | Diff analysis | N/A | Score only what changed in a PR/branch |
14
+ | Transparency | Opaque score | Every score decomposes into lint + security + complexity |
15
+ | Agent-specific gates | N/A | Different quality thresholds per agent trust tier |
16
+ | Tool integration | Proprietary | Wraps tools you already trust: ruff, Bandit, radon, vulture |
17
+ | Dashboard | SaaS login | Single HTML file with per-agent timelines, commit feed, fleet view |
18
+ | Dependencies | Heavy | Analysis tools only; core is stdlib Python |
19
+
20
+ ## Quick Start
21
+
22
+ ```bash
23
+ git clone https://github.com/hummbl-dev/arbiter.git
24
+ cd arbiter
25
+
26
+ # Install (makes `arbiter` command available)
27
+ pip install ".[analyzers]"
28
+
29
+ # Quick score (no persistence)
30
+ arbiter score /path/to/your/repo
31
+
32
+ # Full analysis with per-commit agent attribution
33
+ arbiter analyze /path/to/your/repo
34
+
35
+ # Score only files changed since main
36
+ arbiter diff /path/to/your/repo --base main
37
+
38
+ # Agent leaderboard
39
+ arbiter agents
40
+
41
+ # Start dashboard
42
+ arbiter serve --port 8080
43
+ # Open http://localhost:8080
44
+ ```
45
+
46
+ ### Without install (PYTHONPATH)
47
+
48
+ ```bash
49
+ PYTHONPATH=src python -m arbiter score /path/to/your/repo
50
+ ```
51
+
52
+ ### With Docker
53
+
54
+ ```bash
55
+ docker build -t arbiter .
56
+ docker run -p 8080:8080 -v /path/to/repo:/repo:ro arbiter
57
+ ```
58
+
59
+ ## Architecture
60
+
61
+ ```
62
+ Git Repo ──→ [Git Historian] ──→ [Analyzer Runner] ──→ [Scoring Engine] ──→ [SQLite Store]
63
+ │ │ │ │
64
+ agent attribution tool invocation weighted rubric trend data
65
+ (Co-Authored-By, (ruff, radon, (lint 35%, │
66
+ email matching) vulture, bandit) security 30%, ├──→ REST API
67
+ complexity 35%) └──→ Dashboard
68
+ ┌────────────┐
69
+ │Diff Analyzer│ ←── v0.2: scores only changed files per commit/branch
70
+ └────────────┘
71
+ ```
72
+
73
+ ### Per-Commit Scoring (v0.2)
74
+
75
+ Every commit is scored against only the files it changed, not the entire repo. This makes the agent leaderboard meaningful — a commit that touches 1 clean file scores differently than one that touches 10 messy files.
76
+
77
+ ### Diff Mode (v0.2)
78
+
79
+ `arbiter diff` scores only files changed since a base branch. Ideal for CI/PR quality gates — fast, scoped, actionable.
80
+
81
+ ### Agent Attribution
82
+
83
+ Arbiter identifies which agent authored each commit:
84
+
85
+ 1. **Co-Authored-By trailer** — `Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>`
86
+ 2. **Author email** — maps `noreply@anthropic.com` → claude, `codex@openai.com` → codex
87
+ 3. **Default** — "human" if no agent pattern matches
88
+
89
+ Configure in `agents.yml`:
90
+ ```yaml
91
+ agents:
92
+ - name: claude
93
+ emails: [noreply@anthropic.com]
94
+ co_author_patterns: ["Claude\\s+(Opus|Sonnet|Haiku)"]
95
+ trust_tier: verified
96
+ quality_threshold: 70.0
97
+ - name: gemini
98
+ trust_tier: probation
99
+ quality_threshold: 80.0 # Higher bar for probationary agents
100
+ ```
101
+
102
+ ### Analyzers (pluggable)
103
+
104
+ | Analyzer | Tool | What It Finds |
105
+ |----------|------|--------------|
106
+ | Lint | ruff | Style violations, import errors, bugbear patterns |
107
+ | Complexity | radon | Cyclomatic complexity (grade A-F per function) |
108
+ | Security | bandit | Hardcoded secrets, shell injection, dangerous patterns |
109
+ | Dead Code | vulture | Unused functions, imports, variables |
110
+ | Duplication | AST hash | Near-duplicate function bodies |
111
+
112
+ ### Scoring
113
+
114
+ Deterministic. Same code → same score. Always.
115
+
116
+ ```
117
+ Overall = Lint (35%) + Security (30%) + Complexity (35%)
118
+
119
+ Penalty points by severity:
120
+ CRITICAL: 50 | HIGH: 20 | MEDIUM: 5 | LOW: 1
121
+
122
+ Score = 100 - (total_penalty / LOC) * normalization_factor
123
+ ```
124
+
125
+ Grades: A (90+) | B (80+) | C (70+) | D (60+) | F (<60)
126
+
127
+ ### Dashboard (v2)
128
+
129
+ Single HTML file with Chart.js. No build step, no React, no npm.
130
+
131
+ - **Score Card** — Big number + breakdown bars
132
+ - **Agent Leaderboard** — Who writes the best code? Color-coded by agent
133
+ - **Per-Agent Quality Timeline** — Score over time per agent (not just repo-wide)
134
+ - **Commit Feed** — Recent commits with agent, score, changes, timestamp
135
+ - **Hotspot Files** — Ranked by finding count
136
+ - **Fleet View** — Multi-repo quality grid with color-coded scores
137
+ - **Tabbed UI** — Overview, Commits, Fleet tabs
138
+
139
+ ### API
140
+
141
+ ```
142
+ GET /api/score Current repo score
143
+ GET /api/agents Agent leaderboard
144
+ GET /api/agents/{name}/trend Per-agent quality over time
145
+ GET /api/trend?days=30 Quality over time
146
+ GET /api/worst?limit=20 Worst files
147
+ GET /api/commits Recent commits with scores
148
+ GET /api/commits/{hash} Detail for one commit
149
+ GET /api/fleet Fleet report (multi-repo)
150
+ GET /api/health System health
151
+ ```
152
+
153
+ ## CLI Commands
154
+
155
+ ```bash
156
+ arbiter analyze <repo> # Full analysis + per-commit scoring + persist
157
+ arbiter score <repo> [--json] [--exclude] # Quick score (no persist)
158
+ arbiter diff <repo> [--base main] [--json] # Score only changed files vs base branch
159
+ arbiter agents # Agent leaderboard
160
+ arbiter trend [--days 30] # Quality trend
161
+ arbiter worst [--limit 20] # Worst files
162
+ arbiter commits [--agent claude] # Recent commits
163
+ arbiter audit-fleet <directory> # Audit all repos in a directory
164
+ arbiter fleet-report # Fleet quality summary
165
+ arbiter triage # Auto-classify repos: green/yellow/red/archive
166
+ arbiter fix <repo> [--dry-run] # Auto-fix ruff findings + before/after score
167
+ arbiter serve [--port 8080] # API + dashboard
168
+ ```
169
+
170
+ ## Tests
171
+
172
+ ```bash
173
+ pip install ".[test]"
174
+ PYTHONPATH=src python -m pytest tests/ -v
175
+ # 78 tests, <7 seconds
176
+ ```
177
+
178
+ ## Requirements
179
+
180
+ - Python 3.11+
181
+ - git (for historian)
182
+ - Optional: ruff, radon, vulture, bandit (for full analysis)
183
+ - Docker (for containerized deployment)
184
+
185
+ ## License
186
+
187
+ MIT — see [LICENSE](LICENSE).
188
+
189
+ ---
190
+
191
+ Built by [HUMMBL LLC](https://hummbl.io) from production experience coordinating Claude, Codex, Gemini, and human engineers on a 6,000+ test codebase.
@@ -0,0 +1,36 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "arbiter-dev"
7
+ version = "0.2.0"
8
+ description = "Agent-aware code quality system for multi-agent codebases"
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ requires-python = ">=3.11"
12
+ authors = [
13
+ {name = "Reuben Bowlby"},
14
+ {name = "Daniel Matha"},
15
+ ]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ ]
23
+
24
+ [project.optional-dependencies]
25
+ analyzers = ["ruff>=0.4.0", "radon>=6.0", "vulture>=2.10", "bandit>=1.7.0"]
26
+ test = ["pytest>=7.0"]
27
+ all = ["arbiter[analyzers,test]"]
28
+
29
+ [project.scripts]
30
+ arbiter = "arbiter.__main__:main"
31
+
32
+ [tool.setuptools.packages.find]
33
+ where = ["src"]
34
+
35
+ [tool.pytest.ini_options]
36
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """Arbiter — Agent-aware code quality system."""
2
+
3
+ __version__ = "0.1.0"