@famgia/omnify-cli 0.0.119 → 0.0.121

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 CHANGED
@@ -1029,6 +1029,20 @@ function generateAIGuides(rootDir, _plugins) {
1029
1029
  }
1030
1030
 
1031
1031
  // src/commands/generate.ts
1032
+ async function loadRegisteredSchemaPaths(rootDir) {
1033
+ const schemaPathsFile = (0, import_node_path7.resolve)(rootDir, "storage/omnify/schema-paths.json");
1034
+ if (!(0, import_node_fs5.existsSync)(schemaPathsFile)) {
1035
+ return [];
1036
+ }
1037
+ try {
1038
+ const content = (0, import_node_fs5.readFileSync)(schemaPathsFile, "utf-8");
1039
+ const data = JSON.parse(content);
1040
+ return data.paths ?? [];
1041
+ } catch {
1042
+ logger.debug("Could not read registered schema paths file");
1043
+ return [];
1044
+ }
1045
+ }
1032
1046
  function hasPluginGenerators(plugins) {
1033
1047
  return plugins.some((p) => p.generators && p.generators.length > 0);
1034
1048
  }
@@ -1461,13 +1475,28 @@ async function runGenerate(options) {
1461
1475
  validateConfig(config, rootDir);
1462
1476
  const schemaPath = (0, import_node_path7.resolve)(rootDir, config.schemasDir);
1463
1477
  logger.step(`Loading schemas from ${schemaPath}`);
1464
- const schemas = await (0, import_omnify_core5.loadSchemas)(schemaPath);
1478
+ let schemas = await (0, import_omnify_core5.loadSchemas)(schemaPath);
1479
+ logger.debug(`Found ${Object.keys(schemas).length} schema(s) in main directory`);
1480
+ const additionalPaths = await loadRegisteredSchemaPaths(rootDir);
1481
+ if (additionalPaths.length > 0) {
1482
+ logger.step(`Loading schemas from ${additionalPaths.length} registered path(s)`);
1483
+ for (const entry of additionalPaths) {
1484
+ if ((0, import_node_fs5.existsSync)(entry.path)) {
1485
+ const packageSchemas = await (0, import_omnify_core5.loadSchemas)(entry.path);
1486
+ const count = Object.keys(packageSchemas).length;
1487
+ logger.debug(` \u2022 ${entry.path}: ${count} schema(s)`);
1488
+ schemas = { ...packageSchemas, ...schemas };
1489
+ } else {
1490
+ logger.warn(` \u2022 ${entry.path}: directory not found (skipped)`);
1491
+ }
1492
+ }
1493
+ }
1465
1494
  const schemaCount = Object.keys(schemas).length;
1466
1495
  if (schemaCount === 0) {
1467
1496
  logger.warn("No schema files found");
1468
1497
  return;
1469
1498
  }
1470
- logger.debug(`Found ${schemaCount} schema(s)`);
1499
+ logger.debug(`Total: ${schemaCount} schema(s)`);
1471
1500
  const customTypeNames = [];
1472
1501
  for (const plugin of config.plugins) {
1473
1502
  if (plugin.types) {