Contributing
Toolchain
| Tool | Role | Command |
|---|---|---|
| tsx | Run .mts sources directly (dev loop) | npm run dev |
| tsc | Type-check + emit dist/*.mjs | npm run build / npm run typecheck |
| Biome | Format + lint | npm run check / npm run check:fix |
node --test | Unit tests | npm test |
| VitePress | This docs site | npm run docs:dev |
bash
npm install
npm run dev # tsx src/adapter.mts — run sources directly, no build
npm run build # tsc -> dist/ (production artifact)
npm run typecheck # tsc --noEmit
npm run check # biome format + lint (read-only)
npm run check:fix # biome auto-fix
npm test # build + node --test dist/test/*.mjsConventions
- ESM only:
.mtssources undersrc/compile to.mjsunderdist/. Relative imports use the.mjsextension (NodeNext). - Erasable syntax only (
erasableSyntaxOnly): noenum,namespace, or constructor parameter properties. Declare fields explicitly and assign in the constructor body. This keepstsxand Node 24 native type stripping working — on Node 24 you can runnode src/adapter.mtsdirectly. - Never hand-edit
dist/orgenerated/— they are produced bynpm run buildandnpm run generate:schema. - Formatting: 2-space, single quotes, no semicolons, lineWidth 100 (Biome). Run
npm run check:fixbefore committing. - New Claude backends go in a
*-runtime.mtsmodule wired throughruntime-factory.mts(theClaudeRuntimeinterface).
Why .mts / .mjs?
The adapter is launched directly with node dist/src/adapter.mjs on remote hosts. Compiling .mts → .mjs makes every file unambiguously ESM at the file level (Node always treats .mjs as ESM, regardless of any package.json), so the deployed artifact needs only node — no TS toolchain, no dependence on a type: module lookup in dist/.
Project layout
src/adapter.mts— entry point / CLI mode dispatch.src/server.mts— Codex app-server protocol layer.src/transports.mts— stdio / WebSocket / Unix-socket daemon / proxy.src/store.mts— SQLite thread/turn persistence (node:sqlite).src/*-runtime.mts+runtime-factory.mts— pluggable Claude backends.scripts/codex-shim— thePATHshim Codex App invokes.scripts/claude-codex-mode— host helper to switch backends.test/—node:testsuites againstdist/.
The repo also ships progressive AGENTS.md files (root + src/ + scripts/ + test/) for AI agents working in the codebase, plus a Claude Code guard hook in scripts/hooks/guard.mjs.
Docs site
This site is built with VitePress from docs/:
bash
npm run docs:dev # local preview with hot reload
npm run docs:build # static build -> docs/.vitepress/dist
npm run docs:preview # serve the built siteIt deploys to GitHub Pages automatically on push to main via .github/workflows/deploy-docs.yml.