sober-audit 2.0.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.
- sober_audit-2.0.0/LICENSE +21 -0
- sober_audit-2.0.0/PKG-INFO +450 -0
- sober_audit-2.0.0/README.md +415 -0
- sober_audit-2.0.0/pyproject.toml +66 -0
- sober_audit-2.0.0/setup.cfg +4 -0
- sober_audit-2.0.0/src/sober/__init__.py +7 -0
- sober_audit-2.0.0/src/sober/cli.py +491 -0
- sober_audit-2.0.0/src/sober/core/__init__.py +1 -0
- sober_audit-2.0.0/src/sober/core/ci.py +61 -0
- sober_audit-2.0.0/src/sober/core/config.py +89 -0
- sober_audit-2.0.0/src/sober/core/git_helper.py +174 -0
- sober_audit-2.0.0/src/sober/core/manifest.py +107 -0
- sober_audit-2.0.0/src/sober/core/registry_cache.py +82 -0
- sober_audit-2.0.0/src/sober/core/remediation.py +61 -0
- sober_audit-2.0.0/src/sober/core/sanitizer.py +78 -0
- sober_audit-2.0.0/src/sober/core/scanner.py +146 -0
- sober_audit-2.0.0/src/sober/core/scorer.py +176 -0
- sober_audit-2.0.0/src/sober/core/watcher.py +59 -0
- sober_audit-2.0.0/src/sober/detectors/__init__.py +47 -0
- sober_audit-2.0.0/src/sober/detectors/antipatterns.py +217 -0
- sober_audit-2.0.0/src/sober/detectors/chatter.py +54 -0
- sober_audit-2.0.0/src/sober/detectors/duplicates.py +88 -0
- sober_audit-2.0.0/src/sober/detectors/ghost_code.py +201 -0
- sober_audit-2.0.0/src/sober/detectors/hallucinations.py +550 -0
- sober_audit-2.0.0/src/sober/detectors/security.py +118 -0
- sober_audit-2.0.0/src/sober/detectors/slopsquatting.py +83 -0
- sober_audit-2.0.0/src/sober/ui/__init__.py +1 -0
- sober_audit-2.0.0/src/sober/ui/console.py +146 -0
- sober_audit-2.0.0/src/sober_audit.egg-info/PKG-INFO +450 -0
- sober_audit-2.0.0/src/sober_audit.egg-info/SOURCES.txt +52 -0
- sober_audit-2.0.0/src/sober_audit.egg-info/dependency_links.txt +1 -0
- sober_audit-2.0.0/src/sober_audit.egg-info/entry_points.txt +2 -0
- sober_audit-2.0.0/src/sober_audit.egg-info/requires.txt +7 -0
- sober_audit-2.0.0/src/sober_audit.egg-info/top_level.txt +1 -0
- sober_audit-2.0.0/tests/test_antipatterns.py +90 -0
- sober_audit-2.0.0/tests/test_chatter.py +36 -0
- sober_audit-2.0.0/tests/test_cli.py +51 -0
- sober_audit-2.0.0/tests/test_cli_advanced.py +105 -0
- sober_audit-2.0.0/tests/test_cli_v2.py +65 -0
- sober_audit-2.0.0/tests/test_config.py +64 -0
- sober_audit-2.0.0/tests/test_duplicates.py +77 -0
- sober_audit-2.0.0/tests/test_ghost_code.py +41 -0
- sober_audit-2.0.0/tests/test_git_helper.py +78 -0
- sober_audit-2.0.0/tests/test_hallucinations.py +85 -0
- sober_audit-2.0.0/tests/test_manifest.py +63 -0
- sober_audit-2.0.0/tests/test_registry_cache.py +34 -0
- sober_audit-2.0.0/tests/test_remediation.py +40 -0
- sober_audit-2.0.0/tests/test_scanner.py +113 -0
- sober_audit-2.0.0/tests/test_scorer.py +31 -0
- sober_audit-2.0.0/tests/test_security.py +29 -0
- sober_audit-2.0.0/tests/test_security_advanced.py +58 -0
- sober_audit-2.0.0/tests/test_security_v2.py +61 -0
- sober_audit-2.0.0/tests/test_slopsquatting.py +52 -0
- sober_audit-2.0.0/tests/test_watcher.py +41 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shenald-dev
|
|
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,450 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sober-audit
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: πΈ The Vibe Coding Hangover Cure. Audit, sanitize, and proofread AI-generated code before pushing to production.
|
|
5
|
+
Author-email: Shenal Diluksha <shenald@users.noreply.github.com>
|
|
6
|
+
Maintainer-email: shenald-dev <shenald@users.noreply.github.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/shenald-dev/sober
|
|
9
|
+
Project-URL: Documentation, https://github.com/shenald-dev/sober#readme
|
|
10
|
+
Project-URL: Repository, https://github.com/shenald-dev/sober
|
|
11
|
+
Project-URL: Issues, https://github.com/shenald-dev/sober/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/shenald-dev/sober/blob/main/CHANGELOG.md
|
|
13
|
+
Keywords: ai,vibe-coding,code-quality,audit,security,cli,hangover,slop-detector
|
|
14
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
24
|
+
Classifier: Topic :: Utilities
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: rich>=13.7.0
|
|
29
|
+
Requires-Dist: typer>=0.12.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
|
|
33
|
+
Requires-Dist: ruff>=0.3.0; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
<div align="center">
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
____ ____ ____ _____ ____
|
|
40
|
+
/ ___/ __ \| __ )| ____| _ \
|
|
41
|
+
\___ \ | | | _ \| _| | |_) |
|
|
42
|
+
___) | |_| | |_) | |___| _ <
|
|
43
|
+
|____/\____/|____/|_____|_| \_\
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
<h3>πΈ sober</h3>
|
|
47
|
+
<p><b>The Vibe Coding Hangover Cure</b></p>
|
|
48
|
+
<i>Audit, sanitize, and proofread AI-generated code before pushing to production. Zero bloat. Maximum Flow.</i>
|
|
49
|
+
|
|
50
|
+
<br/><br/>
|
|
51
|
+
|
|
52
|
+
[](https://pypi.org/project/sober-audit/)
|
|
53
|
+
[](https://github.com/shenald-dev/sober/releases)
|
|
54
|
+
[](https://python.org)
|
|
55
|
+
[](LICENSE)
|
|
56
|
+
[](https://github.com/shenald-dev/sober/actions)
|
|
57
|
+
[](https://github.com/shenald-dev/sober)
|
|
58
|
+
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## π Table of Contents
|
|
64
|
+
- [β‘ The Problem: The Vibe Coding Hangover](#-the-problem-the-vibe-coding-hangover)
|
|
65
|
+
- [π What is Sober?](#-what-is-sober)
|
|
66
|
+
- [π Core Detection Pillars](#-core-detection-pillars)
|
|
67
|
+
- [β‘ Quick Start Guide](#-quick-start-guide)
|
|
68
|
+
- [π» CLI Usage & Commands](#-cli-usage--commands)
|
|
69
|
+
- [π Real-Time Live Watcher (`sober watch`)](#-real-time-live-watcher-sober-watch)
|
|
70
|
+
- [π€ Agent Self-Healing Remediation (`sober explain`)](#-agent-self-healing-remediation-sober-explain)
|
|
71
|
+
- [βοΈ Configuration (`sober.toml`)](#οΈ-configuration-sobertoml)
|
|
72
|
+
- [π‘οΈ Native Git Hooks & CI/CD SARIF](#οΈ-native-git-hooks--cicd-sarif)
|
|
73
|
+
- [ποΈ Architecture](#οΈ-architecture)
|
|
74
|
+
- [π€ Contributing](#-contributing)
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## β‘ The Problem: The Vibe Coding Hangover
|
|
79
|
+
|
|
80
|
+
You just spent 3 hours vibe-coding with **Claude Code**, **Cursor**, **Windsurf**, or **Copilot**. Your prototype spins up blindingly fast, but you have that familiar, sinking feeling:
|
|
81
|
+
|
|
82
|
+
- *Did the AI hallucinate a typosquatted package like `reqeusts` or `nummpy` that leaves you vulnerable to slopsquatting supply-chain malware?*
|
|
83
|
+
- *Did it invoke `requests.get()` or `fetch()` without a timeout, causing production processes to hang forever on network stalls?*
|
|
84
|
+
- *Did it generate authentication tokens using insecure `random.randint()` or `Math.random()`?*
|
|
85
|
+
- *Did it directly interpolate untrusted user strings into LLM prompt templates (`f"...{user_msg}..."`), opening prompt injection vulnerabilities?*
|
|
86
|
+
- *Did it leave 15 leftover `print(f"DEBUG: ...")`, `console.log("HERE")`, markdown code fences, and `debugger;` statements in production files?*
|
|
87
|
+
- *Did it embed conversational assistant comments like `// Certainly! Here is the updated code...` in source files?*
|
|
88
|
+
- *Did it silently swallow fatal database errors with `except: pass` or empty `catch {}` blocks?*
|
|
89
|
+
- *Did it commit a live OpenAI, Anthropic, Gemini, Groq, Supabase, Stripe, or Hugging Face API key directly into your git history?*
|
|
90
|
+
- *Did it disable TLS certificates (`verify=False`) or introduce unsafe deserialization vectors?*
|
|
91
|
+
- *Did it re-invent helper functions that already existed in your repository three folders away?*
|
|
92
|
+
|
|
93
|
+
Standard `git diff` was built for humans reviewing 5-line editsβnot humans auditing 500-line multi-file AI rewrites.
|
|
94
|
+
|
|
95
|
+
**Enter `sober`.**
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## π What is Sober?
|
|
100
|
+
|
|
101
|
+
`sober` is an ultra-fast, zero-config CLI that audits your uncommitted git changes, branches, or entire repositories in **<200ms**. It detects AI-introduced hallucinations, slopsquatting, reliability antipatterns, conversational chatter, slop residue, silent error swallows, duplicate logic, and secret leaks, providing a crystal-clear **Sober Score (0β100%)** before you push to production.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## π Core Detection Pillars
|
|
106
|
+
|
|
107
|
+
| Pillar | Detection Engine | Severity |
|
|
108
|
+
| :--- | :--- | :---: |
|
|
109
|
+
| π§ͺ **Hallucination & Slopsquatting** | Cross-references new imports against local manifests, live PyPI/npm registries, and Damerau-Levenshtein similarity to popular libraries (e.g. `reqeusts` vs `requests`). | `CRITICAL` |
|
|
110
|
+
| π‘οΈ **Dangerous AI Antipatterns** | Catches omitted HTTP timeouts (`requests.get`, `fetch`), insecure pseudo-random tokens (`random.choice`), prompt injection vectors (`f"...{user_input}..."`), and client-side system prompt leakage. | `HIGH` / `CRITICAL` |
|
|
111
|
+
| π **Secrets & Leaks** | Catches hardcoded OpenAI, Anthropic, Gemini, Groq, Supabase, Hugging Face, GitHub PATs, AWS, Stripe Live, Pinecone, Slack, Discord, SendGrid, and trivial default passwords. | `CRITICAL` |
|
|
112
|
+
| π‘οΈ **Vulnerability Vectors** | Detects raw SQL string formatting, `shell=True` command injection, disabled TLS/SSL (`verify=False`), unsafe pickle/YAML deserialization, and trivial JWT secrets. | `HIGH` |
|
|
113
|
+
| π» **Ghost Code & Error Swallows** | Flags blank `except: pass`, empty `catch {}` blocks, empty promise catches, and dangling `debugger;` breakpoints. | `HIGH` |
|
|
114
|
+
| π€ **AI Conversational Chatter** | Detects assistant prompt leakage and conversational text (`Certainly! Here is...`, `As an AI language model...`, `Let me know if you need adjustments`). | `LOW` *(Auto-Cureable)* |
|
|
115
|
+
| π§© **AST Duplication** | Catches AI agents re-inventing existing project helper utilities across files instead of importing them. | `MEDIUM` |
|
|
116
|
+
| π§Ή **Debug Debris & Fences** | Finds temporary `print(f"DEBUG...")`, `console.log("here")`, lingering breakpoints, and stray markdown code fences. | `LOW` *(Auto-Cureable)* |
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## β‘ Quick Start Guide
|
|
121
|
+
|
|
122
|
+
### Installation
|
|
123
|
+
|
|
124
|
+
Install directly via `pip`:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
pip install sober-audit
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Or run directly with `pipx` or `uv`:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
pipx install sober-audit
|
|
134
|
+
# or
|
|
135
|
+
uv tool install sober-audit
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## π» CLI Usage & Commands
|
|
141
|
+
|
|
142
|
+
### 1. Default Working Tree Audit
|
|
143
|
+
Audit your staged and uncommitted git changes instantly:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
sober scan
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 2. Air-Gapped Offline Audit (`--offline`)
|
|
150
|
+
Perform zero-network audits verifying dependencies strictly against local manifests and disk cache:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
sober scan --offline
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### 3. Auto-Cure AI Residue & Chatter
|
|
157
|
+
Automatically strip leftover debug print statements, console logs, dangling debuggers, stray markdown fences, and AI chatter comments:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
sober scan --cure
|
|
161
|
+
# or via standalone cure command:
|
|
162
|
+
sober cure
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### 4. Git Commit Range & PR Branch Auditing (`diff`)
|
|
166
|
+
Audit changes introduced across a PR branch or commit range:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Audit changes between main and current branch
|
|
170
|
+
sober diff main..HEAD
|
|
171
|
+
|
|
172
|
+
# Audit the last commit
|
|
173
|
+
sober diff HEAD~1
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### 5. Full Repository Scan
|
|
177
|
+
Scan all files in the project instead of just git diff changes:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
sober scan --all
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 6. Strict Mode (Pre-Commit / CI)
|
|
184
|
+
Fails with exit code `1` if your **Sober Score** is below threshold (default: 95%) or if any critical issues are found:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
sober scan --strict
|
|
188
|
+
# Custom threshold:
|
|
189
|
+
sober scan --strict --min-score 90
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 7. GitHub Security SARIF & PR Markdown Export
|
|
193
|
+
Generate SARIF 2.1.0 for GitHub Code Scanning or Markdown summary tables for automated PR review comments:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Output SARIF format for GitHub Security tab
|
|
197
|
+
sober scan --sarif > sober-results.sarif
|
|
198
|
+
|
|
199
|
+
# Output GitHub Markdown table for PR comments
|
|
200
|
+
sober scan --markdown
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### 8. Native Zero-Dependency Git Hook Manager
|
|
204
|
+
Install an automated pre-commit hook directly into `.git/hooks/pre-commit`:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Install hook
|
|
208
|
+
sober hook install
|
|
209
|
+
|
|
210
|
+
# Check hook status
|
|
211
|
+
sober hook status
|
|
212
|
+
|
|
213
|
+
# Remove hook
|
|
214
|
+
sober hook uninstall
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### 9. Automated GitHub Actions CI Workflow Setup
|
|
218
|
+
Bootstrap `.github/workflows/sober-guard.yml` in one command:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
sober ci init
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### 10. Project Configuration Initialization
|
|
225
|
+
Generate a starter `sober.toml` configuration file:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
sober init
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## π Real-Time Live Watcher (`sober watch`)
|
|
234
|
+
|
|
235
|
+
Keep a live HUD open alongside your editor while vibe-coding with Cursor, Windsurf, or Claude Code:
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
sober watch
|
|
239
|
+
# Custom polling interval:
|
|
240
|
+
sober watch --interval 0.5
|
|
241
|
+
# Auto-cure debris on save:
|
|
242
|
+
sober watch --cure
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Whenever files are saved, `sober` immediately re-audits the project and updates your sobriety score in real-time.
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## π€ Agent Self-Healing Remediation (`sober explain`)
|
|
250
|
+
|
|
251
|
+
Feed diagnostic audit context directly back to your AI coding agent (Claude Code, Cursor Agent, Copilot Workspace, Aider, Devin):
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
sober explain
|
|
255
|
+
# Or pipe directly to clipboard / agent:
|
|
256
|
+
sober explain | your-agent-fixer
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Outputs a high-density, zero-hallucination directive containing exact file locations, code snippets, and unambiguous surgical instructions to fix every defect.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## βοΈ Configuration (`sober.toml`)
|
|
264
|
+
|
|
265
|
+
Configure `sober` on a workspace or project level using `sober.toml` or `pyproject.toml` (`[tool.sober]`):
|
|
266
|
+
|
|
267
|
+
```toml
|
|
268
|
+
# sober.toml (v2.0)
|
|
269
|
+
[sober]
|
|
270
|
+
min_score = 95.0
|
|
271
|
+
fail_on_critical = true
|
|
272
|
+
max_workers = 10
|
|
273
|
+
offline_mode = false
|
|
274
|
+
|
|
275
|
+
# Paths to ignore during audits
|
|
276
|
+
ignore_paths = [
|
|
277
|
+
"tests/*",
|
|
278
|
+
"docs/*",
|
|
279
|
+
"migrations/*",
|
|
280
|
+
]
|
|
281
|
+
|
|
282
|
+
# Allowed internal or proprietary packages that should never trigger hallucination alerts
|
|
283
|
+
allowed_packages = [
|
|
284
|
+
"@my-org/*",
|
|
285
|
+
"internal_company_sdk",
|
|
286
|
+
]
|
|
287
|
+
|
|
288
|
+
# Disable specific detectors if needed
|
|
289
|
+
# disabled_detectors = ["duplicates"]
|
|
290
|
+
|
|
291
|
+
# Custom proprietary secret regex patterns
|
|
292
|
+
# [[sober.custom_secret_patterns]]
|
|
293
|
+
# name = "Company Internal API Token"
|
|
294
|
+
# pattern = "comp_[A-Za-z0-9]{32}"
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## π‘οΈ Native Git Hooks & CI/CD SARIF
|
|
300
|
+
|
|
301
|
+
### Native Pre-Commit Hook
|
|
302
|
+
|
|
303
|
+
Install `sober` directly into your repository with zero third-party dependencies:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
sober hook install
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Now, every `git commit` automatically triggers `sober scan --strict`, preventing AI slop or accidental credential leaks from ever entering git history!
|
|
310
|
+
|
|
311
|
+
### One-Command GitHub Actions CI Generator
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
sober ci init
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Generates `.github/workflows/sober-guard.yml`:
|
|
318
|
+
|
|
319
|
+
```yaml
|
|
320
|
+
name: SOBER Code Sobriety Radar
|
|
321
|
+
|
|
322
|
+
on:
|
|
323
|
+
pull_request:
|
|
324
|
+
branches: [main, master]
|
|
325
|
+
push:
|
|
326
|
+
branches: [main, master]
|
|
327
|
+
|
|
328
|
+
jobs:
|
|
329
|
+
sober-audit:
|
|
330
|
+
name: AI Hangover & Security Audit
|
|
331
|
+
runs-on: ubuntu-latest
|
|
332
|
+
steps:
|
|
333
|
+
- name: Checkout Code
|
|
334
|
+
uses: actions/checkout@v4
|
|
335
|
+
with:
|
|
336
|
+
fetch-depth: 0
|
|
337
|
+
|
|
338
|
+
- name: Set up Python
|
|
339
|
+
uses: actions/setup-python@v5
|
|
340
|
+
with:
|
|
341
|
+
python-version: "3.11"
|
|
342
|
+
|
|
343
|
+
- name: Install SOBER
|
|
344
|
+
run: pip install git+https://github.com/shenald-dev/sober.git
|
|
345
|
+
|
|
346
|
+
- name: Run SOBER Audit (SARIF & Markdown)
|
|
347
|
+
run: |
|
|
348
|
+
sober scan --all --sarif > sober.sarif
|
|
349
|
+
sober scan --all --markdown > sober-summary.md
|
|
350
|
+
cat sober-summary.md >> $GITHUB_STEP_SUMMARY
|
|
351
|
+
continue-on-error: true
|
|
352
|
+
|
|
353
|
+
- name: Upload SARIF to GitHub Code Scanning
|
|
354
|
+
uses: github/codeql-action/upload-sarif@v3
|
|
355
|
+
if: always()
|
|
356
|
+
with:
|
|
357
|
+
sarif_file: sober.sarif
|
|
358
|
+
category: sober-hangover-guard
|
|
359
|
+
|
|
360
|
+
- name: Strict Sobriety Gate
|
|
361
|
+
run: sober scan --all --strict --min-score 90
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
---
|
|
365
|
+
|
|
366
|
+
## π Telemetry & The Sober Score
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
ββββββββββββββββββββββββ π SOBRIETY HEALTH TELEMETRY βββββββββββββββββββββββββ
|
|
370
|
+
β β
|
|
371
|
+
β Sober Score: 100% [A+] β
|
|
372
|
+
β State: π§ Crystal Sober (Production Ready) β
|
|
373
|
+
β β
|
|
374
|
+
β β’ Critical Issues: 0 β’ High: 0 β’ Medium: 0 β’ Low (Debris): 0 β
|
|
375
|
+
β β’ Auto-Fixable with --cure: 0 β
|
|
376
|
+
β β
|
|
377
|
+
β Scanned 18 files in 0.11s. β
|
|
378
|
+
β β
|
|
379
|
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
- **95% β 100%** → `π§ Crystal Sober`: Production ready, strictly typed, pristine flow.
|
|
383
|
+
- **80% β 94%** → `β Mild Buzz`: Minor debug debris or unaddressed stubs detected.
|
|
384
|
+
- **60% β 79%** → `πΈ Noticeable Hangover`: Review required. High-risk patterns found.
|
|
385
|
+
- **< 60%** → `π¨ Complete Blackout`: Critical security vulnerabilities or hallucinated dependencies. **Do NOT deploy.**
|
|
386
|
+
|
|
387
|
+
---
|
|
388
|
+
|
|
389
|
+
## ποΈ Architecture
|
|
390
|
+
|
|
391
|
+
```
|
|
392
|
+
βββββββββββββββββββββββββββ
|
|
393
|
+
β Git Workspace / Targetβ
|
|
394
|
+
βββββββββββββ¬ββββββββββββββ
|
|
395
|
+
β
|
|
396
|
+
βΌ
|
|
397
|
+
βββββββββββββββββββββββββββ
|
|
398
|
+
β Scanner & Diff Engine β (Uncommitted changes,
|
|
399
|
+
β (git status & ranges) β commit diffs, or all)
|
|
400
|
+
βββββββββββββ¬ββββββββββββββ
|
|
401
|
+
β
|
|
402
|
+
ββββββββββββββββββΌβββββββββββββββββ
|
|
403
|
+
βΌ βΌ βΌ
|
|
404
|
+
ββββββββββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββββββ
|
|
405
|
+
β Manifest Inspector β β Disk Registry β β Config Engine β
|
|
406
|
+
β (package.json/pyproj)β β Cache (TTL) β β (sober.toml loader) β
|
|
407
|
+
ββββββββββββ¬ββββββββββββ βββββββββ¬βββββββββ ββββββββββββ¬ββββββββββββ
|
|
408
|
+
β β β
|
|
409
|
+
ββββββββββββββββββ¬βββββ΄ββββββββββββββββββββββ
|
|
410
|
+
β
|
|
411
|
+
βΌ
|
|
412
|
+
βββββββββββββββββββββββββββ
|
|
413
|
+
β Detection Pillar Pool β
|
|
414
|
+
β β’ Slopsquatting / PyPI β
|
|
415
|
+
β β’ Dangerous Antipatternsβ
|
|
416
|
+
β β’ Secrets & Webhooks β
|
|
417
|
+
β β’ AI Chatter & Fences β
|
|
418
|
+
β β’ Silent Error Swallows β
|
|
419
|
+
β β’ AST Duplication β
|
|
420
|
+
βββββββββββββ¬ββββββββββββββ
|
|
421
|
+
β
|
|
422
|
+
ββββββββββββββββββββββββΌβββββββββββββββββββββββ
|
|
423
|
+
βΌ βΌ βΌ
|
|
424
|
+
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
|
|
425
|
+
β Sobriety Radar β β Live Vibe Watch β β Agent Remediationβ
|
|
426
|
+
β β’ Terminal HUD β β β’ File monitor β β β’ sober explain β
|
|
427
|
+
β β’ SARIF 2.1.0 β β β’ Real-time HUD β β β’ Self-healing β
|
|
428
|
+
β β’ Markdown PR β β β’ Auto-cure β β directive β
|
|
429
|
+
ββββββββββββββββββββ ββββββββββββββββββββ ββββββββββββββββββββ
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## π€ Contributing
|
|
435
|
+
|
|
436
|
+
Contributions are welcome! Please open an issue or PR on [GitHub](https://github.com/shenald-dev/sober).
|
|
437
|
+
|
|
438
|
+
```bash
|
|
439
|
+
git clone https://github.com/shenald-dev/sober.git
|
|
440
|
+
cd sober
|
|
441
|
+
pip install -e ".[dev]"
|
|
442
|
+
pytest
|
|
443
|
+
ruff check .
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
## π License
|
|
449
|
+
|
|
450
|
+
MIT License. Designed and built with β€οΈ by [shenald-dev](https://github.com/shenald-dev).
|