Files
matcha/CONTRIBUTING.md
T
chrnx 5c8f72b409 feat(openapi): the OpenAPI document, and the paperwork the crate shipped without
`Cargo.toml` has declared `license = "MIT"` since the first release and the
published crate carried no license text, so anyone vendoring the source had the
claim without the grant. `LICENSE` is that text. `DCO` is the certificate the
README has been requiring a sign-off against without shipping, and
`CONTRIBUTING.md` says how — including that GitHub is a mirror of `main` and
tags, so a pull request there is carried upstream by a maintainer rather than
merged, which would put the two forges out of sync.

`CHANGELOG.md` reconstructs 26.7.0 and 26.8.0-beta.0 from their tags. The CLI
ships on its own version line, so the header says what that does and does not
mean about the core version a scaffold is pinned to, and each entry says when
that pin moved.

`matcha openapi` prints core's structural OpenAPI 3.1 for the route table —
`--title`, `--api-version`, `--out`. It reuses the entry resolution and the
generated-script runner that `graph` and `explain` already had, so it is the
same `app.ready()` that resolves the graph without booting providers. Structural
is the honest word: paths, methods and parameters come from the decorators, and
nothing invents a response schema.

The loose end from the capability table is closed. `cli.rs` still carried its own
copies of the `create` kinds and the `add` capabilities, so adding either meant
editing two files that could disagree — a value the parser accepts and the
dispatcher rejects. Both now read the list from the module that owns it, and the
three `create` piece kinds became rows in a table rather than near-identical
match arms, which also retires a `too_many_arguments` allow.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
2026-09-05 16:01:49 -05:00

6.3 KiB

Contributing to matcha

matcha is the green-tea CLI. It is open source, but nobody pushes directly — changes land through reviewed pull requests with a DCO sign-off.

Where to send your changes

Development happens on a private Gitea instance. GitHub is a downstream mirror: the promote workflow pushes main and version tags to it and nothing else, so there is no develop there and no long-lived branch for contributions.

From GitHub: open your pull request against main and say in the description that it is a contribution rather than a release. A maintainer carries the commits upstream into Gitea's develop with your authorship and your sign-off intact, and the change reaches GitHub again through the normal promotion. Nothing is merged into the GitHub main directly — that would put the two forges out of sync and break the next release push.

From Gitea, if you have access: follow the branch model below.

Developer Certificate of Origin (DCO)

We use the Developer Certificate of Origin instead of a CLA — a per-commit affirmation that you have the right to submit your work under this project's license. No copyright assignment, no paperwork.

Every commit must be signed off:

git commit -s -m "fix(wire): keep a type import out of the value brace"

That appends Signed-off-by: Your Name <your@email>, which has to match your commit author. Forgot it on the last commit:

git commit --amend -s
git push --force-with-lease

Working with AI assistance

Use one if it helps. There is no permission to ask for and nothing to declare.

What we do ask is that you read what it hands you before it becomes a pull request. Every line here is reviewed by a person, by hand, and usually that person is one person. A diff its own author has not read moves that work onto them and turns review into proofreading, which is the thing review is worst at.

What assistants tend to get wrong in this repository in particular:

  • They test the CLI instead of its output. cargo test proves matcha writes the files it means to write. It cannot prove those files describe a project that runs. That gap is why the templates sat two core releases behind for two months with a green build. scripts/starter-smoke.sh is the check that closes it; run it for the runtime you touched.
  • They write for Node and assume the rest follows. matcha scaffolds for node, deno, bun and the edge, and the four differ in ways that bite. A generated handler that compiles under tsc can still be TS1272 under Deno's isolatedModules + emitDecoratorMetadata.
  • They reach for a crate. matcha has four dependencies and reads TOML and JSON with line scans on purpose. A new dependency for a value that is always written one per line is not a trade worth making.
  • They pin @green-tea/core with a caret. Core is prerelease-only, and npm excludes a prerelease from any range whose comparators carry a different major.minor.patch. A caret there is a pin to the oldest matching prerelease that nothing can move off. There is a test for this.
  • They delete comments they read as redundant. A comment here usually carries reasoning the code cannot show on its own — why a marker is a route literal rather than a decorator name, why the edge scaffold installs from JSR.

Where you are unsure, say so — not as a disclosure, as a pointer. "I did not run the bun leg" tells a reviewer where to spend their attention.

None of this changes the sign-off. Signed-off-by says you have the right to submit the work under this project's license, and that stays true however the text was produced.

Branch model (GitFlow)

  • main — production-ready, protected. No direct pushes. Tags are cut here.
  • develop — active development, protected. Feature branches merge here.
  • feature/<name> — branch from develop.
  • hotfix/<name> — branch from main.
  • release/<version> — release stabilization.

Commits

Follow Conventional Commits: feat:, fix:, chore:, docs:, test:, refactor:, ci:. Focus the message on the why. Do not add AI co-authoring attribution.

Anything user-visible gets a CHANGELOG.md entry under ## [Unreleased], in the same voice as the entries around it: what changed, and what it was before.

Local setup

A stable Rust toolchain is all that is required to build and test the CLI:

cargo build
cargo test

The starter smoke needs the runtime it exercises — node, deno, bun or wrangler (which npm install brings in for the edge scaffold). You are not expected to install all four to fix a typo; you are expected to run the one your change touches, and to say which in the pull request.

cargo build
scripts/starter-smoke.sh node     # also: deno, bun, edge

It scaffolds into a temp directory, installs, type-checks, boots, curls / and the /zen stream, runs matcha graph/explain, then adds every matcha add capability and type-checks them together. It picks a random high port, so it does not collide with a server you already have running; PORT=4567 scripts/starter-smoke.sh node overrides.

Before you open a pull request

Run what CI runs:

cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test --locked
scripts/starter-smoke.sh <the runtime you touched>

CI runs the smoke for all four runtimes on a matrix, plus a weekly core-freshness job that fails when CORE_VERSION in src/template.rs falls behind core's beta dist-tag.

Non-trivial logic leaves a check behind. Not a suite — the smallest thing that fails if the logic breaks. A generator gets a test that the generated code carries what it must; a parser gets a test for the case that motivated it.

Reporting issues

Bugs and feature requests go to GitHub issues. A report that says what you ran, what you expected, and what happened — with the runtime and the matcha version from matcha --version — is worth several that do not.

Defects in the framework itself belong in the green-tea repository, not here.

Code of conduct

Be decent. Assume good faith, keep criticism about the code, and take the hint when someone asks you to drop it.