Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
180de79462 |
No files matched your search
@@ -1,28 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Something behaves differently from what the docs or the types promise
|
|
||||||
labels: bug
|
|
||||||
---
|
|
||||||
|
|
||||||
## What happened
|
|
||||||
|
|
||||||
## What you expected
|
|
||||||
|
|
||||||
## Minimal reproduction
|
|
||||||
|
|
||||||
The smallest module and route that shows it:
|
|
||||||
|
|
||||||
```ts
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
## Environment
|
|
||||||
|
|
||||||
- green-tea version:
|
|
||||||
- Runtime and version: <!-- Node 20.11 / Deno 2.1 / Bun 1.1 / Cloudflare Workers -->
|
|
||||||
- OS:
|
|
||||||
|
|
||||||
<!--
|
|
||||||
If it works on one runtime and not another, say which. That difference is
|
|
||||||
usually the bug rather than a detail of it.
|
|
||||||
-->
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# Design questions, scope decisions and "should this live in core?" threads don't fit a
|
|
||||||
# bug form, and they are most of what gets filed here. Keep the blank option available.
|
|
||||||
blank_issues_enabled: true
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
<!--
|
|
||||||
Opening this from a fork on GitHub? The base branch must be `contrib`, not `main`.
|
|
||||||
See CONTRIBUTING.md for why, and for the worked example.
|
|
||||||
-->
|
|
||||||
|
|
||||||
## What this changes
|
|
||||||
|
|
||||||
<!-- A sentence or two, on the why rather than the what. -->
|
|
||||||
|
|
||||||
Closes #
|
|
||||||
|
|
||||||
## Checklist
|
|
||||||
|
|
||||||
- [ ] Commits are signed off (`git commit -s`)
|
|
||||||
- [ ] `npm run lint`, `npm run format:check`, `npm run typecheck` and `npm test` pass locally
|
|
||||||
- [ ] New behavior has a test
|
|
||||||
- [ ] A new public option or method is also declared in `src/app/types.ts`, and noted in `README.md`
|
|
||||||
- [ ] Behavior is the same on Node, Deno and Bun — or the difference is deliberate, and said out loud here
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
name: CI
|
name: CI
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [develop, main, contrib]
|
branches: [develop, main]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [develop, main, contrib]
|
branches: [develop, main]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -13,23 +13,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: '18'
|
node-version: '18'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
|
- run: npm audit
|
||||||
- run: npm run lint
|
- run: npm run lint
|
||||||
- run: npm run format:check
|
- run: npm run format:check
|
||||||
- run: npm run complexity:check
|
- run: npm run complexity:check
|
||||||
- run: npm run typecheck
|
- run: npm run typecheck
|
||||||
- run: npm test
|
- run: npm test
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
# Supply chain, deliberately after the code gates: an advisory published by a third party
|
|
||||||
# must never decide whether a contributor gets to see their own lint and typecheck output.
|
|
||||||
# Only what we ship blocks — with `reflect-metadata` as the sole runtime dependency, a
|
|
||||||
# production advisory is rare and genuinely reaches users. Build tooling only reports.
|
|
||||||
- run: npm audit --omit=dev
|
|
||||||
- run: npm audit
|
|
||||||
continue-on-error: true
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22.12'
|
node-version: '22.12'
|
||||||
- run: npm ci --prefix website
|
- run: npm ci --prefix website
|
||||||
- run: npm audit --prefix website
|
- run: npm audit --prefix website
|
||||||
continue-on-error: true
|
|
||||||
- run: npm run docs:build
|
- run: npm run docs:build
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
# AGENTS.md
|
|
||||||
|
|
||||||
Guidance for AI coding assistants working in this repository. Claude Code, Codex, Cursor and anything else that reads this file.
|
|
||||||
|
|
||||||
If you are an assistant: a person reads every line of what you produce before it lands, and the person submitting it signs off on it. Make that reading worth their time — leave the reasoning visible, don't quietly widen the scope you were asked for, and say what you were unsure about instead of smoothing over it. The "Working with AI assistance" section of `CONTRIBUTING.md` applies to your output.
|
|
||||||
|
|
||||||
## What this is
|
|
||||||
|
|
||||||
`@green-tea/core` — a type-safe HTTP framework where the API is a dependency graph rather than a middleware chain. You declare what each step needs and provides; the framework computes execution order, fails at boot if something is missing, and can print the whole pipeline. Runs on Node, Deno, Bun and the edge from one codebase.
|
|
||||||
|
|
||||||
**Hard constraint: one runtime dependency.** `reflect-metadata`, and nothing else. `busboy` and `ws` are peer dependencies. Anything that would add a third belongs in a plugin, not in core.
|
|
||||||
|
|
||||||
## Commands
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run lint # eslint
|
|
||||||
npm run format:check # prettier, src/**/*.ts only
|
|
||||||
npm run typecheck # must be clean; includes the compile-time-guarantee type test
|
|
||||||
npm test # vitest
|
|
||||||
npm run build # tsup
|
|
||||||
npm run complexity:check
|
|
||||||
|
|
||||||
npm run test:deno # the other runtimes are NOT covered by `npm test`
|
|
||||||
npm run test:bun
|
|
||||||
npm run test:edge
|
|
||||||
```
|
|
||||||
|
|
||||||
Run the first four before proposing anything as finished. The runtime suites are separate on purpose — a change to shared code that passes `npm test` may still be broken on Deno or Bun.
|
|
||||||
|
|
||||||
## Two forges
|
|
||||||
|
|
||||||
Development lives on a private Gitea instance. GitHub is a downstream mirror that receives `main` and release tags, nothing else.
|
|
||||||
|
|
||||||
```
|
|
||||||
feature/* → develop → main → [promote.yml] → GitHub main
|
|
||||||
↑ ↓
|
|
||||||
lead dev GitHub contrib ← external PRs
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Gitea `develop`** — active development.
|
|
||||||
- **Gitea `main`** — staging. Merging here publishes nothing; only a `v*` tag publishes.
|
|
||||||
- **GitHub `main`** — production mirror. No human touches it. Protected against force-push and deletion, with no review requirement, because `promote.yml` pushes to it directly and a review rule would block that.
|
|
||||||
- **`contrib`** — exists on *both* forges. Where outside contributions land.
|
|
||||||
|
|
||||||
`develop` and `main` on Gitea have direct push disabled with an empty whitelist, so nobody can push to them, admins included. Advance them by opening a PR and merging it.
|
|
||||||
|
|
||||||
## Procedure
|
|
||||||
|
|
||||||
**Promotions are fast-forward-only.** `develop → main` merges with Gitea's fast-forward-only style, so `main` becomes an exact copy of `develop` and no commit is ever born on `main`. This is not a preference: merge-style promotions created seven of the ten commits of drift that had to be cleaned up in August 2026, because each one lived on `main` and never travelled back. Release boundaries are marked by `v*` tags, not by promotion commits.
|
|
||||||
|
|
||||||
**Only `hotfix/*` can still cause real drift**, since it branches from and returns to `main`. That case genuinely needs a back-merge; nothing else does.
|
|
||||||
|
|
||||||
**Diagnosing "this branch is ahead of main".** Usually it is pre-rebase duplication, not unmerged work: the same content under different SHAs, because contributions are rebased on their way into `develop`. Confirm before acting:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git diff <branch> <main> -- <suspect file> # empty means the content is already in main
|
|
||||||
```
|
|
||||||
|
|
||||||
Merging such a branch to "recover" the commits duplicates the work and drags stale history along.
|
|
||||||
|
|
||||||
**External contributions.** They arrive on GitHub `contrib`. Mirror that branch to Gitea, then rebase the PR's own commits onto `develop` and open a normal `feature/` PR — rebase rather than merge, so `main`'s history stays out of `develop`. Take the commit range from the pull request itself, never "everything since main": if a second contributor branched from `contrib` after the first one merged, the broad range sweeps up work that isn't theirs.
|
|
||||||
|
|
||||||
**After every promotion, reset *both* `contrib` branches to `main`.** They hold pre-rebase SHAs while `main` holds the rebased equivalents, so they are not ancestors and this needs a force-push. The Gitea one is unprotected and easy to forget. The GitHub one refuses the push even for admins, so its protection has to be lifted and restored around the reset.
|
|
||||||
|
|
||||||
A conflict against unreleased `develop` work can never be delegated to an outside contributor — they cannot see the code they are conflicting with. Those are always the maintainer's to resolve.
|
|
||||||
|
|
||||||
## CI
|
|
||||||
|
|
||||||
The audit gate is scoped, not severity-filtered: `npm audit --omit=dev` blocks, everything else is `continue-on-error`. A critical in the test runner reaches nobody; a high in `reflect-metadata` reaches everyone. It runs *after* the code gates, because an advisory published by a third party must never decide whether a contributor sees their own lint and typecheck output.
|
|
||||||
|
|
||||||
**The forges disagree about where workflows come from.** GitHub reads `pull_request` workflows from the base branch, so a workflow fix cannot validate itself and must reach the base before it gates anything. Gitea reads from the head. Likewise, `continue-on-error` steps report as `success` on GitHub, hiding the advisory in the log, but as `failure` with the job still green on Gitea.
|
|
||||||
|
|
||||||
GitHub does not run workflows on fork pull requests until a maintainer approves them. A contributor's first push may sit with no checks at all.
|
|
||||||
|
|
||||||
## Conventions
|
|
||||||
|
|
||||||
- Conventional Commits, focused on the *why*. Every commit signed off (`git commit -s`) — the project uses a DCO, and unsigned commits are rejected. No AI co-authoring attribution.
|
|
||||||
- Comments carry reasoning the code cannot show. When editing a block, keep them; if one explains an ordering or a version floor, it is load-bearing.
|
|
||||||
- A new option or method on a public interface has to change `src/app/types.ts` too. An implementation that grows a parameter alone is unreachable for anyone consuming the package.
|
|
||||||
- Behaviour that differs between runtimes must be explicit. An "unavailable here" is fine; silently accepting an option that does nothing is a bug.
|
|
||||||
- New public API needs a note in `README.md`.
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
# CLAUDE.md
|
|
||||||
|
|
||||||
See [AGENTS.md](./AGENTS.md). It is the same guidance, kept in one place so the two files cannot drift apart.
|
|
||||||
+3
-70
@@ -2,36 +2,6 @@
|
|||||||
|
|
||||||
Thanks for your interest. green-tea is open source, but not anyone can push directly — contributions land through reviewed pull/merge requests with a **DCO sign-off**.
|
Thanks for your interest. green-tea is open source, but not anyone can push directly — contributions land through reviewed pull/merge requests with a **DCO sign-off**.
|
||||||
|
|
||||||
## Where to send your changes
|
|
||||||
|
|
||||||
Development happens on a private Gitea instance. The GitHub repository is a downstream mirror: it receives `main` and release tags, and nothing else. Which branch you target depends on where you are.
|
|
||||||
|
|
||||||
**From GitHub, if you are an outside contributor:** open your pull request against **`contrib`**. Not `main`. `main` on GitHub is a mirror of released code, and merging into it puts the two forges out of sync and breaks the next release push. A maintainer reviews on `contrib` and then carries your commits upstream into Gitea's `develop`, with your authorship and your sign-off intact.
|
|
||||||
|
|
||||||
**From Gitea, if you have access:** follow the branch model below.
|
|
||||||
|
|
||||||
### Worked example
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# fork Expressive-Tea/green-tea on GitHub, then
|
|
||||||
git clone git@github.com:<you>/green-tea.git
|
|
||||||
cd green-tea
|
|
||||||
git remote add upstream https://github.com/Expressive-Tea/green-tea.git
|
|
||||||
git fetch upstream
|
|
||||||
|
|
||||||
# branch from contrib, not from main
|
|
||||||
git checkout -b fix/close-timeout upstream/contrib
|
|
||||||
|
|
||||||
# ... make the change, add a test ...
|
|
||||||
|
|
||||||
git commit -s -m "fix: add a timeout to app.close()"
|
|
||||||
git push origin fix/close-timeout
|
|
||||||
```
|
|
||||||
|
|
||||||
Then open the pull request with **`contrib`** as the base branch.
|
|
||||||
|
|
||||||
`contrib` tracks released code, so it is reset to `main` after each release. If your branch has been open across one, rebase onto the new `contrib` before pushing again.
|
|
||||||
|
|
||||||
## Developer Certificate of Origin (DCO)
|
## Developer Certificate of Origin (DCO)
|
||||||
|
|
||||||
We use the [Developer Certificate of Origin](./DCO) instead of a CLA. It's a lightweight, per-commit affirmation that you have the right to submit your work under the project's license. No copyright assignment, no paperwork.
|
We use the [Developer Certificate of Origin](./DCO) instead of a CLA. It's a lightweight, per-commit affirmation that you have the right to submit your work under the project's license. No copyright assignment, no paperwork.
|
||||||
@@ -56,34 +26,6 @@ To sign off a range you forgot to sign:
|
|||||||
git rebase --signoff <base>
|
git rebase --signoff <base>
|
||||||
```
|
```
|
||||||
|
|
||||||
Or, for the commit you just made:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
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 that lands here is reviewed by a person, by hand, and usually that person is one person. A diff its own author hasn't read moves that work onto them, and turns review into proofreading — which is the thing review is worst at.
|
|
||||||
|
|
||||||
So go through the diff the way you would go through a stranger's, because that is what it is. If you can't say why a line is there, it isn't ready to send. That's the whole of it.
|
|
||||||
|
|
||||||
**What assistants tend to get wrong here in particular** — worth checking before you push:
|
|
||||||
|
|
||||||
- They add dependencies. Core has one runtime dependency, and that is a design constraint rather than an oversight.
|
|
||||||
- They write for Node and assume the rest follows. It doesn't — green-tea also runs on Deno, Bun and the edge, and `npm test` does not cover them.
|
|
||||||
- They delete comments they read as redundant. In this codebase a comment usually carries reasoning the code can't show on its own.
|
|
||||||
- They skip the test.
|
|
||||||
|
|
||||||
**Where you're unsure, say so** — not as a disclosure, as a pointer. "I'm not confident about the Deno path here" tells a reviewer where to spend their attention, and that is worth more to them than a pull request that merely looks clean.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
If your assistant reads repository instructions, `AGENTS.md` has the conventions and the architecture notes.
|
|
||||||
|
|
||||||
## Branch model (GitFlow)
|
## Branch model (GitFlow)
|
||||||
|
|
||||||
- `main` — production-ready, protected. No direct pushes.
|
- `main` — production-ready, protected. No direct pushes.
|
||||||
@@ -91,7 +33,6 @@ If your assistant reads repository instructions, `AGENTS.md` has the conventions
|
|||||||
- `feature/<name>` — branch from `develop`.
|
- `feature/<name>` — branch from `develop`.
|
||||||
- `hotfix/<name>` — branch from `main`.
|
- `hotfix/<name>` — branch from `main`.
|
||||||
- `release/<version>` — release stabilization.
|
- `release/<version>` — release stabilization.
|
||||||
- `contrib` — GitHub only. Where outside contributions land before a maintainer moves them to `develop`.
|
|
||||||
|
|
||||||
`main` and `develop` are protected: they require a reviewed MR and signed-off commits. (Branch protection is configured on the git server, not in this repo.)
|
`main` and `develop` are protected: they require a reviewed MR and signed-off commits. (Branch protection is configured on the git server, not in this repo.)
|
||||||
|
|
||||||
@@ -99,25 +40,17 @@ If your assistant reads repository instructions, `AGENTS.md` has the conventions
|
|||||||
|
|
||||||
Follow [Conventional Commits](https://www.conventionalcommits.org/): `feat:`, `fix:`, `chore:`, `docs:`, `test:`, `refactor:`. Focus the message on the *why*. Do not add AI co-authoring attribution.
|
Follow [Conventional Commits](https://www.conventionalcommits.org/): `feat:`, `fix:`, `chore:`, `docs:`, `test:`, `refactor:`. Focus the message on the *why*. Do not add AI co-authoring attribution.
|
||||||
|
|
||||||
## Before you open a pull request
|
## Before you open an MR
|
||||||
|
|
||||||
Run what CI runs:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run lint
|
|
||||||
npm run format:check
|
|
||||||
npm run typecheck # must be clean — this includes the compile-time-guarantee type test
|
|
||||||
npm test # all tests must pass
|
npm test # all tests must pass
|
||||||
|
npm run typecheck # must be clean — this includes the compile-time-guarantee type test
|
||||||
```
|
```
|
||||||
|
|
||||||
- Write tests for new behavior (TDD welcome). We use Vitest.
|
- Write tests for new behavior (TDD welcome). We use Vitest.
|
||||||
- Keep runtime dependencies at zero beyond `reflect-metadata`.
|
- Keep runtime dependencies at zero beyond `reflect-metadata`.
|
||||||
- A new option or method on a public interface has to change that interface too. An implementation that grows a parameter without `src/app/types.ts` growing it as well is unreachable for anyone consuming the package.
|
|
||||||
- New public API needs a doc note in `README.md`.
|
- New public API needs a doc note in `README.md`.
|
||||||
- If your change only works on one runtime, say so in the pull request. green-tea runs on Node, Deno, Bun and the edge, and behavior that quietly differs between them is treated as a bug — an explicit "not available here" is fine, silence is not.
|
|
||||||
|
|
||||||
On GitHub, workflows do not run on pull requests from forks until a maintainer approves them, so your first push may sit without any checks for a while. That is not a rejection.
|
|
||||||
|
|
||||||
## Reporting issues
|
## Reporting issues
|
||||||
|
|
||||||
Open an issue with a minimal reproduction: green-tea version, runtime and version, and the smallest module/route that shows the problem.
|
Open an issue with a minimal reproduction: green-tea version, Node version, and the smallest module/route that shows the problem.
|
||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@green-tea/core",
|
"name": "@green-tea/core",
|
||||||
"version": "26.8.0-beta.0",
|
"version": "26.8.0-beta.0",
|
||||||
"description": "A zen, opinionated, type-safe framework \u2014 your API is a graph, not a middleware chain.",
|
"description": "You declare what each step needs and provides; green-tea computes the execution order, fails at boot if something is missing, and prints the whole pipeline. HTTP, SSE and WebSocket on Node, Deno, Bun and the edge.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "green-tea contributors",
|
"author": "green-tea contributors",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
Reference in new issue
Block a user