Skip to content

Commit 41809af

Browse files
Merge pull request #39 from CodeAnt-AI/codex/cod-1178-cli-sync
COD-1178: expose all CodeAnt findings through CLI and MCP
2 parents 5e7b0cb + 9d54831 commit 41809af

33 files changed

Lines changed: 2094 additions & 58 deletions

.claude-plugin/marketplace.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
"name": "CodeAnt AI",
1919
"email": "support@codeant.ai"
2020
},
21-
"homepage": "https://codeant.ai",
22-
"repository": "https://github.com/CodeAnt-AI/codeant-cli",
21+
"homepage": "https://docs.codeant.ai/cli/claude-code-integration",
2322
"license": "MIT",
2423
"keywords": [
2524
"code-review",

.claude-plugin/plugin.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
"name": "CodeAnt AI",
77
"email": "support@codeant.ai"
88
},
9-
"homepage": "https://codeant.ai",
10-
"documentation": "https://docs.codeant.ai/cli/claude-code-plugin",
11-
"repository": "https://github.com/CodeAnt-AI/codeant-cli",
9+
"homepage": "https://docs.codeant.ai/cli/claude-code-integration",
10+
"documentation": "https://docs.codeant.ai/cli/claude-code-integration",
1211
"license": "MIT",
1312
"keywords": [
1413
"code-review",

.github/workflows/publish-mcpb.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ jobs:
4242
4343
Commit: ${{ github.sha }}
4444
45-
Install instructions: https://github.com/CodeAnt-AI/codeant-cli/blob/main/mcp.md
45+
Install instructions: https://docs.codeant.ai/cli/mcp-server

README.md

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

11-
Or run locally:
12-
13-
```bash
14-
git clone https://github.com/codeantai/codeant-cli.git
15-
cd codeant-cli
16-
npm install
17-
npm link
18-
```
11+
For installation, authentication, and self-hosted setup, see the [CodeAnt CLI setup guide](https://docs.codeant.ai/cli/setup).
1912

2013
## Quick Start
2114

@@ -131,6 +124,40 @@ Show the current API base URL and its source.
131124
codeant get-base-url
132125
```
133126

127+
#### `hotlist`
128+
129+
Query the same organization-wide prioritized findings shown in the CodeAnt Hotlist, or fetch one finding by its stable ID.
130+
131+
```bash
132+
codeant hotlist list --org CodeAnt-AI --service github --severity critical,high
133+
codeant hotlist get 0123456789abcdef0123456789abcdef --org CodeAnt-AI --service github
134+
```
135+
136+
#### `findings`
137+
138+
Access repository, organization Hotlist, cloud-security, anti-pattern, and pentest findings through one command group.
139+
140+
```bash
141+
codeant findings repos --org CodeAnt-AI
142+
codeant findings repo --repo CodeAnt-AI/example --types sast,sca,iac,anti_patterns
143+
codeant findings list --severity critical,high
144+
codeant findings cloud history --provider all
145+
codeant findings pentest history
146+
```
147+
148+
See the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings) for the complete command and agent manual.
149+
150+
#### `api request`
151+
152+
Call any CodeAnt application API using the saved bearer token. Only relative paths on the configured CodeAnt API host are accepted.
153+
154+
```bash
155+
codeant api request GET /some/read/endpoint --org CodeAnt-AI --service github --query '{"page":1}'
156+
codeant api request POST /some/app/endpoint --org CodeAnt-AI --service github --body '{"repo":"CodeAnt-AI/example"}'
157+
```
158+
159+
See the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings) for all finding commands, authentication, self-hosted provider, and agent/MCP details.
160+
134161
### Global Options
135162

136163
```bash
@@ -240,11 +267,11 @@ node src/index.js secrets --all
240267

241268
This package also ships an MCP (Model Context Protocol) server that exposes CodeAnt's scan, review, and PR data as tools to Claude and other MCP clients. The same source tree is packaged as a Desktop Extension (`.mcpb`) for one-click install in Claude Desktop.
242269

243-
See [mcp.md](mcp.md) for the tools listing, install paths (Claude Code CLI, Claude Desktop manual config, MCPB double-click), and bundling/submission instructions.
270+
See the [CodeAnt MCP server documentation](https://docs.codeant.ai/cli/mcp-server) for the tools listing and installation paths. See the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings) for Hotlist and authenticated API usage.
244271

245272
## Privacy Policy
246273

247-
Full policy: **https://codeant.ai/privacy**
274+
Full policy: **https://www.codeant.ai/privacy-policy**
248275

249276
Summary of what this CLI / MCP server sends and stores:
250277

cli-api.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# CodeAnt application APIs from the CLI
2+
3+
The CLI can call the authenticated application endpoints used by the CodeAnt web app without adding a second backend adapter for each endpoint. Sign in once, select one exact organization/provider connection, then use a first-class command or the generic API request command.
4+
5+
```bash
6+
codeant login
7+
codeant scans orgs
8+
```
9+
10+
`CODEANT_API_TOKEN` and `CODEANT_API_URL` can be used instead of the saved login for agents, CI, and self-hosted installations.
11+
12+
The browser login binds the CLI key to the signed-in user and the exact connections visible to that user. For application API calls, the backend resolves the selected connection and injects the same verified user identity used by the app. The existing organization-membership, RBAC, repository-access, audit, and request guards still run. CLI keys expire after 90 days by default (`CLI_API_KEY_TTL_DAYS` controls the backend deployment value), and `codeant logout` revokes the key server-side before deleting it locally.
13+
14+
Keys created before this authenticated application-API bridge do not contain the verified user identity. Run `codeant logout` followed by `codeant login` once after upgrading.
15+
16+
## Hotlist findings
17+
18+
Hotlist commands use the same organization-wide snapshot, ranking, filters, stable finding IDs, and cursor pagination as the app.
19+
20+
```bash
21+
# First page; org/service are auto-selected when unambiguous
22+
codeant hotlist list
23+
24+
# Highest-priority production findings for one authenticated connection
25+
codeant hotlist list \
26+
--org CodeAnt-AI \
27+
--service github \
28+
--severity critical,high \
29+
--validation exploit_confirmed \
30+
--limit 50
31+
32+
# Fetch every SCA finding across the organization
33+
codeant hotlist list --org CodeAnt-AI --service github --type SCA --all
34+
35+
# Continue a page using next_cursor from the previous response
36+
codeant hotlist list --org CodeAnt-AI --service github --cursor '<cursor>'
37+
38+
# Fetch exactly one finding using the stable ID shown in the app
39+
codeant hotlist get 0123456789abcdef0123456789abcdef \
40+
--org CodeAnt-AI \
41+
--service github
42+
```
43+
44+
Supported `hotlist list` filters:
45+
46+
| Option | Values |
47+
|---|---|
48+
| `--search` | title, repository/account, path, package, CVE, or check ID |
49+
| `--type` | `AI Exploitation`, `SCA`, `SAST`, `Secrets`, `IaC`, `Infrastructure` |
50+
| `--location` | repository full names or cloud accounts |
51+
| `--severity` | `critical`, `high`, `medium`, `low`, `unknown` |
52+
| `--ticket-status` | `created`, `not_created` |
53+
| `--compliance` | framework keys such as `soc2` |
54+
| `--validation` | `exploit_confirmed` |
55+
56+
Comma-separated values are accepted. The default page size is 30 and the maximum is 100. `--all` follows every cursor. If the first organization snapshot is still being built, the command waits up to 60 seconds; change that with `--max-wait <seconds>`.
57+
58+
For self-hosted GitHub, GitLab, Bitbucket, or Azure DevOps, the CLI normally discovers the provider base URL from the authenticated connection. Use `--provider-base-url` only to override it.
59+
60+
## All findings
61+
62+
Use `codeant findings` for first-class access to repository findings, organization Hotlist and anti-pattern findings, AWS/Azure/GCP cloud-security findings, and pentest engagements. The full command matrix, provider-specific fields, examples, and agent workflow are documented in the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings).
63+
64+
## Any app API
65+
66+
Use the generic request command when a first-class command does not exist yet:
67+
68+
```bash
69+
codeant api request GET /some/read/endpoint \
70+
--org CodeAnt-AI --service github \
71+
--query '{"page":1}'
72+
73+
codeant api request POST /some/app/endpoint \
74+
--org CodeAnt-AI --service github \
75+
--body '{"repo":"CodeAnt-AI/example"}'
76+
77+
codeant api request PATCH /some/app/endpoint \
78+
--org CodeAnt-AI --service github \
79+
--body-file ./request.json \
80+
--header 'If-Match: revision-123'
81+
```
82+
83+
The output is JSON:
84+
85+
```json
86+
{
87+
"ok": true,
88+
"status": 200,
89+
"tenant": {
90+
"org": "CodeAnt-AI",
91+
"service": "github"
92+
},
93+
"data": {}
94+
}
95+
```
96+
97+
Security properties:
98+
99+
- The path must start with `/` and is always resolved against the configured CodeAnt API host. Absolute and protocol-relative URLs are rejected, so the bearer token cannot be forwarded to another host.
100+
- Authentication is supplied from `CODEANT_API_TOKEN` or the key saved by `codeant login`.
101+
- `--org`, `--service`, and the discovered provider base URL must match one saved login connection exactly. They are auto-selected only when unambiguous. Use `--provider-base-url` for a self-hosted override.
102+
- POST/PUT/PATCH/DELETE bodies must be JSON objects. The CLI adds the selected tenant fields before sending the request; conflicting tenant values are rejected by the backend.
103+
- `Authorization`, `Cookie`, `Host`, `Content-Length`, and the `X-CodeAnt-CLI-*` tenant headers cannot be overridden.
104+
- The backend remains authoritative for account access, organization membership, RBAC, and endpoint authorization.
105+
106+
The generic command can call write endpoints. Review the method, path, and body before running it.
107+
108+
## Agent and MCP access
109+
110+
Run `codeant mcp` or install the CodeAnt MCP bundle. Agents receive dedicated read-only tools:
111+
112+
- `codeant_hotlist_list` — filter and page through organization-wide findings.
113+
- `codeant_hotlist_get` — fetch one finding by stable ID.
114+
- `codeant_api_get` — authenticated GET access for newly-added read APIs.
115+
- `codeant_findings_antipatterns` — selected or all-repository anti-pattern findings.
116+
- `codeant_cloud_scan_history`, `codeant_cloud_findings_list`, `codeant_cloud_finding_get` — cloud scan discovery, findings, and detail.
117+
- `codeant_pentest_history`, `codeant_pentest_issues`, `codeant_pentest_report` — pentest engagement discovery and results.
118+
119+
Set `CODEANT_READ_ONLY=0` to opt in to write tools, including `codeant_api_request` for POST/PUT/PATCH/DELETE. Read-only mode is the default. The MCP server never opens a browser during startup; the agent must explicitly call `codeant_login` when no token is configured.
120+
121+
## Troubleshooting
122+
123+
| Error | Resolution |
124+
|---|---|
125+
| No matching organization | Run `codeant scans orgs`, then pass its exact `organizationName` and `service`. |
126+
| Multiple organizations match | Pass both `--org` and `--service`. |
127+
| Access denied (403) | Run `codeant logout`, then `codeant login`, or replace `CODEANT_API_TOKEN`. |
128+
| Invalid token after upgrading | Older keys lack verified CLI identity metadata. Run `codeant logout`, then `codeant login`. |
129+
| Hotlist is still building | Retry, or increase `--max-wait`. |
130+
| Finding not found | Refresh the app/Hotlist and copy the current stable finding ID and tenant context. |

findings.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# CodeAnt findings CLI
2+
3+
`codeant findings` is the unified, read-only entry point for findings visible in the CodeAnt app. It reuses the same authenticated backend endpoints and authorization checks as the UI.
4+
5+
```bash
6+
codeant login
7+
codeant scans orgs
8+
codeant findings --help
9+
```
10+
11+
When one login has multiple connections, pass the exact `--org` and `--service` values returned by `codeant scans orgs`. A self-hosted provider base URL is discovered from the selected connection; use `--provider-base-url` only as an explicit override.
12+
13+
## Coverage
14+
15+
| App data | CLI command | Scope |
16+
|---|---|---|
17+
| Repository list | `codeant findings repos` | organization |
18+
| SAST, SCA, IaC, Secrets, SBOM | `codeant findings repo` | repository + scan/branch |
19+
| Anti-patterns, dead code, docstrings, complex functions | `codeant findings repo` | repository + scan/branch |
20+
| Prioritized SAST/SCA/IaC/Secrets/Infrastructure/AI Exploitation | `codeant findings list/get` | organization Hotlist |
21+
| Anti-patterns across repositories | `codeant findings antipatterns` | selected repos or organization |
22+
| AWS/Azure/GCP CSPM, VM, and container findings | `codeant findings cloud history/list/get` | organization + cloud resource scope |
23+
| Pentest engagements, issues, reports | `codeant findings pentest history/issues/report` | organization + engagement |
24+
25+
The existing `codeant scans repos`, `codeant scans results`, and `codeant hotlist list/get` commands remain supported. The unified commands are aliases or thin authenticated clients, so existing scripts do not need to migrate.
26+
27+
## Repository list and repo-level findings
28+
29+
```bash
30+
# List connected repositories
31+
codeant findings repos --org CodeAnt-AI
32+
33+
# Latest scan, all supported finding types
34+
codeant findings repo --repo CodeAnt-AI/example --types all
35+
36+
# Selected categories and severities
37+
codeant findings repo \
38+
--repo CodeAnt-AI/example \
39+
--branch main \
40+
--types sast,sca,iac,anti_patterns \
41+
--severity critical,high
42+
43+
# A specific scan, formatted for another tool
44+
codeant findings repo \
45+
--repo CodeAnt-AI/example \
46+
--scan 0123456789abcdef \
47+
--types sast,secrets \
48+
--format sarif \
49+
--output codeant.sarif
50+
```
51+
52+
Supported repo types are `sast`, `sca`, `secrets`, `iac`, `dead_code`, `sbom`, `anti_patterns`, `docstring`, and `complex_functions`. Use `--types all` for all of them. Formats are `json`, `sarif`, `csv`, `md`, and `table`; JSON is the default.
53+
54+
Use `--filter-dismissed` to exclude dismissed findings and `--no-false-positives` to exclude false positives. `--path`, `--check`, `--limit`, and `--offset` support agent-friendly filtering and pagination.
55+
56+
## Organization Hotlist findings
57+
58+
`findings list/get` exposes the same stable IDs, prioritization, filters, and cursor pagination as the app Hotlist.
59+
60+
```bash
61+
codeant findings list --org CodeAnt-AI --service github --severity critical,high
62+
codeant findings list --type SCA,IaC --location CodeAnt-AI/example --all
63+
codeant findings get 0123456789abcdef0123456789abcdef --org CodeAnt-AI --service github
64+
```
65+
66+
Hotlist types are `SAST`, `SCA`, `Secrets`, `IaC`, `Infrastructure`, and `AI Exploitation`. The last two cover prioritized cloud-security and pentest findings. Use the dedicated cloud and pentest commands below when complete scan/engagement data is required.
67+
68+
## Organization anti-patterns
69+
70+
```bash
71+
# Every repository in the selected organization
72+
codeant findings antipatterns --org CodeAnt-AI --service github
73+
74+
# Only selected repositories
75+
codeant findings antipatterns \
76+
--org CodeAnt-AI --service github \
77+
--repos CodeAnt-AI/api,CodeAnt-AI/web
78+
```
79+
80+
When `--repos` is omitted, the CLI first lists the organization's repositories and sends all of them to the same aggregate anti-pattern endpoint used by the Quality Report UI.
81+
82+
## Cloud security findings
83+
84+
Cloud findings are organization/account scoped rather than repository scoped.
85+
86+
```bash
87+
# History across AWS, Azure, and GCP
88+
codeant findings cloud history --org CodeAnt-AI --service github
89+
90+
# Latest scan per provider
91+
codeant findings cloud history --provider all --latest
92+
93+
# VM and container vulnerability scan histories
94+
codeant findings cloud history --provider all --kind vm
95+
codeant findings cloud history --provider all --kind container
96+
97+
# AWS findings and one full detail record
98+
codeant findings cloud list --provider aws --scan-id <scan-id> --account-id <account-id>
99+
codeant findings cloud get --provider aws --scan-id <scan-id> --uid <finding-uid> --cloud-service iam
100+
101+
# VM and container vulnerabilities use the same list/detail flow
102+
codeant findings cloud list --provider aws --kind vm --scan-id <scan-id>
103+
codeant findings cloud get --provider gcp --kind container --scan-id <scan-id> --uid <finding-uid>
104+
105+
# Azure requires the tenant ID
106+
codeant findings cloud list \
107+
--provider azure --tenant-id <tenant-id> --scan-id <scan-id> \
108+
--severity high --subscription-id <subscription-id>
109+
110+
# GCP requires the project ID
111+
codeant findings cloud list \
112+
--provider gcp --project-id <project-id> --scan-id <scan-id> \
113+
--framework cis
114+
```
115+
116+
`--kind` defaults to `cspm`; use `vm` or `container` for the other Cloud Security result views. CSPM `cloud list` supports `--cloud-service`, `--severity`, `--status`, `--framework`, and `--min-days-unused`. AWS additionally supports `--exploit-attempted-only`; Azure additionally supports `--subscription-id`. CSPM responses include `findings` and `dismissed_findings`; VM/container responses preserve their UI result payload unchanged.
117+
118+
## Pentest findings
119+
120+
```bash
121+
# Discover engagement IDs
122+
codeant findings pentest history --org CodeAnt-AI --service github
123+
124+
# All available open issues for an engagement
125+
codeant findings pentest issues --report-id <report-id>
126+
127+
# Full customer report
128+
codeant findings pentest report --report-id <report-id>
129+
130+
# Test-environment variant
131+
codeant findings pentest issues --report-id <report-id> --variant test
132+
codeant findings pentest report --report-id <report-id> --variant test
133+
```
134+
135+
`--variant prod` is the default. Pentest entitlements and critical/high redaction are enforced by the backend exactly as they are in the UI; the CLI does not bypass locked content.
136+
137+
## Agent/MCP tools
138+
139+
Agents can use these read-only MCP tools:
140+
141+
| Tool | Purpose |
142+
|---|---|
143+
| `codeant_scans_repos` | List repositories. |
144+
| `codeant_scans_results` | Fetch repo-level SAST/SCA/IaC/Secrets/quality findings. |
145+
| `codeant_hotlist_list`, `codeant_hotlist_get` | Query prioritized org-wide findings and stable IDs. |
146+
| `codeant_findings_antipatterns` | Fetch selected or all-repo anti-pattern findings. |
147+
| `codeant_cloud_scan_history` | Discover AWS/Azure/GCP scan IDs and scopes. |
148+
| `codeant_cloud_findings_list`, `codeant_cloud_finding_get` | List cloud findings and retrieve full detail. |
149+
| `codeant_pentest_history`, `codeant_pentest_issues`, `codeant_pentest_report` | Discover and inspect pentest engagements. |
150+
151+
All these tools are available in the default read-only MCP mode. A typical agent flow is discovery (`orgs` -> `repos`, cloud history, or pentest history), list/filter findings, then retrieve one detailed finding or report.
152+
153+
## Errors and access
154+
155+
| Error | Resolution |
156+
|---|---|
157+
| No or multiple matching organizations | Run `codeant scans orgs`; pass exact `--org` and `--service`. |
158+
| Access denied (403) | Run `codeant logout`, then `codeant login`. Older CLI keys must be refreshed once. |
159+
| Missing Azure/GCP scope | Pass `--tenant-id` for Azure or `--project-id` for GCP. |
160+
| Report or scan not found | Use the corresponding history command and verify the selected tenant/provider. |
161+
| Redacted pentest fields | Unlock the engagement in the app; CLI access follows the same entitlement. |
162+
163+
For current authentication, finding coverage, and agent guidance, see the [CodeAnt findings documentation](https://docs.codeant.ai/cli/findings).

0 commit comments

Comments
 (0)