codedd-cli 0.1.1__tar.gz → 0.1.4__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.
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/PKG-INFO +16 -9
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/README.md +12 -7
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/__init__.py +3 -3
- codedd_cli-0.1.4/codedd_cli/__main__.py +60 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/api/client.py +4 -1
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/api/endpoints.py +19 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/api/exceptions.py +24 -24
- codedd_cli-0.1.4/codedd_cli/auditor/archetype_classifier.py +900 -0
- codedd_cli-0.1.4/codedd_cli/auditor/architecture_analyzer.py +2335 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/auditor/architecture_prompts.py +68 -0
- codedd_cli-0.1.4/codedd_cli/auditor/commit_classifier.py +350 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/auditor/complexity_analyzer.py +374 -63
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/auditor/dependency_scanner.py +187 -101
- codedd_cli-0.1.4/codedd_cli/auditor/enhanced_architecture_detectors.py +381 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/auditor/file_auditor.py +156 -44
- codedd_cli-0.1.4/codedd_cli/auditor/git_stats_collector.py +711 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/auditor/response_parser.py +484 -484
- codedd_cli-0.1.4/codedd_cli/auditor/sub_audit_runner.py +630 -0
- codedd_cli-0.1.4/codedd_cli/auditor/tier_definitions.py +525 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/auditor/vulnerability_validator.py +186 -46
- codedd_cli-0.1.4/codedd_cli/auth/session.py +101 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/cli.py +4 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/commands/__init__.py +1 -1
- codedd_cli-0.1.4/codedd_cli/commands/ai_docs_cmd.py +1000 -0
- codedd_cli-0.1.4/codedd_cli/commands/audit_cmd.py +1377 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/commands/auth_cmd.py +22 -1
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/commands/config_cmd.py +80 -26
- codedd_cli-0.1.4/codedd_cli/commands/fix_cmd.py +1119 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/commands/scope_cmd.py +258 -19
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/config/constants.py +5 -1
- codedd_cli-0.1.4/codedd_cli/config/fix_session.py +95 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/config/settings.py +46 -7
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/llm/key_manager.py +102 -6
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/scanner/file_classifier.py +0 -9
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/utils/__init__.py +1 -1
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/utils/display.py +291 -1
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/pyproject.toml +67 -60
- codedd_cli-0.1.1/codedd_cli/__main__.py +0 -19
- codedd_cli-0.1.1/codedd_cli/auditor/architecture_analyzer.py +0 -1251
- codedd_cli-0.1.1/codedd_cli/auditor/git_stats_collector.py +0 -417
- codedd_cli-0.1.1/codedd_cli/auth/session.py +0 -40
- codedd_cli-0.1.1/codedd_cli/commands/audit_cmd.py +0 -1987
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/LICENSE +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/api/__init__.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/auditor/__init__.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/auth/__init__.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/auth/token_manager.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/commands/audits_cmd.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/config/__init__.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/llm/__init__.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/models/__init__.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/models/account.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/models/audit.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/models/local_directory.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/scanner/__init__.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/scanner/file_walker.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/scanner/line_counter.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/utils/directory_validator.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/utils/payload_inspector.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/utils/security.py +0 -0
- {codedd_cli-0.1.1 → codedd_cli-0.1.4}/codedd_cli/utils/validators.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codedd-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: CLI tool for CodeDD — run code audits from your terminal
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
Keywords: code-audit,security,cli,codedd
|
|
8
8
|
Author: CodeDD
|
|
9
|
-
Author-email:
|
|
9
|
+
Author-email: info@codedd.ai
|
|
10
10
|
Requires-Python: >=3.10,<4.0
|
|
11
11
|
Classifier: Development Status :: 3 - Alpha
|
|
12
12
|
Classifier: Environment :: Console
|
|
@@ -20,7 +20,9 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.14
|
|
21
21
|
Classifier: Topic :: Security
|
|
22
22
|
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
+
Provides-Extra: esprima
|
|
23
24
|
Requires-Dist: defusedxml (>=0.7.1)
|
|
25
|
+
Requires-Dist: esprima (>=4.0.0) ; extra == "esprima"
|
|
24
26
|
Requires-Dist: httpx (>=0.27.0)
|
|
25
27
|
Requires-Dist: keyring (>=25.0.0)
|
|
26
28
|
Requires-Dist: lizard (>=1.17.0)
|
|
@@ -53,11 +55,11 @@ Ideal for teams who want to keep source code local while still using CodeDD’s
|
|
|
53
55
|
|
|
54
56
|
## Features
|
|
55
57
|
|
|
56
|
-
- **Scope management** — Add/remove local directories, sync with CodeDD, detect changes and re-confirm scope (delta updates).
|
|
58
|
+
- **Scope management** — Add/remove local directories, sync with CodeDD, detect changes and re-confirm scope (delta updates). Removing a repo from local scope also attempts a best-effort removal of the matching repository from CodeDD when the server still has it registered (with safe fallbacks if the API is unreachable or ambiguous).
|
|
57
59
|
- **Local file auditing** — LLM-based file analysis using your Anthropic or OpenAI API keys; supports batching and progress feedback.
|
|
58
60
|
- **Complexity analysis** — Cyclomatic complexity and Halstead metrics (Radon/Lizard) run locally and are submitted to CodeDD.
|
|
59
61
|
- **Dependency scanning** — Local lockfile/manifest and import parsing; dependency data is sent to CodeDD for vulnerability and license analysis.
|
|
60
|
-
- **Architecture analysis** — Local component/relationship extraction with optional LLM enhancement; Phase 3 synthesis and storage on CodeDD.
|
|
62
|
+
- **Architecture analysis** — Local component/relationship extraction with optional LLM enhancement; additional local heuristics infer technologies, coupling, and communication-style signals (aligned with CodeDD payloads). Phase 3 synthesis and storage run on CodeDD.
|
|
61
63
|
- **Payment and budget** — Pre-flight checks, LoC budget deduction, or Stripe checkout when additional payment is required.
|
|
62
64
|
- **Secure auth** — CLI tokens stored in the OS credential store (Windows Credential Locker, macOS Keychain, Linux Secret Service).
|
|
63
65
|
|
|
@@ -67,7 +69,7 @@ Ideal for teams who want to keep source code local while still using CodeDD’s
|
|
|
67
69
|
|
|
68
70
|
### Requirements
|
|
69
71
|
|
|
70
|
-
- **Python 3.
|
|
72
|
+
- **Python 3.10+** (3.10–3.13 supported; see `pyproject.toml` classifiers)
|
|
71
73
|
- A [CodeDD](https://codedd.ai) account and a CLI token (Account → CLI Access → Generate Token)
|
|
72
74
|
|
|
73
75
|
### From source (development)
|
|
@@ -78,7 +80,7 @@ cd codedd-cli
|
|
|
78
80
|
pip install -e .
|
|
79
81
|
```
|
|
80
82
|
|
|
81
|
-
### From PyPI
|
|
83
|
+
### From PyPI
|
|
82
84
|
|
|
83
85
|
```bash
|
|
84
86
|
pip install codedd-cli
|
|
@@ -184,7 +186,7 @@ A. Auto-sync scope -> if changed, asks to re-confirm
|
|
|
184
186
|
B. Pre-flight on CodeDD -> checks status/payment/budget
|
|
185
187
|
C. Payment path -> budget deduction OR checkout flow
|
|
186
188
|
D. Local execution -> file audit (LLM), complexity, dependencies, git stats, architecture
|
|
187
|
-
E. Submission -> sends structured outputs to CodeDD
|
|
189
|
+
E. Submission -> sends structured outputs to CodeDD (with retries on transient API errors)
|
|
188
190
|
F. Completion -> triggers server-side consolidation/recommendations
|
|
189
191
|
```
|
|
190
192
|
|
|
@@ -204,7 +206,7 @@ Run: codedd audit start
|
|
|
204
206
|
| File audit | Local | LLM (Anthropic/OpenAI) analyses each file; results sent to CodeDD. |
|
|
205
207
|
| Complexity | Local | Radon/Lizard; metrics sent to CodeDD. |
|
|
206
208
|
| Dependencies | Local + CodeDD| Lockfiles/imports scanned locally; package/vuln data stored and enriched on CodeDD. |
|
|
207
|
-
| Git statistics | Local + CodeDD| Commit
|
|
209
|
+
| Git statistics | Local + CodeDD| Commit history and core repo stats collected locally and submitted; CodeDD can derive further timeline/churn views from that history. |
|
|
208
210
|
| Architecture | Local + CodeDD| Components/relations extracted locally; persisted and processed on CodeDD. |
|
|
209
211
|
| Recommendations | CodeDD | Consolidation, technical debt, security, licenses, etc. |
|
|
210
212
|
|
|
@@ -243,7 +245,7 @@ Run: codedd audit start
|
|
|
243
245
|
|
|
244
246
|
| Command | Description |
|
|
245
247
|
|--------|-------------|
|
|
246
|
-
| `codedd audit start` | Sync scope (if needed), pre-flight, pay/budget, then run full local audit and submit to CodeDD. Use `--skip-sync` to skip scope sync; `--yes` to auto-confirm; `--show` for one-shot transparency summary; `--show-interactive` for per-request confirmations (debug); `--show-force-interactive` to override large-audit guardrails; `--debug-llm` for LLM debug output. |
|
|
248
|
+
| `codedd audit start` | Sync scope (if needed), pre-flight, pay/budget, then run full local audit and submit to CodeDD. Use `--skip-sync` to skip scope sync; `--yes` to auto-confirm; `--show` for one-shot transparency summary; `--show-interactive` for per-request confirmations (debug); `--show-force-interactive` to override large-audit guardrails; `--debug-llm` for LLM debug output; `--debug-llm-full-prompt` to include the full proprietary system prompt in that output (sensitive). |
|
|
247
249
|
|
|
248
250
|
### Configuration
|
|
249
251
|
|
|
@@ -264,6 +266,11 @@ Run: codedd audit start
|
|
|
264
266
|
- **Config file:** `~/.codedd/config.toml` (TOML). Stores API URL, active audit, scope directories, LLM provider, concurrency. Permissions are restricted to the owner (Unix).
|
|
265
267
|
- **Secrets:** The CLI token and LLM API keys are stored in the system keychain (Windows Credential Locker, macOS Keychain, Linux Secret Service), not in the config file.
|
|
266
268
|
|
|
269
|
+
Optional `[audit]` keys (defaults shown) tune how long the CLI waits after opening a payment browser flow:
|
|
270
|
+
|
|
271
|
+
- `payment_poll_interval_seconds` (default `5`)
|
|
272
|
+
- `payment_poll_max_wait_seconds` (default `600`)
|
|
273
|
+
|
|
267
274
|
### Environment variables
|
|
268
275
|
|
|
269
276
|
| Variable | Purpose |
|
|
@@ -18,11 +18,11 @@ Ideal for teams who want to keep source code local while still using CodeDD’s
|
|
|
18
18
|
|
|
19
19
|
## Features
|
|
20
20
|
|
|
21
|
-
- **Scope management** — Add/remove local directories, sync with CodeDD, detect changes and re-confirm scope (delta updates).
|
|
21
|
+
- **Scope management** — Add/remove local directories, sync with CodeDD, detect changes and re-confirm scope (delta updates). Removing a repo from local scope also attempts a best-effort removal of the matching repository from CodeDD when the server still has it registered (with safe fallbacks if the API is unreachable or ambiguous).
|
|
22
22
|
- **Local file auditing** — LLM-based file analysis using your Anthropic or OpenAI API keys; supports batching and progress feedback.
|
|
23
23
|
- **Complexity analysis** — Cyclomatic complexity and Halstead metrics (Radon/Lizard) run locally and are submitted to CodeDD.
|
|
24
24
|
- **Dependency scanning** — Local lockfile/manifest and import parsing; dependency data is sent to CodeDD for vulnerability and license analysis.
|
|
25
|
-
- **Architecture analysis** — Local component/relationship extraction with optional LLM enhancement; Phase 3 synthesis and storage on CodeDD.
|
|
25
|
+
- **Architecture analysis** — Local component/relationship extraction with optional LLM enhancement; additional local heuristics infer technologies, coupling, and communication-style signals (aligned with CodeDD payloads). Phase 3 synthesis and storage run on CodeDD.
|
|
26
26
|
- **Payment and budget** — Pre-flight checks, LoC budget deduction, or Stripe checkout when additional payment is required.
|
|
27
27
|
- **Secure auth** — CLI tokens stored in the OS credential store (Windows Credential Locker, macOS Keychain, Linux Secret Service).
|
|
28
28
|
|
|
@@ -32,7 +32,7 @@ Ideal for teams who want to keep source code local while still using CodeDD’s
|
|
|
32
32
|
|
|
33
33
|
### Requirements
|
|
34
34
|
|
|
35
|
-
- **Python 3.
|
|
35
|
+
- **Python 3.10+** (3.10–3.13 supported; see `pyproject.toml` classifiers)
|
|
36
36
|
- A [CodeDD](https://codedd.ai) account and a CLI token (Account → CLI Access → Generate Token)
|
|
37
37
|
|
|
38
38
|
### From source (development)
|
|
@@ -43,7 +43,7 @@ cd codedd-cli
|
|
|
43
43
|
pip install -e .
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
### From PyPI
|
|
46
|
+
### From PyPI
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
49
|
pip install codedd-cli
|
|
@@ -149,7 +149,7 @@ A. Auto-sync scope -> if changed, asks to re-confirm
|
|
|
149
149
|
B. Pre-flight on CodeDD -> checks status/payment/budget
|
|
150
150
|
C. Payment path -> budget deduction OR checkout flow
|
|
151
151
|
D. Local execution -> file audit (LLM), complexity, dependencies, git stats, architecture
|
|
152
|
-
E. Submission -> sends structured outputs to CodeDD
|
|
152
|
+
E. Submission -> sends structured outputs to CodeDD (with retries on transient API errors)
|
|
153
153
|
F. Completion -> triggers server-side consolidation/recommendations
|
|
154
154
|
```
|
|
155
155
|
|
|
@@ -169,7 +169,7 @@ Run: codedd audit start
|
|
|
169
169
|
| File audit | Local | LLM (Anthropic/OpenAI) analyses each file; results sent to CodeDD. |
|
|
170
170
|
| Complexity | Local | Radon/Lizard; metrics sent to CodeDD. |
|
|
171
171
|
| Dependencies | Local + CodeDD| Lockfiles/imports scanned locally; package/vuln data stored and enriched on CodeDD. |
|
|
172
|
-
| Git statistics | Local + CodeDD| Commit
|
|
172
|
+
| Git statistics | Local + CodeDD| Commit history and core repo stats collected locally and submitted; CodeDD can derive further timeline/churn views from that history. |
|
|
173
173
|
| Architecture | Local + CodeDD| Components/relations extracted locally; persisted and processed on CodeDD. |
|
|
174
174
|
| Recommendations | CodeDD | Consolidation, technical debt, security, licenses, etc. |
|
|
175
175
|
|
|
@@ -208,7 +208,7 @@ Run: codedd audit start
|
|
|
208
208
|
|
|
209
209
|
| Command | Description |
|
|
210
210
|
|--------|-------------|
|
|
211
|
-
| `codedd audit start` | Sync scope (if needed), pre-flight, pay/budget, then run full local audit and submit to CodeDD. Use `--skip-sync` to skip scope sync; `--yes` to auto-confirm; `--show` for one-shot transparency summary; `--show-interactive` for per-request confirmations (debug); `--show-force-interactive` to override large-audit guardrails; `--debug-llm` for LLM debug output. |
|
|
211
|
+
| `codedd audit start` | Sync scope (if needed), pre-flight, pay/budget, then run full local audit and submit to CodeDD. Use `--skip-sync` to skip scope sync; `--yes` to auto-confirm; `--show` for one-shot transparency summary; `--show-interactive` for per-request confirmations (debug); `--show-force-interactive` to override large-audit guardrails; `--debug-llm` for LLM debug output; `--debug-llm-full-prompt` to include the full proprietary system prompt in that output (sensitive). |
|
|
212
212
|
|
|
213
213
|
### Configuration
|
|
214
214
|
|
|
@@ -229,6 +229,11 @@ Run: codedd audit start
|
|
|
229
229
|
- **Config file:** `~/.codedd/config.toml` (TOML). Stores API URL, active audit, scope directories, LLM provider, concurrency. Permissions are restricted to the owner (Unix).
|
|
230
230
|
- **Secrets:** The CLI token and LLM API keys are stored in the system keychain (Windows Credential Locker, macOS Keychain, Linux Secret Service), not in the config file.
|
|
231
231
|
|
|
232
|
+
Optional `[audit]` keys (defaults shown) tune how long the CLI waits after opening a payment browser flow:
|
|
233
|
+
|
|
234
|
+
- `payment_poll_interval_seconds` (default `5`)
|
|
235
|
+
- `payment_poll_max_wait_seconds` (default `600`)
|
|
236
|
+
|
|
232
237
|
### Environment variables
|
|
233
238
|
|
|
234
239
|
| Variable | Purpose |
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"""CodeDD CLI — run code audits from your terminal."""
|
|
2
|
-
|
|
3
|
-
__version__ = "0.1.
|
|
1
|
+
"""CodeDD CLI — run code audits from your terminal."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.1.4"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"""Allow running via ``python -m codedd_cli``."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _ensure_utf8_io() -> None:
|
|
8
|
+
"""
|
|
9
|
+
Reconfigure stdout/stderr to use UTF-8 on Windows.
|
|
10
|
+
|
|
11
|
+
PowerShell and cmd.exe default to the system code page (e.g. cp1252),
|
|
12
|
+
which causes ``UnicodeEncodeError: 'charmap' codec can't encode …``
|
|
13
|
+
whenever Rich prints Unicode symbols. Setting the streams to UTF-8
|
|
14
|
+
early — before any import triggers output — eliminates the need for
|
|
15
|
+
callers to set ``PYTHONIOENCODING=utf-8`` externally.
|
|
16
|
+
"""
|
|
17
|
+
if sys.platform != "win32":
|
|
18
|
+
return
|
|
19
|
+
|
|
20
|
+
# Env-var approach: respected by any subprocess we may spawn as well
|
|
21
|
+
os.environ.setdefault("PYTHONIOENCODING", "utf-8")
|
|
22
|
+
|
|
23
|
+
# Reconfigure the existing streams in-place (Python 3.7+)
|
|
24
|
+
for stream_name in ("stdout", "stderr"):
|
|
25
|
+
stream = getattr(sys, stream_name, None)
|
|
26
|
+
if stream is not None and hasattr(stream, "reconfigure"):
|
|
27
|
+
try:
|
|
28
|
+
stream.reconfigure(encoding="utf-8", errors="replace")
|
|
29
|
+
except Exception:
|
|
30
|
+
pass # non-standard stream (e.g. piped / pytest capture)
|
|
31
|
+
|
|
32
|
+
# Enable UTF-8 mode for the Windows console (Python 3.15+ flag;
|
|
33
|
+
# also ensures ctypes-level console code page is set).
|
|
34
|
+
try:
|
|
35
|
+
import ctypes
|
|
36
|
+
kernel32 = ctypes.windll.kernel32 # type: ignore[attr-defined]
|
|
37
|
+
kernel32.SetConsoleOutputCP(65001)
|
|
38
|
+
kernel32.SetConsoleCP(65001)
|
|
39
|
+
except Exception:
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
# Apply before importing anything that may write to the console
|
|
44
|
+
_ensure_utf8_io()
|
|
45
|
+
|
|
46
|
+
from codedd_cli.api.exceptions import CodeDDConnectionError # noqa: E402
|
|
47
|
+
from codedd_cli.cli import app # noqa: E402
|
|
48
|
+
from codedd_cli.utils.display import print_error # noqa: E402
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def main() -> None:
|
|
52
|
+
try:
|
|
53
|
+
app()
|
|
54
|
+
except CodeDDConnectionError as e:
|
|
55
|
+
print_error(str(e))
|
|
56
|
+
sys.exit(1)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
if __name__ == "__main__":
|
|
60
|
+
main()
|
|
@@ -9,6 +9,7 @@ Wraps ``httpx`` with:
|
|
|
9
9
|
- Descriptive User-Agent header
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
+
import threading
|
|
12
13
|
import time
|
|
13
14
|
from typing import Any
|
|
14
15
|
|
|
@@ -54,6 +55,7 @@ class CodeDDClient:
|
|
|
54
55
|
verify=verify_tls,
|
|
55
56
|
follow_redirects=True,
|
|
56
57
|
)
|
|
58
|
+
self._lock = threading.Lock()
|
|
57
59
|
|
|
58
60
|
def _build_headers(self) -> dict[str, str]:
|
|
59
61
|
headers: dict[str, str] = {
|
|
@@ -85,7 +87,8 @@ class CodeDDClient:
|
|
|
85
87
|
|
|
86
88
|
for attempt in range(1, MAX_RETRIES + 1):
|
|
87
89
|
try:
|
|
88
|
-
|
|
90
|
+
with self._lock:
|
|
91
|
+
resp = self._client.request(method, path, **kwargs)
|
|
89
92
|
|
|
90
93
|
# Don't retry client errors (4xx)
|
|
91
94
|
if resp.status_code < 500:
|
|
@@ -17,6 +17,7 @@ class Endpoints:
|
|
|
17
17
|
# Scope
|
|
18
18
|
REGISTER_SCOPE = "/api/cli/scope/register/"
|
|
19
19
|
SCOPE_FILES = "/api/cli/scope/files/"
|
|
20
|
+
DELETE_REPO_FROM_SCOPE = "/delete_repo_from_scope/"
|
|
20
21
|
|
|
21
22
|
# Audit lifecycle
|
|
22
23
|
AUDIT_CAN_START = "/api/cli/audit/can-start/"
|
|
@@ -38,7 +39,25 @@ class Endpoints:
|
|
|
38
39
|
|
|
39
40
|
# Local git statistics (for CLI-driven audits; enables dashboards)
|
|
40
41
|
AUDIT_GIT_STATISTICS = "/api/cli/audit/git-statistics/"
|
|
42
|
+
AUDIT_GIT_DEVELOPMENT_ANALYSIS = "/api/cli/audit/git-development-analysis/"
|
|
41
43
|
AUDIT_VULNERABILITY_VALIDATION = "/api/cli/audit/vulnerability-validation/"
|
|
42
44
|
|
|
43
45
|
# Architecture analysis (Phase 1+2 run locally; server runs Phase 3 + storage)
|
|
44
46
|
AUDIT_ARCHITECTURE = "/api/cli/audit/architecture/"
|
|
47
|
+
|
|
48
|
+
# LLM model tracking (records which model(s) were used during local file auditing)
|
|
49
|
+
AUDIT_LLM_MODEL = "/api/cli/audit/llm-model/"
|
|
50
|
+
|
|
51
|
+
# Fix workflow
|
|
52
|
+
FIX_OVERVIEW = "/api/cli/fix/overview/"
|
|
53
|
+
FIX_FLAGS_NEXT = "/api/cli/fix/flags/next/"
|
|
54
|
+
FIX_VULNS_NEXT = "/api/cli/fix/vulns/next/"
|
|
55
|
+
FIX_VULNS_AFFECTED_FILES = "/api/cli/fix/vulns/affected-files/"
|
|
56
|
+
FIX_STATUS = "/api/cli/fix/status/"
|
|
57
|
+
FIX_COMMENT = "/api/cli/fix/comment/"
|
|
58
|
+
FIX_RESOLVE = "/api/cli/fix/resolve/"
|
|
59
|
+
FIX_INVALIDATE = "/api/cli/fix/invalidate/"
|
|
60
|
+
|
|
61
|
+
# Fix access control (remediation module)
|
|
62
|
+
FIX_ACCESS_STATUS = "/api/cli/fix/access/status/"
|
|
63
|
+
FIX_ACCESS_TOGGLE = "/api/cli/fix/access/toggle/"
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
"""
|
|
2
|
-
API-layer exceptions with user-facing messages.
|
|
3
|
-
|
|
4
|
-
Raised when the CLI cannot reach the CodeDD server (connection refused,
|
|
5
|
-
timeout, server disconnected, etc.). Handled at the CLI entry point to
|
|
6
|
-
display a single, clear message instead of a full traceback.
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
# Pre-defined message shown when the remote is not responding.
|
|
10
|
-
CONNECTION_ERROR_MESSAGE = (
|
|
11
|
-
"Unable to reach CodeDD. "
|
|
12
|
-
"Check that the server is running and your network connection is available, "
|
|
13
|
-
"or try again later."
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class CodeDDConnectionError(Exception):
|
|
18
|
-
"""
|
|
19
|
-
Raised when a request to the CodeDD API fails due to connection
|
|
20
|
-
or transport errors (e.g. server not responding, timeout, disconnect).
|
|
21
|
-
"""
|
|
22
|
-
|
|
23
|
-
def __init__(self, message: str | None = None) -> None:
|
|
24
|
-
super().__init__(message or CONNECTION_ERROR_MESSAGE)
|
|
1
|
+
"""
|
|
2
|
+
API-layer exceptions with user-facing messages.
|
|
3
|
+
|
|
4
|
+
Raised when the CLI cannot reach the CodeDD server (connection refused,
|
|
5
|
+
timeout, server disconnected, etc.). Handled at the CLI entry point to
|
|
6
|
+
display a single, clear message instead of a full traceback.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
# Pre-defined message shown when the remote is not responding.
|
|
10
|
+
CONNECTION_ERROR_MESSAGE = (
|
|
11
|
+
"Unable to reach CodeDD. "
|
|
12
|
+
"Check that the server is running and your network connection is available, "
|
|
13
|
+
"or try again later."
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CodeDDConnectionError(Exception):
|
|
18
|
+
"""
|
|
19
|
+
Raised when a request to the CodeDD API fails due to connection
|
|
20
|
+
or transport errors (e.g. server not responding, timeout, disconnect).
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, message: str | None = None) -> None:
|
|
24
|
+
super().__init__(message or CONNECTION_ERROR_MESSAGE)
|