diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..960d675 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,246 @@ +# AGENTS.md — Agentic Craft + +You are working on **Agentic Craft**, a reference site for designing agent +interfaces beyond chat. The site documents interaction patterns for orchestration, +tool use, approvals, memory, multi-agent coordination, and observability. The +shadcn-compatible registry is the distribution channel — consumers run +`npx shadcn@latest add bitcomplete/agentic-craft/` to install primitives. + +**The job whenever you edit this repo:** every demo is a teaching artifact, so +interaction quality (real state, real animation, accessible controls) is a +first-class feature, not an afterthought. The site teaches agent UX — looking +like an AI demo would forfeit the argument. + +The canonical research backing the patterns lives in `docs/research.md`. When +you build or modify a pattern page, that file is the source of truth for *what* +the pattern teaches. + +## Stack + +| Concern | Choice | +|------------------|--------| +| Framework | Next.js 16 App Router (`next: ^16.1.6`) | +| UI library | React 19 (`react: ^19.2.0`) | +| Styling | Tailwind CSS 4 (`tailwindcss: ^4.1.17`) | +| Component system | `@base-ui/react ^1.3.0` (NOT Radix) | +| Icons | `@hugeicons/react` + `@hugeicons/core-free-icons`; always monochrome, `strokeWidth={1.5}` | +| Fonts | PP Neue Montreal (sans), Signifier (serif) — local cuts in `app/fonts/` | +| Animations | Pure CSS keyframes in `src/index.css` or registry item `css` blocks; no motion library | +| Language | TypeScript strict; path alias `@/*` → `./src/*` | +| Package manager | npm only (`node >=20.9.0`) | +| Registry CLI | `shadcn` v4 | + +## Commands + +| Command | What it does | +|---------|--------------| +| `npm run dev` | Next.js dev server at `http://localhost:3000` | +| `npm run lint` | ESLint over the project | +| `npm run typecheck` | `tsc --noEmit` (strict) | +| `npm run format` | Prettier write over `**/*.{ts,tsx}` | +| `npm run format:check` | Prettier check | +| `npm run audit:ui` | `node scripts/audit-ui.mjs` (report only) | +| `npm test` | Vitest smoke tests in `tests/` | +| `npm run build` | Next.js production build | +| `npm run registry:build` | `shadcn build` — regenerates `public/r/` from `registry.json` | +| `npm run verify` | Full CI chain (lint → typecheck → format:check → audit-ui --fail → sync-registry --check → check-registry-deps → build → registry:build) | + +Before opening a PR, run `npm run verify`. If it fails, treat the failure as a +stop condition and fix the cause — do not bypass. + +## The four invariants + +These four rules are load-bearing for the project. Violating any of them ships +broken output. Treat each as a stop condition. + +### 1. Registry sync — the four-file commit rule + +UI primitives live in `src/components/ui/`. The registry copies them into +`registry/base-nova/ui/` via `node scripts/sync-registry.mjs`. Blocks live only +in `registry/base-nova/blocks/`. `registry.json` is the manifest. `public/r/` is +the committed build output. + +**Whenever you edit `src/components/ui/*`, you must:** + +1. Run `node scripts/sync-registry.mjs` — syncs into `registry/base-nova/ui/`. +2. Run `npm run registry:build` — regenerates `public/r/`. +3. Commit **all four** together: `src/components/ui/`, `registry/base-nova/ui/`, + `registry.json`, `public/r/`. + +CI runs `node scripts/sync-registry.mjs --check` and +`git diff --exit-code -- public/r registry.json`. Either drift fails the build. + +Every new registry item needs a smoke test in `tests/ui/` (primitives) or +`tests/blocks/` (blocks). + +**Never edit `registry/base-nova/ui/` directly.** Those are sync outputs. +**Never edit `public/r/` manually.** That is the build output. + +### 2. Motion policy — CSS keyframes only, no `