Skip to content

Latest commit

 

History

History
54 lines (48 loc) · 2.62 KB

File metadata and controls

54 lines (48 loc) · 2.62 KB

Repository Guidelines

Project Structure & Module Organization

  • app/: Next.js App Router entrypoints and routes.
  • app/(chat)/: chat UI pages plus API routes (api/chat, api/history, api/files/upload, etc.).
  • app/(auth)/: Auth.js login/register flows and auth route handlers.
  • components/: feature components; components/ui/ contains shared UI primitives.
  • lib/: core logic (lib/ai, lib/db, lib/dashboard, lib/editor, utilities).
  • artifacts/: artifact server/client implementations (text, code, image, sheet).
  • tests/: Playwright E2E (tests/e2e), fixtures/helpers, and prompt utilities.
  • public/images/: static assets.

Build, Test, and Development Commands

  • pnpm install: install dependencies.
  • pnpm dev: start local dev server (next dev --turbo).
  • pnpm build: run DB migration then build production app.
  • pnpm start: run production server locally.
  • pnpm lint: run Ultracite checks.
  • pnpm format: apply Ultracite fixes.
  • pnpm db:migrate: apply Drizzle migrations.
  • pnpm db:generate / pnpm db:studio: generate migrations / inspect DB.
  • pnpm test: run Playwright test suite.
  • Example single spec: pnpm exec playwright test tests/e2e/chat.test.ts.

Coding Style & Naming Conventions

  • Language: TypeScript + React function components.
  • Formatting/linting: Ultracite (pnpm lint, pnpm format) is the source of truth.
  • Use 2-space indentation and keep files in ASCII unless required.
  • Naming patterns:
  • Component files: kebab-case (for example chat-header.tsx).
  • Component exports: PascalCase (ChatHeader).
  • Hooks: useX naming in hooks/ (use-chat-visibility.ts).
  • Prefer @/ imports over deep relative paths.

Testing Guidelines

  • Framework: Playwright (@playwright/test).
  • Place end-to-end tests in tests/e2e/*.test.ts.
  • Keep test names behavior-focused (for example: "redirects to /chat/:id after sending message").
  • Update/add tests for changes to chat flow, model selection, auth, uploads, or API behavior.

Commit & Pull Request Guidelines

  • Follow existing history style: conventional prefixes like feat: and fix:.
  • Use imperative, concise subjects (optionally with scope, e.g., feat(chat): add workflow runner).
  • PRs should include:
  • What changed and why.
  • Linked issue/task.
  • Test evidence (commands run and results).
  • Screenshots/GIFs for UI changes.
  • Migration/env updates when schema or config changes.

Security & Configuration Tips

  • Never commit secrets; keep local values in .env.local.
  • Start from .env.example and document any new variables in PRs.
  • Avoid hard-coded external endpoints or API keys in source code.