Skip to content

Commit bb81036

Browse files
committed
feat(cli): expose workspace_repos in aoe list --json
Sessions created with `--repo`/`--project` already persist their workspace info on disk, but `aoe list --json` only emitted the primary path, leaving CLI consumers no way to discover the extra repos. The web `SessionResponse` already carried `workspace_repos`; this brings the CLI surface to parity. Single-repo sessions return `workspace_repos: []` so the field is always present and never `null`.
1 parent fd504e3 commit bb81036

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

src/cli/list.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,32 @@ struct SessionJson {
3333
command: String,
3434
profile: String,
3535
created_at: chrono::DateTime<chrono::Utc>,
36+
/// Empty for single-repo sessions; populated with one entry per repo
37+
/// (including the primary) for sessions created with `--repo`/`--project`.
38+
workspace_repos: Vec<WorkspaceRepoJson>,
39+
}
40+
41+
#[derive(Serialize)]
42+
struct WorkspaceRepoJson {
43+
name: String,
44+
source_path: String,
45+
branch: String,
46+
}
47+
48+
fn workspace_repos_for(inst: &Instance) -> Vec<WorkspaceRepoJson> {
49+
inst.workspace_info
50+
.as_ref()
51+
.map(|w| {
52+
w.repos
53+
.iter()
54+
.map(|r| WorkspaceRepoJson {
55+
name: r.name.clone(),
56+
source_path: r.source_path.clone(),
57+
branch: r.branch.clone(),
58+
})
59+
.collect()
60+
})
61+
.unwrap_or_default()
3662
}
3763

3864
fn print_table_header() {
@@ -93,6 +119,7 @@ pub async fn run(profile: &str, args: ListArgs) -> Result<()> {
93119
command: inst.command.clone(),
94120
profile: storage.profile().to_string(),
95121
created_at: inst.created_at,
122+
workspace_repos: workspace_repos_for(inst),
96123
})
97124
.collect();
98125
super::output::print_json(&sessions)?;
@@ -125,6 +152,7 @@ async fn run_all_profiles(json: bool) -> Result<()> {
125152
if let Ok(storage) = Storage::new(profile_name) {
126153
if let Ok((instances, _)) = storage.load_with_groups() {
127154
for inst in instances {
155+
let workspace_repos = workspace_repos_for(&inst);
128156
all_sessions.push(SessionJson {
129157
id: inst.id,
130158
title: inst.title,
@@ -134,6 +162,7 @@ async fn run_all_profiles(json: bool) -> Result<()> {
134162
command: inst.command,
135163
profile: profile_name.clone(),
136164
created_at: inst.created_at,
165+
workspace_repos,
137166
});
138167
}
139168
}

0 commit comments

Comments
 (0)