Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
51751af
feat: playground
olliethedev Mar 26, 2026
acfd7a8
refactor: improve StackBlitz embed functionality and project file han…
olliethedev Mar 27, 2026
e355eb7
feat: add custom headers for cross-origin isolation in Next.js config…
olliethedev Mar 27, 2026
28f0127
feat: enhance stackblitz-template to handle workspace-built plugins a…
olliethedev Mar 27, 2026
ba90e8f
feat: add active route preview functionality in PlaygroundClient and …
olliethedev Mar 27, 2026
de0c24b
refactor: streamline StackBlitz SDK loading and error handling in emb…
olliethedev Mar 27, 2026
6b5ae38
feat: implement useRegisteredRoutes hook for retrieving registered cl…
olliethedev Mar 27, 2026
1435d40
feat: add extraPackages support in project generation and enhance Sta…
olliethedev Mar 27, 2026
11d2f6a
feat: ensure CMS is included in selected plugins when ui-builder is a…
olliethedev Mar 27, 2026
c59a712
feat: drawer for routes
olliethedev Mar 30, 2026
b861e11
docs: add shadcn ai skill
olliethedev Mar 30, 2026
549331e
chore: update package version to 0.1.2 and enhance exports structure …
olliethedev Mar 30, 2026
22c4263
feat: integrate AI chat functionality into Next.js layout, including …
olliethedev Apr 1, 2026
17aaeeb
feat: enhance playground UI with theme toggle, new components, and im…
olliethedev Apr 1, 2026
53b9592
refactor: consolidate PLUGIN_ROUTES export into constants and remove …
olliethedev Apr 1, 2026
760291c
fix: adjust import logic for usePathname based on pagesLayoutOverride…
olliethedev Apr 1, 2026
01e01cc
chore: update test-init script to install plugin-specific extra packa…
olliethedev Apr 1, 2026
2759577
feat: implement getEffectivePlugins utility to streamline plugin sele…
olliethedev Apr 1, 2026
b5e62eb
refactor: simplify DrawerContent structure in RouteDrawer component f…
olliethedev Apr 1, 2026
2a3d45e
feat: add react-router and tanstack project skeletons to playground
olliethedev Apr 1, 2026
df090f6
fix: update layout templates to remove unused AI chat context provide…
olliethedev Apr 2, 2026
bff02d2
feat: enhance layout patching logic to conditionally include AI chat …
olliethedev Apr 2, 2026
caa1064
feat: add seed data functionality for plugins in playground, includin…
olliethedev Apr 2, 2026
e5efede
fix: update seed route path format to include hyphen for consistency …
olliethedev Apr 2, 2026
6b4c67c
chore: remove AI Chat demo and related files from the demos directory
olliethedev Apr 2, 2026
fc0af86
fix: correct seed route path format for react-router to use dot notat…
olliethedev Apr 2, 2026
203d147
feat: enhance smoke test script to dynamically generate imports for i…
olliethedev Apr 2, 2026
074bbef
chore: undo test-registry changes
olliethedev Apr 2, 2026
0ebb968
chore: remove GitHub Actions workflow for demo projects
olliethedev Apr 2, 2026
8a7a915
tests: next e2e codegen
olliethedev Apr 2, 2026
2a01401
testing: codegen nextjs e2e testing
olliethedev Apr 2, 2026
e5c4803
feat: codegen react-router, tanstack start
olliethedev Apr 3, 2026
adbd7e8
tests: e2e codegen react-router, tanstack
olliethedev Apr 3, 2026
4013860
feat: update .env creation in codegen scripts to merge variables from…
olliethedev Apr 3, 2026
0266dad
feat: add normalizePlugins utility and enhance scaffold plan with css…
olliethedev Apr 3, 2026
0be7d93
tests: fix e2e for codegen projects
olliethedev Apr 3, 2026
583ab95
feat: implement detectShadcnConfig utility to read configuration from…
olliethedev Apr 3, 2026
e2c3c65
feat: import detectShadcnConfig and normalizePlugins utilities in ini…
olliethedev Apr 6, 2026
429acba
feat: add loading and error components to form demo pages for better …
olliethedev Apr 6, 2026
0d67983
fix: ensure memory adapter export in react-router and tanstack build …
olliethedev Apr 6, 2026
094350b
feat: enhance test-init script to automatically add dropdown-menu for…
olliethedev Apr 6, 2026
5bc9683
chore: remove examples
olliethedev Apr 6, 2026
84d8db9
docs: update SKILL.md for codegen projects and E2E setup clarity
olliethedev Apr 6, 2026
0355c37
refactor: update e2e test scripts and remove obsolete playwright.conf…
olliethedev Apr 6, 2026
1b76d22
chore: update contributing guidelines and remove obsolete e2e smoke t…
olliethedev Apr 6, 2026
6d3e3bf
chore: update patches for codegen
olliethedev Apr 6, 2026
de4a916
fix: remove file-deletion step from react-router and tanstack codegen…
olliethedev Apr 6, 2026
e83b40f
chore: update pnpm-lock.yaml after codegen project setup
olliethedev Apr 6, 2026
b51b6c1
fix: remove spurious new-file patches for shadcn-installed ui components
olliethedev Apr 6, 2026
157d97b
fix: use shadcn baseline for src/router.tsx in tanstack patch generation
olliethedev Apr 6, 2026
f7650f4
chore: fix playground from importing fs lib from codegen cli lib
olliethedev Apr 6, 2026
dcc5f0b
fix: add new route file and update patch generation
olliethedev Apr 6, 2026
ed1bde1
fix: improve seed plan error handling and enhance server readiness ch…
olliethedev Apr 6, 2026
795827d
refactor: update route file to use context for query client and clean…
olliethedev Apr 6, 2026
95b8170
feat: add new seed generation capabilities for Next.js and Vite
olliethedev Apr 7, 2026
b19c278
fix: update tanstack route test to use createFileRoute and verify ser…
olliethedev Apr 7, 2026
8191359
feat: add AI chat API key handling and user banner in pages layout te…
olliethedev Apr 7, 2026
9bc18e0
chore: add exclusion for codegen-projects in biome.json file
olliethedev Apr 7, 2026
eb02d4d
feat: add .env template for OpenAI API key configuration in stackblit…
olliethedev Apr 7, 2026
478867d
chore: update patches
olliethedev Apr 7, 2026
9266a11
chore: update patches
olliethedev Apr 7, 2026
b5cd5f0
chore: remove outdated UI component patches for empty, field, and item
olliethedev Apr 7, 2026
b03515c
chore: remove examples directory from pnpm workspace configuration
olliethedev Apr 8, 2026
350a39b
chore: track codegen projects
olliethedev Apr 8, 2026
44f3a3e
feat: integrate PageAIContextProvider into layout patching for AI cha…
olliethedev Apr 8, 2026
0e790e9
chore: update patches
olliethedev Apr 8, 2026
31ffc62
chore: remove codegen from git tracking
olliethedev Apr 8, 2026
8e56609
chore: add codegen-projects to .gitignore
olliethedev Apr 8, 2026
364a712
refactor: improve environment variable handling in stack-client and e…
olliethedev Apr 8, 2026
975f0b0
chore: update patch files
olliethedev Apr 8, 2026
7868b74
chore: fix nextjs playground project
olliethedev Apr 8, 2026
414cfa4
chore: simplify import statements in local storage adapter
olliethedev Apr 8, 2026
56f1eea
chore: remove files replaced by E2E patches in setup scripts
olliethedev Apr 8, 2026
21af4b4
fix: add packages/ui/** to codegen-e2e workflow paths filter
cursoragent Apr 8, 2026
a1ade0b
Fix inconsistent reuseExistingServer in tanstack web server config
cursoragent Apr 8, 2026
98cf4f1
test: change codegen project initialization approach
olliethedev Apr 8, 2026
8b42035
chore: add zod and lucide-react dependencies to project templates and…
olliethedev Apr 8, 2026
851fe0c
chore: update lucide-react dependency to latest version in project te…
olliethedev Apr 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 10 additions & 10 deletions .agents/skills/btst-build-config/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,27 @@ The `postbuild.cjs` script auto-discovers and copies them — no manual registra
}
```

## Updating all three example apps
## Updating all three codegen projects

When adding a new plugin or changing plugin config, update ALL three:

**Next.js** (`examples/nextjs/`)
- `lib/stack.tsx` — backend plugin registration
**Next.js** (`codegen-projects/nextjs/`)
- `lib/stack.ts` — backend plugin registration
- `lib/stack-client.tsx` — client plugin registration
- `app/pages/[[...all]]/layout.tsx` — override configuration
- `app/pages/layout.tsx` — override configuration
- `app/globals.css` — `@import "@btst/stack/plugins/{name}/css";`

**React Router** (`examples/react-router/`)
- `app/lib/stack.tsx`
**React Router** (`codegen-projects/react-router/`)
- `app/lib/stack.ts`
- `app/lib/stack-client.tsx`
- `app/routes/pages/_layout.tsx`
- `app/app.css`

**TanStack** (`examples/tanstack/`)
- `src/lib/stack.tsx`
**TanStack** (`codegen-projects/tanstack/`)
- `src/lib/stack.ts`
- `src/lib/stack-client.tsx`
- `src/routes/pages/route.tsx`
- `src/styles/app.css`
- `src/styles.css`

### Override type registration (in each layout)

Expand Down Expand Up @@ -119,6 +119,6 @@ pnpm turbo clean && pnpm build
## Gotchas

- **Missing `typesVersions`** — always add alongside `exports`; TypeScript won't resolve the new path otherwise.
- **Build cache** — run `pnpm turbo clean` if changes aren't reflected in examples after `pnpm build`.
- **Build cache** — run `pnpm turbo clean` if changes aren't reflected in codegen projects after `pnpm build`.
- **CSS not loading** — ensure `"./plugins/{name}/css"` entry exists in `package.json` exports; `postbuild.cjs` handles the rest automatically.
- **`@workspace/ui` sub-path components** — if a new component imports from a directory (not a single file), add it to `EXTERNAL_REGISTRY_COMPONENTS` in `build-registry.ts`.
18 changes: 18 additions & 0 deletions .agents/skills/btst-client-plugin-dev/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,30 @@ description: Patterns for writing BTST client plugins inside the monorepo, inclu
src/plugins/{name}/
client/
plugin.tsx ← defineClientPlugin entry
hooks.ts ← "use client" React hooks only
components/
pages/
my-page.tsx ← wrapper: ComposedRoute + lazy import
my-page.internal.tsx ← actual UI: useSuspenseQuery
query-keys.ts ← React Query key factory
```

## Server/client module boundary

`client/plugin.tsx` must stay import-safe on the server. Next.js (including SSG build)
can execute `createStackClient()` on the server, which calls each `*ClientPlugin()`
factory. If that module is marked `"use client"` or imports a client-only module, build
can fail with "Attempted to call ... from the server".

Rules:

- Do **not** add `"use client"` to `client/plugin.tsx`.
- Keep `client/plugin.tsx` free of React hooks (`useState`, `useEffect`, etc.).
- Put hook utilities in a separate client-only module (`client/hooks.ts`) with
`"use client"`, and re-export them from `client/index.ts`.
- UI components can remain client components as needed; only the plugin factory entry
must stay server-import-safe.

## Route anatomy

Each route returns exactly three things:
Expand Down Expand Up @@ -110,6 +127,7 @@ type PluginOverrides = {
- **Next.js Link href undefined** — use `href={href || "#"}` pattern.
- **Suspense errors not caught** — add `if (error && !isFetching) throw error` in every suspense hook.
- **Missing ComposedRoute wrapper** — without it, errors crash the entire app instead of hitting ErrorBoundary.
- **Client directive on `client/plugin.tsx`** — can break SSG/SSR when plugin factories are invoked server-side.

## Full code patterns

Expand Down
69 changes: 52 additions & 17 deletions .agents/skills/btst-testing/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,41 +67,76 @@ Use `vi.mock` for external modules that don't exist in the test environment (e.g

## E2E tests (Playwright)

### E2E setup

Playwright configuration lives in `e2e/playwright.codegen.config.ts`, command `pnpm codegen:e2e`. It starts the `codegen-projects/` apps (ports 3006–3008) and tests the CLI codegen output — accurately reflecting what a real `btst init` user gets.

The codegen projects are built from scratch via `scripts/codegen/setup-*.sh`.

### Location and naming

Tests live in `e2e/tests/`. Naming convention: `smoke.{feature}.spec.ts`

Examples: `smoke.chat.spec.ts`, `smoke.blog.spec.ts`

### Setting up codegen projects (required before running codegen E2E)

The `codegen-projects/` directory is **not committed** — build it from scratch:

```bash
# Set up a specific framework
bash scripts/codegen/setup-nextjs.sh
bash scripts/codegen/setup-react-router.sh
bash scripts/codegen/setup-tanstack.sh

# Or set up all frameworks at once
bash scripts/codegen/setup.sh

# Cleanup when you want a fresh start
bash scripts/codegen/cleanup.sh nextjs
bash scripts/codegen/cleanup.sh react-router
bash scripts/codegen/cleanup.sh tanstack
```

See `scripts/codegen/README.md` for full details on the E2E overlay file system and update workflow.

### Run commands

```bash
# All frameworks (starts all 3 servers)
cd e2e
export $(cat ../examples/nextjs/.env | xargs)
pnpm e2e:smoke

# Single framework only
pnpm e2e:smoke:nextjs
pnpm e2e:smoke:tanstack
pnpm e2e:smoke:react-router
# Run all codegen E2E tests
pnpm codegen:e2e

# Specific test file
pnpm e2e:smoke -- tests/smoke.chat.spec.ts
# Target a specific framework
pnpm codegen:e2e:nextjs
pnpm codegen:e2e:tanstack
pnpm codegen:e2e:react-router

# Specific Playwright project
pnpm e2e:smoke -- --project="nextjs:memory"
# Specific test file
pnpm codegen:e2e:nextjs -- tests/smoke.blog.spec.ts
```

### Playwright projects and ports

| Project | Port |
|---|---|
| `nextjs:memory` | 3003 |
| `tanstack:memory` | 3004 |
| `react-router:memory` | 3005 |
| `nextjs:codegen` | 3006 |
| `tanstack:codegen` | 3007 |
| `react-router:codegen` | 3008 |

Set `BTST_FRAMEWORK=nextjs|tanstack|react-router` to start only one server.

### In-memory state between test runs

Defined in `playwright.config.ts`. By default all three servers start. Set `BTST_FRAMEWORK=nextjs|tanstack|react-router` to start only one — or use the per-framework scripts above. CI uses a matrix to run each in a separate parallel job.
The in-memory adapter keeps data alive for the lifetime of the server process. If you re-run tests against an already-running server, earlier test data will still be present and can cause failures.

To reset: kill the server and let `reuseExistingServer: true` restart it, or rebuild with `start:e2e`:

```bash
kill $(lsof -ti:3006)
pnpm -F nextjs run start:e2e # rebuilds .next and starts fresh
```

### API key guard pattern

Expand All @@ -122,7 +157,7 @@ test.beforeEach(async () => {
### Environment variables

```bash
export $(cat ../examples/nextjs/.env | xargs)
# Env is loaded from codegen-projects/nextjs/.env automatically by playwright.codegen.config.ts
```

For CI, the workflow uses a matrix — each framework job sets `BTST_FRAMEWORK` and only starts its own server.
For CI, the codegen workflow (`.github/workflows/codegen-e2e.yml`) builds the codegen project from scratch and passes `OPENAI_API_KEY` from secrets.
Loading