Build 100 packages in the time it used to take to build 10.
One binary that caches task outputs by input hash, runs dependent tasks in the right order, and only reruns what actually changed.
You know this.
You change one type in a shared package and rebuild the whole monorepo. 10 minutes later you find out the type was wrong. You do it again.
kb-devkit hashes your inputs. Change one package, only that package and its dependents rebuild.
CI takes 20 minutes on every PR. Nobody knows which packages actually changed. You end up building everything because it's safer.
kb-devkit run build --affected finds exactly what changed via git diff and BFS through the dependency graph.
You're running lint, type-check, and tests in parallel but the type-check needs the dist/ from a dep that hasn't built yet. Errors that aren't real.
deps: ["^build"] in devkit.yaml. Deps' build finishes before your task starts. Guaranteed.
One file, any monorepo.
Drop devkit.yaml in your workspace root. Declare tasks once, run them everywhere. kb-devkit finds packages by glob patterns and applies the right rules.
The KB Labs workspace uses kb-devkit for all 125+ packages across 18 repos.
tasks:
build:
command: tsup
inputs:
- "src/**"
- "tsconfig*.json"
outputs:
- "dist/**"
deps:
- "^build" # deps first
lint:
command: eslint src/
inputs: ["src/**"]
test:
command: vitest run
inputs: ["src/**", "test/**"]
deps: ["build"]
affected:
strategy: submodulesHow it works
The things that matter once the pain is familiar.
Identical inputs, zero work
SHA256 hash of all input files. Cache hit restores outputs in ~1ms. No rebuild, no rerun, no wait.
Runs in the right order
DAG across all (package × task) pairs. Packages with no interdependencies run in parallel. deps: ["^build"] means what it says.
Knows what actually changed
git diff inside each submodule, BFS through the reverse dependency graph. --affected targets only what needs to run.
Works with any task
build, lint, test, type-check, deploy, or anything with a shell command. cache: false for side-effectful tasks.
Quality checks built in
Validates tsconfig inheritance, eslint config, required scripts, dep consistency. kb-devkit check catches drift before CI does.
Every command is scriptable
All commands output structured JSON with an ok field. Results include per-package stdout, stderr, exit code, and duration.
Docker build context pruning
kb-devkit bundle resolves the full workspace:* closure and emits only the packages needed to build the target. Equivalent to turbo prune — drop in before pnpm install in your Dockerfile.
Commands
All commands support --json for CI and agent workflows.
kb-devkit run buildRun build across all packages in dependency order. Cached results restore in ~1ms.
kb-devkit run build --affectedRun only on packages changed relative to HEAD, plus all their downstream dependents.
kb-devkit run build lint testChain multiple tasks. Each respects its own inputs, outputs, and dep ordering.
kb-devkit run build --packages @scope/pkg-a,@scope/pkg-bTarget specific packages by name. Useful for focused rebuilds during development.
kb-devkit checkValidate all packages against devkit.yaml rules: naming, tsconfig, eslint, deps, structure.
kb-devkit statsWorkspace health score (A–F), issue counts by category, coverage metrics.
kb-devkit fixAuto-fix safe violations found by check. Use --dry-run to preview first.
kb-devkit gateCheck staged files only. Exits with code 1 on violations. For pre-commit hooks.
kb-devkit bundle @scope/pkg --dockerPrune the monorepo to a minimal Docker build context. Resolves transitive workspace:* deps, emits pruned pnpm-workspace.yaml and package.json files. --docker splits into json/ (deps layer) and full/ (build layer).
Download
Pre-built binaries for macOS, Linux, and Windows. SHA-256 checksums included in every release.
Part of KB Labs
kb-devkit is the build engine inside KB Labs. Every package in the platform is built, linted, and tested through it.
Install KB Labs →