codedd-cli 0.1.8__tar.gz → 0.1.10__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.8 → codedd_cli-0.1.10}/PKG-INFO +79 -5
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/README.md +77 -3
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/__init__.py +1 -1
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/archetype_classifier.py +232 -6
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/architecture_analyzer.py +368 -73
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/MANIFEST.json +8 -4
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/enhanced_technology_detector.py +81 -3
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/repo_kind.py +5 -0
- codedd_cli-0.1.10/codedd_cli/auditor/server_parity/taxonomy.py +500 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auth/session.py +24 -8
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/cli.py +3 -2
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/commands/ai_docs_cmd.py +129 -31
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/commands/audit_cmd.py +10 -4
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/commands/auth_cmd.py +81 -41
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/commands/config_cmd.py +7 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/commands/fix_cmd.py +578 -91
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/commands/scope_cmd.py +86 -6
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/llm/anthropic_utils.py +4 -5
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/llm/key_manager.py +37 -8
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/pyproject.toml +3 -2
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/LICENSE +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/__main__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/api/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/api/client.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/api/endpoints.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/api/exceptions.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/architecture_prompts.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/architecture_schema_contract.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/audit_checkpoint.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/audit_progress_sync.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/commit_classifier.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/complexity_analyzer.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/cross_repo_evidence.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/dependency_scanner.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/file_auditor.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/git_stats_collector.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/parity_overrides.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/response_parser.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/enhanced_relationship_detector.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/evidence_extractor.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/infra_scan.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/manifest_coordinate_resolver.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/published_identity.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/repo_file.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/tech_normalizer.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/technology_lists.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/server_parity/tier_definitions.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/sub_audit_runner.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/tier_definitions.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/agents.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/cli_ai_auditor.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/cli_orchestrator.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/cli_settings.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/file_io.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/_generic.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/c_cpp.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/csharp.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/go.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/java.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/js_ts.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/kotlin.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/php.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/ruby.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/rust.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/scala.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/shell.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/swift.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_ast/taint.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/lang_snippets.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/langgraph_runner.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/planner.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/prompts.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/scope.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/security_patterns.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/semgrep_runner.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/state.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_analysis/tools.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auditor/vulnerability_validator.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auth/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/auth/token_manager.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/commands/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/commands/audits_cmd.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/config/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/config/constants.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/config/fix_session.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/config/settings.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/config/url_validation.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/llm/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/models/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/models/account.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/models/audit.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/models/local_directory.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/scanner/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/scanner/file_classifier.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/scanner/file_walker.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/scanner/line_counter.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/utils/__init__.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/utils/directory_validator.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/utils/display.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/utils/payload_inspector.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/utils/safe_path.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/codedd_cli/utils/security.py +0 -0
- {codedd_cli-0.1.8 → codedd_cli-0.1.10}/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.
|
|
3
|
+
Version: 0.1.10
|
|
4
4
|
Summary: CLI tool for CodeDD — run code audits from your terminal
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -32,7 +32,7 @@ Requires-Dist: radon (>=6.0.0)
|
|
|
32
32
|
Requires-Dist: rich (>=13.0.0)
|
|
33
33
|
Requires-Dist: tomli (>=2.0.0) ; python_version < "3.11"
|
|
34
34
|
Requires-Dist: tomli-w (>=1.0.0)
|
|
35
|
-
Requires-Dist: typer
|
|
35
|
+
Requires-Dist: typer (>=0.9.0)
|
|
36
36
|
Project-URL: Homepage, https://codedd.ai
|
|
37
37
|
Project-URL: Repository, https://gitlab.com/codedd1/codedd-cli
|
|
38
38
|
Description-Content-Type: text/markdown
|
|
@@ -62,6 +62,7 @@ Ideal for teams who want to keep source code local while still using CodeDD’s
|
|
|
62
62
|
- **Complexity analysis** — Cyclomatic complexity and Halstead metrics (Radon/Lizard) run locally and are submitted to CodeDD.
|
|
63
63
|
- **Dependency scanning** — Local lockfile/manifest and import parsing; dependency data is sent to CodeDD for vulnerability and license analysis.
|
|
64
64
|
- **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.
|
|
65
|
+
- **Issue remediation (`codedd fix`)** — Work through audit flags and dependency vulnerabilities from the terminal: fetch overviews, get the next issue by priority, record progress, mark resolved, and scope to a repo or Issue Compass saved list. Designed for interactive use and AI-agent workflows (`context`, `summarize`, `--json`).
|
|
65
66
|
- **Payment and budget** — Pre-flight checks, LoC budget deduction, or Stripe checkout when additional payment is required.
|
|
66
67
|
- **Secure auth** — CLI tokens stored in the OS credential store (Windows Credential Locker, macOS Keychain, Linux Secret Service).
|
|
67
68
|
|
|
@@ -94,6 +95,8 @@ Verify:
|
|
|
94
95
|
codedd --version
|
|
95
96
|
```
|
|
96
97
|
|
|
98
|
+
On Linux, the OS credential store needs a Secret Service provider such as gnome-keyring or KWallet (typically present on desktop environments). Headless servers, containers, and CI runners generally do not; use environment variables instead of `codedd auth login` / `codedd config set-key` (see [Environment variables](#environment-variables)).
|
|
99
|
+
|
|
97
100
|
---
|
|
98
101
|
|
|
99
102
|
## Quick start (recommended workflow)
|
|
@@ -108,6 +111,8 @@ codedd auth login --token <your_token>
|
|
|
108
111
|
|
|
109
112
|
Or run `codedd auth login` and paste the token when prompted.
|
|
110
113
|
|
|
114
|
+
On headless Linux or in CI, skip login and export `CODEDD_API_TOKEN` instead (see [Environment variables](#environment-variables)).
|
|
115
|
+
|
|
111
116
|
Optional sanity check:
|
|
112
117
|
|
|
113
118
|
```bash
|
|
@@ -145,6 +150,8 @@ codedd config set-key anthropic
|
|
|
145
150
|
# or: codedd config set-key openai
|
|
146
151
|
```
|
|
147
152
|
|
|
153
|
+
Alternatively, export a provider key (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `XAI_API_KEY`, or the `CODEDD_*` equivalents). Environment variables take precedence over the keychain.
|
|
154
|
+
|
|
148
155
|
Optional (recommended if both are configured):
|
|
149
156
|
|
|
150
157
|
```bash
|
|
@@ -166,6 +173,35 @@ The CLI will:
|
|
|
166
173
|
|
|
167
174
|
Results and recommendations are available in the CodeDD dashboard; you can also run `codedd audits list` to see status.
|
|
168
175
|
|
|
176
|
+
### 6. Fix issues (optional, after audit completes)
|
|
177
|
+
|
|
178
|
+
Once an audit has finished and remediation data is available on CodeDD, use `codedd fix` to work through flags and vulnerabilities locally:
|
|
179
|
+
|
|
180
|
+
**Group / portfolio audit** (multiple repos):
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
codedd fix status # repos ranked by severity
|
|
184
|
+
codedd fix repo my-service # scope to one repository
|
|
185
|
+
codedd fix flags next --auto # next unresolved flag (red first)
|
|
186
|
+
codedd fix resolve --comment "Fixed null check in auth handler"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Single-repo audit:**
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
codedd fix fetch flags
|
|
193
|
+
codedd fix flags next --auto
|
|
194
|
+
codedd fix resolve --comment "Updated lodash to 4.17.21"
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
`codedd fix resolve` records the comment, marks the issue fixed, and prints the next one, so the remediation loop is a single command per issue. Repeat it until the output shows `QUEUE EMPTY`.
|
|
198
|
+
|
|
199
|
+
For dependency vulnerabilities, swap `flags` for `vulns` (`codedd fix fetch vulns`, `codedd fix vulns next --auto`, `codedd fix vulns affected-files <package>`).
|
|
200
|
+
|
|
201
|
+
Issue Compass saved lists from the web UI can narrow flag remediation: `codedd fix selections list`, then `codedd fix selections use <n>`.
|
|
202
|
+
|
|
203
|
+
Run `codedd ai-docs fix` for the full remediation reference (AI-agent workflows, JSON output, access controls).
|
|
204
|
+
|
|
169
205
|
---
|
|
170
206
|
|
|
171
207
|
## Workflow overview
|
|
@@ -248,6 +284,32 @@ Run: codedd audit start
|
|
|
248
284
|
| Command | Description |
|
|
249
285
|
|--------|-------------|
|
|
250
286
|
| `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). |
|
|
287
|
+
| `codedd audit status` | Show pipeline step progress for an active or resumable audit. |
|
|
288
|
+
|
|
289
|
+
### Issue remediation (`codedd fix`)
|
|
290
|
+
|
|
291
|
+
Requires a completed audit with remediation data on CodeDD. Select the audit first (`codedd audits select`).
|
|
292
|
+
|
|
293
|
+
| Command | Description |
|
|
294
|
+
|--------|-------------|
|
|
295
|
+
| `codedd fix status [--json]` | Dashboard of open flags/vulns; repos ranked by severity in group audits |
|
|
296
|
+
| `codedd fix repo [name\|uuid]` | Scope fix workflow to one sub-audit (group audits) |
|
|
297
|
+
| `codedd fix fetch flags\|vulns` | Load issue overview (interactive sub-audit pick when needed) |
|
|
298
|
+
| `codedd fix flags next [--auto] [--json]` | Next unresolved flag; `--auto` prioritizes red issues |
|
|
299
|
+
| `codedd fix flags invalidate [--reason "<text>"]` | Mark current flag as invalid and advance |
|
|
300
|
+
| `codedd fix vulns next [--auto] [--severity S] [--used-only] [--json]` | Next vulnerability; `--auto` prioritizes critical |
|
|
301
|
+
| `codedd fix vulns affected-files <package> [--json]` | List local files importing a vulnerable package |
|
|
302
|
+
| `codedd fix resolve [--comment "<text>"]` | Record progress, mark resolved, and print the next issue |
|
|
303
|
+
| `codedd fix comment "<text>"` | Record progress without resolving |
|
|
304
|
+
| `codedd fix context [--json]` / `summarize` | Session snapshot for AI agents |
|
|
305
|
+
| `codedd fix selections list\|show\|use\|clear` | Issue Compass saved flag lists from the web UI |
|
|
306
|
+
| `codedd fix access status\|enable\|disable\|activate\|deactivate` | Remediation Module access (org initiator) |
|
|
307
|
+
|
|
308
|
+
Comment text can also be supplied with `--comment-file <path>` or on stdin (`codedd fix comment -`), which avoids shell quoting for multi-line or quote-heavy notes.
|
|
309
|
+
|
|
310
|
+
**Exit codes** (for scripted and AI-agent loops): `0` issue delivered or action succeeded, `1` error, `3` no unresolved issues left in the current scope. Commands that deliver an issue also print a loop protocol block — the remaining count, the exact next command, and the stop condition — on every invocation, so long remediation runs do not depend on the instruction surviving in an agent's context window.
|
|
311
|
+
|
|
312
|
+
See `codedd ai-docs fix` for detailed examples and agent integration patterns.
|
|
251
313
|
|
|
252
314
|
### Configuration
|
|
253
315
|
|
|
@@ -266,7 +328,7 @@ Run: codedd audit start
|
|
|
266
328
|
## Configuration
|
|
267
329
|
|
|
268
330
|
- **Config file:** `~/.codedd/config.toml` (TOML). Stores API URL, active audit, scope directories, LLM provider, concurrency. Permissions are restricted to the owner (Unix).
|
|
269
|
-
- **Secrets:**
|
|
331
|
+
- **Secrets:** On desktop, 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. On headless systems, supply them via environment variables; the CLI does not write secrets to disk.
|
|
270
332
|
|
|
271
333
|
Optional `[audit]` keys (defaults shown) tune how long the CLI waits after opening a payment browser flow:
|
|
272
334
|
|
|
@@ -277,14 +339,26 @@ Optional `[audit]` keys (defaults shown) tune how long the CLI waits after openi
|
|
|
277
339
|
|
|
278
340
|
| Variable | Purpose |
|
|
279
341
|
|---------|---------|
|
|
280
|
-
| `CODEDD_API_TOKEN` |
|
|
342
|
+
| `CODEDD_API_TOKEN` | CLI token (used when the OS keyring is unavailable, e.g. CI or headless Linux). Takes precedence over a stored keyring token. |
|
|
343
|
+
| `CODEDD_ANTHROPIC_API_KEY` / `ANTHROPIC_API_KEY` | Anthropic API key. `CODEDD_*` wins if both are set. |
|
|
344
|
+
| `CODEDD_OPENAI_API_KEY` / `OPENAI_API_KEY` | OpenAI API key. |
|
|
345
|
+
| `CODEDD_GEMINI_API_KEY` / `GEMINI_API_KEY` / `GOOGLE_API_KEY` | Google Gemini API key. |
|
|
346
|
+
| `CODEDD_GROK_API_KEY` / `XAI_API_KEY` / `GROK_API_KEY` | xAI Grok API key. |
|
|
347
|
+
|
|
348
|
+
Headless / CI example:
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
export CODEDD_API_TOKEN=codedd_cli_...
|
|
352
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
353
|
+
codedd audit start --yes
|
|
354
|
+
```
|
|
281
355
|
|
|
282
356
|
|
|
283
357
|
---
|
|
284
358
|
|
|
285
359
|
## Security
|
|
286
360
|
|
|
287
|
-
- CLI tokens and LLM keys are stored in the OS credential store, not in plaintext on disk.
|
|
361
|
+
- On desktop, CLI tokens and LLM keys are stored in the OS credential store, not in plaintext on disk. On headless Linux, containers, and CI, supply them through environment variables; the CLI does not write those secrets to disk.
|
|
288
362
|
- TLS certificate verification is always enabled for API requests.
|
|
289
363
|
- Config file and `~/.codedd` directory use owner-only permissions where supported.
|
|
290
364
|
- Tokens expire after 90 days (server-configurable); re-generate from the CodeDD dashboard when needed.
|
|
@@ -23,6 +23,7 @@ Ideal for teams who want to keep source code local while still using CodeDD’s
|
|
|
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
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
|
+
- **Issue remediation (`codedd fix`)** — Work through audit flags and dependency vulnerabilities from the terminal: fetch overviews, get the next issue by priority, record progress, mark resolved, and scope to a repo or Issue Compass saved list. Designed for interactive use and AI-agent workflows (`context`, `summarize`, `--json`).
|
|
26
27
|
- **Payment and budget** — Pre-flight checks, LoC budget deduction, or Stripe checkout when additional payment is required.
|
|
27
28
|
- **Secure auth** — CLI tokens stored in the OS credential store (Windows Credential Locker, macOS Keychain, Linux Secret Service).
|
|
28
29
|
|
|
@@ -55,6 +56,8 @@ Verify:
|
|
|
55
56
|
codedd --version
|
|
56
57
|
```
|
|
57
58
|
|
|
59
|
+
On Linux, the OS credential store needs a Secret Service provider such as gnome-keyring or KWallet (typically present on desktop environments). Headless servers, containers, and CI runners generally do not; use environment variables instead of `codedd auth login` / `codedd config set-key` (see [Environment variables](#environment-variables)).
|
|
60
|
+
|
|
58
61
|
---
|
|
59
62
|
|
|
60
63
|
## Quick start (recommended workflow)
|
|
@@ -69,6 +72,8 @@ codedd auth login --token <your_token>
|
|
|
69
72
|
|
|
70
73
|
Or run `codedd auth login` and paste the token when prompted.
|
|
71
74
|
|
|
75
|
+
On headless Linux or in CI, skip login and export `CODEDD_API_TOKEN` instead (see [Environment variables](#environment-variables)).
|
|
76
|
+
|
|
72
77
|
Optional sanity check:
|
|
73
78
|
|
|
74
79
|
```bash
|
|
@@ -106,6 +111,8 @@ codedd config set-key anthropic
|
|
|
106
111
|
# or: codedd config set-key openai
|
|
107
112
|
```
|
|
108
113
|
|
|
114
|
+
Alternatively, export a provider key (`ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `GEMINI_API_KEY`, `XAI_API_KEY`, or the `CODEDD_*` equivalents). Environment variables take precedence over the keychain.
|
|
115
|
+
|
|
109
116
|
Optional (recommended if both are configured):
|
|
110
117
|
|
|
111
118
|
```bash
|
|
@@ -127,6 +134,35 @@ The CLI will:
|
|
|
127
134
|
|
|
128
135
|
Results and recommendations are available in the CodeDD dashboard; you can also run `codedd audits list` to see status.
|
|
129
136
|
|
|
137
|
+
### 6. Fix issues (optional, after audit completes)
|
|
138
|
+
|
|
139
|
+
Once an audit has finished and remediation data is available on CodeDD, use `codedd fix` to work through flags and vulnerabilities locally:
|
|
140
|
+
|
|
141
|
+
**Group / portfolio audit** (multiple repos):
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
codedd fix status # repos ranked by severity
|
|
145
|
+
codedd fix repo my-service # scope to one repository
|
|
146
|
+
codedd fix flags next --auto # next unresolved flag (red first)
|
|
147
|
+
codedd fix resolve --comment "Fixed null check in auth handler"
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Single-repo audit:**
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
codedd fix fetch flags
|
|
154
|
+
codedd fix flags next --auto
|
|
155
|
+
codedd fix resolve --comment "Updated lodash to 4.17.21"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`codedd fix resolve` records the comment, marks the issue fixed, and prints the next one, so the remediation loop is a single command per issue. Repeat it until the output shows `QUEUE EMPTY`.
|
|
159
|
+
|
|
160
|
+
For dependency vulnerabilities, swap `flags` for `vulns` (`codedd fix fetch vulns`, `codedd fix vulns next --auto`, `codedd fix vulns affected-files <package>`).
|
|
161
|
+
|
|
162
|
+
Issue Compass saved lists from the web UI can narrow flag remediation: `codedd fix selections list`, then `codedd fix selections use <n>`.
|
|
163
|
+
|
|
164
|
+
Run `codedd ai-docs fix` for the full remediation reference (AI-agent workflows, JSON output, access controls).
|
|
165
|
+
|
|
130
166
|
---
|
|
131
167
|
|
|
132
168
|
## Workflow overview
|
|
@@ -209,6 +245,32 @@ Run: codedd audit start
|
|
|
209
245
|
| Command | Description |
|
|
210
246
|
|--------|-------------|
|
|
211
247
|
| `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). |
|
|
248
|
+
| `codedd audit status` | Show pipeline step progress for an active or resumable audit. |
|
|
249
|
+
|
|
250
|
+
### Issue remediation (`codedd fix`)
|
|
251
|
+
|
|
252
|
+
Requires a completed audit with remediation data on CodeDD. Select the audit first (`codedd audits select`).
|
|
253
|
+
|
|
254
|
+
| Command | Description |
|
|
255
|
+
|--------|-------------|
|
|
256
|
+
| `codedd fix status [--json]` | Dashboard of open flags/vulns; repos ranked by severity in group audits |
|
|
257
|
+
| `codedd fix repo [name\|uuid]` | Scope fix workflow to one sub-audit (group audits) |
|
|
258
|
+
| `codedd fix fetch flags\|vulns` | Load issue overview (interactive sub-audit pick when needed) |
|
|
259
|
+
| `codedd fix flags next [--auto] [--json]` | Next unresolved flag; `--auto` prioritizes red issues |
|
|
260
|
+
| `codedd fix flags invalidate [--reason "<text>"]` | Mark current flag as invalid and advance |
|
|
261
|
+
| `codedd fix vulns next [--auto] [--severity S] [--used-only] [--json]` | Next vulnerability; `--auto` prioritizes critical |
|
|
262
|
+
| `codedd fix vulns affected-files <package> [--json]` | List local files importing a vulnerable package |
|
|
263
|
+
| `codedd fix resolve [--comment "<text>"]` | Record progress, mark resolved, and print the next issue |
|
|
264
|
+
| `codedd fix comment "<text>"` | Record progress without resolving |
|
|
265
|
+
| `codedd fix context [--json]` / `summarize` | Session snapshot for AI agents |
|
|
266
|
+
| `codedd fix selections list\|show\|use\|clear` | Issue Compass saved flag lists from the web UI |
|
|
267
|
+
| `codedd fix access status\|enable\|disable\|activate\|deactivate` | Remediation Module access (org initiator) |
|
|
268
|
+
|
|
269
|
+
Comment text can also be supplied with `--comment-file <path>` or on stdin (`codedd fix comment -`), which avoids shell quoting for multi-line or quote-heavy notes.
|
|
270
|
+
|
|
271
|
+
**Exit codes** (for scripted and AI-agent loops): `0` issue delivered or action succeeded, `1` error, `3` no unresolved issues left in the current scope. Commands that deliver an issue also print a loop protocol block — the remaining count, the exact next command, and the stop condition — on every invocation, so long remediation runs do not depend on the instruction surviving in an agent's context window.
|
|
272
|
+
|
|
273
|
+
See `codedd ai-docs fix` for detailed examples and agent integration patterns.
|
|
212
274
|
|
|
213
275
|
### Configuration
|
|
214
276
|
|
|
@@ -227,7 +289,7 @@ Run: codedd audit start
|
|
|
227
289
|
## Configuration
|
|
228
290
|
|
|
229
291
|
- **Config file:** `~/.codedd/config.toml` (TOML). Stores API URL, active audit, scope directories, LLM provider, concurrency. Permissions are restricted to the owner (Unix).
|
|
230
|
-
- **Secrets:**
|
|
292
|
+
- **Secrets:** On desktop, 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. On headless systems, supply them via environment variables; the CLI does not write secrets to disk.
|
|
231
293
|
|
|
232
294
|
Optional `[audit]` keys (defaults shown) tune how long the CLI waits after opening a payment browser flow:
|
|
233
295
|
|
|
@@ -238,14 +300,26 @@ Optional `[audit]` keys (defaults shown) tune how long the CLI waits after openi
|
|
|
238
300
|
|
|
239
301
|
| Variable | Purpose |
|
|
240
302
|
|---------|---------|
|
|
241
|
-
| `CODEDD_API_TOKEN` |
|
|
303
|
+
| `CODEDD_API_TOKEN` | CLI token (used when the OS keyring is unavailable, e.g. CI or headless Linux). Takes precedence over a stored keyring token. |
|
|
304
|
+
| `CODEDD_ANTHROPIC_API_KEY` / `ANTHROPIC_API_KEY` | Anthropic API key. `CODEDD_*` wins if both are set. |
|
|
305
|
+
| `CODEDD_OPENAI_API_KEY` / `OPENAI_API_KEY` | OpenAI API key. |
|
|
306
|
+
| `CODEDD_GEMINI_API_KEY` / `GEMINI_API_KEY` / `GOOGLE_API_KEY` | Google Gemini API key. |
|
|
307
|
+
| `CODEDD_GROK_API_KEY` / `XAI_API_KEY` / `GROK_API_KEY` | xAI Grok API key. |
|
|
308
|
+
|
|
309
|
+
Headless / CI example:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
export CODEDD_API_TOKEN=codedd_cli_...
|
|
313
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
314
|
+
codedd audit start --yes
|
|
315
|
+
```
|
|
242
316
|
|
|
243
317
|
|
|
244
318
|
---
|
|
245
319
|
|
|
246
320
|
## Security
|
|
247
321
|
|
|
248
|
-
- CLI tokens and LLM keys are stored in the OS credential store, not in plaintext on disk.
|
|
322
|
+
- On desktop, CLI tokens and LLM keys are stored in the OS credential store, not in plaintext on disk. On headless Linux, containers, and CI, supply them through environment variables; the CLI does not write those secrets to disk.
|
|
249
323
|
- TLS certificate verification is always enabled for API requests.
|
|
250
324
|
- Config file and `~/.codedd` directory use owner-only permissions where supported.
|
|
251
325
|
- Tokens expire after 90 days (server-configurable); re-generate from the CodeDD dashboard when needed.
|
|
@@ -35,11 +35,63 @@ except ImportError: # pragma: no cover - pyyaml is a hard dep, but stay safe
|
|
|
35
35
|
# from the streamed audit plan are observed by every accessor below.
|
|
36
36
|
from codedd_cli.auditor.server_parity import repo_kind as rk
|
|
37
37
|
from codedd_cli.auditor.server_parity import tier_definitions as td
|
|
38
|
+
from codedd_cli.auditor.server_parity.taxonomy import normalize_category, normalize_edge_type
|
|
38
39
|
from codedd_cli.auditor.server_parity.tech_normalizer import canonical_tech_name
|
|
39
40
|
|
|
40
41
|
logger = logging.getLogger(__name__)
|
|
41
42
|
|
|
42
43
|
|
|
44
|
+
# ---------------------------------------------------------------------------
|
|
45
|
+
# Architecture style (topology) - orthogonal to the operational-scale tier
|
|
46
|
+
# ---------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
ARCHITECTURE_STYLE_LABELS: dict[str, str] = {
|
|
49
|
+
'microservices': 'Microservices',
|
|
50
|
+
'service_oriented': 'Service-Oriented (SOA)',
|
|
51
|
+
'modular_monolith': 'Modular Monolith',
|
|
52
|
+
'monolith': 'Monolith',
|
|
53
|
+
'library': 'Library / CLI Tool',
|
|
54
|
+
'data_pipeline': 'Data Pipeline',
|
|
55
|
+
'mobile_client': 'Mobile Client',
|
|
56
|
+
'serverless': 'Serverless',
|
|
57
|
+
'infrastructure': 'Infrastructure / IaC',
|
|
58
|
+
'documentation': 'Documentation',
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def derive_architecture_style(
|
|
63
|
+
deployable_units: int,
|
|
64
|
+
logical_units: int,
|
|
65
|
+
service_node_count: int,
|
|
66
|
+
inter_service_edge_count: int,
|
|
67
|
+
detected_patterns: list[str],
|
|
68
|
+
repo_kind: str = 'service',
|
|
69
|
+
module_dirs: int = 0,
|
|
70
|
+
) -> str:
|
|
71
|
+
"""Topology-derived architecture style, independent of the tier ladder."""
|
|
72
|
+
kind = str(repo_kind or 'service').strip().lower()
|
|
73
|
+
if kind in rk.ABSTAIN_REPO_KINDS:
|
|
74
|
+
return kind
|
|
75
|
+
|
|
76
|
+
patterns_l = [str(p).lower() for p in (detected_patterns or [])]
|
|
77
|
+
graph_services = service_node_count if inter_service_edge_count >= 2 else 0
|
|
78
|
+
effective_services = max(int(deployable_units or 0), graph_services)
|
|
79
|
+
|
|
80
|
+
if effective_services >= 8 and (
|
|
81
|
+
inter_service_edge_count >= 4 or deployable_units >= 8
|
|
82
|
+
):
|
|
83
|
+
return 'microservices'
|
|
84
|
+
if effective_services >= 4:
|
|
85
|
+
return 'service_oriented'
|
|
86
|
+
if (
|
|
87
|
+
module_dirs >= 3
|
|
88
|
+
or logical_units >= 4
|
|
89
|
+
or any('modular monolith' in p or 'bounded context' in p for p in patterns_l)
|
|
90
|
+
):
|
|
91
|
+
return 'modular_monolith'
|
|
92
|
+
return 'monolith'
|
|
93
|
+
|
|
94
|
+
|
|
43
95
|
# ---------------------------------------------------------------------------
|
|
44
96
|
# Dimension Scorers
|
|
45
97
|
# ---------------------------------------------------------------------------
|
|
@@ -84,8 +136,114 @@ class DimensionScorer:
|
|
|
84
136
|
self.nodes = self.phase3.get('nodes', [])
|
|
85
137
|
self.edges = self.phase3.get('edges', [])
|
|
86
138
|
|
|
139
|
+
self.repo_files = self._resolve_repo_file_inventory()
|
|
140
|
+
|
|
87
141
|
self._tech_credit_ledger: dict[str, set[str]] = {}
|
|
88
142
|
self.penalty_signals: dict[str, bool] = {}
|
|
143
|
+
self._deployable_census: tuple[int, int] | None = None
|
|
144
|
+
|
|
145
|
+
def _resolve_repo_file_inventory(self) -> list[str]:
|
|
146
|
+
"""Prefer the full inventory over the budget-capped LLM selection."""
|
|
147
|
+
full = self.phase1.get('all_repository_files')
|
|
148
|
+
if isinstance(full, list) and full:
|
|
149
|
+
return [str(f) for f in full if isinstance(f, str)]
|
|
150
|
+
fallback = (
|
|
151
|
+
self.phase1.get('relevant_files', [])
|
|
152
|
+
or self.phase2.get('phase1_files', [])
|
|
153
|
+
or []
|
|
154
|
+
)
|
|
155
|
+
return [str(f) for f in fallback if isinstance(f, str)]
|
|
156
|
+
|
|
157
|
+
@staticmethod
|
|
158
|
+
def _is_first_party_service_node(node: dict) -> bool:
|
|
159
|
+
if not isinstance(node, dict):
|
|
160
|
+
return False
|
|
161
|
+
if node.get('is_external') or (node.get('properties') or {}).get('is_external'):
|
|
162
|
+
return False
|
|
163
|
+
if normalize_category(node.get('category')) == 'service':
|
|
164
|
+
return True
|
|
165
|
+
return node.get('type') in ('service', 'component', 'module')
|
|
166
|
+
|
|
167
|
+
_SYNC_RPC_EDGE_TYPES = frozenset({'api_calls', 'calls'})
|
|
168
|
+
|
|
169
|
+
def _count_inter_service_edges(
|
|
170
|
+
self, edge_types: frozenset | None = None
|
|
171
|
+
) -> tuple[int, int]:
|
|
172
|
+
"""Count graph edges connecting two distinct first-party service nodes."""
|
|
173
|
+
service_ids: set[str] = set()
|
|
174
|
+
for n in self.nodes:
|
|
175
|
+
if self._is_first_party_service_node(n):
|
|
176
|
+
node_id = n.get('id')
|
|
177
|
+
if node_id:
|
|
178
|
+
service_ids.add(node_id)
|
|
179
|
+
count = 0
|
|
180
|
+
for e in self.edges:
|
|
181
|
+
if not isinstance(e, dict):
|
|
182
|
+
continue
|
|
183
|
+
etype = normalize_edge_type(e.get('type'))
|
|
184
|
+
if edge_types is not None and etype not in edge_types:
|
|
185
|
+
continue
|
|
186
|
+
source, target = e.get('source'), e.get('target')
|
|
187
|
+
if source in service_ids and target in service_ids and source != target:
|
|
188
|
+
count += 1
|
|
189
|
+
return count, len(service_ids)
|
|
190
|
+
|
|
191
|
+
def _count_build_module_dirs(self) -> int:
|
|
192
|
+
"""Count distinct directories that carry a build manifest."""
|
|
193
|
+
manifests = (
|
|
194
|
+
'pom.xml', 'build.gradle', 'build.gradle.kts', 'package.json',
|
|
195
|
+
)
|
|
196
|
+
dirs: set[str] = set()
|
|
197
|
+
for f in self.repo_files:
|
|
198
|
+
if not isinstance(f, str):
|
|
199
|
+
continue
|
|
200
|
+
lower = f.lower().replace('\\', '/')
|
|
201
|
+
name = lower.rsplit('/', 1)[-1]
|
|
202
|
+
if name in manifests:
|
|
203
|
+
parent = lower.rsplit('/', 1)[0] if '/' in lower else '.'
|
|
204
|
+
dirs.add(parent)
|
|
205
|
+
return len(dirs)
|
|
206
|
+
|
|
207
|
+
def apply_graph_consistency_gate(
|
|
208
|
+
self, dimension_scores: dict[str, dict[str, Any]]
|
|
209
|
+
) -> dict[str, Any]:
|
|
210
|
+
"""Reconcile deployment_model with the component graph when they disagree."""
|
|
211
|
+
edge_count, service_count = self._count_inter_service_edges()
|
|
212
|
+
info: dict[str, Any] = {
|
|
213
|
+
'applied': False,
|
|
214
|
+
'service_nodes': service_count,
|
|
215
|
+
'inter_service_edges': edge_count,
|
|
216
|
+
}
|
|
217
|
+
dim = dimension_scores.get('deployment_model')
|
|
218
|
+
if not dim:
|
|
219
|
+
return info
|
|
220
|
+
|
|
221
|
+
current = float(dim.get('score', 0))
|
|
222
|
+
target: float | None = None
|
|
223
|
+
if service_count >= 8 and edge_count >= max(5, service_count // 2):
|
|
224
|
+
if current < 69:
|
|
225
|
+
target = 72.0
|
|
226
|
+
elif service_count >= 4 and edge_count >= 3:
|
|
227
|
+
if current < 47:
|
|
228
|
+
target = 50.0
|
|
229
|
+
|
|
230
|
+
if target is None or target <= current:
|
|
231
|
+
return info
|
|
232
|
+
|
|
233
|
+
info.update({
|
|
234
|
+
'applied': True,
|
|
235
|
+
'original_score': round(current, 1),
|
|
236
|
+
'adjusted_score': round(target, 1),
|
|
237
|
+
})
|
|
238
|
+
dim['score'] = round(target, 1)
|
|
239
|
+
dim['evidence'].append(self._evidence(
|
|
240
|
+
f'Graph consistency gate: {service_count} first-party service '
|
|
241
|
+
f'node(s) with {edge_count} inter-service call edge(s) contradict '
|
|
242
|
+
f'a monolith-band deployment score; re-derived from '
|
|
243
|
+
f'{current:.0f} to {target:.0f}.',
|
|
244
|
+
'strong',
|
|
245
|
+
))
|
|
246
|
+
return info
|
|
89
247
|
|
|
90
248
|
# -- helpers --------------------------------------------------------
|
|
91
249
|
|
|
@@ -269,7 +427,7 @@ class DimensionScorer:
|
|
|
269
427
|
'helm', 'kustomize', '.github/workflows', '.gitlab-ci',
|
|
270
428
|
'jenkinsfile', 'buildspec',
|
|
271
429
|
]
|
|
272
|
-
phase1_files_raw = (
|
|
430
|
+
phase1_files_raw = self.repo_files or (
|
|
273
431
|
self.phase1.get('relevant_files', [])
|
|
274
432
|
or self.phase2.get('phase1_files', [])
|
|
275
433
|
or []
|
|
@@ -366,6 +524,7 @@ class DimensionScorer:
|
|
|
366
524
|
'weak',
|
|
367
525
|
))
|
|
368
526
|
|
|
527
|
+
self._deployable_census = (deployable_count, logical_count)
|
|
369
528
|
return deployable_count, logical_count, evidence
|
|
370
529
|
|
|
371
530
|
@staticmethod
|
|
@@ -1366,9 +1525,43 @@ class TierMatcher:
|
|
|
1366
1525
|
# Tier Gap Analysis
|
|
1367
1526
|
# ---------------------------------------------------------------------------
|
|
1368
1527
|
|
|
1528
|
+
_RECOMMENDATION_EVIDENCE_GUARDS: list[tuple[tuple[str, ...], tuple[str, ...]]] = [
|
|
1529
|
+
(('containerize',), ('docker', 'kubernetes', 'k8s', 'containerd', 'podman')),
|
|
1530
|
+
(('kubernetes',), ('kubernetes', 'k8s')),
|
|
1531
|
+
(('infrastructure as code', 'terraform'), ('terraform', 'pulumi', 'cloudformation', 'ansible', 'bicep', 'cdk')),
|
|
1532
|
+
(('distributed tracing', 'opentelemetry'), ('opentelemetry', 'otel', 'jaeger', 'zipkin', 'tempo', 'lightstep')),
|
|
1533
|
+
(('centralized logging',), ('loki', 'elasticsearch', 'elk', 'fluentd', 'fluent bit', 'splunk', 'graylog')),
|
|
1534
|
+
(('monitoring',), ('prometheus', 'grafana', 'datadog', 'new relic', 'newrelic', 'dynatrace', 'cloudwatch')),
|
|
1535
|
+
(('caching layer', 'application-level caching'), ('redis', 'memcached', 'valkey', 'hazelcast')),
|
|
1536
|
+
(('streaming platform', 'kafka'), ('kafka', 'pulsar', 'kinesis')),
|
|
1537
|
+
(('gitops',), ('argocd', 'argo cd', 'argo', 'fluxcd', 'flux cd')),
|
|
1538
|
+
(('cdn',), ('cloudfront', 'cloudflare', 'akamai', 'fastly')),
|
|
1539
|
+
(('autoscaling policies', 'hpa/keda'), ('hpa', 'keda')),
|
|
1540
|
+
(('ci/cd pipeline',), ('github actions', 'gitlab ci', 'jenkins', 'circleci', 'tekton', 'buildkite')),
|
|
1541
|
+
]
|
|
1542
|
+
|
|
1543
|
+
|
|
1544
|
+
def _recommendation_contradicts_evidence(
|
|
1545
|
+
recommendation: str, detected_technologies: list[str]
|
|
1546
|
+
) -> bool:
|
|
1547
|
+
"""True when every capability the recommendation names is already detected."""
|
|
1548
|
+
rec_lower = str(recommendation or '').lower()
|
|
1549
|
+
detected_blob = ' '.join(str(t).lower() for t in (detected_technologies or []))
|
|
1550
|
+
if not rec_lower or not detected_blob:
|
|
1551
|
+
return False
|
|
1552
|
+
matched_any = False
|
|
1553
|
+
for needles, techs in _RECOMMENDATION_EVIDENCE_GUARDS:
|
|
1554
|
+
if any(needle in rec_lower for needle in needles):
|
|
1555
|
+
matched_any = True
|
|
1556
|
+
if not any(tech in detected_blob for tech in techs):
|
|
1557
|
+
return False
|
|
1558
|
+
return matched_any
|
|
1559
|
+
|
|
1560
|
+
|
|
1369
1561
|
def compute_tier_gap_analysis(
|
|
1370
1562
|
primary_tier: int,
|
|
1371
1563
|
dimension_scores: dict[str, dict[str, Any]],
|
|
1564
|
+
detected_technologies: list[str] | None = None,
|
|
1372
1565
|
) -> dict[str, Any]:
|
|
1373
1566
|
"""Describe what is needed to advance from the current tier to the next."""
|
|
1374
1567
|
if primary_tier >= 5:
|
|
@@ -1396,16 +1589,29 @@ def compute_tier_gap_analysis(
|
|
|
1396
1589
|
}
|
|
1397
1590
|
else:
|
|
1398
1591
|
recs = td.GAP_RECOMMENDATIONS.get(dim_key, {})
|
|
1592
|
+
recommendation = recs.get(
|
|
1593
|
+
primary_tier,
|
|
1594
|
+
f'Advance {td.DIMENSION_LABELS.get(dim_key, dim_key)} '
|
|
1595
|
+
f'capabilities toward Tier {next_tier}.',
|
|
1596
|
+
)
|
|
1597
|
+
recommendation_adjusted = False
|
|
1598
|
+
if _recommendation_contradicts_evidence(
|
|
1599
|
+
recommendation, detected_technologies or []
|
|
1600
|
+
):
|
|
1601
|
+
recommendation = (
|
|
1602
|
+
f'Core tooling for this step is already in place; deepen '
|
|
1603
|
+
f'its adoption and coverage to raise '
|
|
1604
|
+
f'{td.DIMENSION_LABELS.get(dim_key, dim_key)} toward '
|
|
1605
|
+
f'Tier {next_tier}.'
|
|
1606
|
+
)
|
|
1607
|
+
recommendation_adjusted = True
|
|
1399
1608
|
actions[dim_key] = {
|
|
1400
1609
|
'status': 'below_target',
|
|
1401
1610
|
'current_score': current_score,
|
|
1402
1611
|
'target_score': target,
|
|
1403
1612
|
'gap': round(gap, 1),
|
|
1404
|
-
'recommendation':
|
|
1405
|
-
|
|
1406
|
-
f'Advance {td.DIMENSION_LABELS.get(dim_key, dim_key)} '
|
|
1407
|
-
f'capabilities toward Tier {next_tier}.',
|
|
1408
|
-
),
|
|
1613
|
+
'recommendation': recommendation,
|
|
1614
|
+
'recommendation_adjusted': recommendation_adjusted,
|
|
1409
1615
|
}
|
|
1410
1616
|
|
|
1411
1617
|
return {
|
|
@@ -1450,6 +1656,20 @@ def classify_local(
|
|
|
1450
1656
|
repo_kind_value = rk.classify_repo_kind(scorer.detected_techs, scorer.detected_patterns)
|
|
1451
1657
|
tier_not_applicable = repo_kind_value in rk.ABSTAIN_REPO_KINDS
|
|
1452
1658
|
|
|
1659
|
+
consistency_gate = scorer.apply_graph_consistency_gate(dimension_scores)
|
|
1660
|
+
|
|
1661
|
+
deployable_units, logical_units = scorer._deployable_census or (0, 0)
|
|
1662
|
+
inter_service_edges, service_node_count = scorer._count_inter_service_edges()
|
|
1663
|
+
architecture_style = derive_architecture_style(
|
|
1664
|
+
deployable_units=deployable_units,
|
|
1665
|
+
logical_units=logical_units,
|
|
1666
|
+
service_node_count=service_node_count,
|
|
1667
|
+
inter_service_edge_count=inter_service_edges,
|
|
1668
|
+
detected_patterns=scorer.detected_patterns,
|
|
1669
|
+
repo_kind=repo_kind_value,
|
|
1670
|
+
module_dirs=scorer._count_build_module_dirs(),
|
|
1671
|
+
)
|
|
1672
|
+
|
|
1453
1673
|
match_result = TierMatcher.match(dimension_scores)
|
|
1454
1674
|
|
|
1455
1675
|
if tier_not_applicable:
|
|
@@ -1465,6 +1685,7 @@ def classify_local(
|
|
|
1465
1685
|
gap_analysis = compute_tier_gap_analysis(
|
|
1466
1686
|
match_result['primary_tier'],
|
|
1467
1687
|
match_result['dimension_scores'],
|
|
1688
|
+
detected_technologies=scorer.detected_techs,
|
|
1468
1689
|
)
|
|
1469
1690
|
|
|
1470
1691
|
elapsed = round(time.time() - start_time, 2)
|
|
@@ -1499,4 +1720,9 @@ def classify_local(
|
|
|
1499
1720
|
'confidence_components': match_result.get('confidence_components', {}),
|
|
1500
1721
|
'penalty_caps_applied': getattr(scorer, '_applied_penalty_caps', []),
|
|
1501
1722
|
'penalty_signals': scorer.penalty_signals,
|
|
1723
|
+
'architecture_style': architecture_style,
|
|
1724
|
+
'architecture_style_label': ARCHITECTURE_STYLE_LABELS.get(
|
|
1725
|
+
architecture_style, architecture_style.replace('_', ' ').title()
|
|
1726
|
+
),
|
|
1727
|
+
'graph_consistency_gate': consistency_gate,
|
|
1502
1728
|
}
|