ATP CLI - AT Protocol Command Line Interface

May 26, 2025 ยท View on GitHub

๐ŸŒ AT Protocol Core Implementation ๐ŸŒ

A command-line interface for the AT Protocol, focusing on the core com.atproto.* namespace with additional Bluesky social features.

License: MIT Rust Tests

๐Ÿš€ Features

ATP CLI provides comprehensive access to the AT Protocol with primary focus on core protocol operations:

Core AT Protocol (com.atproto.*)

  • ๐Ÿ” Authentication & Session Management - Full session lifecycle support
  • ๐Ÿ‘ค Identity Resolution - Handle and DID resolution and management
  • ๐Ÿ“ฆ Repository Operations - Complete CRUD operations for AT Protocol records
  • ๐Ÿ”„ Synchronization - Repository sync and blob management
  • ๐Ÿ–ฅ๏ธ Server Management - Server capabilities and session management

Additional Features

  • ๐ŸŽฏ Bluesky Integration - Native support for Bluesky social features (app.bsky.*)

๐Ÿ“ฆ Installation

From Source

git clone https://github.com/yourusername/atp
cd atp
cargo build --release

Using Cargo

cargo install atp

๐Ÿ› ๏ธ Usage

Authentication

# Login with your credentials
atp auth login --identifier your.handle --password your-app-password

# Check current session
atp auth session

Core AT Protocol Operations

Identity Management

# Resolve handle to DID
atp atproto identity resolve-handle --handle alice.bsky.social

# Resolve DID to DID document
atp atproto identity resolve-did --did did:plc:example123

# Update your handle
atp atproto identity update-handle --handle new.handle.com

Repository Operations

# Create a new record
atp atproto repo create-record \
  --repo did:plc:example \
  --collection app.bsky.feed.post \
  --record '{"text": "Hello AT Protocol!", "createdAt": "2024-01-01T00:00:00Z"}'

# Get a specific record
atp atproto repo get-record \
  --repo did:plc:example \
  --collection app.bsky.feed.post \
  --rkey 3k2a4b5c6d7e8f9g

# List records in a collection
atp atproto repo list-records \
  --repo did:plc:example \
  --collection app.bsky.feed.post \
  --limit 50

# Delete a record
atp atproto repo delete-record \
  --repo did:plc:example \
  --collection app.bsky.feed.post \
  --rkey 3k2a4b5c6d7e8f9g

# Upload a blob
atp atproto repo upload-blob --file image.jpg

# Describe a repository
atp atproto repo describe-repo --repo did:plc:example

Server Operations

# Create a session (alternative to auth login)
atp atproto server create-session \
  --identifier your.handle \
  --password your-password

# Get current session info
atp atproto server get-session

# Refresh session tokens
atp atproto server refresh-session

# Delete session (logout)
atp atproto server delete-session

# Get server capabilities
atp atproto server describe-server

Synchronization Operations

# Get a blob
atp atproto sync get-blob --did did:plc:example --cid bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi

# Get repository head
atp atproto sync get-head --did did:plc:example

# Get latest commit
atp atproto sync get-latest-commit --did did:plc:example

# Get repository status
atp atproto sync get-repo-status --did did:plc:example

# List repositories
atp atproto sync list-repos --limit 100

Bluesky Social Features

# View a user's profile
atp bsky actor profile --actor alice.bsky.social

# Get multiple profiles
atp bsky actor profiles --actors alice.bsky.social,bob.bsky.social

# Search for users
atp bsky actor search --query "rust developer" --limit 25

# Get user suggestions
atp bsky actor suggestions --limit 50

# Get user preferences
atp bsky actor preferences

๐Ÿ“Š AT Protocol Core Support (com.atproto.*)

Current Implementation Status

NamespaceCommandsCoverageStatus
com.atproto.identity3/9๐ŸŸก 33%Core identity operations
com.atproto.repo6/12๐ŸŸก 50%Repository management
com.atproto.server5/25๐Ÿ”ด 20%Server operations
com.atproto.sync5/17๐Ÿ”ด 29%Synchronization
com.atproto.admin0/15๐Ÿ”ด 0%Administrative functions
com.atproto.label0/3๐Ÿ”ด 0%Content labeling
com.atproto.moderation0/3๐Ÿ”ด 0%Moderation tools
com.atproto.temp0/4๐Ÿ”ด 0%Temporary operations

Detailed Feature Matrix

โœ… Implemented Features (Click to expand)

Identity Management (com.atproto.identity)

  • โœ… resolveHandle - Resolve handle to DID
  • โœ… resolveDid - Resolve DID to DID document
  • โœ… updateHandle - Update account handle

Repository Operations (com.atproto.repo)

  • โœ… createRecord - Create new record
  • โœ… getRecord - Get specific record
  • โœ… listRecords - List records in collection
  • โœ… deleteRecord - Delete record
  • โœ… uploadBlob - Upload blob
  • โœ… describeRepo - Get repository metadata

Server Management (com.atproto.server)

  • โœ… createSession - Login/create session
  • โœ… getSession - Get current session info
  • โœ… refreshSession - Refresh tokens
  • โœ… deleteSession - Logout
  • โœ… describeServer - Get server capabilities

Synchronization (com.atproto.sync)

  • โœ… getBlob - Get blob data
  • โœ… getHead - Get repository head
  • โœ… getLatestCommit - Get latest commit
  • โœ… getRepoStatus - Get repository status
  • โœ… listRepos - List repositories
๐Ÿšง Planned Core Features (Click to expand)

High Priority

  • โŒ com.atproto.repo.applyWrites - Batch repository operations
  • โŒ com.atproto.repo.putRecord - Update existing records
  • โŒ com.atproto.server.createAccount - Account creation
  • โŒ com.atproto.identity.getRecommendedDidCredentials - DID credential management
  • โŒ com.atproto.moderation.createReport - Content reporting

Medium Priority

  • โŒ com.atproto.label.queryLabels - Query content labels
  • โŒ com.atproto.sync.subscribeRepos - Subscribe to repository events
  • โŒ com.atproto.server.createAppPassword - App password management
  • โŒ com.atproto.identity.signPlcOperation - PLC operations
  • โŒ com.atproto.repo.importRepo - Repository import/export

Low Priority

  • โŒ com.atproto.admin.* - Administrative operations (15 commands)
  • โŒ com.atproto.temp.* - Temporary/experimental features (4 commands)

Overall Progress

CategoryImplementedTotalCoverage
Core AT Protocol1966๐ŸŸก 29%
Bluesky Features595+๐Ÿ”ด 5%
Total24161+๐Ÿ”ด 15%

๐Ÿงช Testing

ATP CLI has comprehensive test coverage with 93 passing integration tests covering:

  • โœ… All command-line argument validation
  • โœ… Authentication and authorization flows
  • โœ… Error handling and edge cases
  • โœ… Parameter validation and boundary testing
  • โœ… JSON validation and parsing
  • โœ… Help system consistency
  • โœ… Unicode and special character handling
# Run all tests
cargo test

# Run only integration tests
cargo test --test integration_tests

# Run with verbose output
cargo test -- --nocapture

๐Ÿ”ง Configuration

ATP CLI stores configuration and session data in your system's local config directory:

  • Linux: ~/.config/atp/config.toml
  • macOS: ~/Library/Application Support/atp/config.toml
  • Windows: %APPDATA%\atp\config.toml

Configuration Format

[session]
did = "did:plc:example123"
handle = "alice.bsky.social"
email = "alice@example.com"
accessJwt = "..."
refreshJwt = "..."

๐Ÿ—๏ธ Architecture

ATP CLI is built with:

  • ๐Ÿฆ€ Rust 2024 Edition - Modern, safe systems programming
  • โšก Tokio - Async runtime for high-performance networking
  • ๐Ÿ”ง Clap - Powerful command-line argument parsing
  • ๐ŸŒ Reqwest - HTTP client with JSON support
  • ๐Ÿ“ Serde - Serialization/deserialization
  • โœ… TDD Approach - Test-driven development with comprehensive coverage

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Priority Areas for Contribution

  1. Core AT Protocol Features - Complete the com.atproto.* namespace implementation
  2. Batch Operations - Implement applyWrites and bulk operations
  3. Identity Management - Complete DID and handle operations
  4. Event Streaming - Add support for real-time subscriptions
  5. Documentation - Improve examples and API documentation

Development Setup

git clone https://github.com/yourusername/atp
cd atp
cargo build
cargo test

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built on the AT Protocol specification
  • Compatible with Bluesky and other AT Protocol servers
  • Inspired by the vision of a decentralized social web
  • Thanks to all contributors and testers

๐Ÿ”— Resources

AT Protocol Documentation

API References


AT Protocol โ€ข Issues โ€ข Discussions

Made with โค๏ธ for the decentralized social web