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

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 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 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.
  • down: Stop Docker services.
  • exec: Execute a command inside a running service container.
  • logs: Show logs for a Docker service.
  • ps: List running Docker containers.
  • up: Start Docker services.

tux docker build

Build Docker images.

Runs docker compose build.

Usage:

Text Only
tux docker build [OPTIONS]

Options:

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

tux docker down

Stop Docker services.

Runs docker compose down.

Usage:

Text Only
tux docker down [OPTIONS]

Options:

Name Type Description Default
--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
--help boolean Show this message and exit. False

tux docker logs

Show logs for a Docker service.

Runs docker compose logs [service].

Usage:

Text Only
tux docker logs [OPTIONS] [SERVICE]

Options:

Name Type Description Default
-f, --follow boolean Follow log output. False
--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 up

Start Docker services.

Runs docker compose up. Can optionally build images first with --build.

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
--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