claudewheel v0.24.2 /claudewheel.profile_info
Edit
On this page

Gather and format a detailed inspection report for a single profile.

#claudewheel.profile_info

#claudewheel.profile_info

Gather and format a detailed inspection report for a single profile.

#ProfileReport

Everything gather_profile_info() learns about one profile.

#_read_options_registration

python
def _read_options_registration(ws: 'Workspace', name: str) -> tuple[bool, bool]

Return (registered, pinned) for name from options.json.

#_read_token_state

python
def _read_token_state(ws: 'Workspace', name: str) -> tuple[bool, TokenExpiry | None, str | None, str | None]

Return (has_token, expiry, tier, subscription) for name from tokens.json.

A corrupt tokens.json raises :class:TokenStoreError (the hard-error contract): profile inspection is a CLI command, so token corruption is a workspace-integrity problem the operator must fix, never a silent skip.

#_count_active_sessions

python
def _count_active_sessions(config_dir: Path) -> tuple[int, int]

Return (live, live_interactive) session counts for config_dir.

A delegate to :mod:claudewheel.session_registry, the single reader of Claude Code's per-session registry: it parses sessions/<pid>.json and drops phantoms (a leftover file, or a PID the kernel has recycled). The two numbers are kept apart because they answer different questions -- the report shows how much is running, while the delete guard only refuses for a human's session.

#_disk_usage

python
def _disk_usage(config_dir: Path) -> int

Sum file sizes under config_dir, never following symlinks.

Uses os.walk(followlinks=False) so symlinked dirs (the shared-store links inside profile dirs) are not descended into, and skips symlinked files so only data truly owned by the profile dir is counted.

#_read_settings

python
def _read_settings(config_dir: Path) -> tuple[bool, dict[str, int], bool | None, int | None, bool | None]

Summarize settings.json; tolerate a missing/corrupt file and keys.

#detect_auth_shadow

python
def detect_auth_shadow(ws: 'Workspace', name: str) -> bool

Return True if profile has session credentials shadowing a long-lived token.

Conditions (all must be true):

  • A valid token entry exists in tokens.json for name
  • .credentials.json exists in the profile's config dir
  • .credentials.json contains a "claudeAiOauth" key

Lightweight check usable from both gather_profile_info and health checks.

#gather_profile_info

python
def gather_profile_info(ws: 'Workspace', name: str) -> ProfileReport

Assemble a full ProfileReport for name.

Never raises for unknown profiles: callers check report.exists / report.registered / report.has_token to decide how to present one.

#_format_size

python
def _format_size(size: int) -> str

Human-readable byte size (B / KB / MB / GB).

#format_report

python
def format_report(report: ProfileReport) -> list[str]

Render a ProfileReport as plain display lines (TUI page and CLI).

Search