This document explains the turbo.json configuration for the ai-kit monorepo.
Turborepo orchestrates tasks across packages with intelligent caching and parallel execution.
"$schema": "https://turbo.build/schema.json"Enables IDE autocomplete and validation.
"ui": "tui"Uses terminal UI for better task visualization.
"lint": {
"cache": true,
"inputs": ["**/*.py", "pyproject.toml", ".ruff.toml"]
}- cache: Results are cached based on inputs
- inputs: Files that affect linting results
- No outputs: Linting doesn't produce files
- No dependencies: Can run independently
"format": {
"cache": true,
"inputs": ["**/*.py", "pyproject.toml", ".ruff.toml"],
"outputs": ["**/*.py"]
}- cache: Caches formatted files
- inputs: Files that affect formatting
- outputs: Formatted Python files
- No dependencies: Can run independently
"test": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["**/*.py", "tests/**", "pyproject.toml"],
"outputs": [".coverage", "htmlcov/**"]
}- cache: Caches test results
- dependsOn:
^buildmeans "wait for dependencies to build first" - inputs: Source code and test files
- outputs: Coverage reports
"build": {
"cache": true,
"dependsOn": ["^build"],
"inputs": ["src/**", "pyproject.toml"],
"outputs": ["dist/**", "build/**", "*.egg-info/**"]
}- cache: Caches build artifacts
- dependsOn:
^buildensures dependencies build first - inputs: Source code and package config
- outputs: Distribution files
^task: Runtaskin dependencies first (topological order)task: Runtaskin this package first- No prefix: Run in parallel
When inputs haven't changed:
- Turborepo replays logs from cache
- Outputs are restored from cache
- Task completes in milliseconds
- Shows "cache hit" in output
When inputs have changed:
- Task executes normally
- Results are cached for next run
- Shows "cache miss" in output
pnpm lint # Run lint across all packages
pnpm test # Run tests (respects dependencies)
pnpm build # Build all packagesjust lint # Runs: turbo run lint
just test # Runs: turbo run test
just build # Runs: turbo run buildpnpm build --forcepnpm test --filter=@ai-kit/coreTasks: 4 successful, 4 total
Cached: 0 cached, 4 total
Time: 2.5s
Tasks: 4 successful, 4 total
Cached: 4 cached, 4 total
Time: 50ms >>> FULL TURBO
95% faster! 🚀
In GitHub Actions, Turborepo cache is persisted using actions/cache:
- name: Setup Turborepo cache
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-# Clear cache and rebuild
rm -rf .turbo
pnpm build --force- Check
dependsOnconfiguration - Ensure
^buildis used for dependency builds
- Verify
outputspaths are correct - Check that tasks actually produce those files
- Inputs: Include all files that affect task output
- Outputs: List all generated files for proper caching
- Dependencies: Use
^taskfor topological ordering - Cache: Enable for all deterministic tasks
- Parallel: Let Turborepo handle parallelization