sentrux 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.
- sentrux-0.1.0/.claude-plugin/marketplace.json +23 -0
- sentrux-0.1.0/.github/workflows/ci.yml +48 -0
- sentrux-0.1.0/.github/workflows/publish.yml +25 -0
- sentrux-0.1.0/.gitignore +41 -0
- sentrux-0.1.0/.sentrux/baseline.toml +8 -0
- sentrux-0.1.0/.sentrux/rules.toml +50 -0
- sentrux-0.1.0/LICENSE +21 -0
- sentrux-0.1.0/PKG-INFO +252 -0
- sentrux-0.1.0/README.de.md +287 -0
- sentrux-0.1.0/README.ja.md +287 -0
- sentrux-0.1.0/README.md +232 -0
- sentrux-0.1.0/README.zh-CN.md +287 -0
- sentrux-0.1.0/assets/demo.gif +0 -0
- sentrux-0.1.0/assets/demo.mp4 +0 -0
- sentrux-0.1.0/assets/how-it-works.svg +64 -0
- sentrux-0.1.0/assets/logo-dark.svg +50 -0
- sentrux-0.1.0/assets/logo-exploration-v2.html +812 -0
- sentrux-0.1.0/assets/logo-exploration.html +900 -0
- sentrux-0.1.0/assets/logo-light.svg +50 -0
- sentrux-0.1.0/assets/logo.svg +45 -0
- sentrux-0.1.0/assets/screenshot-architecture.png +0 -0
- sentrux-0.1.0/assets/screenshot-coverage.png +0 -0
- sentrux-0.1.0/assets/screenshot-health.gif +0 -0
- sentrux-0.1.0/assets/screenshot-health.png +0 -0
- sentrux-0.1.0/assets/screenshot.png +0 -0
- sentrux-0.1.0/claude-plugin/.claude-plugin/plugin.json +24 -0
- sentrux-0.1.0/claude-plugin/.mcp.json +8 -0
- sentrux-0.1.0/claude-plugin/skills/scan/SKILL.md +16 -0
- sentrux-0.1.0/docs/ascii-art-logos.html +286 -0
- sentrux-0.1.0/docs/ascii-logos.html +264 -0
- sentrux-0.1.0/docs/block-logos.html +243 -0
- sentrux-0.1.0/docs/event-colors.html +218 -0
- sentrux-0.1.0/docs/icon-prototypes.html +571 -0
- sentrux-0.1.0/docs/logo-prototypes.html +328 -0
- sentrux-0.1.0/docs/pro-architecture.md +244 -0
- sentrux-0.1.0/docs/quality-signal-design.md +289 -0
- sentrux-0.1.0/docs/sensor-icons.html +308 -0
- sentrux-0.1.0/docs/sentrux-logos.html +301 -0
- sentrux-0.1.0/docs/sentrux-sensor-final.html +240 -0
- sentrux-0.1.0/pyproject.toml +39 -0
- sentrux-0.1.0/sentrux/__init__.py +8 -0
- sentrux-0.1.0/sentrux/__main__.py +24 -0
- sentrux-0.1.0/sentrux/cli/__init__.py +0 -0
- sentrux-0.1.0/sentrux/cli/main.py +161 -0
- sentrux-0.1.0/sentrux/core/__init__.py +0 -0
- sentrux-0.1.0/sentrux/core/analyzer.py +52 -0
- sentrux-0.1.0/sentrux/core/metrics.py +217 -0
- sentrux-0.1.0/sentrux/core/parser.py +145 -0
- sentrux-0.1.0/sentrux/core/rules.py +103 -0
- sentrux-0.1.0/sentrux/mcp/__init__.py +0 -0
- sentrux-0.1.0/sentrux/mcp/server.py +150 -0
- sentrux-0.1.0/sentrux/mcp/tools.py +162 -0
- sentrux-0.1.0/sentrux/models/__init__.py +0 -0
- sentrux-0.1.0/sentrux/models/analysis.py +69 -0
- sentrux-0.1.0/sentrux/models/rules.py +53 -0
- sentrux-0.1.0/sentrux/utils/__init__.py +0 -0
- sentrux-0.1.0/sentrux/utils/config.py +148 -0
- sentrux-0.1.0/tests/__init__.py +0 -0
- sentrux-0.1.0/tests/test_analyzer.py +65 -0
- sentrux-0.1.0/tests/test_parser.py +79 -0
- sentrux-0.1.0/uv.lock +712 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
|
|
3
|
+
"name": "sentrux-marketplace",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Sentrux — live codebase visualization and structural quality gate for AI-agent-written code",
|
|
6
|
+
"owner": {
|
|
7
|
+
"name": "yjing",
|
|
8
|
+
"email": "yjing@sentrux.dev"
|
|
9
|
+
},
|
|
10
|
+
"plugins": [
|
|
11
|
+
{
|
|
12
|
+
"name": "sentrux",
|
|
13
|
+
"description": "MCP server for structural health analysis — 14 dimensions graded A-F, dependency cycles, coupling, dead code, test coverage, and quality gates",
|
|
14
|
+
"version": "0.3.12",
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "yjing",
|
|
17
|
+
"email": "yjing@sentrux.dev"
|
|
18
|
+
},
|
|
19
|
+
"source": "./claude-plugin",
|
|
20
|
+
"category": "development"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
strategy:
|
|
12
|
+
fail-fast: false
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ['3.9', '3.10', '3.11', '3.12']
|
|
15
|
+
os: [ubuntu-latest, macos-latest]
|
|
16
|
+
runs-on: ${{ matrix.os }}
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
22
|
+
uses: actions/setup-python@v4
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
|
|
26
|
+
- name: Install uv
|
|
27
|
+
uses: astral-sh/setup-uv@v2
|
|
28
|
+
|
|
29
|
+
- name: Install dependencies
|
|
30
|
+
run: |
|
|
31
|
+
uv sync --all-extras
|
|
32
|
+
|
|
33
|
+
- name: Lint with ruff
|
|
34
|
+
run: |
|
|
35
|
+
uv run ruff check sentrux tests
|
|
36
|
+
|
|
37
|
+
- name: Format check with black
|
|
38
|
+
run: |
|
|
39
|
+
uv run black --check sentrux tests
|
|
40
|
+
|
|
41
|
+
- name: Run tests
|
|
42
|
+
run: |
|
|
43
|
+
uv run pytest tests/ -v --cov=sentrux
|
|
44
|
+
|
|
45
|
+
- name: Test CLI
|
|
46
|
+
run: |
|
|
47
|
+
uv run sentrux scan .
|
|
48
|
+
uv run sentrux check .
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
deploy:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
environment:
|
|
11
|
+
name: release
|
|
12
|
+
url: https://pypi.org/p/${{ github.event.repository.name }}
|
|
13
|
+
permissions:
|
|
14
|
+
id-token: write
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- uses: astral-sh/setup-uv@v2
|
|
20
|
+
|
|
21
|
+
- name: Build
|
|
22
|
+
run: uv build
|
|
23
|
+
|
|
24
|
+
- name: Publish to PyPI
|
|
25
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
sentrux-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Build
|
|
2
|
+
target/
|
|
3
|
+
build/
|
|
4
|
+
dist/
|
|
5
|
+
*.egg-info/
|
|
6
|
+
|
|
7
|
+
# Python
|
|
8
|
+
__pycache__/
|
|
9
|
+
*.py[cod]
|
|
10
|
+
*$py.class
|
|
11
|
+
.Python
|
|
12
|
+
env/
|
|
13
|
+
venv/
|
|
14
|
+
ENV/
|
|
15
|
+
.venv
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.coverage
|
|
18
|
+
htmlcov/
|
|
19
|
+
|
|
20
|
+
# OS
|
|
21
|
+
.DS_Store
|
|
22
|
+
|
|
23
|
+
# Local config
|
|
24
|
+
.mcp.json
|
|
25
|
+
!claude-plugin/.mcp.json
|
|
26
|
+
|
|
27
|
+
# Runtime data
|
|
28
|
+
.sentrux/baseline.json
|
|
29
|
+
*.key
|
|
30
|
+
|
|
31
|
+
# IDE
|
|
32
|
+
.idea/
|
|
33
|
+
.vscode/
|
|
34
|
+
*.swp
|
|
35
|
+
*.swo
|
|
36
|
+
|
|
37
|
+
# Local tools
|
|
38
|
+
.beemem*/
|
|
39
|
+
.claude/
|
|
40
|
+
.wrangler/
|
|
41
|
+
sentrux-core/src/analysis/plugin/embedded.rs
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Sentrux Architectural Rules
|
|
2
|
+
# These constraints are checked by `sentrux check` and the `check_rules` MCP tool.
|
|
3
|
+
|
|
4
|
+
[constraints]
|
|
5
|
+
max_cycles = 0 # No circular dependencies allowed
|
|
6
|
+
max_cc = 25 # Max cyclomatic complexity per function
|
|
7
|
+
max_fn_lines = 100 # Max function length
|
|
8
|
+
no_god_files = false # Allow god files for now
|
|
9
|
+
|
|
10
|
+
# Layer definitions: higher order depends on lower order only.
|
|
11
|
+
[[layers]]
|
|
12
|
+
name = "core"
|
|
13
|
+
paths = ["src/core/*"]
|
|
14
|
+
order = 0
|
|
15
|
+
|
|
16
|
+
[[layers]]
|
|
17
|
+
name = "analysis"
|
|
18
|
+
paths = ["src/analysis/*"]
|
|
19
|
+
order = 1
|
|
20
|
+
|
|
21
|
+
[[layers]]
|
|
22
|
+
name = "metrics"
|
|
23
|
+
paths = ["src/metrics/*"]
|
|
24
|
+
order = 2
|
|
25
|
+
|
|
26
|
+
[[layers]]
|
|
27
|
+
name = "layout"
|
|
28
|
+
paths = ["src/layout/*"]
|
|
29
|
+
order = 3
|
|
30
|
+
|
|
31
|
+
[[layers]]
|
|
32
|
+
name = "renderer"
|
|
33
|
+
paths = ["src/renderer/*"]
|
|
34
|
+
order = 4
|
|
35
|
+
|
|
36
|
+
[[layers]]
|
|
37
|
+
name = "app"
|
|
38
|
+
paths = ["src/app/*"]
|
|
39
|
+
order = 5
|
|
40
|
+
|
|
41
|
+
# Boundary rules: forbidden cross-layer shortcuts
|
|
42
|
+
[[boundaries]]
|
|
43
|
+
from = "src/renderer/*"
|
|
44
|
+
to = "src/analysis/*"
|
|
45
|
+
reason = "Renderer must not depend on analysis directly"
|
|
46
|
+
|
|
47
|
+
[[boundaries]]
|
|
48
|
+
from = "src/layout/*"
|
|
49
|
+
to = "src/app/*"
|
|
50
|
+
reason = "Layout must not depend on app layer"
|
sentrux-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sentrux
|
|
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.
|
sentrux-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sentrux
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Structural quality analysis and governance tool for AI-assisted code development
|
|
5
|
+
Author: Sentrux Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.9
|
|
9
|
+
Requires-Dist: click>=8.1.0
|
|
10
|
+
Requires-Dist: tomli>=2.0.0; python_version < '3.11'
|
|
11
|
+
Provides-Extra: dev
|
|
12
|
+
Requires-Dist: black>=23.0; extra == 'dev'
|
|
13
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
14
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
15
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
16
|
+
Provides-Extra: test
|
|
17
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'test'
|
|
18
|
+
Requires-Dist: pytest>=7.0; extra == 'test'
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
<div align="center">
|
|
22
|
+
|
|
23
|
+
<picture>
|
|
24
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg?v=2">
|
|
25
|
+
<source media="(prefers-color-scheme: light)" srcset="assets/logo-light.svg?v=2">
|
|
26
|
+
<img alt="sentrux" src="assets/logo-dark.svg?v=2" width="500">
|
|
27
|
+
</picture>
|
|
28
|
+
|
|
29
|
+
<br>
|
|
30
|
+
|
|
31
|
+
**The sensor that helps AI agents close the feedback loop.**<br>Structural quality analysis for Python code.
|
|
32
|
+
|
|
33
|
+
[](https://github.com/sentrux/sentrux/actions/workflows/ci.yml)
|
|
34
|
+
[](LICENSE)
|
|
35
|
+
|
|
36
|
+
**English** | [中文](README.zh-CN.md) | [Deutsch](README.de.md) | [日本語](README.ja.md)
|
|
37
|
+
|
|
38
|
+
[How it Works](#how-it-works) · [Quick Start](#quick-start) · [MCP Integration](#mcp-server) · [Rules Engine](#rules-engine)
|
|
39
|
+
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
## How it works
|
|
43
|
+
|
|
44
|
+
AI agents write code at machine speed. But without visibility into architectural health, codebases degrade just as fast.
|
|
45
|
+
|
|
46
|
+
sentrux measures structural quality in real-time:
|
|
47
|
+
|
|
48
|
+
- **5 root cause metrics** (modularity, acyclicity, depth, equality, redundancy)
|
|
49
|
+
- **One continuous score** (0–10000)
|
|
50
|
+
- **Architectural rules engine** (CI-friendly constraints)
|
|
51
|
+
- **MCP integration** (real-time feedback for Claude, Cursor, etc.)
|
|
52
|
+
|
|
53
|
+
When your agent writes code, you see immediately whether quality improved or degraded.
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
**Install** (Python 3.9+)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Using uv (recommended)
|
|
61
|
+
uv pip install sentrux
|
|
62
|
+
|
|
63
|
+
# Or using pip
|
|
64
|
+
pip install sentrux
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Run it**
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
sentrux scan . # Analyze current project and show quality score
|
|
71
|
+
sentrux check . # Check if project meets architectural rules
|
|
72
|
+
sentrux gate --save . # Save baseline before starting an AI session
|
|
73
|
+
sentrux gate . # Compare after — catches quality degradation
|
|
74
|
+
sentrux --mcp # Start MCP server for AI agent integration
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Connect to your AI agent** (optional)
|
|
78
|
+
|
|
79
|
+
Claude Code:
|
|
80
|
+
```
|
|
81
|
+
/plugin marketplace add sentrux/sentrux
|
|
82
|
+
/plugin install sentrux
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Cursor / Windsurf / any MCP client — add to your MCP config:
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"mcpServers": {
|
|
89
|
+
"sentrux": {
|
|
90
|
+
"command": "sentrux",
|
|
91
|
+
"args": ["--mcp"]
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**From source**
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
git clone https://github.com/sentrux/sentrux.git
|
|
101
|
+
cd sentrux
|
|
102
|
+
|
|
103
|
+
# Using uv (recommended)
|
|
104
|
+
uv sync
|
|
105
|
+
|
|
106
|
+
# Or using pip
|
|
107
|
+
pip install -e .
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## The Problem
|
|
111
|
+
|
|
112
|
+
You start a project with Claude Code or Cursor. Day one is magic. The agent writes clean code, understands your intent, ships features fast.
|
|
113
|
+
|
|
114
|
+
Then something shifts.
|
|
115
|
+
|
|
116
|
+
The agent starts hallucinating functions that don't exist. It puts new code in the wrong place. It introduces bugs in files it touched yesterday. You're spending more time fixing the agent's output than writing it yourself.
|
|
117
|
+
|
|
118
|
+
Everyone assumes the AI got worse. **It didn't.** Your codebase did.
|
|
119
|
+
|
|
120
|
+
Here's what happened: you lost visibility into architecture. The agent modifies dozens of files per session. You see `Modified src/foo.py` in the terminal, but you've lost spatial awareness. You don't see the dependency graph. You don't see that it just created a cycle. You don't see that three modules now depend on a file that was supposed to be internal.
|
|
121
|
+
|
|
122
|
+
**Every AI session silently degrades your architecture.**
|
|
123
|
+
|
|
124
|
+
Same function names, different purposes, scattered across files. Unrelated code dumped in the same folder. Dependencies tangling into spaghetti. When the agent searches your project, it finds twenty conflicting matches — and picks the wrong one. Every session makes the mess worse.
|
|
125
|
+
|
|
126
|
+
**The traditional answer doesn't work.** Tools like GitHub Spec Kit try to plan architecture first, then let AI implement. But there's zero visibility into whether the implementation actually matches the spec. No feedback loop.
|
|
127
|
+
|
|
128
|
+
**You don't need a better plan. You need a better sensor.**
|
|
129
|
+
|
|
130
|
+
## The Solution
|
|
131
|
+
|
|
132
|
+
sentrux is the missing feedback loop for AI-assisted development.
|
|
133
|
+
|
|
134
|
+
It watches your Python codebase in real-time — every file, every dependency, every architectural relationship. Computed in milliseconds.
|
|
135
|
+
|
|
136
|
+
**5 root cause metrics, one continuous score.**
|
|
137
|
+
|
|
138
|
+
- **Modularity**: Are dependencies contained or scattered?
|
|
139
|
+
- **Acyclicity**: Are there circular dependencies?
|
|
140
|
+
- **Depth**: How deep is the import structure?
|
|
141
|
+
- **Equality**: Is complexity evenly distributed or concentrated?
|
|
142
|
+
- **Redundancy**: How much code is duplicated?
|
|
143
|
+
|
|
144
|
+
When architecture degrades, you see it immediately — not two weeks later when everything is broken.
|
|
145
|
+
|
|
146
|
+
sentrux gives you the sensor. Your rules give you the spec. The agent is the actuator. **The loop closes.**
|
|
147
|
+
|
|
148
|
+
## MCP Server
|
|
149
|
+
|
|
150
|
+
Connect sentrux to any AI agent via Model Context Protocol.
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
Agent: scan("/Users/me/myproject")
|
|
154
|
+
→ { overall_score: 7342, file_count: 139, modularity: 0.73, acyclicity: 0.92 }
|
|
155
|
+
|
|
156
|
+
Agent: session_start()
|
|
157
|
+
→ { status: "Baseline saved", score: 7342 }
|
|
158
|
+
|
|
159
|
+
... agent writes code ...
|
|
160
|
+
|
|
161
|
+
Agent: health()
|
|
162
|
+
→ { overall_score: 6891, modularity: 0.58, acyclicity: 0.85 }
|
|
163
|
+
→ Quality degraded during this session
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Available MCP tools:**
|
|
167
|
+
|
|
168
|
+
- `scan` – Analyze workspace and get quality metrics
|
|
169
|
+
- `health` – Get current project quality score
|
|
170
|
+
- `check_rules` – Verify architectural rules compliance
|
|
171
|
+
- `session_start` – Initialize a session and save baseline
|
|
172
|
+
- `session_end` – End session and compare results
|
|
173
|
+
- `evolution` – Track quality over time
|
|
174
|
+
- `test_gaps` – Identify untested modules
|
|
175
|
+
|
|
176
|
+
## Rules Engine
|
|
177
|
+
|
|
178
|
+
Define architectural constraints. Enforce them in CI. Let the agent know the boundaries.
|
|
179
|
+
|
|
180
|
+
**Example `.sentrux/rules.toml`**
|
|
181
|
+
|
|
182
|
+
```toml
|
|
183
|
+
[constraints]
|
|
184
|
+
max_cycles = 0 # No circular dependencies allowed
|
|
185
|
+
max_cc = 25 # Max cyclomatic complexity per function
|
|
186
|
+
max_fn_lines = 100 # Max function length
|
|
187
|
+
|
|
188
|
+
[[layers]]
|
|
189
|
+
name = "core"
|
|
190
|
+
paths = ["src/core/*"]
|
|
191
|
+
order = 0
|
|
192
|
+
|
|
193
|
+
[[layers]]
|
|
194
|
+
name = "analysis"
|
|
195
|
+
paths = ["src/analysis/*"]
|
|
196
|
+
order = 1
|
|
197
|
+
|
|
198
|
+
[[layers]]
|
|
199
|
+
name = "app"
|
|
200
|
+
paths = ["src/app/*"]
|
|
201
|
+
order = 2
|
|
202
|
+
|
|
203
|
+
[[boundaries]]
|
|
204
|
+
from = "src/app/*"
|
|
205
|
+
to = "src/core/internal/*"
|
|
206
|
+
reason = "App must not depend on core internals"
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
sentrux check .
|
|
211
|
+
# ❌ Violations found:
|
|
212
|
+
# - src/app/main.py: Cyclomatic complexity 28.0 exceeds max 25
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Or in CI:
|
|
216
|
+
```bash
|
|
217
|
+
sentrux check . && echo "Architecture check passed"
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Supported Languages
|
|
221
|
+
|
|
222
|
+
Python 3.9+. Analyzes Python projects using the Python `ast` module.
|
|
223
|
+
|
|
224
|
+
Can be extended to support additional languages using tree-sitter Python bindings.
|
|
225
|
+
|
|
226
|
+
## Philosophy
|
|
227
|
+
|
|
228
|
+
The human role is changing — from writing code to governing code.
|
|
229
|
+
|
|
230
|
+
sentrux is built on three beliefs:
|
|
231
|
+
|
|
232
|
+
**1. Human-in-the-loop is non-negotiable.** AI agents are powerful but limited. They cannot hold the big picture and small details at once. A human must see what the agent is doing to the whole — not just which file it touched, but what that means to architecture.
|
|
233
|
+
|
|
234
|
+
**2. Verification is more valuable than generation.** Generating a correct solution is harder than verifying one. You don't need to out-code the machine. You need to out-evaluate it — specify what "correct" looks like, recognize when the output misses, judge whether the direction is right.
|
|
235
|
+
|
|
236
|
+
**3. Good systems make good outcomes inevitable.** A well-designed system constrains behavior so that the right thing is the easy thing. A quality gate that blocks degradation. A rules engine that encodes architectural decisions. A sensor that makes structural rot impossible to ignore.
|
|
237
|
+
|
|
238
|
+
Once you have a feedback loop that works, you don't go back to doing it by hand.
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
<div align="center">
|
|
243
|
+
|
|
244
|
+
<sub>AI agents write code at machine speed. Without structural governance, codebases decay at machine speed too.<br><b>sentrux is the governor.</b></sub>
|
|
245
|
+
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<div align="center">
|
|
249
|
+
|
|
250
|
+
[MIT License](LICENSE)
|
|
251
|
+
|
|
252
|
+
</div>
|