1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! Claude Code account credential management.
//!
//! Manages multiple Claude Code credential sets stored under `.persistent/claude/credential/`
//! for account rotation when usage limits are reached.
//!
//! # Modules
//!
//! - [`paths`]: [`ClaudePaths`] — all `~/.claude/` canonical paths from `HOME`
//! - [`account`]: Named credential storage and rotation
//! - [`token`]: OAuth token expiry status detection
//! - [`persist`]: [`PersistPaths`] — persistent user storage path from `$PRO`/`$HOME` (FR-15)
//! - [`registry`]: Command registration helpers (feature `enabled`)
//! - [`output`]: Output formatting, `parse_int_flag`, JWT utilities (feature `enabled`)
//!
//! # Account Management Examples
//!
//! ## Check Token Status
//!
//! ```no_run
//! use claude_profile::token;
//!
//! match token::status().expect( "failed to read credentials" )
//! {
//! token::TokenStatus::Valid { expires_in } =>
//! println!( "ok — {}m remaining", expires_in.as_secs() / 60 ),
//! token::TokenStatus::ExpiringSoon { expires_in } =>
//! eprintln!( "expires in {}m", expires_in.as_secs() / 60 ),
//! token::TokenStatus::Expired =>
//! eprintln!( "token expired — run: claude auth login" ),
//! }
//! ```
//!
//! ## Inspect and Switch Manually
//!
//! ```no_run
//! use claude_profile::{ account, ClaudePaths, PersistPaths };
//!
//! let persist = PersistPaths::new().expect( "PRO or HOME must be set" );
//! let credential_store = persist.credential_store();
//! let paths = ClaudePaths::new().expect( "HOME must be set" );
//!
//! // See what's available
//! for acct in account::list( &credential_store ).expect( "list failed" )
//! {
//! let active = if acct.is_active { " ← active" } else { "" };
//! println!( "{}{} ({})", acct.name, active, acct.subscription_type );
//! }
//!
//! // Switch to a specific account
//! account::switch_account( "alice@home.com", &credential_store, &paths ).expect( "switch failed" );
//! ```
/// Path to the YAML command definitions for this crate.
///
/// Used by `assistant/build.rs` for metadata-only export. Profile commands
/// are registered programmatically via [`register_commands()`], not via YAML aggregation.
pub const COMMANDS_YAML : &str = concat!;
pub use ClaudePaths;
pub use PersistPaths;
pub use register_commands;
/// Run the `clp`/`claude_profile` CLI.
///
/// Entry point shared by the `clp` and `claude_profile` binary targets.