You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte-kit-vice/AGENTS.md

61 lines
2.6 KiB

# AGENTS.md
This file provides guidance to agents when working with code in this repository.
docs: COMPONENT_AUDIT_GUIDE.md — inviolable pre-flight for component work Creates the binding pre-flight checklist every agent / contributor must read before touching any UIX component (`src/uix/{morfo, soma, sema, eidos}/components/{name}` or `web/routes/uix/components/{name}/`). Sections: 0. Inviolable rule — always read this + DEMO_AUTHORING_GUIDE + components/README before coding 1. Reference library matrix (radix-themes, chakra, mantine, mui, react-aria, ark, bits, shadcn, WAI-ARIA APG) with what each is for 2. 4-layer ownership recap (morfo / soma / sema / eidos) + the 2-of-3 rule for morfo extensions 3. Pre-flight audit template — feature parity matrix, architectural choices, reference comparison, decision log, user sign-off line 4. Project-wide architectural rules (Radix item/container split, composition over visibility props, chip parity, size category cheatsheet, per-event intent, no re-export facades, persistent label registries, floating layer defaults, combobox keyboard, Chakra band-above-control chips) 5. Demo template lock — points at DEMO_AUTHORING_GUIDE 6. Anti-pattern catalogue — every failed approach from recent sessions with WHY it failed (shallow demos, matchAnchorWidth, visibility booleans, inline chips, onpointerdown picks, flex 100% wrap, unregistering labels on unmount, auto-rendering wrappers, refocus without guard, agent git reset, skipped audit) 7. Canonical canaries per domain (drawer, search-field, box, flex, date-picker, avatar) 8. Audit log — running table of completed audits with commit hashes + the known gaps from Layout Batch 1 to address before the next round (alignContent on Flex/Grid, columns/rows shorthand on Grid, grow boolean on Group, fluid on Container, HStack/VStack helpers) 9. Pre-port checklist consumers can copy into task plans 10. "When in doubt, ask the user" closer AGENTS.md updated with a top-banner ⚠ block linking the three required reads (this guide, the demo guide, the eidos components README) so any new agent picks them up before touching code. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
## ⚠ INVIOLABLE — component work pre-flight
Before creating, porting, or modifying ANY UIX component, you MUST read:
1. **[`web/routes/uix/lib/COMPONENT_AUDIT_GUIDE.md`](web/routes/uix/lib/COMPONENT_AUDIT_GUIDE.md)** — pre-flight audit + reference library matrix + architectural rules + anti-patterns
2. **[`web/routes/uix/lib/DEMO_AUTHORING_GUIDE.md`](web/routes/uix/lib/DEMO_AUTHORING_GUIDE.md)** — locked demo template (6 tabs, stage, observer, snippets)
3. **[`src/uix/eidos/components/README.md`](src/uix/eidos/components/README.md)** — eidos contract
Skipping these produced the broken Layout Batch 1 (commit `9ec2a57a`) that was reverted + redone. Don't repeat the mistake.
## Build/Test Commands
```bash
npm run dev # Start dev server
npm run build # Production build (static site)
npm run test # Run all tests once
npm run test:unit # Run tests in watch mode
npx vitest run src/lib/ling/test/ling.test.ts # Run single test file
npx vitest run -t "describe name" # Run tests matching pattern
npm run check # Type check with svelte-check
npm run lint # Check formatting with Prettier
npm run format # Auto-format with Prettier
```
## Critical Architecture
### Dual Alias Configuration Required
Path aliases must be synced in BOTH [`svelte.config.js`](svelte.config.js:11) AND [`vite.config.ts`](vite.config.ts:14) for TypeScript, Svelte compiler, and Vitest to resolve consistently:
- `@/` → `src/`
- `@/ling` → `src/lib/ling` (i18n)
- `@/logr` → `src/lib/logr` (logging)
- `@/glob` → `src/lib/glob` (globalization)
- `@/actx` → `src/lib/actx` (audio context)
- `$uix` → `src/uix` (UI components)
### Svelte 5 Runes Mode Enforced
[`svelte.config.js`](svelte.config.js:31) forces `runes: true` for all project files via `dynamicCompileOptions`. All components must use Svelte 5 runes (`$state`, `$derived`, `$effect`, etc.).
### Vitest Two-Project Structure
[`vite.config.ts`](vite.config.ts:35) defines separate test projects:
- **client**: Browser tests via Playwright for `*.svelte.{test,spec}.{js,ts}` files
- **server**: Node environment for `*.{test,spec}.{js,ts}` files (excludes svelte tests)
### Internal Library Pattern
Each library (`ling`, `logr`, `glob`, `actx`) uses factory functions (`createLing`, `createLogr`, etc.) that return instances with internal state. The `logr` library depends on `ling` for localized messages.
## Code Style
- Tabs for indentation, single quotes, no trailing commas, 100 char print width
- Spanish comments in code are acceptable

Powered by TurnKey Linux.