devnog 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. devnog-0.1.0/.github/workflows/publish.yml +55 -0
  2. devnog-0.1.0/.gitignore +14 -0
  3. devnog-0.1.0/CLAUDE.md +188 -0
  4. devnog-0.1.0/LICENSE +21 -0
  5. devnog-0.1.0/PKG-INFO +369 -0
  6. devnog-0.1.0/README.md +324 -0
  7. devnog-0.1.0/devnog.team.toml +18 -0
  8. devnog-0.1.0/devnog.toml +43 -0
  9. devnog-0.1.0/examples/sample_project/api_client.py +53 -0
  10. devnog-0.1.0/examples/sample_project/config.py +29 -0
  11. devnog-0.1.0/examples/sample_project/database.py +80 -0
  12. devnog-0.1.0/examples/sample_project/requirements.txt +10 -0
  13. devnog-0.1.0/examples/sample_project/security.py +52 -0
  14. devnog-0.1.0/examples/sample_project/utils.py +119 -0
  15. devnog-0.1.0/pyproject.toml +67 -0
  16. devnog-0.1.0/src/devnog/__init__.py +17 -0
  17. devnog-0.1.0/src/devnog/_version.py +1 -0
  18. devnog-0.1.0/src/devnog/capture/__init__.py +33 -0
  19. devnog-0.1.0/src/devnog/capture/decorators.py +472 -0
  20. devnog-0.1.0/src/devnog/capture/models.py +129 -0
  21. devnog-0.1.0/src/devnog/capture/replayer.py +237 -0
  22. devnog-0.1.0/src/devnog/capture/serializer.py +209 -0
  23. devnog-0.1.0/src/devnog/capture/store.py +365 -0
  24. devnog-0.1.0/src/devnog/cli/__init__.py +1 -0
  25. devnog-0.1.0/src/devnog/cli/compliance_cmd.py +55 -0
  26. devnog-0.1.0/src/devnog/cli/dashboard_cmd.py +36 -0
  27. devnog-0.1.0/src/devnog/cli/fix_cmd.py +229 -0
  28. devnog-0.1.0/src/devnog/cli/guardian_cmd.py +108 -0
  29. devnog-0.1.0/src/devnog/cli/history_cmd.py +67 -0
  30. devnog-0.1.0/src/devnog/cli/main.py +41 -0
  31. devnog-0.1.0/src/devnog/cli/qa_cmd.py +63 -0
  32. devnog-0.1.0/src/devnog/cli/scan_cmd.py +173 -0
  33. devnog-0.1.0/src/devnog/cli/undo_cmd.py +56 -0
  34. devnog-0.1.0/src/devnog/core/__init__.py +1 -0
  35. devnog-0.1.0/src/devnog/core/config.py +196 -0
  36. devnog-0.1.0/src/devnog/core/crypto.py +38 -0
  37. devnog-0.1.0/src/devnog/core/input_resolver.py +154 -0
  38. devnog-0.1.0/src/devnog/core/license.py +160 -0
  39. devnog-0.1.0/src/devnog/core/models.py +171 -0
  40. devnog-0.1.0/src/devnog/core/output.py +277 -0
  41. devnog-0.1.0/src/devnog/dashboard/__init__.py +1 -0
  42. devnog-0.1.0/src/devnog/dashboard/server.py +556 -0
  43. devnog-0.1.0/src/devnog/enterprise/__init__.py +1 -0
  44. devnog-0.1.0/src/devnog/enterprise/ci_gate.py +247 -0
  45. devnog-0.1.0/src/devnog/enterprise/compliance.py +211 -0
  46. devnog-0.1.0/src/devnog/enterprise/team_config.py +97 -0
  47. devnog-0.1.0/src/devnog/enterprise/trending.py +148 -0
  48. devnog-0.1.0/src/devnog/fix/__init__.py +5 -0
  49. devnog-0.1.0/src/devnog/fix/ai_fixer.py +177 -0
  50. devnog-0.1.0/src/devnog/fix/applier.py +112 -0
  51. devnog-0.1.0/src/devnog/fix/engine.py +136 -0
  52. devnog-0.1.0/src/devnog/fix/models.py +30 -0
  53. devnog-0.1.0/src/devnog/fix/rule_fixer.py +465 -0
  54. devnog-0.1.0/src/devnog/fix/undo.py +104 -0
  55. devnog-0.1.0/src/devnog/guardian/__init__.py +24 -0
  56. devnog-0.1.0/src/devnog/guardian/audit.py +190 -0
  57. devnog-0.1.0/src/devnog/guardian/config.py +96 -0
  58. devnog-0.1.0/src/devnog/guardian/context.py +230 -0
  59. devnog-0.1.0/src/devnog/guardian/middleware.py +293 -0
  60. devnog-0.1.0/src/devnog/guardian/patterns.py +329 -0
  61. devnog-0.1.0/src/devnog/qa/__init__.py +5 -0
  62. devnog-0.1.0/src/devnog/qa/checks/__init__.py +82 -0
  63. devnog-0.1.0/src/devnog/qa/checks/base.py +98 -0
  64. devnog-0.1.0/src/devnog/qa/checks/config.py +307 -0
  65. devnog-0.1.0/src/devnog/qa/checks/data_safety.py +219 -0
  66. devnog-0.1.0/src/devnog/qa/checks/error_handling.py +293 -0
  67. devnog-0.1.0/src/devnog/qa/checks/infrastructure.py +339 -0
  68. devnog-0.1.0/src/devnog/qa/checks/observability.py +257 -0
  69. devnog-0.1.0/src/devnog/qa/checks/performance.py +231 -0
  70. devnog-0.1.0/src/devnog/qa/checks/resilience.py +247 -0
  71. devnog-0.1.0/src/devnog/qa/checks/timeouts.py +277 -0
  72. devnog-0.1.0/src/devnog/qa/engine.py +182 -0
  73. devnog-0.1.0/src/devnog/scanner/__init__.py +5 -0
  74. devnog-0.1.0/src/devnog/scanner/checks/__init__.py +92 -0
  75. devnog-0.1.0/src/devnog/scanner/checks/base.py +84 -0
  76. devnog-0.1.0/src/devnog/scanner/checks/code_quality.py +534 -0
  77. devnog-0.1.0/src/devnog/scanner/checks/dependencies.py +407 -0
  78. devnog-0.1.0/src/devnog/scanner/checks/error_handling.py +422 -0
  79. devnog-0.1.0/src/devnog/scanner/checks/security.py +603 -0
  80. devnog-0.1.0/src/devnog/scanner/engine.py +134 -0
  81. devnog-0.1.0/src/devnog/scanner/scoring.py +91 -0
  82. devnog-0.1.0/tests/__init__.py +0 -0
  83. devnog-0.1.0/tests/test_capture/__init__.py +0 -0
  84. devnog-0.1.0/tests/test_capture/test_decorators.py +410 -0
  85. devnog-0.1.0/tests/test_capture/test_serializer.py +379 -0
  86. devnog-0.1.0/tests/test_capture/test_store.py +371 -0
  87. devnog-0.1.0/tests/test_core/__init__.py +0 -0
  88. devnog-0.1.0/tests/test_core/test_config.py +182 -0
  89. devnog-0.1.0/tests/test_core/test_input_resolver.py +130 -0
  90. devnog-0.1.0/tests/test_core/test_license.py +238 -0
  91. devnog-0.1.0/tests/test_core/test_scoring.py +165 -0
  92. devnog-0.1.0/tests/test_dashboard/__init__.py +0 -0
  93. devnog-0.1.0/tests/test_enterprise/__init__.py +0 -0
  94. devnog-0.1.0/tests/test_enterprise/test_ci_gate.py +560 -0
  95. devnog-0.1.0/tests/test_enterprise/test_compliance.py +543 -0
  96. devnog-0.1.0/tests/test_enterprise/test_team_config.py +351 -0
  97. devnog-0.1.0/tests/test_enterprise/test_trending.py +493 -0
  98. devnog-0.1.0/tests/test_fix/__init__.py +0 -0
  99. devnog-0.1.0/tests/test_fix/test_applier.py +182 -0
  100. devnog-0.1.0/tests/test_fix/test_rule_fixer.py +298 -0
  101. devnog-0.1.0/tests/test_fix/test_undo.py +142 -0
  102. devnog-0.1.0/tests/test_guardian/__init__.py +0 -0
  103. devnog-0.1.0/tests/test_guardian/test_audit.py +244 -0
  104. devnog-0.1.0/tests/test_guardian/test_config.py +139 -0
  105. devnog-0.1.0/tests/test_guardian/test_middleware.py +222 -0
  106. devnog-0.1.0/tests/test_guardian/test_patterns.py +320 -0
  107. devnog-0.1.0/tests/test_integration/__init__.py +0 -0
  108. devnog-0.1.0/tests/test_integration/test_scan_fix_rescan.py +269 -0
  109. devnog-0.1.0/tests/test_qa/__init__.py +0 -0
  110. devnog-0.1.0/tests/test_qa/test_qa_checks.py +1828 -0
  111. devnog-0.1.0/tests/test_qa/test_qa_engine.py +555 -0
  112. devnog-0.1.0/tests/test_scanner/__init__.py +0 -0
  113. devnog-0.1.0/tests/test_scanner/test_code_quality.py +490 -0
  114. devnog-0.1.0/tests/test_scanner/test_engine.py +191 -0
  115. devnog-0.1.0/tests/test_scanner/test_error_handling.py +470 -0
  116. devnog-0.1.0/tests/test_scanner/test_security.py +605 -0
@@ -0,0 +1,55 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ name: Build distribution
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.12"
22
+
23
+ - name: Install build dependencies
24
+ run: python -m pip install --upgrade pip build
25
+
26
+ - name: Build package
27
+ run: python -m build
28
+
29
+ - name: Upload distribution artifacts
30
+ uses: actions/upload-artifact@v4
31
+ with:
32
+ name: python-package-distributions
33
+ path: dist/
34
+
35
+ publish:
36
+ name: Publish to PyPI
37
+ needs: build
38
+ runs-on: ubuntu-latest
39
+
40
+ environment:
41
+ name: pypi
42
+ url: https://pypi.org/p/devnog
43
+
44
+ permissions:
45
+ id-token: write # Required for Trusted Publishers (OIDC)
46
+
47
+ steps:
48
+ - name: Download distribution artifacts
49
+ uses: actions/download-artifact@v4
50
+ with:
51
+ name: python-package-distributions
52
+ path: dist/
53
+
54
+ - name: Publish to PyPI
55
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ .eggs/
8
+ *.egg
9
+ .devnog/
10
+ .pytest_cache/
11
+ .coverage
12
+ htmlcov/
13
+ *.bak
14
+ .env
devnog-0.1.0/CLAUDE.md ADDED
@@ -0,0 +1,188 @@
1
+ # CLAUDE.md — Contributor Guide for DevNog
2
+
3
+ ## Project Overview
4
+
5
+ DevNog is a Python CLI + localhost dashboard + lightweight SDK for code analysis and fixing. It scans Python codebases, finds issues, and generates fixes.
6
+
7
+ ## Project Structure
8
+
9
+ ```
10
+ src/devnog/
11
+ ├── __init__.py # Public API: checkpoint, healable, capture, guard, guardian_context, guardian_config
12
+ ├── _version.py # Version string (0.1.0)
13
+ ├── core/ # Shared utilities
14
+ │ ├── models.py # Data models: Finding, ScanReport, FixProposal, QAVerdict, etc.
15
+ │ ├── config.py # DevNogConfig, load_config(), devnog.toml parsing
16
+ │ ├── license.py # Tier enum, LicenseManager, tier gating
17
+ │ ├── crypto.py # Fernet encryption for captures
18
+ │ ├── output.py # Rich terminal formatting (print_scan_report, etc.)
19
+ │ └── input_resolver.py # Resolve directory/zip/GitHub URL inputs
20
+ ├── scanner/ # Static analysis engine
21
+ │ ├── engine.py # Scanner orchestrator
22
+ │ ├── scoring.py # Weighted scoring algorithm
23
+ │ └── checks/ # All 38 scanner checks
24
+ │ ├── base.py # BaseCheck and DependencyCheck ABCs
25
+ │ ├── code_quality.py # CQ-001 through CQ-010
26
+ │ ├── security.py # SEC-001 through SEC-012
27
+ │ ├── error_handling.py # ERR-001 through ERR-008
28
+ │ └── dependencies.py # DEP-001 through DEP-008
29
+ ├── fix/ # Fix engine
30
+ │ ├── engine.py # FixEngine orchestrator
31
+ │ ├── rule_fixer.py # 13 rule-based fix handlers
32
+ │ ├── ai_fixer.py # Claude-powered fixes
33
+ │ ├── applier.py # Apply fixes with backup
34
+ │ ├── undo.py # UndoManager
35
+ │ └── models.py # FixProposalConfidence, UndoRecord
36
+ ├── qa/ # QA Gate (production readiness)
37
+ │ ├── engine.py # QAGate orchestrator
38
+ │ └── checks/ # 25 QA checks (QA-001 through QA-025)
39
+ │ ├── base.py # QACheck ABC
40
+ │ ├── error_handling.py # QA-001 to QA-003
41
+ │ ├── timeouts.py # QA-004 to QA-006
42
+ │ ├── infrastructure.py # QA-007 to QA-011
43
+ │ ├── data_safety.py # QA-012 to QA-013
44
+ │ ├── config.py # QA-014 to QA-016
45
+ │ ├── resilience.py # QA-017 to QA-019
46
+ │ ├── performance.py # QA-020 to QA-021
47
+ │ └── observability.py # QA-022 to QA-025
48
+ ├── capture/ # Failure capture/replay
49
+ │ ├── decorators.py # @checkpoint, @healable, @capture
50
+ │ ├── models.py # FailureCapture, CheckpointState
51
+ │ ├── serializer.py # Safe serialization + redaction
52
+ │ ├── store.py # Encrypted SQLite capture store
53
+ │ └── replayer.py # Replay from checkpoint
54
+ ├── guardian/ # Runtime protection
55
+ │ ├── middleware.py # ASGI middleware + guard()
56
+ │ ├── context.py # guardian_context async context manager
57
+ │ ├── config.py # GuardianConfig
58
+ │ ├── patterns.py # FailurePatternDetector (Pro)
59
+ │ └── audit.py # HealingAuditLog (Pro)
60
+ ├── dashboard/ # Localhost web dashboard
61
+ │ └── server.py # HTTP server with embedded HTML SPA
62
+ ├── enterprise/ # Enterprise features
63
+ │ ├── team_config.py # TeamConfigEnforcer
64
+ │ ├── ci_gate.py # CIScanDiff for CI/CD
65
+ │ ├── trending.py # HistoryTracker (SQLite)
66
+ │ └── compliance.py # OWASP/SOC2 compliance reports
67
+ └── cli/ # Click CLI commands
68
+ ├── main.py # CLI entry point (click.Group)
69
+ ├── scan_cmd.py # devnog scan
70
+ ├── fix_cmd.py # devnog fix
71
+ ├── qa_cmd.py # devnog qa
72
+ ├── dashboard_cmd.py # devnog dashboard
73
+ ├── guardian_cmd.py # devnog guardian
74
+ ├── undo_cmd.py # devnog undo
75
+ ├── history_cmd.py # devnog history (Enterprise)
76
+ └── compliance_cmd.py # devnog compliance (Enterprise)
77
+ ```
78
+
79
+ ## Running Tests
80
+
81
+ ```bash
82
+ # Run all tests
83
+ python -m pytest tests/ -v
84
+
85
+ # Run a specific test module
86
+ python -m pytest tests/test_scanner/test_security.py -v
87
+
88
+ # Run tests for a specific check
89
+ python -m pytest tests/test_scanner/test_code_quality.py::TestCQ001FunctionTooLong -v
90
+
91
+ # Run with coverage
92
+ python -m pytest tests/ --cov=devnog --cov-report=term-missing
93
+ ```
94
+
95
+ ## How to Add a New Scanner Check
96
+
97
+ 1. **Choose an ID** following the pattern: `{CATEGORY}-{NNN}` (e.g., `SEC-013`, `CQ-011`)
98
+
99
+ 2. **Create the check class** in the appropriate file under `src/devnog/scanner/checks/`:
100
+
101
+ ```python
102
+ class SEC013NewCheck(BaseCheck):
103
+ """Detect the new security issue."""
104
+
105
+ check_id = "SEC-013"
106
+ category = Category.SECURITY
107
+ severity = Severity.WARNING # CRITICAL, WARNING, or INFO
108
+ fix_type = FixType.RULE_BASED # RULE_BASED, AI_GENERATED, or MANUAL
109
+ description = "Description of what this detects"
110
+
111
+ def run(self, file_path: Path, source: str, tree: ast.Module) -> list[Finding]:
112
+ findings = []
113
+ # Walk the AST and look for the pattern
114
+ for node in ast.walk(tree):
115
+ if self._is_problematic(node):
116
+ findings.append(self._make_finding(
117
+ message="Human-readable description of the issue",
118
+ file_path=file_path,
119
+ line=node.lineno,
120
+ suggestion="How to fix this",
121
+ ))
122
+ return findings
123
+ ```
124
+
125
+ 3. **Register the check** in `src/devnog/scanner/checks/__init__.py`:
126
+
127
+ ```python
128
+ from devnog.scanner.checks.security import SEC013NewCheck
129
+
130
+ ALL_CHECKS: list[type] = [
131
+ # ... existing checks ...
132
+ SEC013NewCheck,
133
+ ]
134
+ ```
135
+
136
+ 4. **Add a rule-based fix** (optional) in `src/devnog/fix/rule_fixer.py`:
137
+
138
+ ```python
139
+ # In the __init__ method, add to self._handlers:
140
+ self._handlers["SEC-013"] = self._fix_sec013
141
+
142
+ def _fix_sec013(self, finding: Finding) -> FixProposal | None:
143
+ # Generate the fix
144
+ ...
145
+ ```
146
+
147
+ 5. **Write tests** in `tests/test_scanner/test_security.py`:
148
+
149
+ ```python
150
+ class TestSEC013NewCheck:
151
+ def test_detects_issue(self, tmp_path):
152
+ code = '''problematic code here'''
153
+ # ... test that it produces findings
154
+
155
+ def test_clean_code(self, tmp_path):
156
+ code = '''clean code here'''
157
+ # ... test that it produces no findings
158
+ ```
159
+
160
+ 6. **Run the tests**:
161
+
162
+ ```bash
163
+ python -m pytest tests/test_scanner/test_security.py::TestSEC013NewCheck -v
164
+ ```
165
+
166
+ ## Key Design Decisions
167
+
168
+ - **AST-only analysis**: All checks use Python's `ast` module. No code execution.
169
+ - **No external services**: Everything runs locally. No accounts or cloud dependencies.
170
+ - **Three required deps**: click, rich, cryptography. Everything else is optional.
171
+ - **Tier gating**: Use `LicenseManager.require_pro()` / `require_enterprise()` for gated features.
172
+ - **Weighted scoring**: security 25%, error_handling 25%, code_quality 20%, dependencies 15%, test_coverage 15%.
173
+
174
+ ## Common Development Tasks
175
+
176
+ ```bash
177
+ # Install in development mode
178
+ pip install -e ".[dev]"
179
+
180
+ # Run the CLI locally
181
+ devnog scan examples/sample_project/
182
+
183
+ # Run DevNog on itself
184
+ devnog scan src/
185
+
186
+ # Start dashboard for testing
187
+ devnog dashboard --no-open --port 7654
188
+ ```
devnog-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Luke H / X: @kinggablim
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.
devnog-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,369 @@
1
+ Metadata-Version: 2.4
2
+ Name: devnog
3
+ Version: 0.1.0
4
+ Summary: Developer's Bulletproofing Toolkit — scan, fix, and ship with confidence
5
+ Project-URL: Homepage, https://github.com/mintingpressbuilds/DevNog
6
+ Project-URL: Repository, https://github.com/mintingpressbuilds/DevNog
7
+ Project-URL: Issues, https://github.com/mintingpressbuilds/DevNog/issues
8
+ Project-URL: Changelog, https://github.com/mintingpressbuilds/DevNog/releases
9
+ Author: Luke H
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: code-quality,developer-tools,fixer,linter,security
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Security
21
+ Classifier: Topic :: Software Development :: Quality Assurance
22
+ Classifier: Topic :: Software Development :: Testing
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: click>=8.0
25
+ Requires-Dist: cryptography>=41.0
26
+ Requires-Dist: rich>=13.0
27
+ Provides-Extra: ai
28
+ Requires-Dist: anthropic>=0.40.0; extra == 'ai'
29
+ Provides-Extra: all
30
+ Requires-Dist: anthropic>=0.40.0; extra == 'all'
31
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'all'
32
+ Requires-Dist: pytest-cov>=4.0; extra == 'all'
33
+ Requires-Dist: pytest>=7.0; extra == 'all'
34
+ Requires-Dist: reportlab>=4.0; extra == 'all'
35
+ Requires-Dist: starlette>=0.27; extra == 'all'
36
+ Provides-Extra: dev
37
+ Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
38
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
39
+ Requires-Dist: pytest>=7.0; extra == 'dev'
40
+ Provides-Extra: enterprise
41
+ Requires-Dist: reportlab>=4.0; extra == 'enterprise'
42
+ Provides-Extra: guardian
43
+ Requires-Dist: starlette>=0.27; extra == 'guardian'
44
+ Description-Content-Type: text/markdown
45
+
46
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
47
+
48
+ # DevNog — Developer's Bulletproofing Toolkit
49
+
50
+ **One scan. One click. One fix. Ship with confidence.**
51
+
52
+ DevNog is a Python CLI + localhost dashboard + lightweight SDK that makes any codebase bulletproof. It doesn't just find problems — it fixes them.
53
+
54
+ ```bash
55
+ pip install devnog
56
+ ```
57
+
58
+ No accounts. No hosting. No cloud. Everything runs locally.
59
+
60
+ ---
61
+
62
+ ## Quick Start (under 60 seconds)
63
+
64
+ ```bash
65
+ # Install
66
+ pip install devnog
67
+
68
+ # Scan your project
69
+ cd your-project
70
+ devnog scan
71
+
72
+ # See the report → fix everything safe → score goes up
73
+ devnog fix --all
74
+
75
+ # Rescan to see your new score
76
+ devnog scan
77
+ ```
78
+
79
+ That's it. Your codebase just got safer.
80
+
81
+ ---
82
+
83
+ ## All CLI Commands
84
+
85
+ ### `devnog scan` — Find every issue
86
+
87
+ ```bash
88
+ devnog scan # Scan current directory
89
+ devnog scan ./src # Scan specific directory
90
+ devnog scan project.zip # Scan a zip file
91
+ devnog scan https://github.com/user/repo # Scan a GitHub repo
92
+ devnog scan --fail-under 70 # CI mode: fail if score below threshold
93
+ devnog scan --export json # Export report as JSON
94
+ devnog scan --export html # Export report as HTML
95
+ devnog scan --only security # Scan only specific categories
96
+ devnog scan --fix # Scan and auto-fix in one step
97
+ devnog scan --dashboard # Scan and open dashboard
98
+ ```
99
+
100
+ 38 built-in checks across 4 categories:
101
+
102
+ | Category | Checks | What It Finds |
103
+ |----------|--------|---------------|
104
+ | **Security** | SEC-001 to SEC-012 | Hardcoded secrets, SQL injection, eval(), weak hashing, open CORS, DEBUG=True, subprocess shell=True |
105
+ | **Code Quality** | CQ-001 to CQ-010 | Long functions, deep nesting, unused imports, duplicate code, missing type hints, star imports, dead code |
106
+ | **Error Handling** | ERR-001 to ERR-008 | Bare except, silent errors, missing timeouts, unhandled I/O, no global handler |
107
+ | **Dependencies** | DEP-001 to DEP-008 | Known CVEs, abandoned packages, unpinned deps, unused packages, outdated versions |
108
+
109
+ ### `devnog fix` — Fix every issue
110
+
111
+ ```bash
112
+ devnog fix SEC-001 # Fix a specific issue
113
+ devnog fix SEC-001 --preview # Preview without applying
114
+ devnog fix --all # Fix all auto-fixable issues
115
+ devnog fix --all -y # Fix all without confirmation
116
+ devnog fix --category security # Fix all security issues
117
+ devnog fix ERR-004 --ai # Use AI for complex fix (requires ANTHROPIC_API_KEY)
118
+ devnog fix --target ./src # Fix issues in specific directory
119
+ ```
120
+
121
+ Every fix shows a diff before applying. All fixes are reversible.
122
+
123
+ ### `devnog undo` — Reverse any fix
124
+
125
+ ```bash
126
+ devnog undo SEC-001 # Undo a specific fix
127
+ devnog undo --last # Undo all fixes from last session
128
+ devnog undo --list # List all undoable fixes
129
+ ```
130
+
131
+ ### `devnog qa` — Validate production readiness
132
+
133
+ ```bash
134
+ devnog qa # Full readiness check (25 checks)
135
+ devnog qa ./src # Check specific directory
136
+ devnog qa --fix # Auto-fix readiness gaps
137
+ devnog qa --strict # CI mode: fail if not ready
138
+ ```
139
+
140
+ Checks what tests don't cover: timeouts, retry logic, circuit breakers, transaction handling, structured logging, and more.
141
+
142
+ ### `devnog dashboard` — Visual web UI
143
+
144
+ ```bash
145
+ devnog dashboard # Opens http://localhost:7654
146
+ devnog dashboard --port 8080 # Custom port
147
+ devnog dashboard --no-open # Start without opening browser
148
+ ```
149
+
150
+ The dashboard provides:
151
+ - **Report Card** tab — Overall score with category breakdown, clickable [FIX] buttons on every issue
152
+ - **QA Gate** tab — Production readiness verdict (PASS / CONDITIONAL PASS / FAIL)
153
+ - **Runtime** tab — Captured failures from Guardian decorators
154
+ - **History** tab — Fix history with [UNDO] buttons
155
+ - **Fix modal** — Diff view with confidence indicator, side effects, and manual steps
156
+ - **Fix All** button — One click to apply all safe fixes
157
+ - **URL scanner** — Paste a GitHub URL to scan any public repo
158
+
159
+ ### `devnog guardian` — Runtime protection status
160
+
161
+ ```bash
162
+ devnog guardian # Show Guardian status
163
+ devnog guardian --status # Same as above
164
+ devnog guardian --audit # Show healing audit log (Pro)
165
+ devnog guardian --report # Show runtime failure report
166
+ ```
167
+
168
+ ### `devnog history` — Historical trending (Enterprise)
169
+
170
+ ```bash
171
+ devnog history # Show score history
172
+ devnog history --days 30 # Last 30 days
173
+ devnog history --json # JSON output
174
+ ```
175
+
176
+ ### `devnog compliance` — Compliance reports (Enterprise)
177
+
178
+ ```bash
179
+ devnog compliance # Generate OWASP Top 10 report
180
+ devnog compliance --framework soc2 # SOC2 compliance report
181
+ devnog compliance --export pdf # Export as PDF
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Decorator Usage
187
+
188
+ ### `@capture` — Lightweight failure capture
189
+
190
+ ```python
191
+ from devnog import capture
192
+
193
+ @capture
194
+ def risky_calculation(data):
195
+ return sum(d / normalize(d) for d in data)
196
+ ```
197
+
198
+ When `risky_calculation` fails, DevNog saves a complete snapshot — args, local variables, stack trace, timestamp — to `.devnog/captures.db`. Sensitive data is automatically redacted.
199
+
200
+ ### `@checkpoint` — Resume from last successful step
201
+
202
+ ```python
203
+ from devnog import checkpoint
204
+
205
+ @checkpoint
206
+ def long_pipeline(data, _ckpt=None):
207
+ step1_result = expensive_step_1(data)
208
+ _ckpt.save("step1", {"result": step1_result})
209
+
210
+ step2_result = expensive_step_2(step1_result)
211
+ _ckpt.save("step2", {"result": step2_result})
212
+
213
+ return step2_result
214
+ ```
215
+
216
+ If the function fails mid-way, DevNog can replay from the last checkpoint. Accept `_ckpt` as a parameter to save intermediate state.
217
+
218
+ ### `@healable` — Self-healing functions (Pro)
219
+
220
+ ```python
221
+ from devnog import healable
222
+
223
+ @healable(retries=3, backoff=True, fallback="skip")
224
+ async def call_external_api(payload):
225
+ response = await httpx.post(url, json=payload)
226
+ return response.json()
227
+ ```
228
+
229
+ On **Free tier**, `@healable` captures failures but re-raises them (observe-only mode).
230
+ On **Pro tier**, it adds retry with exponential backoff, fallback strategies, and pattern detection.
231
+
232
+ ---
233
+
234
+ ## Guardian Setup
235
+
236
+ ### FastAPI / Starlette
237
+
238
+ ```python
239
+ from fastapi import FastAPI
240
+ from devnog import guard
241
+
242
+ app = FastAPI()
243
+ guard(app) # Adds ASGI middleware for request failure capture
244
+ ```
245
+
246
+ ### Context manager
247
+
248
+ ```python
249
+ from devnog import guardian_context
250
+
251
+ async with guardian_context():
252
+ await do_something_risky()
253
+ ```
254
+
255
+ ### Configuration
256
+
257
+ ```python
258
+ from devnog import guardian_config
259
+
260
+ guardian_config(
261
+ capture_args=True,
262
+ capture_locals=True,
263
+ max_captures=1000,
264
+ redact_patterns=["password", "token", "secret"],
265
+ )
266
+ ```
267
+
268
+ ---
269
+
270
+ ## Configuration
271
+
272
+ Create `devnog.toml` in your project root. Everything is optional — sensible defaults are built in:
273
+
274
+ ```toml
275
+ [scan]
276
+ fail_under = 70 # CI threshold
277
+ categories = ["code_quality", "security", "error_handling", "dependencies"]
278
+ exclude = ["tests/", "migrations/", "venv/"]
279
+
280
+ [scan.code_quality]
281
+ max_function_length = 75 # Lines per function
282
+ max_nesting_depth = 5 # Max nesting levels
283
+ max_complexity = 15 # Cyclomatic complexity
284
+
285
+ [fix]
286
+ backup_before_fix = true # Save backups to .devnog/backups/
287
+
288
+ [dashboard]
289
+ port = 7654
290
+
291
+ [guardian]
292
+ capture_args = true
293
+ capture_locals = true
294
+ redact_patterns = ["password", "token", "secret", "key", "auth"]
295
+ ```
296
+
297
+ ---
298
+
299
+ ## Tiers
300
+
301
+ | Tier | Price | What's Included |
302
+ |------|-------|-----------------|
303
+ | **Free** | $0 forever | Scanner (38 checks), rule-based fixes, QA Gate (25 checks), observe-only Guardian, capture decorators, dashboard |
304
+ | **Pro** | Coming soon | Everything Free + Guardian auto-healing, pattern detection, healing audit log, `@healable` retry/backoff |
305
+ | **Enterprise** | Coming soon | Everything Pro + enforced team config, CI/CD scan diffs, historical trending, OWASP/SOC2 compliance reports |
306
+
307
+ Set your license key:
308
+
309
+ ```bash
310
+ export DEVNOG_LICENSE_KEY="your-key-here"
311
+ # Or save to .devnog/license.key
312
+ ```
313
+
314
+ ---
315
+
316
+ ## AI-Powered Fixes
317
+
318
+ For complex issues that can't be fixed by rules alone, DevNog uses Claude:
319
+
320
+ ```bash
321
+ pip install devnog[ai]
322
+ export ANTHROPIC_API_KEY="sk-ant-..."
323
+ devnog fix SEC-002 --ai
324
+ ```
325
+
326
+ AI fixes include confidence scores, side effect warnings, and manual follow-up steps.
327
+
328
+ ---
329
+
330
+ ## Safety
331
+
332
+ - DevNog **never modifies code** without showing you the diff first
333
+ - All fixes are **reversible** via `devnog undo`
334
+ - **Backups** saved to `.devnog/backups/` before every fix
335
+ - First time running fixes? DevNog shows **preview-only mode** with no changes applied
336
+ - The `.devnog/` directory is auto-added to `.gitignore`
337
+
338
+ ---
339
+
340
+ ## Dependencies
341
+
342
+ Only 3 required dependencies:
343
+
344
+ - `click` — CLI framework
345
+ - `rich` — Terminal formatting
346
+ - `cryptography` — Fernet encryption for capture storage
347
+
348
+ Optional extras:
349
+
350
+ ```bash
351
+ pip install devnog[ai] # anthropic — AI-powered fixes
352
+ pip install devnog[guardian] # starlette — ASGI middleware
353
+ pip install devnog[enterprise] # reportlab — PDF compliance reports
354
+ pip install devnog[all] # Everything
355
+ ```
356
+
357
+ ---
358
+
359
+ ## DevNog Pro — Coming Soon
360
+
361
+ Auto-healing runtime protection. Pattern detection across failures. Full healing audit trail.
362
+
363
+ Sign up for early access: https://devnog.dev/pro
364
+
365
+ ---
366
+
367
+ ## License
368
+
369
+ MIT License. See [LICENSE](LICENSE) for details.