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