You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Bash(__NEW_LINE_3f3e368681926904__ prog add \"Migrate server/metrics.ts to Effect Metric\" -p pg.garden -d \"Replace raw @opentelemetry/sdk-metrics with Effect''s built-in Metric module.:*)",
67
+
"Bash(__NEW_LINE_3f3e368681926904__ prog add \"Migrate server/otel-logger.ts to Effect.log\" -p pg.garden -d \"Replace raw @opentelemetry/sdk-logs with Effect''s structured logging.:*)",
68
+
"Bash(__NEW_LINE_3f3e368681926904__ prog add \"Extract remaining auth/webhook route handlers to Effect.fn\" -p pg.garden -d \"After the proof of concept with auth.register, migrate the remaining manual-span handlers.:*)",
69
+
"Bash(__NEW_LINE_3f3e368681926904__ prog add \"Browser: WebSdk.layer replaces raw WebTracerProvider\" -p pg.garden -d \"Replace src/telemetry.ts raw OTel with Effect WebSdk.layer.:*)",
Copy file name to clipboardExpand all lines: CLAUDE.md
+25-41Lines changed: 25 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,65 +3,45 @@
3
3
## Tooling
4
4
5
5
-**Runtime**: Bun — always use `bun` instead of `npx`/`node`
6
-
-**Lint**: Run `bun lint` after making changes. Fix errors before moving on.
7
-
-**Typecheck**: Run `bun typecheck` after making changes. Zero errors policy.
8
-
-**Dev server**: `bun run dev` (port 3000, Vite SSR)
9
-
-**Build**: `bun run build` then `bun run start`
10
-
-**Renderer**: Don't manually run `build:renderer` — it runs in watch mode alongside dev
6
+
-**Dev server**: `bun run dev` (port 3000, Vite SSR, assume it is running, ask user to run it if down)
7
+
-**Renderer**: Don't manually run `build:renderer` — it runs in watch mode alongside dev
8
+
-**Webviews**: Don't manually run `build:webview` — it runs in watch mode alongside dev
9
+
-**Production Build**: `bun run build && bun start` runs on port 3000
11
10
12
-
## Architecture
11
+
## Debugging
13
12
14
-
Full VSCode workbench in the browser via `@codingame/monaco-vscode-api`. Not a simple Monaco demo — it has the complete extension API, multi-process workers, virtual filesystem (IndexedDB + memory overlays), and 300+ VSCode service packages.
13
+
-**Lint**: Run `bun lint` after making changes. Fix errors before moving on.
14
+
-**Typecheck**: Run `bun typecheck` after making changes. Zero errors policy.
15
+
-**Smoke test**: After significant changes, use any available browser MCP to open `http://localhost:3000` and check console messages for errors.
16
+
-`effect-devtui` mcp should be available to capture observability data from Effect apps
15
17
16
18
### Server (`server/`)
17
19
18
-
Bun + Elysia backend. SSR injects data via `window.__INITIAL_DATA__`.
19
-
20
-
-`index.ts` — entry, routes dev/prod
21
-
-`app.ts` — API routes (Elysia + TypeBox validation)
22
-
-`db.ts` — Kysely DB connections + `withAuthContext()` for RLS
20
+
Bun + Effect Platform backend. Look at `server/httpapi/` for routes and `server/layers/` for service layers. SSR uses Effect HttpApi contracts. Kysely for DB queries with `withAuthContext()` for RLS.
23
21
24
22
### Client (`src/`)
25
23
26
-
-`entry.ts` → `loader.ts` — boot sequence
27
-
-`setup.common.ts` / `setup.workbench.ts` — VSCode service overrides
-`features/notebook/renderer/` — Preact notebook renderer (Shadow DOM, Vite lib mode)
30
-
31
-
### Notebook Renderer
32
-
33
-
- Built via `vite.renderer.config.ts` (lib mode, `inlineDynamicImports`)
34
-
- CSS inlined into JS via custom `inlineCssPlugin` — captures CSS in `generateBundle`, replaces a unique placeholder in the JS entry
35
-
- pev2 vendored at `src/features/notebook/renderer/pev2/`
36
-
- Output: `src/features/notebook/renderer-dist/`
37
-
38
-
## Database Patterns
39
-
40
-
- Use Kysely query builder for all SQL (never raw SQL except for Postgres function calls with named args)
41
-
- Wrap user-data queries in `withAuthContext(session.id, async (tx) => ...)`
42
-
- TypeBox validation schemas on all route params, body, query
43
-
- Never `body as any`, `Number(params.id)`, or `new Response(JSON.stringify())`
24
+
Boot sequence starts at `src/entry.ts` → `src/loader.ts`. VSCode service overrides in `src/setup.*.ts`. Feature modules live in `src/features/` — each is an Effect Layer (auth, notebook, playground, serverSync, pglite, etc.).
44
25
45
26
## Code Quality Rules
46
27
47
-
- Keep TypeScript strict — no `any` leaks. Use `unknown` and narrow.
48
-
- Use Effect Schema (`import * as S from "effect/Schema"`) for runtime JSON validation
49
-
- Annotate `JSON.parse()` results as `unknown` or validate with a schema
50
-
- Catch blocks: use bare `catch {}` if error unused, or `catch (err)` with `err instanceof Error ? err.message : String(err)`
51
-
- Don't leave floating promises — use `void` or `await`
52
-
- Don't leave `async` on functions that don't `await` — use `Promise.resolve()` if the interface requires it
53
-
- Eden API error objects need `JSON.stringify(error.value)` in template literals
- Use Effect for all code — services, layers, error handling
29
+
- All error handling should be handled through Effect so runtime errors can be traced through the type system
30
+
- Use Effect Schema (`import * as S from "effect/Schema"`) for runtime any and all runtime validation
31
+
- Never `JSON.parse(input)` use `S.parseJson(schema)(input)`
32
+
- Use Kysely query builder for DB queries (never raw SQL except for Postgres function calls with named args)
33
+
- Effect information can be found in through `effect-solutions` cli and from reading `~/.local/share/effect-solutions/effect`
34
+
- You can and should immediately refactor any non-Effect code to use best practices
55
35
56
36
## Task Tracking
57
37
58
-
This project uses **prog** for cross-session task management. **Do NOT use internal TodoWrite/TaskCreate/TaskUpdate tools** — use `prog` for all task tracking.
59
-
Run `prog prime` for workflow context, or configure hooks for auto-injection.
38
+
This project uses **prog** for cross-session task management. **Do NOT use internal planning tools** — use `prog` for all task tracking.
39
+
Run `prog prime` for workflow context
60
40
61
41
**Quick reference:**
62
42
63
43
```
64
-
prog ready # Find unblocked work
44
+
prog ready -p pg.garden # Find unblocked work
65
45
prog add "Title" -p pg.garden # Create task
66
46
prog start <id> # Claim work
67
47
prog log <id> "msg" # Log progress
@@ -71,3 +51,7 @@ prog done <id> # Complete work
71
51
MUST use `-p pg.garden` for all commands that dont have an <id>
72
52
73
53
For full workflow: `prog prime`
54
+
55
+
## Landing the plane
56
+
57
+
When you believe changes are complete, mark the current `prog` task as done and prompt the user with a commit message to describe changes.
0 commit comments