Skip to main content

Open-source CLI for composing and publishing X posts

Project description

xcli

xcli is a command line tool for interacting with the X API.

It is designed for local-first usage, safe publishing defaults, and open-source packaging.

Install

Install from PyPI:

pip install xcli-v2

Quickstart

  1. Set OAuth app credentials:
export TWITTER_CLIENT_ID="..."
export TWITTER_CLIENT_SECRET="..."
  1. Run login flow:
xcli auth login
  1. Draft content:
xcli compose "shipping small daily"
  1. Post from terminal text (default):
xcli post "shipping small daily"
  1. Preview without posting:
xcli post "shipping small daily" --dry-run
  1. Post from file:
xcli post --file draft.txt
  1. Attach media (repeat --media up to 4 files):
xcli post "launch day" --media image1.png --media image2.jpg

Currently supported media types are image uploads accepted by the X media upload endpoint (jpeg, png, webp, bmp, tiff). Media upload requires OAuth scope media.write; if you logged in before this was added, run xcli auth login again to refresh token scopes.

Commands

  • xcli auth login
  • xcli auth whoami
  • xcli auth status
  • xcli auth logout
  • xcli compose
  • xcli post
  • xcli reply --to <tweet_id>
  • xcli quote --to <tweet_id>
  • xcli posts mine
  • xcli posts get --id <tweet_id>
  • xcli timeline --user <handle>

Safety model

  • Posting commands send by default (with confirmation prompt).
  • Use --dry-run to preview payload without posting.
  • Non-interactive workflows can use --yes.
  • Machine output is available with --json.

Auth storage

Default token path uses platform config directories:

  • macOS: ~/Library/Application Support/xcli/auth.json
  • Linux: ~/.config/xcli/auth.json
  • Windows: %APPDATA%\\xcli\\auth.json

Legacy compatibility fallback is supported for ~/.twitter/auth.json.

Development

pip install -e .[dev]
pytest
ruff check
mypy src

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xcli_v2-0.1.0.tar.gz (56.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xcli_v2-0.1.0-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

Details for the file xcli_v2-0.1.0.tar.gz.

File metadata

  • Download URL: xcli_v2-0.1.0.tar.gz
  • Upload date:
  • Size: 56.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for xcli_v2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 15e0aa596161fc6cfe938b450322e291237a868b32e67263d515bb40c987e72c
MD5 5a7b0c9a02b2e02c2445f75e13318cf6
BLAKE2b-256 7c26b5bbe64b32ed2284da5b791688d5d138e8685a1dc208536c21932d1af53c

See more details on using hashes here.

File details

Details for the file xcli_v2-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xcli_v2-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.3

File hashes

Hashes for xcli_v2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 93d2601a340e2c99f4c6f085b868ec4401c63fe50339b33366fe9781ef3d6802
MD5 6e71ceaf44a64d74e937c10349042f04
BLAKE2b-256 b70062a7d9671e4d2d8e8e11e05d4b69653b307ea8332fa14d991531b4545906

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page