mirror of
https://github.com/rtk-ai/rtk.git
synced 2026-09-19 07:33:17 +08:00
7c18567155
Bump edition 2021 -> 2024. rust-version stays at 1.91, already well above
the 1.85 floor the edition needs; docs/guide/resources/troubleshooting.md
still claimed 1.70+, which is where a failed `cargo install --git` lands.
Four things the edition forces:
- std::env::{set_var,remove_var} are unsafe in 2024 with no safe std
replacement. Rather than wrap the test call sites in unsafe -- which the
crate denies and .semgrep.yml flags -- route them through temp-env, a
dev-only dependency whose closure API is safe and which restores the
previous value even when the body panics. The hand-rolled CLAUDE_DIR_LOCK
and PI_DIR_LOCK guards existed only to serialise those mutations and are
now redundant; CWD_LOCK and TEST_ENV_LOCK stay, they order more than the
env var itself.
- unsafe_op_in_unsafe_fn is on by default, so the libc calls in the proxy
signal handler and in stream.rs's relay handler need explicit unsafe
blocks, scoped to the libc calls themselves.
- `gen` is a reserved keyword, so the closure by that name in diff_cmd.rs
becomes make_lines.
- Tightened tail-expression temporary scopes let clippy prove the binding in
setup_test_env is inlinable, so let_and_return now fires there.
if_let_rescope changes when the scrutinee temporary drops in an if let/else.
The two sites in show_claude_config take cargo fix --edition's match rewrite,
which keeps the 2021 drop timing.
rustfmt.toml is kept rather than dropped: cargo fmt passes --edition from
Cargo.toml, but a bare rustfmt invocation has no crate context and falls
back to edition 2015, which cannot parse the let-chains the next commit
introduces. Pinning it there keeps format-on-save and pre-commit hooks in
agreement with CI.
clippy::collapsible_if is allowed crate-wide for now; the follow-up commit
adopts let-chains and removes the allow.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
90 lines
2.5 KiB
TOML
90 lines
2.5 KiB
TOML
[package]
|
|
name = "rtk"
|
|
version = "0.48.0"
|
|
edition = "2024"
|
|
rust-version = "1.91"
|
|
authors = ["Patrick Szymkowiak"]
|
|
description = "Rust Token Killer - High-performance CLI proxy to minimize LLM token consumption"
|
|
license = "Apache-2.0"
|
|
homepage = "https://www.rtk-ai.app"
|
|
repository = "https://github.com/rtk-ai/rtk"
|
|
readme = "README.md"
|
|
keywords = ["cli", "llm", "token", "filter", "productivity"]
|
|
categories = ["command-line-utilities", "development-tools"]
|
|
|
|
[dependencies]
|
|
clap = { version = "4", features = ["derive"] }
|
|
anyhow = "1.0"
|
|
# Console code page decoding for child-process output. Kept off the
|
|
# cfg(windows) target so the mapping and the incremental UTF-8 walk stay
|
|
# compiled — and unit-tested — on every platform; only the code page *lookup*
|
|
# is Windows-specific. codepage covers the ANSI/DBCS pages encoding_rs
|
|
# implements, oem_cp the legacy OEM/DOS pages (437, 850, …) it does not.
|
|
encoding_rs = "0.8"
|
|
codepage = "0.1"
|
|
oem_cp = "2"
|
|
ignore = "0.4"
|
|
walkdir = "2"
|
|
regex = "1"
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = { version = "1", features = ["preserve_order"] }
|
|
colored = "3"
|
|
dirs = "5"
|
|
rusqlite = { version = "0.31", features = ["bundled"] }
|
|
toml = "0.8"
|
|
toml_edit = "0.22"
|
|
chrono = "0.4"
|
|
tempfile = "3"
|
|
sha2 = "0.10"
|
|
ureq = "2"
|
|
getrandom = "0.4"
|
|
flate2 = "1.0"
|
|
quick-xml = "0.37"
|
|
which = "8"
|
|
|
|
[target.'cfg(unix)'.dependencies]
|
|
libc = "0.2"
|
|
|
|
[target.'cfg(windows)'.dependencies]
|
|
windows-sys = { version = "0.59", features = [
|
|
"Win32_System_Console",
|
|
"Win32_Globalization",
|
|
] }
|
|
|
|
[build-dependencies]
|
|
toml = "0.8"
|
|
|
|
[dev-dependencies]
|
|
# Safe, closure-scoped env mutation for tests. std::env::set_var is unsafe
|
|
# in edition 2024 and has no safe std replacement; temp-env restores the
|
|
# previous value on completion or panic and serializes callers internally.
|
|
temp-env = "0.3"
|
|
|
|
[profile.release]
|
|
opt-level = 3
|
|
lto = true
|
|
codegen-units = 1
|
|
panic = "abort"
|
|
strip = true
|
|
|
|
# cargo-deb configuration
|
|
[package.metadata.deb]
|
|
maintainer = "Patrick Szymkowiak"
|
|
copyright = "2024 Patrick Szymkowiak"
|
|
license-file = ["LICENSE", "0"]
|
|
extended-description = "rtk filters and compresses command outputs before they reach your LLM context, saving 60-90% of tokens."
|
|
section = "utility"
|
|
priority = "optional"
|
|
assets = [
|
|
["target/release/rtk", "usr/bin/", "755"],
|
|
]
|
|
# cargo-generate-rpm configuration
|
|
[package.metadata.generate-rpm]
|
|
assets = [
|
|
{ source = "target/release/rtk", dest = "/usr/bin/rtk", mode = "755" },
|
|
]
|
|
|
|
[lints.rust]
|
|
unsafe_code = "deny"
|
|
warnings = "deny"
|