What Programming Languages Does OpenClaude Repo-Map Support?
OpenClaude's repo-map feature supports four programming languages: TypeScript, TSX, JavaScript, and Python, defined strictly in the SupportedLanguage union type within the source code.
The Gitlawb/openclaude repository implements repo-map functionality to enable syntax-aware code navigation and symbol extraction. Understanding what programming languages the OpenClaude repo-map supports helps developers know which file types benefit from intelligent parsing and query-based analysis.
Supported Languages Overview
The OpenClaude repo-map recognizes source files written in four distinct languages. These languages cover the majority of modern web development and data science workflows:
- TypeScript (
.tsfiles) — Statically typed JavaScript superset - TSX (
.tsxfiles) — TypeScript with JSX support for React components - JavaScript (
.js,.jsxfiles) — Dynamic scripting for web applications - Python (
.pyfiles) — General-purpose language for backend and ML workflows
This specific quartet is hardcoded in the type system, ensuring type safety across the parsing pipeline.
Language Detection Architecture
The SupportedLanguage Type Definition
In src/context/repoMap/types.ts, the supported set is declared as a TypeScript union type:
export type SupportedLanguage = 'typescript' | 'tsx' | 'javascript' | 'python';
This type definition acts as the single source of truth for all language-specific operations in the repo-map feature. By constraining the type system to these four string literals, OpenClaude ensures compile-time safety when loading parsers or executing queries.
File Extension to Language Mapping
When processing repository files, src/context/repoMap/gitFiles.ts maps known file extensions to their corresponding SupportedLanguage values. The getLanguageForFile() function performs this resolution by analyzing the file path and extension.
For example, the function correctly identifies:
src/app/index.ts→'typescript'components/button.tsx→'tsx'frontend/main.jsx→'javascript'scripts/util.py→'python'
Files with extensions outside this supported set return undefined, effectively excluding them from repo-map processing.
Parsing and Query Implementation
Tree-Sitter Grammar Loading
Once a language is detected, src/context/repoMap/parser.ts loads the appropriate tree-sitter WASM grammar. The createParser() function accepts a SupportedLanguage parameter and returns a configured parser instance capable of building an abstract syntax tree (AST) for that specific language.
This architecture allows OpenClaude to perform language-specific structural analysis without maintaining separate parsing logic for each grammar. The parser caches grammars efficiently to avoid reloading WASM binaries across multiple file operations.
Tag Query Definitions
The actual symbol extraction logic resides in src/context/repoMap/queries.ts. This module contains bundled tree-sitter query files (such as typescript-tags.scm) that define how to identify functions, classes, variables, and imports within each supported language's AST.
These queries are language-specific, allowing the repo-map to extract meaningful context-aware symbols regardless of whether it is parsing a Python module or a TypeScript React component.
Practical Implementation Example
To leverage the repo-map language detection in your own OpenClaude extensions or modifications, import the core utilities and follow this pattern:
import { getLanguageForFile } from '@/context/repoMap/gitFiles.js';
import { createParser } from '@/context/repoMap/parser.js';
async function analyzeSourceFile(path: string, content: string) {
// Detect language from file extension
const language = getLanguageForFile(path);
if (!language) {
throw new Error('Unsupported file type for repo-map analysis');
}
// Initialize tree-sitter parser for the detected language
const parser = await createParser(language);
const tree = parser?.parse(content);
// Execute repo-map queries on the parsed AST
// ...symbol extraction and navigation logic here...
}
This workflow ensures that only supported languages trigger the parsing pipeline, preventing runtime errors and optimizing performance by skipping irrelevant files.
Summary
- Four languages supported: TypeScript, TSX, JavaScript, and Python, as defined in
src/context/repoMap/types.ts. - Type-safe definitions: The
SupportedLanguageunion type prevents invalid language values from propagating through the codebase. - Extension-based detection:
getLanguageForFile()insrc/context/repoMap/gitFiles.tsmaps file paths to language identifiers. - Tree-sitter integration:
createParser()insrc/context/repoMap/parser.tsdynamically loads the correct WASM grammar for each supported language. - Query-driven analysis: Language-specific symbol extraction is handled through dedicated
.scmquery files insrc/context/repoMap/queries.ts.
Frequently Asked Questions
What programming languages does OpenClaude repo map support?
OpenClaude repo-map supports TypeScript, TSX, JavaScript, and Python. This set is explicitly defined as the SupportedLanguage union type in src/context/repoMap/types.ts, which constrains all language-specific operations throughout the codebase.
How does OpenClaude detect the language of a source file?
OpenClaude uses the getLanguageForFile() function exported from src/context/repoMap/gitFiles.ts to analyze file extensions and map them to SupportedLanguage values. This function returns 'typescript', 'tsx', 'javascript', or 'python' based on the file path, or undefined for unsupported extensions.
Where are the tree-sitter grammars loaded in OpenClaude?
Tree-sitter grammars are loaded in src/context/repoMap/parser.ts via the createParser() function. This module dynamically imports the appropriate WASM grammar for the requested SupportedLanguage and maintains a cache to optimize performance across multiple parsing operations.
Can I extend OpenClaude to support additional programming languages?
Adding support for additional languages would require modifying the SupportedLanguage type in src/context/repoMap/types.ts, updating the extension mapping logic in src/context/repoMap/gitFiles.ts, and providing corresponding tree-sitter WASM grammars and tag query files in the parser and queries modules. The current architecture is designed around the four built-in languages, so extensions would need to maintain type safety throughout the parsing pipeline.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →