diff --git a/AGENTS.md b/AGENTS.md index 4f4c5bf..bb3e21e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,19 +1,34 @@ -# AGENTS.md +# Veridian AGENTS.md -This file contains guidelines and commands for agentic coding agents working in -the Veridian repository. +**Nuxt 4 AI chat platform with Triplit database + better-auth** -## Project Overview +## Architecture Overview -Veridian is a Nuxt 4 application built with TypeScript, using Triplit with -better-auth for authentication, and UnoCSS for styling. The app is an agnetic -chat platform that is meant to provide a well rounded experience for interacting -with LLMs as well as providing a way to manage agents and provide helpful tools -like RAG (retrieval augmented generation) and web scraping/search. +``` +app/ # Nuxt 4 application (SSR) +├── components/ # Vue components (Sidenav, Message, Settings, etc.) +├── composables/ # Shared state (useChat, useAuth, useModels, etc.) +├── layouts/ # Auth and default layouts +├── middleware/ # Global auth middleware +├── pages/ # File-based routing (/, /auth/*, /agent/*) +├── plugins/ # Auth plugins (client/server), remark markdown +├── types/ # TypeScript interfaces +└── utils/ # Crypto, model-mapping, search utilities -You should be connected to the Nuxt docs MCP server, if you need to reference -the documentation or are unsure on how to implement something, consult the -docs. +server/ # Server-side API routes +└── api/ + ├── auth/ # Better-auth handler + ├── chat/ # Generation, cancel endpoints + └── provider/ # Model fetching from providers + +triplit/ # Database +├── schema.ts # Full schema with auth + app collections +└── auth-schema.ts # Auth collections (users, sessions, accounts) + +lib/ # Shared utilities +├── auth.ts # Better-auth server config +└── auth-client.ts # Better-auth client +``` ## Core Commands @@ -26,215 +41,172 @@ database commands. - `bunx triplit schema push` - Push schema changes to database -## Tech Stack & Dependencies +## Code Style -- **Framework**: Nuxt 4 (SSR enabled) -- **Language**: TypeScript with strict configuration -- **Database**: Triplit (next generation fullstack syncing database, sort of - like convex) -- **Auth**: better-auth with email/password and social providers -- **Styling**: UnoCSS with presetMini -- **Icons**: @nuxt/icon with Iconify, use Myna UI Icons +- **Indentation**: 4 spaces (no tabs) +- **Semicolons**: Always required +- **Equality**: Strict equality only (`===`, `!==`) +- **Components**: PascalCase, never self-closing tags +- **Functions**: camelCase for functions, PascalCase for constructors/classes +- **Constants**: SCREAMING_SNAKE_CASE for constants, camelCase for const values +- **Files**: kebab-case for files, PascalCase for Vue components +- **State**: `useState('prefix:name', () => default)` for reactive state -## Code Style Guidelines +## Imports Order -**Follow the LLVM golden rule: If you are extending, enhancing, or bug fixing -already implemented code, use the style that is already being used so that -the source is uniform and easy to follow.** +Group imports in this order (alphabetical within groups): +1. Type imports (`types/`) +2. Dependency imports (npm packages) +3. Triplit imports (`#triplit/`, `@triplit/`) +4. Vue/Nuxt imports (`vue`, `#app`, `~~/`, `~/`, `@/`) +5. Local imports (`lib/`, `server/`) -- **Always end lines with a semicolon regardless of surrounding code** -- Use 4 spaces for indentation -- Use consistent naming conventions for variables, functions, and constants -- Always use strict equality checks (`===` and `!==`) instead of loose equality - checks (`==` and `!=`) -- Prefer using explicity equality checks over truthy/falsy checks - e.g., prefer `if (value !== null)` instead of `if (value)` -- Always check existing code patterns before implementing new features -- Follow existing component and composable structures -- Use proper TypeScript types for all function parameters and returns -- Implement proper cleanup in composables (e.g., useClickOutside) -- Prefer reactive state management over direct DOM manipulation -- Keep components focused and single-purpose -- Use semantic HTML elements where appropriate - -### General Structure - -- Use Nuxt's app directory structure (`app/`, `server/`, `lib/`) -- Auth configuration in `lib/auth.ts` -- Server API routes go in `server/api/` -- Composables go in `app/composables/` -- Database schema in `db/schema.ts` -- Database migrations in `db/migrations/` - -### TypeScript Guidelines - -- Use strict TypeScript with no implicit any -- Export types and interfaces explicitly -- Use `computed()` and `ref()` from Vue 3 reactivity system -- Type API responses and database models - -### Vue Components - -- **Never use self-closing tags, excluding images, br, hr, and input** -- Use `