Repository navigation
Contributor Guide
Contributing is the rules: how the repository is governed and what a pull request must carry. This page is the walkthrough — you want to fix a bug, add a feature or write a plugin, and need to know where to start, what to touch, and what will be expected of the change before it merges.
Get it running. Node 24 (nvm use reads .nvmrc), then:
npm install # rebuilds node-pty for the Electron ABI
npm run electron:serve # Angular dev server with live reload + the Electron shellnpm start on its own is the Angular dev server in a browser tab. Most of Studio needs the
Electron shell — anything that crosses the bridge is a no-op in a browser — so electron:serve is
the command you want. Dev launches share the installed app's profile; point STUDIO_USER_DATA_DIR at
a scratch directory if you would rather not.
Read three things first, in this order — they are short and everything below assumes them:
-
docs/agents.mdin the repository — the ten non-negotiables. These are enforced by ESLint, by specs, by CI or by review, and a change that breaks one is rejected whatever else it does. - Architecture — feature-first layout, kitchen vs recipe, the assembler.
- Runtime seams — the extension points. Almost every contribution is "plug into one of these"; a change that invents a new mechanism where a seam exists will be sent back to use the seam.
Claim the work. For anything bigger than a small fix, open or comment on an issue so the approach is agreed before the code is written. Studio has a lot of settled decisions (Decisions); proposing to reverse one is a conversation, not a PR.
src/features/<feature>/{angular,electron,api} ← one folder per tab view; imports only @shared and itself
src/shared/angular ← components, control atoms, services, the dock, the shell
src/shared/api ← contracts: IPC channel slices, the plugin manifest, protocols
src/shared/electron ← the main process and preload; nothing here names a feature
src/shared/app ← the composition root (config.ts is the feature list)
plugins/<name> ← first-party plugins: manifest, source, build script
e2e/ ← Playwright suites that drive the built Electron app
scripts/ ← plugin index verification, tarball packing, plugin typecheck
docs/ ← agents.md and generated per-release commit tables
Where a given kind of thing lives, so you know what to open:
| You want to change… | Look in | Seam |
|---|---|---|
| A tab view, its ribbon or its status strip | src/features/<feature>/angular/ |
4.1 Feature registry |
| A dock panel or a tab's default layout | the tab's DOCK_BLUEPRINT
|
4.2 The dock |
| Something the renderer asks the main process for |
src/shared/api/<domain>-channels.ts, its @Service() client, its main handler |
4.3 IPC |
| A keyboard shortcut | the view's activation lifecycle, Keybindings
|
4.5 Keybindings |
| A setting | src/shared/angular/services/settings/settings-registry.ts |
— |
| A form control | src/shared/angular/components/forms/ |
Conventions › Control atoms |
| Anything the agent can do or is stopped from doing | src/shared/electron/ai/ |
Agent access and permissions |
| A language server, debugger, decoder, container engine or AI provider |
plugins/<name>/, the curated catalogue |
Plugins |
| A modal or a pop-out window | the modal service / window manager | 4.12 Modal windows, 4.8 Multi-window |
A quick way to find the owner of something you can see: search for the label on the button or menu entry. Ribbon commands and menu items are plain strings in the feature's ribbon or commands file.
- Reproduce it in the running app, not just in your head. Note the exact steps; they become the How it was verified section of the PR.
- Find the owner. The label → feature folder → the view, service or main handler behind it. A bug that spans the bridge has two halves: check the main-process handler as well as the renderer.
-
Write the failing spec first. Specs sit beside the file they test (
foo.ts/foo.spec.ts). Name it for the behaviour the bug broke —method_condition_expectation— so the name reads as the regression it guards against. - Fix. Keep the diff to the bug: a fix PR that also renames things or reformats a file is harder to review and harder to revert.
- If the bug was an interaction (a click, a drag, a shortcut) rather than a computation, consider an e2e case too — a jsdom spec cannot see the native-menu path or a real window, which is how several fixes here passed their unit tests while the app stayed broken.
- Title it as the behaviour after the fix:
fix(dock): a collapsed gutter keeps its width, and putCloses #nin the body.
A setting is a SettingDef in SETTINGS_REGISTRY (settings-registry.ts): key, title, description,
a control (toggle, text, number, select, buttonGroup, …) and a default. The registry drives
the Settings view, so there is no template to write.
- Give it a
sinceof the version it ships in. The setup wizard uses that to decide which steps an upgrade shows. - Every setting needs a reader. A setting nothing consults is dead code and is rejected as such.
- Add a spec for the reader's behaviour under each value, not for the registry entry.
A ribbon is created in the shell's injector and drives the view through the feature's command
registry; the view registers its handler on activation, and its keybindings in the same lifecycle,
clearing both on deactivation. Chords use Mod (⌘ / Ctrl). ⛔ Never bind ⌘Z, ⌘⇧Z, ⌘X, ⌘C, ⌘V or ⌘A —
editing-chords.contract.spec.ts reads the feature sources and will fail the build. In the terminal,
only Mod+Shift chords.
This is the biggest kind of renderer change and the most templated. A feature is a folder under
src/features/<name>/ holding its view, optional ribbon, optional status component and a
<name>.feature.ts that exports the FeatureDescriptor; then one line in
src/shared/app/config.ts. That line is the only thing outside the folder allowed to know the
feature exists.
- The view must declare
tabIdandisActiveinputs (FeatureViewInputs) or Angular throws at mount (NG0303). - View status goes in the feature's
statuscomponent, which is created through the view's own injector. ⛔ Do not push it into the sharedStatusBar— that is for ambient, app-wide segments. - A feature imports
@shared/*and@features/<self>/*only. ESLint bans sibling features; the fix for a cross-feature need is to promote the shared surface to@shared, never a cross-import. - Look at a small existing feature first —
containersis a complete, compact example of view + ribbon + commands + status.
The renderer is untrusted and crosses to Node only through window.bridge. A new capability is:
- A channel slice in
src/shared/api/<domain>-channels.ts— the channel enum, payload types, and a<Domain>Clientinterface. This is the contract; it names no feature. - A main-process handler that validates every argument before acting. An
invoketo an unregistered channel rejects; nothing arriving from the renderer is trusted. - A
@Service()client inshared/angularwrappingwindow.bridge, exposing a nullable ops object so call sites do not care whether they are in Electron.
Spec the handler's validation (bad input is refused, not coerced) and the client's behaviour when the bridge is absent.
A plugin fills an existing slot — language server, debug adapter, decoder, container engine, agent
harness — and never adds UI. The whole contract is a manifest validated by parsePluginManifest;
Plugins covers the fields, the provisioning kinds and the catalogue.
-
Start by sideloading. Write
plugin.json, put the payload beside it, and install it through the Plugin Manager. The same validation and hash checks apply as to a catalogue entry, so a sideloaded plugin that works is a catalogue-ready one. -
First-party plugins live in
plugins/<name>/with abuild.mjs, atsconfig.jsonand their source;npm run typecheck:pluginstype-checks them all and CI runs it. A harness speaks the agent protocol over stdin/stdout (src/shared/api/agent-protocol.ts); a decoder speaks the decoder protocol. The reference harness,src/shared/electron/ai/testing/echo-harness.mjs, imports nothing. -
To get onto the catalogue, open an issue with the manifest and the reason. The catalogue is
curated: every entry is something Studio will download and execute. Before a catalogue change,
npm run verify:plugin-index -- --plugin <id>fetches the pinned artifact and checks its hash — no unit test can do that for you. - A harness plugin is released on its own tag,
plugin-<name>-v<version>; see Plugins › Releasing a harness plugin for the sequencing, which matters.
Three contracts are versioned, each with a spec that fingerprints its shape and fails when it changes without the version moving:
| Contract | Constant | Bump |
|---|---|---|
| Plugin manifest |
PLUGIN_API_VERSION in src/shared/api/plugin-manifest.ts
|
minor if it only grows; major if a field changes meaning, is removed or becomes required |
| Agent protocol |
AGENT_PROTOCOL_VERSION in src/shared/api/agent-protocol.ts
|
same rule; a harness declaring a newer minor is refused at the handshake |
| Decoder protocol |
DECODER_PROTOCOL_VERSION in src/shared/api/decoder-protocol.ts
|
same rule |
Bump in the same PR as the change, and record why in the comment block above the constant, as
the earlier bumps do. A breaking change adds ! after the PR title's scope and a BREAKING CHANGE:
paragraph. Remember that the first-party plugins in plugins/ are written against these contracts
too: a change here usually means a plugin change, a regenerated lockfile and a repinned catalogue.
The wiki is the documentation home and is its own repository
(git clone https://github.com/onix-labs/onixlabs-studio.wiki.git); it is maintained by admins, so
propose a change through an issue with the text. docs/agents.md holds only the non-negotiables and
changes rarely. A release also needs its entry in src/shared/api/release-highlights.ts — the
handful of user-facing headlines the setup wizard shows on upgrade.
These are the things review actually checks, roughly in the order they are checked.
-
Strict TypeScript. Explicit
public/protected/privateon every member; every parameter, return and local typed; noany. Genuine TSDoc on every member including private ones — a doc comment that restates the name is not documentation. Other comments say why; no commented-out code, no untrackedTODOs. -
Angular. Standalone, signals and
computed,OnPush,inject(), built-in control flow,protectedtemplate members. Templates use the control atoms (app-button,app-text-field,app-dropdown,app-checkbox,app-toggle, …), never a raw<button>,<input>,<select>,<textarea>, checkbox or radio. Where no atom fits, write the atom — the element is not inlined "just this once". A call site may pick a variant; it never restyles a control locally. -
The invariants.
sharednames no feature; a feature imports only@sharedand itself; the renderer crosses the bridge, never Node. ESLint catches the import ones; review catches the rest. - No dead code. No stubs or seed data on production paths, no unreferenced exports, no setting without a reader. If it is not used, it is not shipped.
- Size. A file drifting past ~500 lines or ~5 responsibilities gets decomposed, not extended.
The full text is on Conventions.
-
Vitest, spec beside the source, AAA with blank lines between the phases, one logical assertion
per test, named
method_condition_expectation, exercising behaviour through the public API rather than poking internals. -
Run one file while iterating:
ng test --include "**/foo.spec.ts". The whole suite isnpm test; the gate runsnpm run test:coverage. -
Coverage only goes up. The thresholds live in
angular.json(coverageThresholds) and sit just under the actual figures. A change that drops coverage below them fails CI, and the answer is tests, not a lower number. If your change raises coverage, you may raise the thresholds with it. -
Contract specs (
*.contract.spec.ts) fingerprint things a unit test cannot see: the manifest shape, the editing chords, design tokens, harness plugin pins. If one fails, it is telling you a rule was crossed — read its comment before touching it. -
E2E (
npm run e2e, Playwright driving the built app —npm run buildandnpm run build:electronfirst) is for interactions. It is not required to merge, but CI runs it and a red run will be looked at. Suites live ine2e/; the fixture ine2e/fixtures.tslaunches an isolated profile and skips the setup wizard unless a test opts in. ⚠️ Assertions through the CSS cascade (getComputedStyle) do not survive CI; assert the class or the attribute, not the computed pixel.
npm run lint is ESLint with typed rules, including the generated per-feature import bans;
npm run format:check is Prettier over ts, html, scss, json and md. Both must be clean —
there is no tolerated baseline of warnings. npm run lint:fix and npm run format fix what they can.
Run it before every commit, not just before the PR:
npm run format:check
npm run lint
npm run test:coverage
npm run build
npm run build:electronCI runs the same five, plus npm run typecheck:plugins, the e2e suite and a packaging smoke. If a
step cannot stay green, the change is too big — split it. Toolchain gotchas (aliases in styleUrl,
export type in barrels, esbuild and tsc) are on Build, test and tooling.
A green gate is not a working feature. Before opening the PR, run the change in the Electron shell and exercise it the way a user would — a cold start where relevant, a second window where relevant. Say what you did in the PR's How it was verified section; "tests pass" on its own is not a verification of a UI change.
- Title
type(scope): subject, subject stating the behaviour after the change, lower-case, no full stop. It becomes the commit subject and the release-note line. - Kind label:
feature,enhancement,bugordocumentation. - Fill in the template: what changes and why (with
Closes #n), how it was verified, the checklist ticked honestly. It is the same list as the pre-PR checklist. - One concern per PR. A series of dependent changes is a series of PRs, each saying what it builds on.
Recurring reasons a review asks for another round, so you can pre-empt them:
- A raw form element in a feature template instead of an atom.
- A cross-feature import, or feature knowledge leaking into
shared. - A
StatusBarsegment for view state; a view's status belongs in itsstatuscomponent. - A new mechanism where a seam exists (a bespoke registry, a hand-rolled table, a second modal system).
- A setting, export or stub with no reader.
- Coverage lowered to make the gate pass.
- A UI change with no account of it having been run.
- TSDoc that repeats the member name; comments that say what the next line does.
- Claiming one of the editing chords.
Using Studio
Contributing
How it works
- Architecture
- Runtime seams
- Agent access and permissions
- Agent MCP capabilities
- Agent surfaces, prompts and skills
- Source control
- Plugins
- Package managers
- Language servers — capability matrix
- Language servers — adding a server
- Setup wizard
- Container engines
Decisions