Languages
accepted ADR-0004 engineering/ADR-0004-languages
languages: main: name: TypeScriptStatus
Section titled “Status”Accepted
What is this file? A question governance asks your repository, with the answer it recommends. While it says
status: proposed, you may edit it freely.revision:dates the question, not the file: you do not fill it, and it only moves when the question changes. rejected is a full answer: when the question does not apply here, rule rejected, remove the wholetraits:block, and say what stands in for it. ADR-0001 explains the mechanics.
Context
Section titled “Context”While this key is empty, an agent adding code to this repository does not know which language to write it in. It infers from what it sees, and gets it wrong as soon as the repository holds more than one. Once the value is written, it reads it and sticks to it.
The main language is not the only language in the repository: it is the one code is written in by default, and the one whose tooling is the reference. A repository can hold others without changing the answer.
Decision
Section titled “Decision”governance does not choose for you, but it narrows the field. It recommends two languages:
| Key | Recommended value | Reason |
|---|---|---|
languages.main.name |
Python or TypeScript |
both have mature test, typing and coverage tooling, both have a schema-first validation library that ADR-0005 can recommend (pydantic, zod), and coding agents write and review both reliably |
Between the two: TypeScript when the repository runs in a browser or shares code between browser and server; Python for scripts, data work and services that do neither. Neither is better in the abstract.
Another language remains possible, and is justified here, not elsewhere. Write what the two recommended languages did not give you: a single static binary, a runtime constraint, an ecosystem the repository depends on. That justification is the only thing governance asks in return.
None of this is checked by a tool. The schema checks that a value is written, never that it is in the list: refusing a language mechanically would make impossible the very case this section allows. Review reads your justification, not a command.
Adopted as recommended: TypeScript.
Consequences
Section titled “Consequences”Positive
Section titled “Positive”- An agent writes new code in TypeScript without inferring it.
- Validation (ADR-0005) and coverage (ADR-0007) recommendations apply directly.
Negative
Section titled “Negative”- The code is plain JavaScript (
.mjs) at the time of ruling, shipped as sources from git with no build step and run on Node 20.19, which does not execute.ts. Moving to TypeScript needs a build step or committed output, and a migration ofsrc/,bin/andtest/.
Neutral
Section titled “Neutral”- Secondary languages (shell scripts, YAML, Markdown) are not declared here and do not change the answer.
Alternatives Considered
Section titled “Alternatives Considered”Python
Section titled “Python”Mature test and typing tooling, pydantic for validation, a large
ecosystem for scripts and data work.
TypeScript
Section titled “TypeScript”One language from browser to server, gradual typing, zod for validation.
One binary to deploy, fast compilation, simple concurrency. surdesrails recommends it; governance does not, because its repositories rarely need a static binary and one fewer language keeps the other recommendations shorter. It remains a valid answer when justified.
Another language
Section titled “Another language”Possible, and justified in this file: what the recommended languages did not give you.
No main language
Section titled “No main language”For a documentation, configuration or infrastructure repository. Rule rejected then, and say what the repository holds instead.
References
Section titled “References”- Adapted from surdesrails SDR-0004, revision 1.
- ADR-0001: how governance ADRs are ruled on.
- ADR-0005 and ADR-0007: validation and coverage, which depend on this answer.
The key.
| Key | What it holds | Allowed values |
|---|---|---|
languages.main.name |
the main language, as a person writes it | Python, TypeScript, or another one justified above |
What this key does not cover: no test runner, test command, coverage threshold, lint command or tool. The coverage threshold is ADR-0007’s; commands are not carried by governance, which does not know what your repository runs.
An empty key is not an answer: this one is required. The value is written in this file and nowhere else; whoever needs it links here. See ADR-0001 for the check command.
