Summary
Add a Kotlin/Native CLI tool (crosspaste) that allows users to interact with the locally running CrossPaste application from the terminal. The CLI communicates with the app via HTTP API using token-based authentication.
Features
CLI Commands
crosspaste status — Show app status (version, port, device count, paste count)
crosspaste paste [id] — View the most recent paste or a specific paste by ID
crosspaste history [--limit] [--type] [--favorite] — List recent paste history with filtering
crosspaste search <query> [--limit] [--type] — Full-text search paste history
crosspaste copy <text> — Copy text to clipboard via CrossPaste
crosspaste delete <id> — Delete a paste by ID
crosspaste fav <id> — Toggle favorite status
crosspaste devices — List paired devices with connection status
crosspaste config / crosspaste config set <key> <value> — View/update configuration
crosspaste tags / tags create <name> / tags delete <id> — Manage paste tags
crosspaste version — Show CLI and app versions
crosspaste --json <command> — JSON output mode for scripting/piping
crosspaste --generate-completion=(bash|zsh|fish) — Shell completion
Architecture
- Kotlin/Native binary — no JVM required at runtime
- Koin DI for dependency injection and testability
- Token-based auth — app generates a token file on startup, CLI reads it for Bearer auth
- Platform-aware paths — mirrors the desktop app's path resolution exactly (macOS, Linux, Windows)
- Custom storage path support — reads
appConfig.json to resolve non-default data directories
Tech Stack
- Clikt 5.1.0 for command parsing
- Ktor CIO Client for HTTP communication
- Koin 4.1.1 for dependency injection
- Okio for file system operations
App-Side Changes
- New
CliTokenManager — generates and validates CLI auth tokens
- New
CliRouting — HTTP routes under /cli/* with localhost + Bearer token auth
- New CLI DTOs —
StatusResponse, PasteSummaryDto, ManagementDto
- New error codes —
CLI_FORBIDDEN, CLI_NOT_FOUND, CLI_INVALID_REQUEST
- New SQLDelight query —
getActiveCount for paste statistics
Summary
Add a Kotlin/Native CLI tool (
crosspaste) that allows users to interact with the locally running CrossPaste application from the terminal. The CLI communicates with the app via HTTP API using token-based authentication.Features
CLI Commands
crosspaste status— Show app status (version, port, device count, paste count)crosspaste paste [id]— View the most recent paste or a specific paste by IDcrosspaste history [--limit] [--type] [--favorite]— List recent paste history with filteringcrosspaste search <query> [--limit] [--type]— Full-text search paste historycrosspaste copy <text>— Copy text to clipboard via CrossPastecrosspaste delete <id>— Delete a paste by IDcrosspaste fav <id>— Toggle favorite statuscrosspaste devices— List paired devices with connection statuscrosspaste config/crosspaste config set <key> <value>— View/update configurationcrosspaste tags/tags create <name>/tags delete <id>— Manage paste tagscrosspaste version— Show CLI and app versionscrosspaste --json <command>— JSON output mode for scripting/pipingcrosspaste --generate-completion=(bash|zsh|fish)— Shell completionArchitecture
appConfig.jsonto resolve non-default data directoriesTech Stack
App-Side Changes
CliTokenManager— generates and validates CLI auth tokensCliRouting— HTTP routes under/cli/*with localhost + Bearer token authStatusResponse,PasteSummaryDto,ManagementDtoCLI_FORBIDDEN,CLI_NOT_FOUND,CLI_INVALID_REQUESTgetActiveCountfor paste statistics