diff --git a/apps/differ/src-tauri/src/lib.rs b/apps/differ/src-tauri/src/lib.rs index 3b317719c..20b828664 100644 --- a/apps/differ/src-tauri/src/lib.rs +++ b/apps/differ/src-tauri/src/lib.rs @@ -300,8 +300,8 @@ fn list_directory(path: String) -> Result, String> { } } - dirs.sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase())); - files.sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase())); + dirs.sort_by_key(|a| a.name.to_lowercase()); + files.sort_by_key(|a| a.name.to_lowercase()); dirs.extend(files); Ok(dirs) } diff --git a/apps/staged/src-tauri/src/blox.rs b/apps/staged/src-tauri/src/blox.rs index d2d2a0ceb..e1af64645 100644 --- a/apps/staged/src-tauri/src/blox.rs +++ b/apps/staged/src-tauri/src/blox.rs @@ -3,11 +3,18 @@ //! Thin wrappers around shared `blox-cli` helpers so existing Staged code can //! keep using `crate::blox::*`. +use std::sync::OnceLock; + pub use blox_cli::{BloxError, WorkspaceCommand, WorkspaceInfo, WorkspaceListEntry}; +static SQ_AVAILABLE: OnceLock = OnceLock::new(); + /// Check whether the `sq` CLI is available on this system. +/// +/// The result is cached for the lifetime of the process since the PATH +/// won't change mid-session. pub fn is_sq_available() -> bool { - blox_cli::is_sq_available() + *SQ_AVAILABLE.get_or_init(blox_cli::is_sq_available) } /// Start a new Blox workspace. diff --git a/apps/staged/src-tauri/src/session_runner.rs b/apps/staged/src-tauri/src/session_runner.rs index 8ac6e68f6..af8704d37 100644 --- a/apps/staged/src-tauri/src/session_runner.rs +++ b/apps/staged/src-tauri/src/session_runner.rs @@ -429,7 +429,23 @@ pub fn start_session( log::info!("Drained next queued session for branch {branch_id}"); } Ok(false) => { - if let Some(auto_review_branch_id) = auto_review_branch_id { + // Check if auto-review is enabled in user preferences + let auto_review_enabled = crate::preferences_store_path_buf() + .and_then(|path| std::fs::read_to_string(&path).ok()) + .and_then(|contents| { + serde_json::from_str::(&contents).ok() + }) + .and_then(|json| { + json.get("auto-start-code-reviews")? + .as_str() + .map(String::from) + }) + .map(|mode| mode != "never") + .unwrap_or_else(crate::blox::is_sq_available); + + if let Some(auto_review_branch_id) = + auto_review_branch_id.filter(|_| auto_review_enabled) + { match crate::session_commands::trigger_auto_review( store_for_follow_up, registry_for_follow_up, diff --git a/apps/staged/src/lib/features/diff/highlighter.ts b/apps/staged/src/lib/features/diff/highlighter.ts index 15af20077..76333ffb9 100644 --- a/apps/staged/src/lib/features/diff/highlighter.ts +++ b/apps/staged/src/lib/features/diff/highlighter.ts @@ -9,8 +9,10 @@ export { getSyntaxThemeName, setSyntaxTheme, isLightTheme, + loadAllThemePreviewColors, SYNTAX_THEMES, type Token, type HighlighterTheme, + type ThemePreviewColors, type SyntaxThemeName, } from '@builderbot/diff-viewer/utils'; diff --git a/apps/staged/src/lib/features/layout/TopBar.svelte b/apps/staged/src/lib/features/layout/TopBar.svelte index e9d857d3c..76f71a474 100644 --- a/apps/staged/src/lib/features/layout/TopBar.svelte +++ b/apps/staged/src/lib/features/layout/TopBar.svelte @@ -1,14 +1,13 @@ + +
+
+
+

+ + General +

+

Appearance and app behaviour.

+
+
+ +
+
+ Theme +
+ + + {#if dropdownOpen} +
+
+ {#each ['all', 'light', 'dark'] as filter (filter)} + + {/each} +
+ {#each themes as theme (theme.name)} + {@const colors = previewColors.get(theme.name)} + {@const isActive = preferences.syntaxTheme === theme.name} + + {/each} +
+ {/if} +
+
+ +
+ + +

+ + {#if preferences.autoReviewMode === 'after-changes'} + A code review will automatically start after each commit session completes. + {:else} + Code reviews will only start when you manually request them. + {/if} +

+
+
+
+ + diff --git a/apps/staged/src/lib/features/settings/SettingsPage.svelte b/apps/staged/src/lib/features/settings/SettingsPage.svelte index c6e447ea1..a0daf2840 100644 --- a/apps/staged/src/lib/features/settings/SettingsPage.svelte +++ b/apps/staged/src/lib/features/settings/SettingsPage.svelte @@ -1,9 +1,10 @@