Contributing
Development Setup
Section titled “Development Setup”Prerequisites
Section titled “Prerequisites”- Rust 1.85+ (
rustup update stable) - A language server for testing (optional):
- TypeScript:
npm install -g @vtsls/language-server - Rust:
rustup component add rust-analyzer - Go:
go install golang.org/x/tools/gopls@latest
- TypeScript:
git clone https://github.com/Codestz/kraitcd kraitcargo buildRunning Tests
Section titled “Running Tests”Unit tests (no external dependencies)
Section titled “Unit tests (no external dependencies)”cargo testRuns 299+ unit tests and basic CLI smoke tests.
LSP integration tests (optional)
Section titled “LSP integration tests (optional)”# Requires rust-analyzercargo test -- --ignoredThese use fixture projects in tests/fixtures/.
Code Style
Section titled “Code Style”Clippy
Section titled “Clippy”cargo clippy # must pass with zero warningsError handling
Section titled “Error handling”anyhowfor errors in binary/daemon codethiserrorfor library-level error types- No
.unwrap()in library code
Formatting
Section titled “Formatting”cargo fmtSubmitting Changes
Section titled “Submitting Changes”Small fixes
Section titled “Small fixes”Open a pull request directly.
New features
Section titled “New features”- Open an issue first to discuss the approach
- Reference the issue in your PR
- Include tests for new behavior
PR checklist
Section titled “PR checklist”-
cargo fmt— no formatting diff -
cargo clippy— zero warnings -
cargo test— all tests pass - New behavior has unit tests
- PR description explains the motivation
Architecture Overview
Section titled “Architecture Overview”Krait has three layers:
CLI (src/main.rs, src/cli.rs, src/client.rs)
Parses arguments, connects to daemon over Unix socket, prints results. Stateless.
Daemon (src/daemon/)
One process per project root. Manages LSP lifecycles, serves requests, maintains the symbol index.
LSP layer (src/lsp/)
LspMultiplexer runs one server per language, dynamically attaches workspace folders.
Reporting Bugs
Section titled “Reporting Bugs”Use GitHub Issues. Include:
- krait version (
krait --version) - OS and architecture
- Minimal reproduction steps
- Output with
RUST_LOG=debug krait <command>for LSP issues