Files
matcha/.github/workflows/ci.yml
T
chrnxandClaude Opus 5 827e6863ad feat(graph): draw the graph, and stop scaffolding a two-month-old core
The CLI's last feature work was 12 July; core has shipped 26.8 and 26.9 since.
Two consequences, fixed together because they share an entry-file convention.

Every runtime overlay pinned `^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 is not a loose pin, it is a pin to
the oldest matching prerelease that nothing can move off. Every project
`matcha new` has produced since July installed 26.7.0-beta.0 and could not
upgrade: no logger, no request budget, no resumable `@Sse` id, and none of the
crashes 26.9 fixed. The pin is now exact, lives in one `CORE_VERSION` const,
and Deno resolves through JSR — which is core's native path for Deno and the
one 26.9 repaired.

Nothing caught that because CI never ran JavaScript. `cargo test` proves the CLI
writes the files it means to write; it cannot prove those files describe a
project the current core will run. `scripts/starter-smoke.sh` scaffolds,
installs, type-checks, boots, curls `/` and the `/zen` stream, and introspects a
real starter per runtime; a weekly job fails when the pin falls behind the
`beta` dist-tag. The smoke immediately found a second defect: the bun overlay
carried no Bun types, so `tsc --noEmit` — and therefore `matcha create --check`
— failed on every bun project the CLI has ever scaffolded.

`matcha graph` and `matcha explain <pattern>` close the widest gap in the
surface: the framework's claim is that an API is a graph rather than a
middleware chain, `toMermaid`/`toDOT`/`graph`/`explain` have been exported all
along, and the CLI could not draw any of it. Both reach the app through
`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. Formatting lives in the generated script rather than in Rust,
which keeps serde out for output `console.log` already has the values for.

That needed an app the CLI can import without binding a port, so the starter
now composes the graph in `src/app.ts` and leaves `src/main.ts` holding only
the serve call. `create module` follows, preferring `src/app.ts` and falling
back to `src/main.ts` so projects scaffolded before the split keep working.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012x1UPw987zNSxjH2DxHy2C
2026-09-05 14:30:19 -05:00

78 lines
2.9 KiB
YAML

name: CI
# Rust gate. Lives in .github/workflows so both Gitea and GitHub run it.
on:
pull_request:
branches: [develop, main]
push:
branches: [develop, main]
# Weekly, so a core release that breaks the starter or leaves the pin behind
# shows up here rather than in somebody's `matcha new`.
schedule:
- cron: '0 6 * * 1'
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Add clippy + rustfmt
run: rustup component add clippy rustfmt
- run: cargo fmt --check
- run: cargo clippy --all-targets -- -D warnings
- run: cargo test --locked
# `cargo test` proves the CLI writes the files it means to write. It cannot
# prove those files describe a project the current @green-tea/core will run —
# which is how the templates sat two core releases behind for two months with
# a green build the whole time. This job scaffolds, installs, type-checks,
# boots and introspects a real starter, per runtime.
starter:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
runtime: [node, deno, bun]
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- run: cargo build
- name: Install Deno
if: matrix.runtime == 'deno'
run: |
curl -fsSL https://deno.land/install.sh | sh -s -- --yes
echo "$HOME/.deno/bin" >> "$GITHUB_PATH"
- name: Install Bun
if: matrix.runtime == 'bun'
run: |
curl -fsSL https://bun.sh/install | bash
echo "$HOME/.bun/bin" >> "$GITHUB_PATH"
- run: scripts/starter-smoke.sh ${{ matrix.runtime }}
# The pin in src/template.rs is exact because core is prerelease-only and no
# caret range can move off its first matching prerelease. Exact pins go stale
# silently, so this is the thing that notices. Scheduled only: a core release
# should nag on Monday, not redden an unrelated pull request.
core-freshness:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compare the scaffold pin against the beta dist-tag
run: |
pinned=$(grep -oP 'CORE_VERSION: &str = "\K[^"]+' src/template.rs)
latest=$(npm view @green-tea/core dist-tags.beta)
echo "pinned=$pinned latest=$latest"
if [ "$pinned" != "$latest" ]; then
echo "::error::matcha scaffolds @green-tea/core@$pinned but the beta tag is $latest."
echo "Bump CORE_VERSION in src/template.rs and let the starter job prove it still boots."
exit 1
fi