@stefanoginella/code-guardian 0.0.9 → 0.0.12

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.
Files changed (2) hide show
  1. package/README.md +55 -16
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -26,7 +26,50 @@ Auto-detects your project's tech stack and runs appropriate open-source CLI tool
26
26
  4. **Let the tools and Claude fix things** — tools with autofix support (Semgrep, ESLint, npm audit) handle what they can, and the security-fixer agent takes care of the rest with targeted code-level fixes.
27
27
  5. **Run `/code-guardian:code-guardian-ci`** to add security scanning to your CI pipeline if you haven't already.
28
28
 
29
- > ℹ️ **Scope options**: `codebase` (all tracked files), `uncommitted` (all local uncommitted work — staged + unstaged + untracked), or `unpushed` (all commits not yet pushed, compared against a base ref you choose).
29
+ ### Options
30
+
31
+ | Option | Values | Default | Description |
32
+ |--------|--------|---------|-------------|
33
+ | `--scope` | `codebase`, `uncommitted`, `unpushed` | `codebase` | What files to scan. `codebase` = all tracked files. `uncommitted` = staged + unstaged + untracked changes. `unpushed` = commits not yet pushed to remote. |
34
+ | `--tools` | comma-separated tool names | all available | Only run these specific tools (e.g. `--tools semgrep,gitleaks`). Others are skipped. |
35
+ | `--autofix` | — | off | Run tools with auto-fix flags and let the security-fixer agent handle the rest. |
36
+ | `--refresh` | — | off | Force re-detection of stack and tools, ignoring the 24-hour cache. |
37
+
38
+ These can also be set as persistent defaults in `.claude/code-guardian.config.json` — see [Configuration](#️-configuration) below. CLI arguments always override config values.
39
+
40
+ **Examples:**
41
+
42
+ ```
43
+ /code-guardian:code-guardian-scan # scan everything, pick scope interactively
44
+ /code-guardian:code-guardian-scan --scope uncommitted # only scan your local changes
45
+ /code-guardian:code-guardian-scan --scope unpushed # scan commits not yet pushed
46
+ /code-guardian:code-guardian-scan --scope uncommitted --autofix # auto-fix local changes
47
+ /code-guardian:code-guardian-scan --tools semgrep,gitleaks # only run specific tools
48
+ ```
49
+
50
+ ## ⚙️ Configuration
51
+
52
+ Scan defaults can be persisted in `.claude/code-guardian.config.json` so you don't have to pass flags every time. Create it manually or run `/code-guardian:code-guardian-setup` to configure interactively.
53
+
54
+ ```json
55
+ {
56
+ "tools": ["semgrep", "gitleaks", "trivy"],
57
+ "disabled": ["trufflehog"],
58
+ "scope": "uncommitted",
59
+ "autofix": false
60
+ }
61
+ ```
62
+
63
+ | Key | Type | Default | Description |
64
+ |-----|------|---------|-------------|
65
+ | `tools` | `string[]` | all available | Only run these tools. Omit to run everything available. |
66
+ | `disabled` | `string[]` | none | Never run these tools, even if available. |
67
+ | `scope` | `string` | `"codebase"` | Default scan scope: `codebase`, `uncommitted`, or `unpushed`. |
68
+ | `autofix` | `boolean` | `false` | Auto-fix findings by default. |
69
+
70
+ **Precedence:** CLI flags always win over config values. If both `tools` and `disabled` are set, `tools` takes precedence. Omitted keys use built-in defaults.
71
+
72
+ This file should be committed to the repo so the team shares the same scan defaults.
30
73
 
31
74
  ## 🔍 Scan Modes
32
75
 
@@ -53,13 +96,13 @@ All tools are free, open-source, and work on private repositories with no limita
53
96
  | Category | Tool | Languages/Targets | Autofix | Docker Image |
54
97
  |----------|------|-------------------|---------|--------------|
55
98
  | SAST | Semgrep | Multi-language (30+) | Yes | `semgrep/semgrep` |
56
- | SAST | Bandit | Python | No | |
99
+ | SAST | Bandit | Python | No | `python:3-slim` |
57
100
  | SAST | gosec | Go | No | `securego/gosec` |
58
101
  | SAST | Brakeman | Ruby/Rails | No | `presidentbeef/brakeman` |
59
102
  | SAST | ESLint (security) | JS/TS | Partial | — |
60
103
  | SAST | PHPStan | PHP | No | `ghcr.io/phpstan/phpstan` |
61
104
  | Secrets | Gitleaks | All | No | `zricethezav/gitleaks` |
62
- | Secrets | TruffleHog | All (filesystem + git) | No | `trufflesecurity/trufflehog` |
105
+ | Secrets | TruffleHog | All (filesystem) | No | `trufflesecurity/trufflehog` |
63
106
  | Dependencies | OSV-Scanner | All ecosystems | No | `ghcr.io/google/osv-scanner` |
64
107
  | Dependencies | npm audit | JS/TS | Yes | — |
65
108
  | Dependencies | pip-audit | Python | Yes | — |
@@ -68,7 +111,7 @@ All tools are free, open-source, and work on private repositories with no limita
68
111
  | Dependencies | govulncheck | Go | No | — |
69
112
  | Container | Trivy | Images, FS, IaC | No | `aquasec/trivy` |
70
113
  | Container | Hadolint | Dockerfiles | No | `hadolint/hadolint` |
71
- | Container | Dockle | Docker images | No | `goodwithtech/dockle` |
114
+ | Container | Dockle | Docker images (manual) | No | `goodwithtech/dockle` |
72
115
  | IaC | Checkov | Terraform, CFN, K8s | No | `bridgecrew/checkov` |
73
116
 
74
117
  > ⚠️ Tools without a Docker image require local installation. The plugin will tell you exactly what to install and how — or you can run `/code-guardian:code-guardian-setup` to walk through it interactively.
@@ -105,7 +148,7 @@ claude --plugin-dir /path/to/plugins/code-guardian
105
148
 
106
149
  ### Recommended
107
150
 
108
- - **Docker** — the plugin prefers running tools via their official Docker images. This avoids installation headaches, ensures consistent versions, and keeps your system clean. Without Docker, tools must be installed locally.
151
+ - **Docker** — the plugin falls back to official Docker images when tools aren't installed locally. This avoids installation headaches and ensures tools are always available. Without Docker, tools must be installed locally.
109
152
 
110
153
  ### Security Tools
111
154
 
@@ -129,13 +172,14 @@ code-guardian/
129
172
  │ └── references/
130
173
  ├── scripts/
131
174
  │ ├── lib/ # Shared utilities and tool registry
132
- │ │ ├── common.sh # Colors, logging, container detection, scope management
175
+ │ │ ├── common.sh # Colors, logging, Docker helpers, scope management
133
176
  │ │ └── tool-registry.sh # Stack → tools mapping, install commands, Docker images
134
177
  │ ├── scanners/ # 18 individual scanner wrappers (unified JSONL output)
135
178
  │ ├── detect-stack.sh # Detects languages, frameworks, Docker, CI, IaC
136
- │ ├── check-tools.sh # Checks tool availability (container + Docker + local)
179
+ │ ├── check-tools.sh # Checks tool availability (local + Docker)
137
180
  │ ├── scan.sh # Main scan orchestrator
138
181
  │ ├── ci-recommend.sh # CI config generator
182
+ │ ├── read-config.sh # Reads project config (.claude/code-guardian.config.json)
139
183
  │ └── cache-state.sh # Cache I/O for stack + tools detection results
140
184
  └── .claude-plugin/
141
185
  └── plugin.json
@@ -143,13 +187,10 @@ code-guardian/
143
187
 
144
188
  ### How the Deterministic Layer Works
145
189
 
146
- Each scanner wrapper follows a three-tier execution strategy:
190
+ Each scanner wrapper follows a two-tier execution strategy:
147
191
 
148
- 1. **Project container** — If docker-compose services are running, the plugin probes them for tool binaries. If semgrep is already installed in your `app` or `dev` container, it runs there. No extra images pulled, no re-installation.
149
- 2. **Standalone Docker image** — If the tool isn't in a running container but Docker is available, it runs via the tool's official Docker image (pulled on demand).
150
- 3. **Local binary** — Falls back to a locally installed binary if neither container option is available.
151
-
152
- This means if your `docker-compose.yml` already has a service with security tools installed, code-guardian will find and use them automatically — no duplication.
192
+ 1. **Local binary** — If the tool is installed locally, it runs directly. Fastest option, zero overhead, respects your installed version and configuration.
193
+ 2. **Docker image** — If the tool isn't installed locally but Docker is available, it runs via the tool's official Docker image (pulled on demand). Consistent version, no local installation needed.
153
194
 
154
195
  After choosing the execution environment, each wrapper:
155
196
  1. Runs the tool with appropriate flags for the requested scope
@@ -165,7 +206,7 @@ This means Claude always gets findings in the same shape regardless of which too
165
206
 
166
207
  ### State Caching
167
208
 
168
- The plugin caches stack detection and tool availability results in `.claude/code-guardian-cache.json` (already gitignored). This avoids re-running container probing, Docker checks, and binary lookups on every command.
209
+ The plugin caches stack detection and tool availability results in `.claude/code-guardian-cache.json` (already gitignored). This avoids re-running Docker checks and binary lookups on every command.
169
210
 
170
211
  - **`setup`** writes the cache after detecting the stack and verifying tools
171
212
  - **`scan`** and **`ci`** read from the cache if it's fresh (< 24 hours), skipping re-detection
@@ -178,8 +219,6 @@ The scan command runs bash scripts that invoke Docker or local CLI tools. Claude
178
219
 
179
220
  - `Bash(bash */code-guardian/scripts/*)`
180
221
 
181
- > ⚠️ Alternatively, you can run Claude Code in `--dangerously-skip-permissions` mode, but do so at your own risk — this disables **all** permission checks. Only use it in an isolated environment.
182
-
183
222
  ## 📄 License
184
223
 
185
224
  [MIT](../../LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stefanoginella/code-guardian",
3
- "version": "0.0.9",
3
+ "version": "0.0.12",
4
4
  "description": "Installs the code-guardian Claude Code plugin — deterministic security scanning layer",
5
5
  "bin": {
6
6
  "code-guardian": "cli.js"