Skip to content

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

fix(list): add missing summary field to JSON output (#1339)

Maximilian Roos3327edcb3177
diff --git a/docs/content/list.md b/docs/content/list.md
index 38aa7254b..400a77a99 100644
--- a/docs/content/list.md
+++ b/docs/content/list.md
@@ -205,6 +205,7 @@ wt list --format=json --full | jq '.[] | select(.ci.stale) | .branch'
| `ci` | object | CI status (see below, absent when no CI) |
| `url` | string | Dev server URL from project config (absent when not configured) |
| `url_active` | boolean | Whether the URL's port is listening (absent when not configured) |
+| `summary` | string | LLM-generated branch summary (absent when not configured or no summary) |
| `statusline` | string | Pre-formatted status with ANSI colors |
| `symbols` | string | Raw status symbols without colors (e.g., `"!?↓"`) |
diff --git a/skills/worktrunk/reference/list.md b/skills/worktrunk/reference/list.md
index 9e11e602f..9bde8f47d 100644
--- a/skills/worktrunk/reference/list.md
+++ b/skills/worktrunk/reference/list.md
@@ -177,6 +177,7 @@ wt list --format=json --full | jq '.[] | select(.ci.stale) | .branch'
| `ci` | object | CI status (see below, absent when no CI) |
| `url` | string | Dev server URL from project config (absent when not configured) |
| `url_active` | boolean | Whether the URL's port is listening (absent when not configured) |
+| `summary` | string | LLM-generated branch summary (absent when not configured or no summary) |
| `statusline` | string | Pre-formatted status with ANSI colors |
| `symbols` | string | Raw status symbols without colors (e.g., `"!?↓"`) |
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 86f4a4dc9..3e9bdfd48 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -626,6 +626,7 @@ wt list --format=json --full | jq '.[] | select(.ci.stale) | .branch'
| `ci` | object | CI status (see below, absent when no CI) |
| `url` | string | Dev server URL from project config (absent when not configured) |
| `url_active` | boolean | Whether the URL's port is listening (absent when not configured) |
+| `summary` | string | LLM-generated branch summary (absent when not configured or no summary) |
| `statusline` | string | Pre-formatted status with ANSI colors |
| `symbols` | string | Raw status symbols without colors (e.g., `"!?↓"`) |
diff --git a/src/commands/list/collect/tasks.rs b/src/commands/list/collect/tasks.rs
index 3cbcde436..7d79e6f62 100644
--- a/src/commands/list/collect/tasks.rs
+++ b/src/commands/list/collect/tasks.rs
@@ -657,7 +657,7 @@ impl Task for UrlStatusTask {
}
}
-/// Task 14: LLM-generated branch summary (--full only, requires LLM command)
+/// Task 14: LLM-generated branch summary (`--full` + `[list] summary = true` + LLM command)
pub struct SummaryGenerateTask;
impl Task for SummaryGenerateTask {
diff --git a/src/commands/list/collect/types.rs b/src/commands/list/collect/types.rs
index 009a2dbe7..0ea3111d1 100644
--- a/src/commands/list/collect/types.rs
+++ b/src/commands/list/collect/types.rs
@@ -154,7 +154,7 @@ pub(crate) enum TaskResult {
/// Whether the port is listening (None if no URL or couldn't parse port)
active: Option<bool>,
},
- /// LLM-generated branch summary (--full only, requires LLM command configured)
+ /// LLM-generated branch summary (`--full` + `[list] summary = true` + LLM command)
SummaryGenerate {
item_idx: usize,
summary: Option<String>,
diff --git a/src/commands/list/json_output.rs b/src/commands/list/json_output.rs
index 64af63817..f1b3848b1 100644
--- a/src/commands/list/json_output.rs
+++ b/src/commands/list/json_output.rs
@@ -91,6 +91,10 @@ pub struct JsonItem {
#[serde(skip_serializing_if = "Option::is_none")]
pub url_active: Option<bool>,
+ /// LLM-generated branch summary (requires `[list] summary = true`)
+ #[serde(skip_serializing_if = "Option::is_none")]
+ pub summary: Option<String>,
+
/// Pre-formatted statusline for statusline tools (tmux, starship)
#[serde(skip_serializing_if = "Option::is_none")]
pub statusline: Option<String>,
@@ -325,6 +329,9 @@ impl JsonItem {
.map(format_raw_symbols)
.filter(|s| !s.is_empty());
+ // Summary: flatten Option<Option<String>> → Option<String>
+ let summary = item.summary.as_ref().and_then(|s| s.clone());
+
JsonItem {
branch: item.branch.clone(),
path,
@@ -343,6 +350,7 @@ impl JsonItem {
ci,
url: item.url.clone(),
url_active: item.url_active,
+ summary,
statusline,
symbols,
}
@@ -881,6 +889,24 @@ mod tests {
assert!(json.contains("\"reason\":\"manual\""));
}
+ #[test]
+ fn test_json_item_summary_present() {
+ let mut item = ListItem::new_branch("abc1234".into(), "feature".into());
+ item.summary = Some(Some("Add login page".to_string()));
+ let json_item = JsonItem::from_list_item(&item);
+ assert_eq!(json_item.summary, Some("Add login page".to_string()));
+ }
+
+ #[test]
+ fn test_json_item_summary_absent() {
+ let mut item = ListItem::new_branch("abc1234".into(), "feature".into());
+ // None = not loaded, Some(None) = loaded but no summary — both should be absent in JSON
+ assert!(JsonItem::from_list_item(&item).summary.is_none());
+
+ item.summary = Some(None);
+ assert!(JsonItem::from_list_item(&item).summary.is_none());
+ }
+
#[test]
fn test_json_ci_serialization() {
let ci = JsonCi {
diff --git a/tests/snapshots/integration__integration_tests__help__help_list_long.snap b/tests/snapshots/integration__integration_tests__help__help_list_long.snap
index 09717fc2a..dede28943 100644
--- a/tests/snapshots/integration__integration_tests__help__help_list_long.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_list_long.snap
@@ -11,6 +11,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
+ NO_COLOR: ""
PSModulePath: ""
RUST_LOG: warn
SHELL: ""
@@ -199,27 +200,28 @@ Query structured data with --format=json:
Fields:
- Field Type Description
- ────────────────── ─────────── ───────────────────────────────────────────────────────────────────
- branch string/null Branch name (null for detached HEAD)
- path string Worktree path (absent for branches without worktrees)
- kind string "worktree" or "branch"
- commit object Commit info (see below)
- working_tree object Working tree state (see below)
- main_state string Relation to the default branch (see below)
- integration_reason string Why branch is integrated (see below)
- operation_state string "conflicts", "rebase", or "merge" (absent when clean)
- main object Relationship to the default branch (see below, absent when is_main)
- remote object Tracking branch info (see below, absent when no tracking)
- worktree object Worktree metadata (see below)
- is_main boolean Is the main worktree
- is_current boolean Is the current worktree
- is_previous boolean Previous worktree from wt switch
- ci object CI status (see below, absent when no CI)
- url string Dev server URL from project config (absent when not configured)
- url_active boolean Whether the URL's port is listening (absent when not configured)
- statusline string Pre-formatted status with ANSI colors
- symbols string Raw status symbols without colors (e.g., "!?↓")
+ Field Type Description
+ ────────────────── ─────────── ───────────────────────────────────────────────────────────────────────
+ branch string/null Branch name (null for detached HEAD)
+ path string Worktree path (absent for branches without worktrees)
+ kind string "worktree" or "branch"
+ commit object Commit info (see below)
+ working_tree object Working tree state (see below)
+ main_state string Relation to the default branch (see below)
+ integration_reason string Why branch is integrated (see below)
+ operation_state string "conflicts", "rebase", or "merge" (absent when clean)
+ main object Relationship to the default branch (see below, absent when is_main)
+ remote object Tracking branch info (see below, absent when no tracking)
+ worktree object Worktree metadata (see below)
+ is_main boolean Is the main worktree
+ is_current boolean Is the current worktree
+ is_previous boolean Previous worktree from wt switch
+ ci object CI status (see below, absent when no CI)
+ url string Dev server URL from project config (absent when not configured)
+ url_active boolean Whether the URL's port is listening (absent when not configured)
+ summary string LLM-generated branch summary (absent when not configured or no summary)
+ statusline string Pre-formatted status with ANSI colors
+ symbols string Raw status symbols without colors (e.g., "!?↓")
Commit object
diff --git a/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap b/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap
index 889a5e792..5aa3e9c2b 100644
--- a/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap
+++ b/tests/snapshots/integration__integration_tests__help__help_list_narrow_80.snap
@@ -11,6 +11,7 @@ info:
GIT_EDITOR: ""
LANG: C
LC_ALL: C
+ NO_COLOR: ""
PSModulePath: ""
RUST_LOG: warn
SHELL: ""
@@ -246,6 +247,8 @@ Query structured data with --format=json:
when not configured)
url_active boolean Whether the URL's port is listening (absent
when not configured)
+ summary string LLM-generated branch summary (absent when not
+ configured or no summary)
statusline string Pre-formatted status with ANSI colors
symbols string Raw status symbols without colors (e.g.,
"!?↓")