#lichess #pgn #chess #authentication #broadcast

app lictl

A command line interface for scripting Lichess

2 releases

Uses new Rust 2024

new 0.1.1 Apr 19, 2025
0.1.0 Apr 19, 2025

#142 in Game dev

AGPL-3.0-only

18KB
321 lines

lictl - Lichess CLI Tool

A command-line interface for interacting with Lichess.org's API to make it easy to script your way around Lichess.

Installation

# Clone the repository
git clone https://github.com/yourusername/lictl.git
cd lictl

# Build and install
cargo install --path crates/lictl

Authentication

Before using commands that require authentication, you'll need to log in with a Lichess API token:

# Store your token securely
lictl login

# Verify your authentication
lictl whoami

# Remove stored token
lictl logout

You can generate a personal access token at: https://lichess.org/account/oauth/token

Commands

Broadcasts

# Get broadcast details by ID
lictl broadcasts get --by-id <broadcast-id>

# Get broadcast details by round ID
lictl broadcasts get --by-round <round-id>

# Export broadcast PGN
lictl broadcasts export <broadcast-id>

Broadcast Rounds

# Get broadcast round details
lictl broadcast-rounds get <round-id>

Studies

# Import PGN into a study
lictl studies import <study-id> "<pgn-content>"

Generic API Requests

# Make GET requests to any Lichess API endpoint
lictl req get /account
lictl req get /broadcast page=2 nb=10

Scripts

The project includes helpful scripts in the scripts/ directory:

copy-broadcast-to-study.sh

Copies a broadcast's games into a study:

./scripts/copy-broadcast-to-study.sh <round-id> <study-id>

Development

# Run tests
cargo test

# Build in debug mode
cargo build

# Build in release mode
cargo build --release

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

Dependencies

~10–21MB
~284K SLoC