|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +Guidance for coding agents working in this repository. (See `CLAUDE.md` for the |
| 4 | +full project reference — commands, architecture, the Effect 3→4 migration notes, |
| 5 | +and the v4 API map. This file documents the vendored reference source.) |
| 6 | + |
| 7 | +## Vendored reference source |
| 8 | + |
| 9 | +This project vendors external source under `repos/` as **read-only reference |
| 10 | +material** (via `git subtree`, not a submodule — no init needed). |
| 11 | + |
| 12 | +- Use vendored source to learn idiomatic usage; never import from it or edit it. |
| 13 | +- Prefer patterns from the vendored source over documentation or web search — |
| 14 | + the published Effect docs are for Effect 3 and are **wrong** for the Effect 4 |
| 15 | + beta this project targets. The vendored source is the source of truth. |
| 16 | +- `repos/` is excluded from TypeScript compilation, ESLint, Prettier, and the |
| 17 | + npm package (`files` allowlist). Do not add it to any `include`/`files` list. |
| 18 | + |
| 19 | +### `repos/effect/` — Effect v4 source (vendored from `Effect-TS/effect-smol`, branch `main`) |
| 20 | + |
| 21 | +`effect@4.0.0-beta.x` is built from the `effect-smol` monorepo. When writing or |
| 22 | +reviewing Effect code, inspect `repos/effect/packages/effect/src` (and |
| 23 | +`.../test`) for real v4 API shapes, signatures, and idioms — do not infer them |
| 24 | +from memory or v3 docs. |
| 25 | + |
| 26 | +High-value files for this generator: |
| 27 | + |
| 28 | +- `repos/effect/packages/effect/src/Schema.ts` — `Top`, `Bottom`, `Codec`, |
| 29 | + `Struct`, `brand`, `check`, `encodeKeys`, `Enum`, the `is*` filters. This is |
| 30 | + the file to consult for any `Schema.*` question. (`Top` is the structural base |
| 31 | + every schema must satisfy; `Bottom<...>` is its 15-param shape.) |
| 32 | +- `repos/effect/packages/effect/src/SchemaAST.ts` — AST node types (`Objects`, |
| 33 | + `PropertySignature`, `resolve`, the `is*` guards). v4 reworked this heavily |
| 34 | + from v3. |
| 35 | + |
| 36 | +### Effect 3 → 4 quick map (verified against the vendored source) |
| 37 | + |
| 38 | +- `Schema.Schema<T,E,R>` → `Schema.Codec<T,E,RD,RE>`; `Schema.Schema.All` → |
| 39 | + `Schema.Top`; `Schema.Schema.Type<S>` → `Schema.Schema.Type<S>` (kept); |
| 40 | + `Schema.Codec.Encoded/DecodingServices/EncodingServices<S>` for the rest. |
| 41 | +- `asSchema` → `revealCodec`; `.annotations({})` → `.annotate({})`. |
| 42 | +- `Schema.DateFromSelf` → `Schema.Date`; `Schema.UUID` → |
| 43 | + `Schema.String.check(Schema.isUUID())`; `Schema.BigIntFromSelf` → `Schema.BigInt`. |
| 44 | +- Filters moved under `.check(Schema.is*)` (e.g. `Schema.int()` → |
| 45 | + `Schema.check(Schema.isInt())`, `Schema.between(a,b)` → |
| 46 | + `Schema.check(Schema.isBetween({ minimum, maximum }))`). |
| 47 | +- Variadic combinators take arrays: `Schema.Union(a,b)` → `Schema.Union([a,b])`, |
| 48 | + `Schema.Literal(a,b)` → `Schema.Literals([a,b])`, `Schema.Tuple(...)` → array. |
| 49 | +- `Schema.Enums` → `Schema.Enum`; `Schema.propertySignature(...).pipe(Schema.fromKey(...))` |
| 50 | + → struct-level `Schema.encodeKeys({ tsName: "db_col" })`. |
| 51 | + |
| 52 | +## Updating the vendored source |
| 53 | + |
| 54 | +```bash |
| 55 | +git subtree pull --prefix=repos/effect https://github.com/Effect-TS/effect-smol.git main --squash |
| 56 | +``` |
| 57 | + |
| 58 | +Keep it roughly in sync with the `effect` beta the project pins (`devDependencies.effect`). |
0 commit comments