fj/Cargo.toml
Stephen Way a6fbf45ba9
stability + optimization: SIGINT handling, wiremock integration tests, trim binary 30%
Stability:
* `cli::run` now races command futures against `tokio::signal::ctrl_c()`.
  On SIGINT the command future is dropped, which propagates to the
  PagerGuard's Drop and restores stdout cleanly.
* Removed the unsafe `std::env::set_var("FJ_NO_PAGER")` in dispatch.
  `--no-pager` is now threaded into `pager::maybe_start(force_disabled)`
  as a parameter, no process-wide side effect.
* Replaced the panicking `.expect("token contains invalid header chars")`
  in `auth_headers` with a typed error that names the host and tells the
  user how to recover.
* Added 9 wiremock-backed integration tests covering: auth header
  injection, retry-on-5xx for idempotent methods, no-retry for POST,
  401 mapping to friendly error, custom header pass-through, null-body
  list tolerance, `get_all` following Link rel=next, total_limit honored
  on early break, malformed token rejection.

Optimization:
* Dropped unused reqwest features (stream, brotli) and unused crates
  (indicatif, futures-util, is-terminal, textwrap, tempfile).
* `panic = "abort"` and `lto = "fat"` on the release profile.
* HTTP retry loop now builds the request once and uses
  `reqwest::Request::try_clone` per attempt instead of rebuilding the
  RequestBuilder (eliminates per-attempt HeaderMap + URL clones).
* Pulled debug-mode request logging behind a `#[cold]` helper so the
  hot path stays small.

Binary: 5.94 MB → 4.15 MB stripped (-30%).
Tests: 51 → 60 (9 new integration tests).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 12:46:19 -07:00

50 lines
1.4 KiB
TOML

[package]
name = "fj"
version = "0.1.0"
edition = "2021"
rust-version = "1.82"
description = "Command-line tool for Forgejo, in the spirit of gh"
authors = ["Stephen Way <stephen@rasterstate.com>"]
license = "MIT"
repository = "https://rasterhub.com/rasterstate/fj"
readme = "README.md"
[[bin]]
name = "fj"
path = "src/main.rs"
[dependencies]
anyhow = "1"
thiserror = "2"
clap = { version = "4.5", features = ["derive", "env", "wrap_help"] }
clap_complete = "4.5"
clap_mangen = "0.2"
tokio = { version = "1", features = ["rt-multi-thread", "macros", "fs", "process", "io-util", "io-std", "signal"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls", "gzip", "multipart"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
toml = "0.8"
directories = "5"
keyring = { version = "3", features = ["apple-native", "linux-native", "windows-native"] }
url = "2"
chrono = { version = "0.4", default-features = false, features = ["serde", "clock"] }
tabled = { version = "0.16", features = ["ansi"] }
owo-colors = { version = "4", features = ["supports-colors"] }
supports-color = "3"
dialoguer = { version = "0.11", default-features = false, features = ["password"] }
libc = "0.2"
[dev-dependencies]
wiremock = "0.6"
tokio = { version = "1", features = ["rt-multi-thread", "macros", "test-util"] }
[profile.release]
lto = "fat"
codegen-units = 1
strip = "symbols"
opt-level = 3
panic = "abort"
[profile.dist]
inherits = "release"