Skip to main content

Module startup

Module startup 

Source
Expand description

Startup types and helpers for Tuitbot CLI commands.

Provides API tier detection types, OAuth token management, PKCE authentication helpers, startup banner formatting, and diagnostic check types used by the run, auth, and test CLI commands.

Structs§

PkceChallenge
PKCE code verifier and challenge pair.
StoredTokens
OAuth tokens persisted to disk at ~/.tuitbot/tokens.json.
TierCapabilities
Capabilities enabled by the current API tier.

Enums§

ApiTier
Detected X API tier.
StartupError
Errors that can occur during startup operations.

Constants§

X_AUTH_URL
X API OAuth 2.0 authorization endpoint.
X_TOKEN_URL
X API OAuth 2.0 token endpoint.
X_USERS_ME_URL
X API users/me endpoint for credential verification.

Functions§

build_auth_url
Build the X API OAuth 2.0 authorization URL.
build_redirect_uri
Build the redirect URI from config auth settings.
data_dir
Default directory for Tuitbot data files (~/.tuitbot/).
exchange_auth_code
Exchange an authorization code for OAuth tokens.
expand_tilde
Expand ~ at the start of a path to the user’s home directory.
extract_auth_code
Extract the authorization code from a callback URL or raw code string.
format_startup_banner
Format the startup banner printed when the agent starts.
generate_pkce
Generate a PKCE code verifier, challenge, and state parameter.
load_tokens_from_file
Load OAuth tokens from the default file path.
save_tokens_to_file
Save OAuth tokens to the default file path with secure permissions.
token_file_path
Path to the token storage file (~/.tuitbot/tokens.json).
verify_credentials
Verify OAuth credentials by calling the X API /2/users/me endpoint.