Skip to main content

Mountain/Command/SourceControlManagement/
ExecuteSCMCommand.rs

1#![allow(non_snake_case)]
2
3//! Tauri command - dispatch SCM operations (commit / push / pull).
4//!
5//! TODO: route through the `SourceControlManagementProvider` trait
6//! instead of the inline match. Real provider invocation gives us
7//! progress reporting, cancellation, and proper error surfacing.
8//! Current shape returns mocked success.
9
10use std::sync::Arc;
11
12use serde_json::{Value, json};
13use tauri::{State, command};
14
15use crate::{ApplicationState::State::ApplicationState::ApplicationState, dev_log};
16
17#[command]
18pub async fn ExecuteSCMCommand(
19	_State:State<'_, Arc<ApplicationState>>,
20	CommandName:String,
21	_Arguments:Value,
22) -> Result<Value, String> {
23	dev_log!("commands", "executing command: {}", CommandName);
24
25	match CommandName.as_str() {
26		"git.commit" | "commit" => {
27			dev_log!("commands", "executing commit");
28			Ok(json!({ "success": true, "message": "Commit successful" }))
29		},
30		"git.push" | "push" => {
31			dev_log!("commands", "executing push");
32			Ok(json!({ "success": true, "message": "Push successful" }))
33		},
34		"git.pull" | "pull" => {
35			dev_log!("commands", "executing pull");
36			Ok(json!({ "success": true, "message": "Pull successful" }))
37		},
38		_ => Err(format!("Unknown SCM command: {}", CommandName)),
39	}
40}