repotoire 0.7.1

Graph-powered code analysis CLI. 110 detectors for security, architecture, bus factor, and code quality.
Documentation
//! Claude Code commit-time hook lifecycle and runtime.
//!
//! Three subcommands under `repotoire claude-hook`:
//!  - `install` — write hook entry into Claude Code's settings.json (lifecycle, fail-closed)
//!  - `uninstall` — remove our hook entries (lifecycle, fail-closed)
//!  - `run` — the hook itself, invoked by Claude Code with PreToolUse JSON on stdin (runtime, fail-open)

mod install;
mod runtime;
mod settings;
mod uninstall;

use clap::Subcommand;

#[derive(Subcommand, Debug)]
pub enum ClaudeHookAction {
    /// Install the Claude Code commit-time check.
    ///
    /// Writes a PreToolUse hook entry into ~/.claude/settings.json (or $CLAUDE_CONFIG_DIR/settings.json).
    /// Idempotent. Existing settings keys are preserved.
    Install {
        /// Allow installing with a dev binary (target/debug/ or target/release/). Off by default.
        #[arg(long)]
        allow_dev_binary: bool,
    },

    /// Remove the Claude Code commit-time check from settings.json.
    ///
    /// Leaves unrelated PreToolUse entries untouched.
    Uninstall,

    /// Internal: invoked by Claude Code via PreToolUse hook. Reads tool-input JSON from stdin
    /// and emits a deny response if `repotoire diff HEAD` finds new critical/high issues.
    /// Users typically run `repotoire claude-hook install` instead.
    #[command(hide = true)]
    Run,
}

pub fn run_install(allow_dev_binary: bool) -> anyhow::Result<()> {
    install::run(allow_dev_binary)
}

pub fn run_uninstall() -> anyhow::Result<()> {
    uninstall::run()
}

pub fn run_hook() -> std::process::ExitCode {
    runtime::run()
}