Skip to main content
Codanna is a local code intelligence MCP server and CLI for AI coding agents. This page covers the source layout, the language-addition workflow, parser conventions, tree-sitter tooling, and the pull request process.

Prerequisites

  • Rust 1.85+ (edition 2024; install via rustup)
  • Git
  • macOS, Linux, or WSL
Linux also needs pkg-config and libssl-dev (Debian/Ubuntu) or equivalents on other distributions.

Repository Layout

Local Build and Test

Pre-commit checks (format, clippy, compile):
Auto-fix formatting and lint issues:
Full CI parity locally (run before a PR):

Adding a Language

Each language lives in a subdirectory under src/parsing/<lang>/ with six files:
1

Read the architecture docs

Three guides under contributing/development/ cover the full surface:
  • language-architecture.md — design principles, resolution flow, state management
  • language-support.md — trait API reference and implementation checklist
  • language-patterns.md — implementation patterns, naming conventions, parser/behavior method organization
2

Install the tree-sitter grammar

See contributing/tree-sitter/README.md for grammar version tracking, ABI exploration, and AST comparison scripts.
3

Implement the six files

Use existing languages as reference. Rust, TypeScript, Python, Go, and PHP are the most feature-complete.
4

Register the language

Wire the new language into src/parsing/registry.rs and declare its definition in your definition.rs.
5

Write tests

Add a comprehensive example under examples/<language>/ and an integration test under tests/. See tests/CLAUDE.md for test infrastructure rules — Tantivy tests go in unit tests in source files, not the tests/ directory.
6

Run the AST comparison

Generates AUDIT_REPORT.md and GRAMMAR_ANALYSIS.md under contributing/parsers/<language>/, surfacing handled vs. unhandled tree-sitter node types.

Parser Development Tools

codanna parse outputs the AST as JSONL for parser debugging and node-type discovery:
Compare codanna output against tree-sitter directly:

Coding Principles

All code must follow the Rust development guidelines in contributing/development/guidelines.md. Key principles:
  • Zero-cost abstractions — no unnecessary allocations on hot paths
  • Type safety — newtypes over primitives (SymbolId, FileId use NonZeroU32)
  • Performance targets — symbol lookups under 10ms, parser above 10,000 symbols/second, CLI startup under 500ms
  • Structured errors — include suggestions and context for recovery
  • Single-responsibility functions — decompose complex logic into focused helpers

Performance Targets

PRs that touch hot paths should document any measurable difference.

Pull Request Workflow

1

Open an issue first

Describe the proposed change. Discuss major features in the issue before implementing. Link the PR with Fixes #<num>.
2

Scope the PR

One feature per PR. Multiple small related fixes can be combined. Keep PRs focused and reviewable.
3

Run local CI

4

Update documentation

Document new features. Update README.md and the relevant pages under documentation/docs/. Include usage examples.
5

Submit the PR

Include tests for new code. Document performance impact when it applies. Flag breaking changes clearly.
Contributions are licensed under Apache License 2.0. See LICENSE for terms.

Next Steps

GitHub Repository

Source, issues, releases.

CLI Reference

Commands, flags, MCP tools, and exit codes.