CLI Reference¶
This section provides details on using the custom tux
command-line interface, built with Click.
Environment Selection¶
The tux
CLI defaults to development mode for all command groups (bot
, db
, dev
, docker
). This ensures that operations like database migrations or starting the bot target your development resources unless explicitly specified otherwise.
-
Production Mode: To run a command targeting production resources (e.g., production database, production bot token), you must use the global
--prod
flag immediately aftertux
: -
Development Mode (Default / Explicit): Running any command without
--prod
automatically uses development mode. You can also explicitly use the--dev
flag, although it is redundant.
This default-to-development approach prioritizes safety by preventing accidental operations on production environments. The environment determination logic can be found in tux/utils/env.py
.
tux¶
Tux CLI
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--version | boolean | Show the version and exit. | False |
--help | boolean | Show this message and exit. | False |
Subcommands
- db: Database management commands
- dev: Development tools
- docker: Docker management commands
- docs: Documentation related commands
- start: Start the Discord bot
- version: Display the current version of Tux
tux db¶
Database management commands
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
Subcommands
- generate: Generate Prisma client.
- migrate: Run database migrations.
- pull: Pull schema from database.
- push: Push schema changes to database.
- reset: Reset database.
tux db generate¶
Generate Prisma client.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux db migrate¶
Run database migrations.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux db pull¶
Pull schema from database.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux db push¶
Push schema changes to database.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux db reset¶
Reset database.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux dev¶
Development tools
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
Subcommands
- coverage: Generate coverage reports with various options.
- coverage-clean: Clean coverage files and reports.
- coverage-open: Open HTML coverage report in browser.
- format: Format code with Ruff.
- lint: Run linting with Ruff.
- lint-fix: Run linting with Ruff and apply fixes.
- pre-commit: Run pre-commit checks.
- test: Run tests with coverage.
- test-quick: Run tests without coverage (faster).
- type-check: Check types with Pyright.
tux dev coverage¶
Generate coverage reports with various options.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--format | choice (term | html | xml | json ) | Coverage report format | term |
--fail-under | integer range (between 0 and 100 ) | Fail if coverage is below this percentage | None |
--open | boolean | Open HTML report in browser (only with --format=html) | False |
--quick | boolean | Quick coverage check without generating reports | False |
--clean | boolean | Clean coverage files before running | False |
--specific | text | Run coverage for specific path (e.g., tux/utils) | None |
--help | boolean | Show this message and exit. | False |
tux dev coverage-clean¶
Clean coverage files and reports.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux dev coverage-open¶
Open HTML coverage report in browser.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux dev format¶
Format code with Ruff.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux dev lint¶
Run linting with Ruff.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux dev lint-fix¶
Run linting with Ruff and apply fixes.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux dev pre-commit¶
Run pre-commit checks.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux dev test¶
Run tests with coverage.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux dev test-quick¶
Run tests without coverage (faster).
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux dev type-check¶
Check types with Pyright.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux docker¶
Docker management commands
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
Subcommands
- build: Build Docker images.
- cleanup: Clean up Tux-related Docker resources (images, containers, networks).
- config: Validate and display the Docker Compose configuration.
- down: Stop Docker services.
- exec: Execute a command inside a running service container.
- health: Check health status of running Tux containers.
- logs: Show logs for Docker services.
- ps: List running Docker containers.
- pull: Pull the latest Tux images from the registry.
- restart: Restart Docker services.
- shell: Open an interactive shell in a running container.
- test: Run Docker performance and functionality tests.
- up: Start Docker services.
tux docker build¶
Build Docker images.
Runs docker compose build
with optional cache and target controls.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--no-cache | boolean | Build without using cache. | False |
--target | text | Build specific stage (dev, production). | None |
--help | boolean | Show this message and exit. | False |
tux docker cleanup¶
Clean up Tux-related Docker resources (images, containers, networks).
SAFETY: Only removes Tux-related resources, never affects other projects.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--volumes | boolean | Also remove Tux volumes. | False |
--force | boolean | Force removal without confirmation. | False |
--dry-run | boolean | Show what would be removed without actually removing. | False |
--help | boolean | Show this message and exit. | False |
tux docker config¶
Validate and display the Docker Compose configuration.
Runs docker compose config
to show the resolved configuration.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux docker down¶
Stop Docker services.
Runs docker compose down
with optional cleanup.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-v , --volumes | boolean | Remove associated volumes. | False |
--remove-orphans | boolean | Remove containers for services not defined in compose file. | False |
--help | boolean | Show this message and exit. | False |
tux docker exec¶
Execute a command inside a running service container.
Runs docker compose exec [service] [command]
.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-it , --interactive | boolean | Keep STDIN open and allocate a TTY. | True |
--help | boolean | Show this message and exit. | False |
tux docker health¶
Check health status of running Tux containers.
Shows health check status for Tux services only.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux docker logs¶
Show logs for Docker services.
Runs docker compose logs [service]
. If no service specified, shows logs for all services.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-f , --follow | boolean | Follow log output. | False |
-n , --tail | integer | Number of lines to show from the end of the logs. | None |
--help | boolean | Show this message and exit. | False |
tux docker ps¶
List running Docker containers.
Runs docker compose ps
.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux docker pull¶
Pull the latest Tux images from the registry.
Runs docker compose pull
to update Tux images only.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux docker restart¶
Restart Docker services.
Runs docker compose restart [service]
.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux docker shell¶
Open an interactive shell in a running container.
Equivalent to docker compose exec [service] bash
.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux docker test¶
Run Docker performance and functionality tests.
Uses the Python Docker toolkit for testing.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--no-cache | boolean | Run tests without Docker cache. | False |
--force-clean | boolean | Perform aggressive cleanup before testing. | False |
--quick | boolean | Run quick validation tests only. | False |
--comprehensive | boolean | Run comprehensive test suite. | False |
--help | boolean | Show this message and exit. | False |
tux docker up¶
Start Docker services.
Runs docker compose up
with various options. In development mode, --watch enables automatic code syncing.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
-d , --detach | boolean | Run containers in the background. | False |
--build | boolean | Build images before starting containers. | False |
--watch | boolean | Enable file watching for development (auto-sync). | False |
--help | boolean | Show this message and exit. | False |
tux docs¶
Documentation related commands
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
Subcommands
tux docs build¶
Build documentation site.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux docs serve¶
Serve documentation locally.
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux start¶
Start the Discord bot
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |
tux version¶
Display the current version of Tux
Usage:
Options:
Name | Type | Description | Default |
---|---|---|---|
--help | boolean | Show this message and exit. | False |