This file provides guidance to AI Agents when working with code in this repository.
npm run dev- Start development server on port 3000 (local mode)npm run dev:e2e- Start development server in integration mode for E2E testing
npm run build- Build the Astro application for productionnpm run preview- Preview the built application locally
npm run lint- Lint and fix TypeScript/Astro filesnpm run lint:check- Check linting without fixingnpm run format- Format code with Prettiernpm run format:check- Check formatting without fixing
npm run test- Run unit tests with Vitestnpm run test:watch- Run tests in watch modenpm run test:ui- Run tests with UI interfacenpm run test:coverage- Generate test coverage reportnpm run test:e2e- Run end-to-end tests with Playwrightnpm run test:e2e:ui- Run E2E tests with UInpm run test:e2e:codegen- Generate test code with Playwright
npm run generate-rules- Generate rules JSON from TypeScript definitions
- Framework: Astro 5 with React 18.3 integration
- Styling: Tailwind CSS 4
- State Management: Zustand for client-side state
- Database: Supabase (PostgreSQL with real-time features)
- Testing: Vitest for unit tests, Playwright for E2E tests
- Authentication: Supabase Auth with email/password and password reset
pages/- Astro pages with API routes underapi/components/- React components organized by featuredata/- Static data including AI rules definitions inrules/subdirectoryservices/- Business logic services, notablyRulesBuilderServicestore/- Zustand stores for state managementhooks/- Custom React hooks
- Rules System: Rules are organized by technology stacks (frontend, backend, database, etc.) and stored in
src/data/rules/ - Rules Builder Service: Core service in
src/services/rules-builder/that generates markdown content using strategy pattern (single-file vs multi-file output) - Collections System: User can save and manage rule collections via
collectionsStore - Feature Flags: Environment-based feature toggling system in
src/features/featureFlags.ts
Standalone Cloudflare Worker implementing Model Context Protocol for programmatic access to AI rules. Provides tools:
listAvailableRules- Get available rule categoriesgetRuleContent- Fetch specific rule content
The application uses Zustand with multiple specialized stores:
techStackStore- Manages selected libraries and tech stackcollectionsStore- Handles saved rule collections with dirty state trackingauthStore- Authentication state managementprojectStore- Project metadata (name, description)
- Uses Astro's environment schema for type-safe environment variables
- Supports three environments:
local,integration,prod - Feature flags control functionality per environment
- Requires
.env.localwith Supabase credentials and Cloudflare Turnstile keys
- Supabase integration with TypeScript types in
src/db/database.types.ts - Collections are stored in Supabase with user association
- Real-time capabilities available but not currently utilized
- Prefer "supabase migration up" over "supabase db reset" when testing migrations
- Unit tests use Vitest with React Testing Library and JSDOM
- E2E tests use Playwright with Page Object Model pattern
- Test files located in
tests/for unit tests ande2e/for E2E tests - All tests run in CI/CD pipeline
Rules are defined as TypeScript objects and exported from category-specific files in src/data/rules/. The system supports:
- Categorization by technology layers (frontend, backend, database, etc.)
- Library-specific rules with placeholder replacement
- Multi-file vs single-file output strategies
- Markdown generation with project context
- Rules contributions go in
src/data/rules/with corresponding translations insrc/i18n/translations.ts - Use feature flags to control new functionality rollout
- Collections allow users to save and share rule combinations
- The MCP server enables programmatic access for AI assistants