@famgia/omnify 1.0.21 → 1.0.22

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@famgia/omnify",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
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.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"
27
+ "@famgia/omnify-cli": "0.0.21",
28
+ "@famgia/omnify-core": "0.0.21",
29
+ "@famgia/omnify-types": "0.0.17",
30
+ "@famgia/omnify-laravel": "0.0.27",
31
+ "@famgia/omnify-typescript": "0.0.9",
32
+ "@famgia/omnify-atlas": "0.0.17",
33
+ "@famgia/omnify-mcp": "0.0.9"
34
34
  },
35
35
  "keywords": [
36
36
  "omnify",
@@ -50,7 +50,7 @@ All schemas are stored in \`schemas/\` directory with \`.yaml\` extension.
50
50
  ## Object Schema Structure
51
51
 
52
52
  \`\`\`yaml
53
- # yaml-language-server: $schema=./node_modules/@famgia/omnify-types/schemas/omnify-schema.json
53
+ # yaml-language-server: $schema=./node_modules/.omnify/combined-schema.json
54
54
  name: ModelName # Required: PascalCase
55
55
  kind: object # Optional: 'object' (default) or 'enum'
56
56
  displayName: # Optional: i18n display name
@@ -286,6 +286,128 @@ const MCP_CONFIG = {
286
286
  },
287
287
  };
288
288
 
289
+ // Combined schema path (relative from project root)
290
+ const COMBINED_SCHEMA_PATH = 'node_modules/.omnify/combined-schema.json';
291
+
292
+ /**
293
+ * Generate combined JSON Schema from base schema + all plugin contributions
294
+ */
295
+ function generateCombinedSchema(projectRoot) {
296
+ const nodeModulesDir = path.join(projectRoot, 'node_modules');
297
+ const outputDir = path.join(nodeModulesDir, '.omnify');
298
+ const outputPath = path.join(outputDir, 'combined-schema.json');
299
+
300
+ try {
301
+ // Read base schema from @famgia/omnify-types
302
+ // Check multiple possible locations (direct, nested via omnify, pnpm hoisted)
303
+ const possiblePaths = [
304
+ path.join(nodeModulesDir, '@famgia/omnify-types/schemas/omnify-schema.json'),
305
+ path.join(nodeModulesDir, '@famgia/omnify/node_modules/@famgia/omnify-types/schemas/omnify-schema.json'),
306
+ path.join(nodeModulesDir, '.pnpm/@famgia+omnify-types@*/node_modules/@famgia/omnify-types/schemas/omnify-schema.json'),
307
+ ];
308
+
309
+ let baseSchemaPath = null;
310
+ for (const p of possiblePaths) {
311
+ // Handle glob pattern for pnpm
312
+ if (p.includes('*')) {
313
+ const dir = path.dirname(path.dirname(p));
314
+ if (fs.existsSync(path.dirname(dir))) {
315
+ const matches = fs.readdirSync(path.dirname(dir)).filter(f => f.startsWith('@famgia+omnify-types@'));
316
+ if (matches.length > 0) {
317
+ const matchPath = path.join(path.dirname(dir), matches[0], 'node_modules/@famgia/omnify-types/schemas/omnify-schema.json');
318
+ if (fs.existsSync(matchPath)) {
319
+ baseSchemaPath = matchPath;
320
+ break;
321
+ }
322
+ }
323
+ }
324
+ } else if (fs.existsSync(p)) {
325
+ baseSchemaPath = p;
326
+ break;
327
+ }
328
+ }
329
+
330
+ if (!baseSchemaPath) {
331
+ console.log(' Note: Base schema not found, skipping combined schema generation');
332
+ return false;
333
+ }
334
+
335
+ const baseSchema = JSON.parse(fs.readFileSync(baseSchemaPath, 'utf-8'));
336
+
337
+ // Find all @famgia/omnify-* plugins with schema contributions
338
+ // Check multiple possible locations (direct, nested via omnify)
339
+ const famgiaDirs = [
340
+ path.join(nodeModulesDir, '@famgia'),
341
+ path.join(nodeModulesDir, '@famgia/omnify/node_modules/@famgia'),
342
+ ];
343
+ const pluginContributions = [];
344
+ const processedPlugins = new Set();
345
+
346
+ for (const famgiaDir of famgiaDirs) {
347
+ if (!fs.existsSync(famgiaDir)) continue;
348
+
349
+ const packages = fs.readdirSync(famgiaDir);
350
+ for (const pkg of packages) {
351
+ // Skip non-plugin packages and already processed
352
+ if (!pkg.startsWith('omnify-') || pkg === 'omnify-types' || pkg === 'omnify-mcp') {
353
+ continue;
354
+ }
355
+ if (processedPlugins.has(pkg)) continue;
356
+
357
+ const contributionPath = path.join(famgiaDir, pkg, 'schemas/schema-contribution.json');
358
+ if (fs.existsSync(contributionPath)) {
359
+ try {
360
+ const contribution = JSON.parse(fs.readFileSync(contributionPath, 'utf-8'));
361
+ pluginContributions.push({ name: pkg, contribution });
362
+ processedPlugins.add(pkg);
363
+ } catch {
364
+ // Invalid JSON, skip
365
+ }
366
+ }
367
+ }
368
+ }
369
+
370
+ // Merge contributions into base schema
371
+ for (const { name, contribution } of pluginContributions) {
372
+ // Add definitions
373
+ if (contribution.definitions) {
374
+ for (const [defName, defValue] of Object.entries(contribution.definitions)) {
375
+ baseSchema.definitions[defName] = defValue;
376
+ }
377
+ }
378
+
379
+ // Add to PropertyDefinition oneOf
380
+ if (contribution.propertyTypes && baseSchema.definitions.PropertyDefinition) {
381
+ for (const typeName of contribution.propertyTypes) {
382
+ baseSchema.definitions.PropertyDefinition.oneOf.push({
383
+ "$ref": `#/definitions/${typeName}`
384
+ });
385
+ }
386
+ }
387
+
388
+ console.log(` Added schema contributions from @famgia/${name}`);
389
+ }
390
+
391
+ // Update schema $id to indicate it's combined
392
+ baseSchema.$id = 'omnify://combined-schema.json';
393
+ baseSchema.description = baseSchema.description + ' (Combined with plugin contributions)';
394
+
395
+ // Create output directory
396
+ if (!fs.existsSync(outputDir)) {
397
+ fs.mkdirSync(outputDir, { recursive: true });
398
+ }
399
+
400
+ // Write combined schema
401
+ fs.writeFileSync(outputPath, JSON.stringify(baseSchema, null, 2), 'utf-8');
402
+ console.log(' Generated combined JSON schema at node_modules/.omnify/combined-schema.json');
403
+
404
+ return true;
405
+ } catch (error) {
406
+ console.log(' Note: Could not generate combined schema');
407
+ return false;
408
+ }
409
+ }
410
+
289
411
  function findProjectRoot() {
290
412
  // npm/pnpm set INIT_CWD to the directory where the install was run
291
413
  // This is more reliable than process.cwd() during postinstall
@@ -441,6 +563,9 @@ function main() {
441
563
  const projectRoot = findProjectRoot();
442
564
 
443
565
  if (projectRoot) {
566
+ // Generate combined JSON schema with plugin contributions
567
+ generateCombinedSchema(projectRoot);
568
+
444
569
  // Create .claude/omnify/ skill files
445
570
  createOmnifySkillFiles(projectRoot);
446
571