Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1e876c5
fix: answer notFound and forbidden over RPC with their status
Nov 11, 2026
6379a04
feat: name the missing action field in a page POST's 405
Nov 11, 2026
a151454
feat: answer common lookups in the catalogue and scaffold
Nov 11, 2026
2efc239
feat: fit the scaffold's first read in one tool call
Nov 11, 2026
e592a97
fix: type the redirecting signIn and signOut as Promise<never>
Nov 11, 2026
430f7a2
feat: let the kit's class helpers take className like cva
Nov 11, 2026
d2afa2d
fix: give each eval build a free port and a short temp dir
Nov 11, 2026
0615a87
fix: run the framework under test through npx in eval apps
Nov 11, 2026
5706a12
feat: ship a minimal scaffold with no UI kit code pre-installed
Nov 12, 2026
74506f1
feat: say how webjs db seed runs the seed file
Nov 12, 2026
215846f
fix: refuse to post a lone bound form missing every submitted field
Nov 12, 2026
17644b9
fix: give each test file its own copy of the test database
Nov 12, 2026
4fbb4aa
fix: count each eval build's tokens once per API message
Nov 12, 2026
caf58ab
test: drop the scaffold from the shared theme-key check
Nov 12, 2026
98b6f78
feat: add webjs verify and ship an empty modules folder
Nov 12, 2026
03d7df4
test: stop the eval prompt prescribing a dev server and curl
Nov 12, 2026
5a60137
fix: run webjs verify on the ci engine, in parallel, without dev env
Nov 12, 2026
36e1e9a
fix: refuse only a field-less lone form in submitForm
Nov 12, 2026
9ea42e2
fix: evict a mutation's tags when an action throws forbidden()
Nov 12, 2026
d7db55a
docs: name the api example module and fix two stale docs pages
Nov 12, 2026
dacc114
refactor: pass className to cn() in the kit helpers, not by recursion
Nov 12, 2026
6b88070
fix: keep the largest usage a message reports in eval metrics
Nov 12, 2026
a054bed
revert: type the redirecting signIn and signOut as Promise<Response>
Nov 12, 2026
9e107f1
fix: evict no declared tags when an RPC action throws a guard
Nov 12, 2026
5f3b73c
fix: return the 403 body from invokeActionForTest under throwOnError …
Nov 12, 2026
35e064e
fix: run webjs verify without CI=true and keep messages starting at
Nov 12, 2026
dc9d1de
fix: replace a previous temp link when an eval build re-runs
Nov 12, 2026
6ffa114
fix: serve the missing-action 405 hint only in development
Nov 12, 2026
8585480
fix: make the api AGENTS.md note loud and drop stale scaffold comments
Nov 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/hooks/block-prose-punctuation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ fi
# positives (a wrongly blocked write), the same tradeoff as the rules above:
# e.g. a sentence-ending "built on webjs." is not flagged (trailing period),
# and the `bin/webjs.js` "webjs commands:" usage banner may rarely trip it.
webjs_cli='create|dev|start|test|check|ci|routes|db|ui|doctor|types|typecheck|mcp|vendor|help|version|add|init|generate|migrate|push|studio|seed|pin|unpin|list|audit|outdated|update|view|diff|info|build|source|status|stop|regenerate'
webjs_cli='create|dev|start|test|check|ci|routes|db|ui|doctor|types|typecheck|mcp|vendor|help|version|add|init|generate|migrate|push|studio|seed|pin|unpin|list|audit|outdated|update|view|diff|info|build|source|status|stop|verify|regenerate'

# Scan copy: drop fenced code blocks, inline code spans, and emphasis markers
# so a `webjs` inside code is never considered and **webjs** still matches.
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ jobs:
# machines, which are independent and must be kept in step by hand.
- name: WebJs form-action guard parity on Bun
run: bun test/bun/form-action-guard.mjs
# notFound() / forbidden() / unauthorized() in an action called over RPC
# (#1697): 404 / 403 / 401 through the Bun.serve listener, never a 500.
- name: Action control flow over RPC on Bun
run: bun test/bun/action-control-flow-rpc.mjs
# live() in an attribute hole (#1443): the SSR unwrap must produce
# byte-identical attribute emission on Bun, across both server machines.
# The bug class this guards was a server/client disagreement (a falsy
Expand Down
12 changes: 7 additions & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ Every code change MUST include, automatically:

1. **Tests, every applicable layer (not just unit).** Ship the tests that prove the change across EVERY layer it touches: **unit** (`packages/*/test/**`, `test/**`, including the counterfactual that fails when reverted), **browser** (`*/test/**/browser/*` via `npm run test:browser`, for hydration / DOM / slots / client router / custom-element upgrade), **e2e** (`test/e2e/*.test.mjs` via `WEBJS_E2E=1`, including network probes / navigation / streaming), and **smoke** (`test/examples/*/smoke/*`). A unit test is NECESSARY BUT NOT SUFFICIENT for any client-router / component / browser-facing change (the headline behaviour is a browser/e2e assertion). **Bun parity is part of the task, not an afterthought:** WebJs runs on Node 24+ AND Bun (#508), so a change to a runtime-sensitive surface (the serializer, the node:http vs `Bun.serve` listener + request path, SSR / action / CSRF dispatch, streams, `node:crypto`, the TS stripper, auth / session / cors) MUST be proven on Bun (`node scripts/run-bun-tests.js` + the touched `test/bun/*.mjs` under `bun`) AND ship an added/updated `test/bun/<feature>.mjs` cross-runtime assertion. `npm test` does NOT run browser, e2e, or Bun; run the layers you touched yourself and report the result (GitHub Actions runs every layer on the PR). Never report work done with failing or missing tests. See https://webjs.dev/docs/testing. Enforced by `.claude/hooks/require-tests-with-src.sh` (the scaffold variant WARNS unless `WEBJS_TEST_GATE=block`) and `.claude/hooks/require-bun-parity-with-runtime-src.sh` (BLOCKS a commit that stages runtime-sensitive source with no `test/bun/**` test; escape hatch `WEBJS_BUN_VERIFIED=1`).
2. **Documentation, part of the definition of done (not optional).** A task is NOT done until EVERY doc surface its change touches is in sync: the docs site (`website/app/(site)/docs/<topic>`, the canonical documentation), per-package `AGENTS.md` for contributor-facing changes, the marketing `website/`, the scaffold templates (`packages/cli/templates/`), `README.md` for a headline capability, and the brief (`packages/mcp/src/brief.js`, pasted verbatim into this file and `packages/cli/templates/AGENTS.md`) only when a Lit or Next.js habit can no longer produce correct code. Updating `AGENTS.md` alone reproduces the #488 gap (docs site left stale). Invoke the `webjs-doc-sync` skill to sync every applicable surface. Enforced by `.claude/hooks/require-docs-with-src.sh`, which BLOCKS a commit that stages public `packages/*/src` source with no doc surface alongside it (a genuinely internal refactor / CI / release / perf change with no behaviour change bypasses with `WEBJS_NO_DOC_GATE=1`). Every commit gate's escape hatch works either in the environment or written in front of the commit it applies to (`WEBJS_NO_DOC_GATE=1 git commit ...`), since a hook cannot see an environment an agent sets for one command.
3. **Scaffold sync (when a feature changes what apps should do).** The scaffold `webjs create` emits is minimal: a root layout, a starting home page, a theme toggle, db wiring and a starter test, one example module (`modules/users/`) the agent reads and then deletes, plus `AGENTS.md`: the brief, a few scaffold rules, and a "This app" section the agent fills in as it builds (`CLAUDE.md` imports it). The feature gallery (`gallery/`, deployed at gallery.webjs.dev) is a standalone app and ships in no scaffold. So when a WebJs feature is added or changed, ask: does the generator (`packages/cli/lib/create.js`), a gallery demo (`gallery/`), or the brief need to move? Verify by generating an app and running `generate + boot + webjs check` (the generators emit strings, so an escaping bug only shows in a freshly generated app). See `framework-dev.md`.
3. **Scaffold sync (when a feature changes what apps should do).** The scaffold `webjs create` emits is minimal: a root layout (dark mode follows the OS), a starting home page, db wiring and a starter test, the UI kit's config and theme with no kit code pre-installed, an empty `modules/` for the features (its layout is in `AGENTS.md`), plus `AGENTS.md`: the brief, a few scaffold rules, and a "This app" section the agent fills in as it builds (`CLAUDE.md` imports it). The feature gallery (`gallery/`, deployed at gallery.webjs.dev) is a standalone app and ships in no scaffold. So when a WebJs feature is added or changed, ask: does the generator (`packages/cli/lib/create.js`), a gallery demo (`gallery/`), or the brief need to move? Verify by generating an app and running `generate + boot + webjs check` (the generators emit strings, so an escaping bug only shows in a freshly generated app). See `framework-dev.md`.
4. **Convention validation.** Run `webjs check` and fix violations. Run it from INSIDE an app, never from the repo root: the root is a workspace, not an app, so the command refuses there with exit 1 rather than reporting the cross-app collisions no single runtime ever sees (#1301). In this repo that means `( cd gallery && npx webjs check )`, `( cd examples/blog && npx webjs check )` and `( cd website && npx webjs check )`. Run `webjs doctor` too when you touched an in-repo app (`gallery`, `examples/blog`, `website`): the required `conventions` CI job runs it over all three, and it fails on a hard toolchain check or on whatever that app's `webjs.doctor.gate` marks `error` (today `UNMARKED_ASSET_LINKS` in `website` and `examples/blog`), so a clean `webjs check` alone is not enough to predict that job (#1257). The repo root has no local CI battery (#1630): GitHub Actions runs the whole list on the PR. Inside `gallery` / `examples/blog` / `website`, `npm run ci` runs that app's own `webjs.ci` list (#1471); in a linked worktree invoke the branch's CLI by path (`node ../packages/cli/bin/webjs.js ci` inside an app) because the hoisted bin resolves into the primary checkout.

### Git workflow (mandatory)
Expand Down Expand Up @@ -171,9 +171,11 @@ routing and Lit components, with the differences below.
Before hand-writing auth, sessions, caching, rate limits, uploads, realtime or
SEO, run `npx webjs source`, which lists what WebJs provides for each need.
`npx webjs source <Export>` then prints one export's signature and example.
After each edit run `npx webjs check` and `npx webjs status`. The framework
source is in `node_modules/@webjsdev/*` (no build, so it is the code that
runs) and the human docs are at https://webjs.dev/docs.
After each edit run `npx webjs check`. To verify the app, run `npx webjs verify`:
check, typecheck, the tests, and every route booted in-process, in one call,
with no dev server to start, curl or stop. The framework source is in
`node_modules/@webjsdev/*` (no build, so it is the code that runs) and the
human docs are at https://webjs.dev/docs.

---

Expand Down Expand Up @@ -204,7 +206,7 @@ These hold for the framework and every app built on it. Hit one as a runtime err

## CLI and scaffolding

`webjs create <name> [--template api] [--db sqlite|postgres] [--runtime node|bun] [--skip-ci]` scaffolds an app (full-stack by default, `api` for a backend with no UI); always scaffold rather than hand-roll, and keep app data in the wired-up database, never JSON files. The other commands: `webjs dev`, `start`, `test`, `check [--rules] [--json]`, `ci`, `routes`, `mcp`, `status`, `stop`, `source <Export>`, `doctor`, `audit`, `types`, `regenerate`, `typecheck`, `db`, `ui`, `vendor`, `version`, `help [command]`. `webjs help <command>` prints each one's options; the docs site has the full reference. Run this repo's own apps (`website/`, `gallery/`, `examples/blog/`) from inside them with their `npm run dev` / `npm start`.
`webjs create <name> [--template api] [--db sqlite|postgres] [--runtime node|bun] [--skip-ci]` scaffolds an app (full-stack by default, `api` for a backend with no UI); always scaffold rather than hand-roll, and keep app data in the wired-up database, never JSON files. The other commands: `webjs dev`, `start`, `test`, `check [--rules] [--json]`, `ci`, `routes`, `mcp`, `status`, `stop`, `verify`, `source <Export>`, `doctor`, `audit`, `types`, `regenerate`, `typecheck`, `db`, `ui`, `vendor`, `version`, `help [command]`. `webjs help <command>` prints each one's options; the docs site has the full reference. Run this repo's own apps (`website/`, `gallery/`, `examples/blog/`) from inside them with their `npm run dev` / `npm start`.

`webjs check` carries correctness rules only (code that is wrong to ship), run unconditionally; anything a sensible app could do differently is a convention in prose, not a check. Run it from INSIDE an app, never from the repo root.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ older, unrelated Java framework also used the name WebJS.
> - Any product UI (todo, blog, notes, dashboard, marketplace, social, e-commerce, a SaaS with accounts…) → **default** (`webjs create <name>`)
> - Backend-only HTTP/JSON API, no UI → **`--template api`**
>
> **The scaffold is minimal, grown in place.** It ships a root layout, a starting home page, a theme toggle, database wiring, a starter test, and one example feature module (`modules/users/`) to copy and then delete. The framework context is a short brief in `AGENTS.md`, which also carries a section the agent keeps current about the app: WebJs follows Next.js App Router routing and Lit's component APIs, so the brief lists only what differs, and `webjs check` refuses the rest with the fix. Build the app the user asked for on top of the scaffold; `npx webjs source` lists what WebJs already provides. Runnable demos of every feature live at [gallery.webjs.dev](https://gallery.webjs.dev) (source in `gallery/`).
> **The scaffold is minimal, grown in place.** It ships a root layout, a starting home page, database wiring, a starter test, the UI kit's config and theme (components are added on demand), and an empty `modules/` whose layout `AGENTS.md` describes. The framework context is a short brief in `AGENTS.md`, which also carries a section the agent keeps current about the app: WebJs follows Next.js App Router routing and Lit's component APIs, so the brief lists only what differs, and `webjs check` refuses the rest with the fix. Build the app the user asked for on top of the scaffold; `npx webjs source` lists what WebJs already provides. Runnable demos of every feature live at [gallery.webjs.dev](https://gallery.webjs.dev) (source in `gallery/`).
>
> Full rules: [`AGENTS.md` → How AI agents must scaffold](./AGENTS.md#how-ai-agents-must-scaffold).
> Full framework docs (every API, every recipe): **https://webjs.dev/docs**.
Expand Down
4 changes: 2 additions & 2 deletions examples/blog/components/ui/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export interface ButtonClassOptions {
}

/** Compose Tailwind classes for a button. Stable shape: object-arg, both optional. */
export function buttonClass(opts: ButtonClassOptions = {}): string {
export function buttonClass(opts: ButtonClassOptions & { className?: string } = {}): string {
const variant = opts.variant ?? 'default';
const size = opts.size ?? 'default';
return cn(BASE, VARIANTS[variant], SIZES[size]);
return cn(BASE, VARIANTS[variant], SIZES[size], opts.className);
}
4 changes: 2 additions & 2 deletions gallery/modules/gallery/ui/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export interface ButtonClassOptions {
* (`buttonClass()` is the primary call-to-action). `cn` de-duplicates, so you
* can append your own layout classes: `class="${buttonClass()} w-full"`.
*/
export function buttonClass(opts: ButtonClassOptions = {}): string {
export function buttonClass(opts: ButtonClassOptions & { className?: string } = {}): string {
const variant = opts.variant ?? 'default';
const size = opts.size ?? 'default';
return cn(BASE, VARIANTS[variant], SIZES[size]);
return cn(BASE, VARIANTS[variant], SIZES[size], opts.className);
}
Loading
Loading