@famgia/omnify-cli 0.0.162 → 0.0.164

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 CHANGED
@@ -7,8 +7,8 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
7
7
  });
8
8
 
9
9
  // src/cli.ts
10
- import { existsSync as existsSync12 } from "fs";
11
- import { resolve as resolve12 } from "path";
10
+ import { existsSync as existsSync13 } from "fs";
11
+ import { resolve as resolve13 } from "path";
12
12
  import { Command } from "commander";
13
13
  import { OmnifyError as OmnifyError7 } from "@famgia/omnify-core";
14
14
 
@@ -552,15 +552,109 @@ function registerInitCommand(program2) {
552
552
  }
553
553
 
554
554
  // src/commands/validate.ts
555
- import { existsSync as existsSync4 } from "fs";
556
- import { resolve as resolve4, dirname as dirname2 } from "path";
555
+ import { existsSync as existsSync5 } from "fs";
556
+ import { resolve as resolve5, dirname as dirname3 } from "path";
557
557
  import { loadSchemas, mergePartialSchemas, validateSchemas, OmnifyError as OmnifyError2 } from "@famgia/omnify-core";
558
558
 
559
559
  // src/config/loader.ts
560
- import { existsSync as existsSync3 } from "fs";
561
- import { resolve as resolve3, dirname } from "path";
560
+ import { existsSync as existsSync4 } from "fs";
561
+ import { resolve as resolve4, dirname as dirname2 } from "path";
562
562
  import { createJiti } from "jiti";
563
563
  import { configError, configNotFoundError } from "@famgia/omnify-core";
564
+
565
+ // src/config/discovery.ts
566
+ import { existsSync as existsSync3, readFileSync as readFileSync2 } from "fs";
567
+ import { resolve as resolve3 } from "path";
568
+ var MANIFEST_FILENAME = ".omnify-packages.json";
569
+ var MANIFEST_VERSION = 1;
570
+ function loadPackageManifest(projectRoot) {
571
+ const manifestPath = resolve3(projectRoot, MANIFEST_FILENAME);
572
+ if (!existsSync3(manifestPath)) {
573
+ logger.debug(`Package manifest not found: ${manifestPath}`);
574
+ return null;
575
+ }
576
+ try {
577
+ const content = readFileSync2(manifestPath, "utf-8");
578
+ const manifest = JSON.parse(content);
579
+ if (manifest.version !== MANIFEST_VERSION) {
580
+ logger.warn(
581
+ `Package manifest version mismatch: expected ${MANIFEST_VERSION}, got ${manifest.version}. Run \`composer dump-autoload\` to regenerate.`
582
+ );
583
+ }
584
+ return manifest;
585
+ } catch (error) {
586
+ const message = error instanceof Error ? error.message : String(error);
587
+ logger.warn(`Failed to read package manifest: ${message}`);
588
+ return null;
589
+ }
590
+ }
591
+ function packageConfigToSchemaPath(packageName, config) {
592
+ const result = {
593
+ path: config.schemas,
594
+ namespace: config.namespace
595
+ };
596
+ if (config.options) {
597
+ const opts = config.options;
598
+ const basePath = config.schemas.replace(/\/database\/schemas\/?$/, "");
599
+ const laravelOutput = {
600
+ base: basePath
601
+ };
602
+ if (opts.modelNamespace) {
603
+ laravelOutput.modelsNamespace = opts.modelNamespace;
604
+ }
605
+ if (opts.migrationsPath) {
606
+ laravelOutput.migrationsPath = opts.migrationsPath.replace(basePath + "/", "");
607
+ }
608
+ if (opts.factoriesPath) {
609
+ laravelOutput.factoriesPath = opts.factoriesPath.replace(basePath + "/", "");
610
+ }
611
+ if (opts.generateServiceProvider !== void 0) {
612
+ laravelOutput.generateServiceProvider = opts.generateServiceProvider;
613
+ }
614
+ if (opts.generateMigrations !== void 0) {
615
+ laravelOutput.generateMigrations = opts.generateMigrations;
616
+ }
617
+ if (opts.generateModels !== void 0) {
618
+ laravelOutput.generateModels = opts.generateModels;
619
+ }
620
+ result.output = { laravel: laravelOutput };
621
+ }
622
+ return result;
623
+ }
624
+ function discoverPackages(projectRoot, discoveryConfig, explicitPaths) {
625
+ const result = [];
626
+ const excludeSet = new Set(discoveryConfig.exclude ?? []);
627
+ if (discoveryConfig.enabled !== false) {
628
+ const manifest = loadPackageManifest(projectRoot);
629
+ if (manifest) {
630
+ const sortedPackages = Object.entries(manifest.packages).sort(
631
+ ([, a], [, b]) => (a.priority ?? 100) - (b.priority ?? 100)
632
+ );
633
+ for (const [packageName, config] of sortedPackages) {
634
+ if (excludeSet.has(packageName)) {
635
+ logger.debug(`Skipping excluded package: ${packageName}`);
636
+ continue;
637
+ }
638
+ const schemasPath = resolve3(projectRoot, config.schemas);
639
+ if (!existsSync3(schemasPath)) {
640
+ logger.debug(`Package schemas not found, skipping: ${schemasPath}`);
641
+ continue;
642
+ }
643
+ result.push(packageConfigToSchemaPath(packageName, config));
644
+ logger.debug(`Discovered package: ${packageName} (${config.namespace ?? "no namespace"})`);
645
+ }
646
+ if (result.length > 0) {
647
+ logger.info(`Auto-discovered ${result.length} package(s) from ${MANIFEST_FILENAME}`);
648
+ }
649
+ }
650
+ }
651
+ if (explicitPaths?.length) {
652
+ result.push(...explicitPaths);
653
+ }
654
+ return result;
655
+ }
656
+
657
+ // src/config/loader.ts
564
658
  var CONFIG_FILES = [
565
659
  "omnify.config.ts",
566
660
  "omnify.config.js",
@@ -568,10 +662,10 @@ var CONFIG_FILES = [
568
662
  "omnify.config.cjs"
569
663
  ];
570
664
  function findConfigFile(startDir) {
571
- const cwd = resolve3(startDir);
665
+ const cwd = resolve4(startDir);
572
666
  for (const filename of CONFIG_FILES) {
573
- const configPath2 = resolve3(cwd, filename);
574
- if (existsSync3(configPath2)) {
667
+ const configPath2 = resolve4(cwd, filename);
668
+ if (existsSync4(configPath2)) {
575
669
  return configPath2;
576
670
  }
577
671
  }
@@ -602,7 +696,7 @@ async function resolvePlugins(plugins, configPath2) {
602
696
  return [];
603
697
  }
604
698
  const resolved = [];
605
- const configDir = configPath2 ? dirname(configPath2) : process.cwd();
699
+ const configDir = configPath2 ? dirname2(configPath2) : process.cwd();
606
700
  for (const plugin of plugins) {
607
701
  if (typeof plugin === "string") {
608
702
  const jiti = createJiti(configDir, {
@@ -628,6 +722,16 @@ async function resolvePlugins(plugins, configPath2) {
628
722
  }
629
723
  async function resolveConfig(userConfig, configPath2) {
630
724
  const plugins = await resolvePlugins(userConfig.plugins, configPath2);
725
+ const projectRoot = configPath2 ? dirname2(configPath2) : process.cwd();
726
+ const discovery = {
727
+ enabled: userConfig.discovery?.enabled ?? true,
728
+ exclude: userConfig.discovery?.exclude
729
+ };
730
+ const allSchemaPaths = discoverPackages(
731
+ projectRoot,
732
+ discovery,
733
+ userConfig.additionalSchemaPaths
734
+ );
631
735
  const databaseConfig = {
632
736
  driver: userConfig.database.driver,
633
737
  enableFieldComments: userConfig.database.enableFieldComments ?? false
@@ -656,8 +760,9 @@ async function resolveConfig(userConfig, configPath2) {
656
760
  plugins,
657
761
  verbose: userConfig.verbose ?? false,
658
762
  lockFilePath: userConfig.lockFilePath ?? ".omnify.lock",
763
+ discovery,
659
764
  ...userConfig.locale && { locale: userConfig.locale },
660
- ...userConfig.additionalSchemaPaths && { additionalSchemaPaths: userConfig.additionalSchemaPaths }
765
+ ...allSchemaPaths.length > 0 && { additionalSchemaPaths: allSchemaPaths }
661
766
  };
662
767
  return result;
663
768
  }
@@ -687,8 +792,8 @@ function buildLaravelConfig(base, userLaravel) {
687
792
  return config;
688
793
  }
689
794
  function validateConfig(config, rootDir) {
690
- const schemaPath = resolve3(rootDir, config.schemasDir);
691
- if (!existsSync3(schemaPath)) {
795
+ const schemaPath = resolve4(rootDir, config.schemasDir);
796
+ if (!existsSync4(schemaPath)) {
692
797
  throw configError(
693
798
  `Schema directory not found: ${schemaPath}. Create the '${config.schemasDir}' directory or update schemasDir in config.`,
694
799
  "E002"
@@ -704,7 +809,7 @@ function requireDevUrl(config) {
704
809
  }
705
810
  }
706
811
  async function loadConfig(startDir = process.cwd()) {
707
- const cwd = resolve3(startDir);
812
+ const cwd = resolve4(startDir);
708
813
  const configPath2 = findConfigFile(cwd);
709
814
  if (configPath2) {
710
815
  const userConfig = await loadConfigFile(configPath2);
@@ -714,7 +819,7 @@ async function loadConfig(startDir = process.cwd()) {
714
819
  configPath: configPath2
715
820
  };
716
821
  }
717
- throw configNotFoundError(resolve3(cwd, "omnify.config.ts"));
822
+ throw configNotFoundError(resolve4(cwd, "omnify.config.ts"));
718
823
  }
719
824
 
720
825
  // src/commands/validate.ts
@@ -725,9 +830,9 @@ async function runValidate(options) {
725
830
  logger.timing("Config load start");
726
831
  const { config, configPath: configPath2 } = await loadConfig();
727
832
  logger.timing("Config loaded");
728
- const rootDir = configPath2 ? dirname2(configPath2) : process.cwd();
833
+ const rootDir = configPath2 ? dirname3(configPath2) : process.cwd();
729
834
  validateConfig(config, rootDir);
730
- const schemaPath = resolve4(rootDir, config.schemasDir);
835
+ const schemaPath = resolve5(rootDir, config.schemasDir);
731
836
  logger.step(`Loading schemas from ${schemaPath}`);
732
837
  logger.timing("Schema load start");
733
838
  let schemas = await loadSchemas(schemaPath);
@@ -737,9 +842,9 @@ async function runValidate(options) {
737
842
  if (additionalPaths.length > 0) {
738
843
  logger.step(`Loading schemas from ${additionalPaths.length} additional path(s)`);
739
844
  for (const entry of additionalPaths) {
740
- const absolutePath = resolve4(rootDir, entry.path);
845
+ const absolutePath = resolve5(rootDir, entry.path);
741
846
  logger.debug(` Checking: ${entry.path} \u2192 ${absolutePath}`);
742
- if (existsSync4(absolutePath)) {
847
+ if (existsSync5(absolutePath)) {
743
848
  const packageSchemas = await loadSchemas(absolutePath, { skipPartialResolution: true });
744
849
  const count = Object.keys(packageSchemas).filter((k) => !k.startsWith("__partial__")).length;
745
850
  const partialCount = Object.keys(packageSchemas).filter((k) => k.startsWith("__partial__")).length;
@@ -797,8 +902,8 @@ function registerValidateCommand(program2) {
797
902
  }
798
903
 
799
904
  // src/commands/diff.ts
800
- import { existsSync as existsSync5 } from "fs";
801
- import { resolve as resolve5, dirname as dirname3 } from "path";
905
+ import { existsSync as existsSync6 } from "fs";
906
+ import { resolve as resolve6, dirname as dirname4 } from "path";
802
907
  import { loadSchemas as loadSchemas2, mergePartialSchemas as mergePartialSchemas2, validateSchemas as validateSchemas2, OmnifyError as OmnifyError3 } from "@famgia/omnify-core";
803
908
 
804
909
  // src/operations/diff.ts
@@ -833,10 +938,10 @@ async function runDiff(options) {
833
938
  logger.header("Checking for Schema Changes");
834
939
  logger.debug("Loading configuration...");
835
940
  const { config, configPath: configPath2 } = await loadConfig();
836
- const rootDir = configPath2 ? dirname3(configPath2) : process.cwd();
941
+ const rootDir = configPath2 ? dirname4(configPath2) : process.cwd();
837
942
  validateConfig(config, rootDir);
838
943
  requireDevUrl(config);
839
- const schemaPath = resolve5(rootDir, config.schemasDir);
944
+ const schemaPath = resolve6(rootDir, config.schemasDir);
840
945
  logger.step(`Loading schemas from ${schemaPath}`);
841
946
  let schemas = await loadSchemas2(schemaPath);
842
947
  logger.debug(`Found ${Object.keys(schemas).length} schema(s) in main directory`);
@@ -845,9 +950,9 @@ async function runDiff(options) {
845
950
  if (additionalPaths.length > 0) {
846
951
  logger.step(`Loading schemas from ${additionalPaths.length} additional path(s)`);
847
952
  for (const entry of additionalPaths) {
848
- const absolutePath = resolve5(rootDir, entry.path);
953
+ const absolutePath = resolve6(rootDir, entry.path);
849
954
  logger.debug(` Checking: ${entry.path} \u2192 ${absolutePath}`);
850
- if (existsSync5(absolutePath)) {
955
+ if (existsSync6(absolutePath)) {
851
956
  const packageSchemas = await loadSchemas2(absolutePath, { skipPartialResolution: true });
852
957
  const count = Object.keys(packageSchemas).filter((k) => !k.startsWith("__partial__")).length;
853
958
  const partialCount = Object.keys(packageSchemas).filter((k) => k.startsWith("__partial__")).length;
@@ -880,7 +985,7 @@ async function runDiff(options) {
880
985
  process.exit(2);
881
986
  }
882
987
  logger.step("Running Atlas diff...");
883
- const lockPath = resolve5(rootDir, config.lockFilePath);
988
+ const lockPath = resolve6(rootDir, config.lockFilePath);
884
989
  const diffResult = await runDiffOperation({
885
990
  schemas,
886
991
  devUrl: config.database.devUrl,
@@ -926,8 +1031,8 @@ function registerDiffCommand(program2) {
926
1031
  }
927
1032
 
928
1033
  // src/commands/generate.ts
929
- import { existsSync as existsSync7, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4, readdirSync as readdirSync2 } from "fs";
930
- import { resolve as resolve7, dirname as dirname5, relative } from "path";
1034
+ import { existsSync as existsSync8, mkdirSync as mkdirSync3, writeFileSync as writeFileSync4, readdirSync as readdirSync2 } from "fs";
1035
+ import { resolve as resolve8, dirname as dirname6, relative } from "path";
931
1036
  import {
932
1037
  loadSchemas as loadSchemas3,
933
1038
  mergePartialSchemas as mergePartialSchemas3,
@@ -960,8 +1065,8 @@ import {
960
1065
  import { generateTypeScript, copyStubs, generateAIGuides as generateTypescriptAIGuides, shouldGenerateAIGuides as shouldGenerateTypescriptAIGuides } from "@famgia/omnify-typescript";
961
1066
 
962
1067
  // src/guides/index.ts
963
- import { existsSync as existsSync6, writeFileSync as writeFileSync3, mkdirSync as mkdirSync2, readdirSync, readFileSync as readFileSync2 } from "fs";
964
- import { resolve as resolve6, dirname as dirname4, join } from "path";
1068
+ import { existsSync as existsSync7, writeFileSync as writeFileSync3, mkdirSync as mkdirSync2, readdirSync, readFileSync as readFileSync3 } from "fs";
1069
+ import { resolve as resolve7, dirname as dirname5, join } from "path";
965
1070
  import "url";
966
1071
  var CLAUDE_MD = `# Omnify Project
967
1072
 
@@ -1018,35 +1123,35 @@ Add your personal preferences in \`CLAUDE.local.md\` (gitignored).
1018
1123
  function copyOmnifyGuides(rootDir) {
1019
1124
  let filesWritten = 0;
1020
1125
  const omnifyPkgPaths = [
1021
- resolve6(rootDir, "node_modules", "@famgia", "omnify", "stubs", "ai-guides", "omnify"),
1022
- resolve6(rootDir, "node_modules", ".pnpm", "@famgia+omnify@*", "node_modules", "@famgia", "omnify", "stubs", "ai-guides", "omnify")
1126
+ resolve7(rootDir, "node_modules", "@famgia", "omnify", "stubs", "ai-guides", "omnify"),
1127
+ resolve7(rootDir, "node_modules", ".pnpm", "@famgia+omnify@*", "node_modules", "@famgia", "omnify", "stubs", "ai-guides", "omnify")
1023
1128
  ];
1024
1129
  let stubsDir = null;
1025
1130
  for (const pkgPath of omnifyPkgPaths) {
1026
1131
  if (pkgPath.includes("*")) {
1027
- const parentDir = dirname4(dirname4(pkgPath));
1028
- if (existsSync6(parentDir)) {
1132
+ const parentDir = dirname5(dirname5(pkgPath));
1133
+ if (existsSync7(parentDir)) {
1029
1134
  const entries = readdirSync(parentDir);
1030
1135
  for (const entry of entries) {
1031
1136
  if (entry.startsWith("@famgia+omnify@")) {
1032
1137
  const testPath = join(parentDir, entry, "node_modules", "@famgia", "omnify", "stubs", "ai-guides", "omnify");
1033
- if (existsSync6(testPath)) {
1138
+ if (existsSync7(testPath)) {
1034
1139
  stubsDir = testPath;
1035
1140
  break;
1036
1141
  }
1037
1142
  }
1038
1143
  }
1039
1144
  }
1040
- } else if (existsSync6(pkgPath)) {
1145
+ } else if (existsSync7(pkgPath)) {
1041
1146
  stubsDir = pkgPath;
1042
1147
  break;
1043
1148
  }
1044
1149
  }
1045
1150
  if (!stubsDir) {
1046
1151
  try {
1047
- const omnifyPath = dirname4(__require.resolve("@famgia/omnify/package.json", { paths: [rootDir] }));
1152
+ const omnifyPath = dirname5(__require.resolve("@famgia/omnify/package.json", { paths: [rootDir] }));
1048
1153
  const testPath = join(omnifyPath, "stubs", "ai-guides", "omnify");
1049
- if (existsSync6(testPath)) {
1154
+ if (existsSync7(testPath)) {
1050
1155
  stubsDir = testPath;
1051
1156
  }
1052
1157
  } catch {
@@ -1055,13 +1160,13 @@ function copyOmnifyGuides(rootDir) {
1055
1160
  if (!stubsDir) {
1056
1161
  return 0;
1057
1162
  }
1058
- const destDir = resolve6(rootDir, ".claude", "omnify", "guides", "omnify");
1163
+ const destDir = resolve7(rootDir, ".claude", "omnify", "guides", "omnify");
1059
1164
  mkdirSync2(destDir, { recursive: true });
1060
1165
  const files = readdirSync(stubsDir).filter((f) => f.endsWith(".stub"));
1061
1166
  for (const file of files) {
1062
1167
  const srcPath = join(stubsDir, file);
1063
1168
  const destPath = join(destDir, file.replace(".stub", ""));
1064
- const content = readFileSync2(srcPath, "utf8");
1169
+ const content = readFileSync3(srcPath, "utf8");
1065
1170
  writeFileSync3(destPath, content);
1066
1171
  filesWritten++;
1067
1172
  }
@@ -1069,8 +1174,8 @@ function copyOmnifyGuides(rootDir) {
1069
1174
  }
1070
1175
  function generateAIGuides(rootDir, _plugins) {
1071
1176
  let filesWritten = 0;
1072
- const claudeMdPath = resolve6(rootDir, "CLAUDE.md");
1073
- if (!existsSync6(claudeMdPath)) {
1177
+ const claudeMdPath = resolve7(rootDir, "CLAUDE.md");
1178
+ if (!existsSync7(claudeMdPath)) {
1074
1179
  writeFileSync3(claudeMdPath, CLAUDE_MD);
1075
1180
  filesWritten++;
1076
1181
  }
@@ -1084,7 +1189,7 @@ function hasPluginGenerators(plugins) {
1084
1189
  }
1085
1190
  function getExistingMigrationTables(migrationsDir) {
1086
1191
  const existingTables = /* @__PURE__ */ new Set();
1087
- if (!existsSync7(migrationsDir)) {
1192
+ if (!existsSync8(migrationsDir)) {
1088
1193
  return existingTables;
1089
1194
  }
1090
1195
  try {
@@ -1277,13 +1382,13 @@ function schemaChangeToVersionChange(change) {
1277
1382
  function writeGeneratorOutputs(outputs, rootDir) {
1278
1383
  const counts = { migrations: 0, types: 0, models: 0, factories: 0, other: 0 };
1279
1384
  for (const output of outputs) {
1280
- const filePath = resolve7(rootDir, output.path);
1281
- const dir = dirname5(filePath);
1282
- if (!existsSync7(dir)) {
1385
+ const filePath = resolve8(rootDir, output.path);
1386
+ const dir = dirname6(filePath);
1387
+ if (!existsSync8(dir)) {
1283
1388
  mkdirSync3(dir, { recursive: true });
1284
1389
  logger.debug(`Created directory: ${dir}`);
1285
1390
  }
1286
- if (output.skipIfExists && existsSync7(filePath)) {
1391
+ if (output.skipIfExists && existsSync8(filePath)) {
1287
1392
  logger.debug(`Skipped (exists): ${output.path}`);
1288
1393
  continue;
1289
1394
  }
@@ -1343,8 +1448,8 @@ function runDirectGeneration(schemas, config, rootDir, options, changes) {
1343
1448
  }
1344
1449
  if (!options.typesOnly && config.output.laravel) {
1345
1450
  logger.step("Generating Laravel migrations...");
1346
- const migrationsDir = resolve7(rootDir, config.output.laravel.migrationsPath);
1347
- if (!existsSync7(migrationsDir)) {
1451
+ const migrationsDir = resolve8(rootDir, config.output.laravel.migrationsPath);
1452
+ if (!existsSync8(migrationsDir)) {
1348
1453
  mkdirSync3(migrationsDir, { recursive: true });
1349
1454
  logger.debug(`Created directory: ${migrationsDir}`);
1350
1455
  }
@@ -1366,7 +1471,7 @@ function runDirectGeneration(schemas, config, rootDir, options, changes) {
1366
1471
  logger.debug(`Skipped CREATE for ${tableName} (already exists)`);
1367
1472
  continue;
1368
1473
  }
1369
- const filePath = resolve7(migrationsDir, migration.fileName);
1474
+ const filePath = resolve8(migrationsDir, migration.fileName);
1370
1475
  writeFileSync4(filePath, migration.content);
1371
1476
  logger.debug(`Created: ${migration.fileName}`);
1372
1477
  migrationsGenerated++;
@@ -1375,7 +1480,7 @@ function runDirectGeneration(schemas, config, rootDir, options, changes) {
1375
1480
  if (alterChanges.length > 0) {
1376
1481
  const alterMigrations = generateMigrationsFromChanges(alterChanges);
1377
1482
  for (const migration of alterMigrations) {
1378
- const filePath = resolve7(migrationsDir, migration.fileName);
1483
+ const filePath = resolve8(migrationsDir, migration.fileName);
1379
1484
  writeFileSync4(filePath, migration.content);
1380
1485
  logger.debug(`Created: ${migration.fileName}`);
1381
1486
  migrationsGenerated++;
@@ -1387,12 +1492,12 @@ function runDirectGeneration(schemas, config, rootDir, options, changes) {
1387
1492
  logger.step("Generating Laravel models...");
1388
1493
  const modelsPath = config.output.laravel.modelsPath;
1389
1494
  const baseModelsPath = config.output.laravel.baseModelsPath ?? `${modelsPath}/OmnifyBase`;
1390
- const modelsDir = resolve7(rootDir, modelsPath);
1391
- const baseModelsDir = resolve7(rootDir, baseModelsPath);
1392
- if (!existsSync7(modelsDir)) {
1495
+ const modelsDir = resolve8(rootDir, modelsPath);
1496
+ const baseModelsDir = resolve8(rootDir, baseModelsPath);
1497
+ if (!existsSync8(modelsDir)) {
1393
1498
  mkdirSync3(modelsDir, { recursive: true });
1394
1499
  }
1395
- if (!existsSync7(baseModelsDir)) {
1500
+ if (!existsSync8(baseModelsDir)) {
1396
1501
  mkdirSync3(baseModelsDir, { recursive: true });
1397
1502
  }
1398
1503
  const providersPath = config.output.laravel.providersPath ?? "app/Providers";
@@ -1403,12 +1508,12 @@ function runDirectGeneration(schemas, config, rootDir, options, changes) {
1403
1508
  customTypes: customTypesMap
1404
1509
  });
1405
1510
  for (const model of models) {
1406
- const filePath = resolve7(rootDir, getModelPath(model));
1407
- const fileDir = dirname5(filePath);
1408
- if (!existsSync7(fileDir)) {
1511
+ const filePath = resolve8(rootDir, getModelPath(model));
1512
+ const fileDir = dirname6(filePath);
1513
+ if (!existsSync8(fileDir)) {
1409
1514
  mkdirSync3(fileDir, { recursive: true });
1410
1515
  }
1411
- if (!model.overwrite && existsSync7(filePath)) {
1516
+ if (!model.overwrite && existsSync8(filePath)) {
1412
1517
  logger.debug(`Skipped (exists): ${getModelPath(model)}`);
1413
1518
  continue;
1414
1519
  }
@@ -1421,20 +1526,20 @@ function runDirectGeneration(schemas, config, rootDir, options, changes) {
1421
1526
  if (!options.typesOnly && config.output.laravel?.factoriesPath) {
1422
1527
  logger.step("Generating Laravel factories...");
1423
1528
  const factoriesPath = config.output.laravel.factoriesPath;
1424
- const factoriesDir = resolve7(rootDir, factoriesPath);
1425
- if (!existsSync7(factoriesDir)) {
1529
+ const factoriesDir = resolve8(rootDir, factoriesPath);
1530
+ if (!existsSync8(factoriesDir)) {
1426
1531
  mkdirSync3(factoriesDir, { recursive: true });
1427
1532
  }
1428
1533
  const factories = generateFactories(schemas, {
1429
1534
  factoryPath: factoriesPath
1430
1535
  });
1431
1536
  for (const factory of factories) {
1432
- const filePath = resolve7(rootDir, getFactoryPath(factory));
1433
- const fileDir = dirname5(filePath);
1434
- if (!existsSync7(fileDir)) {
1537
+ const filePath = resolve8(rootDir, getFactoryPath(factory));
1538
+ const fileDir = dirname6(filePath);
1539
+ if (!existsSync8(fileDir)) {
1435
1540
  mkdirSync3(fileDir, { recursive: true });
1436
1541
  }
1437
- if (!factory.overwrite && existsSync7(filePath)) {
1542
+ if (!factory.overwrite && existsSync8(filePath)) {
1438
1543
  logger.debug(`Skipped (exists): ${getFactoryPath(factory)}`);
1439
1544
  continue;
1440
1545
  }
@@ -1447,15 +1552,15 @@ function runDirectGeneration(schemas, config, rootDir, options, changes) {
1447
1552
  if (!options.migrationsOnly && config.output.typescript) {
1448
1553
  logger.step("Generating TypeScript types...");
1449
1554
  const tsConfig = config.output.typescript;
1450
- const basePath = resolve7(rootDir, tsConfig.path);
1451
- const schemasDir = resolve7(basePath, tsConfig.schemasDir ?? "schemas");
1452
- const enumDir = resolve7(basePath, tsConfig.enumDir ?? "enum");
1555
+ const basePath = resolve8(rootDir, tsConfig.path);
1556
+ const schemasDir = resolve8(basePath, tsConfig.schemasDir ?? "schemas");
1557
+ const enumDir = resolve8(basePath, tsConfig.enumDir ?? "enum");
1453
1558
  const enumImportPrefix = relative(schemasDir, enumDir).replace(/\\/g, "/");
1454
- if (!existsSync7(schemasDir)) {
1559
+ if (!existsSync8(schemasDir)) {
1455
1560
  mkdirSync3(schemasDir, { recursive: true });
1456
1561
  logger.debug(`Created directory: ${schemasDir}`);
1457
1562
  }
1458
- if (!existsSync7(enumDir)) {
1563
+ if (!existsSync8(enumDir)) {
1459
1564
  mkdirSync3(enumDir, { recursive: true });
1460
1565
  logger.debug(`Created directory: ${enumDir}`);
1461
1566
  }
@@ -1471,12 +1576,12 @@ function runDirectGeneration(schemas, config, rootDir, options, changes) {
1471
1576
  });
1472
1577
  for (const file of typeFiles) {
1473
1578
  const outputDir = file.category === "enum" ? enumDir : schemasDir;
1474
- const filePath = resolve7(outputDir, file.filePath);
1475
- const fileDir = dirname5(filePath);
1476
- if (!existsSync7(fileDir)) {
1579
+ const filePath = resolve8(outputDir, file.filePath);
1580
+ const fileDir = dirname6(filePath);
1581
+ if (!existsSync8(fileDir)) {
1477
1582
  mkdirSync3(fileDir, { recursive: true });
1478
1583
  }
1479
- if (!file.overwrite && existsSync7(filePath)) {
1584
+ if (!file.overwrite && existsSync8(filePath)) {
1480
1585
  logger.debug(`Skipped (exists): ${file.filePath}`);
1481
1586
  continue;
1482
1587
  }
@@ -1507,9 +1612,9 @@ async function runGenerate(options) {
1507
1612
  logger.header("Generating Outputs");
1508
1613
  logger.debug("Loading configuration...");
1509
1614
  const { config, configPath: configPath2 } = await loadConfig();
1510
- const rootDir = configPath2 ? dirname5(configPath2) : process.cwd();
1615
+ const rootDir = configPath2 ? dirname6(configPath2) : process.cwd();
1511
1616
  validateConfig(config, rootDir);
1512
- const schemaPath = resolve7(rootDir, config.schemasDir);
1617
+ const schemaPath = resolve8(rootDir, config.schemasDir);
1513
1618
  logger.step(`Loading schemas from ${schemaPath}`);
1514
1619
  let schemas = await loadSchemas3(schemaPath);
1515
1620
  logger.debug(`Found ${Object.keys(schemas).length} schema(s) in main directory`);
@@ -1518,9 +1623,9 @@ async function runGenerate(options) {
1518
1623
  if (additionalPaths.length > 0) {
1519
1624
  logger.step(`Loading schemas from ${additionalPaths.length} additional path(s)`);
1520
1625
  for (const entry of additionalPaths) {
1521
- const absolutePath = resolve7(rootDir, entry.path);
1626
+ const absolutePath = resolve8(rootDir, entry.path);
1522
1627
  logger.debug(` Checking: ${entry.path} \u2192 ${absolutePath}`);
1523
- if (existsSync7(absolutePath)) {
1628
+ if (existsSync8(absolutePath)) {
1524
1629
  let packageSchemas = await loadSchemas3(absolutePath, { skipPartialResolution: true });
1525
1630
  if (entry.output) {
1526
1631
  const schemasWithOutput = {};
@@ -1575,12 +1680,12 @@ async function runGenerate(options) {
1575
1680
  process.exit(2);
1576
1681
  }
1577
1682
  logger.step("Checking for changes...");
1578
- const lockPath = resolve7(rootDir, config.lockFilePath);
1683
+ const lockPath = resolve8(rootDir, config.lockFilePath);
1579
1684
  const existingLock = await readLockFile(lockPath);
1580
1685
  const currentSnapshots = await buildSchemaSnapshots(schemas);
1581
1686
  const v2Lock = existingLock && isLockFileV2(existingLock) ? existingLock : null;
1582
1687
  const comparison = compareSchemasDeep(currentSnapshots, v2Lock);
1583
- const chainFilePath = resolve7(rootDir, VERSION_CHAIN_FILE);
1688
+ const chainFilePath = resolve8(rootDir, VERSION_CHAIN_FILE);
1584
1689
  const versionChain = await readVersionChain(chainFilePath);
1585
1690
  if (versionChain && comparison.hasChanges) {
1586
1691
  const schemaActions = [];
@@ -1617,7 +1722,7 @@ async function runGenerate(options) {
1617
1722
  }
1618
1723
  }
1619
1724
  if (existingLock && config.output.laravel?.migrationsPath) {
1620
- const migrationsDir = resolve7(rootDir, config.output.laravel.migrationsPath);
1725
+ const migrationsDir = resolve8(rootDir, config.output.laravel.migrationsPath);
1621
1726
  const migrationValidation = await validateMigrations(existingLock, migrationsDir);
1622
1727
  if (!migrationValidation.valid) {
1623
1728
  logger.newline();
@@ -1741,15 +1846,15 @@ async function runGenerate(options) {
1741
1846
  if (!options.migrationsOnly && config.output.typescript && typesGenerated === 0) {
1742
1847
  logger.step("Generating TypeScript types...");
1743
1848
  const tsConfig2 = config.output.typescript;
1744
- const basePath2 = resolve7(rootDir, tsConfig2.path);
1745
- const schemasDir2 = resolve7(basePath2, tsConfig2.schemasDir ?? "schemas");
1746
- const enumDir2 = resolve7(basePath2, tsConfig2.enumDir ?? "enum");
1849
+ const basePath2 = resolve8(rootDir, tsConfig2.path);
1850
+ const schemasDir2 = resolve8(basePath2, tsConfig2.schemasDir ?? "schemas");
1851
+ const enumDir2 = resolve8(basePath2, tsConfig2.enumDir ?? "enum");
1747
1852
  const enumImportPrefix2 = relative(schemasDir2, enumDir2).replace(/\\/g, "/");
1748
- if (!existsSync7(schemasDir2)) {
1853
+ if (!existsSync8(schemasDir2)) {
1749
1854
  mkdirSync3(schemasDir2, { recursive: true });
1750
1855
  logger.debug(`Created directory: ${schemasDir2}`);
1751
1856
  }
1752
- if (!existsSync7(enumDir2)) {
1857
+ if (!existsSync8(enumDir2)) {
1753
1858
  mkdirSync3(enumDir2, { recursive: true });
1754
1859
  logger.debug(`Created directory: ${enumDir2}`);
1755
1860
  }
@@ -1765,12 +1870,12 @@ async function runGenerate(options) {
1765
1870
  });
1766
1871
  for (const file of typeFiles) {
1767
1872
  const outputDir2 = file.category === "enum" ? enumDir2 : schemasDir2;
1768
- const filePath = resolve7(outputDir2, file.filePath);
1769
- const fileDir = dirname5(filePath);
1770
- if (!existsSync7(fileDir)) {
1873
+ const filePath = resolve8(outputDir2, file.filePath);
1874
+ const fileDir = dirname6(filePath);
1875
+ if (!existsSync8(fileDir)) {
1771
1876
  mkdirSync3(fileDir, { recursive: true });
1772
1877
  }
1773
- if (!file.overwrite && existsSync7(filePath)) {
1878
+ if (!file.overwrite && existsSync8(filePath)) {
1774
1879
  logger.debug(`Skipped (exists): ${file.filePath}`);
1775
1880
  continue;
1776
1881
  }
@@ -1873,23 +1978,23 @@ function registerGenerateCommand(program2) {
1873
1978
  }
1874
1979
 
1875
1980
  // src/commands/reset.ts
1876
- import { existsSync as existsSync8, readdirSync as readdirSync3, rmSync, statSync } from "fs";
1877
- import { resolve as resolve8, dirname as dirname6, join as join2 } from "path";
1981
+ import { existsSync as existsSync9, readdirSync as readdirSync3, rmSync, statSync } from "fs";
1982
+ import { resolve as resolve9, dirname as dirname7, join as join2 } from "path";
1878
1983
  import { createInterface } from "readline";
1879
1984
  async function confirm2(message) {
1880
1985
  const rl = createInterface({
1881
1986
  input: process.stdin,
1882
1987
  output: process.stdout
1883
1988
  });
1884
- return new Promise((resolve13) => {
1989
+ return new Promise((resolve14) => {
1885
1990
  rl.question(`${message} (y/N) `, (answer) => {
1886
1991
  rl.close();
1887
- resolve13(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
1992
+ resolve14(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
1888
1993
  });
1889
1994
  });
1890
1995
  }
1891
1996
  function countFiles(dir) {
1892
- if (!existsSync8(dir)) return 0;
1997
+ if (!existsSync9(dir)) return 0;
1893
1998
  let count = 0;
1894
1999
  const entries = readdirSync3(dir);
1895
2000
  for (const entry of entries) {
@@ -1904,7 +2009,7 @@ function countFiles(dir) {
1904
2009
  return count;
1905
2010
  }
1906
2011
  function deleteDir(dir, verbose) {
1907
- if (!existsSync8(dir)) return 0;
2012
+ if (!existsSync9(dir)) return 0;
1908
2013
  const count = countFiles(dir);
1909
2014
  rmSync(dir, { recursive: true, force: true });
1910
2015
  if (verbose) {
@@ -1913,7 +2018,7 @@ function deleteDir(dir, verbose) {
1913
2018
  return count;
1914
2019
  }
1915
2020
  function deleteFilesInDir(dir, pattern, verbose) {
1916
- if (!existsSync8(dir)) return 0;
2021
+ if (!existsSync9(dir)) return 0;
1917
2022
  let count = 0;
1918
2023
  const entries = readdirSync3(dir);
1919
2024
  for (const entry of entries) {
@@ -1934,7 +2039,7 @@ async function runReset(options) {
1934
2039
  logger.header("Reset Omnify Generated Files");
1935
2040
  logger.debug("Loading configuration...");
1936
2041
  const { config, configPath: configPath2 } = await loadConfig();
1937
- const rootDir = configPath2 ? dirname6(configPath2) : process.cwd();
2042
+ const rootDir = configPath2 ? dirname7(configPath2) : process.cwd();
1938
2043
  const paths = [];
1939
2044
  const omnifyBasePaths = [
1940
2045
  { name: "OmnifyBase models", paths: ["app/Models/OmnifyBase", "backend/app/Models/OmnifyBase"] },
@@ -1948,8 +2053,8 @@ async function runReset(options) {
1948
2053
  ];
1949
2054
  for (const { name, paths: relPaths } of omnifyBasePaths) {
1950
2055
  for (const relPath of relPaths) {
1951
- const omnifyBasePath = resolve8(rootDir, relPath);
1952
- if (existsSync8(omnifyBasePath)) {
2056
+ const omnifyBasePath = resolve9(rootDir, relPath);
2057
+ if (existsSync9(omnifyBasePath)) {
1953
2058
  paths.push({ name, path: omnifyBasePath, type: "dir" });
1954
2059
  break;
1955
2060
  }
@@ -1957,8 +2062,8 @@ async function runReset(options) {
1957
2062
  }
1958
2063
  for (const { name, paths: relPaths } of legacyGeneratedPaths) {
1959
2064
  for (const relPath of relPaths) {
1960
- const legacyPath = resolve8(rootDir, relPath);
1961
- if (existsSync8(legacyPath)) {
2065
+ const legacyPath = resolve9(rootDir, relPath);
2066
+ if (existsSync9(legacyPath)) {
1962
2067
  paths.push({ name, path: legacyPath, type: "dir" });
1963
2068
  break;
1964
2069
  }
@@ -1969,8 +2074,8 @@ async function runReset(options) {
1969
2074
  "backend/database/migrations/omnify"
1970
2075
  ];
1971
2076
  for (const relPath of migrationPaths) {
1972
- const migrationsPath = resolve8(rootDir, relPath);
1973
- if (existsSync8(migrationsPath)) {
2077
+ const migrationsPath = resolve9(rootDir, relPath);
2078
+ if (existsSync9(migrationsPath)) {
1974
2079
  paths.push({
1975
2080
  name: "Omnify migrations",
1976
2081
  path: migrationsPath,
@@ -1982,15 +2087,15 @@ async function runReset(options) {
1982
2087
  }
1983
2088
  const laravelConfig = config.output.laravel;
1984
2089
  if (laravelConfig?.modelsPath) {
1985
- const modelsPath = resolve8(rootDir, laravelConfig.modelsPath);
2090
+ const modelsPath = resolve9(rootDir, laravelConfig.modelsPath);
1986
2091
  const omnifyBasePath = join2(modelsPath, "OmnifyBase");
1987
- if (existsSync8(omnifyBasePath) && !paths.some((p) => p.path === omnifyBasePath)) {
2092
+ if (existsSync9(omnifyBasePath) && !paths.some((p) => p.path === omnifyBasePath)) {
1988
2093
  paths.push({ name: "OmnifyBase models", path: omnifyBasePath, type: "dir" });
1989
2094
  }
1990
2095
  }
1991
2096
  if (laravelConfig?.migrationsPath) {
1992
- const migrationsPath = resolve8(rootDir, laravelConfig.migrationsPath);
1993
- if (existsSync8(migrationsPath) && !paths.some((p) => p.path === migrationsPath)) {
2097
+ const migrationsPath = resolve9(rootDir, laravelConfig.migrationsPath);
2098
+ if (existsSync9(migrationsPath) && !paths.some((p) => p.path === migrationsPath)) {
1994
2099
  paths.push({
1995
2100
  name: "Omnify migrations",
1996
2101
  path: migrationsPath,
@@ -2003,18 +2108,18 @@ async function runReset(options) {
2003
2108
  for (const additionalPath of config.additionalSchemaPaths) {
2004
2109
  const pkgOutput = additionalPath.output?.laravel;
2005
2110
  if (pkgOutput?.base) {
2006
- const pkgBase = resolve8(rootDir, pkgOutput.base);
2111
+ const pkgBase = resolve9(rootDir, pkgOutput.base);
2007
2112
  const pkgName = additionalPath.namespace ?? "Package";
2008
2113
  const pkgOmnifyBase = join2(pkgBase, pkgOutput.baseModelsPath ?? "src/Models/OmnifyBase");
2009
- if (existsSync8(pkgOmnifyBase) && !paths.some((p) => p.path === pkgOmnifyBase)) {
2114
+ if (existsSync9(pkgOmnifyBase) && !paths.some((p) => p.path === pkgOmnifyBase)) {
2010
2115
  paths.push({ name: `${pkgName} OmnifyBase`, path: pkgOmnifyBase, type: "dir" });
2011
2116
  }
2012
2117
  const pkgGenerated = join2(pkgBase, "src/Models/Generated");
2013
- if (existsSync8(pkgGenerated) && !paths.some((p) => p.path === pkgGenerated)) {
2118
+ if (existsSync9(pkgGenerated) && !paths.some((p) => p.path === pkgGenerated)) {
2014
2119
  paths.push({ name: `${pkgName} Legacy Generated`, path: pkgGenerated, type: "dir" });
2015
2120
  }
2016
2121
  const pkgMigrations = join2(pkgBase, pkgOutput.migrationsPath ?? "database/migrations");
2017
- if (existsSync8(pkgMigrations) && !paths.some((p) => p.path === pkgMigrations)) {
2122
+ if (existsSync9(pkgMigrations) && !paths.some((p) => p.path === pkgMigrations)) {
2018
2123
  paths.push({
2019
2124
  name: `${pkgName} migrations`,
2020
2125
  path: pkgMigrations,
@@ -2022,18 +2127,18 @@ async function runReset(options) {
2022
2127
  });
2023
2128
  }
2024
2129
  const pkgProviders = join2(pkgBase, pkgOutput.providersPath ?? "src/Providers");
2025
- if (existsSync8(pkgProviders) && !paths.some((p) => p.path === pkgProviders)) {
2130
+ if (existsSync9(pkgProviders) && !paths.some((p) => p.path === pkgProviders)) {
2026
2131
  paths.push({ name: `${pkgName} Providers`, path: pkgProviders, type: "dir" });
2027
2132
  }
2028
2133
  const pkgFactories = join2(pkgBase, pkgOutput.factoriesPath ?? "database/factories");
2029
- if (existsSync8(pkgFactories) && !paths.some((p) => p.path === pkgFactories)) {
2134
+ if (existsSync9(pkgFactories) && !paths.some((p) => p.path === pkgFactories)) {
2030
2135
  paths.push({ name: `${pkgName} Factories`, path: pkgFactories, type: "dir" });
2031
2136
  }
2032
2137
  }
2033
2138
  }
2034
2139
  }
2035
2140
  const typescriptPath = config.output.typescript?.path;
2036
- const tsBasePath = typescriptPath ? resolve8(rootDir, typescriptPath) : null;
2141
+ const tsBasePath = typescriptPath ? resolve9(rootDir, typescriptPath) : null;
2037
2142
  const commonTsPaths = [
2038
2143
  "resources/ts/omnify",
2039
2144
  "resources/ts/omnify/schemas",
@@ -2043,45 +2148,45 @@ async function runReset(options) {
2043
2148
  "src/types/models"
2044
2149
  ];
2045
2150
  let foundTsPath = tsBasePath;
2046
- if (!foundTsPath || !existsSync8(foundTsPath)) {
2151
+ if (!foundTsPath || !existsSync9(foundTsPath)) {
2047
2152
  for (const relPath of commonTsPaths) {
2048
- const tsPath = resolve8(rootDir, relPath);
2049
- if (existsSync8(tsPath)) {
2153
+ const tsPath = resolve9(rootDir, relPath);
2154
+ if (existsSync9(tsPath)) {
2050
2155
  foundTsPath = tsPath;
2051
2156
  break;
2052
2157
  }
2053
2158
  }
2054
2159
  }
2055
- if (foundTsPath && existsSync8(foundTsPath)) {
2160
+ if (foundTsPath && existsSync9(foundTsPath)) {
2056
2161
  const autoGeneratedDirs = ["base", "enum", "rules", "hooks", "lib"];
2057
2162
  for (const subDir of autoGeneratedDirs) {
2058
2163
  const subPath = join2(foundTsPath, subDir);
2059
- if (existsSync8(subPath)) {
2164
+ if (existsSync9(subPath)) {
2060
2165
  paths.push({ name: `TypeScript ${subDir}`, path: subPath, type: "dir" });
2061
2166
  }
2062
2167
  }
2063
2168
  const autoGeneratedFiles = ["common.ts", "index.ts", "i18n.ts"];
2064
2169
  for (const fileName of autoGeneratedFiles) {
2065
2170
  const filePath = join2(foundTsPath, fileName);
2066
- if (existsSync8(filePath)) {
2171
+ if (existsSync9(filePath)) {
2067
2172
  paths.push({ name: `TypeScript ${fileName}`, path: filePath, type: "file" });
2068
2173
  }
2069
2174
  }
2070
2175
  }
2071
- const lockFilePath = resolve8(rootDir, config.lockFilePath);
2072
- if (existsSync8(lockFilePath)) {
2176
+ const lockFilePath = resolve9(rootDir, config.lockFilePath);
2177
+ if (existsSync9(lockFilePath)) {
2073
2178
  paths.push({ name: "Lock file", path: lockFilePath, type: "file" });
2074
2179
  }
2075
- const versionsDir = resolve8(rootDir, ".omnify-versions");
2076
- if (existsSync8(versionsDir)) {
2180
+ const versionsDir = resolve9(rootDir, ".omnify-versions");
2181
+ if (existsSync9(versionsDir)) {
2077
2182
  paths.push({ name: "Version history", path: versionsDir, type: "dir" });
2078
2183
  }
2079
- const omnifyVersionsDir = resolve8(rootDir, ".omnify/versions");
2080
- if (existsSync8(omnifyVersionsDir)) {
2184
+ const omnifyVersionsDir = resolve9(rootDir, ".omnify/versions");
2185
+ if (existsSync9(omnifyVersionsDir)) {
2081
2186
  paths.push({ name: "Version history (.omnify/versions)", path: omnifyVersionsDir, type: "dir" });
2082
2187
  }
2083
- const logsDir = resolve8(rootDir, ".omnify/logs");
2084
- if (existsSync8(logsDir)) {
2188
+ const logsDir = resolve9(rootDir, ".omnify/logs");
2189
+ if (existsSync9(logsDir)) {
2085
2190
  paths.push({ name: "Logs", path: logsDir, type: "dir" });
2086
2191
  }
2087
2192
  if (paths.length === 0) {
@@ -2152,8 +2257,8 @@ function registerResetCommand(program2) {
2152
2257
 
2153
2258
  // src/commands/create-project.ts
2154
2259
  import { execSync, spawn } from "child_process";
2155
- import { existsSync as existsSync9, rmSync as rmSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync5 } from "fs";
2156
- import { resolve as resolve9 } from "path";
2260
+ import { existsSync as existsSync10, rmSync as rmSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync5 } from "fs";
2261
+ import { resolve as resolve10 } from "path";
2157
2262
  var BOILERPLATE_REPO = "https://github.com/omnifyjp/omnify-laravel-boilerplate.git";
2158
2263
  var IS_WINDOWS = process.platform === "win32";
2159
2264
  function checkGit() {
@@ -2254,9 +2359,9 @@ var GITIGNORE_ENTRIES_TO_REMOVE = [
2254
2359
  ".claude/omnify/"
2255
2360
  ];
2256
2361
  function cleanupGitignore(targetDir) {
2257
- const gitignorePath = resolve9(targetDir, ".gitignore");
2258
- if (!existsSync9(gitignorePath)) return;
2259
- const content = readFileSync3(gitignorePath, "utf-8");
2362
+ const gitignorePath = resolve10(targetDir, ".gitignore");
2363
+ if (!existsSync10(gitignorePath)) return;
2364
+ const content = readFileSync4(gitignorePath, "utf-8");
2260
2365
  const lines = content.split("\n");
2261
2366
  const cleanedLines = lines.filter((line) => {
2262
2367
  const trimmed = line.trim();
@@ -2270,8 +2375,8 @@ function cleanupGitignore(targetDir) {
2270
2375
  function cloneRepo(repo, targetDir) {
2271
2376
  logger.step(`Cloning boilerplate from ${repo}...`);
2272
2377
  execSync(`git clone --depth 1 ${repo} "${targetDir}"`, { stdio: "inherit" });
2273
- const gitDir = resolve9(targetDir, ".git");
2274
- if (existsSync9(gitDir)) {
2378
+ const gitDir = resolve10(targetDir, ".git");
2379
+ if (existsSync10(gitDir)) {
2275
2380
  rmSync2(gitDir, { recursive: true, force: true });
2276
2381
  }
2277
2382
  cleanupGitignore(targetDir);
@@ -2279,7 +2384,7 @@ function cloneRepo(repo, targetDir) {
2279
2384
  logger.success("Repository cloned successfully");
2280
2385
  }
2281
2386
  function runCommand(command, targetDir) {
2282
- return new Promise((resolve13, reject) => {
2387
+ return new Promise((resolve14, reject) => {
2283
2388
  const child = spawn(command, [], {
2284
2389
  cwd: targetDir,
2285
2390
  shell: true,
@@ -2287,7 +2392,7 @@ function runCommand(command, targetDir) {
2287
2392
  });
2288
2393
  child.on("close", (code) => {
2289
2394
  if (code === 0) {
2290
- resolve13();
2395
+ resolve14();
2291
2396
  } else {
2292
2397
  reject(new Error(`Command failed with exit code ${code}`));
2293
2398
  }
@@ -2335,13 +2440,13 @@ async function runSetup(targetDir) {
2335
2440
  }
2336
2441
  }
2337
2442
  async function runCreateProject(projectName, options) {
2338
- const targetDir = resolve9(process.cwd(), projectName);
2443
+ const targetDir = resolve10(process.cwd(), projectName);
2339
2444
  const repo = options.repo ?? BOILERPLATE_REPO;
2340
2445
  if (!checkGit()) {
2341
2446
  logger.error("Git is not installed. Please install git first.");
2342
2447
  process.exit(1);
2343
2448
  }
2344
- if (existsSync9(targetDir)) {
2449
+ if (existsSync10(targetDir)) {
2345
2450
  logger.error(`Directory "${projectName}" already exists.`);
2346
2451
  process.exit(1);
2347
2452
  }
@@ -2367,7 +2472,7 @@ async function runCreateProject(projectName, options) {
2367
2472
  logger.info(" pnpm run dev");
2368
2473
  logger.newline();
2369
2474
  } catch (error) {
2370
- if (!cloneSucceeded && existsSync9(targetDir)) {
2475
+ if (!cloneSucceeded && existsSync10(targetDir)) {
2371
2476
  rmSync2(targetDir, { recursive: true, force: true });
2372
2477
  } else if (cloneSucceeded) {
2373
2478
  logger.newline();
@@ -2393,8 +2498,8 @@ function registerCreateProjectCommand(program2) {
2393
2498
  }
2394
2499
 
2395
2500
  // src/commands/deploy.ts
2396
- import { existsSync as existsSync10 } from "fs";
2397
- import { resolve as resolve10, dirname as dirname7 } from "path";
2501
+ import { existsSync as existsSync11 } from "fs";
2502
+ import { resolve as resolve11, dirname as dirname8 } from "path";
2398
2503
  import { loadSchemas as loadSchemas4, OmnifyError as OmnifyError5 } from "@famgia/omnify-core";
2399
2504
  import {
2400
2505
  VERSION_CHAIN_FILE as VERSION_CHAIN_FILE2,
@@ -2409,7 +2514,7 @@ async function confirmDeploy(schemaCount, environment, version) {
2409
2514
  input: process.stdin,
2410
2515
  output: process.stdout
2411
2516
  });
2412
- return new Promise((resolve13) => {
2517
+ return new Promise((resolve14) => {
2413
2518
  logger.newline();
2414
2519
  logger.warn("\u26A0\uFE0F WARNING: This action is IRREVERSIBLE!");
2415
2520
  logger.warn("");
@@ -2425,7 +2530,7 @@ async function confirmDeploy(schemaCount, environment, version) {
2425
2530
  logger.newline();
2426
2531
  rl.question(' Type "LOCK" to confirm: ', (answer) => {
2427
2532
  rl.close();
2428
- resolve13(answer.trim().toUpperCase() === "LOCK");
2533
+ resolve14(answer.trim().toUpperCase() === "LOCK");
2429
2534
  });
2430
2535
  });
2431
2536
  }
@@ -2446,11 +2551,11 @@ async function runDeploy(options) {
2446
2551
  logger.header("Deploy Version Lock");
2447
2552
  logger.debug("Loading configuration...");
2448
2553
  const { config, configPath: configPath2 } = await loadConfig();
2449
- const rootDir = configPath2 ? dirname7(configPath2) : process.cwd();
2554
+ const rootDir = configPath2 ? dirname8(configPath2) : process.cwd();
2450
2555
  validateConfig(config, rootDir);
2451
- const schemasDir = resolve10(rootDir, config.schemasDir);
2452
- const chainFilePath = resolve10(rootDir, VERSION_CHAIN_FILE2);
2453
- if (!existsSync10(schemasDir)) {
2556
+ const schemasDir = resolve11(rootDir, config.schemasDir);
2557
+ const chainFilePath = resolve11(rootDir, VERSION_CHAIN_FILE2);
2558
+ if (!existsSync11(schemasDir)) {
2454
2559
  throw new OmnifyError5(
2455
2560
  `Schemas directory not found: ${schemasDir}`,
2456
2561
  "E003",
@@ -2604,8 +2709,8 @@ function registerDeployCommand(program2) {
2604
2709
  }
2605
2710
 
2606
2711
  // src/commands/verify.ts
2607
- import { existsSync as existsSync11 } from "fs";
2608
- import { resolve as resolve11, dirname as dirname8 } from "path";
2712
+ import { existsSync as existsSync12 } from "fs";
2713
+ import { resolve as resolve12, dirname as dirname9 } from "path";
2609
2714
  import { OmnifyError as OmnifyError6 } from "@famgia/omnify-core";
2610
2715
  import {
2611
2716
  VERSION_CHAIN_FILE as VERSION_CHAIN_FILE3,
@@ -2621,11 +2726,11 @@ async function runVerify(options) {
2621
2726
  }
2622
2727
  logger.debug("Loading configuration...");
2623
2728
  const { config, configPath: configPath2 } = await loadConfig();
2624
- const rootDir = configPath2 ? dirname8(configPath2) : process.cwd();
2729
+ const rootDir = configPath2 ? dirname9(configPath2) : process.cwd();
2625
2730
  validateConfig(config, rootDir);
2626
- const schemasDir = resolve11(rootDir, config.schemasDir);
2627
- const chainFilePath = resolve11(rootDir, VERSION_CHAIN_FILE3);
2628
- if (!existsSync11(chainFilePath)) {
2731
+ const schemasDir = resolve12(rootDir, config.schemasDir);
2732
+ const chainFilePath = resolve12(rootDir, VERSION_CHAIN_FILE3);
2733
+ if (!existsSync12(chainFilePath)) {
2629
2734
  if (options.json) {
2630
2735
  console.log(JSON.stringify({
2631
2736
  valid: true,
@@ -2805,8 +2910,8 @@ process.on("unhandledRejection", (reason) => {
2805
2910
  var args = process.argv.slice(2);
2806
2911
  var firstArg = args[0];
2807
2912
  var hasCommand = firstArg !== void 0 && !firstArg.startsWith("-");
2808
- var configPath = resolve12(process.cwd(), "omnify.config.ts");
2809
- var hasConfig = existsSync12(configPath);
2913
+ var configPath = resolve13(process.cwd(), "omnify.config.ts");
2914
+ var hasConfig = existsSync13(configPath);
2810
2915
  if (!hasCommand && !hasConfig) {
2811
2916
  runInit({}).catch((error) => {
2812
2917
  if (error instanceof Error) {