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