Skip to content

Commit 986bc4d

Browse files
committed
Initial commit
0 parents  commit 986bc4d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+10679
-0
lines changed

.github/workflows/publish.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish Package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: '20'
19+
registry-url: 'https://registry.npmjs.org'
20+
21+
- run: npm ci
22+
23+
- run: npm publish --access public
24+
env:
25+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Logs
5+
*.log
6+
npm-debug.log*
7+
8+
# Runtime
9+
.env
10+
.env.local
11+
.env.*.local
12+
13+
# OS files
14+
.DS_Store
15+
Thumbs.db
16+
17+
# IDE
18+
.idea/
19+
.vscode/
20+
*.swp
21+
*.swo
22+
23+
# Build output
24+
dist/
25+
build/
26+
27+
# Yarn lock (if using npm)
28+
yarn.lock
29+
30+
# Coverage
31+
coverage/
32+
33+
# Shell scripts
34+
*.sh

README.md

Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
# CodeAnt CLI
2+
3+
A command-line tool for code review and security scanning.
4+
5+
## Installation
6+
7+
```bash
8+
npm install -g codeant-cli
9+
```
10+
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+
```
19+
20+
## Quick Start
21+
22+
```bash
23+
# Login to CodeAnt
24+
codeant login
25+
26+
# Scan staged files for secrets
27+
codeant secrets
28+
```
29+
30+
## Usage
31+
32+
```bash
33+
codeant <command> [options]
34+
```
35+
36+
### Commands
37+
38+
#### `login`
39+
40+
Authenticate with CodeAnt. Opens a browser window for login.
41+
42+
```bash
43+
codeant login
44+
```
45+
46+
#### `logout`
47+
48+
Log out from CodeAnt.
49+
50+
```bash
51+
codeant logout
52+
```
53+
54+
#### `secrets`
55+
56+
Scan your code for exposed secrets, API keys, and credentials.
57+
58+
```bash
59+
codeant secrets [options]
60+
```
61+
62+
**Options:**
63+
64+
| Option | Description |
65+
|--------|-------------|
66+
| `--staged` | Scan only staged files (default) |
67+
| `--all` | Scan all changed files compared to base branch |
68+
| `--uncommitted` | Scan all uncommitted changes |
69+
| `--last-commit` | Scan files from the last commit |
70+
| `--fail-on <level>` | Fail only on HIGH, MEDIUM, or all (default: HIGH) |
71+
| `--include <patterns>` | Comma-separated glob patterns to include files |
72+
| `--exclude <patterns>` | Comma-separated glob patterns to exclude files |
73+
74+
**Examples:**
75+
76+
```bash
77+
# Scan staged files (default)
78+
codeant secrets
79+
80+
# Scan all changed files
81+
codeant secrets --all
82+
83+
# Scan last commit
84+
codeant secrets --last-commit
85+
86+
# Only fail on HIGH confidence secrets (default)
87+
codeant secrets --fail-on HIGH
88+
89+
# Fail on HIGH and MEDIUM confidence secrets
90+
codeant secrets --fail-on MEDIUM
91+
92+
# Fail on all secrets (except false positives)
93+
codeant secrets --fail-on all
94+
95+
# Filter files using glob patterns
96+
codeant secrets --include '**/*.js' # Only JS files
97+
codeant secrets --exclude 'node_modules/**,*.test.js' # Exclude patterns
98+
codeant secrets --include 'src/**' --exclude '*.test.*' # Combine both
99+
```
100+
101+
**File Filtering:**
102+
103+
Use `--include` and `--exclude` with glob patterns to filter files:
104+
- `*` matches any characters except `/`
105+
- `**` matches any characters including `/`
106+
- `*.{js,ts}` matches multiple extensions
107+
- Comma-separated for multiple patterns: `--exclude 'test/**,dist/**'`
108+
109+
**Exit codes:**
110+
- `0` - No blocking secrets found (or only false positives)
111+
- `1` - Secrets detected that match the `--fail-on` threshold
112+
113+
**Confidence Levels:**
114+
- `HIGH` - High confidence, likely a real secret
115+
- `MEDIUM` - Medium confidence, may need review
116+
- `FALSE_POSITIVE` - Detected but likely not a real secret (always ignored)
117+
118+
#### `set-base-url <url>`
119+
120+
Set a custom API base URL.
121+
122+
```bash
123+
codeant set-base-url https://api.example.com
124+
```
125+
126+
#### `get-base-url`
127+
128+
Show the current API base URL and its source.
129+
130+
```bash
131+
codeant get-base-url
132+
```
133+
134+
### Global Options
135+
136+
```bash
137+
codeant --version # Show version
138+
codeant --help # Show help
139+
```
140+
141+
## Configuration
142+
143+
Config is stored in `~/.codeant/config.json`.
144+
145+
You can also use environment variables:
146+
147+
| Variable | Description |
148+
|----------|-------------|
149+
| `CODEANT_API_URL` | API base URL (overrides config) |
150+
| `CODEANT_API_TOKEN` | Authentication token (overrides config) |
151+
152+
**Priority order:**
153+
1. Environment variables (highest)
154+
2. Config file (`~/.codeant/config.json`)
155+
3. Default values
156+
157+
## Git Hooks
158+
159+
Use CodeAnt as a pre-commit hook to prevent secrets from being committed.
160+
161+
### Manual Setup
162+
163+
Create `.git/hooks/pre-commit`:
164+
165+
```bash
166+
#!/bin/sh
167+
codeant secrets
168+
```
169+
170+
Make it executable:
171+
172+
```bash
173+
chmod +x .git/hooks/pre-commit
174+
```
175+
176+
### With Husky
177+
178+
```bash
179+
npx husky add .husky/pre-commit "codeant secrets"
180+
```
181+
182+
### With lefthook
183+
184+
Add to `lefthook.yml`:
185+
186+
```yaml
187+
pre-commit:
188+
commands:
189+
secrets:
190+
run: codeant secrets
191+
```
192+
193+
## Example Output
194+
195+
### Secrets Found (blocking)
196+
197+
```
198+
✗ 2 secret(s) found!
199+
200+
src/config.js
201+
Line 5: AWS Access Key (HIGH)
202+
Line 12: API Key (HIGH)
203+
204+
Remove secrets before committing.
205+
```
206+
207+
### Only False Positives (non-blocking)
208+
209+
```
210+
⚠ 1 potential secret(s) found (ignored)
211+
212+
Ignored (false positives):
213+
src/example.js
214+
Line 10: Generic Secret (FALSE_POSITIVE)
215+
216+
✓ Commit allowed (only false positives found)
217+
```
218+
219+
### No Secrets
220+
221+
```
222+
✓ No secrets found
223+
```
224+
225+
## Development
226+
227+
```bash
228+
# Run locally
229+
node src/index.js secrets
230+
231+
# Run with npm
232+
npm start secrets
233+
234+
# Test different scan types
235+
node src/index.js secrets --last-commit
236+
node src/index.js secrets --all
237+
```
238+
239+
## License
240+
241+
MIT

changelog.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Changelog
2+
3+
## [0.3.3] - 25/03/2026
4+
- Bug fixes
5+
6+
## [0.3.2] - 23/03/2026
7+
- Add resolve conversation feature for all SCM providers (GitHub, GitLab, Bitbucket, Azure DevOps)
8+
- Add `codeant pr resolve` CLI command
9+
10+
## [0.3.1] - 23/03/2026
11+
- Bug fixes
12+
13+
## [0.3.0] - 23/03/2026
14+
- Token optimization
15+
16+
## [0.2.9] - 23/03/2026
17+
- Updated url
18+
19+
## [0.2.8] - 23/03/2026
20+
- Updated url
21+
22+
## [0.2.7] - 22/03/2026
23+
- Analytics tracking
24+
25+
## [0.2.6] - 21/03/2026
26+
- API Key mapping
27+
28+
## [0.2.5] - 21/03/2026
29+
- Secrets matching better
30+
31+
## [0.2.4] - 21/03/2026
32+
- Deprecation of some features
33+
34+
## [0.2.3] - 21/03/2026
35+
- Better CodeAnt review matching
36+
37+
## [0.2.2] - 20/03/2026
38+
- Headless mode
39+
40+
## [0.2.1] - 20/03/2026
41+
- Per-file parallel agentic review
42+
43+
## [0.2.0] - 19/03/2026
44+
- Add SCM integration layer with support for GitHub, GitLab, Bitbucket, and Azure DevOps
45+
46+
## [0.1.9] - 19/03/2026
47+
- Bug fixes
48+
49+
## [0.1.8] - 19/03/2026
50+
- Bug fixes
51+
52+
## [0.1.7] - 19/03/2026
53+
- Bug fixes
54+
55+
## [0.1.6] - 19/03/2026
56+
- CLI UI Improvements
57+
- More review trigger options

0 commit comments

Comments
 (0)