arbiterx-gate 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.
- arbiterx_gate-0.1.0/.agents/rules.md +69 -0
- arbiterx_gate-0.1.0/.claude-plugin/marketplace.json +19 -0
- arbiterx_gate-0.1.0/.claude-plugin/plugin.json +38 -0
- arbiterx_gate-0.1.0/.codex-plugin/plugin.json +33 -0
- arbiterx_gate-0.1.0/.cursor/rules/arbiterx.mdc +31 -0
- arbiterx_gate-0.1.0/.env.example +14 -0
- arbiterx_gate-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +34 -0
- arbiterx_gate-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
- arbiterx_gate-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +20 -0
- arbiterx_gate-0.1.0/.github/TOPICS.md +24 -0
- arbiterx_gate-0.1.0/.github/copilot-instructions.md +27 -0
- arbiterx_gate-0.1.0/.github/workflows/ci.yml +36 -0
- arbiterx_gate-0.1.0/.github/workflows/pages.yml +40 -0
- arbiterx_gate-0.1.0/.github/workflows/publish.yml +35 -0
- arbiterx_gate-0.1.0/.gitignore +48 -0
- arbiterx_gate-0.1.0/.kiro/steering/arbiterx.md +16 -0
- arbiterx_gate-0.1.0/.well-known/agent.json +27 -0
- arbiterx_gate-0.1.0/.well-known/ai-plugin.json +17 -0
- arbiterx_gate-0.1.0/.windsurf/rules/arbiterx.md +42 -0
- arbiterx_gate-0.1.0/.zed/assistant/rules.md +34 -0
- arbiterx_gate-0.1.0/AGENTS.md +40 -0
- arbiterx_gate-0.1.0/ARCHITECTURE.md +660 -0
- arbiterx_gate-0.1.0/CHANGELOG.md +26 -0
- arbiterx_gate-0.1.0/CLAUDE.md +33 -0
- arbiterx_gate-0.1.0/CODE_OF_CONDUCT.md +41 -0
- arbiterx_gate-0.1.0/CONVENTIONS.md +36 -0
- arbiterx_gate-0.1.0/LICENSE +200 -0
- arbiterx_gate-0.1.0/PKG-INFO +780 -0
- arbiterx_gate-0.1.0/README.md +738 -0
- arbiterx_gate-0.1.0/SECURITY.md +55 -0
- arbiterx_gate-0.1.0/arbiterx.toml.example +89 -0
- arbiterx_gate-0.1.0/assets/arbiterx-logo.svg +27 -0
- arbiterx_gate-0.1.0/assets/demo.svg +35 -0
- arbiterx_gate-0.1.0/benchmarks/README.md +46 -0
- arbiterx_gate-0.1.0/benchmarks/results/.gitkeep +0 -0
- arbiterx_gate-0.1.0/benchmarks/results/benchmark_20260703_150929.txt +21 -0
- arbiterx_gate-0.1.0/benchmarks/results/self-benchmark.md +24 -0
- arbiterx_gate-0.1.0/benchmarks/run_benchmark.py +313 -0
- arbiterx_gate-0.1.0/docs/ABOUT.md +78 -0
- arbiterx_gate-0.1.0/docs/CONTRIBUTING.md +116 -0
- arbiterx_gate-0.1.0/docs/GUIDE.md +322 -0
- arbiterx_gate-0.1.0/docs/INTEGRATIONS.md +431 -0
- arbiterx_gate-0.1.0/docs/site/ai.txt +59 -0
- arbiterx_gate-0.1.0/docs/site/index.html +691 -0
- arbiterx_gate-0.1.0/docs/site/llms.txt +38 -0
- arbiterx_gate-0.1.0/docs/site/robots.txt +4 -0
- arbiterx_gate-0.1.0/docs/site/sitemap.xml +9 -0
- arbiterx_gate-0.1.0/examples/basic_usage.py +127 -0
- arbiterx_gate-0.1.0/examples/quality_check.py +171 -0
- arbiterx_gate-0.1.0/examples/validate_file.py +100 -0
- arbiterx_gate-0.1.0/hooks/hooks.json +31 -0
- arbiterx_gate-0.1.0/hooks/pre-commit +108 -0
- arbiterx_gate-0.1.0/llms.txt +38 -0
- arbiterx_gate-0.1.0/package.json +38 -0
- arbiterx_gate-0.1.0/pyproject.toml +91 -0
- arbiterx_gate-0.1.0/scripts/build-map.sh +17 -0
- arbiterx_gate-0.1.0/scripts/demo.sh +144 -0
- arbiterx_gate-0.1.0/scripts/record-demo.sh +84 -0
- arbiterx_gate-0.1.0/skills/arbiterx-gate.md +44 -0
- arbiterx_gate-0.1.0/skills/arbiterx-review.md +27 -0
- arbiterx_gate-0.1.0/skills/arbiterx.md +41 -0
- arbiterx_gate-0.1.0/src/arbiterx/__init__.py +3 -0
- arbiterx_gate-0.1.0/src/arbiterx/adapters/__init__.py +47 -0
- arbiterx_gate-0.1.0/src/arbiterx/adapters/anthropic.py +145 -0
- arbiterx_gate-0.1.0/src/arbiterx/adapters/base.py +124 -0
- arbiterx_gate-0.1.0/src/arbiterx/adapters/google.py +133 -0
- arbiterx_gate-0.1.0/src/arbiterx/adapters/ollama.py +129 -0
- arbiterx_gate-0.1.0/src/arbiterx/adapters/openai.py +126 -0
- arbiterx_gate-0.1.0/src/arbiterx/adapters/openrouter.py +143 -0
- arbiterx_gate-0.1.0/src/arbiterx/cli.py +324 -0
- arbiterx_gate-0.1.0/src/arbiterx/context/__init__.py +11 -0
- arbiterx_gate-0.1.0/src/arbiterx/context/assembler.py +144 -0
- arbiterx_gate-0.1.0/src/arbiterx/context/cache.py +193 -0
- arbiterx_gate-0.1.0/src/arbiterx/context/compressor.py +199 -0
- arbiterx_gate-0.1.0/src/arbiterx/gate/__init__.py +9 -0
- arbiterx_gate-0.1.0/src/arbiterx/gate/efficiency.py +255 -0
- arbiterx_gate-0.1.0/src/arbiterx/gate/robustness.py +255 -0
- arbiterx_gate-0.1.0/src/arbiterx/gate/security.py +217 -0
- arbiterx_gate-0.1.0/src/arbiterx/gate/validator.py +345 -0
- arbiterx_gate-0.1.0/src/arbiterx/ladder/__init__.py +8 -0
- arbiterx_gate-0.1.0/src/arbiterx/ladder/interrogator.py +975 -0
- arbiterx_gate-0.1.0/src/arbiterx/mapper/__init__.py +23 -0
- arbiterx_gate-0.1.0/src/arbiterx/mapper/graph.py +170 -0
- arbiterx_gate-0.1.0/src/arbiterx/mapper/hasher.py +98 -0
- arbiterx_gate-0.1.0/src/arbiterx/mapper/indexer.py +119 -0
- arbiterx_gate-0.1.0/src/arbiterx/mapper/languages.py +72 -0
- arbiterx_gate-0.1.0/src/arbiterx/mapper/parser.py +509 -0
- arbiterx_gate-0.1.0/src/arbiterx/mapper/store.py +172 -0
- arbiterx_gate-0.1.0/src/arbiterx/plugins/__init__.py +73 -0
- arbiterx_gate-0.1.0/src/arbiterx/plugins/loader.py +307 -0
- arbiterx_gate-0.1.0/src/arbiterx/principles.py +203 -0
- arbiterx_gate-0.1.0/src/arbiterx/router/__init__.py +24 -0
- arbiterx_gate-0.1.0/src/arbiterx/router/classifier.py +364 -0
- arbiterx_gate-0.1.0/src/arbiterx/router/handoff.py +215 -0
- arbiterx_gate-0.1.0/src/arbiterx/router/table.py +217 -0
- arbiterx_gate-0.1.0/tests/__init__.py +0 -0
- arbiterx_gate-0.1.0/tests/integration/__init__.py +0 -0
- arbiterx_gate-0.1.0/tests/integration/test_indexer.py +212 -0
- arbiterx_gate-0.1.0/tests/unit/__init__.py +0 -0
- arbiterx_gate-0.1.0/tests/unit/test_adapters.py +229 -0
- arbiterx_gate-0.1.0/tests/unit/test_classifier.py +55 -0
- arbiterx_gate-0.1.0/tests/unit/test_hasher.py +59 -0
- arbiterx_gate-0.1.0/tests/unit/test_parser.py +223 -0
- arbiterx_gate-0.1.0/tests/unit/test_plugins.py +170 -0
- arbiterx_gate-0.1.0/tests/unit/test_store.py +227 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Agent Rules — ArbiterX
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
ArbiterX is a CLI tool that generates token-efficient codebase maps for AI-assisted development. It parses source code via AST analysis, extracts structural information (functions, classes, imports, dependencies), and compresses it into a compact representation that fits within LLM context windows. The tool supports incremental updates via content hashing and task-aware context prioritization.
|
|
6
|
+
|
|
7
|
+
## Tech Stack
|
|
8
|
+
|
|
9
|
+
- **Language:** Python 3.11+
|
|
10
|
+
- **CLI Framework:** Click
|
|
11
|
+
- **AST Parsing:** tree-sitter (multi-language), ast (Python stdlib fallback)
|
|
12
|
+
- **Hashing:** hashlib (SHA-256)
|
|
13
|
+
- **Configuration:** tomllib / tomli
|
|
14
|
+
- **AI Integration:** litellm (multi-provider)
|
|
15
|
+
- **Testing:** pytest, pytest-cov
|
|
16
|
+
- **Linting/Formatting:** ruff
|
|
17
|
+
- **Packaging:** hatchling / pyproject.toml
|
|
18
|
+
|
|
19
|
+
## Coding Conventions
|
|
20
|
+
|
|
21
|
+
- **Python version:** 3.11+ minimum. Use modern syntax (match statements, `type` aliases, ExceptionGroups where appropriate).
|
|
22
|
+
- **Type hints:** Required on all public functions and methods. Use `from __future__ import annotations` in every module.
|
|
23
|
+
- **Line length:** 100 characters max.
|
|
24
|
+
- **Formatter/Linter:** ruff (format + check). Configuration lives in `pyproject.toml`.
|
|
25
|
+
- **Imports:** Group as stdlib → third-party → local. Use absolute imports.
|
|
26
|
+
- **Docstrings:** Google style. Required on all public classes and functions.
|
|
27
|
+
- **Naming:** snake_case for functions/variables, PascalCase for classes, UPPER_SNAKE for constants.
|
|
28
|
+
- **Error handling:** Use custom exception classes in `src/arbiterx/exceptions.py`. Never catch bare `Exception` in library code.
|
|
29
|
+
- **No global mutable state.** Pass dependencies explicitly or use dependency injection.
|
|
30
|
+
|
|
31
|
+
## Project Structure
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
src/arbiterx/
|
|
35
|
+
├── __init__.py
|
|
36
|
+
├── cli.py # Click CLI entry points
|
|
37
|
+
├── mapper.py # Core map generation logic
|
|
38
|
+
├── hasher.py # File content hashing (SHA-256)
|
|
39
|
+
├── classifier.py # Task classification for relevance ranking
|
|
40
|
+
├── parser/ # Language-specific AST parsers
|
|
41
|
+
├── output/ # Formatters (markdown, json, prompt)
|
|
42
|
+
├── config.py # Configuration loading
|
|
43
|
+
├── exceptions.py # Custom exceptions
|
|
44
|
+
└── models.py # Data classes / types
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Testing Approach
|
|
48
|
+
|
|
49
|
+
- **Framework:** pytest
|
|
50
|
+
- **Structure:** `tests/unit/` for isolated logic, `tests/integration/` for CLI and end-to-end flows.
|
|
51
|
+
- **Naming:** Test files mirror source: `src/arbiterx/hasher.py` → `tests/unit/test_hasher.py`
|
|
52
|
+
- **Fixtures:** Use `conftest.py` for shared fixtures. Prefer `tmp_path` for filesystem tests.
|
|
53
|
+
- **Coverage:** Aim for 80%+ on core modules (mapper, hasher, classifier, parser).
|
|
54
|
+
- **Mocking:** Mock external I/O (filesystem, network, LLM calls). Never mock the unit under test.
|
|
55
|
+
- **Run tests:** `pytest` from project root. CI runs against Python 3.11 and 3.12.
|
|
56
|
+
|
|
57
|
+
## Key Decisions
|
|
58
|
+
|
|
59
|
+
- Maps are deterministic — same input always produces same output (for caching).
|
|
60
|
+
- The tool must work fully offline (no network calls during `map`).
|
|
61
|
+
- Token counting uses tiktoken with cl100k_base encoding.
|
|
62
|
+
- File hashing uses SHA-256 for cache invalidation.
|
|
63
|
+
- Configuration is optional — sensible defaults work out of the box.
|
|
64
|
+
|
|
65
|
+
## Common Tasks
|
|
66
|
+
|
|
67
|
+
- **Add a new language parser:** Create a module in `src/arbiterx/parser/`, implement the `Parser` protocol, register in `parser/__init__.py`.
|
|
68
|
+
- **Add a CLI command:** Add to `src/arbiterx/cli.py` using Click decorators.
|
|
69
|
+
- **Update output format:** Modify or add a formatter in `src/arbiterx/output/`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "arbiterx-marketplace",
|
|
3
|
+
"description": "ArbiterX — AI code quality middleware. Quality gate, smart routing, 97% token reduction.",
|
|
4
|
+
"owner": {
|
|
5
|
+
"name": "Neel Patel",
|
|
6
|
+
"url": "https://github.com/NeelPrime"
|
|
7
|
+
},
|
|
8
|
+
"plugins": [
|
|
9
|
+
{
|
|
10
|
+
"name": "arbiterx",
|
|
11
|
+
"source": ".",
|
|
12
|
+
"description": "Engineering discipline for AI code generation — enforces 10 rules for minimal, robust, unbreakable code. Includes quality gate, smart routing, and codebase mapping.",
|
|
13
|
+
"version": "0.1.0",
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "Neel Patel"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "arbiterx",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Engineering discipline for AI code generation — enforces 10 rules for minimal, robust, unbreakable code with quality gate scoring.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Neel Patel",
|
|
7
|
+
"url": "https://github.com/NeelPrime"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/NeelPrime/arbiterx",
|
|
10
|
+
"install": {
|
|
11
|
+
"command": "pip install arbiterx-gate",
|
|
12
|
+
"checkCommand": "arbiterx --version",
|
|
13
|
+
"instructions": "Requires Python 3.9+. Install with: pip install arbiterx-gate"
|
|
14
|
+
},
|
|
15
|
+
"setup": {
|
|
16
|
+
"command": "arbiterx init",
|
|
17
|
+
"description": "Initialize ArbiterX in the current project"
|
|
18
|
+
},
|
|
19
|
+
"skills": [
|
|
20
|
+
{
|
|
21
|
+
"name": "arbiterx",
|
|
22
|
+
"file": "skills/arbiterx.md",
|
|
23
|
+
"alwaysOn": true,
|
|
24
|
+
"description": "Engineering discipline rules — always active"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "arbiterx-review",
|
|
28
|
+
"file": "skills/arbiterx-review.md",
|
|
29
|
+
"description": "Review code against engineering rules"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "arbiterx-gate",
|
|
33
|
+
"file": "skills/arbiterx-gate.md",
|
|
34
|
+
"description": "Run quality gate on generated code"
|
|
35
|
+
}
|
|
36
|
+
],
|
|
37
|
+
"hooks": "hooks/hooks.json"
|
|
38
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "arbiterx",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Engineering discipline for AI code generation — 10 rules for minimal, robust code with quality gate scoring.",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Neel Patel",
|
|
7
|
+
"url": "https://github.com/NeelPrime"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/NeelPrime/arbiterx",
|
|
10
|
+
"install": {
|
|
11
|
+
"command": "pip install arbiterx-gate",
|
|
12
|
+
"checkCommand": "arbiterx --version"
|
|
13
|
+
},
|
|
14
|
+
"skills": [
|
|
15
|
+
{
|
|
16
|
+
"name": "arbiterx",
|
|
17
|
+
"file": "skills/arbiterx.md",
|
|
18
|
+
"alwaysOn": true,
|
|
19
|
+
"description": "Engineering discipline rules — always active"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "arbiterx-review",
|
|
23
|
+
"file": "skills/arbiterx-review.md",
|
|
24
|
+
"description": "Review code against engineering rules"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "arbiterx-gate",
|
|
28
|
+
"file": "skills/arbiterx-gate.md",
|
|
29
|
+
"description": "Run quality gate on generated code"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"hooks": "hooks/hooks.json"
|
|
33
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: ArbiterX engineering discipline — enforces minimal, robust, unbreakable code
|
|
3
|
+
globs: ["**/*.py", "**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.go", "**/*.rs", "**/*.java", "**/*.c", "**/*.cpp"]
|
|
4
|
+
alwaysApply: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# ArbiterX: Engineering Discipline
|
|
8
|
+
|
|
9
|
+
Before writing code, check: Does this need to exist? Can stdlib do it? Is it already in the codebase? Can it be one line? Only then write the minimum that works.
|
|
10
|
+
|
|
11
|
+
## ENFORCE on all generated code:
|
|
12
|
+
|
|
13
|
+
1. Type all function signatures (params + return values)
|
|
14
|
+
2. Handle every error — specific exceptions, never bare `except:`
|
|
15
|
+
3. Use context managers for resources (`with open(...)`)
|
|
16
|
+
4. Name all constants — no inline magic numbers
|
|
17
|
+
5. One function = one job, max 30 lines
|
|
18
|
+
6. Validate inputs at function entry
|
|
19
|
+
7. No dead code — no commented code, no unused imports
|
|
20
|
+
8. No TODO/FIXME — finish it or don't write it
|
|
21
|
+
9. Prefer immutable data structures
|
|
22
|
+
10. Every line must earn its place
|
|
23
|
+
|
|
24
|
+
## NEVER generate:
|
|
25
|
+
|
|
26
|
+
- Hardcoded API keys, passwords, or tokens
|
|
27
|
+
- SQL with string formatting (use parameterized queries)
|
|
28
|
+
- `eval()` or `exec()`
|
|
29
|
+
- `subprocess` with `shell=True`
|
|
30
|
+
- Network calls without timeouts
|
|
31
|
+
- File operations without error handling
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Cartograph - Environment Variables
|
|
2
|
+
# Copy this file to .env and fill in your API keys.
|
|
3
|
+
|
|
4
|
+
# Anthropic (Claude) - https://console.anthropic.com/
|
|
5
|
+
ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
6
|
+
|
|
7
|
+
# OpenAI (GPT-4o) - https://platform.openai.com/api-keys
|
|
8
|
+
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
9
|
+
|
|
10
|
+
# Google AI (Gemini) - https://aistudio.google.com/apikey
|
|
11
|
+
GOOGLE_AI_API_KEY=AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
12
|
+
|
|
13
|
+
# OpenRouter (multi-model gateway) - https://openrouter.ai/keys
|
|
14
|
+
OPENROUTER_API_KEY=sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Something isn't working
|
|
4
|
+
title: '[Bug] '
|
|
5
|
+
labels: bug
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Description
|
|
9
|
+
|
|
10
|
+
A clear and concise description of the bug.
|
|
11
|
+
|
|
12
|
+
## Steps to Reproduce
|
|
13
|
+
|
|
14
|
+
1.
|
|
15
|
+
2.
|
|
16
|
+
3.
|
|
17
|
+
|
|
18
|
+
## Expected Behavior
|
|
19
|
+
|
|
20
|
+
What you expected to happen.
|
|
21
|
+
|
|
22
|
+
## Actual Behavior
|
|
23
|
+
|
|
24
|
+
What actually happened.
|
|
25
|
+
|
|
26
|
+
## Environment
|
|
27
|
+
|
|
28
|
+
- **Python version**:
|
|
29
|
+
- **OS**:
|
|
30
|
+
- **arbiterx version**:
|
|
31
|
+
|
|
32
|
+
## Additional Context
|
|
33
|
+
|
|
34
|
+
Add any other context, logs, or screenshots about the problem here.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest a new feature
|
|
4
|
+
title: '[Feature] '
|
|
5
|
+
labels: enhancement
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Problem
|
|
9
|
+
|
|
10
|
+
A clear description of the problem or limitation you're experiencing.
|
|
11
|
+
|
|
12
|
+
## Proposed Solution
|
|
13
|
+
|
|
14
|
+
Describe the solution you'd like to see implemented.
|
|
15
|
+
|
|
16
|
+
## Alternatives Considered
|
|
17
|
+
|
|
18
|
+
Any alternative solutions or features you've considered.
|
|
19
|
+
|
|
20
|
+
## Additional Context
|
|
21
|
+
|
|
22
|
+
Add any other context, mockups, or references here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
A brief summary of the changes in this PR.
|
|
4
|
+
|
|
5
|
+
## Type of Change
|
|
6
|
+
|
|
7
|
+
- [ ] Bug fix (non-breaking change that fixes an issue)
|
|
8
|
+
- [ ] New feature (non-breaking change that adds functionality)
|
|
9
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
|
10
|
+
- [ ] Documentation update
|
|
11
|
+
|
|
12
|
+
## How Has This Been Tested?
|
|
13
|
+
|
|
14
|
+
Describe the tests you ran to verify your changes.
|
|
15
|
+
|
|
16
|
+
## Checklist
|
|
17
|
+
|
|
18
|
+
- [ ] All tests pass (`pytest`)
|
|
19
|
+
- [ ] Documentation has been updated (if applicable)
|
|
20
|
+
- [ ] No TODOs left in the code
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# These topics appear on the GitHub repo page and are indexed by search engines.
|
|
2
|
+
# Set them via: Settings → General → Topics
|
|
3
|
+
#
|
|
4
|
+
# Recommended topics for ArbiterX:
|
|
5
|
+
# ai-code-quality
|
|
6
|
+
# ai-coding-assistant
|
|
7
|
+
# ai-middleware
|
|
8
|
+
# claude-code-plugin
|
|
9
|
+
# code-quality
|
|
10
|
+
# codex-plugin
|
|
11
|
+
# cursor-rules
|
|
12
|
+
# developer-tools
|
|
13
|
+
# engineering-discipline
|
|
14
|
+
# llm
|
|
15
|
+
# llm-optimization
|
|
16
|
+
# model-routing
|
|
17
|
+
# prompt-engineering
|
|
18
|
+
# smart-routing
|
|
19
|
+
# token-reduction
|
|
20
|
+
# tree-sitter
|
|
21
|
+
# yagni
|
|
22
|
+
# code-review
|
|
23
|
+
# static-analysis
|
|
24
|
+
# agent-skills
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Engineering Rules (ArbiterX)
|
|
2
|
+
|
|
3
|
+
All generated code must follow these rules:
|
|
4
|
+
|
|
5
|
+
## Required
|
|
6
|
+
- Type hints on all function parameters and return values
|
|
7
|
+
- Error handling for all I/O operations (try/except or context managers)
|
|
8
|
+
- Named constants instead of magic numbers
|
|
9
|
+
- Input validation at function entry
|
|
10
|
+
- Context managers for files and connections (`with open(...)`)
|
|
11
|
+
- Functions under 30 lines
|
|
12
|
+
|
|
13
|
+
## Forbidden
|
|
14
|
+
- No hardcoded secrets or API keys
|
|
15
|
+
- No bare except clauses
|
|
16
|
+
- No string formatting in SQL queries (use parameterized)
|
|
17
|
+
- No eval() or exec()
|
|
18
|
+
- No TODO/FIXME comments — implement fully or skip
|
|
19
|
+
- No functions longer than 30 lines
|
|
20
|
+
- No unused imports or commented-out code
|
|
21
|
+
|
|
22
|
+
## Prefer
|
|
23
|
+
- Standard library over external dependencies
|
|
24
|
+
- Early returns over deep nesting
|
|
25
|
+
- Immutable data where possible
|
|
26
|
+
- Specific exceptions over generic ones
|
|
27
|
+
- `str.join()` over string concatenation in loops
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint-and-test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.11", "3.12"]
|
|
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 with ruff
|
|
30
|
+
run: ruff check .
|
|
31
|
+
|
|
32
|
+
- name: Check formatting with ruff
|
|
33
|
+
run: ruff format --check .
|
|
34
|
+
|
|
35
|
+
- name: Run tests
|
|
36
|
+
run: pytest --tb=short
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Deploy to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths:
|
|
7
|
+
- 'docs/site/**'
|
|
8
|
+
- '.github/workflows/pages.yml'
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
pages: write
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
concurrency:
|
|
17
|
+
group: "pages"
|
|
18
|
+
cancel-in-progress: false
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
deploy:
|
|
22
|
+
environment:
|
|
23
|
+
name: github-pages
|
|
24
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Setup Pages
|
|
31
|
+
uses: actions/configure-pages@v5
|
|
32
|
+
|
|
33
|
+
- name: Upload artifact
|
|
34
|
+
uses: actions/upload-pages-artifact@v3
|
|
35
|
+
with:
|
|
36
|
+
path: 'docs/site'
|
|
37
|
+
|
|
38
|
+
- name: Deploy to GitHub Pages
|
|
39
|
+
id: deployment
|
|
40
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
id-token: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
name: Build and publish to PyPI
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
environment:
|
|
17
|
+
name: pypi
|
|
18
|
+
url: https://pypi.org/project/arbiterx-gate/
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Set up Python
|
|
24
|
+
uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: "3.12"
|
|
27
|
+
|
|
28
|
+
- name: Install build tools
|
|
29
|
+
run: pip install build
|
|
30
|
+
|
|
31
|
+
- name: Build package
|
|
32
|
+
run: python -m build
|
|
33
|
+
|
|
34
|
+
- name: Publish to PyPI
|
|
35
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Python bytecode
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.pyc
|
|
6
|
+
|
|
7
|
+
# Virtual environments
|
|
8
|
+
.venv/
|
|
9
|
+
venv/
|
|
10
|
+
ENV/
|
|
11
|
+
|
|
12
|
+
# Distribution / packaging
|
|
13
|
+
dist/
|
|
14
|
+
build/
|
|
15
|
+
*.egg-info/
|
|
16
|
+
*.egg
|
|
17
|
+
|
|
18
|
+
# ArbiterX map store
|
|
19
|
+
.arbiterx/
|
|
20
|
+
|
|
21
|
+
# Embeddings binary
|
|
22
|
+
embeddings.bin
|
|
23
|
+
|
|
24
|
+
# Environment variables
|
|
25
|
+
.env
|
|
26
|
+
|
|
27
|
+
# Type checking
|
|
28
|
+
.mypy_cache/
|
|
29
|
+
|
|
30
|
+
# Testing
|
|
31
|
+
.pytest_cache/
|
|
32
|
+
htmlcov/
|
|
33
|
+
.coverage
|
|
34
|
+
coverage.xml
|
|
35
|
+
|
|
36
|
+
# Linting
|
|
37
|
+
.ruff_cache/
|
|
38
|
+
|
|
39
|
+
# IDE
|
|
40
|
+
.vscode/
|
|
41
|
+
.idea/
|
|
42
|
+
*.swp
|
|
43
|
+
*.swo
|
|
44
|
+
*~
|
|
45
|
+
|
|
46
|
+
# OS
|
|
47
|
+
.DS_Store
|
|
48
|
+
Thumbs.db
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# ArbiterX: Engineering Discipline
|
|
2
|
+
|
|
3
|
+
Enforce these principles on all generated code:
|
|
4
|
+
|
|
5
|
+
1. Use stdlib before dependencies. Does it need to exist? YAGNI.
|
|
6
|
+
2. Type all function signatures — parameters and return values.
|
|
7
|
+
3. Handle every error path. No bare `except:`. Catch specific exceptions.
|
|
8
|
+
4. Close every resource. Use `with open(...)`, never bare open().
|
|
9
|
+
5. Name constants. No magic numbers inline.
|
|
10
|
+
6. One function = one responsibility. Max 30 lines.
|
|
11
|
+
7. Validate inputs at function entry, not buried in logic.
|
|
12
|
+
8. No dead code. No commented-out code. No unused imports.
|
|
13
|
+
9. Never leave TODO/FIXME. Implement fully or skip entirely.
|
|
14
|
+
10. Delete any line that doesn't change behavior.
|
|
15
|
+
|
|
16
|
+
Never generate: hardcoded secrets, SQL with string formatting, eval/exec, subprocess shell=True, network calls without timeouts.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ArbiterX",
|
|
3
|
+
"description": "AI code quality middleware — 97% token reduction, smart model routing, quality gate scoring 0-100.",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"author": "Neel Patel",
|
|
6
|
+
"homepage": "https://github.com/NeelPrime/arbiterx",
|
|
7
|
+
"install": "pip install arbiterx-gate",
|
|
8
|
+
"capabilities": [
|
|
9
|
+
"code-quality-gate",
|
|
10
|
+
"codebase-mapping",
|
|
11
|
+
"smart-model-routing",
|
|
12
|
+
"engineering-rule-enforcement"
|
|
13
|
+
],
|
|
14
|
+
"supported_tools": [
|
|
15
|
+
"claude-code",
|
|
16
|
+
"codex-cli",
|
|
17
|
+
"cursor",
|
|
18
|
+
"github-copilot",
|
|
19
|
+
"aider",
|
|
20
|
+
"windsurf",
|
|
21
|
+
"kiro",
|
|
22
|
+
"zed",
|
|
23
|
+
"chatgpt"
|
|
24
|
+
],
|
|
25
|
+
"rules_file": "AGENTS.md",
|
|
26
|
+
"llms_txt": "llms.txt"
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "v1",
|
|
3
|
+
"name_for_human": "ArbiterX",
|
|
4
|
+
"name_for_model": "arbiterx",
|
|
5
|
+
"description_for_human": "AI code quality middleware. 97% token reduction, smart model routing, quality gate scoring 0-100. Works with Claude Code, Codex, Cursor, Copilot, Aider.",
|
|
6
|
+
"description_for_model": "ArbiterX enforces engineering discipline on AI-generated code. It provides: (1) Codebase mapping that reduces context tokens by 97% using tree-sitter and PageRank, (2) Smart model routing that classifies task complexity and routes to optimal LLM, (3) Quality gate that scores code 0-100 checking security, robustness, efficiency, types, style, completeness. Install: pip install arbiterx-gate. Initialize: arbiterx init. Map: arbiterx map. Gate: arbiterx gate --file <file>.",
|
|
7
|
+
"auth": {
|
|
8
|
+
"type": "none"
|
|
9
|
+
},
|
|
10
|
+
"api": {
|
|
11
|
+
"type": "cli",
|
|
12
|
+
"install": "pip install arbiterx-gate"
|
|
13
|
+
},
|
|
14
|
+
"logo_url": "https://raw.githubusercontent.com/NeelPrime/arbiterx/main/assets/arbiterx-logo.svg",
|
|
15
|
+
"contact_email": "",
|
|
16
|
+
"legal_info_url": "https://github.com/NeelPrime/arbiterx/blob/main/LICENSE"
|
|
17
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# ArbiterX: Engineering Discipline
|
|
2
|
+
|
|
3
|
+
Before writing ANY code, follow this ladder:
|
|
4
|
+
1. Does this need to exist? → If no, skip (YAGNI)
|
|
5
|
+
2. Already in codebase? → Reuse, don't rewrite
|
|
6
|
+
3. Stdlib does it? → Use stdlib
|
|
7
|
+
4. One line? → Write one line, no abstraction
|
|
8
|
+
|
|
9
|
+
## When Writing Code — ENFORCE:
|
|
10
|
+
|
|
11
|
+
1. Type all function signatures — parameters and return values
|
|
12
|
+
2. Handle every error — no bare `except:`, catch specific exceptions
|
|
13
|
+
3. Close every resource — use `with open(...)`, never bare open()
|
|
14
|
+
4. Name all constants — no magic numbers inline
|
|
15
|
+
5. One function = one job — max 30 lines
|
|
16
|
+
6. Validate inputs at function entry, not deep in logic
|
|
17
|
+
7. No dead code — no commented-out code, no unused imports
|
|
18
|
+
8. Never leave TODO/FIXME — implement fully or skip entirely
|
|
19
|
+
9. Prefer immutable — frozen dataclasses, tuples
|
|
20
|
+
10. Delete any line that doesn't change behavior
|
|
21
|
+
|
|
22
|
+
## NEVER Generate:
|
|
23
|
+
|
|
24
|
+
- Hardcoded secrets (API keys, passwords, tokens)
|
|
25
|
+
- SQL with string formatting (use parameterized queries)
|
|
26
|
+
- eval() or exec()
|
|
27
|
+
- subprocess with shell=True
|
|
28
|
+
- Network calls without timeouts
|
|
29
|
+
- File operations without error handling
|
|
30
|
+
|
|
31
|
+
## After Writing:
|
|
32
|
+
|
|
33
|
+
- Can any line be deleted without breaking behavior? → Delete it
|
|
34
|
+
- Is there a simpler stdlib approach? → Use it
|
|
35
|
+
- Would this pass a senior engineer's review? → If not, fix it
|
|
36
|
+
|
|
37
|
+
## Install ArbiterX for active quality gate:
|
|
38
|
+
```
|
|
39
|
+
pip install arbiterx-gate
|
|
40
|
+
arbiterx init
|
|
41
|
+
arbiterx gate --file <your_file>
|
|
42
|
+
```
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ArbiterX: Engineering Discipline
|
|
2
|
+
|
|
3
|
+
Before writing ANY code, follow this ladder:
|
|
4
|
+
1. Does this need to exist? → If no, skip (YAGNI)
|
|
5
|
+
2. Already in codebase? → Reuse, don't rewrite
|
|
6
|
+
3. Stdlib does it? → Use stdlib
|
|
7
|
+
4. One line? → Write one line, no abstraction
|
|
8
|
+
|
|
9
|
+
## When Writing Code — ENFORCE:
|
|
10
|
+
|
|
11
|
+
1. Type all function signatures — parameters and return values
|
|
12
|
+
2. Handle every error — no bare `except:`, catch specific exceptions
|
|
13
|
+
3. Close every resource — use `with open(...)`, never bare open()
|
|
14
|
+
4. Name all constants — no magic numbers inline
|
|
15
|
+
5. One function = one job — max 30 lines
|
|
16
|
+
6. Validate inputs at function entry, not deep in logic
|
|
17
|
+
7. No dead code — no commented-out code, no unused imports
|
|
18
|
+
8. Never leave TODO/FIXME — implement fully or skip entirely
|
|
19
|
+
9. Prefer immutable — frozen dataclasses, tuples
|
|
20
|
+
10. Delete any line that doesn't change behavior
|
|
21
|
+
|
|
22
|
+
## NEVER Generate:
|
|
23
|
+
|
|
24
|
+
- Hardcoded secrets (API keys, passwords, tokens)
|
|
25
|
+
- SQL with string formatting (use parameterized queries)
|
|
26
|
+
- eval() or exec()
|
|
27
|
+
- subprocess with shell=True
|
|
28
|
+
- Network calls without timeouts
|
|
29
|
+
- File operations without error handling
|
|
30
|
+
|
|
31
|
+
## Install ArbiterX for active quality gate:
|
|
32
|
+
```
|
|
33
|
+
pip install arbiterx-gate && arbiterx init
|
|
34
|
+
```
|