.cursorrules 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. # NEO Project Cursor Rules
  2. Concise rules for AI assistants working on the NEO monorepo. The canonical, detailed guide is [AGENTS.md](AGENTS.md) — read it for project structure, framework versions, styling, customization workflow, skills, and checklists.
  3. ## Project Overview
  4. NEO is a cross-platform UNA CMS frontend:
  5. - **Native app**: React Native with Expo (`apps/expo`), styled with Uniwind (Tailwind CSS v4 syntax)
  6. - **Web app**: Next.js App Router (`apps/next`), styled with Tailwind CSS 4
  7. - **Shared code**: `packages/app` (components, lib, design system, settings)
  8. - Yarn workspaces + Turborepo; lockfile: `yarn.lock`
  9. ## Critical Rules
  10. ### 1. Platform Consistency
  11. - Web and Native implementations should follow the same patterns
  12. - When fixing issues on one platform, check if the same issue exists on the other
  13. - Icon handling, theming, and component behavior should be consistent across platforms
  14. - On native, text styles do NOT cascade from View/Pressable to Text — apply text classes directly to `Text` (see AGENTS.md)
  15. ### 2. Routing
  16. - **Native**: Expo Router with file-based routing (`apps/expo/app/`)
  17. - **Web**: Next.js App Router (`apps/next/app/`)
  18. ### 3. UNA CMS API Integration
  19. - Use the `fetcher` function from `app/lib/fetcher` for all UNA API calls
  20. - Follow UNA's endpoint structure: `/api.php?r=module/action/Template&params[]=JSON`
  21. - Handle proxy routing automatically (web vs native configurations)
  22. - Use Bearer token authentication for server-side calls
  23. - Real-time updates via Pusher WebSocket subscriptions
  24. ```javascript
  25. import { fetcher } from 'app/lib/fetcher';
  26. const data = await fetcher('/api.php?r=module/action/Template&params[]=JSON');
  27. ```
  28. See the `una-api` skill (`.agents/skills/una-api/SKILL.md`) for backend contracts (guest-safe blocks, JSON responses).
  29. ### 4. Authentication
  30. - Use existing `currentUser` patterns for authentication checks
  31. - Menu filtering follows established patterns in `packages/app/lib/util.js`
  32. - Check both logged/non-logged state handling for consistency
  33. ### 5. Customization Layer
  34. - Defaults live in `packages/app/default/` and default `_map.js` files — do not modify them in branch/fork projects
  35. - Overrides belong under `packages/app/customization/` (settings, translations, icons, component maps, config)
  36. ## Red Flags - Always Investigate
  37. - Different implementations between web and native for the same feature
  38. - Missing icons on one platform but working on another
  39. - Hardcoded colors instead of semantic design tokens
  40. - Direct fetch() calls bypassing the `fetcher` function
  41. - Incorrect UNA endpoint patterns (not following `/api.php?r=module/action/Template`)
  42. - Hardcoded UNA_URL instead of using proxy/env configuration
  43. - Direct Tailwind usage where design system components exist
  44. - Missing responsive breakpoints for mobile/desktop differences
  45. ## Before Making Changes
  46. 1. **Search existing code** for similar patterns and components
  47. 2. **Test on both platforms** if making shared changes
  48. 3. **Follow existing conventions** in the same directory/module
  49. 4. **Use semantic design tokens**, not hardcoded values
  50. 5. **Run `npx tsc --noEmit`** in the affected app before finishing
  51. For everything else (component hierarchy, Server vs Client Components, React Compiler notes, animated icons, NeoButton, skill precedence), defer to [AGENTS.md](AGENTS.md).