Add client mode enabling the keep CLI to connect to a remote keep server over HTTP. Local plugins (compression, meta, filters) run on the client; the server stores/retrieves binary blobs. Architecture: - Client save uses 3-thread streaming pipeline: reader thread (stdin → tee/stdout → hash → compress), OS pipe, streamer thread (pipe → chunked HTTP POST). Memory usage is O(PIPESIZE) regardless of data size. - Server accepts compress=false, meta=false, decompress=false query params for granular control of server-side processing. - Streaming body handling on server via async channel → sync reader bridge (ChannelReader). Key additions: - src/client.rs: KeepClient with post_stream() for chunked upload - src/modes/client/: save, get, list, info, delete, diff, status - --client-url / KEEP_CLIENT_URL configuration - --client-password / KEEP_CLIENT_PASSWORD for auth - os_pipe dependency for zero-copy pipe streaming Co-Authored-By: andrew/openrouter/hunter-alpha <noreply@opencode.ai>
34 lines
918 B
Rust
34 lines
918 B
Rust
use crate::client::KeepClient;
|
|
use crate::modes::common::OutputFormat;
|
|
use crate::modes::common::settings_output_format;
|
|
use clap::Command;
|
|
use log::debug;
|
|
|
|
pub fn mode(
|
|
client: &KeepClient,
|
|
_cmd: &mut Command,
|
|
settings: &crate::config::Settings,
|
|
) -> Result<(), anyhow::Error> {
|
|
debug!("CLIENT_STATUS: Getting status from remote server");
|
|
|
|
let status = client.get_status()?;
|
|
|
|
let output_format = settings_output_format(settings);
|
|
|
|
match output_format {
|
|
OutputFormat::Json => {
|
|
println!("{}", serde_json::to_string_pretty(&status)?);
|
|
}
|
|
OutputFormat::Yaml => {
|
|
println!("{}", serde_yaml::to_string(&status)?);
|
|
}
|
|
OutputFormat::Table => {
|
|
println!("Remote Server Status");
|
|
println!("====================");
|
|
println!("{}", serde_json::to_string_pretty(&status)?);
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|