@famgia/omnify-ai-guides 2.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +105 -0
  2. package/dist/chunk-RCTEXK7C.js +549 -0
  3. package/dist/chunk-RCTEXK7C.js.map +1 -0
  4. package/dist/config/rules.yaml +524 -0
  5. package/dist/index.cjs +587 -0
  6. package/dist/index.cjs.map +1 -0
  7. package/dist/index.d.cts +55 -0
  8. package/dist/index.d.ts +55 -0
  9. package/dist/index.js +26 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/knowledge/agents/architect.md.stub +150 -0
  12. package/dist/knowledge/agents/developer.md.stub +190 -0
  13. package/dist/knowledge/agents/reviewer.md.stub +134 -0
  14. package/dist/knowledge/agents/tester.md.stub +196 -0
  15. package/dist/knowledge/checklists/backend.md.stub +112 -0
  16. package/dist/knowledge/checklists/react.md.stub +108 -0
  17. package/dist/knowledge/claude-rules/laravel-controllers.md.stub +57 -0
  18. package/dist/knowledge/claude-rules/laravel-migrations.md.stub +47 -0
  19. package/dist/knowledge/claude-rules/laravel-tests.md.stub +52 -0
  20. package/dist/knowledge/claude-rules/naming.md.stub +369 -0
  21. package/dist/knowledge/claude-rules/performance.md.stub +256 -0
  22. package/dist/knowledge/claude-rules/php-standards.md.stub +305 -0
  23. package/dist/knowledge/claude-rules/react-components.md.stub +67 -0
  24. package/dist/knowledge/claude-rules/schema-yaml.md.stub +83 -0
  25. package/dist/knowledge/claude-rules/security.md.stub +164 -0
  26. package/dist/knowledge/cursor-rules/antd-deprecations.mdc.stub +62 -0
  27. package/dist/knowledge/cursor-rules/basemodel-readonly.mdc.stub +66 -0
  28. package/dist/knowledge/cursor-rules/baserequest-readonly.mdc.stub +74 -0
  29. package/dist/knowledge/cursor-rules/baseresource-readonly.mdc.stub +78 -0
  30. package/dist/knowledge/cursor-rules/laravel-controller.mdc.stub +421 -0
  31. package/dist/knowledge/cursor-rules/laravel-request.mdc.stub +112 -0
  32. package/dist/knowledge/cursor-rules/laravel-resource.mdc.stub +73 -0
  33. package/dist/knowledge/cursor-rules/laravel-review.mdc.stub +69 -0
  34. package/dist/knowledge/cursor-rules/laravel-testing.mdc.stub +138 -0
  35. package/dist/knowledge/cursor-rules/laravel.mdc.stub +138 -0
  36. package/dist/knowledge/cursor-rules/migrations-workflow.mdc.stub +224 -0
  37. package/dist/knowledge/cursor-rules/model-editable.mdc.stub +120 -0
  38. package/dist/knowledge/cursor-rules/omnify-migrations.mdc.stub +109 -0
  39. package/dist/knowledge/cursor-rules/omnify-schema.mdc.stub +358 -0
  40. package/dist/knowledge/cursor-rules/omnify.mdc.stub +58 -0
  41. package/dist/knowledge/cursor-rules/react-design.mdc.stub +693 -0
  42. package/dist/knowledge/cursor-rules/react-form.mdc.stub +292 -0
  43. package/dist/knowledge/cursor-rules/react-services.mdc.stub +304 -0
  44. package/dist/knowledge/cursor-rules/react.mdc.stub +336 -0
  45. package/dist/knowledge/cursor-rules/request-editable.mdc.stub +111 -0
  46. package/dist/knowledge/cursor-rules/resource-editable.mdc.stub +125 -0
  47. package/dist/knowledge/cursor-rules/schema-create.mdc.stub +440 -0
  48. package/dist/knowledge/cursor-rules/validation-rules.mdc.stub +181 -0
  49. package/dist/knowledge/laravel/README.md.stub +59 -0
  50. package/dist/knowledge/laravel/architecture.md.stub +424 -0
  51. package/dist/knowledge/laravel/authentication.md.stub +588 -0
  52. package/dist/knowledge/laravel/controller.md.stub +484 -0
  53. package/dist/knowledge/laravel/datetime.md.stub +334 -0
  54. package/dist/knowledge/laravel/migrations-team.md.stub +376 -0
  55. package/dist/knowledge/laravel/openapi.md.stub +449 -0
  56. package/dist/knowledge/laravel/request.md.stub +450 -0
  57. package/dist/knowledge/laravel/resource.md.stub +516 -0
  58. package/dist/knowledge/laravel/service.md.stub +503 -0
  59. package/dist/knowledge/laravel/testing.md.stub +1504 -0
  60. package/dist/knowledge/omnify/antdesign-guide.md.stub +401 -0
  61. package/dist/knowledge/omnify/config-guide.md.stub +405 -0
  62. package/dist/knowledge/omnify/japan-guide.md.stub +186 -0
  63. package/dist/knowledge/omnify/laravel-guide.md.stub +61 -0
  64. package/dist/knowledge/omnify/partial-schema-guide.md.stub +353 -0
  65. package/dist/knowledge/omnify/react-form-guide.md.stub +225 -0
  66. package/dist/knowledge/omnify/schema-guide.md.stub +144 -0
  67. package/dist/knowledge/omnify/typescript-guide.md.stub +337 -0
  68. package/dist/knowledge/react/README.md.stub +221 -0
  69. package/dist/knowledge/react/antd-guide.md +528 -0
  70. package/dist/knowledge/react/antd-guide.md.stub +528 -0
  71. package/dist/knowledge/react/checklist.md.stub +108 -0
  72. package/dist/knowledge/react/datetime-guide.md.stub +137 -0
  73. package/dist/knowledge/react/design-philosophy.md.stub +363 -0
  74. package/dist/knowledge/react/i18n-guide.md.stub +211 -0
  75. package/dist/knowledge/react/laravel-integration.md.stub +181 -0
  76. package/dist/knowledge/react/service-pattern.md.stub +180 -0
  77. package/dist/knowledge/react/tanstack-query.md.stub +339 -0
  78. package/dist/knowledge/react/types-guide.md +669 -0
  79. package/dist/knowledge/react/types-guide.md.stub +669 -0
  80. package/dist/knowledge/workflows/bug-fix.md.stub +201 -0
  81. package/dist/knowledge/workflows/code-review.md.stub +164 -0
  82. package/dist/knowledge/workflows/new-feature.md.stub +327 -0
  83. package/dist/plugin-M95GyBll.d.cts +191 -0
  84. package/dist/plugin-M95GyBll.d.ts +191 -0
  85. package/dist/plugin.cjs +573 -0
  86. package/dist/plugin.cjs.map +1 -0
  87. package/dist/plugin.d.cts +2 -0
  88. package/dist/plugin.d.ts +2 -0
  89. package/dist/plugin.js +15 -0
  90. package/dist/plugin.js.map +1 -0
  91. package/package.json +53 -0
@@ -0,0 +1,358 @@
1
+ ---
2
+ description: "Omnify schema YAML syntax and examples. Apply when creating or editing schema files in schemas/ folder. Covers property types, relationships, validations, and Japanese compound types."
3
+ globs: ["schemas/**/*.yaml", "schemas/**/*.yml", "{{LARAVEL_ROOT}}database/migrations/**"]
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Omnify Schema Creation Workflow
8
+
9
+ > **Usage:** This rule auto-applies when editing schema files, or mention `@omnify-schema` in chat
10
+
11
+ ## πŸ“‹ Workflow Steps
12
+
13
+ ```
14
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
15
+ β”‚ 1. READ GUIDE β†’ Read schema guide documentation β”‚
16
+ β”‚ 2. CREATE SCHEMA β†’ Create/modify YAML schema file β”‚
17
+ β”‚ 3. GENERATE β†’ Run `npx omnify generate` β”‚
18
+ β”‚ 4. VALIDATE β†’ Check generated code matches requirements β”‚
19
+ β”‚ 5. MIGRATE β†’ Run database migration β”‚
20
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Step 1: Read Schema Guide πŸ“–
26
+
27
+ **MUST READ before creating schema:**
28
+
29
+ ```bash
30
+ # Read the schema guide
31
+ cat .claude/omnify/guides/omnify/schema-guide.md
32
+ # OR
33
+ cat packages/omnify/ai-guides/schema-guide.md
34
+ ```
35
+
36
+ **Key Documentation:**
37
+ - Schema syntax and property types
38
+ - Relationships (belongsTo, hasMany, etc.)
39
+ - Validation rules (nullable, minLength, maxLength)
40
+ - Display names (ja, en, vi)
41
+ - Special types (JapaneseName, JapaneseAddress, etc.)
42
+
43
+ ---
44
+
45
+ ## Step 2: Create Schema πŸ“
46
+
47
+ ### Schema File Location
48
+
49
+ ```
50
+ schemas/
51
+ β”œβ”€β”€ {domain}/ # Group by domain
52
+ β”‚ β”œβ”€β”€ {Model}.yaml # PascalCase filename
53
+ β”‚ └── {Enum}.yaml # Enum schemas
54
+ └── shared/ # Shared enums/types
55
+ ```
56
+
57
+ ### Basic Schema Template
58
+
59
+ ```yaml
60
+ # schemas/{domain}/{ModelName}.yaml
61
+ name: ModelName
62
+ kind: object
63
+
64
+ displayName:
65
+ ja: ヒデル名
66
+ en: Model Name
67
+
68
+ options:
69
+ timestamps: true # created_at, updated_at
70
+ softDelete: false # deleted_at
71
+
72
+ properties:
73
+ # Required field
74
+ name:
75
+ type: String
76
+ length: 100
77
+ displayName:
78
+ ja: 名前
79
+ en: Name
80
+ placeholder:
81
+ ja: δΎ‹οΌšη”°δΈ­ε€ͺιƒŽ
82
+ en: e.g. John Doe
83
+
84
+ # Optional field
85
+ description:
86
+ type: Text
87
+ nullable: true
88
+ displayName:
89
+ ja: θͺ¬ζ˜Ž
90
+ en: Description
91
+
92
+ # Enum field
93
+ status:
94
+ type: OrderStatus
95
+ default: pending
96
+ displayName:
97
+ ja: ステータス
98
+ en: Status
99
+
100
+ # Relationship
101
+ category:
102
+ type: Category
103
+ relation: belongsTo
104
+ nullable: true
105
+ ```
106
+
107
+ ### From SQL/Database Requirements
108
+
109
+ When creating schema from SQL or database design:
110
+
111
+ ```yaml
112
+ # SQL: VARCHAR(255) NOT NULL
113
+ property_name:
114
+ type: String
115
+ length: 255
116
+
117
+ # SQL: VARCHAR(100) NULL
118
+ property_name:
119
+ type: String
120
+ length: 100
121
+ nullable: true
122
+
123
+ # SQL: TEXT
124
+ property_name:
125
+ type: Text
126
+
127
+ # SQL: INT / BIGINT
128
+ property_name:
129
+ type: Int # or BigInt
130
+
131
+ # SQL: DECIMAL(10,2)
132
+ property_name:
133
+ type: Float
134
+
135
+ # SQL: BOOLEAN DEFAULT false
136
+ property_name:
137
+ type: Boolean
138
+ default: false
139
+
140
+ # SQL: DATE
141
+ property_name:
142
+ type: Date
143
+
144
+ # SQL: DATETIME / TIMESTAMP
145
+ property_name:
146
+ type: DateTime
147
+
148
+ # SQL: ENUM('draft', 'published', 'archived')
149
+ # β†’ Create separate enum schema
150
+ ```
151
+
152
+ ---
153
+
154
+ ## Step 3: Generate Code πŸ”§
155
+
156
+ ```bash
157
+ # Generate all code from schemas
158
+ npx omnify generate
159
+ ```
160
+
161
+ **What gets generated:**
162
+ - TypeScript types & Zod schemas
163
+ - Laravel migrations & models
164
+ - API resources & controllers
165
+ - Form requests & validation
166
+
167
+ ---
168
+
169
+ ## Step 4: Validate Generated Code βœ…
170
+
171
+ ### ⚠️ CRITICAL for SQL-based schemas
172
+
173
+ **If creating schema from SQL requirements, MUST verify:**
174
+
175
+ ```bash
176
+ # 1. Check generated migration matches SQL design
177
+ cat {{LARAVEL_ROOT}}database/migrations/*_create_{table_name}_table.php
178
+
179
+ # 2. Check TypeScript types match requirements
180
+ cat {{TYPESCRIPT_BASE}}/omnify/schemas/{ModelName}.ts
181
+
182
+ # 3. Check Laravel model relationships
183
+ cat {{LARAVEL_BASE}}/Models/{ModelName}.php
184
+ ```
185
+
186
+ ### Validation Checklist
187
+
188
+ | Check | What to Verify |
189
+ |-------|----------------|
190
+ | βœ… Column names | snake_case in migration matches schema |
191
+ | βœ… Column types | VARCHAR, TEXT, INT match schema types |
192
+ | βœ… Nullable | NULL/NOT NULL matches `nullable: true/false` |
193
+ | βœ… Defaults | DEFAULT values match `default:` in schema |
194
+ | βœ… Foreign keys | Relationships generate correct FK |
195
+ | βœ… Indexes | Required indexes are present |
196
+
197
+ ### If Generated Code is Wrong
198
+
199
+ ```
200
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
201
+ β”‚ Generated code doesn't match SQL? β”‚
202
+ β”‚ β”‚
203
+ β”‚ 1. Fix the YAML schema β”‚
204
+ β”‚ 2. Run `npx omnify generate` again β”‚
205
+ β”‚ 3. Verify generated code β”‚
206
+ β”‚ 4. Repeat until correct β”‚
207
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
208
+ ```
209
+
210
+ **Common fixes:**
211
+
212
+ ```yaml
213
+ # Problem: Column should be nullable
214
+ # Fix: Add nullable: true
215
+ property_name:
216
+ type: String
217
+ nullable: true # ← Add this
218
+
219
+ # Problem: Wrong column length
220
+ # Fix: Adjust length
221
+ property_name:
222
+ type: String
223
+ length: 255 # ← Change this
224
+
225
+ # Problem: Missing default value
226
+ # Fix: Add default
227
+ status:
228
+ type: OrderStatus
229
+ default: pending # ← Add this
230
+
231
+ # Problem: Wrong relationship type
232
+ # Fix: Change relation
233
+ category:
234
+ type: Category
235
+ relation: belongsTo # belongsTo, hasMany, hasOne, belongsToMany
236
+ ```
237
+
238
+ ### ⚠️ CRITICAL: DB Functions NOT Allowed in Default
239
+
240
+ ```yaml
241
+ # ❌ WRONG - DB functions are NOT allowed
242
+ failed_at:
243
+ type: Timestamp
244
+ default: CURRENT_TIMESTAMP # ERROR!
245
+
246
+ # βœ… CORRECT - Use useCurrent option
247
+ failed_at:
248
+ type: Timestamp
249
+ useCurrent: true # Equivalent to CURRENT_TIMESTAMP
250
+
251
+ updated_at:
252
+ type: Timestamp
253
+ useCurrent: true
254
+ useCurrentOnUpdate: true # ON UPDATE CURRENT_TIMESTAMP
255
+ ```
256
+
257
+ ---
258
+
259
+ ## Step 5: Run Migration πŸ—„οΈ
260
+
261
+ ```bash
262
+ # Run migration
263
+ php artisan migrate
264
+
265
+ # If migration fails, rollback and fix
266
+ php artisan migrate:rollback
267
+ # Fix schema, regenerate, try again
268
+ ```
269
+
270
+ ---
271
+
272
+ ## πŸ”„ Complete Workflow Example
273
+
274
+ ```bash
275
+ # 1. Read guide
276
+ cat .claude/omnify/guides/omnify/schema-guide.md
277
+
278
+ # 2. Create schema file
279
+ # schemas/shop/Product.yaml
280
+
281
+ # 3. Generate code
282
+ npx omnify generate
283
+
284
+ # 4. Validate (especially for SQL-based requirements)
285
+ cat {{LARAVEL_ROOT}}database/migrations/*_create_products_table.php
286
+ # If wrong: fix schema β†’ regenerate β†’ validate again
287
+
288
+ # 5. Run migration
289
+ php artisan migrate
290
+ ```
291
+
292
+ ---
293
+
294
+ ## πŸ“Œ Quick Reference
295
+
296
+ ### Property Types
297
+
298
+ | Type | SQL | TypeScript |
299
+ |------|-----|------------|
300
+ | `String` | VARCHAR | `string` |
301
+ | `Text` | TEXT | `string` |
302
+ | `LongText` | LONGTEXT | `string` |
303
+ | `Int` | INT | `number` |
304
+ | `BigInt` | BIGINT | `number` |
305
+ | `Float` | DECIMAL | `number` |
306
+ | `Boolean` | BOOLEAN | `boolean` |
307
+ | `Date` | DATE | `string` |
308
+ | `DateTime` | DATETIME | `string` |
309
+ | `Email` | VARCHAR | `string` |
310
+ | `Url` | VARCHAR | `string` |
311
+ | `Json` | JSON | `Record<string, unknown>` |
312
+
313
+ ### Japanese Compound Types
314
+
315
+ | Type | Fields Generated |
316
+ |------|------------------|
317
+ | `JapaneseName` | `{prefix}_lastname`, `{prefix}_firstname`, `{prefix}_kana_lastname`, `{prefix}_kana_firstname` |
318
+ | `JapaneseAddress` | `{prefix}_postal_code`, `{prefix}_prefecture`, `{prefix}_address1`, `{prefix}_address2`, `{prefix}_address3` |
319
+ | `JapaneseBankAccount` | `{prefix}_bank_code`, `{prefix}_bank_name`, `{prefix}_branch_code`, etc. |
320
+
321
+ ### Relationship Types
322
+
323
+ | Relation | Description | Foreign Key |
324
+ |----------|-------------|-------------|
325
+ | `belongsTo` | N:1 | `{property}_id` on this table |
326
+ | `hasMany` | 1:N | `{this_model}_id` on related table |
327
+ | `hasOne` | 1:1 | `{this_model}_id` on related table |
328
+ | `belongsToMany` | N:N | Pivot table |
329
+
330
+ ---
331
+
332
+ ## ⚠️ Common Mistakes
333
+
334
+ ```yaml
335
+ # ❌ Wrong: camelCase property name (use camelCase, converts to snake_case)
336
+ firstName: # βœ… Correct - will become first_name in DB
337
+
338
+ # ❌ Wrong: Missing displayName for non-English projects
339
+ name:
340
+ type: String
341
+ # Missing displayName!
342
+
343
+ # βœ… Correct: Always add displayName
344
+ name:
345
+ type: String
346
+ displayName:
347
+ ja: 名前
348
+ en: Name
349
+
350
+ # ❌ Wrong: Hardcoded enum values in property
351
+ status:
352
+ type: String
353
+ enum: [draft, published] # Don't do this
354
+
355
+ # βœ… Correct: Create separate enum schema
356
+ status:
357
+ type: PostStatus # Reference enum schema
358
+ ```
@@ -0,0 +1,58 @@
1
+ ---
2
+ description: "Omnify schema-driven code generation: YAML schema syntax, configuration (omnify.config.ts), and generation workflow. Apply when editing schema files or config."
3
+ globs: ["schemas/**/*.yaml", "schemas/**/*.yml", "omnify.config.ts"]
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Omnify Schema Rules
8
+
9
+ This project uses Omnify for schema-driven code generation.
10
+
11
+ ## Documentation
12
+
13
+ Read these files in `.claude/omnify/guides/omnify/`:
14
+
15
+ | File | Content |
16
+ | --------------------- | -------------------------------- |
17
+ | `schema-guide.md` | Base schema format |
18
+ | `config-guide.md` | Configuration (omnify.config.ts) |
19
+ | `laravel-guide.md` | Laravel generator |
20
+ | `typescript-guide.md` | TypeScript generator |
21
+ | `japan-guide.md` | Japanese field types |
22
+
23
+ ## Commands
24
+
25
+ ```bash
26
+ npx omnify generate # Generate code from schemas
27
+ npx omnify validate # Validate all schemas
28
+ ```
29
+
30
+ ## Important
31
+
32
+ - **DO NOT** manually edit files in `{{LARAVEL_ROOT}}database/migrations/omnify/`
33
+ - **DO NOT** manually edit files in `{{TYPESCRIPT_BASE}}/omnify/schemas/base/`
34
+ - **DO NOT** manually edit files in `{{LARAVEL_BASE}}/Models/OmnifyBase/`
35
+ - Schema changes β†’ Run `npx omnify generate`
36
+
37
+ ## Schema Quick Reference
38
+
39
+ ```yaml
40
+ name: User
41
+ displayName:
42
+ ja: ユーアー
43
+ en: User
44
+
45
+ properties:
46
+ email:
47
+ type: Email
48
+ unique: true
49
+ name:
50
+ type: String
51
+ role:
52
+ type: EnumRef
53
+ target: UserRole
54
+
55
+ options:
56
+ timestamps: true
57
+ softDelete: true
58
+ ```