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