Skip to content

Repository files navigation

code-engine

Production-grade Node.js code intelligence engine powered by Tree-sitter.

Features

  • Tree-sitter parsing — incremental, error-tolerant AST parsing
  • Lazy grammar loading — grammars loaded on first use per language
  • Symbol extraction — functions, classes, methods, variables, imports, exports
  • Streaming file reads — handles multi-GB projects without loading files entirely into memory
  • Directory walking — respects ignore lists (node_modules, .git, etc.)
  • Content hashing — caches parse results for unchanged files
  • Extensible architecture — modular design for easy language and feature additions

Architecture

code-engine/
├── src/
│   ├── api/          # Public API (Phase 6)
│   │   └── index.js
│   ├── cache/        # File-level parse cache
│   │   └── index.js
│   ├── database/     # SQLite storage (Phase 2)
│   │   └── index.js
│   ├── indexer/       # Project indexing (Phase 2)
│   │   └── index.js
│   ├── parser/        # Tree-sitter parsing & symbol extraction
│   │   ├── parser.js
│   │   ├── language-loader.js
│   │   └── javascript-extractor.js
│   ├── search/        # Symbol & full-text search (Phase 3)
│   │   └── index.js
│   ├── utils/
│   │   └── file-stream.js
│   ├── workers/       # Worker thread pool (Phase 5)
│   │   └── index.js
│   ├── constants.js
│   └── index.js       # CLI entry point
├── package.json
└── README.md

Quick Start

npm install

# Parse a single file
node src/index.js parse ./path/to/file.js

# Walk a directory
node src/index.js walk ./path/to/project

# Show supported languages
node src/index.js info

# Parse from stdin
echo "function hello() { return 42; }" | node src/index.js source javascript

Supported Languages (Phase 1)

Language Extensions
JavaScript .js, .mjs, .cjs, .jsx

More languages coming in Phase 4: TypeScript, Python, PHP, Java, C#, C++, Go, Rust, HTML, CSS, JSON.

Phases

Phase Status Description
1 Project structure, Parser, JavaScript support
2 SQLite database, Indexer
3 Symbol & full-text search
4 Multi-language support (13 languages)
5 Worker threads for parallel parsing
6 Retriever API, public API, and AI context queries

API (Preview)

import { createEngine } from './src/api/index.js';

const engine = await createEngine('/path/to/project');
await engine.indexProject();

const symbols = await engine.searchSymbols('myFunction');
const refs = await engine.findReferences('myFunction');

License

MIT

About

Production-grade code intelligence engine powered by Tree-sitter. Indexes, parses, and analyzes codebases at enterprise scale with zero artificial limits. Supports 12 languages with symbol extraction, call graph analysis, dependency tracking, and intelligent context ranking.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages