{"modulePath":"github.com/step-security/dev-machine-guard","version":"v1.19.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package cli\n\n## Functions\n\n```go\nfunc ConfigPathFromArgs(args []string) string\n```\nConfigPathFromArgs pre-scans argv for --config so main can pin the config path before config.Load() runs. Parse() happens after Load(), and Load() keeps whatever it read first, so the flag cannot be honoured any later. Deliberately forgiving: an unparseable argv is Parse()'s problem to report, not this helper's.\n\n## Types\n\n```go\ntype Config struct {\n\tCommand               string // \"\", \"install\", \"uninstall\", \"send-telemetry\", \"identity\", \"configure\", \"configure show\", \"hooks install\", \"hooks uninstall\"\n\tOutputFormat          string // \"pretty\", \"json\", \"html\"\n\tOutputFormatSet       bool   // true if --pretty/--json/--html was explicitly passed (not persisted)\n\tHTMLOutputFile        string // set by --html (not persisted)\n\tColorMode             string // \"auto\", \"always\", \"never\"\n\tVerbose               bool   // --verbose (shortcut for --log-level=debug)\n\tLogLevel              string // \"\" = unset; one of \"error\", \"warn\", \"info\", \"debug\"\n\tInstallDir            string // --install-dir=DIR base install directory; all non-bootstrap files (logs, hook errors, binary placement) live under this dir. \"\" w/ InstallDirSet=true means \"explicitly disabled\" (no file logging).\n\tInstallDirSet         bool   // true if --install-dir was passed (empty value = disable file logging for this run)\n\tEnableNPMScan         *bool  // nil=auto, true/false=explicit\n\tUseLegacyNodeScan     *bool  // nil=auto (disk scan); true=command path, false=disk path\n\tEnableBrewScan        *bool  // nil=auto, true/false=explicit\n\tEnablePythonScan      *bool  // nil=auto, true/false=explicit\n\tEnableRuntimeScan     *bool  // nil=auto (on), true/false=explicit\n\tUseLegacyPythonScan   *bool  // nil=auto (disk scan); true=pip path, false=disk path\n\tIncludeBundledPlugins bool   // --include-bundled-plugins: include bundled/platform plugins in output\n\t// IncludeTCCProtected is tristate: nil or false = skip the macOS\n\t// TCC-protected dirs (Documents, Downloads, ~/Library/Mail, ...)\n\t// so the agent never triggers permission prompts; true = scan them.\n\t// Customers who have granted the agent Full Disk Access (e.g., via\n\t// an MDM-pushed PPPC profile) flip this to true to opt back into\n\t// full scan coverage. See docs/macos-tcc-permissions.md.\n\tIncludeTCCProtected *bool\n\t// IncludeNetworkVolumes is tristate with the OPPOSITE default to\n\t// IncludeTCCProtected: nil or true = walk macOS network volumes\n\t// (container-runtime mounts — OrbStack, Docker Desktop, Colima — are\n\t// Network Volumes to macOS), false = skip them. Walking them is what\n\t// inventories packages inside dev containers, at the cost of a one-time\n\t// TCC prompt on machines with no PPPC pre-approval. Fleets that can't\n\t// pre-approve set this to false. See docs/macos-tcc-permissions.md.\n\tIncludeNetworkVolumes *bool\n\tNPMRCOnly             bool     // --npmrc: run only the npmrc audit and render verbose pretty output\n\tPipConfigOnly         bool     // --pipconfig: run only the pip config audit and render verbose pretty output\n\tPnpmRCOnly            bool     // --pnpmrc: run only the pnpm config audit and render verbose pretty output\n\tBunfigOnly            bool     // --bunfig: run only the bun config audit and render verbose pretty output\n\tYarnRCOnly            bool     // --yarnrc: run only the yarn config audit (both flavors) and render verbose pretty output\n\tSearchDirs            []string // defaults to [\"$HOME\"]\n\n\t// GateProceedReason is populated at runtime (not a CLI flag) by the run\n\t// gate when it lets a run proceed, so telemetry.Run can echo the gate\n\t// decision into the captured execution log (what \"Download logs\" shows).\n\t// The gate itself runs before log capture starts, so its live lines never\n\t// reach the downloadable log without this.\n\tGateProceedReason string\n\n\t// CredentialScanningDisabled is populated at runtime (not a CLI flag) by\n\t// the run gate from this invocation's dashboard check-in. True means\n\t// telemetry.Run must not build, probe with, or run the credential detector.\n\t// The zero value scans, so a caller that never consulted the gate, or one\n\t// whose check-in failed, behaves as before.\n\tCredentialScanningDisabled bool\n\t// DeltaScanEnabled is set by run-config, never by a CLI flag.\n\tDeltaScanEnabled bool\n\n\t// WSLScanEnabled and WSLScanReason are populated at runtime (not CLI flags)\n\t// from the run-config check-in's wsl_directive. They gate scanning INSIDE\n\t// WSL distros — a tenant-wide switch with no per-device granularity. Both\n\t// stay zero on every path that never reached a backend answer, so distro\n\t// scanning fails closed; host-side WSL detection does not consult them.\n\tWSLScanEnabled bool\n\tWSLScanReason  string\n\n\t// WSLHostSerial and WSLDistroID identify this run as happening INSIDE a WSL\n\t// distribution, and are passed by the Windows host that triggered it\n\t// (--wsl-host-serial, --wsl-distro-id). A distro cannot discover either for\n\t// itself. When both are set the agent derives a stable device id from them,\n\t// because a distro's own identity is unusable: it inherits the host's\n\t// hostname, and a minimal or WSL1 distro has no machine-id.\n\tWSLHostSerial string\n\tWSLDistroID   string\n\n\t// ConfigFile is --config: the exact config.json to read. Applied by a\n\t// pre-scan of argv before config.Load(), so this field is informational\n\t// once parsing is done.\n\tConfigFile string\n\n\t// HooksAgent is the --agent value on `hooks install` / `hooks uninstall`;\n\t// \"\" means \"every detected agent\".\n\tHooksAgent string\n\n\t// Non-interactive `configure` inputs. Used by MSI/SCCM and other\n\t// orchestrators that can't drive a stdin prompt loop. NonInteractive\n\t// is implied when any flag saves a config value, and main.go routes\n\t// accordingly.\n\tNonInteractive bool\n\tConfigFromFile string // --from-file: read full config JSON from path\n\n\t// ConfigValues holds the config.json keys this invocation's flags set\n\t// (flagSpec.saves), for `configure` to persist. Scan runs ignore it.\n\tConfigValues map[string]any\n\n\tSearchDirsSet bool `json:\"-\"` // a --search-dirs replaced the $HOME default\n\n\t// UninstallRetire / UninstallNoRetire are `uninstall --retire` and\n\t// `uninstall --no-retire`: force or suppress the backend retire call that\n\t// config.json retire_on_uninstall otherwise decides. Mutually exclusive.\n\tUninstallRetire   bool\n\tUninstallNoRetire bool\n\n\t// ImageBuilder is `configure --image-builder[=BOOL]`: nil leaves the\n\t// master-image switch unchanged (the MSI passes an unset property as an\n\t// empty value), true writes the machine-bound marker that keeps scans off\n\t// on the imaging machine, false removes it. Not a config.json key: a\n\t// bootstrap file is copied into every clone, the switch must not be.\n\tImageBuilder *bool\n\n\t// IgnoreTelemetryError opts the `install` subcommand into treating an\n\t// initial-telemetry POST failure as a warning rather than a fatal exit.\n\t// Default behavior (flag absent) preserves dev-workflow ergonomics —\n\t// a failed first telemetry surfaces misconfigurations immediately. MSI\n\t// custom actions and other unattended orchestrators set this so a\n\t// transient network hiccup doesn't roll back the whole install.\n\tIgnoreTelemetryError bool\n\n\t// OverrideGate disables feature gating for this invocation, letting\n\t// every capability run regardless of the featuregate allowlist.\n\t// Internal — not advertised in --help. Equivalent env var:\n\t// STEPSECURITY_OVERRIDE_GATE=1.\n\tOverrideGate bool\n\n\t// ForceScan bypasses the server-driven run gate for this invocation: the\n\t// scan proceeds even when the backend's run-directive says \"skip\". The\n\t// documented debug/support escape — manual runs are otherwise gated\n\t// exactly like scheduler-fired ones (an MDM-launched run detects as\n\t// one_time too, so invocation method deliberately can't exempt manual\n\t// use). Equivalent env var: STEPSEC_FORCE_SCAN=1.\n\t// The check-in itself still happens (bounded by its own timeout), because\n\t// it also carries the tenant's credential-scanning setting, which a forced\n\t// run must honour.\n\tForceScan bool\n\n\t// RulesFile makes the malicious-file detection engine load its RuleSet\n\t// from a local JSON file instead of fetching it from the backend.\n\t// Dev-only — not advertised in --help. Equivalent env var:\n\t// STEPSECURITY_RULES_FILE=PATH. Lets the engine be exercised offline\n\t// (rules live only in the backend, so an offline run would otherwise scan\n\t// nothing). Zero production impact when unset.\n\tRulesFile string\n\n\t// TelemetryOutFile makes an enterprise run write the assembled telemetry\n\t// Payload to a local JSON file and skip the S3 upload + run-status notify.\n\t// Dev-only — not advertised in --help. Equivalent env var:\n\t// STEPSECURITY_TELEMETRY_OUT=PATH. The dumped file is exactly what the\n\t// backend's process-uploaded sees after gunzip, so it doubles as a backend\n\t// ingestion fixture. Zero production impact when unset.\n\tTelemetryOutFile string\n}\n```\nConfig holds all parsed CLI flags.\n\nThe hidden \\`\\_hook\\` runtime is intentionally NOT represented here. Agents invoke \\`\\_hook\\` on every event and any non-zero exit is treated as a hook failure, so the hot path bypasses cli.Parse entirely — see main.go's early-return and internal/aiagents/cli.RunHook.\n\n```go\nfunc Parse(args []string) (*Config, error)\n```\nParse parses CLI arguments and returns a Config.\n\n","path":"github.com/step-security/dev-machine-guard/internal/cli","name":"cli","synopsis":"","isRedistributable":true}
