Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,840 changes: 1 addition & 1,839 deletions crates/diffcore-core/src/ast.rs → crates/diffcore-core/src/ast/mod.rs

Large diffs are not rendered by default.

1,837 changes: 1,837 additions & 0 deletions crates/diffcore-core/src/ast/tests.rs

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1,620 changes: 1,620 additions & 0 deletions crates/diffcore-core/src/entrypoint/tests.rs

Large diffs are not rendered by default.

1,433 changes: 1,433 additions & 0 deletions crates/diffcore-core/src/flow/mod.rs

Large diffs are not rendered by default.

1,433 changes: 0 additions & 1,433 deletions crates/diffcore-core/src/flow.rs → crates/diffcore-core/src/flow/tests.rs

Large diffs are not rendered by default.

4,341 changes: 0 additions & 4,341 deletions crates/diffcore-core/src/graph.rs

This file was deleted.

1,290 changes: 1,290 additions & 0 deletions crates/diffcore-core/src/graph/mod.rs

Large diffs are not rendered by default.

1,425 changes: 1,425 additions & 0 deletions crates/diffcore-core/src/graph/tests.rs

Large diffs are not rendered by default.

1,666 changes: 1,666 additions & 0 deletions crates/diffcore-core/src/graph/tests_ir.rs

Large diffs are not rendered by default.

818 changes: 818 additions & 0 deletions crates/diffcore-core/tests/e2e_csharp_php_ruby.rs

Large diffs are not rendered by default.

500 changes: 500 additions & 0 deletions crates/diffcore-core/tests/e2e_go_rust.rs

Large diffs are not rendered by default.

762 changes: 762 additions & 0 deletions crates/diffcore-core/tests/e2e_jvm.rs

Large diffs are not rendered by default.

496 changes: 496 additions & 0 deletions crates/diffcore-core/tests/e2e_nextjs_large.rs

Large diffs are not rendered by default.

3,025 changes: 0 additions & 3,025 deletions crates/diffcore-core/tests/e2e_pipeline.rs

Large diffs are not rendered by default.

536 changes: 536 additions & 0 deletions crates/diffcore-core/tests/e2e_systems.rs

Large diffs are not rendered by default.

4,517 changes: 0 additions & 4,517 deletions crates/diffcore-tauri/src/commands.rs

This file was deleted.

91 changes: 91 additions & 0 deletions crates/diffcore-tauri/src/commands/app_state.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
//! Application state persistence commands.

use std::path::PathBuf;

use diffcore_core::config::DiffcoreConfig;

use super::CommandError;

#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[allow(dead_code)]
struct AppStateSnapshotFile {
version: String,
saved_at_epoch_ms: u128,
snapshot: serde_json::Value,
}

#[allow(dead_code)]
fn app_logs_dir() -> Result<PathBuf, CommandError> {
if let Some(global_config) = DiffcoreConfig::global_config_path() {
let config_dir = global_config
.parent()
.ok_or_else(|| CommandError::Io("Failed to resolve config directory".to_string()))?;
return Ok(config_dir.join("logs"));
}

let home = std::env::var_os("HOME")
.ok_or_else(|| CommandError::Io("Cannot determine HOME for log directory".to_string()))?;
Ok(PathBuf::from(home).join(".diffcore").join("logs"))
}

#[allow(dead_code)]
fn app_state_snapshot_dir() -> Result<PathBuf, CommandError> {
Ok(app_logs_dir()?.join("app-state"))
}

#[tauri::command]
pub fn save_app_state(snapshot: serde_json::Value) -> Result<String, CommandError> {
// TODO: re-enable app state save/restore after UX and reliability pass.
let _ = snapshot;
Err(CommandError::Analysis(
"App state save/restore is temporarily disabled".to_string(),
))

// let dir = app_state_snapshot_dir()?;
// std::fs::create_dir_all(&dir)
// .map_err(|e| CommandError::Io(format!("Failed to create app-state dir: {}", e)))?;

// let now = std::time::SystemTime::now()
// .duration_since(std::time::UNIX_EPOCH)
// .map_err(|e| CommandError::Io(format!("System clock error: {}", e)))?;
// let saved_at_epoch_ms = now.as_millis();

// let payload = AppStateSnapshotFile {
// version: "1".to_string(),
// saved_at_epoch_ms,
// snapshot,
// };

// let latest_path = dir.join("latest.json");
// let archive_path = dir.join(format!("snapshot-{}.json", saved_at_epoch_ms));
// let json = serde_json::to_string_pretty(&payload)
// .map_err(|e| CommandError::Io(format!("Failed to serialize app state: {}", e)))?;

// std::fs::write(&latest_path, &json)
// .map_err(|e| CommandError::Io(format!("Failed to write latest app state: {}", e)))?;
// std::fs::write(&archive_path, json)
// .map_err(|e| CommandError::Io(format!("Failed to write archived app state: {}", e)))?;

// Ok(latest_path.to_string_lossy().to_string())
}

#[tauri::command]
pub fn load_last_app_state() -> Result<Option<serde_json::Value>, CommandError> {
// TODO: re-enable app state save/restore after UX and reliability pass.
Err(CommandError::Analysis(
"App state save/restore is temporarily disabled".to_string(),
))

// let latest_path = app_state_snapshot_dir()?.join("latest.json");
// if !latest_path.exists() {
// return Ok(None);
// }

// let raw = std::fs::read_to_string(&latest_path)
// .map_err(|e| CommandError::Io(format!("Failed to read latest app state: {}", e)))?;
// let payload: AppStateSnapshotFile = serde_json::from_str(&raw)
// .map_err(|e| CommandError::Io(format!("Failed to parse latest app state: {}", e)))?;

// Ok(Some(payload.snapshot))
}

Loading