devdoctor-cli 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,382 @@
1
+ Metadata-Version: 2.4
2
+ Name: devdoctor-cli
3
+ Version: 0.1.0
4
+ Summary: Deterministic developer machine and project diagnostic doctor.
5
+ Author: Souran Jash
6
+ License-Expression: MIT
7
+ Keywords: developer-tools,diagnostics,cli,linting,debugging,environment
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Topic :: Software Development :: Quality Assurance
17
+ Classifier: Topic :: System :: Systems Administration
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: rich>=13.0.0
22
+ Requires-Dist: packaging>=21.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
25
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
26
+ Dynamic: license-file
27
+
28
+ # DevDoctor 🩺
29
+
30
+ > **Deterministic developer machine & project diagnostic doctor.**
31
+ > *Scan your machine/project β†’ Run diagnostic checks β†’ Identify problems β†’ Explain WHY β†’ Give a safe FIX β†’ Generate reports.*
32
+
33
+ DevDoctor is a CLI-first, deterministic Python tool that inspects your development environment, detects misconfigurations, explains the root cause with evidence, and provides safe, actionable remediations. **No AI chatbot guesswork, no hallucinationsβ€”purely deterministic diagnostics.**
34
+
35
+ ---
36
+
37
+ ## πŸš€ Quick Start
38
+
39
+ ### Installation
40
+
41
+ ```bash
42
+ # Install via pip
43
+ pip install devdoctor
44
+
45
+ # Or install locally in editable mode
46
+ git clone https://github.com/your-org/devdoctor.git
47
+ cd devdoctor
48
+ pip install -e .
49
+ ```
50
+
51
+ ### Run DevDoctor
52
+
53
+ ```bash
54
+ # Scan current directory / project
55
+ devdoctor
56
+
57
+ # Or explicitly
58
+ devdoctor scan
59
+ ```
60
+
61
+ ---
62
+
63
+ ## πŸ“Ί Example Output
64
+
65
+ ```text
66
+ $ devdoctor scan
67
+
68
+ DevDoctor 0.1.0
69
+ Project: Django + PostgreSQL + Docker
70
+ ────────────────────────────
71
+
72
+ βœ“ Python 3.12.10
73
+ βœ“ pip 25.0.1
74
+ βœ“ Git 2.55.0
75
+
76
+ ❌ Virtual environment
77
+ Current shell is not using a virtual environment.
78
+
79
+ Active interpreter is global: C:\Program Files\Python312\python.exe
80
+
81
+ Fix:
82
+ Windows:
83
+ .venv\Scripts\activate
84
+
85
+ ⚠ Port 8000
86
+ Port is already occupied.
87
+
88
+ Process: python.exe
89
+ PID: 18420
90
+
91
+ Fix:
92
+ devdoctor port free 8000
93
+
94
+ ❌ Environment variable
95
+ DATABASE_URL is required but missing.
96
+
97
+ Found in:
98
+ settings.py (line 24)
99
+
100
+ Fix:
101
+ Add DATABASE_URL to .env
102
+
103
+ Score: 72/100
104
+
105
+ 3 problems found.
106
+ ```
107
+
108
+ ---
109
+
110
+ ## 🧠 Diagnostic Structure
111
+
112
+ Every single DevDoctor diagnostic follows a strict, high-signal structure:
113
+
114
+ ```text
115
+ PROBLEM
116
+ ↓
117
+ WHY IT HAPPENED
118
+ ↓
119
+ EVIDENCE
120
+ ↓
121
+ SAFE FIX
122
+ ↓
123
+ COMMAND
124
+ ```
125
+
126
+ Run with `--verbose` to view the comprehensive breakdown:
127
+
128
+ ```text
129
+ $ devdoctor scan --verbose
130
+
131
+ ❌ Pydantic installation problem
132
+
133
+ PROBLEM:
134
+ Incompatible version of pydantic-core installed for Python runtime.
135
+
136
+ WHY:
137
+ Your Python version is 3.13 and requires a compatible wheel.
138
+
139
+ EVIDENCE:
140
+ pydantic-core does not have a compatible wheel for your current environment.
141
+
142
+ SAFE FIX:
143
+ Use Python 3.12 for this project.
144
+
145
+ COMMAND:
146
+ py -3.12 -m venv .venv
147
+
148
+ Confidence: HIGH
149
+ ```
150
+
151
+ ---
152
+
153
+ ## πŸ› οΈ The First 10 Diagnostic Checks
154
+
155
+ | # | Check | Description |
156
+ |---|---|---|
157
+ | **1** | **Python Version** | Validates active interpreter against `pyproject.toml` (`requires-python`), `.python-version`, or `runtime.txt`. |
158
+ | **2** | **pip Availability** | Validates pip installation, version, and bootstrap status. |
159
+ | **3** | **Virtual Environment** | Confirms whether shell is operating inside an active venv; provides exact platform activation command. |
160
+ | **4** | **Git Availability** | Verifies Git CLI is installed and in PATH. |
161
+ | **5** | **Git Configuration** | Checks `user.name` and `user.email`; audits `.gitignore` to ensure `.env` and sensitive files are not committed. |
162
+ | **6** | **Required Environment Variables** | Uses Python AST to detect unfulfilled `os.environ[...]` lookups without defaults. |
163
+ | **7** | **.env vs .env.example** | Diffs template keys against your `.env` to prevent runtime configuration crashes. |
164
+ | **8** | **Port Conflicts** | Scans web dev ports (8000, 3000, 5000, 5173, etc.); maps occupied ports to process name & PID. |
165
+ | **9** | **Broken Python Imports** | Scans Python code using AST and flags uninstalled third-party packages in site-packages. |
166
+ | **10** | **Dependency Conflicts** | Runs deterministic graph checks and `pip check` to detect version conflicts (e.g., `fastapi` vs `pydantic<3`). |
167
+
168
+ ---
169
+
170
+ ## πŸ” Project Understanding (Phase 3)
171
+
172
+ DevDoctor inspects your repository and automatically determines its stack without requiring AI:
173
+
174
+ - Detects `manage.py` β†’ **Django**
175
+ - Detects `fastapi` in dependencies or code β†’ **FastAPI**
176
+ - Detects `flask` in dependencies or code β†’ **Flask**
177
+ - Detects `Dockerfile` / `docker-compose.yml` β†’ **Docker**
178
+ - Detects PostgreSQL connection strings / psycopg β†’ **PostgreSQL**
179
+ - Detects Redis configuration / compose service β†’ **Redis**
180
+ - Detects `package.json` β†’ **Node.js**
181
+
182
+ ```bash
183
+ $ devdoctor project
184
+
185
+ Project Profile: my-web-app
186
+ ──────────────────────────────────────────
187
+ Detected Type: Django
188
+ Stack Summary: Django + PostgreSQL + Redis + Docker
189
+ Technologies: Python, Django, PostgreSQL, Redis, Docker
190
+ Frameworks: Django
191
+ Config Files: pyproject.toml, docker-compose.yml, .env
192
+ Dependencies: 24 declared
193
+ ```
194
+
195
+ ---
196
+
197
+ ## ⚑ Framework-Specific Diagnostics (Phase 4)
198
+
199
+ DevDoctor includes dedicated diagnostic suites for major frameworks:
200
+
201
+ ```bash
202
+ # Django diagnostics: DEBUG mode, insecure SECRET_KEY, empty ALLOWED_HOSTS, unapplied migrations
203
+ devdoctor django
204
+
205
+ # FastAPI diagnostics: Uvicorn status, default port 8000, reload flag, CORS wildcard check
206
+ devdoctor fastapi
207
+
208
+ # Docker diagnostics: daemon accessibility, exited container error codes, compose port collisions
209
+ devdoctor docker
210
+
211
+ # PostgreSQL diagnostics: port 5432 status, connection string format
212
+ devdoctor postgres
213
+
214
+ # Redis diagnostics: port 6379 status, RESP PING response test
215
+ devdoctor redis
216
+ ```
217
+
218
+ ---
219
+
220
+ ## 🧰 The Killer Feature: `devdoctor fix` (Phase 5)
221
+
222
+ Never blindly modify a developer's machine. DevDoctor clearly separates **Safe automatic fixes** from **Action-required fixes**.
223
+
224
+ ### Interactive Fix Prompt
225
+
226
+ ```bash
227
+ $ devdoctor fix
228
+
229
+ Found 3 problem(s) with available fixes:
230
+
231
+ 1. [SAFE] Add .env to .gitignore
232
+ Command: echo .env >> .gitignore
233
+ 2. [SAFE] Copy .env.example to .env
234
+ Command: copy .env.example .env
235
+ 3. [ACTION] Kill process python.exe (PID: 18420) on port 8000
236
+ Command: devdoctor port free 8000
237
+
238
+ Apply fixes? [Y/n]: Y
239
+
240
+ Applying fixes...
241
+
242
+ βœ“ Fixed: Add .env to .gitignore
243
+ βœ“ Fixed: Copy .env.example to .env
244
+ βœ“ Fixed: Kill process python.exe (PID: 18420) on port 8000
245
+
246
+ Completed: 3 applied, 0 failed.
247
+ ```
248
+
249
+ ### Safe-Only Automation (CI / Scripts)
250
+
251
+ Apply only safe, non-destructive fixes without touching running processes or external installations:
252
+
253
+ ```bash
254
+ devdoctor fix --safe
255
+ ```
256
+
257
+ ### Dry Run
258
+
259
+ Preview all proposed remediations without executing anything:
260
+
261
+ ```bash
262
+ devdoctor fix --dry-run
263
+ ```
264
+
265
+ ### Standalone Port Free Utility
266
+
267
+ Easily free up an occupied port with PID and process name resolution:
268
+
269
+ ```bash
270
+ devdoctor port free 8000 --yes
271
+ ```
272
+
273
+ ---
274
+
275
+ ## πŸ”Œ Extensible Plugin Engine (Phase 6)
276
+
277
+ DevDoctor can be extended with custom checks via the `@check` decorator or Python entry points (`devdoctor.checks`).
278
+
279
+ ### Writing a Custom Check
280
+
281
+ Create a Python file in your project under `.devdoctor/checks/my_check.py` or inside an installable package:
282
+
283
+ ```python
284
+ from devdoctor import check, Diagnostic, ScanContext, Severity
285
+
286
+ @check(name="internal_api", title="Internal API Gateway", category="network")
287
+ def check_internal_api(context: ScanContext) -> Diagnostic | None:
288
+ api_url = context.env_vars.get("INTERNAL_API_URL")
289
+ if not api_url:
290
+ return Diagnostic(
291
+ title="Internal API Gateway",
292
+ severity=Severity.ERROR,
293
+ message="INTERNAL_API_URL is missing in environment.",
294
+ why="Microservices require INTERNAL_API_URL to reach the auth cluster.",
295
+ fix="Add INTERNAL_API_URL=https://api.internal to .env",
296
+ command="echo INTERNAL_API_URL=https://api.internal >> .env",
297
+ )
298
+ return Diagnostic(
299
+ title="Internal API Gateway",
300
+ severity=Severity.OK,
301
+ message=f"Configured: {api_url}",
302
+ )
303
+ ```
304
+
305
+ DevDoctor will automatically discover and execute your custom check!
306
+
307
+ ---
308
+
309
+ ## 🐍 Python API
310
+
311
+ Integrate DevDoctor diagnostics directly into your Python scripts, pytest test suites, or tooling:
312
+
313
+ ```python
314
+ from devdoctor import DevDoctor
315
+
316
+ doctor = DevDoctor(project_path=".")
317
+
318
+ # Run scan
319
+ report = doctor.scan()
320
+
321
+ print(f"Health Score: {report.score}/100")
322
+ print(f"Total Problems: {report.total_problems}")
323
+
324
+ for problem in report.problems:
325
+ print(f"[{problem.severity.value}] {problem.title}: {problem.message}")
326
+
327
+ # Apply safe fixes automatically
328
+ if not report.is_healthy:
329
+ doctor.fix(safe_only=True)
330
+ ```
331
+
332
+ ---
333
+
334
+ ## πŸ€– CI/CD Integration & Reporting
335
+
336
+ Export machine-readable JSON or GitHub-flavored Markdown for CI/CD checks:
337
+
338
+ ```bash
339
+ # Output JSON for pipeline evaluation
340
+ devdoctor scan --json
341
+
342
+ # Fail build if errors or warnings exist
343
+ devdoctor scan --strict
344
+
345
+ # Export Markdown report for PR comment
346
+ devdoctor report --format markdown -o report.md
347
+ ```
348
+
349
+ ---
350
+
351
+ ## πŸ“‹ CLI Reference
352
+
353
+ ```text
354
+ devdoctor [scan] [PATH] Scan machine and project (default command)
355
+ --json Output report in JSON format
356
+ --markdown Output report in Markdown format
357
+ -v, --verbose Show detailed WHY/EVIDENCE/FIX/COMMAND breakdown
358
+ -o, --output FILE Save report to file
359
+ --strict Exit with code 1 on warnings or errors
360
+ --checks-dir DIR Load custom check plugins from directory
361
+
362
+ devdoctor fix [PATH] Apply fixes for identified issues
363
+ --safe Apply only safe non-destructive fixes
364
+ --dry-run Show planned fixes without applying changes
365
+ -y, --yes Confirm all fixes non-interactively
366
+
367
+ devdoctor dependencies [PATH] Check dependency conflicts and broken imports
368
+ devdoctor port free <PORT> [-y] Kill process listening on specified port
369
+ devdoctor project [PATH] Inspect detected project profile and tech stack
370
+ devdoctor report [PATH] Export diagnostic report (terminal/markdown/json)
371
+ devdoctor django [PATH] Run Django-specific diagnostics
372
+ devdoctor fastapi [PATH] Run FastAPI-specific diagnostics
373
+ devdoctor docker [PATH] Run Docker-specific diagnostics
374
+ devdoctor postgres [PATH] Run PostgreSQL-specific diagnostics
375
+ devdoctor redis [PATH] Run Redis-specific diagnostics
376
+ ```
377
+
378
+ ---
379
+
380
+ ## πŸ“„ License
381
+
382
+ MIT License. See [LICENSE](LICENSE) for details.
@@ -0,0 +1,37 @@
1
+ devdoctor/__init__.py,sha256=xbnqWvtUw864v7Fz1sJ5NxHrSOuQ4F7Id4yk3ZhSZmo,906
2
+ devdoctor/__main__.py,sha256=aOaylG-TuVvKY6OArZhYUA1eTJds2fDLhbQROrkisgc,156
3
+ devdoctor/api.py,sha256=0swi86ZahcO9CtaizW6xqU-wBIFeAdDDVru4PS3IieU,2908
4
+ devdoctor/cli.py,sha256=5Ru-cJbg81kKmnmuRBmn-ufsqxVRZDJ2VcFTIJcUY-s,13096
5
+ devdoctor/fixer.py,sha256=vOD774wM8lvgCRWHvW34T6oYh2FzZess5YhatLnAdYw,5994
6
+ devdoctor/models.py,sha256=Xq3PRO5tCrMA0QS_M3rsmhXQG9Hu1yTbpSfhToADGwE,8700
7
+ devdoctor/plugin.py,sha256=ythkIu1rSjDqHxnuZWnSvjhlUdosVJ_9kDmgNqfsn0U,3117
8
+ devdoctor/project.py,sha256=l3G6Es7M-9n9Ea04PoOqmlNvH1MqJn3-1LA5l4Unyj4,7279
9
+ devdoctor/reporter.py,sha256=5DmMdHJpa1Og9lK3xP5sDt13VGO3Pf-oRn-U9HBX8pU,7842
10
+ devdoctor/scanner.py,sha256=H6HpBIHUSCKKgzPZujJIz-QgZ3H-KbxKZ7WuL4TvJ9w,4214
11
+ devdoctor/checks/__init__.py,sha256=6SlkF4OkwNd3zX2DRyTDjqwBl7anfVvn2oWyaD5srQU,1286
12
+ devdoctor/checks/base.py,sha256=lsCSGxMWLU4Iv4yRRXIoHsQdof1kGNqk1DYMV12YF48,2299
13
+ devdoctor/checks/dependencies.py,sha256=BcLkHGq7rJt90rrJVGavUzqTxk7Qg7RcBYeGJtNMfpE,6036
14
+ devdoctor/checks/django.py,sha256=gcAoBliTjE7shWMKolOeBQJMTljx7i5eUcPydmMUgzQ,6159
15
+ devdoctor/checks/docker.py,sha256=27ZH3fSCLfDllPr42y-sjWCao-cspXN5jrLxEJRbvbw,5771
16
+ devdoctor/checks/environment.py,sha256=o8pmKDL-6yWK-EwPNNrgURugWA40GjuEOP9DgVs2-J8,6517
17
+ devdoctor/checks/fastapi.py,sha256=QPNCFNjTxlxkcGsltij6y0q5KGrlobClK7gINHXkh80,4164
18
+ devdoctor/checks/filesystem.py,sha256=fPN0OnrttySMJ4dth8noSV35emFTlSqObV1vqTKjHvU,3043
19
+ devdoctor/checks/git.py,sha256=tjPcCzB1SDmCRHyawP2Qy5uE_W6ia8DmY2CCwVB0EVU,7132
20
+ devdoctor/checks/imports.py,sha256=jHfbRUsrUHq6tW4nq-oDbP2jgaBmUx5EG0qUqHcwDJs,1924
21
+ devdoctor/checks/pip.py,sha256=cYQf_r59q7Dkw59TZVmh1jas4CProww_o8Q9u98PDLE,2755
22
+ devdoctor/checks/ports.py,sha256=wA1Wxe0DMzFlUqlPkYxhXVJ_KogDyNXjvFWIl5ZTtIQ,3564
23
+ devdoctor/checks/postgres.py,sha256=4LGofF9c9V4le8bTy4CvOeVdOsPNT_KnKGJ9lyNAjJo,2866
24
+ devdoctor/checks/python.py,sha256=qcc8Uc6QzR8UHNRSB0XeqxHmN76MgOBfneZVuVK1PoE,4455
25
+ devdoctor/checks/redis.py,sha256=e7d1M4ora7Iv1g2uEdhSxYKQKUV26EdfHkFm2RmooHg,2637
26
+ devdoctor/checks/virtualenv.py,sha256=6RFFfpKoAPH4Dvjtwijz_xXaakN-TkFVfQeimfWs8Qw,2954
27
+ devdoctor/utils/__init__.py,sha256=YrU3Mr0p9k7VUbTHPqCbtsR-aQnbUY3_mB6N6McnHGI,37
28
+ devdoctor/utils/ast_imports.py,sha256=2xNBiiSpsGi9_IxnuN1ldlKXk05fPokLM5lxTSxUjAk,7703
29
+ devdoctor/utils/env_parser.py,sha256=ujZs7NbmiJdho0M9tjlaM4HjFBr7GUg2X0e3A4gbbkI,1967
30
+ devdoctor/utils/platform_info.py,sha256=FDmhRhMQV3I5CsQ_HqwrXmF41JPWGPji98d_li_rx0M,2525
31
+ devdoctor/utils/process_utils.py,sha256=cOTFkeVdNqO0iIDDsqhlMy-qaLYUo6BcThP9zmV0w_E,5680
32
+ devdoctor_cli-0.1.0.dist-info/licenses/LICENSE,sha256=aUnJ2ckD0vO08wkntOzdZ9Dt5yX-4ic_UwQhwcJdqNE,1067
33
+ devdoctor_cli-0.1.0.dist-info/METADATA,sha256=-elzGyrC_Rulaq_zwb7rP_K1EiOL2EsoKc7qAFlz_F0,11487
34
+ devdoctor_cli-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
35
+ devdoctor_cli-0.1.0.dist-info/entry_points.txt,sha256=39PIHelOZ6Hxkvsn93byTVD-gwpmKCqwKgWrcKXDFFY,49
36
+ devdoctor_cli-0.1.0.dist-info/top_level.txt,sha256=3nH0Vv5-Arsjb8AS6nFK6Q3-BXKQRKu0cmTHW6T0Hlo,10
37
+ devdoctor_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ devdoctor = devdoctor.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Souran Jash
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 @@
1
+ devdoctor