vulkro-sf fix
Generates a reviewable fix for each finding that has a well-defined one: a patch to the scanned file, the Setup page where the same change is made by hand, and sf commands to validate and deploy it. It never deploys and never changes the org.
vulkro-sf fix . # summary with Setup links and commands
vulkro-sf fix . --format diff | git apply # apply every verified patch
vulkro-sf fix . --format bundle --out fixes.zip # patched files, diffs, README, scripts
Examples: removing ModifyAllData from a permission set, requiring PKCE on a connected app, making an Apex class with sharing, adding WITH USER_MODE to a query. Every patch is verified by scanning the patched project again, and kept only when its finding is gone and no new finding appears in the file.
| Flag | What it does |
|---|---|
[PATH] | SFDX project or retrieved metadata. Default .. |
--format <table|json|diff|bundle> | Output format. Default table. |
--finding <id> | Fix only these findings (repeatable or comma-separated; alias --id). |
--out <path> | Where bundle writes: an empty folder or a .zip. Default vulkro-sf-fix-bundle. |
--instance-url <url> | Your org's URL, for complete Setup links. |
--no-verify | Skip the verification re-scan (the output says the patches are unverified). |
AI fixes for Apex
--ai asks the local model set up with vulkro-sf ai for a minimal patch to CRUD and FLS, sharing, and SOQL injection findings. Each patch is kept as verified only if the class still parses, the finding is gone and no new finding appears; otherwise it is refused with a reason.
| Flag | What it does |
|---|---|
--ai | Show the AI patches (read-only). |
--ai --write | Apply only the verified AI patches, each printed first. |
--ai-model, --ai-url, --no-ai | Override the model for this run, or turn AI off. |
AI fixes are advisory and never change the exit code.
Exit codes
| Code | Meaning |
|---|---|
0 | No findings. |
1 | Findings reported. |
2 | Error. |
Command reference
Generated from vulkro-sf fix --help (vulkro-sf 0.33.0). Run scripts/gen-docs.sh in the product repository to refresh it; do not edit this section by hand.
Generate reviewable fixes (patches, Setup links, sf scripts) for findings; never deploys.
vulkro-sf fix [OPTIONS] [PATH]
Arguments
| Argument | Description |
|---|---|
[PATH] | Path to the SFDX project or retrieved metadata (defaults to the current directory) Default: .. |
Options
| Flag | Description |
|---|---|
--ai | Turn on the AI fix tier. Without it, fix reports the fixable Apex findings and does nothing else (no model is called) |
--write | Apply ONLY the AI diffs the deterministic re-scan verified, in place (atomic temp file + rename), each printed as a diff first. Requires --ai. Conflicts with --dry-run |
--dry-run | Preview the verified AI diffs without touching any file (the default when --write is absent). Informational; the exit code is unchanged. |
--ai-model <MODEL> | AI model tag override (highest precedence). Overrides VULKRO_AI_MODEL, the saved vulkro-sf ai use selection, and the smart default. |
--ai-url <URL> | AI runtime base url override (OpenAI-compatible). A loopback url is allowed under VULKRO_OFFLINE; a cloud url is refused offline. |
--no-ai | Disable the AI layer for this run (report fixable findings only) |
-f, --format <FORMAT> | Output format: table (default: remedies with Setup links and commands, plus AI diffs and verdicts under --ai), json (the fixable findings, each with an additive ai_fix object under --ai, and an additive top-level remedies array), diff (the combined unified diff of every verified patch, on stdout) or bundle (patched files, diffs, README and scripts, written to --out) Default: table. |
--finding <ID> | Fix only the finding(s) with these ids (repeatable, or a comma-separated list; alias --id). Accepts the per-scan id or the stable finding_id shown by vulkro-sf scan --format json. Omit to fix every finding that has a remedy. Aliases: --id. |
--out <PATH> | Where --format bundle writes: a directory (created; it must be empty or absent) or a file ending in .zip. Defaults to vulkro-sf-fix-bundle in the current directory. |
--no-verify | Skip the re-scan that verifies each patch. Faster, but the patches are then unverified (the output says so) |
--instance-url <URL> | The org's URL (for example https://acme.my.salesforce.com), used to print complete Setup links. Without it the links use a placeholder domain. |
-v, --verbose... | Bump stderr log verbosity. -v enables debug-level tracing for the vulkro + vulkro_sf targets; -vv enables trace. Honoured only when RUST_LOG is unset (an explicit RUST_LOG always wins) |
-q, --quiet | Print only warnings and errors on stderr: no progress, tips or next-step hints. Results on stdout and exit codes are unchanged. |
--no-color | Turn off coloured output. Colour is also off when NO_COLOR is set to a non-empty value or TERM=dumb. |
-h, --help | Print help (see a summary with '-h') |
Full vulkro-sf fix --help
Generate reviewable fixes (patches, Setup links, sf scripts) for findings; never deploys.
Deterministic remedies (always on): for each finding whose fix is well defined, `fix` generates the exact change to the scanned file as a unified diff (a profile or permission set loses ModifyAllData / ViewAllData / a field or object permission, a site or Session Settings get their hardening values, a connected app requires PKCE or drops the Full scope, a Remote Site Setting moves to https, an Apex class becomes `with sharing`, a query gets `WITH USER_MODE`, a dynamic query escapes its values, a Visualforce tag stops disabling escaping), the Lightning Setup page where the same change is made by hand, and reviewed `sf` commands to validate, deploy and check it. Every patch is VERIFIED by scanning the patched project again: it is kept only when its finding is gone and no new finding appears in the file (`--no-verify` skips this). Vulkro never deploys and never changes the org: the patches are for you to review and ship through your own pipeline.
Formats: `table` (default: a summary with Setup links and commands), `json` (the fixable findings plus an additive `remedies` array), `diff` (one combined unified diff on stdout, ready for `git apply`), and `bundle` (a directory, or a `.zip` when `--out` ends in .zip, holding the patched files, per-finding diffs, a README on how to review and deploy them, and validate / deploy / verify scripts).
AI fixes for Apex (opt-in, `--ai`, with `--ai --write` to apply the ones the deterministic detector re-validates): `--ai` turns on the AI fix tier for the mandatory-review Apex classes - CRUD / FLS, with / without sharing, and SOQL injection. The resolved LOCAL model (see `vulkro-sf ai`) proposes a MINIMAL Apex patch scoped to the offending method (add `WITH SECURITY_ENFORCED` / `WITH USER_MODE` / `Security.stripInaccessible` for CRUD / FLS, convert to `with sharing` / `inherited sharing` for a sharing gap, bind-variable-ise dynamic SOQL for injection). Each patch is then VALIDATED by RE-RUNNING the deterministic Apex detector on the patched class: it is shown as `verified` ONLY IF the patched class still parses (a patch that introduces syntax errors is refused before the re-scan, so a broken edit can never "clear" a finding by making the file unparseable), the originating finding disappears, AND no new finding appears anywhere in the file; otherwise as `refused` with a reason. The model proposes; the deterministic detector judges.
`--ai` alone is READ-ONLY (advisory diffs; the default is a dry run). `--ai --write` applies ONLY verified diffs, each printed first, atomically (temp file + rename). An AI diff is never applied silently or without `--write`. Every AI fix is labelled advisory / non-deterministic / excluded-from-benchmark and NEVER changes the exit code: a refused fix is a refusal, not an error. A loopback model is allowed under VULKRO_OFFLINE; a cloud url is refused offline.
Exit codes (CLAUDE.md rule 8): 0 = no findings, 1 = findings reported, 2 = error. The advisory AI layer never changes the exit code.
Usage: vulkro-sf fix [OPTIONS] [PATH]
Arguments:
[PATH]
Path to the SFDX project or retrieved metadata (defaults to the current directory)
[default: .]
Options:
--ai
Turn on the AI fix tier. Without it, `fix` reports the fixable Apex findings and does nothing else (no model is called)
--write
Apply ONLY the AI diffs the deterministic re-scan verified, in place (atomic temp file + rename), each printed as a diff first. Requires `--ai`. Conflicts with `--dry-run`
--dry-run
Preview the verified AI diffs without touching any file (the default when `--write` is absent). Informational; the exit code is unchanged
--ai-model <MODEL>
AI model tag override (highest precedence). Overrides VULKRO_AI_MODEL, the saved `vulkro-sf ai use` selection, and the smart default
--ai-url <URL>
AI runtime base url override (OpenAI-compatible). A loopback url is allowed under VULKRO_OFFLINE; a cloud url is refused offline
--no-ai
Disable the AI layer for this run (report fixable findings only)
-f, --format <FORMAT>
Output format: table (default: remedies with Setup links and commands, plus AI diffs and verdicts under `--ai`), json (the fixable findings, each with an additive `ai_fix` object under `--ai`, and an additive top-level `remedies` array), diff (the combined unified diff of every verified patch, on stdout) or bundle (patched files, diffs, README and scripts, written to `--out`)
[default: table]
--finding <ID>
Fix only the finding(s) with these ids (repeatable, or a comma-separated list; alias `--id`). Accepts the per-scan `id` or the stable `finding_id` shown by `vulkro-sf scan --format json`. Omit to fix every finding that has a remedy
[aliases: --id]
--out <PATH>
Where `--format bundle` writes: a directory (created; it must be empty or absent) or a file ending in `.zip`. Defaults to `vulkro-sf-fix-bundle` in the current directory
--no-verify
Skip the re-scan that verifies each patch. Faster, but the patches are then unverified (the output says so)
--instance-url <URL>
The org's URL (for example https://acme.my.salesforce.com), used to print complete Setup links. Without it the links use a placeholder domain
-v, --verbose...
Bump stderr log verbosity. `-v` enables debug-level tracing for the `vulkro` + `vulkro_sf` targets; `-vv` enables trace. Honoured only when `RUST_LOG` is unset (an explicit `RUST_LOG` always wins)
-q, --quiet
Print only warnings and errors on stderr: no progress, tips or next-step hints. Results on stdout and exit codes are unchanged
--no-color
Turn off coloured output. Colour is also off when NO_COLOR is set to a non-empty value or TERM=dumb
-h, --help
Print help (see a summary with '-h')