CLAUDE.md
ruflo/src/ruvocal/CLAUDE.mdCLAUDE.md
Quality
97/100
Scores the file, not the repository.Length
662 words
16 headings · 4 code blocksRepository
67k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# CLAUDE.md23This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.45## Overview67Chat UI is a SvelteKit application that provides a chat interface for LLMs. It powers HuggingChat (hf.co/chat). The app speaks exclusively to OpenAI-compatible APIs via `OPENAI_BASE_URL`.89## Commands1011```bash12npm run dev # Start dev server on localhost:517313npm run build # Production build14npm run preview # Preview production build15npm run check # TypeScript validation (svelte-kit sync + svelte-check)16npm run lint # Check formatting (Prettier) and linting (ESLint)17npm run format # Auto-format with Prettier18npm run test # Run all tests (Vitest)19```2021### Running a Single Test2223```bash24npx vitest run path/to/file.spec.ts # Run specific test file25npx vitest run -t "test name" # Run test by name26npx vitest --watch path/to/file.spec.ts # Watch mode for single file27```2829### Test Environments3031Tests are split into three workspaces (configured in vite.config.ts):3233- **Client tests** (`*.svelte.test.ts`): Browser environment with Playwright34- **SSR tests** (`*.ssr.test.ts`): Node environment for server-side rendering35- **Server tests** (`*.test.ts`, `*.spec.ts`): Node environment for utilities3637## Architecture3839### Stack4041- **SvelteKit 2** with Svelte 5 (uses runes: `$state`, `$effect`, `$bindable`)42- **MongoDB** for persistence (auto-fallback to in-memory with MongoMemoryServer when `MONGODB_URL` not set)43- **TailwindCSS** for styling4445### Key Directories4647```48src/49├── lib/50│ ├── components/ # Svelte components (chat/, mcp/, voice/, icons/)51│ ├── server/52│ │ ├── api/utils/ # Shared API helpers (auth, superjson, model/conversation resolvers)53│ │ ├── textGeneration/ # LLM streaming pipeline54│ │ ├── mcp/ # Model Context Protocol integration55│ │ ├── router/ # Smart model routing (Omni)56│ │ ├── database.ts # MongoDB collections57│ │ ├── models.ts # Model registry from OPENAI_BASE_URL/models58│ │ └── auth.ts # OpenID Connect authentication59│ ├── types/ # TypeScript interfaces (Conversation, Message, User, Model, etc.)60│ ├── stores/ # Svelte stores for reactive state61│ └── utils/ # Helpers (tree/, marked.ts, auth.ts, etc.)62├── routes/ # SvelteKit file-based routing63│ ├── conversation/[id]/ # Chat page + streaming endpoint64│ ├── settings/ # User settings pages65│ ├── api/ # Legacy v1 API endpoints (mcp, transcribe, fetch-url)66│ ├── api/v2/ # REST API endpoints (+server.ts)67│ └── r/[id]/ # Shared conversation view68```6970### Text Generation Flow71721. User sends message via `POST /conversation/[id]`732. Server validates user, fetches conversation history743. Builds message tree structure (see `src/lib/utils/tree/`)754. Calls LLM endpoint via OpenAI client765. Streams response back, stores in MongoDB7778### Model Context Protocol (MCP)7980MCP servers are configured via `MCP_SERVERS` env var. When enabled, tools are exposed as OpenAI function calls. The router can auto-select tools-capable models when `LLM_ROUTER_ENABLE_TOOLS=true`.8182### LLM Router (Omni)8384Smart routing via Arch-Router model. Configured with:8586- `LLM_ROUTER_ROUTES_PATH`: JSON file defining routes87- `LLM_ROUTER_ARCH_BASE_URL`: Router endpoint88- Shortcuts: multimodal routes bypass router if `LLM_ROUTER_ENABLE_MULTIMODAL=true`8990### Database Collections9192- `conversations` - Chat sessions with nested messages93- `users` - User accounts (OIDC-backed)94- `sessions` - Session data95- `sharedConversations` - Public share links96- `settings` - User preferences9798## Environment Setup99100Copy `.env` to `.env.local` and configure:101102```env103OPENAI_BASE_URL=https://router.huggingface.co/v1104OPENAI_API_KEY=hf_***105# MONGODB_URL is optional; omit for in-memory DB persisted to ./db106```107108See `.env` for full list of variables including router config, MCP servers, auth, and feature flags.109110## Code Conventions111112- TypeScript strict mode enabled113- ESLint: no `any`, no non-null assertions114- Prettier: tabs, 100 char width, Tailwind class sorting115- Server vs client separation via SvelteKit conventions (`+page.server.ts` vs `+page.ts`)116117## Feature Development Checklist118119When building new features, consider:1201211. **HuggingChat vs self-hosted**: Wrap HuggingChat-specific features with `publicConfig.isHuggingChat`1222. **Settings persistence**: Add new fields to `src/lib/types/Settings.ts`, update API endpoint at `src/routes/api/v2/user/settings/+server.ts`1233. **Rich dropdowns**: Use `bits-ui` (Select, DropdownMenu) instead of native elements when you need icons/images in options1244. **Scrollbars**: Use `scrollbar-custom` class for styled scrollbars1255. **Icons**: Custom icons in `$lib/components/icons/`, use Carbon (`~icons/carbon/*`) or Lucide (`~icons/lucide/*`) for standard icons1266. **Provider avatars**: Use `PROVIDERS_HUB_ORGS` from `@huggingface/inference` for HF provider avatar URLs127
Also in ruvnet/ruflo
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| ruvnet/rufloAGENTS.md · 67k | AGENTS.md | buildteststyletypes+5 | 81/100 | 3 days ago | |
| ruvnet/rufloCLAUDE.md · 67k | CLAUDE.md | setupbuildlint-formatstyle+8 | 84/100 | 3 days ago | |
| ruvnet/ruflov3/@claude-flow/cli/CLAUDE.md · 67k | CLAUDE.md | teststyletypestesting-strategy+4 | 69/100 | 3 days ago | |
| ruvnet/ruflov3/@claude-flow/codex/AGENTS.md · 67k | AGENTS.md | setupbuildteststyle+8 | 96/100 | 3 days ago | |
| ruvnet/ruflov3/@claude-flow/mcp/CLAUDE.md · 67k | CLAUDE.md | teststyletypestesting-strategy+4 | 69/100 | 3 days ago | |
| ruvnet/ruflov3/CLAUDE.md · 67k | CLAUDE.md | setupbuildtestarch+4 | 70/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| dotCMS/corecore-web/CLAUDE.md · 950 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 3 days ago | |
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| microsoft/playwrightCLAUDE.md · 94k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| Adit-Jain-srm/NightmareNetCLAUDE.md · 45 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 3 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 3 days ago | |
| filamentphp/filamentCLAUDE.md · 32k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| dotCMS/coreCLAUDE.md · 950 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | 3 days ago | |
| lollipopkit/flutter_server_boxCLAUDE.md · 8.3k | CLAUDE.md | buildteststylearch+2 | 98/100 | 3 days ago |
