wme-cli
A command-line interface (CLI) tool for interacting with the Wikimedia Enterprise API.
Features
- Authentication: Login, token refresh, password management
- Metadata: Browse project codes, languages, projects, and namespaces
- Articles: Fetch articles and structured article data
- Snapshots: List, inspect, and download snapshots and chunks
- Realtime: Stream live updates and manage batches
- Multiple Output Formats: JSON, NDJSON, and ASCII tables
Installation
From Source
The binary will be available at target/release/wme-cli.
Configuration
The CLI stores configuration and tokens in ~/.wme/config.json.
You can also specify a custom config path with --config or the WME_CONFIG environment variable.
Authentication
Before using the API, you need to authenticate:
# Interactive login (will prompt for credentials)
# Or provide credentials via flags
# Or via environment variables
Token Management
# Refresh your access token
# Revoke and clear tokens
# Change password
Usage Examples
Global Options
All commands support these global flags:
Metadata Commands
# List all project codes
# Get specific project code info
# List all languages
# Get specific language info
# List all projects
# Get specific project info
# List all namespaces
# Get specific namespace info
Article Commands
# Get a single article
# Get with specific fields
# Get structured article data (BETA)
Snapshot Commands
# List available snapshots
# Get snapshot metadata
# Download a snapshot (chunked, with automatic resume support)
# Download a specific byte range (no resume support)
# Resume interrupted download (automatic - just rerun the same command)
# List chunks for a snapshot
# Get chunk metadata
# Download a chunk
# List structured snapshots (BETA)
# Get structured snapshot metadata
# Download structured snapshot
Download Resume Feature
When downloading large snapshots in chunked mode, the CLI automatically supports resuming interrupted downloads:
- How it works: A
.progressfile is created next to the output file tracking completed chunks - On interruption: Simply re-run the same download command - completed chunks are skipped
- On completion: The
.progressfile is automatically deleted - Range downloads: The
--rangeflag disables chunked mode and resume support (single HTTP request)
Example workflow:
# Start download (might timeout after chunk 45 of 94)
# Output: Chunk 45/94 | 2.3 GB written | enwiki_chunk_45 ...
# Resume (continues from chunk 46)
# Output: Resuming download: enwiki_namespace_0 (45 chunks already done)
# Output: Skipping 45/94 already-completed chunks
# Output: Chunk 46/94 | 2.3 GB written | enwiki_chunk_46 ...
Realtime Commands
# Connect to realtime stream
# Stream with specific partitions
# Resume from timestamp
# List batches for a date/hour
# Get batch metadata
# Download a batch
Output Formats
JSON (default)
Pretty-printed JSON output:
NDJSON
Newline-delimited JSON for streaming processing:
Table
ASCII table format (useful for list commands):
Quiet
Suppress all output except errors:
Filtering and Field Selection
# Filter results
# Select specific fields
# Limit results
Environment Variables
| Variable | Description |
|---|---|
WME_TOKEN |
Bearer access token |
WME_USERNAME |
API username |
WME_PASSWORD |
API password |
WME_CONFIG |
Path to config file |
Shell Completion
Generate shell completion scripts:
# Bash
# Zsh
# Fish
Development
Running Tests
Code Quality
# Format code
# Run linter
# Run doctests
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.