Monorepo Setup
Auto-Detection
Section titled “Auto-Detection”Krait automatically discovers all workspaces in a monorepo by walking the directory tree and finding manifest files (package.json, go.mod, Cargo.toml, CMakeLists.txt).
For most monorepos, just run:
krait initkrait init
Section titled “krait init”krait init scans your project, detects all workspaces, and generates .krait/krait.toml:
$ cd ~/projects/my-monorepo$ krait init
Detected project root: /Users/me/projects/my-monorepoDetected workspaces: typescript packages/api typescript packages/common typescript packages/web go backend
Written: krait.toml (4 workspaces)Edit this file to customize which workspaces to index.Generated Config
Section titled “Generated Config”[[workspace]]path = "packages/api"language = "typescript"
[[workspace]]path = "packages/common"language = "typescript"
[[workspace]]path = "packages/web"language = "typescript"
[[workspace]]path = "backend"language = "go"How It Works
Section titled “How It Works”Krait runs one LSP process per language and dynamically attaches workspace folders via workspace/didChangeWorkspaceFolders. This means:
- No restart needed when switching between packages
- Shared type information across packages of the same language
- Minimal memory footprint vs. one-server-per-workspace
Tested Monorepos
Section titled “Tested Monorepos”Krait is tested against real-world monorepos:
| Project | Stack | Workspaces |
|---|---|---|
| medusa | TypeScript | 76 |
| meet | TypeScript | 6 |
| WeKnora | Go + TypeScript | 3 |