destructive_command_guard 0.4.2

A Claude Code hook that blocks destructive commands before they execute
Documentation
[package]
name = "destructive_command_guard"
version = "0.4.2"
edition = "2024"
resolver = "2"
authors = [
    "Jeffrey Emanuel <jeff@jeffreyemanuel.dev>",
    "Dowwie <dowwie@gmail.com>"
]
description = "A Claude Code hook that blocks destructive commands before they execute"
repository = "https://github.com/Dicklesworthstone/destructive_command_guard"
homepage = "https://github.com/Dicklesworthstone/destructive_command_guard"
license = "MIT"
keywords = ["destructive", "safety", "claude", "hook", "guard"]
categories = ["command-line-utilities", "development-tools"]
readme = "README.md"
rust-version = "1.85"
exclude = [
    ".github/",
    ".beads/",
    "scripts/",
    "*.md",
    "!README.md",
]

# Primary binary with short alias
[[bin]]
name = "dcg"
path = "src/main.rs"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9"          # External pack YAML parsing
toml = "1.0"
toml_edit = "0.25"         # Preserves formatting when editing TOML files
chrono = { version = "0.4", default-features = false, features = ["std", "clock", "serde"] }  # RFC 3339 timestamps
fancy-regex = "0.17"
regex = "1.10"              # For RegexSet in heredoc detection
memchr = "2.7"
aho-corasick = "1.1"        # Multi-pattern string matching for keyword quick-reject
smallvec = "1.15.1"
colored = "3.1"
dirs = "6.0"
glob = "0.3"                # Glob pattern expansion for custom pack paths
clap = { version = "4.5", features = ["derive", "env"] }
clap_complete = "4.5"
once_cell = "1.19"
base64 = "0.22"              # For decision log format parsing in simulate
async-trait = "0.1.89"
rust-mcp-sdk = { version = "0.8.3", default-features = false, features = ["server", "stdio", "macros"] }
tokio = { version = "1.49", features = ["rt-multi-thread"] }
rayon = { version = "1.11", optional = true }

# AST-based pattern matching for heredoc/inline-script content
ast-grep-core = "0.40"
ast-grep-language = { version = "0.40", default-features = false, features = [
    "tree-sitter-bash",
    "tree-sitter-python",
    "tree-sitter-javascript",
    "tree-sitter-typescript",
    "tree-sitter-ruby",
    "tree-sitter-go",
    "tree-sitter-php",
] }

# Tracing/logging for heredoc detection debugging
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
sha2 = "0.10"
hmac = "0.12"  # HMAC for optional short-code hardening (ksk.1.10)
fs2 = "0.4"
fsqlite = { version = "0.1.1", features = ["fts5"] }  # FrankenSQLite with concurrent writing
fsqlite-types = "0.1.1"  # SqliteValue type
fsqlite-error = "0.1.1"  # FrankenError type
ctrlc = "3.5.1"
flate2 = "1.0"  # Gzip compression for history export

# Update checking dependencies
self_update = { version = "0.42", default-features = false, features = ["rustls", "archive-tar", "archive-zip", "compression-flate2"] }
semver = "1.0"  # Semantic version comparison for update checks

# TUI/CLI visual polish dependencies (advk epic)
ratatui = { version = "0.30", default-features = false, features = ["crossterm"] }
comfy-table = "7.2"
indicatif = "0.18"
console = "0.16"
inquire = "0.9"
rand = { version = "0.10", default-features = false, features = ["std", "thread_rng"] }

# rich_rust for premium terminal output (rich_rust epic)
rich_rust = { version = "0.2.0", features = ["full"], optional = true }

[build-dependencies]
vergen-gix = { version = "10.0.0-beta.5", features = ["build", "cargo", "rustc"] }

[dev-dependencies]
assert_cmd = "2.0"
predicates = "3.1"
tempfile = "3.14"
proptest = "1.4"
criterion = { version = "0.8", features = ["html_reports"] }
libc = "0.2"
regex-automata = "0.4"  # For ksk.8.1 prototype comparison
which = "8.0"            # For finding dcg binary in E2E tests
walkdir = "2.5"          # For golden file directory traversal

[[bench]]
name = "heredoc_perf"
harness = false

[[bench]]
name = "regex_automata_comparison"
harness = false

[profile.release]
opt-level = "z"     # Optimize for size (lean binary for distribution)
lto = true          # Link-time optimization across crates
codegen-units = 1   # Single codegen unit for better optimization
panic = "abort"     # Smaller binary, no unwinding overhead
strip = true        # Remove debug symbols

[profile.dev]
opt-level = 1       # Faster compile times during development

[features]
rayon = ["dep:rayon"]
rich-output = ["dep:rich_rust"]  # Enable rich_rust for premium terminal output
legacy-output = []               # Keep old rendering (placeholder for gradual migration)

[lints.rust]
# unsafe_code = "forbid" # Moved to src/lib.rs and src/main.rs to allow unsafe in tests

[lints.clippy]
all = { level = "warn", priority = -1 }
pedantic = { level = "warn", priority = -1 }
nursery = { level = "warn", priority = -1 }
# Temporarily allow these to unblock CI - should be fixed properly in future
return_self_not_must_use = "allow"
suboptimal_flops = "allow"
too_many_lines = "allow"
manual_string_new = "allow"
field_reassign_with_default = "allow"
missing_const_for_fn = "allow"
redundant_pub_crate = "allow"
cognitive_complexity = "allow"
option_if_let_else = "allow"
significant_drop_tightening = "allow"
iter_without_into_iter = "allow"
map_unwrap_or = "allow"
unused_self = "allow"
must_use_candidate = "allow"
single_match_else = "allow"
unnested_or_patterns = "allow"
match_same_arms = "allow"
needless_pass_by_value = "allow"
similar_names = "allow"
match_wildcard_for_single_variants = "allow"
trivially_copy_pass_by_ref = "allow"
uninlined_format_args = "allow"
if_not_else = "allow"
use_self = "allow"
struct_excessive_bools = "allow"
struct_field_names = "allow"
doc_markdown = "allow"
module_name_repetitions = "allow"
fn_params_excessive_bools = "allow"
needless_for_each = "allow"
items_after_statements = "allow"
cast_possible_truncation = "allow"
cast_sign_loss = "allow"
cast_precision_loss = "allow"
cast_lossless = "allow"
cast_possible_wrap = "allow"
implicit_hasher = "allow"
default_trait_access = "allow"
missing_errors_doc = "allow"
missing_panics_doc = "allow"
wildcard_imports = "allow"
manual_let_else = "allow"
too_many_arguments = "allow"
write_literal = "allow"
print_literal = "allow"
many_single_char_names = "allow"
string_add = "allow"
string_add_assign = "allow"
ref_option_ref = "allow"
unused_async = "allow"
redundant_clone = "allow"
derivable_impls = "allow"
single_match = "allow"
len_zero = "allow"
len_without_is_empty = "allow"
doc_link_with_quotes = "allow"