aboutsummaryrefslogtreecommitdiffstats
path: root/crates/turtle
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-20 23:00:06 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-07-20 23:00:06 +0200
commit2f671f196e245ac1a791c001286e401a2fab9d3a (patch)
treebe90d8f16d5c8b65c6b77ebe1359d22e9738bbf6 /crates/turtle
parentchore: Commit (diff)
downloadatuin-2f671f196e245ac1a791c001286e401a2fab9d3a.zip
chore: Commit
Diffstat (limited to '')
-rw-r--r--crates/turtle/Cargo.toml68
-rw-r--r--crates/turtle/src/client/mod.rs9
-rw-r--r--crates/turtle/src/history/builder.rs4
-rw-r--r--crates/turtle/src/history/mod.rs24
-rw-r--r--crates/turtle/src/lib.rs2
5 files changed, 10 insertions, 97 deletions
diff --git a/crates/turtle/Cargo.toml b/crates/turtle/Cargo.toml
index 102c5e9a..547f8530 100644
--- a/crates/turtle/Cargo.toml
+++ b/crates/turtle/Cargo.toml
@@ -12,84 +12,18 @@ homepage = { workspace = true }
repository = { workspace = true }
[dependencies]
-turtle-common = {workspace = true}
-async-trait = "0.1.58"
-axum = "0.8"
-base64 = "0.22"
-clap = { version = "4.5.7", features = ["derive"] }
-clap_complete = "4.5.8"
-clap_complete_nushell = "4.5.4"
-colored = "2.0.4"
-config = { version = "0.15.8", default-features = false, features = ["toml"] }
-crossterm = {version = "0.29.0", features = ["use-dev-tty", "serde"] }
-crypto_secretbox = "0.1.1"
-dashmap = "6.1.0"
-directories = "6.0.0"
eyre = "0.6"
-fs-err = "3.1"
-fs4 = "0.13.1"
-fuzzy-matcher = "0.3.7"
hyper-util = "0.1"
-indicatif = "0.18.0"
-interim = { version = "0.2.0", features = ["time_0_3"] }
-itertools = "0.14.0"
-lasso = { version = "0.7", features = ["multi-threaded"] }
-log = "0.4"
-metrics = "0.24"
-metrics-exporter-prometheus = { version = "0.18", default-features = false }
-minspan = "0.1.5"
-norm = { version = "0.1.1", features = ["fzf-v2"] }
-notify = "7"
prost = "0.14"
-rand = { version = "0.8.5", features = ["std"] }
-ratatui = "0.30.0"
regex = "1.10.5"
-reqwest = { version = "0.13", features = ["json", "rustls-no-provider", "stream"], default-features = false }
-rmp = { version = "0.8.14" }
-runtime-format = "0.1.3"
-rustix = { version = "1.1.4", features = ["process", "fs"] }
-rustls = { version = "0.23", default-features = false, features = [ "ring", "std", "tls12", ] }
-rusty_paserk = { version = "0.5.0", default-features = false, features = [ "v4", "serde", ] }
-rusty_paseto = { version = "0.8.0", default-features = false }
-semver = "1.0.20"
-serde = { version = "1.0.202", features = ["derive"] }
-serde_json = "1.0.119"
-serde_regex = "1.1.0"
-serde_with = "3.8.1"
-shellexpand = "3"
-sql-builder = "3"
sqlx = { version = "0.8", features = ["runtime-tokio-rustls", "time", "postgres", "uuid", "sqlite", "regexp"] }
-thiserror = "2"
time = { version = "0.3.47", features = [ "serde-human-readable", "macros", "local-offset", "macros", "formatting", "parsing"] }
tokio = { version = "1", features = ["full"] }
-tokio-stream = { version = "0.1.14", features = ["net"] }
-toml_edit = "0.25.4"
tonic = "0.14"
tonic-prost = "0.14"
tower = "0.5"
-tower-http = { version = "0.6", features = ["trace"] }
-tracing = "0.1"
-tracing-appender = "0.2"
-tracing-subscriber = { version = "0.3", features = ["ansi", "fmt", "registry", "env-filter", "json"] }
+turtle-common = {workspace = true}
typed-builder = "0.18.2"
-unicode-segmentation = "1.11.0"
-unicode-width = "0.2"
-url = "2.5.2"
-uuid = { version = "1.9", features = ["v4", "v7", "serde"] }
-vt100 = "0.16"
-whoami = "2.1.0"
-
-[target.'cfg(target_os = "linux")'.dependencies]
-arboard = { version = "3.4", default-features = false, features = [ "wayland-data-control", ] }
-listenfd = "1.0.1"
-
-[target.'cfg(unix)'.dependencies]
-daemonize = "0.5.0"
-portable-pty = "0.9"
-signal-hook = "0.3"
-
-[dev-dependencies]
-tokio = { version = "1", features = ["full"] }
[build-dependencies]
protox = "0.9"
diff --git a/crates/turtle/src/client/mod.rs b/crates/turtle/src/client/mod.rs
index 07f01e6c..ec97c994 100644
--- a/crates/turtle/src/client/mod.rs
+++ b/crates/turtle/src/client/mod.rs
@@ -54,12 +54,12 @@ pub fn history_entry_to_history(entry: HistoryEntry) -> History {
}
#[must_use]
-pub fn daemon_matches_expected(version: &str, protocol: u32) -> bool {
+pub fn daemon_matches_expected(protocol: u32) -> bool {
protocol == DAEMON_PROTOCOL_VERSION
}
#[must_use]
-pub fn daemon_mismatch_message(version: &str, protocol: u32) -> String {
+pub fn daemon_mismatch_message(protocol: u32) -> String {
if protocol == DAEMON_PROTOCOL_VERSION {
unreachable!()
} else {
@@ -110,10 +110,10 @@ pub async fn probe(path: String) -> Probe {
match client.status().await {
Ok(status) => {
- if daemon_matches_expected(&status.version, status.protocol) {
+ if daemon_matches_expected(status.protocol) {
Probe::Ready(client)
} else {
- Probe::NeedsRestart(daemon_mismatch_message(&status.version, status.protocol))
+ Probe::NeedsRestart(daemon_mismatch_message(status.protocol))
}
}
Err(err) => Probe::Unreachable(err),
@@ -129,6 +129,7 @@ pub struct HistoryClient {
client: HistoryServiceClient<Channel>,
}
+#[derive(Clone, Copy, Debug)]
pub struct Range {
pub start: OffsetDateTime,
pub end: OffsetDateTime,
diff --git a/crates/turtle/src/history/builder.rs b/crates/turtle/src/history/builder.rs
index 7eca0491..08d26f7f 100644
--- a/crates/turtle/src/history/builder.rs
+++ b/crates/turtle/src/history/builder.rs
@@ -68,8 +68,8 @@ impl From<HistoryDaemonCapture> for History {
captured.cwd,
-1,
-1,
- Some(captured.session),
- Some(captured.hostname),
+ captured.session,
+ captured.hostname,
captured.author,
captured.intent,
None,
diff --git a/crates/turtle/src/history/mod.rs b/crates/turtle/src/history/mod.rs
index 10e74d8e..27755bbe 100644
--- a/crates/turtle/src/history/mod.rs
+++ b/crates/turtle/src/history/mod.rs
@@ -30,22 +30,6 @@ impl From<String> for HistoryId {
}
}
-pub(crate) fn get_hostname() -> String {
- env::var("ATUIN_HOST_NAME")
- .unwrap_or_else(|_| whoami::hostname().unwrap_or_else(|_| "unknown-host".to_string()))
-}
-
-pub(crate) fn get_username() -> String {
- env::var("ATUIN_HOST_USER")
- .unwrap_or_else(|_| whoami::username().unwrap_or_else(|_| "unknown-user".to_string()))
-}
-
-/// Returns a pair of the hostname and username, separated by a colon.
-#[must_use]
-pub fn get_host_user() -> String {
- format!("{}:{}", get_hostname(), get_username())
-}
-
/// Client-side history entry.
///
/// Client stores data unencrypted, and only encrypts it before sending to the server.
@@ -123,16 +107,12 @@ impl History {
cwd: String,
exit: i64,
duration: i64,
- session: Option<String>,
- hostname: Option<String>,
+ session: String,
+ hostname: String,
author: Option<String>,
intent: Option<String>,
deleted_at: Option<OffsetDateTime>,
) -> Self {
- let session = session
- .or_else(|| env::var("ATUIN_SESSION").ok())
- .unwrap_or_else(|| uuid_v7().as_simple().to_string());
- let hostname = hostname.unwrap_or_else(get_host_user);
let author = Self::normalize_optional_field(author)
.or_else(|| Self::normalize_optional_field(env::var(HISTORY_AUTHOR_ENV).ok()))
.unwrap_or_else(|| Self::author_from_hostname(hostname.as_str()));
diff --git a/crates/turtle/src/lib.rs b/crates/turtle/src/lib.rs
index c78b0475..fbee6761 100644
--- a/crates/turtle/src/lib.rs
+++ b/crates/turtle/src/lib.rs
@@ -1,5 +1,3 @@
-#![expect(unused_crate_dependencies)]
-
pub mod client;
pub mod generated;
pub mod history;