@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.js CHANGED
@@ -873,6 +873,7 @@ import { existsSync as existsSync5, mkdirSync as mkdirSync3, writeFileSync as wr
873
873
  import { resolve as resolve7, dirname as dirname5, relative } from "path";
874
874
  import {
875
875
  loadSchemas as loadSchemas3,
876
+ mergePartialSchemas,
876
877
  validateSchemas as validateSchemas3,
877
878
  OmnifyError as OmnifyError4,
878
879
  PluginManager,
@@ -1023,15 +1024,22 @@ function generateAIGuides(rootDir, _plugins) {
1023
1024
  // src/commands/generate.ts
1024
1025
  async function loadRegisteredSchemaPaths(rootDir) {
1025
1026
  const schemaPathsFile = resolve7(rootDir, "storage/omnify/schema-paths.json");
1027
+ logger.debug(`Checking for registered schema paths at: ${schemaPathsFile}`);
1026
1028
  if (!existsSync5(schemaPathsFile)) {
1029
+ logger.debug("No registered schema paths file found");
1027
1030
  return [];
1028
1031
  }
1029
1032
  try {
1030
1033
  const content = readFileSync3(schemaPathsFile, "utf-8");
1031
1034
  const data = JSON.parse(content);
1032
- return data.paths ?? [];
1033
- } catch {
1034
- logger.debug("Could not read registered schema paths file");
1035
+ if (!data.paths || data.paths.length === 0) {
1036
+ logger.debug("No paths defined in schema-paths.json");
1037
+ return [];
1038
+ }
1039
+ logger.debug(`Found ${data.paths.length} registered schema path(s) in schema-paths.json`);
1040
+ return data.paths;
1041
+ } catch (error) {
1042
+ logger.warn(`Could not read schema-paths.json: ${error.message}`);
1035
1043
  return [];
1036
1044
  }
1037
1045
  }
@@ -1470,19 +1478,28 @@ async function runGenerate(options) {
1470
1478
  let schemas = await loadSchemas3(schemaPath);
1471
1479
  logger.debug(`Found ${Object.keys(schemas).length} schema(s) in main directory`);
1472
1480
  const additionalPaths = await loadRegisteredSchemaPaths(rootDir);
1481
+ let hasPackageSchemas = false;
1473
1482
  if (additionalPaths.length > 0) {
1474
1483
  logger.step(`Loading schemas from ${additionalPaths.length} registered path(s)`);
1475
1484
  for (const entry of additionalPaths) {
1476
- if (existsSync5(entry.path)) {
1477
- const packageSchemas = await loadSchemas3(entry.path);
1478
- const count = Object.keys(packageSchemas).length;
1479
- logger.debug(` \u2022 ${entry.path}: ${count} schema(s)`);
1485
+ const absolutePath = resolve7(rootDir, entry.path);
1486
+ logger.debug(` Checking: ${entry.path} \u2192 ${absolutePath}`);
1487
+ if (existsSync5(absolutePath)) {
1488
+ const packageSchemas = await loadSchemas3(absolutePath, { skipPartialResolution: true });
1489
+ const count = Object.keys(packageSchemas).filter((k) => !k.startsWith("__partial__")).length;
1490
+ const partialCount = Object.keys(packageSchemas).filter((k) => k.startsWith("__partial__")).length;
1491
+ logger.info(` \u2022 ${entry.path}: ${count} schema(s)${partialCount > 0 ? ` + ${partialCount} partial(s)` : ""}`);
1480
1492
  schemas = { ...packageSchemas, ...schemas };
1493
+ hasPackageSchemas = true;
1481
1494
  } else {
1482
1495
  logger.warn(` \u2022 ${entry.path}: directory not found (skipped)`);
1496
+ logger.debug(` Resolved path: ${absolutePath}`);
1483
1497
  }
1484
1498
  }
1485
1499
  }
1500
+ if (hasPackageSchemas) {
1501
+ schemas = mergePartialSchemas(schemas);
1502
+ }
1486
1503
  const schemaCount = Object.keys(schemas).length;
1487
1504
  if (schemaCount === 0) {
1488
1505
  logger.warn("No schema files found");