Skip to content

Commit 7f2924d

Browse files
authored
refactor(deps): simplify dependency tree (#1223)
Remove dead deps (grep, grep-regex, grep-searcher, globset, instant), feature-gate jaq-* behind `jq` flag, replace `futures` with `futures-core` + `futures-util`, add dep analysis to maintenance checklist. Minimal build drops 24%.
1 parent cad12ba commit 7f2924d

14 files changed

Lines changed: 33 additions & 58 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ categories = ["command-line-utilities", "parser-implementations"]
2222
# add them in their own Cargo.toml or via [target.'cfg(...)'.dependencies].
2323
tokio = { version = "1", features = ["sync", "macros", "io-util", "rt", "time"] }
2424
async-trait = "0.1"
25-
futures = "0.3"
25+
futures-core = "0.3"
26+
futures-util = "0.3"
2627

2728
# Error handling
2829
thiserror = "2"
@@ -37,17 +38,9 @@ jaq-core = "3.0"
3738
jaq-std = "3.0"
3839
jaq-json = "2.0"
3940

40-
# Text search (grep) - verified supports search_slice() for in-memory
41-
grep = "0.3"
42-
grep-regex = "0.1"
43-
grep-searcher = "0.1"
44-
4541
# HTTP client (for curl and API calls)
4642
reqwest = { version = "0.13", default-features = false, features = ["json", "rustls", "stream"] }
4743

48-
# Glob matching
49-
globset = "0.4"
50-
5144
# Regex
5245
regex = "1"
5346

crates/bashkit-bench/Cargo.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ serde_json.workspace = true
2222
clap.workspace = true
2323
anyhow.workspace = true
2424

25-
# Timing
26-
instant = "0.1"
27-
2825
# Statistics
2926
statrs = "0.18"
3027

crates/bashkit-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ scripted_tool = ["bashkit/scripted_tool"]
2626
interactive = ["dep:rustyline", "dep:terminal_size", "dep:signal-hook"]
2727

2828
[dependencies]
29-
bashkit = { path = "../bashkit", version = "0.1.9", features = ["http_client", "git"] }
29+
bashkit = { path = "../bashkit", version = "0.1.9", features = ["http_client", "git", "jq"] }
3030
tokio = { workspace = true, features = ["macros", "net", "rt", "rt-multi-thread", "time"] }
3131
clap.workspace = true
3232
anyhow.workspace = true

crates/bashkit-eval/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ name = "bashkit-eval"
1515
path = "src/main.rs"
1616

1717
[dependencies]
18-
bashkit = { path = "../bashkit", features = ["scripted_tool"] }
18+
bashkit = { path = "../bashkit", features = ["scripted_tool", "jq"] }
1919
tokio = { workspace = true, features = ["rt-multi-thread"] }
2020
serde.workspace = true
2121
serde_json.workspace = true

crates/bashkit-js/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ repository.workspace = true
1414
crate-type = ["cdylib"]
1515

1616
[dependencies]
17-
bashkit = { path = "../bashkit", features = ["scripted_tool", "python", "realfs"] }
17+
bashkit = { path = "../bashkit", features = ["scripted_tool", "python", "realfs", "jq"] }
1818
napi = { workspace = true }
1919
napi-derive = { workspace = true }
2020
serde = { workspace = true }

crates/bashkit-python/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ doc = false # Python extension, no Rust docs needed
1818
[dependencies]
1919
# Bashkit core
2020
# realfs: always-on so Python callers can use mount_real_* APIs
21-
bashkit = { path = "../bashkit", features = ["scripted_tool", "python", "realfs"] }
21+
bashkit = { path = "../bashkit", features = ["scripted_tool", "python", "realfs", "jq"] }
2222

2323
# PyO3 native extension
2424
pyo3 = { workspace = true }

crates/bashkit/Cargo.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ readme = "../../README.md"
1717
# Async runtime
1818
tokio = { workspace = true }
1919
async-trait = { workspace = true }
20-
futures = { workspace = true }
20+
futures-core = { workspace = true }
21+
futures-util = { workspace = true }
2122
tower = { workspace = true }
2223

2324
# Error handling
@@ -32,9 +33,6 @@ schemars = { workspace = true }
3233
# Regex
3334
regex = { workspace = true }
3435

35-
# Glob matching
36-
globset = { workspace = true }
37-
3836
# Date/Time
3937
chrono = { workspace = true }
4038

@@ -51,10 +49,10 @@ fail = { workspace = true, optional = true }
5149
# URL parsing
5250
url = "2"
5351

54-
# JSON processing (jq)
55-
jaq-core = { workspace = true }
56-
jaq-std = { workspace = true }
57-
jaq-json = { workspace = true }
52+
# JSON processing (jq) - optional, enabled with jq feature
53+
jaq-core = { workspace = true, optional = true }
54+
jaq-std = { workspace = true, optional = true }
55+
jaq-json = { workspace = true, optional = true }
5856

5957
# Compression (for gzip/gunzip)
6058
flate2 = { workspace = true }
@@ -83,6 +81,9 @@ zapcode-core = { version = "1.5", optional = true }
8381

8482
[features]
8583
default = []
84+
# Enable jq builtin via embedded jaq interpreter
85+
# Usage: cargo build --features jq
86+
jq = ["dep:jaq-core", "dep:jaq-std", "dep:jaq-json"]
8687
http_client = ["reqwest"]
8788
# Enable Ed25519 request signing per RFC 9421 / web-bot-auth profile
8889
bot-auth = ["http_client", "dep:ed25519-dalek", "dep:rand", "dep:zeroize"]

crates/bashkit/src/builtins/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ mod iconv;
6464
mod inspect;
6565
mod introspect;
6666
mod join;
67+
#[cfg(feature = "jq")]
6768
mod jq;
6869
mod json;
6970
mod log;
@@ -164,6 +165,7 @@ pub use iconv::Iconv;
164165
pub use inspect::{File, Less, Stat};
165166
pub use introspect::{Hash, Type, Which};
166167
pub use join::Join;
168+
#[cfg(feature = "jq")]
167169
pub use jq::Jq;
168170
pub use json::Json;
169171
pub use log::Log;

crates/bashkit/src/interpreter/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use std::sync::atomic::{AtomicBool, AtomicU32, AtomicU64, Ordering};
2828
/// Monotonic counter for unique process substitution file paths
2929
static PROC_SUB_COUNTER: AtomicU64 = AtomicU64::new(0);
3030

31-
use futures::FutureExt;
31+
use futures_util::FutureExt;
3232

3333
use crate::builtins::{self, Builtin};
3434
#[cfg(feature = "failpoints")]
@@ -567,7 +567,6 @@ impl Interpreter {
567567
"times" => Times,
568568
"eval" => Eval,
569569
// Text processing
570-
"jq" => Jq,
571570
"grep" => Grep,
572571
"sed" => Sed,
573572
"awk" => Awk,
@@ -695,6 +694,10 @@ impl Interpreter {
695694
"yaml" => Yaml,
696695
);
697696

697+
// jq builtin (requires jq feature)
698+
#[cfg(feature = "jq")]
699+
builtins.insert("jq".to_string(), Box::new(builtins::Jq));
700+
698701
// Custom-construction builtins that need parameters
699702

700703
// source/. requires filesystem access

0 commit comments

Comments
 (0)