claudewheel v0.20.1 /claudewheel.cli
Edit
On this page

CLI argument parsing, subcommand routing, and launch orchestration for the claudewheel command-line interface.

#claudewheel.cli

#claudewheel.cli

CLI argument parsing, subcommand routing, and launch orchestration.

#_do_uninstall

python
def _do_uninstall(version: str) -> int

Delete an installed Claude Code version binary.

Refuses to delete the version the claude symlink currently points to, since that would break the default claude command. Returns a process exit code.

#_do_reset_options

python
def _do_reset_options() -> int

Delete OPTIONS_FILE so it regenerates from defaults on next run.

Does NOT instantiate ConfigManager -- the next normal run will recreate options.json via _ensure_dir. Idempotent: missing file is not an error.

#_do_show

python
def _do_show(cfg: object) -> int

Print a git-status-like summary of last_config, segments, theme, and recent dirs.

#_write_tier_stub

python
def _write_tier_stub(profile: str | None, config_dir: str | None) -> None

Write a rateLimitTier stub into .credentials.json if tokens.json has tier data.

This lets downstream tools (e.g. howmuchleft) read the tier from .credentials.json even when auth is via CLAUDE_CODE_OAUTH_TOKEN. Short-circuits if .credentials.json already has the same tier value. Best-effort: silently skips on any error.

#_do_launch_sequence

python
def _do_launch_sequence(cfg: object, selections: dict, extra_flags: list[str] | None=None, interactive: bool=True, metadata: dict[str, dict[str, dict]] | None=None) -> None

Run health check, hooks, save state, resolve, and exec. Does not return on success.

#_handle_new_profile

python
def _handle_new_profile() -> int

Run the create-profile flow as one continuous alt-screen session.

Mirrors the TUI path: wizard form, auth forms, and summary page all render borrowed in a single alt-screen raw session on a CLI-owned terminal. After the session ends, the summary and auth outcome are printed to stdout as a persistent record.

#_handle_rename_profile

python
def _handle_rename_profile(old: str, new: str) -> int

Rename a profile: validate inputs, then delegate to core rename logic.

#_handle_check_tokens

python
def _handle_check_tokens() -> int

Validate stored tokens for all discovered profiles against the Anthropic API.

#_handle_fix_auth

python
def _handle_fix_auth(name: str) -> int

Remove session credentials that shadow a long-lived token.

#_check_resume_session

python
def _check_resume_session(session_id: str, directory: str) -> None

Intercept --resume to detect and offer to fix directory renames.

When a session exists under an old encoded path (because the project directory was renamed), this function detects the mismatch and offers to move all sessions to the new path via run_mv.

Returns normally when no interception is needed (session found under current directory, or sessions successfully moved). Calls sys.exit(1) when the session cannot be resumed from here.

#_check_cont_session

python
def _check_cont_session(directory: str) -> None

Intercept --cont to detect and offer to fix directory renames.

When the current directory has no sessions but an orphaned project directory exists under the same parent (original cwd no longer on disk), this function offers to move those sessions to the current directory via run_mv.

#_inject_launch

python
def _inject_launch(argv: list[str]) -> list[str]

Return argv with the "launch" subcommand injected when appropriate.

argv includes argv[0] (the program name). When no subcommand is given, or the leading token is neither a known subcommand nor an app-level flag, the "launch" subcommand is injected so the interactive TUI starts. App-level flags (see _APP_LEVEL_FLAGS) and known subcommands are left untouched.

#_build_app

python
def _build_app() -> App

Build the strictcli App with all subcommands registered.

#main

python
def main() -> None

CLI entry point that parses arguments and dispatches to subcommands or the TUI.