@famgia/omnify 1.0.17 → 1.0.21
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.
- package/package.json +8 -8
- package/scripts/postinstall.js +100 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@famgia/omnify",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
4
4
|
"description": "Schema-driven database migration system with TypeScript types and Laravel migrations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@famgia/omnify-cli": "0.0.
|
|
28
|
-
"@famgia/omnify-core": "0.0.
|
|
29
|
-
"@famgia/omnify-types": "0.0.
|
|
30
|
-
"@famgia/omnify-
|
|
31
|
-
"@famgia/omnify-
|
|
32
|
-
"@famgia/omnify-
|
|
33
|
-
"@famgia/omnify-
|
|
27
|
+
"@famgia/omnify-cli": "0.0.20",
|
|
28
|
+
"@famgia/omnify-core": "0.0.20",
|
|
29
|
+
"@famgia/omnify-types": "0.0.16",
|
|
30
|
+
"@famgia/omnify-laravel": "0.0.26",
|
|
31
|
+
"@famgia/omnify-atlas": "0.0.16",
|
|
32
|
+
"@famgia/omnify-typescript": "0.0.8",
|
|
33
|
+
"@famgia/omnify-mcp": "0.0.8"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
36
36
|
"omnify",
|
package/scripts/postinstall.js
CHANGED
|
@@ -11,6 +11,7 @@ This project uses Omnify for schema-driven code generation.
|
|
|
11
11
|
|
|
12
12
|
**Documentation**: \`.claude/omnify/\`
|
|
13
13
|
- \`schema-guide.md\` - Schema format and property types
|
|
14
|
+
- \`config-guide.md\` - Configuration (omnify.config.ts)
|
|
14
15
|
- \`laravel-guide.md\` - Laravel generator (if installed)
|
|
15
16
|
- \`typescript-guide.md\` - TypeScript generator (if installed)
|
|
16
17
|
|
|
@@ -27,6 +28,7 @@ Schemas are in \`schemas/\` directory with \`.yaml\` extension.
|
|
|
27
28
|
|
|
28
29
|
For detailed documentation, read these files:
|
|
29
30
|
- .claude/omnify/schema-guide.md - Base schema format
|
|
31
|
+
- .claude/omnify/config-guide.md - Configuration (omnify.config.ts)
|
|
30
32
|
- .claude/omnify/laravel-guide.md - Laravel generator (if exists)
|
|
31
33
|
- .claude/omnify/typescript-guide.md - TypeScript generator (if exists)
|
|
32
34
|
|
|
@@ -48,7 +50,7 @@ All schemas are stored in \`schemas/\` directory with \`.yaml\` extension.
|
|
|
48
50
|
## Object Schema Structure
|
|
49
51
|
|
|
50
52
|
\`\`\`yaml
|
|
51
|
-
# yaml-language-server: $schema
|
|
53
|
+
# yaml-language-server: $schema=./node_modules/@famgia/omnify-types/schemas/omnify-schema.json
|
|
52
54
|
name: ModelName # Required: PascalCase
|
|
53
55
|
kind: object # Optional: 'object' (default) or 'enum'
|
|
54
56
|
displayName: # Optional: i18n display name
|
|
@@ -185,6 +187,98 @@ If Omnify MCP is configured, these tools are available:
|
|
|
185
187
|
- \`omnify_get_examples\` - Example schemas
|
|
186
188
|
`;
|
|
187
189
|
|
|
190
|
+
// Config guide skill file
|
|
191
|
+
const CONFIG_GUIDE_CONTENT = `# Omnify Configuration Guide
|
|
192
|
+
|
|
193
|
+
## Configuration File
|
|
194
|
+
|
|
195
|
+
Create \`omnify.config.ts\` in project root:
|
|
196
|
+
|
|
197
|
+
\`\`\`typescript
|
|
198
|
+
import { defineConfig } from '@famgia/omnify';
|
|
199
|
+
|
|
200
|
+
export default defineConfig({
|
|
201
|
+
schemasDir: './schemas',
|
|
202
|
+
|
|
203
|
+
database: {
|
|
204
|
+
driver: 'mysql', // 'mysql' | 'pgsql' | 'sqlite' | 'sqlsrv' | 'mariadb'
|
|
205
|
+
},
|
|
206
|
+
|
|
207
|
+
output: {
|
|
208
|
+
laravel: {
|
|
209
|
+
migrationsPath: './database/migrations/omnify',
|
|
210
|
+
modelsPath: './app/Models',
|
|
211
|
+
enumsPath: './app/Enums',
|
|
212
|
+
},
|
|
213
|
+
typescript: {
|
|
214
|
+
path: './src/types/model',
|
|
215
|
+
singleFile: false,
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
|
|
219
|
+
// Multi-language support (optional)
|
|
220
|
+
locale: {
|
|
221
|
+
locales: ['en', 'ja', 'vi'],
|
|
222
|
+
defaultLocale: 'en',
|
|
223
|
+
fallbackLocale: 'en',
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
\`\`\`
|
|
227
|
+
|
|
228
|
+
## Configuration Options
|
|
229
|
+
|
|
230
|
+
### database (required)
|
|
231
|
+
| Option | Type | Description |
|
|
232
|
+
|--------|------|-------------|
|
|
233
|
+
| \`driver\` | string | Database driver: mysql, pgsql, sqlite, sqlsrv, mariadb |
|
|
234
|
+
| \`devUrl\` | string | Development database URL for Atlas diff |
|
|
235
|
+
| \`enableFieldComments\` | boolean | Enable field comments in migrations (MySQL) |
|
|
236
|
+
|
|
237
|
+
### output.laravel
|
|
238
|
+
| Option | Type | Description |
|
|
239
|
+
|--------|------|-------------|
|
|
240
|
+
| \`migrationsPath\` | string | Directory for generated migrations |
|
|
241
|
+
| \`modelsPath\` | string | Directory for generated models |
|
|
242
|
+
| \`modelsNamespace\` | string | PHP namespace for models |
|
|
243
|
+
| \`factoriesPath\` | string | Directory for generated factories |
|
|
244
|
+
| \`enumsPath\` | string | Directory for generated enums |
|
|
245
|
+
| \`enumsNamespace\` | string | PHP namespace for enums |
|
|
246
|
+
|
|
247
|
+
### output.typescript
|
|
248
|
+
| Option | Type | Description |
|
|
249
|
+
|--------|------|-------------|
|
|
250
|
+
| \`path\` | string | Output directory for TypeScript types |
|
|
251
|
+
| \`singleFile\` | boolean | Generate single file vs multiple files |
|
|
252
|
+
| \`generateEnums\` | boolean | Generate enum types |
|
|
253
|
+
| \`generateRelationships\` | boolean | Generate relationship types |
|
|
254
|
+
|
|
255
|
+
### locale (optional)
|
|
256
|
+
| Option | Type | Description |
|
|
257
|
+
|--------|------|-------------|
|
|
258
|
+
| \`locales\` | string[] | Supported locale codes: ['en', 'ja', 'vi'] |
|
|
259
|
+
| \`defaultLocale\` | string | Default locale for simple strings |
|
|
260
|
+
| \`fallbackLocale\` | string | Fallback when requested locale not found |
|
|
261
|
+
|
|
262
|
+
## Common Mistakes
|
|
263
|
+
|
|
264
|
+
❌ **Wrong** - \`locales\` at root level:
|
|
265
|
+
\`\`\`typescript
|
|
266
|
+
{
|
|
267
|
+
locales: ['en', 'ja'], // ERROR: locales not in OmnifyConfig
|
|
268
|
+
}
|
|
269
|
+
\`\`\`
|
|
270
|
+
|
|
271
|
+
✅ **Correct** - \`locales\` inside \`locale\` object:
|
|
272
|
+
\`\`\`typescript
|
|
273
|
+
{
|
|
274
|
+
locale: {
|
|
275
|
+
locales: ['en', 'ja'],
|
|
276
|
+
defaultLocale: 'en',
|
|
277
|
+
},
|
|
278
|
+
}
|
|
279
|
+
\`\`\`
|
|
280
|
+
`;
|
|
281
|
+
|
|
188
282
|
const MCP_CONFIG = {
|
|
189
283
|
omnify: {
|
|
190
284
|
command: 'npx',
|
|
@@ -225,7 +319,12 @@ function createOmnifySkillFiles(projectRoot) {
|
|
|
225
319
|
const schemaGuidePath = path.join(omnifyDir, 'schema-guide.md');
|
|
226
320
|
fs.writeFileSync(schemaGuidePath, SCHEMA_GUIDE_CONTENT, 'utf-8');
|
|
227
321
|
|
|
322
|
+
// Write config guide
|
|
323
|
+
const configGuidePath = path.join(omnifyDir, 'config-guide.md');
|
|
324
|
+
fs.writeFileSync(configGuidePath, CONFIG_GUIDE_CONTENT, 'utf-8');
|
|
325
|
+
|
|
228
326
|
console.log(' Created .claude/omnify/schema-guide.md');
|
|
327
|
+
console.log(' Created .claude/omnify/config-guide.md');
|
|
229
328
|
return true;
|
|
230
329
|
} catch (error) {
|
|
231
330
|
console.log(' Note: Could not create .claude/omnify/ skill files');
|