From f6d5692eb1e290689df516cec6fe77f07d419783 Mon Sep 17 00:00:00 2001 From: soryu Date: Tue, 27 Jan 2026 02:38:37 +0000 Subject: Fix worktree info and patches endpoint --- makima/src/server/handlers/mesh_daemon.rs | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) (limited to 'makima/src/server/handlers/mesh_daemon.rs') diff --git a/makima/src/server/handlers/mesh_daemon.rs b/makima/src/server/handlers/mesh_daemon.rs index f7fe49f..433c787 100644 --- a/makima/src/server/handlers/mesh_daemon.rs +++ b/makima/src/server/handlers/mesh_daemon.rs @@ -493,6 +493,33 @@ pub enum DaemonMessage { #[serde(rename = "prNumber")] pr_number: Option, }, + /// Response to GetWorktreeInfo command + WorktreeInfoResult { + #[serde(rename = "taskId")] + task_id: Uuid, + success: bool, + /// Path to the worktree directory + #[serde(rename = "worktreePath")] + worktree_path: Option, + /// Whether the worktree exists + exists: bool, + /// Number of files changed + #[serde(rename = "filesChanged")] + files_changed: i32, + /// Total lines inserted + insertions: i32, + /// Total lines deleted + deletions: i32, + /// Changed files list + files: Option, + /// Current branch name + branch: Option, + /// Current HEAD commit SHA + #[serde(rename = "headSha")] + head_sha: Option, + /// Error message if failed + error: Option, + }, } /// Validated daemon authentication result. @@ -1880,6 +1907,46 @@ async fn handle_daemon_connection(socket: WebSocket, state: SharedState, auth_re }); } } + Ok(DaemonMessage::WorktreeInfoResult { + task_id, + success, + worktree_path, + exists, + files_changed, + insertions, + deletions, + files, + branch, + head_sha, + error, + }) => { + tracing::debug!( + task_id = %task_id, + success = success, + exists = exists, + files_changed = files_changed, + "Worktree info result received" + ); + + // Fulfill pending worktree info request if any + if let Some((_, tx)) = state.pending_worktree_info.remove(&task_id) { + let response = crate::server::state::WorktreeInfoResponse { + task_id, + success, + worktree_path, + exists, + files_changed, + insertions, + deletions, + files, + branch, + head_sha, + error, + }; + // Ignore send error - receiver may have timed out + let _ = tx.send(response); + } + } Err(e) => { tracing::warn!("Failed to parse daemon message: {}", e); } -- cgit v1.2.3