- Docs
- Project
- Contribute
Contributing
How to set up HeadlessOS for development, run it, run the tests and typechecks, and propose a change through a pull request.
Bug reports, parsers, fixes and docs are all welcome. HeadlessOS is MIT licensed, and by contributing you agree to license your work the same way.
AGENTS.md in the repository has the full rules for code, security and the UI.
Set up
Section titled “Set up”You need Node.js 20 or later and npm 9 or later. Docker is optional and gives you a test server.
Fork the repository, then:
git clone https://github.com/<your-user>/headlessos.gitcd headlessosnpm install # also installs the commit-message hookcp .env.example .env # needed even without a keynpm run build --workspace=shared # once, before the first typecheck.env lives at the repository root. The dev server loads it with --env-file, and Node stops if the file is missing.
Run it
Section titled “Run it”npm run dev # backend on :3001, app on http://localhost:3000For a server to connect to, start the test container:
cd dev && docker compose up -dIt serves SSH on 127.0.0.1:2222, with user testuser and password testpass. On macOS you can use dev/vm.sh start instead, which runs a Lima VM.
You don’t need an LLM key. Parsing still works with the deterministic parsers. To run the UI Agent on scripted replies, set LLM_PROVIDER=fake in .env. It only takes effect when no provider is set up.
To try the desktop app, run npm install once in electron/, then:
npm run test:prod # build the client, bundle the server, launch Electronnpm run build:dist:win # package it; also build:dist:mac and build:dist:linuxProject layout
Section titled “Project layout”| Folder | Holds |
|---|---|
server/ | Fastify backend in TypeScript |
client/ | React and Vite frontend |
shared/ | Types and Zod schemas used by both |
electron/ | Desktop app, with its own install |
dev/ | Local test server |
docs/ | Phase specs, decisions, task tracker |
See Architecture.
Test and typecheck
Section titled “Test and typecheck”npm test # server suite, then client suitenpm run test:server # one suite on its ownnpm run test:client
cd server && npx vitest run tests/config/session-store.test.ts -t "permissions"npm test joins the suites with &&, so a server failure skips the client suite.
Vitest strips types without checking them, so run the typechecks too:
npx tsc --noEmit -p servernpx tsc --noEmit -p clientThese fail with TS6305 until you have built shared once. No linter or formatter is set up.
Propose a change
Section titled “Propose a change”The project is documentation-first:
- Start with an issue. Open one in the issue tracker, even for a small fix. We’ll find or add its task.
- Spec first. A change starts in a phase doc in
docs/phases/, with a task ID and a row indocs/PROGRESS.md. - Decisions. An architectural decision gets an entry in
docs/DECISIONS.mdbefore the code. - Code and tests. Every change has tests.
- The record. Add an “as built” section to the phase doc, update the
docs/PROGRESS.mdrow, and add an entry todocs/TRACEABILITY.md.
Commit format
Section titled “Commit format”A hook checks the first line of each commit message:
<type>(<task-id>): <description>- Types:
feat,fix,refactor,docs,test,chore. - Task ID: one per commit, as listed in
docs/PROGRESS.md. The hook accepts forms likeM<number>.<number>andEX<number>.<number>.
Merge commits are exempt.
Before you open a pull request
Section titled “Before you open a pull request”Run what CI runs: the two typechecks and both test suites. CI uses Node 20 on Ubuntu and runs npm ci first. It runs on every pull request and on pushes to main.
For a UI change, say what you checked in the browser and how, including sizes, spacing, and light and dark themes.
Rules reviews hold to
Section titled “Rules reviews hold to”- TypeScript. Strict mode, no
anyunless it can’t be avoided, and async/await. - Boundaries. Data that crosses a boundary has a Zod schema.
- Frontend. Functional React components, Zustand for state, Tailwind for styles.
- Shell commands. Never put user input or model output into a shell command. Agents call typed actions, and the runner builds and quotes the command.
- Server output is data, never HTML. React renders it, and terminals go through xterm.js.
- Secrets never go into code, tests, docs or commits. Use obvious fakes in tests.
To report a vulnerability, follow Security model. Please don’t open a public issue.
Where to add things
Section titled “Where to add things”| Adding | What it takes |
|---|---|
| A parser | See Add a parser |
| A capability that touches a server for agents | A new action in server/src/agent/actions/catalog/, plus a row in server/tests/agent/actions/catalog.test.ts |
| A desktop app | An entry in client/src/lib/apps.ts, a case in WindowManager.tsx, and a route plugin registered in server/src/index.ts |
| A per-server route prefix | Also add it to dataRoutePattern in server/src/index.ts, so auto-reconnect covers it |
A good first change is a deterministic parser for a Linux command that doesn’t have one yet.