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>
This commit is contained in:
chrnx committed 2026-09-05 16:01:49 -05:00
1 parent a3250da225
commit 5c8f72b409
12 files changed
+542 -47

No files matched your search

+150
View File
@@ -0,0 +1,150 @@
# Changelog
All notable changes to `matcha-cli` are documented here.
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
matcha uses calendar versioning: `YY.M.PATCH` — the month is not zero-padded, matching
green-tea's convention. **The CLI ships on its own version line**: `matcha` 26.8 does not
mean `@green-tea/core` 26.8, and the two release independently. The core version a scaffold
is pinned to is `CORE_VERSION` in `src/template.rs`, and each entry below says when it moved.
## [Unreleased]
### Added
- **`matcha graph` and `matcha explain <pattern>`.** green-tea derives execution order from
what each node declares it `needs` and `provides`, which makes the graph a real artifact
rather than a diagram someone drew — and the CLI could not draw any of it, though
`toMermaid`, `toDOT`, `graph` and `explain` had been exported all along. `graph` prints
Mermaid, Graphviz DOT or the raw `GraphView` (`--format`, `--out`); `explain` prints one
route's chain in execution order with each node's needs and provides.
Both import the app and call `app.ready()`, which resolves the graph and is documented as
deliberately *not* running provider factories — asking for a diagram must not open your
database connections. `explain` takes the route pattern as declared (`/users/:id`, not
`/users/42`), and a miss lists the patterns that are registered.
- **`matcha doctor`** — the misconfigurations that fail confusingly rather than loudly:
`experimentalDecorators` missing, which turns every `@Route` into a syntax error that
blames the decorator; a core pin that cannot resolve, or that does not match what is
installed; an entry that does not export `app`; and `@Ws` or multipart routes whose
lazy-loaded peer dependency is absent, which compile and then fail at the first request.
Every check is a file read — no runtime spawned, nothing fetched — so it works before the
project installs. Exits non-zero on a failure.
- **`matcha new --runtime edge`** — a Cloudflare Worker: `wrangler.toml` with
`nodejs_compat`, `edgeHandler(app)` as the default export, and wrangler's `[assets]`
serving `./public`, so `/` is the same page as on the other three runtimes and `/zen` the
same stream from the worker. `matcha run` is `wrangler dev`, which boots real workerd, so
edge stops being a deploy-only target. Detection puts `wrangler.toml` ahead of
`package.json`, since an edge project has both.
Core is installed from **JSR** on this runtime alone. The npm ESM build carries tsup's
`createRequire(import.meta.url)` banner at module scope and `import.meta.url` is undefined
on workerd, so `@green-tea/core/edge` from npm throws before any of its own code runs
([green-tea#93](https://github.com/Expressive-Tea/green-tea/issues/93)). The scaffolded
`.npmrc` says so; it and the alias can both go once that is fixed.
- **`matcha add ws` and `matcha add upload`**, and **`--controller <path>`**. `add` used to
refuse outright when a project had more than one controller; it still declines to guess,
but it lists the candidates and the flag picks. Both new capabilities name the optional
peer dependency they need on success — core lazy-requires `ws` and `busboy`, so a missing
one is an error at the first request rather than at boot, and the moment to mention it is
when the handler is written.
- **`scripts/starter-smoke.sh`** — scaffolds, installs, type-checks, boots, curls `/` and the
`/zen` stream, introspects, and adds every capability, per runtime. CI runs it on a matrix
of all four, and a weekly job fails when the scaffold's core pin falls behind the `beta`
dist-tag.
### Changed
- **The scaffold composes its graph in `src/app.ts`.** `src/main.ts` now holds only the
runtime's serve call and imports the app from it. The split is what lets `graph`, `explain`
and `doctor` read an application without binding a port. `create module` follows, preferring
`src/app.ts` and falling back to `src/main.ts` so projects scaffolded before the split keep
working.
- **`add sse` generates a resumable stream.** The stub predates green-tea 26.9: it yielded
bare values, so an `EventSource` reconnect restarted the iterable from its beginning and
lost the gap in silence. It now tags each event with `sse(data, { id })` and reads
`@header('last-event-id')` to resume from it.
- **`add buffer` demonstrates `@Transformer`.** It used to return `Buffer.from('hello')`,
which is not what the capability's name means — "buffer" is the *transport*, the whole
response at once — and never worked: `TransformerFn` returns `body: string` and the default
`JsonTransformer` is `JSON.stringify`, so the route answered
`{"type":"Buffer","data":[104,...]}`. It now shapes a `text/csv` response through the
extension point that actually governs one.
- **Types in a decorated signature are imported with `import type`.** `wire`'s import
handling became type-aware in both directions: merging a value symbol into an
`import type` line would erase the decorator at runtime, and merging a type into a value
line is TS1272 under `isolatedModules` with `emitDecoratorMetadata` — which node's and
bun's `tsc` accept and Deno rejects, so the same generated handler compiled on two runtimes
and failed on the third.
### Fixed
- **The scaffold no longer pins `@green-tea/core` two releases behind.** Every runtime
overlay carried `^26.7.0-beta.0`. Core is prerelease-only, and npm's semver excludes a
prerelease from any range whose comparators carry a different `major.minor.patch` — so that
caret was not a loose pin but a pin to the oldest matching prerelease that nothing could
move off. Every project `matcha new` produced since July installed 26.7.0-beta.0 and could
not upgrade to it: no logger, no request budget, no resumable `@Sse` id, and none of the
crashes 26.9 fixed. The pin is exact now, lives in one `CORE_VERSION` constant, and the
scaffold is on **26.9.0-beta.1**.
- **The Deno scaffold resolves core through JSR** rather than `npm:`. JSR is core's native
path for Deno and the one green-tea 26.9 repaired; the npm build's `createRequire` banner
never existed there, which is what used to break `@Html` and multipart at boot.
- **The bun scaffold type-checks.** Its `tsconfig.json` declared no Bun types, so `Bun.serve`
was `TS2868: Cannot find name 'Bun'` — meaning `tsc --noEmit`, and therefore
`matcha create --check`, failed on every bun project the CLI has ever scaffolded.
- **`MIT` is a file, not just a manifest field.** `Cargo.toml` declared `license = "MIT"` and
the published crate carried no license text. Added along with the `DCO` the README has been
requiring sign-off against, and a `CONTRIBUTING.md` saying how.
## [26.8.0-beta.0] - 2026-08-07
### Added
- Publishing to crates.io via OIDC Trusted Publishing — no token in CI.
### Changed
- The crate is `matcha-cli` on crates.io (the name `matcha` was taken); the installed binary
stays `matcha`, so `cargo install matcha-cli` still gives you `matcha`. Two-forge CI/CD:
Gitea is origin, GitHub is the public mirror that release tags are promoted to.
### Fixed
- The README's install paths point at hosts that actually resolve.
## [26.7.0] - 2026-07-13
First tagged release. A single native binary, no JS runtime needed to install it.
### Added
- **`matcha new`** — scaffolds from an embedded starter that is alive on first boot: it serves
an `index.html` and streams a rotating zen message over `@Sse('/zen')`. `--runtime` picks
node (the default), deno or bun through a shared template plus a per-runtime overlay;
`--template-url` scaffolds from any git template, with a `gh:owner/repo` shorthand.
- **`matcha run`** — detects the runtime and spawns it in watch mode. Precedence, first match
wins: `matcha.toml`, then `deno.json`, then a bun lockfile, then `package.json`.
- **`matcha create <controller|step|provider|module>`** — generates the piece and wires it in
with tree-sitter: imports merge into an existing brace rather than adding a second binding
for the same module, and an edit that would break the file's syntax reverts itself instead
of being written. `--check` type-checks afterwards with the project's own runtime.
- **`matcha add <sse|stream|buffer>`** — appends a capability handler to the controller,
idempotent per capability.
- **A `curl | sh` installer** with sha256 verification, and cross-platform binaries attached
to each release.
[Unreleased]: https://github.com/Expressive-Tea/matcha/compare/v26.8.0-beta.0...HEAD
[26.8.0-beta.0]: https://github.com/Expressive-Tea/matcha/compare/v26.7.0...v26.8.0-beta.0
[26.7.0]: https://github.com/Expressive-Tea/matcha/releases/tag/v26.7.0