@famgia/omnify-cli 0.0.132 → 0.0.134

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
@@ -1031,15 +1031,22 @@ function generateAIGuides(rootDir, _plugins) {
1031
1031
  // src/commands/generate.ts
1032
1032
  async function loadRegisteredSchemaPaths(rootDir) {
1033
1033
  const schemaPathsFile = (0, import_node_path7.resolve)(rootDir, "storage/omnify/schema-paths.json");
1034
+ logger.debug(`Checking for registered schema paths at: ${schemaPathsFile}`);
1034
1035
  if (!(0, import_node_fs5.existsSync)(schemaPathsFile)) {
1036
+ logger.debug("No registered schema paths file found");
1035
1037
  return [];
1036
1038
  }
1037
1039
  try {
1038
1040
  const content = (0, import_node_fs5.readFileSync)(schemaPathsFile, "utf-8");
1039
1041
  const data = JSON.parse(content);
1040
- return data.paths ?? [];
1041
- } catch {
1042
- logger.debug("Could not read registered schema paths file");
1042
+ if (!data.paths || data.paths.length === 0) {
1043
+ logger.debug("No paths defined in schema-paths.json");
1044
+ return [];
1045
+ }
1046
+ logger.debug(`Found ${data.paths.length} registered schema path(s) in schema-paths.json`);
1047
+ return data.paths;
1048
+ } catch (error) {
1049
+ logger.warn(`Could not read schema-paths.json: ${error.message}`);
1043
1050
  return [];
1044
1051
  }
1045
1052
  }
@@ -1478,19 +1485,28 @@ async function runGenerate(options) {
1478
1485
  let schemas = await (0, import_omnify_core5.loadSchemas)(schemaPath);
1479
1486
  logger.debug(`Found ${Object.keys(schemas).length} schema(s) in main directory`);
1480
1487
  const additionalPaths = await loadRegisteredSchemaPaths(rootDir);
1488
+ let hasPackageSchemas = false;
1481
1489
  if (additionalPaths.length > 0) {
1482
1490
  logger.step(`Loading schemas from ${additionalPaths.length} registered path(s)`);
1483
1491
  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)`);
1492
+ const absolutePath = (0, import_node_path7.resolve)(rootDir, entry.path);
1493
+ logger.debug(` Checking: ${entry.path} \u2192 ${absolutePath}`);
1494
+ if ((0, import_node_fs5.existsSync)(absolutePath)) {
1495
+ const packageSchemas = await (0, import_omnify_core5.loadSchemas)(absolutePath, { skipPartialResolution: true });
1496
+ const count = Object.keys(packageSchemas).filter((k) => !k.startsWith("__partial__")).length;
1497
+ const partialCount = Object.keys(packageSchemas).filter((k) => k.startsWith("__partial__")).length;
1498
+ logger.info(` \u2022 ${entry.path}: ${count} schema(s)${partialCount > 0 ? ` + ${partialCount} partial(s)` : ""}`);
1488
1499
  schemas = { ...packageSchemas, ...schemas };
1500
+ hasPackageSchemas = true;
1489
1501
  } else {
1490
1502
  logger.warn(` \u2022 ${entry.path}: directory not found (skipped)`);
1503
+ logger.debug(` Resolved path: ${absolutePath}`);
1491
1504
  }
1492
1505
  }
1493
1506
  }
1507
+ if (hasPackageSchemas) {
1508
+ schemas = (0, import_omnify_core5.mergePartialSchemas)(schemas);
1509
+ }
1494
1510
  const schemaCount = Object.keys(schemas).length;
1495
1511
  if (schemaCount === 0) {
1496
1512
  logger.warn("No schema files found");