Initial commit: Triple-C app, container, and CI
Tauri v2 desktop app (React/TypeScript + Rust) for managing containerized Claude Code environments. Includes Gitea Actions workflow for building and pushing the sandbox container image, and a BUILDING.md guide for manual app builds on Linux and Windows. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
54
app/src-tauri/src/commands/docker_commands.rs
Normal file
54
app/src-tauri/src/commands/docker_commands.rs
Normal file
@@ -0,0 +1,54 @@
|
||||
use tauri::State;
|
||||
|
||||
use crate::docker;
|
||||
use crate::models::ContainerInfo;
|
||||
use crate::AppState;
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn check_docker() -> Result<bool, String> {
|
||||
docker::check_docker_available().await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn check_image_exists() -> Result<bool, String> {
|
||||
docker::image_exists().await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn build_image(app_handle: tauri::AppHandle) -> Result<(), String> {
|
||||
use tauri::Emitter;
|
||||
docker::build_image(move |msg| {
|
||||
let _ = app_handle.emit("image-build-progress", msg);
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_container_info(
|
||||
project_id: String,
|
||||
state: State<'_, AppState>,
|
||||
) -> Result<Option<ContainerInfo>, String> {
|
||||
let project = state
|
||||
.projects_store
|
||||
.get(&project_id)
|
||||
.ok_or_else(|| format!("Project {} not found", project_id))?;
|
||||
docker::get_container_info(&project).await
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn list_sibling_containers() -> Result<Vec<serde_json::Value>, String> {
|
||||
let containers = docker::list_sibling_containers().await?;
|
||||
let result: Vec<serde_json::Value> = containers
|
||||
.into_iter()
|
||||
.map(|c| {
|
||||
serde_json::json!({
|
||||
"id": c.id,
|
||||
"names": c.names,
|
||||
"image": c.image,
|
||||
"state": c.state,
|
||||
"status": c.status,
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
Ok(result)
|
||||
}
|
||||
Reference in New Issue
Block a user