This repository is a TypeScript / Next.js / viem / wagmi codebase. Treat it as a frontend product.
- Next.js App Router
- React 19
- TypeScript (
strict: true) - Tailwind CSS
- viem + wagmi + RainbowKit
- Vitest + Playwright
- Cloudflare / OpenNext deployment
-
Domain first
- New app domains should follow the same layout used by
/styfi,/veyfi, and/yeth. - Prefer:
app/<domain>/page.tsxapp/<domain>/<Domain>PageClient.tsxapp/<domain>/messages.tslib/clients/<domain>/types.tslib/clients/<domain>/client.tslib/clients/<domain>/mock.tslib/clients/<domain>/onchain.tslib/hooks/use<Domain>.ts
- New app domains should follow the same layout used by
-
Mock first
- Deliver the mocked UI state machine and mock data shapes before onchain reads/writes.
- The first production of any new surface should be stable mock-backed rendering with deterministic states.
-
UI never owns protocol math
- Render values supplied by domain clients and typed data sources.
- Keep formatting and lightweight derivation in UI.
- Put protocol-specific derivation in
lib/clients/<domain>/...orlib/format.ts.
-
Writes go through the shared transaction pipeline
- Prepare writes in domain clients.
- Execute through the shared
useTxflow. - Do not wire raw wagmi write calls directly inside page components.
-
Reuse shared UI primitives
- Prefer
components/ui/*and existing patterns from/styfi,/veyfi,/yeth. - Only add new primitives when a pattern is clearly cross-domain.
- Prefer
-
Copy is local
- Route-specific copy belongs in
app/<domain>/messages.ts. - Shared components stay copy-agnostic.
- Route-specific copy belongs in
-
Host and rollout safety
- New public app surfaces should be routable by path first.
- Subdomain rollout should stay gated until the route is validated on shared hosts / preprod.
- Production exposure should be feature-flagged.
- Keep TypeScript types explicit at the domain boundary.
- Prefer small, composable functions.
- Avoid speculative abstractions.
- Keep file names descriptive and aligned with current repo patterns.
- Follow existing linting and formatting style already present in the repo.
- Do not introduce new dependencies unless necessary.
Run at minimum for any meaningful change:
npm run typecheck
npm run lint
npm run testRun e2e when UI flows or route behavior change:
npm run test:e2e
npm run test:e2e:fullUse the supplied scripts in this overlay:
./scripts/agent-worktree.sh./scripts/workpkg-worktree.sh./scripts/workpkg-sync-env.sh
Use one long-lived accepted-work lane:
- branch:
agent/integration - worktree:
../<repo>.agent.integration
Create it from the bootstrap checkout with ./scripts/agent-worktree.sh create integration --no-install.
Merge approved work package branches into agent/integration, then tag the integration commit when a
milestone finishes, for example integration/m0.
Work package worktrees are intentionally outside the repo and use dot-suffixed sibling paths:
../<repo>.<track>.<milestone>[.<wp>]
Create work package worktrees from the integration worktree and pass --base agent/integration.
Create only the worktrees you need for the current milestone or work package.
If behavior changes, update the corresponding docs in docs/apps/<domain>/... as part of
the same change set.
A work package is only done when:
- acceptance criteria in the work package doc are met
- tests updated for changed behavior
- docs updated
- reviewer checklist passes
- integrator notes are recorded if the package affects merge order or rollout