Skip to content

Contributing to zer0-CMS

How to set up, the rules the build enforces, style, tests, and how to report a problem — for anyone sending a change to zer0-CMS.

Thanks for wanting to help.

Getting set up

npm install
npm run compile   # type-check + lint + all five bundles
npm run watch     # then press F5 in VS Code to launch the Extension Host
npm test          # unit + golden + MCP stdio + integration

The fast inner loop skips the VS Code download: npx tsc -p . --outDir out, then npx mocha --ui tdd over the fourteen pure-Node suites listed in AGENTS.md. It needs Node >= 22.12, because the engines seam is an ESM package reached through require(esm).

The platform (content/) and the studio (web/) have their own commands in AGENTS.md; in Docker, docker compose --profile content up -d --wait → http://localhost:8000/studio/. See docs/CICD.md.

The rules that are not negotiable

These are enforced by the build, so you will find out quickly, but knowing them up front saves a round trip.

  1. src/core/ and src/mcp/ must not import vscode. They are pure Node. eslint blocks the import, and the MCP bundle — which marks nothing external — turns it into a build error. If core needs something from the editor, take it as a parameter or an injected callback.
  2. No shipped runtime dependencies (decision D3, as amended by D14). The extension ships with an empty dependencies block and that is a feature: this tool holds a publish gate. A build-time library may be bundled from devDependencies only when it is named in that target's allow-list in esbuild.js — today @bamr87/fleet-engines and its yaml, into dist/extension.js alone — and the MCP bundle allows no bare import at all. @anthropic-ai/claude-agent-sdk remains the optional, dynamically imported exception, off by default. Hand-roll the rest against Node's stdlib.
  3. No innerHTML in src/webview/. Build DOM with el() and assign text with textContent. Content comes from user files; the CSP is a second line of defence, not the first.
  4. No any, no @ts-ignore, no empty catch {}. If you must swallow an error, say why in a comment and return a fallback.
  5. The webview is UI, never the gate. A button posts an intent and a target. Every check — publish-allow, brand guard, ledger, draft status, required fields — is re-run host-side in the same function the command palette calls. A check that exists only in a webview is decoration.

Style

  • Conventional Commits: type(scope): description — feat, fix, docs, refactor, test, chore, ci, style.
  • Branch from main and open a PR. Never push to main.
  • README-First, README-Last: read the nearest README.md before changing a directory, and update it after.
  • One paragraph per line in markdown — CI enforces it with tools/unwrap-prose.py, skipping SCHEMA.md and CHANGELOG.md; the matching local gate is python3 tools/unwrap-prose.py --check --exclude '(^|/)SCHEMA\.md$' --exclude '(^|/)CHANGELOG\.md$'.
  • Every source file opens with a short block comment saying what it is and why it exists.

Tests

  • src/core/** is covered by plain unit tests that need no extension host.
  • src/test/fixtures/golden/** holds cross-lane fixtures generated by the Python publishing lane. The ledger bytes, publish previews and worklists must match it byte-for-byte, because both lanes write the same files in the same repos. Regenerate goldens with their own generator — generate.py for the ledger and worklist pair, node src/test/fixtures/golden/{engines,lanes,platform}/generate.mjs for the rest — and never hand-edit one to make a test pass. If a golden test fails, decide first whether the bug is in our serializer.

Where things live

The top-level layout is in AGENTS.md, and docs/README.md indexes every document, including each product directory's own README.md. The repository gates under tools/ are check-config-docs.py (the generated settings tables in docs/CONFIG.md and the docs index), docs_index.py (the index itself, vendored from the hub) and unwrap-prose.py (one paragraph per line).

Reporting things

Bugs and feature requests: https://github.com/bamr87/zer0-CMS/issues. A small reproduction — a zer0.json and one content file — is worth more than a long description.