Skip to content

Commit cc12dbe

Browse files
Merge pull request #53 from CodeAnt-AI/pranav/cli-fixes
cli gaps fixes
2 parents 475f979 + d9ee124 commit cc12dbe

26 files changed

Lines changed: 754 additions & 103 deletions

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,6 @@ coverage/
3333

3434
# Shell scripts
3535
*.sh
36+
37+
# Local Codex connection settings can contain credentials.
38+
.codex/

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ A command-line tool for code review and security scanning.
88
npm install -g codeant-cli
99
```
1010

11+
This repository distributes the Node.js CLI as [`codeant-cli` on npm](https://www.npmjs.com/package/codeant-cli). The npm package’s repository metadata identifies its canonical source. Ownership of the same-named PyPI package is unconfirmed; use the npm installation above for this CLI.
12+
1113
For installation, authentication, and self-hosted setup, see the [CodeAnt CLI setup guide](https://docs.codeant.ai/cli/setup).
1214

1315
## Quick Start

‎changelog.md‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## [0.5.15] - 26/10/2026
4+
5+
- Added `--secrets-scope current|history|all` to `findings repo` and `scans results`, with `current` as the default. Use `--history-run` to retrieve a specific history scan, including when no snapshot scan exists.
6+
- Added `scans start-scan --types historical_secrets --json` to start a history scan and return its run ID, and `scans status --repo … --run …` to track its progress. Requested history features report an explicit error when the backend does not support them.
7+
- Secret results now preserve historical commit, file, line, containing branch/tag references, scan time, and `only_in_history` when a snapshot comparison is available. Native verification and cached live-validation verdicts remain separate; unavailable validation does not imply revocation.
8+
- SCA results now include dependency paths, direct introducers, manifest locations, known lockfiles, declaration evidence, and resolution provenance when supplied by the backend. Fixed versions and vulnerable ranges are preserved, including nested advisory fix fields. Dependency-path readiness is exposed independently of AI reachability verification.
9+
- Added the history options and scan-status tool to MCP. Programmatic fetchers, field projection, JSON, SARIF, and CSV exports preserve the new evidence; CSV includes JSON-encoded package and metadata columns.
10+
- Updated the normalized results schema to `1.1`. SCA finding IDs include package, version, and manifest context; historical finding IDs distinguish commits and repeated occurrences. Consumers that persist finding IDs should account for these corrections.
11+
- Documented the history trigger → poll → retrieve workflow, SCA remediation evidence, backend compatibility requirements, and npm as this repository's distribution channel. Existing scan artifacts remain readable; richer evidence requires a subsequent scan.
12+
- Added deterministic contract tests and opt-in live history tests. Live scan-result tests use bounded concurrency, and organization discovery tests support accounts connected to multiple organizations.
13+
314
## [0.5.14] - 15/10/2026
415
- Increased file limits on code review to 40 files
516

‎cli-api.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,13 @@ Set `CODEANT_READ_ONLY=0` to opt in to write tools, including `codeant_api_reque
128128
| Invalid token after upgrading | Older keys lack verified CLI identity metadata. Run `codeant logout`, then `codeant login`. |
129129
| Hotlist is still building | Retry, or increase `--max-wait`. |
130130
| Finding not found | Refresh the app/Hotlist and copy the current stable finding ID and tenant context. |
131+
132+
## History scan API workflow
133+
134+
The CLI uses `POST /extension/analysis/run` with `repo`, `branch`, `commit_id`, and optional `scan_types: ["historical_secrets"]`. The response includes `scan_run_id`. Omitting `scan_types` preserves the existing scanner selection.
135+
136+
Poll `POST /extension/scans2/secrets/history/status` with `repo` and `scan_run_id`. Retrieve `POST /extension/scans2/secrets/history/results` with the same fields and optional comparison `commit_id`, `filter_dismissed`, and `include_false_positives`. Both extension endpoints authenticate the connection key and enforce organization/provider/repository scope. Results return `findings`, `run`, and `status`; they never return credential storage.
137+
138+
The authenticated application aliases are `/analysis/secrets/repository/status` and `/analysis/secrets/repository/fetch`. Existing `/api/analysis/start` also accepts `scan_types: ["historical_secrets"]` with its existing authentication contract. `/api/analysis/results/secrets` and `/api/analysis/results/sca` expose the same safe validation and dependency evidence as extension readers.
139+
140+
See [the history workflow and SCA contract](scans.md#git-history-secrets-beta) for commands, state meanings, comparison semantics, and migration details. Deploy backend support first. Older artifacts remain readable; no automatic rescans or backfills are triggered.

‎findings.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,7 @@ All these tools are available in the default read-only MCP mode. A typical agent
165165
| Redacted pentest fields | Unlock the engagement in the app; CLI access follows the same entitlement. |
166166

167167
For current authentication, finding coverage, and agent guidance, see the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings).
168+
169+
## History secrets and SCA remediation evidence
170+
171+
`findings repo` accepts `--secrets-scope current|history|all` (default `current`) and `--history-run <id>`, matching `scans results`. See [scan automation](scans.md#git-history-secrets-beta) for start/status/results examples and schema 1.1. SCA findings now carry per-manifest dependency paths, direct introducers, known lockfiles, and vulnerable-package fix versions in `metadata`.

‎mcp.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ The CodeAnt CLI ships an MCP (Model Context Protocol) server that exposes CodeAn
1414
| `codeant_scans_repos` | read | List repos in an org (slim records, paged: `search`, `limit`, `offset`, `full`). |
1515
| `codeant_scans_history` | read | Recent scan runs for a repo. |
1616
| `codeant_scans_get` | read | Severity/category summary for one scan. |
17-
| `codeant_scans_results` | read | Full findings (SAST, SCA, secrets, IaC, …) for one scan. |
17+
| `codeant_scans_results` | read | Full findings; `secretsScope: current|history|all` and optional `historyRun` select history evidence. |
18+
| `codeant_scans_status` | read | History run state for `repo` and optional `run` ID. |
1819
| `codeant_scans_dismissed` | read | Dismissed alerts for a repo (any analysis type; `sast` and `anti_patterns` are accepted as aliases). |
1920
| `codeant_scans_overrides` | read | User false-positive, confidence, and severity overrides for a repo. |
2021
| `codeant_hotlist_list` | read | Prioritized organization-wide Hotlist findings with stable IDs. |
@@ -174,7 +175,7 @@ cd dist/mcpb-stage
174175
'{"jsonrpc":"2.0","id":2,"method":"tools/list"}'; sleep 1) | node server/index.js
175176
```
176177

177-
Expect 24 tools in the `tools/list` response (or 27 if `CODEANT_READ_ONLY=0`). `tests/mcp/server.test.js` checks that this list matches the manifest's `tools`.
178+
Expect 25 tools in the `tools/list` response (or 28 if `CODEANT_READ_ONLY=0`). `tests/mcp/server.test.js` checks that this list matches the manifest's `tools`.
178179

179180
### Bumping the version
180181

@@ -221,3 +222,5 @@ Reviewer notes worth preparing:
221222
| A tool returns "Result too large" | Follow the hint (smaller `limit`, filters, `fields`), or raise `CODEANT_MCP_MAX_RESULT_CHARS` if your client accepts larger results. |
222223
| `codeant_review_local` returns "Could not find a .git directory" | The client started the server outside a git repository (Claude Desktop does). Use a project-scoped client such as Claude Code. |
223224
| MCPB install dialog never appears | Open `.mcpb` with `open -a Claude dist/codeant.mcpb` to force the desktop app to handle it. |
225+
226+
History automation uses `codeant_scans_start` with `types: "historical_secrets"` (write tools enabled), then `codeant_scans_status` and `codeant_scans_results` with `secretsScope: "history"` and `historyRun` set to the returned `scan_run_id`. See [scan contracts](scans.md#git-history-secrets-beta).

‎mcpb/manifest.json‎

Lines changed: 117 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"name": "codeant",
44
"display_name": "CodeAnt AI",
55
"version": "0.5.3",
6-
"description": "Drive CodeAnt AI security scans and code review from Claude — org-wide secret triage, cross-repo SAST/SCA findings, on-demand scans, and local PR review.",
7-
"long_description": "CodeAnt AI inside Claude. Ask things like \"show my highest-priority Hotlist findings\", \"list AWS cloud findings\", \"show this pentest report\", or \"review my staged changes\" — Claude calls the CodeAnt API directly via this MCP server.\n\nIncludes 22 read-only tools, covering repository, Hotlist, cloud security, anti-pattern, and pentest findings plus an authenticated GET escape hatch for new APIs, 2 sign-in tools, and 3 opt-in write tools gated behind a setting.\n\nRequires a CodeAnt account. Sign up at https://codeant.ai. To authenticate, call the `codeant_login` tool — it returns a sign-in link (and opens it in your browser when it can), then saves the token once you finish.\n\nCollects usage telemetry via PostHog by default (events are tied to your CodeAnt token); turn on \"Disable telemetry\" in the extension settings to opt out.",
6+
"description": "Drive CodeAnt AI security scans and code review from Claude \u2014 org-wide secret triage, cross-repo SAST/SCA findings, on-demand scans, and local PR review.",
7+
"long_description": "CodeAnt AI inside Claude. Ask things like \"show my highest-priority Hotlist findings\", \"list AWS cloud findings\", \"show this pentest report\", or \"review my staged changes\" \u2014 Claude calls the CodeAnt API directly via this MCP server.\n\nIncludes 23 read-only tools, covering repository, Hotlist, cloud security, anti-pattern, and pentest findings plus an authenticated GET escape hatch for new APIs, 2 sign-in tools, and 3 opt-in write tools gated behind a setting.\n\nRequires a CodeAnt account. Sign up at https://codeant.ai. To authenticate, call the `codeant_login` tool \u2014 it returns a sign-in link (and opens it in your browser when it can), then saves the token once you finish.\n\nCollects usage telemetry via PostHog by default (events are tied to your CodeAnt token); turn on \"Disable telemetry\" in the extension settings to opt out.",
88
"author": {
99
"name": "CodeAnt AI",
1010
"email": "support@codeant.ai",
@@ -32,7 +32,9 @@
3232
"entry_point": "server/index.js",
3333
"mcp_config": {
3434
"command": "node",
35-
"args": ["${__dirname}/server/index.js"],
35+
"args": [
36+
"${__dirname}/server/index.js"
37+
],
3638
"env": {
3739
"CODEANT_API_TOKEN": "${user_config.api_token}",
3840
"CODEANT_API_URL": "${user_config.base_url}",
@@ -57,33 +59,118 @@
5759
},
5860
"tools_generated": false,
5961
"tools": [
60-
{ "name": "codeant_scans_orgs", "description": "List the CodeAnt organizations the current user is authenticated to." },
61-
{ "name": "codeant_scans_repos", "description": "List repositories connected to CodeAnt for an organization." },
62-
{ "name": "codeant_scans_history", "description": "Show recent scan runs for a single repository." },
63-
{ "name": "codeant_scans_get", "description": "Get summary metadata for a single scan (no findings)." },
64-
{ "name": "codeant_scans_results", "description": "Fetch full findings (SAST, SCA, secrets, IaC, etc.) for a scan." },
65-
{ "name": "codeant_scans_dismissed", "description": "List dismissed alerts for a repository." },
66-
{ "name": "codeant_scans_overrides", "description": "List user false-positive, confidence, and severity overrides for a repository." },
67-
{ "name": "codeant_hotlist_list", "description": "List prioritized organization-wide Hotlist findings with stable IDs." },
68-
{ "name": "codeant_hotlist_get", "description": "Fetch one complete Hotlist finding by its stable ID." },
69-
{ "name": "codeant_findings_antipatterns", "description": "List anti-pattern findings across selected or all organization repositories." },
70-
{ "name": "codeant_cloud_scan_history", "description": "List AWS, Azure, or GCP CSPM, VM, or container scan history." },
71-
{ "name": "codeant_cloud_findings_list", "description": "List findings for a CSPM, VM, or container security scan." },
72-
{ "name": "codeant_cloud_finding_get", "description": "Fetch complete detail for one cloud security finding." },
73-
{ "name": "codeant_pentest_history", "description": "List pentest engagements visible in CodeAnt." },
74-
{ "name": "codeant_pentest_issues", "description": "List all available issues for a pentest engagement." },
75-
{ "name": "codeant_pentest_report", "description": "Fetch a complete pentest customer report." },
76-
{ "name": "codeant_api_get", "description": "Call any authenticated GET endpoint on the configured CodeAnt API host." },
77-
{ "name": "codeant_pr_list", "description": "List pull requests / merge requests across GitHub, GitLab, Bitbucket, Azure DevOps." },
78-
{ "name": "codeant_pr_get", "description": "Fetch detailed information for a single PR/MR." },
79-
{ "name": "codeant_pr_comments", "description": "List comments on a PR/MR with optional filters." },
80-
{ "name": "codeant_comments_search", "description": "Search across CodeAnt review comments by free-text query." },
81-
{ "name": "codeant_review_local", "description": "Run a CodeAnt AI review on local working-copy changes." },
82-
{ "name": "codeant_login", "description": "Start browser sign-in to CodeAnt AI and return the sign-in link; saves the API token once sign-in completes." },
83-
{ "name": "codeant_logout", "description": "Clear the saved API token and sign out of CodeAnt AI." },
84-
{ "name": "codeant_scans_start", "description": "Trigger a new scan run (write — gated behind read_only=false)." },
85-
{ "name": "codeant_pr_resolve", "description": "Resolve a PR conversation thread (write — gated behind read_only=false)." },
86-
{ "name": "codeant_api_request", "description": "Call an authenticated POST, PUT, PATCH, or DELETE API (write — gated behind read_only=false)." }
62+
{
63+
"name": "codeant_scans_orgs",
64+
"description": "List the CodeAnt organizations the current user is authenticated to."
65+
},
66+
{
67+
"name": "codeant_scans_repos",
68+
"description": "List repositories connected to CodeAnt for an organization."
69+
},
70+
{
71+
"name": "codeant_scans_history",
72+
"description": "Show recent scan runs for a single repository."
73+
},
74+
{
75+
"name": "codeant_scans_get",
76+
"description": "Get summary metadata for a single scan (no findings)."
77+
},
78+
{
79+
"name": "codeant_scans_results",
80+
"description": "Fetch full findings (SAST, SCA, secrets, IaC, etc.) for a scan."
81+
},
82+
{
83+
"name": "codeant_scans_dismissed",
84+
"description": "List dismissed alerts for a repository."
85+
},
86+
{
87+
"name": "codeant_scans_overrides",
88+
"description": "List user false-positive, confidence, and severity overrides for a repository."
89+
},
90+
{
91+
"name": "codeant_hotlist_list",
92+
"description": "List prioritized organization-wide Hotlist findings with stable IDs."
93+
},
94+
{
95+
"name": "codeant_hotlist_get",
96+
"description": "Fetch one complete Hotlist finding by its stable ID."
97+
},
98+
{
99+
"name": "codeant_findings_antipatterns",
100+
"description": "List anti-pattern findings across selected or all organization repositories."
101+
},
102+
{
103+
"name": "codeant_cloud_scan_history",
104+
"description": "List AWS, Azure, or GCP CSPM, VM, or container scan history."
105+
},
106+
{
107+
"name": "codeant_cloud_findings_list",
108+
"description": "List findings for a CSPM, VM, or container security scan."
109+
},
110+
{
111+
"name": "codeant_cloud_finding_get",
112+
"description": "Fetch complete detail for one cloud security finding."
113+
},
114+
{
115+
"name": "codeant_pentest_history",
116+
"description": "List pentest engagements visible in CodeAnt."
117+
},
118+
{
119+
"name": "codeant_pentest_issues",
120+
"description": "List all available issues for a pentest engagement."
121+
},
122+
{
123+
"name": "codeant_pentest_report",
124+
"description": "Fetch a complete pentest customer report."
125+
},
126+
{
127+
"name": "codeant_api_get",
128+
"description": "Call any authenticated GET endpoint on the configured CodeAnt API host."
129+
},
130+
{
131+
"name": "codeant_pr_list",
132+
"description": "List pull requests / merge requests across GitHub, GitLab, Bitbucket, Azure DevOps."
133+
},
134+
{
135+
"name": "codeant_pr_get",
136+
"description": "Fetch detailed information for a single PR/MR."
137+
},
138+
{
139+
"name": "codeant_pr_comments",
140+
"description": "List comments on a PR/MR with optional filters."
141+
},
142+
{
143+
"name": "codeant_comments_search",
144+
"description": "Search across CodeAnt review comments by free-text query."
145+
},
146+
{
147+
"name": "codeant_review_local",
148+
"description": "Run a CodeAnt AI review on local working-copy changes."
149+
},
150+
{
151+
"name": "codeant_login",
152+
"description": "Start browser sign-in to CodeAnt AI and return the sign-in link; saves the API token once sign-in completes."
153+
},
154+
{
155+
"name": "codeant_logout",
156+
"description": "Clear the saved API token and sign out of CodeAnt AI."
157+
},
158+
{
159+
"name": "codeant_scans_start",
160+
"description": "Trigger a new scan run (write \u2014 gated behind read_only=false)."
161+
},
162+
{
163+
"name": "codeant_pr_resolve",
164+
"description": "Resolve a PR conversation thread (write \u2014 gated behind read_only=false)."
165+
},
166+
{
167+
"name": "codeant_api_request",
168+
"description": "Call an authenticated POST, PUT, PATCH, or DELETE API (write \u2014 gated behind read_only=false)."
169+
},
170+
{
171+
"name": "codeant_scans_status",
172+
"description": "Read a history scan run status."
173+
}
87174
],
88175
"user_config": {
89176
"api_token": {

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeant-cli",
3-
"version": "0.5.14",
3+
"version": "0.5.15",
44
"description": "Code review CLI tool",
55
"type": "module",
66
"repository": {
@@ -14,6 +14,7 @@
1414
"start": "node src/index.js",
1515
"test": "vitest run",
1616
"test:watch": "vitest",
17+
"test:integration": "CODEANT_LIVE_TESTS=1 vitest run tests/scans tests/settings --no-file-parallelism --maxWorkers=1 --minWorkers=1",
1718
"mcpb:build": "node scripts/build-mcpb.mjs"
1819
},
1920
"keywords": [

0 commit comments

Comments
 (0)