-
Notifications
You must be signed in to change notification settings - Fork 233
Expand file tree
/
Copy pathCargo.toml
More file actions
249 lines (229 loc) · 8.37 KB
/
Copy pathCargo.toml
File metadata and controls
249 lines (229 loc) · 8.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
[package]
name = "destructive_command_guard"
version = "0.11.0"
edition = "2024"
resolver = "2"
authors = [
"Jeffrey Emanuel <jeff@jeffreyemanuel.dev>",
"Dowwie <dowwie@gmail.com>"
]
description = "An AI coding agent 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-file = "LICENSE"
keywords = ["destructive", "safety", "claude", "hook", "guard"]
categories = ["command-line-utilities", "development-tools"]
readme = "README.md"
rust-version = "1.95"
exclude = [
".beads/",
"scripts/",
"*.md",
"!/README.md",
"!/AGENTS.md",
".ntm/",
"*.png",
"*.webp",
"agent_baseline/",
"action/",
]
# Primary binary with short alias
[[bin]]
name = "dcg"
path = "src/main.rs"
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
schemars = "1.0" # JSON Schema generation for config.toml (editor autocomplete/validation)
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.19"
regex = "1.10" # For RegexSet in heredoc detection
memchr = "2.8"
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
shell-words = "1.1" # Quote-aware tokenization for static stdin data-flow analysis
libc = "0.2" # Nonblocking, no-follow opens for inspected stdin files on Unix
clap = { version = "4.5", features = ["derive", "env"] }
clap_complete = "4.6"
once_cell = "1.19"
# Keep the scalar engine: logs and encoded-command analysis do not justify the
# default SIMD feature, which is base64's only unsafe-code surface.
base64 = { version = "0.23", default-features = false, features = ["std"] }
async-trait = "0.1.89"
rust-mcp-sdk = { version = "1.0.1", default-features = false, features = ["server", "stdio", "macros"] }
tokio = { version = "1.52", features = ["rt-multi-thread"] }
rayon = { version = "1.11", optional = true }
# AST-based pattern matching for heredoc/inline-script content
ast-grep-core = "0.45"
ast-grep-language = { version = "0.45", 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.11"
hmac = "0.13" # HMAC for optional short-code hardening (ksk.1.10)
fs2 = "0.4"
rusqlite = { version = "0.40.1", default-features = false, features = ["bundled"] } # Stable bundled SQLite for history telemetry
ctrlc = "3.5.1"
flate2 = "1.0" # Gzip compression for history export
# Update checking dependencies
self_update = { version = "1.0.0-rc.5", default-features = false, features = ["reqwest", "rustls", "github"] }
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"] }
indicatif = "0.18"
console = "0.16"
inquire = "0.9"
rand = { version = "0.10", default-features = false, features = ["std", "thread_rng"] }
tru = "0.2.2"
# rich_rust for premium terminal output (rich_rust epic). Keep only the
# Markdown renderer used by dcg; the syntax feature pulls in an obsolete parser
# stack and the regex renderer below already has a purpose-built highlighter.
rich_rust = { version = "0.2.2", features = ["markdown"], optional = true }
[build-dependencies]
vergen-gix = { version = "10.0.0-beta.8", features = ["build", "cargo", "rustc"] }
[dev-dependencies]
assert_cmd = "2.2"
insta = { version = "1.40", features = ["yaml"] }
predicates = "3.1"
tempfile = "3.14"
proptest = "1.4"
criterion = { version = "0.8", features = ["html_reports"] }
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
[[bench]]
name = "codex_deny"
harness = false
[[bench]]
name = "hook_latency"
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
# The hook is a one-shot process: every enabled pack whose keywords match the
# command compiles its full pattern set from scratch on each invocation.
# Profiling (#245/#248) showed >90% of the ~150-200ms full-evaluation cost was
# regex COMPILATION inside these crates, which `opt-level = "z"` slows several
# fold. Building only the regex family for speed recovers most of that latency
# while keeping the rest of the binary size-optimized.
[profile.release.package.regex-automata]
opt-level = 3
[profile.release.package.regex-syntax]
opt-level = 3
[profile.release.package.regex]
opt-level = 3
[profile.release.package.fancy-regex]
opt-level = 3
[profile.release.package.aho-corasick]
opt-level = 3
[profile.release.package.memchr]
opt-level = 3
[profile.release.package.bit-set]
opt-level = 3
[profile.release.package.bit-vec]
opt-level = 3
# Profilable build for `profiling-software-performance` / samply. Inherits the
# shipping release optimizations but keeps frame pointers and line tables so
# flamegraphs resolve symbols. Never ship this profile — it is measurement-only.
[profile.release-perf]
inherits = "release"
opt-level = 3
debug = "line-tables-only"
strip = false
[profile.dev]
opt-level = 1 # Faster compile times during development
[features]
default = ["rich-output"]
rayon = ["dep:rayon"]
rich-output = ["dep:rich_rust"] # Enable rich_rust for premium terminal output
[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 }
# The pinned release nightly promotes two purely stylistic lints across the
# entire mature codebase. Keep `-D warnings` meaningful for correctness lints
# without forcing a behavior-neutral rewrite of hundreds of control-flow sites.
collapsible_if = "allow"
duration_suboptimal_units = "allow"
# Established project-wide style exceptions.
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"