@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,224 @@
1
+ ---
2
+ description: "Schema-first workflow for database changes. NEVER use php artisan make:migration - always edit schemas/*.yaml and run npx omnify generate instead. This rule enforces the correct workflow when working with migrations."
3
+ globs: ["{{LARAVEL_ROOT}}database/migrations/*.php"]
4
+ alwaysApply: true
5
+ ---
6
+
7
+ # ⛔ STOP: DO NOT CREATE MIGRATIONS MANUALLY
8
+
9
+ ## You MUST use Omnify Schema to create database changes
10
+
11
+ When you need to modify the database structure, **NEVER** run:
12
+
13
+ ```bash
14
+ # ❌ FORBIDDEN
15
+ php artisan make:migration create_xxx_table
16
+ php artisan make:migration add_xxx_to_xxx_table
17
+ php artisan make:migration modify_xxx_column
18
+ ```
19
+
20
+ ---
21
+
22
+ ## ✅ CORRECT WORKFLOW
23
+
24
+ ### Step 1: Create or Edit Schema YAML
25
+
26
+ ```yaml
27
+ # schemas/your-module/YourModel.yaml
28
+ displayName:
29
+ ja: モデル名
30
+ en: Model Name
31
+
32
+ properties:
33
+ field_name:
34
+ type: String
35
+ length: 255
36
+ displayName:
37
+ ja: フィールド名
38
+ en: Field Name
39
+ ```
40
+
41
+ ### Step 2: Generate Migrations
42
+
43
+ ```bash
44
+ npx omnify generate
45
+ ```
46
+
47
+ ### Step 3: Run Migrations
48
+
49
+ ```bash
50
+ php artisan migrate
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Why This Rule Exists
56
+
57
+ | Manual Migration | Omnify Schema |
58
+ |------------------|---------------|
59
+ | ❌ No TypeScript types | ✅ Auto-generated types |
60
+ | ❌ No i18n labels | ✅ Auto-generated i18n |
61
+ | ❌ No Zod validation | ✅ Auto-generated validation |
62
+ | ❌ No API resources | ✅ Auto-generated API |
63
+ | ❌ Inconsistent naming | ✅ Consistent naming |
64
+ | ❌ Manual model updates | ✅ Auto-updated models |
65
+
66
+ ---
67
+
68
+ ## Schema-First Development Flow
69
+
70
+ ```
71
+ ┌─────────────────────────────────────────────────────────────┐
72
+ │ SCHEMA YAML (Source of Truth) │
73
+ │ schemas/module/ModelName.yaml │
74
+ └─────────────────────┬───────────────────────────────────────┘
75
+
76
+ ▼ npx omnify generate
77
+ ┌────────────┴────────────┬─────────────────┐
78
+ ▼ ▼ ▼
79
+ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
80
+ │ Migrations │ │ Laravel │ │ TypeScript │
81
+ │ (PHP) │ │ Models │ │ Types/Zod │
82
+ └─────────────────┘ └─────────────────┘ └─────────────────┘
83
+ │ │ │
84
+ ▼ ▼ ▼
85
+ php artisan Ready to use Frontend ready
86
+ migrate
87
+ ```
88
+
89
+ ---
90
+
91
+ ## 🚨 BEFORE Creating Any Migration
92
+
93
+ ### Ask yourself:
94
+
95
+ 1. **Can this be done with Omnify Schema?**
96
+ - New table? → Create new YAML schema
97
+ - New column? → Add property to YAML
98
+ - New index? → Add `index: true` to property
99
+ - Foreign key? → Add association to YAML
100
+
101
+ 2. **Is this schema-related?**
102
+ - YES → Edit YAML, run `npx omnify generate`
103
+ - NO → Only then consider manual migration
104
+
105
+ ---
106
+
107
+ ## When Manual Migrations ARE Allowed
108
+
109
+ Only for operations **NOT supported** by Omnify:
110
+
111
+ ```bash
112
+ # ✅ ALLOWED: Data migrations (not schema changes)
113
+ php artisan make:migration migrate_old_data_to_new_format
114
+
115
+ # ✅ ALLOWED: Complex SQL operations
116
+ php artisan make:migration add_full_text_search_index
117
+
118
+ # ✅ ALLOWED: Third-party package migrations
119
+ php artisan vendor:publish --tag=package-migrations
120
+ ```
121
+
122
+ **BUT NEVER for standard CRUD tables/columns!**
123
+
124
+ ---
125
+
126
+ ## Quick Reference: Schema vs Manual
127
+
128
+ | Change Type | Use Omnify Schema | Manual OK |
129
+ |-------------|:-----------------:|:---------:|
130
+ | Create table | ✅ | ❌ |
131
+ | Add column | ✅ | ❌ |
132
+ | Modify column | ✅ | ❌ |
133
+ | Add foreign key | ✅ | ❌ |
134
+ | Add simple index | ✅ | ❌ |
135
+ | Add pivot table | ✅ | ❌ |
136
+ | Add enum column | ✅ | ❌ |
137
+ | Data migration | ❌ | ✅ |
138
+ | Full-text index | ❌ | ✅ |
139
+ | Raw SQL changes | ❌ | ✅ |
140
+
141
+ ---
142
+
143
+ ## How to Add Common Schema Changes
144
+
145
+ ### New Table
146
+
147
+ ```yaml
148
+ # schemas/shop/Product.yaml
149
+ displayName:
150
+ ja: 商品
151
+ en: Product
152
+
153
+ properties:
154
+ name:
155
+ type: String
156
+ length: 255
157
+ price:
158
+ type: Decimal
159
+ precision: 10
160
+ scale: 2
161
+ ```
162
+
163
+ ### New Column to Existing Table
164
+
165
+ ```yaml
166
+ # Edit existing schemas/shop/Product.yaml
167
+ properties:
168
+ # ... existing properties ...
169
+
170
+ # Add new property
171
+ sku:
172
+ type: String
173
+ length: 50
174
+ unique: true
175
+ ```
176
+
177
+ ### Add Relationship
178
+
179
+ ```yaml
180
+ # schemas/shop/Product.yaml
181
+ associations:
182
+ category:
183
+ type: ManyToOne
184
+ target: Category
185
+ foreignKey: category_id
186
+ ```
187
+
188
+ ### Add Index
189
+
190
+ ```yaml
191
+ properties:
192
+ email:
193
+ type: String
194
+ index: true # Simple index
195
+
196
+ # Or composite index
197
+ indexes:
198
+ - columns: [first_name, last_name]
199
+ unique: true
200
+ ```
201
+
202
+ ---
203
+
204
+ ## Remember
205
+
206
+ > **Schema YAML = Single Source of Truth**
207
+ >
208
+ > All database structure changes should originate from YAML schemas.
209
+ > The migration files are just **generated output**, not the source.
210
+
211
+ ---
212
+
213
+ ## If You're Unsure
214
+
215
+ Read the schema guide:
216
+
217
+ ```bash
218
+ cat .cursor/rules/omnify/schema-create.mdc
219
+ # or
220
+ cat schemas/README.md
221
+ ```
222
+
223
+ Or ask:
224
+ > "How do I add [field/table/relationship] using Omnify schema?"
@@ -0,0 +1,120 @@
1
+ ---
2
+ description: "User-editable Eloquent models. MUST read corresponding BaseModel before editing to avoid duplicating auto-generated code."
3
+ globs: ["{{LARAVEL_BASE}}/Models/*.php"]
4
+ alwaysApply: true
5
+ ---
6
+
7
+ # Model Editing Rules
8
+
9
+ These are **user-editable** model files that extend auto-generated BaseModels.
10
+
11
+ ## ⚠️ BEFORE EDITING - MANDATORY STEPS
12
+
13
+ ### 1. Read the BaseModel First
14
+
15
+ Before editing `Post.php`, you **MUST** read `OmnifyBase/PostBaseModel.php` to understand:
16
+ - What relations already exist
17
+ - What `$fillable`, `$hidden`, `$casts` are defined
18
+ - What traits are already used
19
+
20
+ ### 2. Check for Existing Features
21
+
22
+ | Feature | Check in BaseModel | If exists, DO NOT duplicate |
23
+ |---------|-------------------|----------------------------|
24
+ | Relations | `author()`, `category()` | ❌ Already defined |
25
+ | Fillable | `$fillable` array | ❌ Already defined |
26
+ | Casts | `casts()` method | ❌ Already defined |
27
+ | Traits | `use SoftDeletes` | ❌ Already used |
28
+
29
+ ## ❌ NEVER DUPLICATE
30
+
31
+ ```php
32
+ // These are ALREADY in PostBaseModel - NEVER recreate!
33
+ public function author() { ... } // ❌ Duplicate
34
+ public function category() { ... } // ❌ Duplicate
35
+ public function tags() { ... } // ❌ Duplicate
36
+ protected $fillable = [...] // ❌ Duplicate
37
+ protected function casts(): array // ❌ Duplicate
38
+ ```
39
+
40
+ ## ✅ ONLY ADD Custom Logic
41
+
42
+ ```php
43
+ class Post extends PostBaseModel
44
+ {
45
+ // ✅ Custom query scopes
46
+ public function scopePublished($query)
47
+ {
48
+ return $query->where('status', 'published');
49
+ }
50
+
51
+ public function scopeFeatured($query)
52
+ {
53
+ return $query->whereNotNull('featured_image');
54
+ }
55
+
56
+ // ✅ Custom accessors (computed properties)
57
+ public function getReadTimeAttribute(): int
58
+ {
59
+ return (int) ceil(str_word_count($this->content) / 200);
60
+ }
61
+
62
+ public function getIsPublishedAttribute(): bool
63
+ {
64
+ return $this->status === 'published';
65
+ }
66
+
67
+ // ✅ Business logic methods
68
+ public function publish(): void
69
+ {
70
+ $this->update([
71
+ 'status' => 'published',
72
+ 'published_at' => now(),
73
+ ]);
74
+ }
75
+
76
+ // ✅ Custom relations NOT in schema
77
+ public function relatedPosts()
78
+ {
79
+ return $this->hasMany(Post::class, 'category_id', 'category_id')
80
+ ->where('id', '!=', $this->id);
81
+ }
82
+
83
+ // ✅ Event hooks
84
+ protected static function booted(): void
85
+ {
86
+ static::creating(function ($post) {
87
+ $post->slug = Str::slug($post->title);
88
+ });
89
+ }
90
+ }
91
+ ```
92
+
93
+ ## Built-in Features from BaseModel
94
+
95
+ ### Localization (via HasLocalizedDisplayName trait)
96
+
97
+ ```php
98
+ // Available on ALL models - use these instead of creating your own!
99
+ Post::displayName('ja') // "投稿"
100
+ Post::propertyDisplayName('title', 'ja') // "タイトル"
101
+ Post::allPropertyDisplayNamesForLocale('ja')
102
+ ```
103
+
104
+ ## Need to Add New Fields?
105
+
106
+ **DO NOT** add to `$fillable` here. Instead:
107
+
108
+ 1. Edit schema YAML in `schemas/`
109
+ 2. Run `npx omnify generate`
110
+ 3. Run `php artisan migrate`
111
+
112
+ The BaseModel will be updated automatically.
113
+
114
+ ## Quick Checklist Before Saving
115
+
116
+ - [ ] Read `OmnifyBase/{Model}BaseModel.php` first
117
+ - [ ] Not duplicating any relation from BaseModel
118
+ - [ ] Not duplicating `$fillable`, `$hidden`, `$casts`
119
+ - [ ] Only adding custom scopes, accessors, or business logic
120
+ - [ ] Using `parent::booted()` if overriding `booted()`
@@ -0,0 +1,109 @@
1
+ ---
2
+ description: "STOP! These are auto-generated Omnify migrations. DO NOT EDIT these files - edit schemas/*.yaml instead and run npx omnify generate"
3
+ globs: ["{{LARAVEL_ROOT}}database/migrations/omnify/**/*.php"]
4
+ alwaysApply: true
5
+ ---
6
+
7
+ # ⛔ CRITICAL: DO NOT EDIT OMNIFY MIGRATIONS
8
+
9
+ ## These files are AUTO-GENERATED
10
+
11
+ All files in `{{LARAVEL_ROOT}}database/migrations/omnify/` are automatically generated by Omnify.
12
+
13
+ **ANY MANUAL CHANGES WILL BE OVERWRITTEN** when running `npx omnify generate`.
14
+
15
+ ---
16
+
17
+ ## ❌ ABSOLUTELY FORBIDDEN
18
+
19
+ ```php
20
+ // NEVER modify files in {{LARAVEL_ROOT}}database/migrations/omnify/
21
+ // Even "simple fixes" will be lost!
22
+ ```
23
+
24
+ | Action | Result |
25
+ |--------|--------|
26
+ | Add column manually | ❌ Overwritten on next generate |
27
+ | Modify column type | ❌ Overwritten on next generate |
28
+ | Add index manually | ❌ Overwritten on next generate |
29
+ | Fix "typo" | ❌ Overwritten on next generate |
30
+
31
+ ---
32
+
33
+ ## ✅ CORRECT APPROACH
34
+
35
+ ### 1. Edit the YAML Schema
36
+
37
+ ```yaml
38
+ # schemas/auth/User.yaml
39
+ properties:
40
+ # Add or modify properties HERE
41
+ new_field:
42
+ type: String
43
+ length: 100
44
+ ```
45
+
46
+ ### 2. Regenerate Migrations
47
+
48
+ ```bash
49
+ npx omnify generate
50
+ php artisan migrate
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Need Custom Migration?
56
+
57
+ For changes NOT supported by Omnify schemas:
58
+
59
+ 1. Create migration **OUTSIDE** the `omnify/` folder:
60
+
61
+ ```bash
62
+ php artisan make:migration add_custom_field_to_users_table
63
+ # Creates: database/migrations/2026_01_12_000000_add_custom_field_to_users_table.php
64
+ # This is SAFE - Omnify won't touch it
65
+ ```
66
+
67
+ 2. Keep the omnify/ folder untouched
68
+
69
+ ---
70
+
71
+ ## Folder Structure
72
+
73
+ ```
74
+ database/migrations/
75
+ ├── omnify/ ← ⛔ AUTO-GENERATED - DO NOT EDIT
76
+ │ ├── 2026_01_01_000000_create_users_table.php
77
+ │ ├── 2026_01_01_000001_create_posts_table.php
78
+ │ └── ...
79
+ ├── 2026_01_12_120000_add_custom_field.php ← ✅ Safe to edit
80
+ └── 2026_01_12_130000_custom_migration.php ← ✅ Safe to edit
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Quick Reference
86
+
87
+ | Want to... | Do this |
88
+ |------------|---------|
89
+ | Add column | Edit schema YAML → `npx omnify generate` |
90
+ | Modify column | Edit schema YAML → `npx omnify generate` |
91
+ | Add index | Edit schema YAML → `npx omnify generate` |
92
+ | Custom migration | `php artisan make:migration` (outside omnify/) |
93
+ | Fix generation bug | Report issue or edit Omnify plugin |
94
+
95
+ ---
96
+
97
+ ## If You See This Warning
98
+
99
+ If a file has this header:
100
+
101
+ ```php
102
+ /**
103
+ * DO NOT EDIT - This file is auto-generated by Omnify.
104
+ * Any changes will be overwritten on next generation.
105
+ * ...
106
+ */
107
+ ```
108
+
109
+ **STOP!** Do not edit this file. Edit the schema YAML instead.