Skip to content

Commit 3778a7e

Browse files
committed
docs: update README with all v1.0.0 features
Add documentation for auto-fix engine (--fix), secure init command, HTML report format, streaming Opus analysis (--opus --stream), GitHub Action with inputs/outputs tables, CLI reference section, and updated architecture diagram reflecting new modules.
1 parent 3415b98 commit 3778a7e

1 file changed

Lines changed: 127 additions & 25 deletions

File tree

β€ŽREADME.mdβ€Ž

Lines changed: 127 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,104 @@ Built at the [Claude Code Hackathon](https://cerebralvalley.ai/e/claude-code-hac
1111
## Quick Start
1212

1313
```bash
14-
# Install
15-
npm install -g agentshield
14+
# Scan your Claude Code config (no install required)
15+
npx agentshield scan
1616

17-
# Scan your Claude Code config
17+
# Or install globally
18+
npm install -g agentshield
1819
agentshield scan
1920

2021
# Scan a specific directory
2122
agentshield scan --path /path/to/.claude
2223

23-
# Output as JSON
24-
agentshield scan --format json
25-
2624
# Auto-fix safe issues
2725
agentshield scan --fix
26+
27+
# Generate an HTML security report
28+
agentshield scan --format html > report.html
29+
30+
# Run Opus 4.6 adversarial analysis with real-time streaming
31+
agentshield scan --opus --stream
32+
33+
# Generate a secure baseline config
34+
agentshield init
35+
```
36+
37+
## Features
38+
39+
### Static Analysis (`agentshield scan`)
40+
41+
Rule-based scanning with 16 rules across 5 categories, graded A-F with a 0-100 numeric score.
42+
43+
### Auto-Fix Engine (`--fix`)
44+
45+
Automatically applies safe fixes for detected issues:
46+
- Replaces hardcoded secrets with `${ENV_VAR}` references
47+
- Tightens wildcard permissions (`Bash(*)` β†’ scoped `Bash(git *)`, `Bash(npm *)`)
48+
- Generic string-replacement transforms for other fixable patterns
49+
50+
Only `auto: true` fixes are applied. Files are never overwritten without a matching pattern.
51+
52+
### Secure Init (`agentshield init`)
53+
54+
Generates a hardened `.claude/` directory with:
55+
- **settings.json** β€” scoped permissions (no `Bash(*)`) and safety hooks
56+
- **CLAUDE.md** β€” security best practices for the AI agent
57+
- **mcp.json** β€” empty MCP config placeholder
58+
59+
Existing files are never overwritten.
60+
61+
### Opus 4.6 Deep Analysis (`--opus`)
62+
63+
Three-agent adversarial pipeline powered by Claude Opus 4.6:
64+
65+
1. **Red Team (Attacker)** β€” finds exploitable attack vectors
66+
2. **Blue Team (Defender)** β€” recommends concrete hardening measures
67+
3. **Auditor** β€” synthesizes both perspectives into a final risk assessment
68+
69+
```bash
70+
# Run with Opus analysis
71+
agentshield scan --opus
72+
73+
# Stream Opus analysis in real-time
74+
agentshield scan --opus --stream
2875
```
2976

77+
Requires `ANTHROPIC_API_KEY` environment variable.
78+
79+
### GitHub Action
80+
81+
Add AgentShield to your CI pipeline:
82+
83+
```yaml
84+
- name: AgentShield Security Scan
85+
uses: affaan-m/agentshield@main
86+
with:
87+
path: "."
88+
min-severity: "medium"
89+
fail-on-findings: "true"
90+
```
91+
92+
**Inputs:**
93+
94+
| Input | Default | Description |
95+
|-------|---------|-------------|
96+
| `path` | `.` | Path to scan |
97+
| `min-severity` | `medium` | Minimum severity: critical, high, medium, low, info |
98+
| `fail-on-findings` | `true` | Fail the action if findings are detected |
99+
| `format` | `terminal` | Output format |
100+
101+
**Outputs:**
102+
103+
| Output | Description |
104+
|--------|-------------|
105+
| `score` | Numeric security score (0-100) |
106+
| `grade` | Letter grade (A-F) |
107+
| `total-findings` | Total number of findings |
108+
| `critical-count` | Number of critical findings |
109+
110+
The action writes a markdown job summary and emits GitHub annotations (warnings/errors) inline on affected files.
111+
30112
## What It Catches
31113

32114
### Secrets Detection
@@ -85,37 +167,54 @@ agentshield scan --fix
85167
| Terminal | `--format terminal` (default) | Interactive use, demos |
86168
| JSON | `--format json` | CI pipelines, programmatic use |
87169
| Markdown | `--format markdown` | Documentation, PRs |
170+
| HTML | `--format html` | Self-contained dark-themed report |
88171
89-
## CI Integration
172+
## CLI Reference
90173
91-
AgentShield exits with code 2 when critical findings are detected, making it easy to integrate into CI pipelines:
92-
93-
```yaml
94-
- name: Security audit
95-
run: npx agentshield scan --min-severity high
174+
```
175+
agentshield scan [options] Scan a configuration directory
176+
-p, --path <path> Path to scan (default: ~/.claude or cwd)
177+
-f, --format <format> Output: terminal, json, markdown, html
178+
--fix Auto-apply safe fixes
179+
--opus Enable Opus 4.6 multi-agent analysis
180+
--stream Stream Opus analysis in real-time
181+
--min-severity <severity> Filter: critical, high, medium, low, info
182+
-v, --verbose Show detailed output
183+
184+
agentshield init [options] Generate secure baseline config
96185
```
97186
98187
## Architecture
99188
100189
```
101190
src/
102191
β”œβ”€β”€ index.ts CLI entry point (commander)
103-
β”œβ”€β”€ types.ts Type system (Finding, Rule, Report, Score)
192+
β”œβ”€β”€ action.ts GitHub Action entry point
193+
β”œβ”€β”€ types.ts Type system + Zod schemas
104194
β”œβ”€β”€ scanner/
105195
β”‚ β”œβ”€β”€ discovery.ts Config file discovery
106-
β”‚ └── index.ts Main scan orchestrator
196+
β”‚ └── index.ts Scan orchestrator
107197
β”œβ”€β”€ rules/
108198
β”‚ β”œβ”€β”€ index.ts Rule registry
109199
β”‚ β”œβ”€β”€ secrets.ts Secret detection (11 patterns)
110-
β”‚ β”œβ”€β”€ mcp.ts MCP server security (4 rules)
111200
β”‚ β”œβ”€β”€ permissions.ts Permission audit (3 rules)
112-
β”‚ β”œβ”€β”€ agents.ts Agent config review
113-
β”‚ └── hooks.ts Hook security analysis
114-
└── reporter/
115-
β”œβ”€β”€ index.ts Report orchestrator
116-
β”œβ”€β”€ terminal.ts Color terminal output
117-
β”œβ”€β”€ json.ts JSON + Markdown output
118-
└── score.ts Security scoring (A-F grades)
201+
β”‚ β”œβ”€β”€ mcp.ts MCP server security (4 rules)
202+
β”‚ β”œβ”€β”€ hooks.ts Hook security analysis
203+
β”‚ └── agents.ts Agent config review
204+
β”œβ”€β”€ reporter/
205+
β”‚ β”œβ”€β”€ score.ts Scoring engine (A-F grades)
206+
β”‚ β”œβ”€β”€ terminal.ts Color terminal output
207+
β”‚ β”œβ”€β”€ json.ts JSON + Markdown output
208+
β”‚ └── html.ts Self-contained HTML report
209+
β”œβ”€β”€ fixer/
210+
β”‚ β”œβ”€β”€ transforms.ts Fix transforms (secret, permission, generic)
211+
β”‚ └── index.ts Fix engine orchestrator
212+
β”œβ”€β”€ init/
213+
β”‚ └── index.ts Secure config generator
214+
└── opus/
215+
β”œβ”€β”€ prompts.ts Attacker/Defender/Auditor system prompts
216+
β”œβ”€β”€ pipeline.ts Three-agent Opus 4.6 pipeline
217+
└── render.ts Opus analysis rendering
119218
```
120219
121220
## Security Rules
@@ -137,15 +236,18 @@ npm install
137236
# Development mode
138237
npm run dev scan --path examples/vulnerable
139238
239+
# Run tests (202 tests)
240+
npm test
241+
242+
# Run tests with coverage
243+
npm run test:coverage
244+
140245
# Type check
141246
npm run typecheck
142247
143248
# Build
144249
npm run build
145250
146-
# Run tests
147-
npm test
148-
149251
# Demo scan (vulnerable examples)
150252
npm run scan:demo
151253
```

0 commit comments

Comments
Β (0)