Skip to content

Commit 8fa205b

Browse files
Update existing cursor rules for Medusa Forms compatibility
- Update monorepo-organization.mdc with proper globs and new package structure - Add medusa-forms package and directory structure documentation - Update storybook-testing.mdc to include react-hook-form and @medusajs/ui - Add medusa-forms story directory to project structure - Update form-component-patterns.mdc to clarify scope (Remix Hook Form only) - Add note directing to medusa-forms-patterns.mdc for Medusa components
1 parent cb26e17 commit 8fa205b

3 files changed

Lines changed: 31 additions & 14 deletions

File tree

.cursor/rules/form-component-patterns.mdc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
22
type: Always
3-
description: Rules for form component integration patterns in the lambda-curry/forms repository
3+
description: Rules for form component integration patterns in the lambda-curry/forms repository (applies to Remix Hook Form components)
44
---
55

66
You are an expert in React Hook Form, Remix Hook Form, Zod validation, and form component architecture for the lambda-curry/forms monorepo.
77

8-
# Form Component Integration Patterns
8+
# Form Component Integration Patterns (Remix Hook Form)
9+
10+
**Note: These patterns apply to Remix Hook Form components in `packages/components/`. For Medusa Forms components using react-hook-form + @medusajs/ui, see the medusa-forms-patterns.mdc rules.**
911

1012
## Core Principles
1113
- All form components must integrate seamlessly with Remix Hook Form
@@ -215,4 +217,3 @@ export type { ComponentNameProps };
215217
- Test component composition and customization
216218

217219
Remember: Form components are the core of this library. Every form component should be intuitive, accessible, and integrate seamlessly with the Remix Hook Form + Zod validation pattern.
218-

.cursor/rules/monorepo-organization.mdc

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
description: Monorepo structure and import conventions for the lambda-curry/forms repository
3-
globs:
3+
globs: ["packages/**/*.{ts,tsx}", "apps/**/*.{ts,tsx}", "*.{ts,tsx,json}", "turbo.json", "package.json"]
44
alwaysApply: false
55
---
66

@@ -21,14 +21,21 @@ lambda-curry/forms/
2121
├── apps/
2222
│ └── docs/ # Storybook documentation app
2323
│ ├── src/
24-
│ │ ├── remix-hook-form/ # Story files
24+
│ │ ├── remix-hook-form/ # Remix Hook Form story files
25+
│ │ ├── medusa-forms/ # Medusa Forms story files
2526
│ │ └── lib/ # Storybook utilities
2627
│ └── package.json
2728
├── packages/
28-
│ └── components/ # Main component library
29+
│ ├── components/ # Main component library (Remix Hook Form)
30+
│ │ ├── src/
31+
│ │ │ ├── remix-hook-form/ # Form-aware components
32+
│ │ │ ├── ui/ # Base UI components
33+
│ │ │ └── index.ts # Main export file
34+
│ │ └── package.json
35+
│ └── medusa-forms/ # Medusa Forms component library
2936
│ ├── src/
30-
│ │ ├── remix-hook-form/ # Form-aware components
31-
│ │ ├── ui/ # Base UI components
37+
│ │ ├── controlled/ # Controlled components using react-hook-form
38+
│ │ ├── ui/ # Base UI components using @medusajs/ui
3239
│ │ └── index.ts # Main export file
3340
│ └── package.json
3441
├── package.json # Root package.json
@@ -43,9 +50,13 @@ lambda-curry/forms/
4350
import { TextField } from '@lambdacurry/forms/remix-hook-form';
4451
import { Button } from '@lambdacurry/forms/ui';
4552

53+
// ✅ Import from Medusa Forms package
54+
import { ControlledInput } from '@lambdacurry/medusa-forms/controlled';
55+
import { Input } from '@lambdacurry/medusa-forms/ui';
56+
4657
// ✅ Import from specific entry points
4758
import { TextField } from '@lambdacurry/forms/remix-hook-form/text-field';
48-
import { Button } from '@lambdacurry/forms/ui/button';
59+
import { ControlledInput } from '@lambdacurry/medusa-forms/controlled/ControlledInput';
4960
```
5061

5162
### Internal Package Imports
@@ -361,4 +372,3 @@ docs/
361372
- Maintain backward compatibility when possible
362373

363374
Remember: A well-organized monorepo makes development faster and more predictable. Every import should be intentional and follow the established patterns to maintain consistency across the codebase.
364-

.cursor/rules/storybook-testing.mdc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ type: Always
33
description: Rules for writing Storybook Playwright tests in the lambda-curry/forms repository
44
---
55

6-
You are an expert in Storybook, Playwright testing, React, TypeScript, Remix Hook Form, Zod validation, and the lambda-curry/forms monorepo architecture.
6+
You are an expert in Storybook, Playwright testing, React, TypeScript, Remix Hook Form, react-hook-form, @medusajs/ui, Zod validation, and the lambda-curry/forms monorepo architecture.
77

88
# Project Context
99
This is a monorepo containing form components with comprehensive Storybook Playwright testing. The testing setup combines Storybook's component isolation with Playwright's browser automation to create real-world testing scenarios.
@@ -13,7 +13,8 @@ This is a monorepo containing form components with comprehensive Storybook Playw
1313
- @storybook/test-runner for Playwright automation
1414
- @storybook/test for testing utilities (userEvent, expect, canvas)
1515
- React Router stub decorator for form handling
16-
- Remix Hook Form + Zod for validation testing
16+
- Remix Hook Form + Zod for validation testing (main components)
17+
- react-hook-form + @medusajs/ui for Medusa Forms components
1718
- Yarn 4.7.0 with corepack
1819
- TypeScript throughout
1920

@@ -22,13 +23,18 @@ This is a monorepo containing form components with comprehensive Storybook Playw
2223
lambda-curry/forms/
2324
├── apps/docs/ # Storybook app
2425
│ ├── .storybook/ # Storybook configuration
25-
│ ├── src/remix-hook-form/ # Story files with tests
26+
│ ├── src/remix-hook-form/ # Remix Hook Form story files with tests
27+
│ ├── src/medusa-forms/ # Medusa Forms story files with tests
2628
│ ├── simple-server.js # Custom static server for testing
2729
│ └── package.json # Test scripts
28-
├── packages/components/ # Component library
30+
├── packages/components/ # Main component library (Remix Hook Form)
2931
│ └── src/
3032
│ ├── remix-hook-form/ # Form components
3133
│ └── ui/ # UI components
34+
├── packages/medusa-forms/ # Medusa Forms component library
35+
│ └── src/
36+
│ ├── controlled/ # Controlled components using react-hook-form
37+
│ └── ui/ # UI components using @medusajs/ui
3238
└── .cursor/rules/ # Cursor rules directory
3339
```
3440

0 commit comments

Comments
 (0)