| title | dx-cli - ChessMate Developer Experience CLI |
|---|---|
| service | dx-cli |
| status | active |
| last_reviewed | 2025-11-15 |
| type | overview |
Unified command-line interface for all developer workflows in the ChessMate monorepo.
dx-cli provides a single, consistent command interface to orchestrate services, manage lifecycles, and streamline common developer tasks across the entire monorepo.
# Install dx-cli dependencies
cd dx-cli
pnpm install
# Build the CLI
pnpm build
# Link for global use (optional)
pnpm linkTo run dx commands without the full path, add the bin directory to your shell's PATH:
# Add to ~/.bashrc, ~/.zshrc, or ~/.profile
export PATH="/path/to/chessmate/dx-cli/bin:$PATH"
# Then reload your shell
source ~/.bashrcAlternatively, use it directly with the absolute path:
/workspaces/chessmate/dx-cli/bin/dx doctorThe CLI can be invoked via multiple aliases:
dx help
monocto help
mnc helpAll three commands execute the same CLI. Choose your favorite!
# Check system health
dx doctor
# View all services
dx doctor
# Start development environment
dx dev
# Run tests for all services
dx test
# Build all services
dx buildInitialize development environment and verify prerequisites. This command automatically:
- Checks system requirements (Node.js, Python, Git, etc.)
- Installs missing system-level dependencies (Poetry, etc.)
- Verifies the development environment is ready
dx setup
# Skip automatic dependency installation
dx setup --skip-depsCheck system health and configuration. Validates service discovery, DAG, and runtime setup.
# Full system check
dx doctor
# Check specific service
dx doctor account-apiStart development environment.
# Start all services
dx dev
# Start single service with dependencies
dx dev account-api
# Start only account-api (skip dependencies)
dx dev account-api --singleRun test suite.
# Run all tests
dx test
# Test single service with dependencies
dx test account-api
# Test only account-api
dx test account-api --singleBuild service(s).
# Build all services
dx build
# Build with dependencies
dx build live-game-api
# Build only live-game-api
dx build live-game-api --singleLint service code.
# Lint all
dx lint
# Lint specific service
dx lint chess-app
# Lint only
dx lint chess-app --singleRun database migrations.
# Migrate all services (dev environment)
dx migrate
# Migrate specific service
dx migrate account-api --env=dev
# Migrate only (no dependencies)
dx migrate account-api --single
# Migrate for staging
dx migrate account-api --env=stagingSeed database with initial data.
# Seed all services
dx seed
# Seed specific service
dx seed account-api --env=dev
# Seed only
dx seed account-api --singleView service logs.
# View last 50 lines
dx logs account-api
# Follow logs
dx logs account-api --follow
# View last 100 lines
dx logs account-api --lines=100Deploy to environment (dev, staging, prod).
# Deploy all services to staging
dx deploy staging
# Deploy single service to prod
dx deploy prod account-api --single
# Deploy to dev
dx deploy devView service changelog.
# View changelog for service
dx changelog account-api
# View all changelogs
dx changelogReset sandbox environment.
# Reset all sandboxes
dx sandbox reset
# Reset specific service
dx sandbox reset account-api --singleGenerate Bruno API collections for services.
# Generate for all services
dx bruno generate
# Generate for specific service
dx bruno generate account-apiValidate Bruno API collections compliance.
# Validate all services
dx bruno validate
# Validate specific service
dx bruno validate account-apiWhen no service is specified, the command runs against all services in parallel (respecting concurrency limits).
dx test # Runs tests for ALL services
dx build # Builds ALL servicesWhen a service is specified, the CLI:
- Resolves the dependency DAG for that service
- Executes dependencies first (in topological order)
- Executes the target service last
dx test account-api # Tests dependencies + account-api
dx build live-game-api # Builds dependencies + live-game-apiThe --single flag skips dependency resolution and runs only the target service.
dx test account-api --single # Only test account-api, skip dependenciesThe CLI automatically discovers all services by scanning for service.yaml files in the monorepo.
chessmate/
├── account-api/
│ └── service.yaml ← Discovered
├── live-game-api/
│ └── service.yaml ← Discovered
├── matchmaking-api/
│ └── service.yaml ← Discovered
└── chess-app/
└── service.yaml ← Discovered
Each service.yaml defines:
- Service metadata (name, kind, language, runtime)
- Lifecycle commands (dev, test, build, etc.)
- Dependencies (which other services must run first)
- Infrastructure requirements
See docs/service-spec.md for the full schema.
The CLI builds a Directed Acyclic Graph (DAG) from service dependencies to ensure correct execution order.
For each lifecycle (dev, test, build, deploy), the DAG resolver:
- Identifies all dependencies for the target service
- Detects cycles (errors if found)
- Sorts topologically (dependencies before dependents)
- Groups by depth (enabling parallel execution where safe)
Given this dependency structure:
account-api (no deps)
live-game-api → account-api
matchmaking-api → account-api, live-game-api
chess-app → all APIs
Running dx build chess-app executes in this order:
1. account-api (depth 0)
2. live-game-api (depth 1, depends on account-api)
3. matchmaking-api (depth 2, depends on both)
4. chess-app (depth 3, depends on all)
Services at the same depth run in parallel (up to concurrency limit).
Configuration is managed via dx.config.yml in the monorepo root.
# Service discovery patterns
global:
service_discovery:
patterns:
- "**/service.yaml"
root: "."
# Logging behavior
logging:
level: "info" # debug, info, warn, error
format: "pretty" # pretty, json
prefix_logs: true # Add service name to logs
# Execution settings
execution:
parallel_limit: 4 # Max parallel commands
stream_logs: true # Stream output in real-time
exit_on_error: true # Stop on first failure
timeout_ms: 0 # 0 = no timeout
# Environment definitions
environments:
dev:
kube_context: "docker-desktop"
namespace: "default"
helm_root: "charts"
staging:
kube_context: "staging-cluster"
namespace: "chessmate-staging"
prod:
kube_context: "prod-cluster"
namespace: "chessmate-prod"
# Tool management
mise:
enabled: true # Use mise for tool versioning
auto_install: true
# Service groups
service_groups:
apis: [account-api, live-game-api, matchmaking-api]
apps: [chess-app]Control CLI behavior via environment variables:
# Log level (default: info)
export DX_LOG_LEVEL=debug
# Parallel execution limit (default: 4)
export DX_PARALLEL_LIMIT=2
# Disable mise integration
export DX_MISE_DISABLED=1
# JSON logging output
export DX_LOG_FORMAT=jsonEach service requires a service.yaml file at its root.
name: account-api
kind: api
language: python
runtime: python3.11
description: Account management API
commands:
dev: "poetry run uvicorn app.main:app --reload"
test: "poetry run pytest"
build: "poetry build"
lint: "poetry run pylint app/"
migrate: "poetry run alembic upgrade head"
seed: "poetry run python scripts/seed.py"
dependencies:
dev: []
test: []
build: []
deploy: []
infra:
requires:
- database
- cacheSee service-spec.md for complete schema documentation.
If mise is enabled in dx.config.yml, all commands are executed with mise exec --:
# Without mise
command --version
# With mise (automatic)
mise exec -- command --versionThis ensures:
- Tool versions are managed via
.mise.toml - Environment consistency across developers
- CI/CD reproducibility
For deploy commands, the CLI reads Kubernetes configuration from dx.config.yml:
environments:
prod:
kube_context: "prod-cluster"
namespace: "chessmate-prod"
helm_root: "charts"Deploy commands will:
- Switch to the correct Kubernetes context
- Deploy to the specified namespace
- Use Helm charts from the configured root
dx-cli now includes environment-aware Kubernetes workflows. Key commands:
dx env list|use|current— manage environments defined in.dx/config.yaml.dx k8s init-local— bootstrap a localkindcluster for development.dx deploy <env> [service]— deploy service(s) to a Kubernetes environment.dx logs <service>— stream logs from pods when an active K8s environment is set.dx shell <service>— open an interactive shell in a pod.dx open <service>— open a service URL (ingress) or start a port-forward for local development.
See dx-cli/docs/kubernetes/ for full documentation, examples, and troubleshooting.
$ dx build missing-service
✗ Service 'missing-service' not found
# Solution: Check dx doctor
dx doctor✗ DAG validation failed:
- Dependency cycle detected: a → b → a
# Solution: Fix service.yaml dependencies to remove cycles⚠ account-api has no build command configured
# Solution: Add 'build' command to account-api/service.yamlchmod +x bin/dx bin/monocto bin/mncpnpm buildpnpm dev # Watch modepnpm testpnpm type-checkpnpm lintsrc/core/- Core utilities (logging, execution, config loading)src/services/- Service discovery and registrysrc/dag/- Dependency resolution and validationsrc/commands/- Command implementationssrc/config/- Schema definitionsbin/- CLI entry points (dx, monocto, mnc)
See ARCHITECTURE.md in docs for detailed architecture.
When adding new commands:
- Create new file in
src/commands/ - Export a Command instance
- Register in
src/index.ts - Update this README with documentation
- docs/service-spec.md - Complete service.yaml specification
- dx.config.yml - Global configuration reference
- docs/DX_PLATFORM.md - Platform architecture and integration guide