keyhog 0.5.73

GPU-accelerated secret scanner for code, Git history, cloud, containers, browser assets, and live credential verification
use clap::Parser;
use std::path::PathBuf;
#[derive(Parser)]
pub struct CompileExecutionPacksArgs {
    /// Publish the complete immutable execution-pack generation here.
    #[arg(long, value_name = "DIR")]
    pub output_dir: PathBuf,

    /// Read the exact 32-byte installation signing key from this regular file.
    #[arg(long, value_name = "PATH")]
    pub signing_key: PathBuf,
}

#[derive(Parser)]
pub struct CompletionArgs {
    /// Shell to generate completions for.
    #[arg(value_enum)]
    pub shell: clap_complete::Shell,
}

#[derive(Parser)]
// `--json` renders either the self-test report or the autoroute-cache inspection,
// so it requires one of them; the two modes are mutually exclusive.
#[command(group(clap::ArgGroup::new("json_target").args(["self_test", "autoroute"])))]
pub struct BackendArgs {
    /// Probe the workload size in the diagnostic hardware heuristic matrix.
    /// This does not predict `scan --backend auto`, which uses persisted
    /// fastest-correct calibration evidence.
    #[arg(long)]
    pub probe_bytes: Option<u64>,

    /// Inspect the persisted autoroute calibration cache: which resolved scan
    /// configs and workload buckets have a fastest-correct backend decision,
    /// the cold-aware one-shot and warm-daemon routes, confidence basis, and
    /// whether the cache is stale for this build. Read-only; pairs with
    /// `--json`. Use this to diagnose an "autoroute calibration required"
    /// routing error and identify the exact unproved workload bucket.
    #[arg(long)]
    pub autoroute: bool,

    /// Include every workload decision and parity receipt in human-readable
    /// autoroute inspection. The default view is a concise health and route
    /// summary; `--json` remains the complete machine-readable representation.
    #[arg(long, requires = "autoroute")]
    pub verbose: bool,

    /// Inspect this explicit autoroute cache file instead of the platform
    /// default. Use the same absolute path passed to `scan --autoroute-cache`
    /// or configured as `[system].autoroute_cache`; `off` inspects the disabled
    /// state.
    #[arg(long, value_name = "PATH|off", requires = "autoroute")]
    pub autoroute_cache: Option<String>,

    /// Compiled pattern count to use for the routing-simulation matrix.
    /// This is a what-if knob: it does not change the loaded corpus, only
    /// the pattern_count fed to the backend-routing thresholds so you can
    /// probe how a larger/smaller corpus would route. Omit it to use the live
    /// compiled embedded corpus.
    #[arg(long)]
    pub patterns: Option<usize>,

    /// Run the GPU self-tests (MoE compute kernel + VYRE direct-match
    /// diagnostic + production region-presence dispatch). Prints PASS/FAIL
    /// with adapter info and exits with code 4 on failure so CI can
    /// gate a release on real GPU functionality. Reports SKIP and exits zero
    /// without a non-software adapter unless --require-gpu is set.
    #[arg(long)]
    pub self_test: bool,

    /// Emit `backend --self-test` or `backend --autoroute` as stable JSON for
    /// CI health gates / scripted inspection.
    #[arg(long, requires = "json_target")]
    pub json: bool,

    /// Disable GPU probing for backend inspection/self-test.
    #[arg(long, conflicts_with = "require_gpu")]
    pub no_gpu: bool,

    /// Fail closed when backend self-test cannot use a real GPU.
    #[arg(long, conflicts_with = "no_gpu")]
    pub require_gpu: bool,
}

/// Arguments for `keyhog doctor`.
#[derive(Parser)]
pub struct DoctorArgs {
    /// Read a `bloom-evidence-v1` receipt produced by `keyhog bloom-diagnostic`.
    /// The receipt must match this binary's detector corpus and prove exact
    /// enabled-versus-bypassed finding parity.
    #[arg(long, value_name = "PATH")]
    pub bloom_evidence: Option<PathBuf>,

    /// Inspect this explicit autoroute cache file instead of the platform
    /// default. Use the same absolute path passed to `scan --autoroute-cache`
    /// or configured as `[system].autoroute_cache`; `off` inspects the disabled
    /// state. Without it, doctor reports the platform-default cache, which is
    /// not the file a project-configured scan uses.
    #[arg(long, value_name = "PATH|off")]
    pub autoroute_cache: Option<String>,
}

/// Arguments for `keyhog update` (self-update from GitHub releases).
#[derive(Parser)]
pub struct UpdateArgs {
    /// Only check whether the GitHub binary-asset channel offers a newer
    /// release; do not install. Exits 10 when a newer asset exists, 0 otherwise.
    #[arg(long)]
    pub check: bool,

    /// Install an exact release version (e.g. `1.2.3` or `v1.2.3`).
    /// Canonical SemVer is required; a leading `v` is normalized. Valid
    /// prereleases are accepted. Use this to pin a version or downgrade.
    #[arg(
        long,
        id = "release_version",
        value_name = "SEMVER",
        value_parser = crate::installer::normalize_requested_version
    )]
    pub version: Option<String>,
}

/// Arguments for `keyhog repair` (reinstall a known-good binary from releases).
#[derive(Parser)]
pub struct RepairArgs {
    /// Reinstall even if the scan-engine self-test currently passes.
    #[arg(long)]
    pub force: bool,

    /// Reinstall an exact release version (e.g. `1.2.3` or `v1.2.3`).
    /// Canonical SemVer is required; a leading `v` is normalized. Valid
    /// prereleases are accepted. Use this to pin a version or downgrade.
    #[arg(
        long,
        id = "release_version",
        value_name = "SEMVER",
        value_parser = crate::installer::normalize_requested_version
    )]
    pub version: Option<String>,
}

/// Arguments for `keyhog uninstall`.
#[derive(Parser)]
pub struct UninstallArgs {
    /// Actually remove the binary. Without this, uninstall is a safe dry run
    /// that only reports what would be removed.
    #[arg(long)]
    pub yes: bool,
}