`matcha add` covered three capabilities against a framework that has shipped
several more, and one of the three did not work.
`ws` and `upload` are new. Both 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 rather than when it 501s.
The `sse` stub predates 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 `last-event-id` to
resume — verified end to end, a reconnect at id 41 resumes at 42.
`buffer` returned `Buffer.from('hello')` and never could have worked: the
capability is named for the *transport*, `TransformerFn` returns `body: string`,
and the default `JsonTransformer` is `JSON.stringify` — so the route answered
`{"type":"Buffer","data":[104,...]}`. It now demonstrates `@Transformer`, which
is what actually governs a whole-response route, and answers `text/csv`.
`add` refused to act when a project had more than one controller. It still
refuses to guess, but it lists the candidates and `--controller <path>` is the
way through.
The starter smoke now adds every capability and type-checks them together, and
caught what unit tests could not: `MultipartBody` in a decorated signature is
TS1272 under `isolatedModules` + `emitDecoratorMetadata`, so the handler
compiled on node and bun and failed on Deno. Types in decorated signatures now
go through `wire::add_type_import`, and `find_named_imports` became type-aware
in both directions — merging a value symbol into an `import type` line would
erase the decorator at runtime.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012x1UPw987zNSxjH2DxHy2C
matcha
The green-tea CLI — scaffold, run, and generate green-tea apps from a single native binary. No JS runtime required to install or operate.
Install
cargo install matcha-cli
Builds from crates.io and installs the matcha
binary. Needs a Rust toolchain; takes a few seconds.
Prebuilt binary (no Rust), from the latest GitHub release:
curl -fsSL https://raw.githubusercontent.com/Expressive-Tea/matcha/main/install.sh | sh
Drops the binary in ~/.local/bin. Env vars go on the sh side of the pipe:
curl -fsSL …/install.sh | MATCHA_VERSION=v26.7.0 MATCHA_INSTALL_DIR=/usr/local/bin sh
From git (compiles the default branch):
cargo install --git https://github.com/Expressive-Tea/matcha
Usage
matcha new my-api # scaffold from the official starter
matcha new my-api --template-url gh:owner/repo # scaffold from any git template
matcha run # detect node/deno/bun and run in watch
matcha create controller Users # generate + auto-wire into @Module
matcha add sse # add a capability to your controller
matcha graph # draw the dependency graph
matcha explain /users/:id # one route's chain, in execution order
The starter
matcha new <name> (no flags) scaffolds a live app: it serves an index.html
with the green-tea logo and streams a rotating zen message over @Sse('/zen').
Open the browser and it's already alive — matcha run boots it.
The graph is composed in src/app.ts, which exports the app; src/main.ts
imports it and binds a port. The split is what lets matcha graph and
matcha explain read your application without starting a server.
The @green-tea/core version is pinned exactly, not with a caret. Core is
prerelease-only, and npm's semver excludes a prerelease from any range whose
comparators carry a different major.minor.patch — so ^26.7.0-beta.0 never
resolves past 26.7.0-beta.0 however many betas ship after it. CI scaffolds,
installs, boots and introspects a real starter on every runtime, and a weekly
job fails when the pin falls behind the beta dist-tag.
Introspection
green-tea derives execution order from what each node declares it needs and
provides, so the graph is a real artifact rather than a diagram someone drew.
matcha graph prints it and matcha explain prints one route's slice of it.
matcha graph # Mermaid (default)
matcha graph --format dot # Graphviz
matcha graph --format json # the raw GraphView
matcha graph --out docs/graph.mmd # to a file instead of stdout
matcha explain /users/:id # providers → steps → handler, with needs/provides
Both import src/app.ts (override with --entry) and call app.ready(), which
resolves the graph and deliberately does not run provider factories — asking
for a diagram will not open your database connections. Your dependencies have to
be installed, since this runs your code under your runtime.
explain takes the route pattern as declared, not a concrete URL:
/users/:id, not /users/42. A miss lists the patterns that are registered.
add capabilities
| generates | |
|---|---|
sse |
@Sse stream tagged with sse(data, { id }), reading @header('last-event-id') to resume |
ws |
@Ws duplex handler: consume @inbound(), return a channel() — needs ws on Node |
stream |
@Stream chunked response |
upload |
@Post with @body(): MultipartBody — needs busboy |
buffer |
@Get with a custom @Transformer shaping the whole response |
matcha add <cap> edits the only controller under src/controllers; with more
than one it refuses and lists them, and --controller <path> picks. Repeats are
no-ops. Both peer dependencies are lazy-loaded by core, so neither is needed to
compile — only to serve the route.
create / add auto-wiring
create and add edit your TypeScript with tree-sitter: they insert imports
and wire pieces into the right @Module array or controller. Edits are
idempotent and revert themselves if they would break the file's syntax. Pass
--check to create to type-check with your project's runtime afterward.
Runtime detection
matcha run picks the runtime by precedence, first match wins:
matcha.toml—runtime = "node" | "deno" | "bun"deno.json/deno.jsonc→ denobun.lockb/bun.lock→ bunpackage.json→ node
Edge is a deploy target, not a matcha run target.
Development
cargo test # unit + CLI integration
scripts/starter-smoke.sh node # scaffold, install, type-check, boot, introspect
scripts/starter-smoke.sh deno # (also bun) — needs that runtime installed
starter-smoke.sh is the check that cargo test cannot be: cargo test proves
the CLI writes the files it means to write, not that those files describe a
project the current core will run.
License
MIT — same as the green-tea framework. Contributions require a DCO sign-off (git commit -s).