Contributing
This page is the public contributor guide for AICodeReviewer. It covers the
repository layout, local development setup, the test and validation matrix,
and the common contribution workflows. The repository’s AGENTS.md holds the
always-on rules, guardrails, environment notes, and the list of known
codebase pitfalls to avoid reintroducing — read it before larger changes.
Repository layout
Section titled “Repository layout”| Path | Purpose |
|---|---|
packages/* |
Runtime TypeScript packages (CLI, core, server, agents, sandbox, outputs, mcp-output, llm, vcs, store, eval). Managed with pnpm workspaces and TypeScript project references. |
docs/site |
This documentation site (Astro Starlight, English + 简体中文). An isolated workspace package; not part of the runtime. |
docs/ (other) |
Topical reference modules (e.g. output channels) consulted while writing these pages. |
example/ |
Deployment sample: config.yaml, .env.sample, Compose stack, trigger scripts. |
deploy/ |
Dockerfile, deploy.sh, and related deployment assets. |
eval/ |
Permanent eval CLI test fixtures. |
AGENTS.md |
Always-on contributor guidance, guardrails, and known codebase pitfalls. |
.agents/skills/ |
Repeatable workflow skills (audit, deployment, maintenance, etc.). |
Development setup
Section titled “Development setup”Requirements:
- Node.js
>= 20(Node 22 userspace is used by the deployment image). - pnpm.
# From the repository rootpnpm installpnpm buildTest and validation matrix
Section titled “Test and validation matrix”Run these before proposing a change. On Linux/CI use the pnpm scripts; on
Windows PowerShell invoke the Node binaries directly as above.
| Step | Linux/CI | Windows PowerShell |
|---|---|---|
| ESLint | pnpm lint |
node node_modules/eslint/bin/eslint.js . |
| Typecheck | pnpm typecheck |
node node_modules/typescript/bin/tsc -b tsconfig.json --pretty false |
| Unit tests | pnpm test |
node node_modules/vitest/vitest.mjs run |
| Markdown lint | pnpm markdownlint |
node node_modules/markdownlint-cli2/markdownlint-cli2.mjs "**/*.md" "!**/node_modules/**" "!**/dist/**" "!**/coverage/**" |
| Build | pnpm build |
cmd /c "pnpm build" |
| Eval fixture validation | pnpm eval:validate (after build) |
node packages/cli/dist/index.js eval --validate-only |
| Docs build | pnpm docs:build |
pnpm docs:build |
pnpm eval:validate runs aicr eval --validate-only, which checks eval/*.json
shape and expected-problem contracts only — no LLM, no config secrets. A full
aicr eval run loads config and calls the LLM, so keep it as a separate
environment-specific benchmark job.
Changes that affect config shape, agent adapters, MCP tool contracts, output
rendering, deployment behavior, or public workflow must update the matching
docs, example/config.yaml, and example/README.md in the same change.
Adding a package
Section titled “Adding a package”- Create the package directory under
packages/<name>/with its ownpackage.json,tsconfig.json,src/, andtest/. - Add the package to
pnpm-workspace.yaml(the workspace already globspackages/*, so this is usually automatic). - Add a TypeScript project reference from the root
tsconfig.jsonand from any package that consumes it; add a reference back from the new package’stsconfig.jsonto its dependencies. - Add at least a
test/index.test.tsso the package has a test surface, even if it only exports a constant. - Add the new
onlyBuiltDependenciesentry topnpm-workspace.yamlif the package introduces a native module (pnpm 10 gates native builds behindonlyBuiltDependencies).
Adding or changing a config field
Section titled “Adding or changing a config field”The Zod schema in packages/core/src/config.ts is the source of truth.
- Update the schema (and any
superRefinecross-field validation). - Add or update a test in
packages/core/test/config.test.ts. - Update
example/config.yamlwith a commented example. - Update the relevant narrative page under
docs/site/src/content/docs/.../configuration/and the field table in Configuration fields. - If the field changes runtime behavior, update
example/README.mdand the matching topical doc.
Workspace config files cannot write system-level fields; respect the
cache / defaults / instances three-part shape and the
global → workspace-default → workspace-instance override order.
Adding an output channel
Section titled “Adding an output channel”- Implement the dispatcher in
packages/outputs/src/and register it in the output registry. The channelkindis a free-form string constrained by the registry (not a closed enum). - Add built-in Handlebars templates for the problem and summary variants under the template engine.
- Add tests, including the IM-markdown transformer if the channel is an IM
bot (table regexes must not use the
gflag with.test()). - Document the channel in Output channels and add its fields to Configuration fields.
- Update
example/config.yamlwith a commented example.
See Output channels for the problem schema, summary schema, channel mapping, and the no-problems policy that every channel must respect.
Maintaining the docs site
Section titled “Maintaining the docs site”The docs site is bilingual (English under .../en/, 简体中文 under
.../zh-cn/). Every user-facing page exists in both locales; keep config
keys, commands, paths, field names, and enum values identical across locales.
- Build and validate locally with
pnpm docs:build. The build enforces the public/internal boundary: pages undersrc/content/docs/must not reference the internal AI/roadmap documentation tree or carry migration-source maintenance notes. - Sidebar slugs omit the
indexsegment (e.g.troubleshooting/index.mdhas slugtroubleshooting). Frontmattertemplateonly acceptsdocorsplash; Starlightsocialis an array of link items. - Content pages use
.md. The two landing pages (en/index.mdx,zh-cn/index.mdx) use.mdxso they can render Starlight components (hero frontmatter plusCard,CardGrid,LinkCard,Steps,Aside). MDX is provided by Starlight with no extra integration; components never render in plain.md. The public-content validator scans both.mdand.mdx. - Cross-links use locale-prefixed paths (
/en/...,/zh-cn/...).
When you change a config shape, output contract, or runtime behavior, update both locales’ relevant pages in the same change.
Workflow rules
Section titled “Workflow rules”- Keep edits minimal and surgical; do not weaken lint, typecheck, test, or markdown gates to land a change.
- All temporary task artifacts (scratch scripts, debug logs, one-off reports,
benchmark output) go under
build/, never in the repository root,eval/, or a package directory. - Public/shared modules (
packages/cli/src,ReviewEvent, template context) must stay platform-neutral — import canonical schemas from@aicr/coreand keep provider/channel-specific names inside config contracts, docs, tests, and platform-specific adapters.
For the full, always-on contributor rules — including the numbered list of
known codebase pitfalls to avoid reintroducing — read AGENTS.md at the
repository root.