Expand description
xurl — fast Rust client for the X (Twitter) API.
Ships two consumable surfaces:
- The
xrbinary, a high-level CLI for the X API. - The
xurllibrary exposed via the modules below. Downstream Rust consumers build requests viaapi::ApiClient, drive output throughoutput::OutputConfig, pattern-match onerror::XurlError, and persist auth state instore::TokenStore.
Four authentication paths are supported, selected per request from the token store and environment:
- OAuth2 PKCE (browser-driven or headless copy-paste) — every v2 user-scoped endpoint.
- OAuth1 HMAC-SHA1 — legacy v1.1 endpoints and some v2 write paths.
- Bearer (app-only) — v2 read-only endpoints and search; set via
XURL_BEARER_TOKEN.
Modules§
- api
- X API client — request building, response handling, shortcuts, and media.
- auth
- Authentication orchestration —
OAuth2PKCE,OAuth1HMAC-SHA1, Bearer. - cli
- CLI definition — clap derive with subcommands.
- config
- Application configuration resolved from environment variables.
- envelope
- Canonical agent-native JSON envelope shape.
- error
- Typed error system matching xurl’s error categories.
- output
- Output formatting helpers for
--output,--quiet,--color, andNO_COLORsupport. - skill_
install xr skill install <host>— clone the xurl-rs skill bundle into a host’s canonical skills directory using a build-generated host map and a hardenedgit cloneinvocation.- store
- Token persistence layer — multi-app YAML store at
~/.xurl.
Constants§
- API_
SPEC_ DATE - Date (UTC,
YYYY-MM-DD) the vendored OpenAPI spec was last refreshed byscripts/refresh-x-openapi.sh, read fromvendor/spec-metadata.json. - API_
SPEC_ SHA256 - SHA-256 of
vendor/x-api-openapi.jsonat the time of its most recent vendoring, read fromvendor/spec-metadata.json. Drift-sensitive identifier — changes every time X changes spec content, regardless ofAPI_SPEC_VERSION. - API_
SPEC_ VERSION - X API OpenAPI spec version (
info.versionfield) of the vendoredvendor/x-api-openapi.jsonat build time, read from thevendor/spec-metadata.jsonsidecar. X bumps spec content without bumping this field; pair withAPI_SPEC_SHA256when drift detection matters. - CRATE_
GIT_ SHA - Git commit SHA the crate was built from.
Nonewhen the build had no git context (e.g.,cargo installfrom a crates.io tarball, where.gitis not present). - CRATE_
VERSION - Version of this crate, from
[package].versioninCargo.toml.