Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Make `wt config state show` comprehensive with JSON support (#180)

Maximilian Roos920616f01759
diff --git a/src/cli.rs b/src/cli.rs
index fd22ed624..9ce74a0f7 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -465,10 +465,17 @@ pub enum StateCommand {
#[command(after_long_help = r#"Shows all cached state including:
- **Default branch**: Cached result of querying remote for default branch
+- **Switch history**: Previous branch for `wt switch -`
+- **Branch markers**: User-defined branch notes
- **CI status**: Cached GitHub/GitLab CI status per branch (30s TTL)
+- **Log files**: Background operation logs
CI cache entries show status, age, and the commit SHA they were fetched for."#)]
- Show,
+ Show {
+ /// Output format (table, json)
+ #[arg(long, value_enum, default_value = "table", hide_possible_values = true)]
+ format: OutputFormat,
+ },
}
#[derive(Subcommand)]
diff --git a/src/commands/config.rs b/src/commands/config.rs
index ed062c37a..96f3b47ea 100644
--- a/src/commands/config.rs
+++ b/src/commands/config.rs
@@ -685,8 +685,8 @@ pub fn handle_state_get(key: &str, refresh: bool, branch: Option<String>) -> any
});
// Build table
- let mut table = String::from("| File | Size | Modified |\n");
- table.push_str("|------|------|----------|\n");
+ let mut table = String::from("| File | Size | Age |\n");
+ table.push_str("|------|------|-----|\n");
for entry in entries {
let path = entry.path();
@@ -737,8 +737,18 @@ pub fn handle_state_set(key: &str, value: String, branch: Option<String>) -> any
None => repo.require_current_branch("set marker for current branch")?,
};
+ // Store as JSON with timestamp
+ let now = std::time::SystemTime::now()
+ .duration_since(std::time::UNIX_EPOCH)
+ .expect("system clock before Unix epoch")
+ .as_secs();
+ let json = serde_json::json!({
+ "marker": value,
+ "set_at": now
+ });
+
let config_key = format!("worktrunk.marker.{}", branch_name);
- repo.run_command(&["config", &config_key, &value])?;
+ repo.run_command(&["config", &config_key, &json.to_string()])?;
crate::output::print(success_message(cformat!(
"Set marker for <bold>{branch_name}</> to <bold>{value}</>"
@@ -851,59 +861,307 @@ pub fn handle_state_clear(key: &str, branch: Option<String>, all: bool) -> anyho
}
/// Handle the state show command
-pub fn handle_state_show() -> anyhow::Result<()> {
+pub fn handle_state_show(format: crate::cli::OutputFormat) -> anyhow::Result<()> {
+ use crate::cli::OutputFormat;
+
let repo = Repository::current();
+ match format {
+ OutputFormat::Json => handle_state_show_json(&repo),
+ OutputFormat::Table => handle_state_show_table(&repo),
+ }
+}
+
+/// Output state as JSON
+fn handle_state_show_json(repo: &Repository) -> anyhow::Result<()> {
+ // Get default branch
+ let default_branch = repo.default_branch().ok();
+
+ // Get switch history
+ let switch_previous = repo.get_switch_previous();
+
+ // Get markers
+ let markers: Vec<serde_json::Value> = get_all_markers(repo)
+ .into_iter()
+ .map(|m| {
+ serde_json::json!({
+ "branch": m.branch,
+ "marker": m.marker,
+ "set_at": if m.set_at > 0 { Some(m.set_at) } else { None }
+ })
+ })
+ .collect();
+
+ // Get CI status cache
+ let mut ci_entries = CachedCiStatus::list_all(repo);
+ ci_entries.sort_by(|a, b| {
+ b.1.checked_at
+ .cmp(&a.1.checked_at)
+ .then_with(|| a.0.cmp(&b.0))
+ });
+ let ci_status: Vec<serde_json::Value> = ci_entries
+ .into_iter()
+ .map(|(branch, cached)| {
+ let status = cached.status.as_ref().map(|s| {
+ serde_json::to_string(&s.ci_status)
+ .map(|s| s.trim_matches('"').to_string())
+ .unwrap_or_else(|_| "unknown".to_string())
+ });
+ serde_json::json!({
+ "branch": branch,
+ "status": status,
+ "checked_at": cached.checked_at,
+ "head": cached.head
+ })
+ })
+ .collect();
+
+ // Get log files
+ let git_common_dir = repo.git_common_dir()?;
+ let log_dir = git_common_dir.join("wt-logs");
+ let logs: Vec<serde_json::Value> = if log_dir.exists() {
+ let mut entries: Vec<_> = std::fs::read_dir(&log_dir)?
+ .filter_map(|e| e.ok())
+ .filter(|e| e.path().is_file() && e.path().extension().is_some_and(|ext| ext == "log"))
+ .collect();
+
+ entries.sort_by(|a, b| {
+ let a_time = a.metadata().and_then(|m| m.modified()).ok();
+ let b_time = b.metadata().and_then(|m| m.modified()).ok();
+ b_time.cmp(&a_time)
+ });
+
+ entries
+ .into_iter()
+ .map(|entry| {
+ let path = entry.path();
+ let name = path
+ .file_name()
+ .unwrap_or_default()
+ .to_string_lossy()
+ .to_string();
+ let meta = entry.metadata().ok();
+ let size = meta.as_ref().map(|m| m.len()).unwrap_or(0);
+ let modified = meta
+ .and_then(|m| m.modified().ok())
+ .and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok())
+ .map(|d| d.as_secs());
+
+ serde_json::json!({
+ "file": name,
+ "size": size,
+ "modified_at": modified
+ })
+ })
+ .collect()
+ } else {
+ vec![]
+ };
+
+ let output = serde_json::json!({
+ "default_branch": default_branch,
+ "switch_previous": switch_previous,
+ "markers": markers,
+ "ci_status": ci_status,
+ "logs": logs
+ });
+
+ crate::output::data(serde_json::to_string_pretty(&output)?)?;
+ Ok(())
+}
+
+/// Output state as human-readable table
+fn handle_state_show_table(repo: &Repository) -> anyhow::Result<()> {
+ // Build complete output as a string
+ let mut out = String::new();
+
// Show default branch cache
- crate::output::print(info_message("Default branch:"))?;
+ writeln!(out, "{}", cformat!("<cyan>DEFAULT BRANCH</>"))?;
match repo.default_branch() {
- Ok(branch) => crate::output::gutter(format_with_gutter(&branch, "", None))?,
- Err(_) => crate::output::gutter(format_with_gutter("(not cached)", "", None))?,
+ Ok(branch) => write!(out, "{}", format_with_gutter(&branch, "", None))?,
+ Err(_) => write!(out, "{}", format_with_gutter("(not cached)", "", None))?,
}
- crate::output::blank()?;
+ writeln!(out)?;
- // Show CI status cache
- crate::output::print(info_message("CI status cache:"))?;
+ // Show switch history (for `wt switch -`)
+ writeln!(out, "{}", cformat!("<cyan>SWITCH HISTORY</>"))?;
+ match repo.get_switch_previous() {
+ Some(prev) => write!(out, "{}", format_with_gutter(&prev, "", None))?,
+ None => write!(out, "{}", format_with_gutter("(none)", "", None))?,
+ }
+ writeln!(out)?;
+
+ // Show branch markers
+ writeln!(out, "{}", cformat!("<cyan>BRANCH MARKERS</>"))?;
+ let markers = get_all_markers(repo);
+ if markers.is_empty() {
+ write!(out, "{}", format_with_gutter("(none)", "", None))?;
+ } else {
+ let mut table = String::from("| Branch | Marker | Age |\n");
+ table.push_str("|--------|--------|-----|\n");
+ for entry in markers {
+ let age = if entry.set_at == 0 {
+ "?".to_string() // Legacy marker without timestamp
+ } else {
+ format_relative_time_short(entry.set_at as i64)
+ };
+ table.push_str(&format!(
+ "| {} | {} | {} |\n",
+ entry.branch, entry.marker, age
+ ));
+ }
+ let rendered = crate::md_help::render_markdown_table(&table);
+ writeln!(out, "{}", rendered.trim_end())?;
+ }
+ writeln!(out)?;
- let entries = CachedCiStatus::list_all(&repo);
+ // Show CI status cache
+ writeln!(out, "{}", cformat!("<cyan>CI STATUS CACHE</>"))?;
+ let mut entries = CachedCiStatus::list_all(repo);
+ // Sort by age (most recent first), then by branch name for ties
+ entries.sort_by(|a, b| {
+ b.1.checked_at
+ .cmp(&a.1.checked_at)
+ .then_with(|| a.0.cmp(&b.0))
+ });
if entries.is_empty() {
- crate::output::gutter(format_with_gutter("(empty)", "", None))?;
- return Ok(());
+ write!(out, "{}", format_with_gutter("(none)", "", None))?;
+ } else {
+ // Build markdown table
+ let mut table = String::from("| Branch | Status | Age | Head |\n");
+ table.push_str("|--------|--------|-----|------|\n");
+ for (branch, cached) in entries {
+ let status = match &cached.status {
+ Some(pr_status) => serde_json::to_string(&pr_status.ci_status)
+ .map(|s| s.trim_matches('"').to_string())
+ .unwrap_or_else(|_| "unknown".to_string()),
+ None => "none".to_string(),
+ };
+ let age = format_relative_time_short(cached.checked_at as i64);
+ let head: String = cached.head.chars().take(8).collect();
+
+ table.push_str(&format!("| {branch} | {status} | {age} | {head} |\n"));
+ }
+
+ let rendered = crate::md_help::render_markdown_table(&table);
+ writeln!(out, "{}", rendered.trim_end())?;
}
+ writeln!(out)?;
- // Respect SOURCE_DATE_EPOCH for reproducible test output
- let now_secs = std::env::var("SOURCE_DATE_EPOCH")
- .ok()
- .and_then(|val| val.parse::<u64>().ok())
- .unwrap_or_else(|| {
- std::time::SystemTime::now()
- .duration_since(std::time::UNIX_EPOCH)
- .map(|d| d.as_secs())
- .unwrap_or(0)
- });
+ // Show log files
+ let git_common_dir = repo.git_common_dir()?;
+ let log_dir = git_common_dir.join("wt-logs");
+ writeln!(out, "{}", cformat!("<cyan>LOG FILES</> @ .git/wt-logs"))?;
- // Build markdown table
- let mut table = String::from("| Branch | Status | Age | Head |\n");
- table.push_str("|--------|--------|-----|------|\n");
- for (branch, cached) in entries {
- let status = match &cached.status {
- Some(pr_status) => serde_json::to_string(&pr_status.ci_status)
- .map(|s| s.trim_matches('"').to_string())
- .unwrap_or_else(|_| "unknown".to_string()),
- None => "none".to_string(),
- };
- let age = now_secs.saturating_sub(cached.checked_at);
- let head: String = cached.head.chars().take(8).collect();
+ if !log_dir.exists() {
+ write!(out, "{}", format_with_gutter("(none)", "", None))?;
+ } else {
+ let mut entries: Vec<_> = std::fs::read_dir(&log_dir)?
+ .filter_map(|e| e.ok())
+ .filter(|e| e.path().is_file() && e.path().extension().is_some_and(|ext| ext == "log"))
+ .collect();
+
+ if entries.is_empty() {
+ write!(out, "{}", format_with_gutter("(none)", "", None))?;
+ } else {
+ // Sort by modification time (newest first)
+ entries.sort_by(|a, b| {
+ let a_time = a.metadata().and_then(|m| m.modified()).ok();
+ let b_time = b.metadata().and_then(|m| m.modified()).ok();
+ b_time.cmp(&a_time)
+ });
+
+ // Build table
+ let mut table = String::from("| File | Size | Age |\n");
+ table.push_str("|------|------|-----|\n");
+
+ for entry in entries {
+ let path = entry.path();
+ let name = path.file_name().unwrap_or_default().to_string_lossy();
+ let meta = entry.metadata().ok();
+
+ let size = meta.as_ref().map(|m| m.len()).unwrap_or(0);
+ let size_str = if size < 1024 {
+ format!("{size}B")
+ } else {
+ format!("{}K", size / 1024)
+ };
- table.push_str(&format!("| {branch} | {status} | {age}s | {head} |\n"));
+ let age = meta
+ .and_then(|m| m.modified().ok())
+ .and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok())
+ .map(|d| format_relative_time_short(d.as_secs() as i64))
+ .unwrap_or_else(|| "?".to_string());
+
+ table.push_str(&format!("| {name} | {size_str} | {age} |\n"));
+ }
+
+ let rendered = crate::md_help::render_markdown_table(&table);
+ write!(out, "{}", rendered.trim_end())?;
+ }
}
- let rendered = crate::md_help::render_markdown_table(&table);
- crate::output::table(rendered.trim_end())?;
+ // Display through pager (fall back to stderr if pager unavailable)
+ if let Err(e) = show_help_in_pager(&out) {
+ log::debug!("Pager invocation failed: {}", e);
+ // Fall back to direct output via eprintln (matches help behavior)
+ worktrunk::styling::eprintln!("{}", out);
+ }
Ok(())
}
+/// Marker entry with branch, text, and timestamp
+struct MarkerEntry {
+ branch: String,
+ marker: String,
+ set_at: u64,
+}
+
+/// Get all branch markers from git config with timestamps
+fn get_all_markers(repo: &Repository) -> Vec<MarkerEntry> {
+ let output = repo
+ .run_command(&["config", "--get-regexp", "^worktrunk\\.marker\\."])
+ .unwrap_or_default();
+
+ let mut markers = Vec::new();
+ for line in output.lines() {
+ // Format: "worktrunk.marker.branch_name json_or_plain_value"
+ if let Some((key, value)) = line.split_once(' ')
+ && let Some(branch) = key.strip_prefix("worktrunk.marker.")
+ {
+ // Try to parse as JSON, fall back to legacy plain-text
+ if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(value) {
+ // Skip if "marker" field is missing (corrupted data)
+ let Some(marker) = parsed.get("marker").and_then(|v| v.as_str()) else {
+ continue;
+ };
+ let set_at = parsed.get("set_at").and_then(|v| v.as_u64()).unwrap_or(0);
+ markers.push(MarkerEntry {
+ branch: branch.to_string(),
+ marker: marker.to_string(),
+ set_at,
+ });
+ } else {
+ // Legacy plain-text marker (no timestamp)
+ markers.push(MarkerEntry {
+ branch: branch.to_string(),
+ marker: value.to_string(),
+ set_at: 0, // Unknown age
+ });
+ }
+ }
+ }
+
+ // Sort by age (most recent first), then by branch name for ties
+ markers.sort_by(|a, b| {
+ b.set_at
+ .cmp(&a.set_at)
+ .then_with(|| a.branch.cmp(&b.branch))
+ });
+ markers
+}
+
#[cfg(test)]
mod tests {
use super::*;
diff --git a/src/git/repository/mod.rs b/src/git/repository/mod.rs
index 4f6d6591a..1c34f8992 100644
--- a/src/git/repository/mod.rs
+++ b/src/git/repository/mod.rs
@@ -273,12 +273,26 @@ impl Repository {
}
/// Read a user-defined marker from `worktrunk.marker.<branch>` in git config.
+ ///
+ /// Markers are stored as JSON: `{"marker": "text", "set_at": unix_timestamp}`.
+ /// Falls back to plain text for legacy markers without timestamps.
pub fn branch_keyed_marker(&self, branch: &str) -> Option<String> {
let config_key = format!("worktrunk.marker.{}", branch);
- self.run_command(&["config", "--get", &config_key])
+ let raw = self
+ .run_command(&["config", "--get", &config_key])
.ok()
.map(|output| output.trim().to_string())
- .filter(|s| !s.is_empty())
+ .filter(|s| !s.is_empty())?;
+
+ // Try to parse as JSON, fall back to raw string for legacy markers
+ if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&raw) {
+ parsed
+ .get("marker")
+ .and_then(|v| v.as_str())
+ .map(|s| s.to_string())
+ } else {
+ Some(raw) // Legacy plain-text marker
+ }
}
/// Read user-defined branch-keyed marker.
diff --git a/src/main.rs b/src/main.rs
index c24d96d6a..e6421dd7a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -929,7 +929,7 @@ fn main() {
LogsAction::Get => handle_state_get("logs", false, None),
LogsAction::Clear => handle_state_clear("logs", None, false),
},
- StateCommand::Show => handle_state_show(),
+ StateCommand::Show { format } => handle_state_show(format),
},
},
Commands::Step { action } => match action {
diff --git a/tests/integration_tests/config_state.rs b/tests/integration_tests/config_state.rs
index 714ec2af8..06401ce86 100644
--- a/tests/integration_tests/config_state.rs
+++ b/tests/integration_tests/config_state.rs
@@ -21,6 +21,14 @@ fn wt_state_show_cmd(repo: &TestRepo) -> Command {
cmd
}
+fn wt_state_show_json_cmd(repo: &TestRepo) -> Command {
+ let mut cmd = wt_command();
+ repo.clean_cli_env(&mut cmd);
+ cmd.args(["config", "state", "show", "--format=json"]);
+ cmd.current_dir(repo.root_path());
+ cmd
+}
+
// ============================================================================
// default-branch
// ============================================================================
@@ -219,11 +227,8 @@ fn test_state_set_marker_branch_default(repo: TestRepo) {
assert!(output.status.success());
assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"βœ… Set marker for main to 🚧");
- // Verify it was set
- let output = repo
- .git_command(&["config", "--get", "worktrunk.marker.main"])
- .output()
- .unwrap();
+ // Verify it was set (use wt command to parse JSON storage)
+ let output = wt_state_cmd(&repo, "marker", "get", &[]).output().unwrap();
assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "🚧");
}
@@ -237,9 +242,8 @@ fn test_state_set_marker_branch_specific(repo: TestRepo) {
assert!(output.status.success());
assert_snapshot!(String::from_utf8_lossy(&output.stderr), @"βœ… Set marker for feature to πŸ”§");
- // Verify it was set
- let output = repo
- .git_command(&["config", "--get", "worktrunk.marker.feature"])
+ // Verify it was set (use wt command to parse JSON storage)
+ let output = wt_state_cmd(&repo, "marker", "get", &["--branch", "feature"])
.output()
.unwrap();
assert_eq!(String::from_utf8_lossy(&output.stdout).trim(), "πŸ”§");
@@ -380,11 +384,20 @@ fn test_state_show_empty(repo: TestRepo) {
let output = wt_state_show_cmd(&repo).output().unwrap();
assert!(output.status.success());
assert_snapshot!(String::from_utf8_lossy(&output.stderr), @r"
- βšͺ Default branch:
+ DEFAULT BRANCH
  main
- βšͺ CI status cache:
-   (empty)
+ SWITCH HISTORY
+   (none)
+
+ BRANCH MARKERS
+   (none)
+
+ CI STATUS CACHE
+   (none)
+
+ LOG FILES @ .git/wt-logs
+   (none)
");
}
@@ -419,3 +432,112 @@ fn test_state_show_with_ci_entries(repo: TestRepo) {
assert!(output.status.success());
assert_snapshot!(String::from_utf8_lossy(&output.stderr));
}
+
+#[rstest]
+fn test_state_show_comprehensive(repo: TestRepo) {
+ // Set up switch history
+ repo.git_command(&["config", "worktrunk.history", "feature"])
+ .status()
+ .unwrap();
+
+ // Set up branch markers (JSON format with timestamps for deterministic age)
+ repo.git_command(&[
+ "config",
+ "worktrunk.marker.feature",
+ &format!(r#"{{"marker":"🚧 WIP","set_at":{TEST_EPOCH}}}"#),
+ ])
+ .status()
+ .unwrap();
+ repo.git_command(&[
+ "config",
+ "worktrunk.marker.bugfix",
+ &format!(r#"{{"marker":"πŸ› debugging","set_at":{TEST_EPOCH}}}"#),
+ ])
+ .status()
+ .unwrap();
+
+ // Set up CI cache
+ repo.git_command(&[
+ "config",
+ "worktrunk.ci.feature",
+ &format!(r#"{{"status":{{"ci_status":"passed","source":"pullrequest","is_stale":false}},"checked_at":{TEST_EPOCH},"head":"abc12345def67890"}}"#),
+ ])
+ .status()
+ .unwrap();
+
+ // Create log files
+ let git_dir = repo.root_path().join(".git");
+ let log_dir = git_dir.join("wt-logs");
+ std::fs::create_dir_all(&log_dir).unwrap();
+ std::fs::write(log_dir.join("feature-post-start-npm.log"), "npm output").unwrap();
+ std::fs::write(log_dir.join("bugfix-remove.log"), "remove output").unwrap();
+
+ let output = wt_state_show_cmd(&repo).output().unwrap();
+ assert!(output.status.success());
+ assert_snapshot!(String::from_utf8_lossy(&output.stderr));
+}
+
+#[rstest]
+fn test_state_show_json_empty(repo: TestRepo) {
+ let output = wt_state_show_json_cmd(&repo).output().unwrap();
+ assert!(output.status.success());
+ // JSON output goes to stdout
+ let json_str = String::from_utf8_lossy(&output.stdout);
+ let json: serde_json::Value = serde_json::from_str(&json_str).unwrap();
+
+ assert_eq!(json["default_branch"], "main");
+ assert_eq!(json["switch_previous"], serde_json::Value::Null);
+ assert_eq!(json["markers"], serde_json::json!([]));
+ assert_eq!(json["ci_status"], serde_json::json!([]));
+ assert_eq!(json["logs"], serde_json::json!([]));
+}
+
+#[rstest]
+fn test_state_show_json_comprehensive(repo: TestRepo) {
+ // Set up switch history
+ repo.git_command(&["config", "worktrunk.history", "feature"])
+ .status()
+ .unwrap();
+
+ // Set up branch markers (JSON format with timestamps)
+ repo.git_command(&[
+ "config",
+ "worktrunk.marker.feature",
+ &format!(r#"{{"marker":"🚧 WIP","set_at":{TEST_EPOCH}}}"#),
+ ])
+ .status()
+ .unwrap();
+
+ // Set up CI cache
+ repo.git_command(&[
+ "config",
+ "worktrunk.ci.feature",
+ &format!(r#"{{"status":{{"ci_status":"passed","source":"pullrequest","is_stale":false}},"checked_at":{TEST_EPOCH},"head":"abc12345def67890"}}"#),
+ ])
+ .status()
+ .unwrap();
+
+ let output = wt_state_show_json_cmd(&repo).output().unwrap();
+ assert!(output.status.success());
+ // JSON output goes to stdout
+ let json_str = String::from_utf8_lossy(&output.stdout);
+ let json: serde_json::Value = serde_json::from_str(&json_str).unwrap();
+
+ assert_eq!(json["default_branch"], "main");
+ assert_eq!(json["switch_previous"], "feature");
+
+ // Check markers
+ let markers = json["markers"].as_array().unwrap();
+ assert_eq!(markers.len(), 1);
+ assert_eq!(markers[0]["branch"], "feature");
+ assert_eq!(markers[0]["marker"], "🚧 WIP");
+ assert_eq!(markers[0]["set_at"], TEST_EPOCH);
+
+ // Check CI status
+ let ci_status = json["ci_status"].as_array().unwrap();
+ assert_eq!(ci_status.len(), 1);
+ assert_eq!(ci_status[0]["branch"], "feature");
+ assert_eq!(ci_status[0]["status"], "passed");
+ assert_eq!(ci_status[0]["checked_at"], TEST_EPOCH);
+ assert_eq!(ci_status[0]["head"], "abc12345def67890");
+}
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__config_state__state_show_comprehensive.snap b/tests/integration_tests/snapshots/integration__integration_tests__config_state__state_show_comprehensive.snap
new file mode 100644
index 000000000..7d7f55fa1
--- /dev/null
+++ b/tests/integration_tests/snapshots/integration__integration_tests__config_state__state_show_comprehensive.snap
@@ -0,0 +1,26 @@
+---
+source: tests/integration_tests/config_state.rs
+expression: "String::from_utf8_lossy(&output.stderr)"
+---
+DEFAULT BRANCH
+  main
+
+SWITCH HISTORY
+  feature
+
+BRANCH MARKERS
+Branch Marker Age
+─────── ──────────── ───
+bugfix πŸ› debugging now
+feature 🚧 WIP now
+
+CI STATUS CACHE
+Branch Status Age Head
+─────── ────── ─── ────────
+feature passed now abc12345
+
+LOG FILES @ .git/wt-logs
+File Size Age
+────────────────────────── ──── ──────
+bugfix-remove.log 13B future
+feature-post-start-npm.log 10B future
diff --git a/tests/integration_tests/snapshots/integration__integration_tests__config_state__state_show_with_ci_entries.snap b/tests/integration_tests/snapshots/integration__integration_tests__config_state__state_show_with_ci_entries.snap
index 97417a04e..557ae1ff5 100644
--- a/tests/integration_tests/snapshots/integration__integration_tests__config_state__state_show_with_ci_entries.snap
+++ b/tests/integration_tests/snapshots/integration__integration_tests__config_state__state_show_with_ci_entries.snap
@@ -2,12 +2,21 @@
source: tests/integration_tests/config_state.rs
expression: "String::from_utf8_lossy(&output.stderr)"
---
-βšͺ Default branch:
+DEFAULT BRANCH
  main
-βšͺ CI status cache:
+SWITCH HISTORY
+  (none)
+
+BRANCH MARKERS
+  (none)
+
+CI STATUS CACHE
Branch Status Age Head
─────── ────── ─── ────────
-feature passed 0s abc12345
-bugfix failed 0s 11122233
-main none 0s deadbeef
+bugfix failed now 11122233
+feature passed now abc12345
+main none now deadbeef
+
+LOG FILES @ .git/wt-logs
+  (none)
diff --git a/tests/snapshots/integration__integration_tests__help__help_config_state_show.snap b/tests/snapshots/integration__integration_tests__help__help_config_state_show.snap
index bfdcd618c..b817f6e51 100644
--- a/tests/snapshots/integration__integration_tests__help__help_config_state_show.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_config_state_show.snap
@@ -24,6 +24,11 @@ wt config state show - Show all cached state
Usage: wt config state show [OPTIONS]
Options:
+ --format <FORMAT>
+ Output format (table, json)
+
+ [default: table]
+
-h, --help
Print help (see a summary with '-h')
@@ -40,6 +45,9 @@ Usage: wt config state show [OPTIONS]
Shows all cached state including:
- Default branch: Cached result of querying remote for default branch
+- Switch history: Previous branch for wt switch -
+- Branch markers: User-defined branch notes
- CI status: Cached GitHub/GitLab CI status per branch (30s TTL)
+- Log files: Background operation logs
CI cache entries show status, age, and the commit SHA they were fetched for.