Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ tapes-client = { version = "0.4", features = [
clap = { version = "4", features = ["derive", "env", "string"] }
anstream = "1"
anstyle = "1"
# The table `sessions list` renders by default. Terminal-width handling and
# unicode-width measurement come free, which a hand-rolled column aligner would
# have to reimplement (and get subtly wrong on CJK/emoji cells). Plain text: no
# colour is applied — tapesctl has no style layer (see `ports/search.rs`).
comfy-table = "7.1"

# --- async runtime ---
tokio = { version = "1", features = ["full"] }
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,13 @@ tapesctl spans list <trace-id>
tapesctl spans get <trace-id> <span-id>
```

Each prints the server's JSON verbatim, so it composes with `jq`. `sessions
list` pages with `--limit`/`--cursor` and narrows with `--sort`,
`--direction`, `--since`, `--until`, and `--auth-subject`; a cursor is only
valid with the `--sort` and `--direction` it was minted under. `sessions
traces` and `spans list` take `--payload preview` to truncate payload strings
server-side.
`sessions list` renders its listing as a table by default; `--json` restores the
raw document so it still composes with `jq`. The other commands print the
server's JSON verbatim. `sessions list` pages with `--limit`/`--cursor` and
narrows with `--sort`, `--direction`, `--since`, `--until`, and
`--auth-subject`; a cursor is only valid with the `--sort` and `--direction` it
was minted under. `sessions traces` and `spans list` take `--payload preview`
to truncate payload strings server-side.

```bash
tapesctl export <session-id> -o bundle.jsonl # --detail spans (default) or traces
Expand Down
1 change: 1 addition & 0 deletions crates/tapesctl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ axum = { workspace = true }
base64 = { workspace = true }
bytes = { workspace = true }
clap = { workspace = true }
comfy-table = { workspace = true }
dirs = { workspace = true }
flate2 = { workspace = true }
futures-util = { workspace = true }
Expand Down
22 changes: 16 additions & 6 deletions crates/tapesctl/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,14 @@
//!
//! # Output
//!
//! Every command prints the server's JSON, pretty-printed, and nothing else. See
//! [`client`] for why these particular responses are not decoded through the
//! shared models on the way through: in short, a model can only carry the
//! fields the build it shipped in knew about, and these commands exist to show
//! what the server said.
//! `sessions list` renders its listing as a table by default; `--json` restores
//! the raw document. Every other command prints the server's JSON,
//! pretty-printed, and nothing else. See [`client`] for why these particular
//! responses are not decoded through the shared models on the way through: in
//! short, a model can only carry the fields the build it shipped in knew about,
//! and these commands exist to show what the server said. The table view keeps
//! that spirit by reading its columns off the undecoded document — see
//! [`table`].
//!
//! # Requests
//!
Expand All @@ -36,6 +39,7 @@

pub mod client;
pub mod contract;
pub mod table;

use serde_json::Value;
use snafu::{OptionExt, ResultExt};
Expand Down Expand Up @@ -107,7 +111,12 @@ pub async fn sessions(command: SessionsCommand) -> Result<()> {
values.push(("direction", direction));
}
let value: Value = client.call(ops::LIST_SESSIONS, values).await?;
print_json(&value)
if args.json {
print_json(&value)
} else {
print!("{}", table::render_sessions(&value));
Ok(())
}
}
SessionsCommand::Get(args) => {
let client = resolve_client(&args.api)?;
Expand Down Expand Up @@ -208,6 +217,7 @@ mod tests {
harness_session_id: None,
harness_id: None,
auth_subject: None,
json: false,
}
}

Expand Down
Loading
Loading