codedd-cli 0.1.2__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.
Files changed (58) hide show
  1. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/PKG-INFO +12 -7
  2. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/README.md +11 -6
  3. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/__init__.py +3 -3
  4. codedd_cli-0.1.4/codedd_cli/__main__.py +60 -0
  5. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/api/client.py +4 -1
  6. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/api/endpoints.py +17 -0
  7. codedd_cli-0.1.4/codedd_cli/auditor/archetype_classifier.py +900 -0
  8. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/architecture_analyzer.py +162 -16
  9. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/file_auditor.py +690 -581
  10. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/sub_audit_runner.py +630 -601
  11. codedd_cli-0.1.4/codedd_cli/auditor/tier_definitions.py +525 -0
  12. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/vulnerability_validator.py +96 -15
  13. codedd_cli-0.1.4/codedd_cli/auth/session.py +101 -0
  14. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/cli.py +4 -0
  15. codedd_cli-0.1.4/codedd_cli/commands/ai_docs_cmd.py +1000 -0
  16. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/commands/audit_cmd.py +89 -3
  17. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/commands/auth_cmd.py +22 -1
  18. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/commands/config_cmd.py +80 -26
  19. codedd_cli-0.1.4/codedd_cli/commands/fix_cmd.py +1119 -0
  20. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/config/constants.py +4 -0
  21. codedd_cli-0.1.4/codedd_cli/config/fix_session.py +95 -0
  22. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/config/settings.py +46 -7
  23. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/llm/key_manager.py +103 -7
  24. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/scanner/file_classifier.py +0 -9
  25. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/pyproject.toml +67 -67
  26. codedd_cli-0.1.2/codedd_cli/__main__.py +0 -19
  27. codedd_cli-0.1.2/codedd_cli/auth/session.py +0 -40
  28. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/LICENSE +0 -0
  29. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/api/__init__.py +0 -0
  30. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/api/exceptions.py +0 -0
  31. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/__init__.py +0 -0
  32. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/architecture_prompts.py +0 -0
  33. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/commit_classifier.py +0 -0
  34. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/complexity_analyzer.py +0 -0
  35. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/dependency_scanner.py +0 -0
  36. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/enhanced_architecture_detectors.py +0 -0
  37. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/git_stats_collector.py +0 -0
  38. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auditor/response_parser.py +0 -0
  39. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auth/__init__.py +0 -0
  40. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/auth/token_manager.py +0 -0
  41. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/commands/__init__.py +0 -0
  42. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/commands/audits_cmd.py +0 -0
  43. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/commands/scope_cmd.py +0 -0
  44. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/config/__init__.py +0 -0
  45. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/llm/__init__.py +0 -0
  46. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/models/__init__.py +0 -0
  47. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/models/account.py +0 -0
  48. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/models/audit.py +0 -0
  49. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/models/local_directory.py +0 -0
  50. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/scanner/__init__.py +0 -0
  51. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/scanner/file_walker.py +0 -0
  52. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/scanner/line_counter.py +0 -0
  53. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/utils/__init__.py +0 -0
  54. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/utils/directory_validator.py +0 -0
  55. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/utils/display.py +0 -0
  56. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/utils/payload_inspector.py +0 -0
  57. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/utils/security.py +0 -0
  58. {codedd_cli-0.1.2 → codedd_cli-0.1.4}/codedd_cli/utils/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codedd-cli
3
- Version: 0.1.2
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
@@ -55,11 +55,11 @@ Ideal for teams who want to keep source code local while still using CodeDD’s
55
55
 
56
56
  ## Features
57
57
 
58
- - **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).
59
59
  - **Local file auditing** — LLM-based file analysis using your Anthropic or OpenAI API keys; supports batching and progress feedback.
60
60
  - **Complexity analysis** — Cyclomatic complexity and Halstead metrics (Radon/Lizard) run locally and are submitted to CodeDD.
61
61
  - **Dependency scanning** — Local lockfile/manifest and import parsing; dependency data is sent to CodeDD for vulnerability and license analysis.
62
- - **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.
63
63
  - **Payment and budget** — Pre-flight checks, LoC budget deduction, or Stripe checkout when additional payment is required.
64
64
  - **Secure auth** — CLI tokens stored in the OS credential store (Windows Credential Locker, macOS Keychain, Linux Secret Service).
65
65
 
@@ -69,7 +69,7 @@ Ideal for teams who want to keep source code local while still using CodeDD’s
69
69
 
70
70
  ### Requirements
71
71
 
72
- - **Python 3.11+**
72
+ - **Python 3.10+** (3.10–3.13 supported; see `pyproject.toml` classifiers)
73
73
  - A [CodeDD](https://codedd.ai) account and a CLI token (Account → CLI Access → Generate Token)
74
74
 
75
75
  ### From source (development)
@@ -186,7 +186,7 @@ A. Auto-sync scope -> if changed, asks to re-confirm
186
186
  B. Pre-flight on CodeDD -> checks status/payment/budget
187
187
  C. Payment path -> budget deduction OR checkout flow
188
188
  D. Local execution -> file audit (LLM), complexity, dependencies, git stats, architecture
189
- E. Submission -> sends structured outputs to CodeDD
189
+ E. Submission -> sends structured outputs to CodeDD (with retries on transient API errors)
190
190
  F. Completion -> triggers server-side consolidation/recommendations
191
191
  ```
192
192
 
@@ -206,7 +206,7 @@ Run: codedd audit start
206
206
  | File audit | Local | LLM (Anthropic/OpenAI) analyses each file; results sent to CodeDD. |
207
207
  | Complexity | Local | Radon/Lizard; metrics sent to CodeDD. |
208
208
  | Dependencies | Local + CodeDD| Lockfiles/imports scanned locally; package/vuln data stored and enriched on CodeDD. |
209
- | Git statistics | Local + CodeDD| Commit/churn/collaboration metrics collected locally, then submitted. |
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. |
210
210
  | Architecture | Local + CodeDD| Components/relations extracted locally; persisted and processed on CodeDD. |
211
211
  | Recommendations | CodeDD | Consolidation, technical debt, security, licenses, etc. |
212
212
 
@@ -245,7 +245,7 @@ Run: codedd audit start
245
245
 
246
246
  | Command | Description |
247
247
  |--------|-------------|
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. |
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). |
249
249
 
250
250
  ### Configuration
251
251
 
@@ -266,6 +266,11 @@ Run: codedd audit start
266
266
  - **Config file:** `~/.codedd/config.toml` (TOML). Stores API URL, active audit, scope directories, LLM provider, concurrency. Permissions are restricted to the owner (Unix).
267
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.
268
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
+
269
274
  ### Environment variables
270
275
 
271
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.11+**
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)
@@ -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/churn/collaboration metrics collected locally, then submitted. |
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.2"
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
- resp = self._client.request(method, path, **kwargs)
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:
@@ -44,3 +44,20 @@ class Endpoints:
44
44
 
45
45
  # Architecture analysis (Phase 1+2 run locally; server runs Phase 3 + storage)
46
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/"