Skip to content

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 after tux:

    Bash
    # Example: Apply migrations to production database
    poetry run tux --prod db migrate
    
    # Example: Start the bot using production token/DB
    poetry run tux --prod bot start
    
  • 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.

    Bash
    # These are equivalent and run in development mode:
    poetry run tux db push
    poetry run tux --dev db push
    
    poetry run tux bot start
    poetry run tux --dev bot start
    

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:

Text Only
tux [OPTIONS] COMMAND [ARGS]...

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:

Text Only
tux db [OPTIONS] COMMAND [ARGS]...

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:

Text Only
tux db generate [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux db migrate

Run database migrations.

Usage:

Text Only
tux db migrate [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux db pull

Pull schema from database.

Usage:

Text Only
tux db pull [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux db push

Push schema changes to database.

Usage:

Text Only
tux db push [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux db reset

Reset database.

Usage:

Text Only
tux db reset [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux dev

Development tools

Usage:

Text Only
tux dev [OPTIONS] COMMAND [ARGS]...

Options:

Name Type Description Default
--help boolean Show this message and exit. False

Subcommands

tux dev coverage

Generate coverage reports with various options.

Usage:

Text Only
tux dev coverage [OPTIONS]

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:

Text Only
tux dev coverage-clean [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux dev coverage-open

Open HTML coverage report in browser.

Usage:

Text Only
tux dev coverage-open [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux dev format

Format code with Ruff.

Usage:

Text Only
tux dev format [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux dev lint

Run linting with Ruff.

Usage:

Text Only
tux dev lint [OPTIONS]

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:

Text Only
tux dev lint-fix [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux dev pre-commit

Run pre-commit checks.

Usage:

Text Only
tux dev pre-commit [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux dev test

Run tests with coverage.

Usage:

Text Only
tux dev test [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux dev test-quick

Run tests without coverage (faster).

Usage:

Text Only
tux dev test-quick [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux dev type-check

Check types with Pyright.

Usage:

Text Only
tux dev type-check [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux docker

Docker management commands

Usage:

Text Only
tux docker [OPTIONS] COMMAND [ARGS]...

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:

Text Only
tux docker build [OPTIONS]

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:

Text Only
tux docker cleanup [OPTIONS]

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:

Text Only
tux docker config [OPTIONS]

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:

Text Only
tux docker down [OPTIONS]

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:

Text Only
tux docker exec [OPTIONS] [SERVICE] COMMAND...

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:

Text Only
tux docker health [OPTIONS]

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:

Text Only
tux docker logs [OPTIONS] [SERVICE]

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:

Text Only
tux docker ps [OPTIONS]

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:

Text Only
tux docker pull [OPTIONS]

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:

Text Only
tux docker restart [OPTIONS] [SERVICE]

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:

Text Only
tux docker shell [OPTIONS] [SERVICE]

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:

Text Only
tux docker test [OPTIONS]

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:

Text Only
tux docker up [OPTIONS]

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:

Text Only
tux docs [OPTIONS] COMMAND [ARGS]...

Options:

Name Type Description Default
--help boolean Show this message and exit. False

Subcommands

  • build: Build documentation site.
  • serve: Serve documentation locally.

tux docs build

Build documentation site.

Usage:

Text Only
tux docs build [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux docs serve

Serve documentation locally.

Usage:

Text Only
tux docs serve [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux start

Start the Discord bot

Usage:

Text Only
tux start [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False

tux version

Display the current version of Tux

Usage:

Text Only
tux version [OPTIONS]

Options:

Name Type Description Default
--help boolean Show this message and exit. False