@famgia/omnify 1.0.13 ā 1.0.17
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/dist/index.cjs +7 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/package.json +16 -8
- package/scripts/postinstall.js +361 -0
package/dist/index.cjs
CHANGED
|
@@ -28,14 +28,14 @@ __export(index_exports, {
|
|
|
28
28
|
diffHclSchemas: () => import_omnify_atlas.diffHclSchemas,
|
|
29
29
|
findReferencedSchemas: () => import_omnify_core.findReferencedSchemas,
|
|
30
30
|
findReferencingSchemas: () => import_omnify_core.findReferencingSchemas,
|
|
31
|
-
generateEnums: () =>
|
|
31
|
+
generateEnums: () => import_omnify_typescript.generateEnums,
|
|
32
32
|
generateHclSchema: () => import_omnify_atlas.generateHclSchema,
|
|
33
|
-
generateInterfaces: () =>
|
|
33
|
+
generateInterfaces: () => import_omnify_typescript.generateInterfaces,
|
|
34
34
|
generateMigrationFromSchema: () => import_omnify_laravel.generateMigrationFromSchema,
|
|
35
35
|
generateMigrations: () => import_omnify_laravel.generateMigrations,
|
|
36
36
|
generatePreview: () => import_omnify_atlas.generatePreview,
|
|
37
|
-
generateTypeScript: () =>
|
|
38
|
-
|
|
37
|
+
generateTypeScript: () => import_omnify_typescript.generateTypeScript,
|
|
38
|
+
generateTypeScriptFiles: () => import_omnify_typescript.generateTypeScriptFiles,
|
|
39
39
|
getEntitySchemas: () => import_omnify_core.getEntitySchemas,
|
|
40
40
|
getEnumSchemas: () => import_omnify_core.getEnumSchemas,
|
|
41
41
|
getGroups: () => import_omnify_core.getGroups,
|
|
@@ -54,7 +54,7 @@ __export(index_exports, {
|
|
|
54
54
|
renderHcl: () => import_omnify_atlas.renderHcl,
|
|
55
55
|
runAtlasDiff: () => import_omnify_atlas.runAtlasDiff,
|
|
56
56
|
schemaToBlueprint: () => import_omnify_laravel.schemaToBlueprint,
|
|
57
|
-
schemaToInterface: () =>
|
|
57
|
+
schemaToInterface: () => import_omnify_typescript.schemaToInterface,
|
|
58
58
|
validateSchemas: () => import_omnify_core.validateSchemas,
|
|
59
59
|
writeLockFile: () => import_omnify_atlas.writeLockFile
|
|
60
60
|
});
|
|
@@ -62,6 +62,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
62
62
|
var import_omnify_cli = require("@famgia/omnify-cli");
|
|
63
63
|
var import_omnify_core = require("@famgia/omnify-core");
|
|
64
64
|
var import_omnify_laravel = require("@famgia/omnify-laravel");
|
|
65
|
+
var import_omnify_typescript = require("@famgia/omnify-typescript");
|
|
65
66
|
var import_omnify_atlas = require("@famgia/omnify-atlas");
|
|
66
67
|
// Annotate the CommonJS export names for ESM import in node:
|
|
67
68
|
0 && (module.exports = {
|
|
@@ -80,7 +81,7 @@ var import_omnify_atlas = require("@famgia/omnify-atlas");
|
|
|
80
81
|
generateMigrations,
|
|
81
82
|
generatePreview,
|
|
82
83
|
generateTypeScript,
|
|
83
|
-
|
|
84
|
+
generateTypeScriptFiles,
|
|
84
85
|
getEntitySchemas,
|
|
85
86
|
getEnumSchemas,
|
|
86
87
|
getGroups,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @famgia/omnify - Schema-driven database migration system\n *\n * Main entry point that re-exports key APIs.\n */\n\n// CLI exports (for config files)\nexport { defineConfig, loadConfig } from '@famgia/omnify-cli';\nexport type { OmnifyConfig as ConfigType, ResolvedOmnifyConfig, DatabaseConfig, OutputConfig } from '@famgia/omnify-cli';\n\n// Core exports\nexport {\n loadSchemas,\n validateSchemas,\n createOmnify,\n Omnify,\n PluginManager,\n getSchemaMetadata,\n introspectSchema,\n introspectSchemas,\n getSchemaNames,\n getEntitySchemas,\n getEnumSchemas,\n getSchemasByGroup,\n getGroups,\n findReferencingSchemas,\n findReferencedSchemas,\n getRelationshipGraph,\n hasCircularReferences,\n getTopologicalOrder,\n} from '@famgia/omnify-core';\n\n// Type exports\nexport type {\n SchemaDefinition,\n LoadedSchema,\n SchemaCollection,\n PropertyDefinition,\n AssociationDefinition,\n OmnifyPlugin,\n OmnifyConfig,\n} from '@famgia/omnify-types';\n\n// Laravel generator exports\nexport {\n generateMigrations,\n generateMigrationFromSchema,\n generateTypeScript,\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @famgia/omnify - Schema-driven database migration system\n *\n * Main entry point that re-exports key APIs.\n */\n\n// CLI exports (for config files)\nexport { defineConfig, loadConfig } from '@famgia/omnify-cli';\nexport type { OmnifyConfig as ConfigType, ResolvedOmnifyConfig, DatabaseConfig, OutputConfig } from '@famgia/omnify-cli';\n\n// Core exports\nexport {\n loadSchemas,\n validateSchemas,\n createOmnify,\n Omnify,\n PluginManager,\n getSchemaMetadata,\n introspectSchema,\n introspectSchemas,\n getSchemaNames,\n getEntitySchemas,\n getEnumSchemas,\n getSchemasByGroup,\n getGroups,\n findReferencingSchemas,\n findReferencedSchemas,\n getRelationshipGraph,\n hasCircularReferences,\n getTopologicalOrder,\n} from '@famgia/omnify-core';\n\n// Type exports\nexport type {\n SchemaDefinition,\n LoadedSchema,\n SchemaCollection,\n PropertyDefinition,\n AssociationDefinition,\n OmnifyPlugin,\n OmnifyConfig,\n} from '@famgia/omnify-types';\n\n// Laravel generator exports (migrations only)\nexport {\n generateMigrations,\n generateMigrationFromSchema,\n schemaToBlueprint,\n} from '@famgia/omnify-laravel';\n\nexport type {\n MigrationFile,\n MigrationOptions,\n} from '@famgia/omnify-laravel';\n\n// TypeScript generator exports\nexport {\n generateTypeScript,\n generateTypeScriptFiles,\n generateInterfaces,\n generateEnums,\n schemaToInterface,\n} from '@famgia/omnify-typescript';\n\nexport type {\n TypeScriptFile,\n TypeScriptOptions,\n} from '@famgia/omnify-typescript';\n\n// Atlas adapter exports\nexport {\n runAtlasDiff,\n diffHclSchemas,\n generateHclSchema,\n renderHcl,\n readLockFile,\n writeLockFile,\n compareSchemas,\n generatePreview,\n parseDiffOutput,\n} from '@famgia/omnify-atlas';\n\nexport type {\n AtlasDiffResult,\n HclSchema,\n LockFile,\n DiffResult,\n ChangePreview,\n} from '@famgia/omnify-atlas';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,wBAAyC;AAIzC,yBAmBO;AAcP,4BAIO;AAQP,+BAMO;AAQP,0BAUO;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { OmnifyConfig as ConfigType, DatabaseConfig, OutputConfig, ResolvedOmnifyConfig, defineConfig, loadConfig } from '@famgia/omnify-cli';
|
|
2
2
|
export { Omnify, PluginManager, createOmnify, findReferencedSchemas, findReferencingSchemas, getEntitySchemas, getEnumSchemas, getGroups, getRelationshipGraph, getSchemaMetadata, getSchemaNames, getSchemasByGroup, getTopologicalOrder, hasCircularReferences, introspectSchema, introspectSchemas, loadSchemas, validateSchemas } from '@famgia/omnify-core';
|
|
3
3
|
export { AssociationDefinition, LoadedSchema, OmnifyConfig, OmnifyPlugin, PropertyDefinition, SchemaCollection, SchemaDefinition } from '@famgia/omnify-types';
|
|
4
|
-
export { MigrationFile, MigrationOptions,
|
|
4
|
+
export { MigrationFile, MigrationOptions, generateMigrationFromSchema, generateMigrations, schemaToBlueprint } from '@famgia/omnify-laravel';
|
|
5
|
+
export { TypeScriptFile, TypeScriptOptions, generateEnums, generateInterfaces, generateTypeScript, generateTypeScriptFiles, schemaToInterface } from '@famgia/omnify-typescript';
|
|
5
6
|
export { AtlasDiffResult, ChangePreview, DiffResult, HclSchema, LockFile, compareSchemas, diffHclSchemas, generateHclSchema, generatePreview, parseDiffOutput, readLockFile, renderHcl, runAtlasDiff, writeLockFile } from '@famgia/omnify-atlas';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { OmnifyConfig as ConfigType, DatabaseConfig, OutputConfig, ResolvedOmnifyConfig, defineConfig, loadConfig } from '@famgia/omnify-cli';
|
|
2
2
|
export { Omnify, PluginManager, createOmnify, findReferencedSchemas, findReferencingSchemas, getEntitySchemas, getEnumSchemas, getGroups, getRelationshipGraph, getSchemaMetadata, getSchemaNames, getSchemasByGroup, getTopologicalOrder, hasCircularReferences, introspectSchema, introspectSchemas, loadSchemas, validateSchemas } from '@famgia/omnify-core';
|
|
3
3
|
export { AssociationDefinition, LoadedSchema, OmnifyConfig, OmnifyPlugin, PropertyDefinition, SchemaCollection, SchemaDefinition } from '@famgia/omnify-types';
|
|
4
|
-
export { MigrationFile, MigrationOptions,
|
|
4
|
+
export { MigrationFile, MigrationOptions, generateMigrationFromSchema, generateMigrations, schemaToBlueprint } from '@famgia/omnify-laravel';
|
|
5
|
+
export { TypeScriptFile, TypeScriptOptions, generateEnums, generateInterfaces, generateTypeScript, generateTypeScriptFiles, schemaToInterface } from '@famgia/omnify-typescript';
|
|
5
6
|
export { AtlasDiffResult, ChangePreview, DiffResult, HclSchema, LockFile, compareSchemas, diffHclSchemas, generateHclSchema, generatePreview, parseDiffOutput, readLockFile, renderHcl, runAtlasDiff, writeLockFile } from '@famgia/omnify-atlas';
|
package/dist/index.js
CHANGED
|
@@ -23,13 +23,15 @@ import {
|
|
|
23
23
|
import {
|
|
24
24
|
generateMigrations,
|
|
25
25
|
generateMigrationFromSchema,
|
|
26
|
+
schemaToBlueprint
|
|
27
|
+
} from "@famgia/omnify-laravel";
|
|
28
|
+
import {
|
|
26
29
|
generateTypeScript,
|
|
27
|
-
|
|
30
|
+
generateTypeScriptFiles,
|
|
28
31
|
generateInterfaces,
|
|
29
32
|
generateEnums,
|
|
30
|
-
schemaToBlueprint,
|
|
31
33
|
schemaToInterface
|
|
32
|
-
} from "@famgia/omnify-
|
|
34
|
+
} from "@famgia/omnify-typescript";
|
|
33
35
|
import {
|
|
34
36
|
runAtlasDiff,
|
|
35
37
|
diffHclSchemas,
|
|
@@ -57,7 +59,7 @@ export {
|
|
|
57
59
|
generateMigrations,
|
|
58
60
|
generatePreview,
|
|
59
61
|
generateTypeScript,
|
|
60
|
-
|
|
62
|
+
generateTypeScriptFiles,
|
|
61
63
|
getEntitySchemas,
|
|
62
64
|
getEnumSchemas,
|
|
63
65
|
getGroups,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @famgia/omnify - Schema-driven database migration system\n *\n * Main entry point that re-exports key APIs.\n */\n\n// CLI exports (for config files)\nexport { defineConfig, loadConfig } from '@famgia/omnify-cli';\nexport type { OmnifyConfig as ConfigType, ResolvedOmnifyConfig, DatabaseConfig, OutputConfig } from '@famgia/omnify-cli';\n\n// Core exports\nexport {\n loadSchemas,\n validateSchemas,\n createOmnify,\n Omnify,\n PluginManager,\n getSchemaMetadata,\n introspectSchema,\n introspectSchemas,\n getSchemaNames,\n getEntitySchemas,\n getEnumSchemas,\n getSchemasByGroup,\n getGroups,\n findReferencingSchemas,\n findReferencedSchemas,\n getRelationshipGraph,\n hasCircularReferences,\n getTopologicalOrder,\n} from '@famgia/omnify-core';\n\n// Type exports\nexport type {\n SchemaDefinition,\n LoadedSchema,\n SchemaCollection,\n PropertyDefinition,\n AssociationDefinition,\n OmnifyPlugin,\n OmnifyConfig,\n} from '@famgia/omnify-types';\n\n// Laravel generator exports\nexport {\n generateMigrations,\n generateMigrationFromSchema,\n generateTypeScript,\n
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @famgia/omnify - Schema-driven database migration system\n *\n * Main entry point that re-exports key APIs.\n */\n\n// CLI exports (for config files)\nexport { defineConfig, loadConfig } from '@famgia/omnify-cli';\nexport type { OmnifyConfig as ConfigType, ResolvedOmnifyConfig, DatabaseConfig, OutputConfig } from '@famgia/omnify-cli';\n\n// Core exports\nexport {\n loadSchemas,\n validateSchemas,\n createOmnify,\n Omnify,\n PluginManager,\n getSchemaMetadata,\n introspectSchema,\n introspectSchemas,\n getSchemaNames,\n getEntitySchemas,\n getEnumSchemas,\n getSchemasByGroup,\n getGroups,\n findReferencingSchemas,\n findReferencedSchemas,\n getRelationshipGraph,\n hasCircularReferences,\n getTopologicalOrder,\n} from '@famgia/omnify-core';\n\n// Type exports\nexport type {\n SchemaDefinition,\n LoadedSchema,\n SchemaCollection,\n PropertyDefinition,\n AssociationDefinition,\n OmnifyPlugin,\n OmnifyConfig,\n} from '@famgia/omnify-types';\n\n// Laravel generator exports (migrations only)\nexport {\n generateMigrations,\n generateMigrationFromSchema,\n schemaToBlueprint,\n} from '@famgia/omnify-laravel';\n\nexport type {\n MigrationFile,\n MigrationOptions,\n} from '@famgia/omnify-laravel';\n\n// TypeScript generator exports\nexport {\n generateTypeScript,\n generateTypeScriptFiles,\n generateInterfaces,\n generateEnums,\n schemaToInterface,\n} from '@famgia/omnify-typescript';\n\nexport type {\n TypeScriptFile,\n TypeScriptOptions,\n} from '@famgia/omnify-typescript';\n\n// Atlas adapter exports\nexport {\n runAtlasDiff,\n diffHclSchemas,\n generateHclSchema,\n renderHcl,\n readLockFile,\n writeLockFile,\n compareSchemas,\n generatePreview,\n parseDiffOutput,\n} from '@famgia/omnify-atlas';\n\nexport type {\n AtlasDiffResult,\n HclSchema,\n LockFile,\n DiffResult,\n ChangePreview,\n} from '@famgia/omnify-atlas';\n"],"mappings":";AAOA,SAAS,cAAc,kBAAkB;AAIzC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAcP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAQP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@famgia/omnify",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"description": "Schema-driven database migration system with TypeScript types and Laravel migrations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,14 +20,17 @@
|
|
|
20
20
|
"dist",
|
|
21
21
|
"bin",
|
|
22
22
|
"docs",
|
|
23
|
+
"scripts",
|
|
23
24
|
"README.md"
|
|
24
25
|
],
|
|
25
26
|
"dependencies": {
|
|
26
|
-
"@famgia/omnify-cli": "0.0.
|
|
27
|
-
"@famgia/omnify-core": "0.0.
|
|
28
|
-
"@famgia/omnify-types": "0.0.
|
|
29
|
-
"@famgia/omnify-
|
|
30
|
-
"@famgia/omnify-laravel": "0.0.
|
|
27
|
+
"@famgia/omnify-cli": "0.0.16",
|
|
28
|
+
"@famgia/omnify-core": "0.0.16",
|
|
29
|
+
"@famgia/omnify-types": "0.0.12",
|
|
30
|
+
"@famgia/omnify-typescript": "0.0.4",
|
|
31
|
+
"@famgia/omnify-laravel": "0.0.22",
|
|
32
|
+
"@famgia/omnify-mcp": "0.0.4",
|
|
33
|
+
"@famgia/omnify-atlas": "0.0.12"
|
|
31
34
|
},
|
|
32
35
|
"keywords": [
|
|
33
36
|
"omnify",
|
|
@@ -36,7 +39,10 @@
|
|
|
36
39
|
"laravel",
|
|
37
40
|
"typescript",
|
|
38
41
|
"atlas",
|
|
39
|
-
"database"
|
|
42
|
+
"database",
|
|
43
|
+
"mcp",
|
|
44
|
+
"ai",
|
|
45
|
+
"claude"
|
|
40
46
|
],
|
|
41
47
|
"author": "Famgia",
|
|
42
48
|
"license": "MIT",
|
|
@@ -45,6 +51,8 @@
|
|
|
45
51
|
"clean": "rm -rf dist",
|
|
46
52
|
"test": "vitest run --passWithNoTests",
|
|
47
53
|
"test:watch": "vitest",
|
|
48
|
-
"lint": "eslint src"
|
|
54
|
+
"lint": "eslint src",
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"postinstall": "node scripts/postinstall.js"
|
|
49
57
|
}
|
|
50
58
|
}
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import os from 'os';
|
|
6
|
+
|
|
7
|
+
// Content for CLAUDE.md
|
|
8
|
+
const CLAUDE_MD_SECTION = `## Omnify
|
|
9
|
+
|
|
10
|
+
This project uses Omnify for schema-driven code generation.
|
|
11
|
+
|
|
12
|
+
**Documentation**: \`.claude/omnify/\`
|
|
13
|
+
- \`schema-guide.md\` - Schema format and property types
|
|
14
|
+
- \`laravel-guide.md\` - Laravel generator (if installed)
|
|
15
|
+
- \`typescript-guide.md\` - TypeScript generator (if installed)
|
|
16
|
+
|
|
17
|
+
**Commands**:
|
|
18
|
+
- \`npx omnify generate\` - Generate code from schemas
|
|
19
|
+
- \`npx omnify validate\` - Validate schemas
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
// Cursor rules content
|
|
23
|
+
const CURSORRULES_CONTENT = `# Omnify Schema Rules
|
|
24
|
+
|
|
25
|
+
This project uses Omnify for schema-driven code generation.
|
|
26
|
+
Schemas are in \`schemas/\` directory with \`.yaml\` extension.
|
|
27
|
+
|
|
28
|
+
For detailed documentation, read these files:
|
|
29
|
+
- .claude/omnify/schema-guide.md - Base schema format
|
|
30
|
+
- .claude/omnify/laravel-guide.md - Laravel generator (if exists)
|
|
31
|
+
- .claude/omnify/typescript-guide.md - TypeScript generator (if exists)
|
|
32
|
+
|
|
33
|
+
Commands:
|
|
34
|
+
- npx omnify generate - Generate code from schemas
|
|
35
|
+
- npx omnify validate - Validate all schemas
|
|
36
|
+
`;
|
|
37
|
+
|
|
38
|
+
// Marker to check if Omnify section exists
|
|
39
|
+
const OMNIFY_MARKER = '.claude/omnify/';
|
|
40
|
+
|
|
41
|
+
// Schema guide skill file
|
|
42
|
+
const SCHEMA_GUIDE_CONTENT = `# Omnify Schema Format Guide
|
|
43
|
+
|
|
44
|
+
## Schema Location
|
|
45
|
+
|
|
46
|
+
All schemas are stored in \`schemas/\` directory with \`.yaml\` extension.
|
|
47
|
+
|
|
48
|
+
## Object Schema Structure
|
|
49
|
+
|
|
50
|
+
\`\`\`yaml
|
|
51
|
+
# yaml-language-server: $schema=https://unpkg.com/@famgia/omnify-types/schemas/omnify-schema.json
|
|
52
|
+
name: ModelName # Required: PascalCase
|
|
53
|
+
kind: object # Optional: 'object' (default) or 'enum'
|
|
54
|
+
displayName: # Optional: i18n display name
|
|
55
|
+
ja: ę„ę¬čŖå
|
|
56
|
+
en: English Name
|
|
57
|
+
description: # Optional: i18n description
|
|
58
|
+
ja: čŖ¬ęę
|
|
59
|
+
en: Description
|
|
60
|
+
group: group-name # Optional: for organizing schemas
|
|
61
|
+
options:
|
|
62
|
+
softDelete: true # Enable soft delete (deleted_at column)
|
|
63
|
+
timestamps: true # Enable created_at, updated_at
|
|
64
|
+
table: custom_table # Custom table name
|
|
65
|
+
properties:
|
|
66
|
+
# Property definitions here
|
|
67
|
+
\`\`\`
|
|
68
|
+
|
|
69
|
+
## Property Types
|
|
70
|
+
|
|
71
|
+
### String Types
|
|
72
|
+
| Type | Description | Options |
|
|
73
|
+
|------|-------------|---------|
|
|
74
|
+
| \`String\` | Short text (varchar) | \`maxLength\`, \`minLength\`, \`default\` |
|
|
75
|
+
| \`LongText\` | Long text (text) | \`default\` |
|
|
76
|
+
|
|
77
|
+
### Numeric Types
|
|
78
|
+
| Type | Description | Options |
|
|
79
|
+
|------|-------------|---------|
|
|
80
|
+
| \`Int\` | Integer | \`min\`, \`max\`, \`default\`, \`unsigned\` |
|
|
81
|
+
| \`BigInt\` | Big integer | \`min\`, \`max\`, \`default\`, \`unsigned\` |
|
|
82
|
+
| \`Float\` | Decimal | \`precision\`, \`scale\`, \`default\` |
|
|
83
|
+
|
|
84
|
+
### Other Types
|
|
85
|
+
| Type | Description | Options |
|
|
86
|
+
|------|-------------|---------|
|
|
87
|
+
| \`Boolean\` | True/false | \`default\` |
|
|
88
|
+
| \`Date\` | Date only | \`default\` |
|
|
89
|
+
| \`DateTime\` | Date and time | \`default\` |
|
|
90
|
+
| \`Json\` | JSON object | \`default\` |
|
|
91
|
+
| \`EnumRef\` | Reference to enum | \`enum\` (required), \`default\` |
|
|
92
|
+
|
|
93
|
+
### Association Type
|
|
94
|
+
| Type | Description | Options |
|
|
95
|
+
|------|-------------|---------|
|
|
96
|
+
| \`Association\` | Relation | \`relation\`, \`target\`, \`onDelete\`, \`mappedBy\` |
|
|
97
|
+
|
|
98
|
+
## Property Options
|
|
99
|
+
|
|
100
|
+
\`\`\`yaml
|
|
101
|
+
properties:
|
|
102
|
+
name:
|
|
103
|
+
type: String
|
|
104
|
+
displayName:
|
|
105
|
+
ja: åå
|
|
106
|
+
en: Name
|
|
107
|
+
required: true # Not nullable
|
|
108
|
+
unique: true # Unique constraint
|
|
109
|
+
index: true # Create index
|
|
110
|
+
maxLength: 255 # For String
|
|
111
|
+
default: 'default' # Default value
|
|
112
|
+
\`\`\`
|
|
113
|
+
|
|
114
|
+
## Association Relations
|
|
115
|
+
|
|
116
|
+
### ManyToOne (N:1)
|
|
117
|
+
\`\`\`yaml
|
|
118
|
+
author:
|
|
119
|
+
type: Association
|
|
120
|
+
relation: ManyToOne
|
|
121
|
+
target: User
|
|
122
|
+
onDelete: CASCADE # CASCADE, SET_NULL, RESTRICT
|
|
123
|
+
\`\`\`
|
|
124
|
+
|
|
125
|
+
### OneToMany (1:N)
|
|
126
|
+
\`\`\`yaml
|
|
127
|
+
posts:
|
|
128
|
+
type: Association
|
|
129
|
+
relation: OneToMany
|
|
130
|
+
target: Post
|
|
131
|
+
mappedBy: author # Property name in Post that references this
|
|
132
|
+
\`\`\`
|
|
133
|
+
|
|
134
|
+
### ManyToMany (N:M)
|
|
135
|
+
\`\`\`yaml
|
|
136
|
+
tags:
|
|
137
|
+
type: Association
|
|
138
|
+
relation: ManyToMany
|
|
139
|
+
target: Tag
|
|
140
|
+
pivotTable: post_tags # Optional: custom pivot table name
|
|
141
|
+
pivotFields: # Optional: extra pivot fields
|
|
142
|
+
- name: order
|
|
143
|
+
type: Int
|
|
144
|
+
default: 0
|
|
145
|
+
\`\`\`
|
|
146
|
+
|
|
147
|
+
### OneToOne (1:1)
|
|
148
|
+
\`\`\`yaml
|
|
149
|
+
profile:
|
|
150
|
+
type: Association
|
|
151
|
+
relation: OneToOne
|
|
152
|
+
target: Profile
|
|
153
|
+
onDelete: CASCADE
|
|
154
|
+
\`\`\`
|
|
155
|
+
|
|
156
|
+
## Enum Schema
|
|
157
|
+
|
|
158
|
+
\`\`\`yaml
|
|
159
|
+
name: PostStatus
|
|
160
|
+
kind: enum
|
|
161
|
+
displayName:
|
|
162
|
+
ja: ę稿ć¹ćć¼ćæć¹
|
|
163
|
+
en: Post Status
|
|
164
|
+
values:
|
|
165
|
+
draft: ćć©ćć # value: displayName format
|
|
166
|
+
published: å
¬éęøćæ
|
|
167
|
+
archived: ć¢ć¼ć«ć¤ć
|
|
168
|
+
\`\`\`
|
|
169
|
+
|
|
170
|
+
Use enum in object schema:
|
|
171
|
+
\`\`\`yaml
|
|
172
|
+
status:
|
|
173
|
+
type: EnumRef
|
|
174
|
+
enum: PostStatus # Reference enum name
|
|
175
|
+
default: draft # Default value from enum
|
|
176
|
+
\`\`\`
|
|
177
|
+
|
|
178
|
+
## MCP Tools
|
|
179
|
+
|
|
180
|
+
If Omnify MCP is configured, these tools are available:
|
|
181
|
+
- \`omnify_create_schema\` - Generate schema YAML
|
|
182
|
+
- \`omnify_validate_schema\` - Validate YAML content
|
|
183
|
+
- \`omnify_get_types\` - Property types documentation
|
|
184
|
+
- \`omnify_get_relationships\` - Relationship guide
|
|
185
|
+
- \`omnify_get_examples\` - Example schemas
|
|
186
|
+
`;
|
|
187
|
+
|
|
188
|
+
const MCP_CONFIG = {
|
|
189
|
+
omnify: {
|
|
190
|
+
command: 'npx',
|
|
191
|
+
args: ['@famgia/omnify-mcp'],
|
|
192
|
+
},
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
function findProjectRoot() {
|
|
196
|
+
// npm/pnpm set INIT_CWD to the directory where the install was run
|
|
197
|
+
// This is more reliable than process.cwd() during postinstall
|
|
198
|
+
let dir = process.env.INIT_CWD || process.cwd();
|
|
199
|
+
|
|
200
|
+
// If we're in node_modules, go up to find the actual project
|
|
201
|
+
const nodeModulesIndex = dir.indexOf('node_modules');
|
|
202
|
+
if (nodeModulesIndex !== -1) {
|
|
203
|
+
dir = dir.substring(0, nodeModulesIndex - 1);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Verify it's a project root by checking for package.json
|
|
207
|
+
const packageJsonPath = path.join(dir, 'package.json');
|
|
208
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
209
|
+
return dir;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function createOmnifySkillFiles(projectRoot) {
|
|
216
|
+
const omnifyDir = path.join(projectRoot, '.claude', 'omnify');
|
|
217
|
+
|
|
218
|
+
try {
|
|
219
|
+
// Create .claude/omnify directory
|
|
220
|
+
if (!fs.existsSync(omnifyDir)) {
|
|
221
|
+
fs.mkdirSync(omnifyDir, { recursive: true });
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Write base schema guide (plugin-specific guides are created by each plugin)
|
|
225
|
+
const schemaGuidePath = path.join(omnifyDir, 'schema-guide.md');
|
|
226
|
+
fs.writeFileSync(schemaGuidePath, SCHEMA_GUIDE_CONTENT, 'utf-8');
|
|
227
|
+
|
|
228
|
+
console.log(' Created .claude/omnify/schema-guide.md');
|
|
229
|
+
return true;
|
|
230
|
+
} catch (error) {
|
|
231
|
+
console.log(' Note: Could not create .claude/omnify/ skill files');
|
|
232
|
+
return false;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function createClaudeMd(projectRoot) {
|
|
237
|
+
const claudeMdPath = path.join(projectRoot, 'CLAUDE.md');
|
|
238
|
+
|
|
239
|
+
// Check if CLAUDE.md exists
|
|
240
|
+
if (fs.existsSync(claudeMdPath)) {
|
|
241
|
+
const existingContent = fs.readFileSync(claudeMdPath, 'utf-8');
|
|
242
|
+
|
|
243
|
+
// Check if Omnify section already exists
|
|
244
|
+
if (existingContent.includes(OMNIFY_MARKER)) {
|
|
245
|
+
console.log(' CLAUDE.md already has Omnify section, skipping...');
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// Append Omnify section to existing CLAUDE.md
|
|
250
|
+
const newContent = existingContent.trimEnd() + '\n\n' + CLAUDE_MD_SECTION;
|
|
251
|
+
fs.writeFileSync(claudeMdPath, newContent, 'utf-8');
|
|
252
|
+
console.log(' Appended Omnify section to CLAUDE.md');
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Create new CLAUDE.md with just the Omnify section
|
|
257
|
+
fs.writeFileSync(claudeMdPath, CLAUDE_MD_SECTION, 'utf-8');
|
|
258
|
+
console.log(' Created CLAUDE.md');
|
|
259
|
+
return true;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function createCursorRules(projectRoot) {
|
|
263
|
+
const cursorDir = path.join(projectRoot, '.cursor', 'rules');
|
|
264
|
+
const cursorRulesPath = path.join(cursorDir, 'omnify.md');
|
|
265
|
+
|
|
266
|
+
try {
|
|
267
|
+
// Create .cursor/rules directory
|
|
268
|
+
if (!fs.existsSync(cursorDir)) {
|
|
269
|
+
fs.mkdirSync(cursorDir, { recursive: true });
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Always overwrite - this file is fully managed by Omnify
|
|
273
|
+
fs.writeFileSync(cursorRulesPath, CURSORRULES_CONTENT, 'utf-8');
|
|
274
|
+
console.log(' Updated .cursor/rules/omnify.md');
|
|
275
|
+
return true;
|
|
276
|
+
} catch {
|
|
277
|
+
return false;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function configureClaudeMcp() {
|
|
282
|
+
const homeDir = os.homedir();
|
|
283
|
+
const claudeDir = path.join(homeDir, '.claude');
|
|
284
|
+
const configPath = path.join(claudeDir, 'claude_desktop_config.json');
|
|
285
|
+
|
|
286
|
+
try {
|
|
287
|
+
// Create .claude directory if not exists
|
|
288
|
+
if (!fs.existsSync(claudeDir)) {
|
|
289
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
let config = { mcpServers: {} };
|
|
293
|
+
|
|
294
|
+
// Read existing config if exists
|
|
295
|
+
if (fs.existsSync(configPath)) {
|
|
296
|
+
try {
|
|
297
|
+
const content = fs.readFileSync(configPath, 'utf-8');
|
|
298
|
+
config = JSON.parse(content);
|
|
299
|
+
if (!config.mcpServers) {
|
|
300
|
+
config.mcpServers = {};
|
|
301
|
+
}
|
|
302
|
+
} catch {
|
|
303
|
+
// Invalid JSON, start fresh
|
|
304
|
+
config = { mcpServers: {} };
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// Check if omnify is already configured
|
|
309
|
+
if (config.mcpServers.omnify) {
|
|
310
|
+
console.log(' Omnify MCP already configured');
|
|
311
|
+
return false;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Add omnify MCP server
|
|
315
|
+
config.mcpServers.omnify = MCP_CONFIG.omnify;
|
|
316
|
+
|
|
317
|
+
// Write config
|
|
318
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');
|
|
319
|
+
console.log(' Configured Omnify MCP server in ~/.claude/claude_desktop_config.json');
|
|
320
|
+
return true;
|
|
321
|
+
} catch (error) {
|
|
322
|
+
// Silently fail - MCP config is optional
|
|
323
|
+
console.log(' Note: Could not auto-configure MCP (optional)');
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function main() {
|
|
329
|
+
// Skip in CI environments
|
|
330
|
+
if (process.env.CI || process.env.CONTINUOUS_INTEGRATION) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// Skip if in omnify-ts monorepo (source code), but allow examples/
|
|
335
|
+
const projectDir = process.env.INIT_CWD || process.cwd();
|
|
336
|
+
if (projectDir.includes('omnify-ts') && !projectDir.includes('omnify-ts/examples')) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
console.log('\nš§ Omnify: Setting up Claude Code integration...\n');
|
|
341
|
+
|
|
342
|
+
const projectRoot = findProjectRoot();
|
|
343
|
+
|
|
344
|
+
if (projectRoot) {
|
|
345
|
+
// Create .claude/omnify/ skill files
|
|
346
|
+
createOmnifySkillFiles(projectRoot);
|
|
347
|
+
|
|
348
|
+
// Create or update CLAUDE.md in project root
|
|
349
|
+
createClaudeMd(projectRoot);
|
|
350
|
+
|
|
351
|
+
// Create Cursor rules
|
|
352
|
+
createCursorRules(projectRoot);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Configure MCP server in user's home directory
|
|
356
|
+
configureClaudeMcp();
|
|
357
|
+
|
|
358
|
+
console.log('\nā
Omnify setup complete!\n');
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
main();
|