id = "safety"
name = "Safety CLI"
homepage = "https://safetycli.com/product/safety-cli"
description = "Checks Python dependencies for known vulnerabilities and suggests remediations."
executables = ["safety"]
[dotfiles]
paths = []
exclude = []
secret = ["~/.safety/config.ini"]
[commands]
format = 1
label = "Safety CLI"
description = "Scan a project for vulnerable Python dependencies. The legacy check command, save-as and login-related options are not covered."
quality = "ai-draft"
parser = { end_of_options = "--", interleave = "permute", long_equals = true, short_attached = true, short_bundles = false }
[[commands.subcommand]]
path = ["scan"]
label = "Scan a project"
description = "Scan a project directory for dependency vulnerabilities."
[[commands.subcommand.source]]
id = "src"
kind = "help"
url = "https://github.com/pyupio/safety/blob/main/safety/scan/constants.py"
revision = "2026-10-27"
evidence = """
Example: safety scan --policy-file /path/to/policy.yml
Define a specific project path to scan. (default: current directory)
Example: safety scan --target /path/to/project
Set the output format for scan results (default: screen)
Example: safety scan --output json
Enable a verbose scan report for detailed insights (only for screen output)
Example: safety scan --detailed-output
Update packages listed in requirements.txt files to secure versions where possible
typer.Option("--apply-fixes", help=SCAN_APPLY_FIXES, show_default=False)
"""
[[commands.subcommand.field]]
id = "target"
label = "Project folder"
description = "Defaults to the current directory."
type = "path"
option = ["--target"]
path = { kind = "directory", role = "input", must_exist = true }
sources = ["src"]
[[commands.subcommand.field]]
id = "output"
label = "Output format"
type = "string"
option = ["--output"]
suggestions = [{ value = "screen", label = "Screen" }, { value = "json", label = "JSON" }]
sources = ["src"]
[[commands.subcommand.field]]
id = "detailed_output"
label = "Detailed report"
description = "Only for screen output."
type = "boolean"
option = ["--detailed-output"]
sources = ["src"]
[[commands.subcommand.field]]
id = "policy_file"
label = "Policy file"
type = "path"
option = ["--policy-file"]
path = { kind = "file", role = "input", must_exist = false }
sources = ["src"]
[[commands.subcommand.field]]
id = "apply_fixes"
label = "Apply fixes"
description = "Rewrites requirements.txt files to secure versions."
type = "boolean"
option = ["--apply-fixes"]
effect = "overwrite"
sources = ["src"]
[[commands.subcommand.task]]
id = "scan"
label = "Scan a project"
fields = ["target", "detailed_output"]
required = []
[[commands.subcommand.task]]
id = "scan_json"
label = "Scan with JSON output"
fields = ["target", "output"]
required = []
set = { output = ["json"] }
[[commands.subcommand.group]]
id = "basic"
label = "Basic"
fields = ["target", "output", "detailed_output"]
[[commands.subcommand.group]]
id = "advanced"
label = "Advanced"
fields = ["policy_file", "apply_fixes"]