# Programming Languages Supported and Language Detection in gpt-engineer

> Discover the 16 programming languages gpt-engineer supports and how its automatic language detection uses file extensions and Tree-Sitter for parsing. Learn more!

- Repository: [Anton Osika/gpt-engineer](https://github.com/AntonOsika/gpt-engineer)
- Tags: internals
- Published: 2026-03-06

---

**gpt-engineer automatically recognizes 16 programming languages by matching file extensions against a static registry in [`gpt_engineer/tools/supported_languages.py`](https://github.com/AntonOsika/gpt-engineer/blob/main/gpt_engineer/tools/supported_languages.py), mapping each to its corresponding Tree-Sitter grammar identifier for parsing.**

The `gpt-engineer` repository determines how to process source files through a declarative configuration system that bridges file extensions to parser grammars. Understanding which programming languages are supported and how language detection is configured enables developers to extend the tool for additional tech stacks and troubleshoot file ingestion issues.

## Supported Programming Languages

The `SUPPORTED_LANGUAGES` list defined in [`gpt_engineer/tools/supported_languages.py`](https://github.com/AntonOsika/gpt-engineer/blob/main/gpt_engineer/tools/supported_languages.py) contains 16 language entries. Each dictionary specifies three critical fields: `name` for the human-readable identifier, `extensions` as a list of valid file suffixes, and `tree_sitter_name` for the Tree-Sitter grammar library identifier.

The currently supported languages include:

- **Python** (`.py`) → `python`
- **JavaScript** (`.js`, `.mjs`) → `javascript`
- **TypeScript** (`.ts`, `.tsx`) → `typescript`
- **HTML** (`.html`, `.htm`) → `html`
- **CSS** (`.css`) → `css`
- **Java** (`.java`) → `java`
- **C#** (`.cs`) → `c_sharp`
- **Ruby** (`.rb`, `.erb`) → `ruby`
- **PHP** (`.php`, `.phtml`, `.php3`, `.php4`, `.php5`, `.php7`, `.phps`, `.php-s`, `.pht`, `.phar`) → `php`
- **Go** (`.go`) → `go`
- **Kotlin** (`.kt`, `.kts`) → `kotlin`
- **Rust** (`.rs`) → `rust`
- **C++** (`.cpp`, `.cc`, `.cxx`, `.h`, `.hpp`, `.hxx`) → `cpp`
- **C** (`.c`, `.h`) → `c`
- **Markdown** (`.md`) → `md`
- **Arduino C** (`.ino`) → `ino`

Note that while placeholder entries for languages like Swift may exist in the source code, they are explicitly marked as unsupported by the current document chunker implementation.

## How Language Detection Is Configured

Language detection operates through **extension-based matching** against the `SUPPORTED_LANGUAGES` registry. When the engine ingests a project, it traverses the file tree and executes the following logic for each file:

1. Extracts the file extension from the path
2. Queries the registry to locate the matching `tree_sitter_name`
3. Initializes the Tree-Sitter parser with the corresponding grammar to generate an Abstract Syntax Tree (AST)

Files bearing extensions absent from the registry are excluded from processing by the default disk-memory loader.

### Registry Integration in Disk Memory

In [`gpt_engineer/core/default/disk_memory.py`](https://github.com/AntonOsika/gpt-engineer/blob/main/gpt_engineer/core/default/disk_memory.py), the system constructs a comprehensive set of valid extensions to filter project files:

```python
from gpt_engineer.tools.supported_languages import SUPPORTED_LANGUAGES

all_extensions = {ext for lang in SUPPORTED_LANGUAGES for ext in lang["extensions"]}

```

Only files whose suffixes appear in this set are loaded into the context window for prompt generation.

## Detecting Languages Programmatically

You can leverage the registry directly to identify file types in custom workflows:

```python
import pathlib
from gpt_engineer.tools.supported_languages import SUPPORTED_LANGUAGES

def detect_language(file_path: str) -> str | None:
    ext = pathlib.Path(file_path).suffix.lower()
    for lang in SUPPORTED_LANGUAGES:
        if ext in lang["extensions"]:
            return lang["name"]
    return None

# Usage examples

print(detect_language("main.py"))       # → Python

print(detect_language("script.js"))   # → JavaScript

print(detect_language("unknown.jsx")) # → None

```

## Configuring Tree-Sitter Parsing

Once a language is detected, the `tree_sitter_name` field configures the parser instance:

```python
from tree_sitter import Language, Parser
from gpt_engineer.tools.supported_languages import SUPPORTED_LANGUAGES

def get_parser_for_extension(ext: str) -> Parser | None:
    for lang in SUPPORTED_LANGUAGES:
        if ext in lang["extensions"]:
            language = Language('build/my-languages.so', lang["tree_sitter_name"])
            parser = Parser()
            parser.set_language(language)
            return parser
    return None

```

This mechanism drives the AST-based document chunking system that feeds language-aware context into the generation prompts.

## Extending Language Support

Adding support for new programming languages requires modifying [`gpt_engineer/tools/supported_languages.py`](https://github.com/AntonOsika/gpt-engineer/blob/main/gpt_engineer/tools/supported_languages.py). Append a dictionary containing the `name`, `extensions` list, and `tree_sitter_name` to the `SUPPORTED_LANGUAGES` array. The detection pipeline and Tree-Sitter integration automatically incorporate new entries without requiring changes to the core file processing logic in [`gpt_engineer/core/default/disk_memory.py`](https://github.com/AntonOsika/gpt-engineer/blob/main/gpt_engineer/core/default/disk_memory.py) or the chunking modules.

## Summary

- **16 programming languages** are supported through the static registry in [`gpt_engineer/tools/supported_languages.py`](https://github.com/AntonOsika/gpt-engineer/blob/main/gpt_engineer/tools/supported_languages.py)
- **File extension matching** drives language detection and determines which Tree-Sitter grammar to load
- **Disk memory filtering** in [`gpt_engineer/core/default/disk_memory.py`](https://github.com/AntonOsika/gpt-engineer/blob/main/gpt_engineer/core/default/disk_memory.py) uses the registry to exclude unrecognized file types
- **Tree-Sitter integration** converts detected languages into ASTs for document chunking and prompt generation
- **Registry extensibility** allows simple addition of new languages by appending entries to `SUPPORTED_LANGUAGES`

## Frequently Asked Questions

### Which programming languages does gpt-engineer support?

The tool supports Python, JavaScript, TypeScript, HTML, CSS, Java, C#, Ruby, PHP, Go, Kotlin, Rust, C++, C, Markdown, and Arduino C. Each language maps specific file extensions to Tree-Sitter grammar names in the central registry located at [`gpt_engineer/tools/supported_languages.py`](https://github.com/AntonOsika/gpt-engineer/blob/main/gpt_engineer/tools/supported_languages.py).

### How does gpt-engineer detect the programming language of a file?

Language detection relies on suffix matching against the `SUPPORTED_LANGUAGES` list. The engine extracts each file's extension and looks up the corresponding `tree_sitter_name` field, which identifies the correct Tree-Sitter parser grammar to generate an AST for that specific language.

### Can I add support for additional programming languages?

Yes. Modify [`gpt_engineer/tools/supported_languages.py`](https://github.com/AntonOsika/gpt-engineer/blob/main/gpt_engineer/tools/supported_languages.py) to append a new dictionary containing the language name, file extensions, and Tree-Sitter grammar identifier. The detection pipeline in [`gpt_engineer/core/default/disk_memory.py`](https://github.com/AntonOsika/gpt-engineer/blob/main/gpt_engineer/core/default/disk_memory.py) automatically incorporates new entries without requiring changes to the core ingestion logic.

### Why are some languages like Swift listed but marked as unsupported?

While the registry may contain placeholder entries for languages such as Swift, the current document chunker implementation lacks the necessary Tree-Sitter grammar integration or parsing logic required to process these files effectively, rendering them unsupported in practice.