claude_code_switcher/
lib.rs1pub mod cli;
7pub mod commands;
8pub mod confirm_selector;
9pub mod credentials;
10pub mod settings;
11pub mod simple_selector;
12pub mod snapshots;
13pub mod templates;
14pub mod utils;
15
16pub use cli::{Cli, Commands, CredentialCommands};
18pub use commands::run_command;
19pub use credentials::{
20 CredentialStore, SavedCredential, SavedCredentialStore, get_api_key_interactively,
21};
22pub use settings::{
23 ClaudeSettings, Hooks, Permissions, StatusLine, format_settings_for_display, merge_settings,
24};
25pub use snapshots::{Snapshot, SnapshotScope, SnapshotStore};
26pub use templates::{TemplateType, get_all_templates, get_template, get_template_type};
27pub use utils::{get_credentials_dir, get_snapshots_dir};
28
29pub trait Configurable: Sized {
31 fn merge_with(self, other: Self) -> Self;
33
34 fn filter_by_scope(self, scope: &SnapshotScope) -> Self;
36
37 fn mask_sensitive_data(self) -> Self;
39}
40
41pub trait Storage<T>: Send + Sync {
42 fn load(&self) -> anyhow::Result<T>;
44
45 fn save(&self, data: &T) -> anyhow::Result<()>;
47
48 fn path(&self) -> std::path::PathBuf;
50}
51
52pub trait CredentialManager: Send + Sync {
53 fn save_credential(
55 &self,
56 name: String,
57 api_key: &str,
58 template_type: TemplateType,
59 ) -> anyhow::Result<()>;
60
61 fn load_credentials(&self) -> anyhow::Result<Vec<SavedCredential>>;
63
64 fn delete_credential(&self, id: &str) -> anyhow::Result<()>;
66
67 fn clear_credentials(&self) -> anyhow::Result<()>;
69}