@rafter-security/cli 0.7.7 → 0.7.9

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.
package/README.md CHANGED
@@ -1,709 +1,55 @@
1
1
  # @rafter-security/cli
2
2
 
3
- Node.js CLI for [Rafter](https://rafter.so) — the security toolkit for developers. This is the **full-featured package** with both local security and remote code analysis.
3
+ Node.js CLI for [Rafter](https://rafter.so) — the security toolkit for AI coding agents and developers. Secret scanning, command interception, policy enforcement, extension auditing, and audit logging. Local features run offline with no account required; remote SAST/SCA via `RAFTER_API_KEY` when needed.
4
4
 
5
- **Local security toolkit** Fast, deterministic secret scanning (21+ patterns, Gitleaks), policy enforcement with risk-tiered rules, pre-commit hooks, extension auditing, custom rule authoring, and full audit logging. Works with Claude Code, Codex CLI, OpenClaw, and 5 more platforms. No API key required. No data leaves your machine.
5
+ > **Full documentation lives in the repo root:** [README.md](https://github.com/Raftersecurity/rafter-cli/blob/main/README.md). This page is the package-level entry on npm and only covers Node-specific install and build notes everything else (commands, flags, exit codes, recipes, CI integrations, MCP server) is in the root README and [`shared-docs/CLI_SPEC.md`](https://github.com/Raftersecurity/rafter-cli/blob/main/shared-docs/CLI_SPEC.md).
6
6
 
7
- **Remote code analysis** — Deep security audits that combine agentic analysis with a full SAST/SCA toolchain. The engine examines your codebase the way a professional cybersecurity auditor would — tracing data flows, reasoning about business logic, and surfacing vulnerabilities that static rules alone miss — then cross-references findings with industry-standard static analysis and dependency scanning. Structured JSON reports with documented exit codes. Your code is deleted immediately after analysis completes.
8
-
9
- ## Installation
7
+ ## Install
10
8
 
11
9
  ```bash
12
- # Using npm
10
+ # Global CLI (recommended)
13
11
  npm install -g @rafter-security/cli
14
-
15
- # Using pnpm
16
12
  pnpm add -g @rafter-security/cli
17
-
18
- # Using yarn
19
13
  yarn global add @rafter-security/cli
20
- ```
21
-
22
- ## Quick Start
23
-
24
- ### Getting an API Key
25
-
26
- To use remote code analysis features, you'll need a Rafter API key:
27
-
28
- 1. **Sign up**: Create an account at [rafter.so](https://rafter.so)
29
- 2. **Get API key**: Navigate to Dashboard → Settings → API Keys
30
- 3. **Set environment variable**:
31
- ```bash
32
- export RAFTER_API_KEY="your-api-key-here"
33
- ```
34
- 4. **Or use `.env` file**:
35
- ```bash
36
- echo "RAFTER_API_KEY=your-api-key-here" >> .env
37
- ```
38
-
39
- **Note**: Agent security features (secret scanning, command execution) work **without an API key**. Only remote code analysis requires authentication.
40
-
41
- ### Remote Code Analysis
42
-
43
- ```bash
44
- # Set your API key (from above)
45
- export RAFTER_API_KEY="your-api-key-here"
46
-
47
- # Run a security scan (can also use 'rafter scan')
48
- rafter run
49
-
50
- # Get scan results
51
- rafter get <scan-id>
52
14
 
53
- # Check API usage
54
- rafter usage
15
+ # One-off, no install
16
+ npx @rafter-security/cli --help
55
17
  ```
56
18
 
57
- ### Local Security
19
+ After install, the `rafter` binary is on your `PATH`. Verify with `rafter --version`.
58
20
 
59
- ```bash
60
- # Initialize local security
61
- rafter agent init
62
- rafter agent init --local # write config to ./.rafter (ephemeral/benchmark)
63
-
64
- # Granular per-component control
65
- rafter agent list
66
- rafter agent enable claude-code
67
- rafter agent disable gemini
68
-
69
- # Scan files for secrets
70
- rafter agent scan .
71
- rafter agent scan --history # full git history (gitleaks engine)
72
-
73
- # Execute commands safely
74
- rafter agent exec "git commit -m 'Add feature'"
75
-
76
- # View audit logs (tamper-evident hash chain)
77
- rafter agent audit
78
- rafter agent audit --verify # verify chain; exit 1 if tampered
79
-
80
- # Manage configuration
81
- rafter agent config show
82
- ```
83
-
84
- ### Skills
85
-
86
- Four first-party skills ship with the CLI: `rafter` (CYOA router), `rafter-code-review`, `rafter-secure-design`, `rafter-skill-review`.
21
+ ## Quickstart
87
22
 
88
23
  ```bash
89
- rafter skill list # installed + available
90
- rafter skill install --all # install all four
91
- rafter skill review github:owner/repo # audit a third-party skill before install
92
- rafter skill review --installed # audit every skill already on disk
93
- ```
94
-
95
- ## Global Options
96
-
97
- | Flag | Description |
98
- |------|-------------|
99
- | `-a, --agent` | Plain output (no colors, no emoji) |
100
- | `-V, --version` | Print version |
101
- | `-h, --help` | Show help |
102
-
103
- ## Commands
24
+ # Find hardcoded secrets in the current directory
25
+ rafter secrets .
104
26
 
105
- ### `rafter run [options]`
106
- **Alias:** `rafter scan`
27
+ # Install Rafter into your AI coding agents (Claude Code, Codex, Cursor, etc.)
28
+ rafter agent init --all
107
29
 
108
- Trigger a new security scan for your repository.
109
-
110
- **Options:**
111
- - `-r, --repo <repo>` - Repository in format `org/repo` (default: auto-detected)
112
- - `-b, --branch <branch>` - Branch name (default: auto-detected)
113
- - `-k, --api-key <key>` - API key (or set `RAFTER_API_KEY` env var)
114
- - `-f, --format <format>` - Output format: `json` or `md` (default: `md`)
115
- - `--skip-interactive` - Don't wait for scan completion
116
- - `--quiet` - Suppress status messages
117
-
118
- **Examples:**
119
- ```bash
120
- # Basic scan with auto-detection
121
- rafter run
122
- # or
123
- rafter scan
124
-
125
- # Scan specific repo/branch
126
- rafter scan --repo myorg/myrepo --branch feature-branch
127
-
128
- # Non-interactive scan
129
- rafter scan --skip-interactive
130
- ```
131
-
132
- ### `rafter get <scan-id> [options]`
133
-
134
- Retrieve results from a completed scan.
135
-
136
- **Options:**
137
- - `-k, --api-key <key>` - API key (or set `RAFTER_API_KEY` env var)
138
- - `-f, --format <format>` - Output format: `json` or `md` (default: `md`)
139
- - `--interactive` - Poll until scan completes
140
- - `--quiet` - Suppress status messages
141
-
142
- **Examples:**
143
- ```bash
144
- # Get scan results
145
- rafter get <scan-id>
146
-
147
- # Wait for scan completion
148
- rafter get <scan-id> --interactive
149
- ```
150
-
151
- ### `rafter usage [options]`
152
-
153
- Check your API quota and usage.
154
-
155
- **Options:**
156
- - `-k, --api-key <key>` - API key (or set `RAFTER_API_KEY` env var)
157
-
158
- **Example:**
159
- ```bash
160
- rafter usage
30
+ # Scan a remote repo (needs RAFTER_API_KEY)
31
+ rafter run https://github.com/owner/repo
161
32
  ```
162
33
 
163
- ---
164
-
165
- ## Local Security Commands
166
-
167
- Rafter is a **security primitive** that any developer or tool can call and trust. Stable exit codes, deterministic findings, and structured output mean any workflow can integrate Rafter without reading prose.
34
+ See the [root README](https://github.com/Raftersecurity/rafter-cli/blob/main/README.md) for the full command reference, supported platforms, and integration recipes.
168
35
 
169
- ### `rafter agent init [options]`
36
+ ## Building from source
170
37
 
171
- Initialize local security system.
172
-
173
- **Options:**
174
- - `--risk-level <level>` - Set risk level: `minimal`, `moderate`, or `aggressive` (default: `moderate`)
175
- - `--with-openclaw` - Install OpenClaw integration
176
- - `--with-claude-code` - Install Claude Code integration
177
- - `--with-codex` - Install Codex CLI integration
178
- - `--with-gemini` - Install Gemini CLI integration
179
- - `--with-aider` - Install Aider integration
180
- - `--with-cursor` - Install Cursor integration
181
- - `--with-windsurf` - Install Windsurf integration
182
- - `--with-continue` - Install Continue.dev integration
183
- - `--with-gitleaks` - Download and install Gitleaks binary
184
- - `--all` - Install all detected integrations and download Gitleaks
185
-
186
- **What it does:**
187
- - Creates `~/.rafter/config.json` configuration
188
- - Initializes directory structure
189
- - Detects installed platforms
190
- - Installs opted-in integrations (skills, hooks, MCP servers)
191
- - Sets up audit logging
192
-
193
- **Example:**
194
38
  ```bash
195
- rafter agent init # Config only, detect environments
196
- rafter agent init --all # Install all detected integrations
197
- rafter agent init --with-claude-code # Install Claude Code integration only
198
- rafter agent init --risk-level aggressive
199
- ```
200
-
201
- ### `rafter agent scan [path] [options]`
202
-
203
- Scan files or directories for secrets.
204
-
205
- **Arguments:**
206
- - `path` - File or directory to scan (default: current directory)
207
-
208
- **Options:**
209
- - `-q, --quiet` - Only output if secrets found
210
- - `--json` - Output results as JSON
211
- - `--diff <ref>` - Scan files changed since a git ref (e.g., `HEAD~1`, `main`, `v1.0.0`)
212
-
213
- **Features:**
214
- - Detects 21+ secret types (AWS, GitHub, Stripe, Google, Slack, etc.)
215
- - Shows severity levels (critical/high/medium/low)
216
- - Displays line and column numbers
217
- - Smart redaction (shows first/last 4 chars)
218
- - Exits with code 1 if secrets found (CI-friendly)
219
-
220
- **Examples:**
221
- ```bash
222
- # Scan current directory
223
- rafter agent scan
224
-
225
- # Scan specific file
226
- rafter agent scan ./config.js
227
-
228
- # Scan files changed since a ref
229
- rafter agent scan --diff HEAD~1
230
- rafter agent scan --diff main
231
-
232
- # Scan for CI (quiet mode)
233
- rafter agent scan --quiet
234
-
235
- # JSON output for processing
236
- rafter agent scan --json
237
- ```
238
-
239
- **Detected patterns:**
240
- - AWS Access Keys & Secret Keys
241
- - GitHub Personal Access Tokens
242
- - Google API Keys
243
- - Slack Tokens & Webhooks
244
- - Stripe API Keys
245
- - Database connection strings
246
- - JWT tokens
247
- - npm & PyPI tokens
248
- - Private keys (RSA, DSA, EC)
249
- - Generic API keys and secrets
250
-
251
- ### `rafter agent exec <command> [options]`
252
-
253
- Execute shell command with security validation.
254
-
255
- **Arguments:**
256
- - `command` - Shell command to execute
257
-
258
- **Options:**
259
- - `--skip-scan` - Skip pre-execution file scanning
260
- - `--force` - Skip approval prompts (use with caution, logged in audit)
261
-
262
- **Features:**
263
- - Blocks critical commands automatically (rm -rf /, fork bombs)
264
- - Requires approval for high-risk operations
265
- - Scans staged files before git commits
266
- - Logs all executions to audit log
267
- - Risk assessment for all commands
268
-
269
- **Command risk levels:**
270
- - **Critical** (blocked): `rm -rf /`, fork bombs, `dd` to /dev, `mkfs`
271
- - **High** (requires approval): `rm -rf`, `sudo rm`, `chmod 777`, `curl|sh`, `git push --force`
272
- - **Medium** (requires approval on moderate+): `sudo`, `chmod`, `kill -9`
273
- - **Low** (allowed): Most other commands
274
-
275
- **Examples:**
276
- ```bash
277
- # Safe command - executes immediately
278
- rafter agent exec "npm install"
279
-
280
- # Git commit - scans staged files first
281
- rafter agent exec "git commit -m 'Add feature'"
282
-
283
- # High-risk command - requires approval
284
- rafter agent exec "sudo rm /tmp/old-files"
285
-
286
- # Critical command - blocked
287
- rafter agent exec "rm -rf /"
288
- ```
289
-
290
- ### `rafter agent config <subcommand>`
291
-
292
- Manage agent configuration.
293
-
294
- **Subcommands:**
295
- - `show` - Display full configuration
296
- - `get <key>` - Get specific configuration value
297
- - `set <key> <value>` - Set configuration value
298
-
299
- **Configuration keys:**
300
- - `agent.riskLevel` - Risk level: `minimal`, `moderate`, `aggressive`
301
- - `agent.commandPolicy.mode` - Policy mode: `allow-all`, `approve-dangerous`, `deny-list`
302
- - `agent.outputFiltering.redactSecrets` - Redact secrets in output: `true` or `false`
303
- - `agent.audit.logAllActions` - Log all actions: `true` or `false`
304
- - `agent.audit.retentionDays` - Log retention period (days)
305
-
306
- **Examples:**
307
- ```bash
308
- # View all configuration
309
- rafter agent config show
310
-
311
- # Get risk level
312
- rafter agent config get agent.riskLevel
313
-
314
- # Set to aggressive mode
315
- rafter agent config set agent.riskLevel aggressive
316
-
317
- # Change command policy
318
- rafter agent config set agent.commandPolicy.mode deny-list
319
- ```
320
-
321
- ### `rafter agent audit [options]`
322
-
323
- View security audit logs.
324
-
325
- **Options:**
326
- - `--last <n>` - Show last N entries (default: 10)
327
- - `--event <type>` - Filter by event type
328
- - `--agent <type>` - Filter by agent type (`openclaw`, `claude-code`)
329
- - `--since <date>` - Show entries since date (YYYY-MM-DD)
330
-
331
- **Event types:**
332
- - `command_intercepted` - Command execution attempts
333
- - `secret_detected` - Secret found in files
334
- - `content_sanitized` - Output redacted
335
- - `policy_override` - User override of security policy
336
- - `scan_executed` - File scan performed
337
- - `config_changed` - Configuration modified
338
-
339
- **Examples:**
340
- ```bash
341
- # Show recent audit logs
342
- rafter agent audit
343
-
344
- # Show last 20 entries
345
- rafter agent audit --last 20
346
-
347
- # Filter by event type
348
- rafter agent audit --event secret_detected
349
-
350
- # Show logs since date
351
- rafter agent audit --since 2026-02-01
352
- ```
353
-
354
- ### `rafter agent install-hook [options]`
355
-
356
- Install git pre-commit hook to automatically scan for secrets before commits.
357
-
358
- **Options:**
359
- - `--global` - Install globally for all repos (via git config)
360
-
361
- **Features:**
362
- - Automatically scans staged files before each commit
363
- - Blocks commits if secrets are detected
364
- - Zero-configuration security for git workflows
365
- - Can be bypassed with `git commit --no-verify` (not recommended)
366
-
367
- **Examples:**
368
- ```bash
369
- # Install for current repository
370
- cd my-repo
371
- rafter agent install-hook
372
-
373
- # Install globally for all repositories
374
- rafter agent install-hook --global
375
-
376
- # Uninstall global hook
377
- git config --global --unset core.hooksPath
378
- ```
379
-
380
- **What it does:**
381
- ```bash
382
- # When you commit:
383
- git add .env
384
- git commit -m "Update config"
385
-
386
- # Rafter automatically scans:
387
- 🔍 Rafter: Scanning staged files for secrets...
388
- ❌ Commit blocked: Secrets detected in staged files
389
-
390
- Run: rafter agent scan --staged
391
- To see details and remediate.
392
- ```
393
-
394
- **Why use pre-commit hooks?**
395
-
396
- Pre-commit hooks provide the most effective protection against accidentally committing secrets to git:
397
- - **Automatic**: No need to remember to scan manually
398
- - **Fail-safe**: Prevents secrets from entering version control
399
- - **CI-friendly**: Works locally before code reaches CI/CD
400
- - **Team-wide**: Can be committed to `.git/hooks` or distributed via git config
401
-
402
- Always install pre-commit hooks for repositories handling sensitive data.
403
-
404
- ### `rafter agent audit-skill <skill-path> [options]`
405
-
406
- Security audit of a Claude Code skill file before installation.
407
-
408
- **Arguments:**
409
- - `skill-path` - Path to skill file to audit
410
-
411
- **Options:**
412
- - `--skip-openclaw` - Skip OpenClaw integration, show manual review prompt
413
- - `--json` - Output results as JSON
414
-
415
- **Features:**
416
- - **Quick Scan**: Detects secrets, external URLs, high-risk commands
417
- - **Deep Analysis**: Uses OpenClaw's skill-auditor for comprehensive review (if installed)
418
- - **12 Security Dimensions**: Trust, network security, command safety, file access, credentials, input validation, data exfiltration, obfuscation, scope alignment, error handling, dependencies, environment manipulation
419
- - **Risk Rating**: LOW/MEDIUM/HIGH/CRITICAL assessment
420
- - **Actionable Recommendations**: Clear install/don't install guidance
421
-
422
- **Security Dimensions Analyzed:**
423
- 1. Trust & Attribution - Source verification
424
- 2. Network Security - External communication
425
- 3. Command Execution - Shell command safety
426
- 4. File System Access - Read/write patterns
427
- 5. Credential Handling - Secret management
428
- 6. Input Validation - Injection risks
429
- 7. Data Exfiltration - What leaves the system
430
- 8. Obfuscation - Hidden behavior detection
431
- 9. Scope Alignment - Matches stated purpose
432
- 10. Error Handling - Information disclosure
433
- 11. Dependencies - Supply chain risks
434
- 12. Environment Manipulation - System modifications
435
-
436
- **Examples:**
437
- ```bash
438
- # Audit a skill file
439
- rafter agent audit-skill ~/.openclaw/skills/untrusted-skill.md
440
-
441
- # Audit with OpenClaw (comprehensive)
442
- rafter agent audit-skill skill.md
443
- # Then in OpenClaw: /rafter-audit-skill /path/to/skill.md
444
-
445
- # Manual review prompt (no OpenClaw)
446
- rafter agent audit-skill skill.md --skip-openclaw
447
-
448
- # JSON output for automation
449
- rafter agent audit-skill skill.md --json
450
- ```
451
-
452
- **Example Output:**
453
- ```
454
- 🔍 Auditing skill: untrusted-skill.md
455
- ═══════════════════════════════════════════════════════════
456
- 📊 Quick Scan Results
457
- ⚠️ Secrets: 1 found
458
- ⚠️ External URLs: 2 found
459
- • https://api.example.com/v1/data
460
- • https://untrusted-cdn.com/script.js
461
- ⚠️ High-risk commands: 1 found
462
- • curl | bash (line 45)
463
-
464
- 🤖 For comprehensive security review:
465
- 1. Open OpenClaw
466
- 2. Run: /rafter-audit-skill /path/to/skill.md
467
- ```
468
-
469
- **Why audit skills?**
470
-
471
- Claude Code skills can:
472
- - Execute shell commands
473
- - Access sensitive files
474
- - Make network requests
475
- - Handle credentials
476
- - Process user input
477
-
478
- Always audit skills from untrusted sources before installation. The skill-auditor provides systematic analysis to identify security risks.
479
-
480
- ### `rafter mcp serve [options]`
481
-
482
- Start an MCP server exposing Rafter security tools over stdio transport. Any MCP-compatible client (Cursor, Windsurf, Claude Desktop, Cline, etc.) can connect.
483
-
484
- **Options:**
485
- - `--transport <type>` - Transport type (default: `stdio`)
486
-
487
- **MCP client config:**
488
- ```json
489
- {
490
- "rafter": {
491
- "command": "rafter",
492
- "args": ["mcp", "serve"]
493
- }
494
- }
495
- ```
496
-
497
- **Tools provided:**
498
-
499
- | Tool | Description |
500
- |------|-------------|
501
- | `scan_secrets` | Scan files/directories for hardcoded secrets. Params: `path` (required), `engine` (auto/gitleaks/patterns) |
502
- | `evaluate_command` | Check if a shell command is allowed by Rafter policy. Params: `command` (required) |
503
- | `read_audit_log` | Read audit log entries. Params: `limit`, `event_type`, `since` |
504
- | `get_config` | Read Rafter config. Params: `key` (optional dot-path) |
505
-
506
- **Resources provided:**
507
-
508
- | URI | Description |
509
- |-----|-------------|
510
- | `rafter://config` | Current Rafter configuration (JSON) |
511
- | `rafter://policy` | Active security policy — merged `.rafter.yml` + config (JSON) |
512
-
513
- ---
514
-
515
- ### `rafter ci init [options]`
516
-
517
- Generate CI/CD pipeline configuration for secret scanning.
518
-
519
- **Options:**
520
- - `--platform <platform>` - CI platform: `github`, `gitlab`, `circleci` (default: auto-detect)
521
- - `--output <path>` - Output file path (default: platform-specific)
522
- - `--with-remote` - Include remote security audit job (requires `RAFTER_API_KEY`)
523
-
524
- **Auto-detection:** Checks for `.github/`, `.gitlab-ci.yml`, `.circleci/` in the current directory.
525
-
526
- **Examples:**
527
- ```bash
528
- # Auto-detect platform
529
- rafter ci init
530
-
531
- # Generate GitHub Actions workflow
532
- rafter ci init --platform github
533
-
534
- # Include remote scanning job
535
- rafter ci init --with-remote
536
-
537
- # Custom output path
538
- rafter ci init --output .github/workflows/security.yml
539
- ```
540
-
541
- ---
542
-
543
- ## Policy File (`.rafter.yml`)
544
-
545
- Define per-project security policies by placing a `.rafter.yml` in your project root. The CLI walks from cwd up to git root looking for it.
546
-
547
- ```yaml
548
- version: "1"
549
- risk_level: moderate
550
- command_policy:
551
- mode: approve-dangerous
552
- blocked_patterns: ["rm -rf /"]
553
- require_approval: ["npm publish"]
554
- scan:
555
- exclude_paths: ["vendor/", "third_party/"]
556
- custom_patterns:
557
- - name: "Internal API Key"
558
- regex: "INTERNAL_[A-Z0-9]{32}"
559
- severity: critical
560
- audit:
561
- retention_days: 90
562
- log_level: info
563
- ```
564
-
565
- **Precedence:** Policy file values override `~/.rafter/config.json`. Arrays replace, not append.
566
-
567
- ---
568
-
569
- ## Configuration
570
-
571
- ### Environment Variables
572
-
573
- - `RAFTER_API_KEY` - Your Rafter API key (alternative to `--api-key` flag)
574
-
575
- ### Git Auto-Detection
576
-
577
- The CLI automatically detects your repository and branch from the current Git repository:
578
-
579
- 1. **Repository**: Extracted from Git remote URL
580
- 2. **Branch**: Current branch name, or `main` if on detached HEAD
581
-
582
- **Note**: The CLI only scans remote repositories, not your current local branch.
583
-
584
- ### Local Security Configuration
585
-
586
- Security settings are stored in `~/.rafter/config.json`. Key settings:
587
-
588
- **Risk Levels:**
589
- - `minimal` - Basic guidance only, most commands allowed
590
- - `moderate` - Standard protections, approval for high-risk commands (recommended)
591
- - `aggressive` - Maximum security, requires approval for most operations
592
-
593
- **Command Policy Modes:**
594
- - `allow-all` - Allow all commands (not recommended for production)
595
- - `approve-dangerous` - Require approval for high/critical risk commands (default)
596
- - `deny-list` - Block specific patterns, allow everything else
597
-
598
- **File Locations:**
599
- - Config: `~/.rafter/config.json`
600
- - Audit log: `~/.rafter/audit.jsonl`
601
- - Binaries: `~/.rafter/bin/`
602
- - Patterns: `~/.rafter/patterns/`
603
-
604
- ## OpenClaw Integration
605
-
606
- Rafter integrates seamlessly with [OpenClaw](https://openclaw.com).
607
-
608
- ### Setup
609
-
610
- When OpenClaw is detected, `rafter agent init` automatically installs a skill to `~/.openclaw/skills/rafter-security.md`.
611
-
612
- **What the skill provides:**
613
- - `/rafter-scan` - Scan files before commits
614
- - `/rafter-bash` - Execute commands with validation (via `rafter agent exec`)
615
- - `/rafter-audit-skill` - Comprehensive security audit of Claude Code skills
616
- - `/rafter-audit` - View security logs
617
-
618
- ### Usage in OpenClaw
619
-
620
- ```bash
621
- # In OpenClaw, use Rafter commands naturally:
622
- "Scan this directory for secrets"
623
- # OpenClaw will call: rafter agent scan .
624
-
625
- "Audit this skill for security issues"
626
- # OpenClaw will call: /rafter-audit-skill <path>
627
- # Provides comprehensive 12-dimension security analysis
628
-
629
- "Commit these changes"
630
- # OpenClaw will call: rafter agent exec "git commit -m '...'"
631
- # Rafter scans staged files first, blocks if secrets found
632
- ```
633
-
634
- ### Best Practices
635
-
636
- 1. **Install pre-commit hooks**: Run `rafter agent install-hook` to automatically scan before commits (recommended)
637
- 2. **Audit untrusted skills**: Run `/rafter-audit-skill` before installing skills from unknown sources
638
- 3. **Review blocked commands**: Check `rafter agent audit` when commands are blocked
639
- 4. **Configure appropriately**: Use `moderate` risk level for most use cases
640
- 5. **Keep patterns updated**: Patterns are updated automatically with CLI updates
641
-
642
- ## Claude Code Integration
643
-
644
- Rafter provides TWO skills for Claude Code:
645
-
646
- ### 1. Remote Code Analysis Skill (Core Feature)
647
-
648
- **Automatic Integration** - Claude can proactively suggest security scans
649
-
650
- **Commands:**
651
- - `rafter run` - Trigger security scan
652
- - `rafter get <scan-id>` - Get results
653
- - `rafter usage` - Check quota
654
-
655
- **Installation:**
656
- ```bash
657
- rafter agent init
658
- # Auto-detects Claude Code and installs both skills
659
- ```
660
-
661
- Or manually:
662
- ```bash
663
- cp -r node/.claude/skills/rafter ~/.claude/skills/
664
- ```
665
-
666
- **Usage:**
667
- Claude will automatically suggest Rafter scans when you mention security, vulnerabilities, or code analysis. You can also invoke manually:
668
- ```
669
- Can you run a Rafter security scan on this repo?
670
- ```
671
-
672
- ### 2. Local Security Skill
673
-
674
- **User-Invoked** - Requires explicit commands for safety
675
-
676
- **Commands:**
677
- - `/rafter-scan` - Scan files for secrets
678
- - `/rafter-bash` - Execute commands safely
679
- - `/rafter-audit-skill` - Audit skills before installing
680
- - `/rafter-audit` - View security logs
681
-
682
- **Installation:**
683
- ```bash
684
- rafter agent init
685
- # Installs automatically if Claude Code detected
686
- ```
687
-
688
- Or manually:
689
- ```bash
690
- cp -r node/.claude/skills/rafter-agent-security ~/.claude/skills/
691
- ```
692
-
693
- **Usage:**
694
- Explicitly invoke commands:
695
- ```
696
- /rafter-scan .
697
- /rafter-audit-skill untrusted-skill.md
39
+ git clone https://github.com/Raftersecurity/rafter-cli
40
+ cd rafter-cli/node
41
+ pnpm install
42
+ pnpm run build # TypeScript -> dist/
43
+ pnpm test # Vitest
44
+ node dist/index.js --help
698
45
  ```
699
46
 
700
- ### Why Two Skills?
47
+ The published package contains the compiled `dist/` only. `pnpm pack` produces the npm tarball; CI publishes via the workflow in `.github/workflows/`.
701
48
 
702
- - **Remote code analysis skill** - Safe for Claude to auto-invoke (read-only API calls)
703
- - **Agent security skill** - Requires user permission (local file access, command execution)
49
+ ## Python sibling
704
50
 
705
- This separation emphasizes Rafter's core remote code analysis capabilities while keeping local security features safely behind user control.
51
+ A feature-equivalent Python implementation is published as `rafter-cli` on PyPI. Both implementations share the same CLI surface and JSON output contract — see [`shared-docs/CLI_SPEC.md`](https://github.com/Raftersecurity/rafter-cli/blob/main/shared-docs/CLI_SPEC.md).
706
52
 
707
- ## Documentation
53
+ ## License
708
54
 
709
- For comprehensive documentation, API reference, and examples, see [https://docs.rafter.so](https://docs.rafter.so).
55
+ MIT see [LICENSE](https://github.com/Raftersecurity/rafter-cli/blob/main/LICENSE).