Skip to content
Open
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
567 changes: 567 additions & 0 deletions src-tauri/src/cli/commands/check.rs

Large diffs are not rendered by default.

473 changes: 473 additions & 0 deletions src-tauri/src/cli/commands/memory.rs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src-tauri/src/cli/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
pub mod check;
pub mod config;
pub mod env;
pub mod mcp;
pub mod memory;
pub mod prompts;
pub mod provider;
pub mod provider_input;
Expand Down
58 changes: 58 additions & 0 deletions src-tauri/src/cli/commands/skills.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ pub enum SkillsCommand {
/// Skill directory or id
spec: String,
},
/// Enable all installed skills for the selected app
EnableAll,
/// Disable all skills for the selected app
DisableAll,
/// Sync enabled skills to app skills dirs
Sync,
/// Scan unmanaged skills in app skills dirs
Expand Down Expand Up @@ -88,6 +92,8 @@ pub fn execute(cmd: SkillsCommand, app: Option<AppType>) -> Result<(), AppError>
SkillsCommand::Uninstall { spec } => uninstall_skill(&spec),
SkillsCommand::Enable { spec } => toggle_skill(&app_type, &spec, true),
SkillsCommand::Disable { spec } => toggle_skill(&app_type, &spec, false),
SkillsCommand::EnableAll => enable_all(&app_type),
SkillsCommand::DisableAll => disable_all(&app_type),
SkillsCommand::Sync => sync_skills(app.as_ref()),
SkillsCommand::ScanUnmanaged => scan_unmanaged(),
SkillsCommand::ImportFromApps { directories } => import_from_apps(directories),
Expand Down Expand Up @@ -192,6 +198,58 @@ fn toggle_skill(app_type: &AppType, spec: &str, enabled: bool) -> Result<(), App
Ok(())
}

fn enable_all(app_type: &AppType) -> Result<(), AppError> {
let skills = SkillService::list_installed()?;
if skills.is_empty() {
println!("{}", info("No installed skills found."));
return Ok(());
}

let mut count = 0;
for skill in &skills {
if !skill.apps.is_enabled_for(app_type) {
SkillService::toggle_app(&skill.directory, app_type, true)?;
count += 1;
}
}

println!(
"{}",
success(&format!(
"✓ Enabled {} skill(s) for {}",
count,
app_type.as_str()
))
);
Ok(())
}

fn disable_all(app_type: &AppType) -> Result<(), AppError> {
let skills = SkillService::list_installed()?;
if skills.is_empty() {
println!("{}", info("No installed skills found."));
return Ok(());
}

let mut count = 0;
for skill in &skills {
if skill.apps.is_enabled_for(app_type) {
SkillService::toggle_app(&skill.directory, app_type, false)?;
count += 1;
}
}

println!(
"{}",
success(&format!(
"✓ Disabled {} skill(s) for {}",
count,
app_type.as_str()
))
);
Ok(())
}

fn sync_skills(app: Option<&AppType>) -> Result<(), AppError> {
SkillService::sync_all_enabled(app)?;
println!("{}", success("✓ Skills synced successfully"));
Expand Down
8 changes: 8 additions & 0 deletions src-tauri/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ pub enum Commands {
/// Update cc-switch binary to latest release
Update(commands::update::UpdateCommand),

/// Manage memory (observations, context, hooks)
#[command(subcommand)]
Memory(commands::memory::MemoryCommand),

/// Check for CLI tool updates (Claude Code, Codex, Gemini)
#[command(subcommand)]
Check(commands::check::CheckCommand),

/// Enter interactive mode
#[command(alias = "ui")]
Interactive,
Expand Down
4 changes: 2 additions & 2 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ pub use mcp::{
};
pub use provider::{Provider, ProviderMeta};
pub use services::{
ConfigService, EndpointLatency, McpService, PromptService, ProviderService, SkillService,
SpeedtestService, SyncDecision, WebDavSyncService, WebDavSyncSummary,
ConfigService, EndpointLatency, McpService, MemoryService, PromptService, ProviderService,
SkillService, SpeedtestService, SyncDecision, WebDavSyncService, WebDavSyncSummary,
};
pub use settings::{
get_skip_claude_onboarding, get_webdav_sync_settings, set_skip_claude_onboarding,
Expand Down
2 changes: 2 additions & 0 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ fn run(cli: Cli) -> Result<(), AppError> {
Some(Commands::Config(cmd)) => cc_switch_lib::cli::commands::config::execute(cmd, cli.app),
Some(Commands::Env(cmd)) => cc_switch_lib::cli::commands::env::execute(cmd, cli.app),
Some(Commands::Update(cmd)) => cc_switch_lib::cli::commands::update::execute(cmd),
Some(Commands::Memory(cmd)) => cc_switch_lib::cli::commands::memory::execute(cmd, cli.app),
Some(Commands::Check(cmd)) => cc_switch_lib::cli::commands::check::execute(cmd, cli.app),
Some(Commands::Completions { shell }) => {
cc_switch_lib::cli::generate_completions(shell);
Ok(())
Expand Down
Loading