@ooneex/cli 1.13.3 → 1.15.0

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
@@ -4876,7 +4876,7 @@ var require_pluralize = __commonJS((exports, module) => {
4876
4876
  });
4877
4877
 
4878
4878
  // src/index.ts
4879
- import { commandRun } from "@ooneex/command";
4879
+ import { run } from "@ooneex/command";
4880
4880
 
4881
4881
  // src/commands/CompletionZshCommand.ts
4882
4882
  import { homedir } from "os";
@@ -5184,10 +5184,10 @@ CompletionZshCommand = __legacyDecorateClassTS([
5184
5184
  decorator.command()
5185
5185
  ], CompletionZshCommand);
5186
5186
  // src/commands/MakeAiCommand.ts
5187
- import { join as join2 } from "path";
5188
- import { decorator as decorator2 } from "@ooneex/command";
5189
- import { TerminalLogger as TerminalLogger2 } from "@ooneex/logger";
5190
- import { toPascalCase } from "@ooneex/utils";
5187
+ import { join as join4 } from "path";
5188
+ import { decorator as decorator3 } from "@ooneex/command";
5189
+ import { TerminalLogger as TerminalLogger3 } from "@ooneex/logger";
5190
+ import { toPascalCase as toPascalCase2 } from "@ooneex/utils";
5191
5191
 
5192
5192
  // src/prompts/askName.ts
5193
5193
  var import_enquirer = __toESM(require_enquirer(), 1);
@@ -5282,6 +5282,234 @@ export class {{NAME}}Ai implements IAiChat<OpenAiConfigType> {
5282
5282
  }
5283
5283
  `;
5284
5284
 
5285
+ // src/utils.ts
5286
+ import { join as join3 } from "path";
5287
+
5288
+ // src/commands/MakeModuleCommand.ts
5289
+ import { join as join2 } from "path";
5290
+ import { decorator as decorator2 } from "@ooneex/command";
5291
+ import { TerminalLogger as TerminalLogger2 } from "@ooneex/logger";
5292
+ import { toKebabCase, toPascalCase } from "@ooneex/utils";
5293
+
5294
+ // src/templates/module/command.run.txt
5295
+ var command_run_default = `#!/usr/bin/env bun
5296
+
5297
+ import { run } from "@ooneex/command";
5298
+ import "@/commands/commands";
5299
+
5300
+ await run();
5301
+ `;
5302
+
5303
+ // src/templates/module/module.txt
5304
+ var module_default = `import type { ModuleType } from "@ooneex/module";
5305
+
5306
+ export const {{NAME}}Module: ModuleType = {
5307
+ controllers: [],
5308
+ entities: [],
5309
+ middlewares: [],
5310
+ cronJobs: [],
5311
+ events: [],
5312
+ };
5313
+ `;
5314
+
5315
+ // src/templates/module/package.txt
5316
+ var package_default = `{
5317
+ "name": "@module/{{NAME}}",
5318
+ "description": "",
5319
+ "version": "0.0.1",
5320
+ "scripts": {
5321
+ "test": "bun test tests",
5322
+ "lint": "tsgo --noEmit && bunx biome lint"
5323
+ }
5324
+ }
5325
+ `;
5326
+
5327
+ // src/templates/module/test.txt
5328
+ var test_default = `import { describe, expect, test } from "bun:test";
5329
+ import { {{NAME}}Module } from "@/{{NAME}}Module";
5330
+
5331
+ describe("{{NAME}}Module", () => {
5332
+ test("should have controllers array", () => {
5333
+ expect(Array.isArray({{NAME}}Module.controllers)).toBe(true);
5334
+ });
5335
+
5336
+ test("should have entities array", () => {
5337
+ expect(Array.isArray({{NAME}}Module.entities)).toBe(true);
5338
+ });
5339
+
5340
+ test("should have middlewares array", () => {
5341
+ expect(Array.isArray({{NAME}}Module.middlewares)).toBe(true);
5342
+ });
5343
+
5344
+ test("should have cronJobs array", () => {
5345
+ expect(Array.isArray({{NAME}}Module.cronJobs)).toBe(true);
5346
+ });
5347
+
5348
+ test("should have events array", () => {
5349
+ expect(Array.isArray({{NAME}}Module.events)).toBe(true);
5350
+ });
5351
+ });
5352
+ `;
5353
+
5354
+ // src/templates/module/tsconfig.txt
5355
+ var tsconfig_default = `{
5356
+ "extends": "../../tsconfig.json",
5357
+ "compilerOptions": {
5358
+ "types": ["@types/bun"],
5359
+ "paths": {
5360
+ "@/*": ["./src/*"]
5361
+ }
5362
+ },
5363
+ "include": ["src/**/*.ts", "src/**/*.tsx", "tests/**/*.ts", "tests/**/*.tsx", "bin/**/*.ts"],
5364
+ "exclude": ["node_modules", "dist"]
5365
+ }
5366
+ `;
5367
+
5368
+ // src/commands/MakeModuleCommand.ts
5369
+ class MakeModuleCommand {
5370
+ getName() {
5371
+ return "make:module";
5372
+ }
5373
+ getDescription() {
5374
+ return "Generate a new module";
5375
+ }
5376
+ async addToAppModule(appModulePath, pascalName, kebabName) {
5377
+ let content = await Bun.file(appModulePath).text();
5378
+ const moduleName = `${pascalName}Module`;
5379
+ const importPath = `@${kebabName}/${moduleName}`;
5380
+ const importLine = `import { ${moduleName} } from "${importPath}";
5381
+ `;
5382
+ const lastImportIndex = content.lastIndexOf("import ");
5383
+ const lineEnd = content.indexOf(`
5384
+ `, lastImportIndex);
5385
+ content = `${content.slice(0, lineEnd + 1)}${importLine}${content.slice(lineEnd + 1)}`;
5386
+ const fields = ["controllers", "entities", "middlewares", "cronJobs", "events"];
5387
+ for (const field of fields) {
5388
+ const regex = new RegExp(`(${field}:\\s*\\[)([^\\]]*)`, "s");
5389
+ const match = content.match(regex);
5390
+ if (match) {
5391
+ const existing = match[2]?.trim();
5392
+ const spread = `...${moduleName}.${field}`;
5393
+ const newValue = existing ? `${existing}, ${spread}` : spread;
5394
+ content = content.replace(regex, `$1${newValue}`);
5395
+ }
5396
+ }
5397
+ await Bun.write(appModulePath, content);
5398
+ }
5399
+ async addModuleScope(commitlintPath, kebabName) {
5400
+ let content = await Bun.file(commitlintPath).text();
5401
+ const regex = /("scope-enum":\s*\[\s*RuleConfigSeverity\.Error,\s*"always",\s*\[)([\s\S]*?)(\])/;
5402
+ const match = content.match(regex);
5403
+ if (match) {
5404
+ const existing = match[2]?.trim() ?? "";
5405
+ const newScope = `"${kebabName}"`;
5406
+ if (!existing.includes(newScope)) {
5407
+ const newValue = existing ? `${existing}
5408
+ ${newScope},` : `
5409
+ ${newScope},`;
5410
+ content = content.replace(regex, `$1${newValue}
5411
+ $3`);
5412
+ await Bun.write(commitlintPath, content);
5413
+ }
5414
+ }
5415
+ }
5416
+ async addPathAlias(tsconfigPath, kebabName) {
5417
+ const content = await Bun.file(tsconfigPath).text();
5418
+ const tsconfig = JSON.parse(content);
5419
+ tsconfig.compilerOptions ??= {};
5420
+ tsconfig.compilerOptions.paths ??= {};
5421
+ tsconfig.compilerOptions.paths[`@${kebabName}/*`] = [`../${kebabName}/src/*`];
5422
+ await Bun.write(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}
5423
+ `);
5424
+ }
5425
+ async run(options) {
5426
+ const {
5427
+ cwd = process.cwd(),
5428
+ silent = false,
5429
+ skipMigrations = false,
5430
+ skipSeeds = false,
5431
+ skipCommands = false
5432
+ } = options;
5433
+ let { name } = options;
5434
+ if (!name) {
5435
+ name = await askName({ message: "Enter module name" });
5436
+ }
5437
+ const pascalName = toPascalCase(name).replace(/Module$/, "");
5438
+ const kebabName = toKebabCase(pascalName);
5439
+ const moduleDir = join2(cwd, "modules", kebabName);
5440
+ const srcDir = join2(moduleDir, "src");
5441
+ const testsDir = join2(moduleDir, "tests");
5442
+ const moduleContent = module_default.replace(/{{NAME}}/g, pascalName);
5443
+ const packageContent = package_default.replace(/{{NAME}}/g, kebabName);
5444
+ const testContent = test_default.replace(/{{NAME}}/g, pascalName);
5445
+ await Bun.write(join2(srcDir, `${pascalName}Module.ts`), moduleContent);
5446
+ if (!skipMigrations) {
5447
+ await Bun.write(join2(srcDir, "migrations", "migrations.ts"), "");
5448
+ }
5449
+ if (!skipSeeds) {
5450
+ await Bun.write(join2(srcDir, "seeds", "seeds.ts"), "");
5451
+ }
5452
+ if (!skipCommands) {
5453
+ await Bun.write(join2(srcDir, "commands", "commands.ts"), "");
5454
+ const binCommandRunPath = join2(moduleDir, "bin", "command", "run.ts");
5455
+ const binCommandRunFile = Bun.file(binCommandRunPath);
5456
+ if (!await binCommandRunFile.exists()) {
5457
+ await Bun.write(binCommandRunPath, command_run_default);
5458
+ }
5459
+ }
5460
+ await Bun.write(join2(moduleDir, "package.json"), packageContent);
5461
+ await Bun.write(join2(moduleDir, "tsconfig.json"), tsconfig_default);
5462
+ await Bun.write(join2(testsDir, `${pascalName}Module.spec.ts`), testContent);
5463
+ if (kebabName !== "app") {
5464
+ const appModulePath = join2(cwd, "modules", "app", "src", "AppModule.ts");
5465
+ if (await Bun.file(appModulePath).exists()) {
5466
+ await this.addToAppModule(appModulePath, pascalName, kebabName);
5467
+ }
5468
+ const appTsconfigPath = join2(cwd, "modules", "app", "tsconfig.json");
5469
+ if (await Bun.file(appTsconfigPath).exists()) {
5470
+ await this.addPathAlias(appTsconfigPath, kebabName);
5471
+ }
5472
+ }
5473
+ const commitlintPath = join2(cwd, ".commitlintrc.ts");
5474
+ if (await Bun.file(commitlintPath).exists()) {
5475
+ await this.addModuleScope(commitlintPath, kebabName);
5476
+ }
5477
+ if (!silent) {
5478
+ const logger = new TerminalLogger2;
5479
+ logger.success(`modules/${kebabName} created successfully`, undefined, {
5480
+ showTimestamp: false,
5481
+ showArrow: false,
5482
+ useSymbol: true
5483
+ });
5484
+ }
5485
+ const packageJsonPath = join2(process.cwd(), "package.json");
5486
+ const packageJson = await Bun.file(packageJsonPath).json();
5487
+ const deps = packageJson.dependencies ?? {};
5488
+ const devDeps = packageJson.devDependencies ?? {};
5489
+ if (!deps["@ooneex/module"] && !devDeps["@ooneex/module"]) {
5490
+ const install = Bun.spawn(["bun", "add", "@ooneex/module"], {
5491
+ cwd: process.cwd(),
5492
+ stdout: "ignore",
5493
+ stderr: "inherit"
5494
+ });
5495
+ await install.exited;
5496
+ }
5497
+ }
5498
+ }
5499
+ MakeModuleCommand = __legacyDecorateClassTS([
5500
+ decorator2.command()
5501
+ ], MakeModuleCommand);
5502
+
5503
+ // src/utils.ts
5504
+ var ensureModule = async (module) => {
5505
+ const moduleDir = join3(process.cwd(), "modules", module);
5506
+ const moduleDirExists = await Bun.file(join3(moduleDir, "package.json")).exists();
5507
+ if (!moduleDirExists) {
5508
+ const makeModule = new MakeModuleCommand;
5509
+ await makeModule.run({ name: module, cwd: process.cwd(), silent: true });
5510
+ }
5511
+ };
5512
+
5285
5513
  // src/commands/MakeAiCommand.ts
5286
5514
  class MakeAiCommand {
5287
5515
  getName() {
@@ -5295,30 +5523,33 @@ class MakeAiCommand {
5295
5523
  if (!name) {
5296
5524
  name = await askName({ message: "Enter name" });
5297
5525
  }
5298
- name = toPascalCase(name).replace(/Ai$/, "");
5526
+ name = toPascalCase2(name).replace(/Ai$/, "");
5527
+ if (module) {
5528
+ await ensureModule(module);
5529
+ }
5299
5530
  const content = ai_default.replace(/{{NAME}}/g, name);
5300
- const base = module ? join2("modules", module) : ".";
5301
- const aiLocalDir = join2(base, "src", "ai");
5302
- const aiDir = join2(process.cwd(), aiLocalDir);
5303
- const filePath = join2(aiDir, `${name}Ai.ts`);
5531
+ const base = module ? join4("modules", module) : ".";
5532
+ const aiLocalDir = join4(base, "src", "ai");
5533
+ const aiDir = join4(process.cwd(), aiLocalDir);
5534
+ const filePath = join4(aiDir, `${name}Ai.ts`);
5304
5535
  await Bun.write(filePath, content);
5305
5536
  const testContent = ai_test_default.replace(/{{NAME}}/g, name);
5306
- const testsLocalDir = join2(base, "tests", "ai");
5307
- const testsDir = join2(process.cwd(), testsLocalDir);
5308
- const testFilePath = join2(testsDir, `${name}Ai.spec.ts`);
5537
+ const testsLocalDir = join4(base, "tests", "ai");
5538
+ const testsDir = join4(process.cwd(), testsLocalDir);
5539
+ const testFilePath = join4(testsDir, `${name}Ai.spec.ts`);
5309
5540
  await Bun.write(testFilePath, testContent);
5310
- const logger = new TerminalLogger2;
5311
- logger.success(`${join2(aiLocalDir, name)}Ai.ts created successfully`, undefined, {
5541
+ const logger = new TerminalLogger3;
5542
+ logger.success(`${join4(aiLocalDir, name)}Ai.ts created successfully`, undefined, {
5312
5543
  showTimestamp: false,
5313
5544
  showArrow: false,
5314
5545
  useSymbol: true
5315
5546
  });
5316
- logger.success(`${join2(testsLocalDir, name)}Ai.spec.ts created successfully`, undefined, {
5547
+ logger.success(`${join4(testsLocalDir, name)}Ai.spec.ts created successfully`, undefined, {
5317
5548
  showTimestamp: false,
5318
5549
  showArrow: false,
5319
5550
  useSymbol: true
5320
5551
  });
5321
- const packageJsonPath = join2(process.cwd(), "package.json");
5552
+ const packageJsonPath = join4(process.cwd(), "package.json");
5322
5553
  const packageJson = await Bun.file(packageJsonPath).json();
5323
5554
  const deps = packageJson.dependencies ?? {};
5324
5555
  const devDeps = packageJson.devDependencies ?? {};
@@ -5333,13 +5564,13 @@ class MakeAiCommand {
5333
5564
  }
5334
5565
  }
5335
5566
  MakeAiCommand = __legacyDecorateClassTS([
5336
- decorator2.command()
5567
+ decorator3.command()
5337
5568
  ], MakeAiCommand);
5338
5569
  // src/commands/MakeAnalyticsCommand.ts
5339
- import { join as join3 } from "path";
5340
- import { decorator as decorator3 } from "@ooneex/command";
5341
- import { TerminalLogger as TerminalLogger3 } from "@ooneex/logger";
5342
- import { toPascalCase as toPascalCase2 } from "@ooneex/utils";
5570
+ import { join as join5 } from "path";
5571
+ import { decorator as decorator4 } from "@ooneex/command";
5572
+ import { TerminalLogger as TerminalLogger4 } from "@ooneex/logger";
5573
+ import { toPascalCase as toPascalCase3 } from "@ooneex/utils";
5343
5574
 
5344
5575
  // src/templates/analytics.test.txt
5345
5576
  var analytics_test_default = `import { describe, expect, test } from "bun:test";
@@ -5384,30 +5615,33 @@ class MakeAnalyticsCommand {
5384
5615
  if (!name) {
5385
5616
  name = await askName({ message: "Enter analytics name" });
5386
5617
  }
5387
- name = toPascalCase2(name).replace(/Analytics$/, "");
5618
+ name = toPascalCase3(name).replace(/Analytics$/, "");
5388
5619
  const content = analytics_default.replace(/{{NAME}}/g, name);
5389
- const base = module ? join3("modules", module) : ".";
5390
- const analyticsLocalDir = join3(base, "src", "analytics");
5391
- const analyticsDir = join3(process.cwd(), analyticsLocalDir);
5392
- const filePath = join3(analyticsDir, `${name}Analytics.ts`);
5620
+ if (module) {
5621
+ await ensureModule(module);
5622
+ }
5623
+ const base = module ? join5("modules", module) : ".";
5624
+ const analyticsLocalDir = join5(base, "src", "analytics");
5625
+ const analyticsDir = join5(process.cwd(), analyticsLocalDir);
5626
+ const filePath = join5(analyticsDir, `${name}Analytics.ts`);
5393
5627
  await Bun.write(filePath, content);
5394
5628
  const testContent = analytics_test_default.replace(/{{NAME}}/g, name);
5395
- const testsLocalDir = join3(base, "tests", "analytics");
5396
- const testsDir = join3(process.cwd(), testsLocalDir);
5397
- const testFilePath = join3(testsDir, `${name}Analytics.spec.ts`);
5629
+ const testsLocalDir = join5(base, "tests", "analytics");
5630
+ const testsDir = join5(process.cwd(), testsLocalDir);
5631
+ const testFilePath = join5(testsDir, `${name}Analytics.spec.ts`);
5398
5632
  await Bun.write(testFilePath, testContent);
5399
- const logger = new TerminalLogger3;
5400
- logger.success(`${join3(analyticsLocalDir, name)}Analytics.ts created successfully`, undefined, {
5633
+ const logger = new TerminalLogger4;
5634
+ logger.success(`${join5(analyticsLocalDir, name)}Analytics.ts created successfully`, undefined, {
5401
5635
  showTimestamp: false,
5402
5636
  showArrow: false,
5403
5637
  useSymbol: true
5404
5638
  });
5405
- logger.success(`${join3(testsLocalDir, name)}Analytics.spec.ts created successfully`, undefined, {
5639
+ logger.success(`${join5(testsLocalDir, name)}Analytics.spec.ts created successfully`, undefined, {
5406
5640
  showTimestamp: false,
5407
5641
  showArrow: false,
5408
5642
  useSymbol: true
5409
5643
  });
5410
- const packageJsonPath = join3(process.cwd(), "package.json");
5644
+ const packageJsonPath = join5(process.cwd(), "package.json");
5411
5645
  const packageJson = await Bun.file(packageJsonPath).json();
5412
5646
  const deps = packageJson.dependencies ?? {};
5413
5647
  const devDeps = packageJson.devDependencies ?? {};
@@ -5422,10 +5656,10 @@ class MakeAnalyticsCommand {
5422
5656
  }
5423
5657
  }
5424
5658
  MakeAnalyticsCommand = __legacyDecorateClassTS([
5425
- decorator3.command()
5659
+ decorator4.command()
5426
5660
  ], MakeAnalyticsCommand);
5427
5661
  // src/commands/MakeAppCommand.ts
5428
- import { join as join6 } from "path";
5662
+ import { join as join7 } from "path";
5429
5663
  import { decorator as decorator6 } from "@ooneex/command";
5430
5664
  import { TerminalLogger as TerminalLogger6 } from "@ooneex/logger";
5431
5665
  import { toKebabCase as toKebabCase3, toSnakeCase } from "@ooneex/utils";
@@ -6193,7 +6427,7 @@ const app = new App({
6193
6427
  prefix: "api",
6194
6428
  },
6195
6429
  check: {
6196
- health: "/api/v1/healthcheck",
6430
+ health: "/v1/health-check",
6197
6431
  },
6198
6432
  loggers: [BetterstackLogger, TerminalLogger],
6199
6433
  onException: BetterstackExceptionLogger,
@@ -6562,10 +6796,10 @@ var zed_settings_json_default = `{
6562
6796
  `;
6563
6797
 
6564
6798
  // src/commands/MakeControllerCommand.ts
6565
- import { basename, join as join4 } from "path";
6566
- import { decorator as decorator4 } from "@ooneex/command";
6567
- import { TerminalLogger as TerminalLogger4 } from "@ooneex/logger";
6568
- import { toKebabCase, toPascalCase as toPascalCase3, trim } from "@ooneex/utils";
6799
+ import { basename, join as join6 } from "path";
6800
+ import { decorator as decorator5 } from "@ooneex/command";
6801
+ import { TerminalLogger as TerminalLogger5 } from "@ooneex/logger";
6802
+ import { toKebabCase as toKebabCase2, toPascalCase as toPascalCase4, trim } from "@ooneex/utils";
6569
6803
 
6570
6804
  // src/prompts/askConfirm.ts
6571
6805
  var import_enquirer3 = __toESM(require_enquirer(), 1);
@@ -6908,326 +7142,114 @@ export type {{TYPE_NAME}}RouteType = {
6908
7142
  payload: Assert({
6909
7143
 
6910
7144
  }),
6911
- queries: Assert({
6912
-
6913
- }),
6914
- response: Assert({
6915
-
6916
- }),
6917
- roles: [ERole.USER],
6918
- })
6919
- export class {{NAME}}Controller {
6920
- public async index(context: ContextType<{{TYPE_NAME}}RouteType>) {
6921
- // const { id } = context.params;
6922
-
6923
- return context.response.json({
6924
-
6925
- });
6926
- }
6927
- }
6928
- `;
6929
-
6930
- // src/commands/MakeControllerCommand.ts
6931
- class MakeControllerCommand {
6932
- getName() {
6933
- return "make:controller";
6934
- }
6935
- getDescription() {
6936
- return "Generate a new controller class";
6937
- }
6938
- async addToModule(modulePath, controllerName) {
6939
- let content = await Bun.file(modulePath).text();
6940
- const className = `${controllerName}Controller`;
6941
- const importLine = `import { ${className} } from "./controllers/${className}";
6942
- `;
6943
- const lastImportIndex = content.lastIndexOf("import ");
6944
- const lineEnd = content.indexOf(`
6945
- `, lastImportIndex);
6946
- content = `${content.slice(0, lineEnd + 1)}${importLine}${content.slice(lineEnd + 1)}`;
6947
- const regex = /(controllers:\s*\[)([^\]]*)/s;
6948
- const match = content.match(regex);
6949
- if (match) {
6950
- const existing = match[2]?.trim();
6951
- const newValue = existing ? `${existing}, ${className}` : className;
6952
- content = content.replace(regex, `$1${newValue}`);
6953
- }
6954
- await Bun.write(modulePath, content);
6955
- }
6956
- async run(options) {
6957
- let { name, module, isSocket } = options;
6958
- if (!name) {
6959
- name = await askName({ message: "Enter controller name" });
6960
- }
6961
- if (isSocket === undefined) {
6962
- isSocket = await askConfirm({ message: "Is this a socket controller?" });
6963
- }
6964
- name = toPascalCase3(name).replace(/Controller$/, "");
6965
- const { route = {} } = options;
6966
- const selectedTemplate = isSocket ? controller_socket_default : controller_default;
6967
- let content = selectedTemplate.replaceAll("{{NAME}}", name);
6968
- if (!route.name) {
6969
- route.name = await askRouteName({ message: "Enter route name (e.g., api.user.create)" });
6970
- }
6971
- const routeTypeName = toPascalCase3(route.name);
6972
- content = content.replaceAll("{{ROUTE_NAME}}", route.name).replaceAll("{{TYPE_NAME}}", routeTypeName);
6973
- if (!route.path) {
6974
- route.path = await askRoutePath({ message: "Enter route path", initial: "/" });
6975
- }
6976
- const routePath = `/${toKebabCase(trim(route.path, "/"))}`;
6977
- content = content.replaceAll("{{ROUTE_PATH}}", routePath);
6978
- if (!isSocket && !route.method) {
6979
- route.method = await askRouteMethod({ message: "Enter route method" });
6980
- }
6981
- if (!isSocket && route.method) {
6982
- content = content.replaceAll("{{ROUTE_METHOD}}", route.method.toLowerCase());
6983
- }
6984
- const base = module ? join4("modules", module) : ".";
6985
- const controllersLocalDir = join4(base, "src", "controllers");
6986
- const controllersDir = join4(process.cwd(), controllersLocalDir);
6987
- const filePath = join4(controllersDir, `${name}Controller.ts`);
6988
- await Bun.write(filePath, content);
6989
- const testContent = controller_test_default.replace(/{{NAME}}/g, name);
6990
- const testsLocalDir = join4(base, "tests", "controllers");
6991
- const testsDir = join4(process.cwd(), testsLocalDir);
6992
- const testFilePath = join4(testsDir, `${name}Controller.spec.ts`);
6993
- await Bun.write(testFilePath, testContent);
6994
- const modulePascalName = module ? toPascalCase3(module) : toPascalCase3(basename(process.cwd()));
6995
- const modulePath = join4(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
6996
- if (await Bun.file(modulePath).exists()) {
6997
- await this.addToModule(modulePath, name);
6998
- }
6999
- const logger = new TerminalLogger4;
7000
- logger.success(`${join4(controllersLocalDir, name)}Controller.ts created successfully`, undefined, {
7001
- showTimestamp: false,
7002
- showArrow: false,
7003
- useSymbol: true
7004
- });
7005
- logger.success(`${join4(testsLocalDir, name)}Controller.spec.ts created successfully`, undefined, {
7006
- showTimestamp: false,
7007
- showArrow: false,
7008
- useSymbol: true
7009
- });
7010
- const packageJsonPath = join4(process.cwd(), "package.json");
7011
- const packageJson = await Bun.file(packageJsonPath).json();
7012
- const deps = packageJson.dependencies ?? {};
7013
- const devDeps = packageJson.devDependencies ?? {};
7014
- if (!deps["@ooneex/controller"] && !devDeps["@ooneex/controller"]) {
7015
- const install = Bun.spawn(["bun", "add", "@ooneex/controller"], {
7016
- cwd: process.cwd(),
7017
- stdout: "ignore",
7018
- stderr: "inherit"
7019
- });
7020
- await install.exited;
7021
- }
7022
- }
7023
- }
7024
- MakeControllerCommand = __legacyDecorateClassTS([
7025
- decorator4.command()
7026
- ], MakeControllerCommand);
7027
-
7028
- // src/commands/MakeModuleCommand.ts
7029
- import { join as join5 } from "path";
7030
- import { decorator as decorator5 } from "@ooneex/command";
7031
- import { TerminalLogger as TerminalLogger5 } from "@ooneex/logger";
7032
- import { toKebabCase as toKebabCase2, toPascalCase as toPascalCase4 } from "@ooneex/utils";
7033
-
7034
- // src/templates/module/command.run.txt
7035
- var command_run_default = `#!/usr/bin/env bun
7036
-
7037
- import { commandRun } from "@ooneex/cli";
7038
- import "@/commands/commands";
7039
-
7040
- await commandRun();
7041
- `;
7042
-
7043
- // src/templates/module/module.txt
7044
- var module_default = `import type { ModuleType } from "@ooneex/module";
7045
-
7046
- export const {{NAME}}Module: ModuleType = {
7047
- controllers: [],
7048
- entities: [],
7049
- middlewares: [],
7050
- cronJobs: [],
7051
- events: [],
7052
- };
7053
- `;
7054
-
7055
- // src/templates/module/package.txt
7056
- var package_default = `{
7057
- "name": "@module/{{NAME}}",
7058
- "description": "",
7059
- "version": "0.0.1",
7060
- "scripts": {
7061
- "test": "bun test tests",
7062
- "lint": "tsgo --noEmit && bunx biome lint"
7063
- }
7064
- }
7065
- `;
7066
-
7067
- // src/templates/module/test.txt
7068
- var test_default = `import { describe, expect, test } from "bun:test";
7069
- import { {{NAME}}Module } from "@/{{NAME}}Module";
7070
-
7071
- describe("{{NAME}}Module", () => {
7072
- test("should have controllers array", () => {
7073
- expect(Array.isArray({{NAME}}Module.controllers)).toBe(true);
7074
- });
7075
-
7076
- test("should have entities array", () => {
7077
- expect(Array.isArray({{NAME}}Module.entities)).toBe(true);
7078
- });
7079
-
7080
- test("should have middlewares array", () => {
7081
- expect(Array.isArray({{NAME}}Module.middlewares)).toBe(true);
7082
- });
7145
+ queries: Assert({
7083
7146
 
7084
- test("should have cronJobs array", () => {
7085
- expect(Array.isArray({{NAME}}Module.cronJobs)).toBe(true);
7086
- });
7147
+ }),
7148
+ response: Assert({
7087
7149
 
7088
- test("should have events array", () => {
7089
- expect(Array.isArray({{NAME}}Module.events)).toBe(true);
7090
- });
7091
- });
7092
- `;
7150
+ }),
7151
+ roles: [ERole.USER],
7152
+ })
7153
+ export class {{NAME}}Controller {
7154
+ public async index(context: ContextType<{{TYPE_NAME}}RouteType>) {
7155
+ // const { id } = context.params;
7093
7156
 
7094
- // src/templates/module/tsconfig.txt
7095
- var tsconfig_default = `{
7096
- "extends": "../../tsconfig.json",
7097
- "compilerOptions": {
7098
- "types": ["@types/bun"],
7099
- "paths": {
7100
- "@/*": ["./src/*"]
7101
- }
7102
- },
7103
- "include": ["src/**/*.ts", "src/**/*.tsx", "tests/**/*.ts", "tests/**/*.tsx", "bin/**/*.ts"],
7104
- "exclude": ["node_modules", "dist"]
7157
+ return context.response.json({
7158
+
7159
+ });
7160
+ }
7105
7161
  }
7106
7162
  `;
7107
7163
 
7108
- // src/commands/MakeModuleCommand.ts
7109
- class MakeModuleCommand {
7164
+ // src/commands/MakeControllerCommand.ts
7165
+ class MakeControllerCommand {
7110
7166
  getName() {
7111
- return "make:module";
7167
+ return "make:controller";
7112
7168
  }
7113
7169
  getDescription() {
7114
- return "Generate a new module";
7170
+ return "Generate a new controller class";
7115
7171
  }
7116
- async addToAppModule(appModulePath, pascalName, kebabName) {
7117
- let content = await Bun.file(appModulePath).text();
7118
- const moduleName = `${pascalName}Module`;
7119
- const importPath = `@${kebabName}/${moduleName}`;
7120
- const importLine = `import { ${moduleName} } from "${importPath}";
7172
+ async addToModule(modulePath, controllerName) {
7173
+ let content = await Bun.file(modulePath).text();
7174
+ const className = `${controllerName}Controller`;
7175
+ const importLine = `import { ${className} } from "./controllers/${className}";
7121
7176
  `;
7122
7177
  const lastImportIndex = content.lastIndexOf("import ");
7123
7178
  const lineEnd = content.indexOf(`
7124
7179
  `, lastImportIndex);
7125
7180
  content = `${content.slice(0, lineEnd + 1)}${importLine}${content.slice(lineEnd + 1)}`;
7126
- const fields = ["controllers", "entities", "middlewares", "cronJobs", "events"];
7127
- for (const field of fields) {
7128
- const regex = new RegExp(`(${field}:\\s*\\[)([^\\]]*)`, "s");
7129
- const match = content.match(regex);
7130
- if (match) {
7131
- const existing = match[2]?.trim();
7132
- const spread = `...${moduleName}.${field}`;
7133
- const newValue = existing ? `${existing}, ${spread}` : spread;
7134
- content = content.replace(regex, `$1${newValue}`);
7135
- }
7136
- }
7137
- await Bun.write(appModulePath, content);
7138
- }
7139
- async addModuleScope(commitlintPath, kebabName) {
7140
- let content = await Bun.file(commitlintPath).text();
7141
- const regex = /("scope-enum":\s*\[\s*RuleConfigSeverity\.Error,\s*"always",\s*\[)([\s\S]*?)(\])/;
7181
+ const regex = /(controllers:\s*\[)([^\]]*)/s;
7142
7182
  const match = content.match(regex);
7143
7183
  if (match) {
7144
- const existing = match[2]?.trim() ?? "";
7145
- const newScope = `"${kebabName}"`;
7146
- if (!existing.includes(newScope)) {
7147
- const newValue = existing ? `${existing}
7148
- ${newScope},` : `
7149
- ${newScope},`;
7150
- content = content.replace(regex, `$1${newValue}
7151
- $3`);
7152
- await Bun.write(commitlintPath, content);
7153
- }
7184
+ const existing = match[2]?.trim();
7185
+ const newValue = existing ? `${existing}, ${className}` : className;
7186
+ content = content.replace(regex, `$1${newValue}`);
7154
7187
  }
7155
- }
7156
- async addPathAlias(tsconfigPath, kebabName) {
7157
- const content = await Bun.file(tsconfigPath).text();
7158
- const tsconfig = JSON.parse(content);
7159
- tsconfig.compilerOptions ??= {};
7160
- tsconfig.compilerOptions.paths ??= {};
7161
- tsconfig.compilerOptions.paths[`@${kebabName}/*`] = [`../${kebabName}/src/*`];
7162
- await Bun.write(tsconfigPath, `${JSON.stringify(tsconfig, null, 2)}
7163
- `);
7188
+ await Bun.write(modulePath, content);
7164
7189
  }
7165
7190
  async run(options) {
7166
- const {
7167
- cwd = process.cwd(),
7168
- silent = false,
7169
- skipMigrations = false,
7170
- skipSeeds = false,
7171
- skipCommands = false
7172
- } = options;
7173
- let { name } = options;
7191
+ let { name, module, isSocket } = options;
7174
7192
  if (!name) {
7175
- name = await askName({ message: "Enter module name" });
7193
+ name = await askName({ message: "Enter controller name" });
7176
7194
  }
7177
- const pascalName = toPascalCase4(name).replace(/Module$/, "");
7178
- const kebabName = toKebabCase2(pascalName);
7179
- const moduleDir = join5(cwd, "modules", kebabName);
7180
- const srcDir = join5(moduleDir, "src");
7181
- const testsDir = join5(moduleDir, "tests");
7182
- const moduleContent = module_default.replace(/{{NAME}}/g, pascalName);
7183
- const packageContent = package_default.replace(/{{NAME}}/g, kebabName);
7184
- const testContent = test_default.replace(/{{NAME}}/g, pascalName);
7185
- await Bun.write(join5(srcDir, `${pascalName}Module.ts`), moduleContent);
7186
- if (!skipMigrations) {
7187
- await Bun.write(join5(srcDir, "migrations", "migrations.ts"), "");
7195
+ if (isSocket === undefined) {
7196
+ isSocket = await askConfirm({ message: "Is this a socket controller?" });
7188
7197
  }
7189
- if (!skipSeeds) {
7190
- await Bun.write(join5(srcDir, "seeds", "seeds.ts"), "");
7198
+ name = toPascalCase4(name).replace(/Controller$/, "");
7199
+ const { route = {} } = options;
7200
+ const selectedTemplate = isSocket ? controller_socket_default : controller_default;
7201
+ let content = selectedTemplate.replaceAll("{{NAME}}", name);
7202
+ if (!route.name) {
7203
+ route.name = await askRouteName({ message: "Enter route name (e.g., api.user.create)" });
7191
7204
  }
7192
- if (!skipCommands) {
7193
- await Bun.write(join5(srcDir, "commands", "commands.ts"), "");
7194
- const binCommandRunPath = join5(moduleDir, "bin", "command", "run.ts");
7195
- const binCommandRunFile = Bun.file(binCommandRunPath);
7196
- if (!await binCommandRunFile.exists()) {
7197
- await Bun.write(binCommandRunPath, command_run_default);
7198
- }
7205
+ const routeTypeName = toPascalCase4(route.name);
7206
+ content = content.replaceAll("{{ROUTE_NAME}}", route.name).replaceAll("{{TYPE_NAME}}", routeTypeName);
7207
+ if (!route.path) {
7208
+ route.path = await askRoutePath({ message: "Enter route path", initial: "/" });
7199
7209
  }
7200
- await Bun.write(join5(moduleDir, "package.json"), packageContent);
7201
- await Bun.write(join5(moduleDir, "tsconfig.json"), tsconfig_default);
7202
- await Bun.write(join5(testsDir, `${pascalName}Module.spec.ts`), testContent);
7203
- if (kebabName !== "app") {
7204
- const appModulePath = join5(cwd, "modules", "app", "src", "AppModule.ts");
7205
- if (await Bun.file(appModulePath).exists()) {
7206
- await this.addToAppModule(appModulePath, pascalName, kebabName);
7207
- }
7208
- const appTsconfigPath = join5(cwd, "modules", "app", "tsconfig.json");
7209
- if (await Bun.file(appTsconfigPath).exists()) {
7210
- await this.addPathAlias(appTsconfigPath, kebabName);
7211
- }
7210
+ const routePath = `/${toKebabCase2(trim(route.path, "/"))}`;
7211
+ content = content.replaceAll("{{ROUTE_PATH}}", routePath);
7212
+ if (!isSocket && !route.method) {
7213
+ route.method = await askRouteMethod({ message: "Enter route method" });
7212
7214
  }
7213
- const commitlintPath = join5(cwd, ".commitlintrc.ts");
7214
- if (await Bun.file(commitlintPath).exists()) {
7215
- await this.addModuleScope(commitlintPath, kebabName);
7215
+ if (!isSocket && route.method) {
7216
+ content = content.replaceAll("{{ROUTE_METHOD}}", route.method.toLowerCase());
7216
7217
  }
7217
- if (!silent) {
7218
- const logger = new TerminalLogger5;
7219
- logger.success(`modules/${kebabName} created successfully`, undefined, {
7220
- showTimestamp: false,
7221
- showArrow: false,
7222
- useSymbol: true
7223
- });
7218
+ if (module) {
7219
+ await ensureModule(module);
7224
7220
  }
7225
- const packageJsonPath = join5(process.cwd(), "package.json");
7221
+ const base = module ? join6("modules", module) : ".";
7222
+ const controllersLocalDir = join6(base, "src", "controllers");
7223
+ const controllersDir = join6(process.cwd(), controllersLocalDir);
7224
+ const filePath = join6(controllersDir, `${name}Controller.ts`);
7225
+ await Bun.write(filePath, content);
7226
+ const testContent = controller_test_default.replace(/{{NAME}}/g, name);
7227
+ const testsLocalDir = join6(base, "tests", "controllers");
7228
+ const testsDir = join6(process.cwd(), testsLocalDir);
7229
+ const testFilePath = join6(testsDir, `${name}Controller.spec.ts`);
7230
+ await Bun.write(testFilePath, testContent);
7231
+ const modulePascalName = module ? toPascalCase4(module) : toPascalCase4(basename(process.cwd()));
7232
+ const modulePath = join6(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
7233
+ if (await Bun.file(modulePath).exists()) {
7234
+ await this.addToModule(modulePath, name);
7235
+ }
7236
+ const logger = new TerminalLogger5;
7237
+ logger.success(`${join6(controllersLocalDir, name)}Controller.ts created successfully`, undefined, {
7238
+ showTimestamp: false,
7239
+ showArrow: false,
7240
+ useSymbol: true
7241
+ });
7242
+ logger.success(`${join6(testsLocalDir, name)}Controller.spec.ts created successfully`, undefined, {
7243
+ showTimestamp: false,
7244
+ showArrow: false,
7245
+ useSymbol: true
7246
+ });
7247
+ const packageJsonPath = join6(process.cwd(), "package.json");
7226
7248
  const packageJson = await Bun.file(packageJsonPath).json();
7227
7249
  const deps = packageJson.dependencies ?? {};
7228
7250
  const devDeps = packageJson.devDependencies ?? {};
7229
- if (!deps["@ooneex/module"] && !devDeps["@ooneex/module"]) {
7230
- const install = Bun.spawn(["bun", "add", "@ooneex/module"], {
7251
+ if (!deps["@ooneex/controller"] && !devDeps["@ooneex/controller"]) {
7252
+ const install = Bun.spawn(["bun", "add", "@ooneex/controller"], {
7231
7253
  cwd: process.cwd(),
7232
7254
  stdout: "ignore",
7233
7255
  stderr: "inherit"
@@ -7236,9 +7258,9 @@ class MakeModuleCommand {
7236
7258
  }
7237
7259
  }
7238
7260
  }
7239
- MakeModuleCommand = __legacyDecorateClassTS([
7261
+ MakeControllerCommand = __legacyDecorateClassTS([
7240
7262
  decorator5.command()
7241
- ], MakeModuleCommand);
7263
+ ], MakeControllerCommand);
7242
7264
 
7243
7265
  // src/commands/MakeAppCommand.ts
7244
7266
  class MakeAppCommand {
@@ -7258,15 +7280,15 @@ class MakeAppCommand {
7258
7280
  destination = await askDestination({ message: "Enter destination path", initial: kebabName });
7259
7281
  }
7260
7282
  const packageContent = package_json_default.replace(/{{NAME}}/g, kebabName);
7261
- await Bun.write(join6(destination, ".commitlintrc.ts"), _commitlintrc_ts_default);
7262
- await Bun.write(join6(destination, ".gitignore"), _gitignore_default);
7263
- await Bun.write(join6(destination, "biome.jsonc"), biome_jsonc_default);
7264
- await Bun.write(join6(destination, "bunfig.toml"), bunfig_toml_default);
7265
- await Bun.write(join6(destination, "nx.json"), nx_json_default);
7266
- await Bun.write(join6(destination, "package.json"), packageContent);
7267
- await Bun.write(join6(destination, "README.md"), README_md_default.replace(/{{NAME}}/g, kebabName));
7268
- await Bun.write(join6(destination, "tsconfig.json"), tsconfig_json_default);
7269
- await Bun.write(join6(destination, ".zed", "settings.json"), zed_settings_json_default);
7283
+ await Bun.write(join7(destination, ".commitlintrc.ts"), _commitlintrc_ts_default);
7284
+ await Bun.write(join7(destination, ".gitignore"), _gitignore_default);
7285
+ await Bun.write(join7(destination, "biome.jsonc"), biome_jsonc_default);
7286
+ await Bun.write(join7(destination, "bunfig.toml"), bunfig_toml_default);
7287
+ await Bun.write(join7(destination, "nx.json"), nx_json_default);
7288
+ await Bun.write(join7(destination, "package.json"), packageContent);
7289
+ await Bun.write(join7(destination, "README.md"), README_md_default.replace(/{{NAME}}/g, kebabName));
7290
+ await Bun.write(join7(destination, "tsconfig.json"), tsconfig_json_default);
7291
+ await Bun.write(join7(destination, ".zed", "settings.json"), zed_settings_json_default);
7270
7292
  const makeModuleCommand = new MakeModuleCommand;
7271
7293
  await makeModuleCommand.run({
7272
7294
  name: "app",
@@ -7275,22 +7297,22 @@ class MakeAppCommand {
7275
7297
  skipMigrations: true,
7276
7298
  skipSeeds: true
7277
7299
  });
7278
- const appModulePackagePath = join6(destination, "modules", "app", "package.json");
7300
+ const appModulePackagePath = join7(destination, "modules", "app", "package.json");
7279
7301
  const appModulePackageJson = await Bun.file(appModulePackagePath).json();
7280
7302
  appModulePackageJson.scripts.dev = "bun --hot run ./src/index.ts";
7281
7303
  appModulePackageJson.scripts.build = "bun build ./src/index.ts --outdir ./dist --target bun";
7282
7304
  await Bun.write(appModulePackagePath, JSON.stringify(appModulePackageJson, null, 2));
7283
7305
  const envContent = env_default.replace(/^DATABASE_URL=/m, 'DATABASE_URL="postgresql://ooneex:ooneex@localhost:5432/ooneex"').replace(/^CACHE_REDIS_URL=/m, 'CACHE_REDIS_URL="redis://localhost:6379"').replace(/^PUBSUB_REDIS_URL=/m, 'PUBSUB_REDIS_URL="redis://localhost:6379"').replace(/^RATE_LIMIT_REDIS_URL=/m, 'RATE_LIMIT_REDIS_URL="redis://localhost:6379"').replace(/^DATABASE_REDIS_URL=/m, 'DATABASE_REDIS_URL="redis://localhost:6379"');
7284
- await Bun.write(join6(destination, "modules", "app", ".env"), envContent);
7285
- await Bun.write(join6(destination, "modules", "app", ".env.example"), env_default);
7286
- await Bun.write(join6(destination, "modules", "app", "src", "databases", "AppDatabase.ts"), app_database_default);
7287
- await Bun.write(join6(destination, "modules", "app", "src", "index.ts"), index_ts_default);
7306
+ await Bun.write(join7(destination, "modules", "app", ".env"), envContent);
7307
+ await Bun.write(join7(destination, "modules", "app", ".env.example"), env_default);
7308
+ await Bun.write(join7(destination, "modules", "app", "src", "databases", "AppDatabase.ts"), app_database_default);
7309
+ await Bun.write(join7(destination, "modules", "app", "src", "index.ts"), index_ts_default);
7288
7310
  const snakeName = toSnakeCase(name);
7289
7311
  const dockerComposeContent = docker_compose_yml_default.replace(/{{NAME}}/g, snakeName);
7290
- await Bun.write(join6(destination, "modules", "app", "docker-compose.yml"), dockerComposeContent);
7312
+ await Bun.write(join7(destination, "modules", "app", "docker-compose.yml"), dockerComposeContent);
7291
7313
  const dockerfileContent = Dockerfile_default.replace(/{{NAME}}/g, snakeName);
7292
- await Bun.write(join6(destination, "modules", "app", "Dockerfile"), dockerfileContent);
7293
- await Bun.write(join6(destination, "modules", "app", "var", ".gitkeep"), "");
7314
+ await Bun.write(join7(destination, "modules", "app", "Dockerfile"), dockerfileContent);
7315
+ await Bun.write(join7(destination, "modules", "app", "var", ".gitkeep"), "");
7294
7316
  const makeControllerCommand = new MakeControllerCommand;
7295
7317
  await makeControllerCommand.run({
7296
7318
  name: "HealthCheck",
@@ -7340,6 +7362,7 @@ class MakeAppCommand {
7340
7362
  "bun",
7341
7363
  "add",
7342
7364
  "-D",
7365
+ "@ooneex/command",
7343
7366
  "@biomejs/biome",
7344
7367
  "@commitlint/cli",
7345
7368
  "@commitlint/config-conventional",
@@ -7359,8 +7382,8 @@ class MakeAppCommand {
7359
7382
  await addDevDeps.exited;
7360
7383
  const huskyInit = Bun.spawn(["bunx", "husky", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
7361
7384
  await huskyInit.exited;
7362
- await Bun.write(join6(destination, ".husky", "pre-commit"), "lint-staged");
7363
- await Bun.write(join6(destination, ".husky", "commit-msg"), `bunx commitlint --edit "$1"`);
7385
+ await Bun.write(join7(destination, ".husky", "pre-commit"), "lint-staged");
7386
+ await Bun.write(join7(destination, ".husky", "commit-msg"), `bunx commitlint --edit "$1"`);
7364
7387
  const logger = new TerminalLogger6;
7365
7388
  logger.success(`${kebabName} created successfully at ${destination}`, undefined, {
7366
7389
  showTimestamp: false,
@@ -7373,7 +7396,7 @@ MakeAppCommand = __legacyDecorateClassTS([
7373
7396
  decorator6.command()
7374
7397
  ], MakeAppCommand);
7375
7398
  // src/commands/MakeCacheCommand.ts
7376
- import { join as join7 } from "path";
7399
+ import { join as join8 } from "path";
7377
7400
  import { decorator as decorator7 } from "@ooneex/command";
7378
7401
  import { TerminalLogger as TerminalLogger7 } from "@ooneex/logger";
7379
7402
  import { toPascalCase as toPascalCase5 } from "@ooneex/utils";
@@ -7448,28 +7471,31 @@ class MakeCacheCommand {
7448
7471
  }
7449
7472
  name = toPascalCase5(name).replace(/Cache$/, "");
7450
7473
  const content = cache_default.replace(/{{NAME}}/g, name);
7451
- const base = module ? join7("modules", module) : ".";
7452
- const cacheLocalDir = join7(base, "src", "cache");
7453
- const cacheDir = join7(process.cwd(), cacheLocalDir);
7454
- const filePath = join7(cacheDir, `${name}Cache.ts`);
7474
+ if (module) {
7475
+ await ensureModule(module);
7476
+ }
7477
+ const base = module ? join8("modules", module) : ".";
7478
+ const cacheLocalDir = join8(base, "src", "cache");
7479
+ const cacheDir = join8(process.cwd(), cacheLocalDir);
7480
+ const filePath = join8(cacheDir, `${name}Cache.ts`);
7455
7481
  await Bun.write(filePath, content);
7456
7482
  const testContent = cache_test_default.replace(/{{NAME}}/g, name);
7457
- const testsLocalDir = join7(base, "tests", "cache");
7458
- const testsDir = join7(process.cwd(), testsLocalDir);
7459
- const testFilePath = join7(testsDir, `${name}Cache.spec.ts`);
7483
+ const testsLocalDir = join8(base, "tests", "cache");
7484
+ const testsDir = join8(process.cwd(), testsLocalDir);
7485
+ const testFilePath = join8(testsDir, `${name}Cache.spec.ts`);
7460
7486
  await Bun.write(testFilePath, testContent);
7461
7487
  const logger = new TerminalLogger7;
7462
- logger.success(`${join7(cacheLocalDir, name)}Cache.ts created successfully`, undefined, {
7488
+ logger.success(`${join8(cacheLocalDir, name)}Cache.ts created successfully`, undefined, {
7463
7489
  showTimestamp: false,
7464
7490
  showArrow: false,
7465
7491
  useSymbol: true
7466
7492
  });
7467
- logger.success(`${join7(testsLocalDir, name)}Cache.spec.ts created successfully`, undefined, {
7493
+ logger.success(`${join8(testsLocalDir, name)}Cache.spec.ts created successfully`, undefined, {
7468
7494
  showTimestamp: false,
7469
7495
  showArrow: false,
7470
7496
  useSymbol: true
7471
7497
  });
7472
- const packageJsonPath = join7(process.cwd(), "package.json");
7498
+ const packageJsonPath = join8(process.cwd(), "package.json");
7473
7499
  const packageJson = await Bun.file(packageJsonPath).json();
7474
7500
  const deps = packageJson.dependencies ?? {};
7475
7501
  const devDeps = packageJson.devDependencies ?? {};
@@ -7487,7 +7513,7 @@ MakeCacheCommand = __legacyDecorateClassTS([
7487
7513
  decorator7.command()
7488
7514
  ], MakeCacheCommand);
7489
7515
  // src/commands/MakeClaudeSkillCommand.ts
7490
- import { join as join8 } from "path";
7516
+ import { join as join9 } from "path";
7491
7517
  import { decorator as decorator8 } from "@ooneex/command";
7492
7518
  import { TerminalLogger as TerminalLogger8 } from "@ooneex/logger";
7493
7519
 
@@ -7776,14 +7802,14 @@ class MakeClaudeSkillCommand {
7776
7802
  return "Generate Claude skills from templates";
7777
7803
  }
7778
7804
  async run() {
7779
- const skillsLocalDir = join8(".claude", "skills");
7780
- const skillsDir = join8(process.cwd(), skillsLocalDir);
7805
+ const skillsLocalDir = join9(".claude", "skills");
7806
+ const skillsDir = join9(process.cwd(), skillsLocalDir);
7781
7807
  const logger = new TerminalLogger8;
7782
7808
  for (const [skillName, content] of Object.entries(skills)) {
7783
7809
  const dirName = skillName.replace(/\./g, "-");
7784
- const filePath = join8(skillsDir, dirName, "SKILL.md");
7810
+ const filePath = join9(skillsDir, dirName, "SKILL.md");
7785
7811
  await Bun.write(filePath, content);
7786
- logger.success(`${join8(skillsLocalDir, dirName, "SKILL.md")} created successfully`, undefined, {
7812
+ logger.success(`${join9(skillsLocalDir, dirName, "SKILL.md")} created successfully`, undefined, {
7787
7813
  showTimestamp: false,
7788
7814
  showArrow: false,
7789
7815
  useSymbol: true
@@ -7795,7 +7821,7 @@ MakeClaudeSkillCommand = __legacyDecorateClassTS([
7795
7821
  decorator8.command()
7796
7822
  ], MakeClaudeSkillCommand);
7797
7823
  // src/commands/MakeCommandCommand.ts
7798
- import { join as join9 } from "path";
7824
+ import { join as join10 } from "path";
7799
7825
  import { commandCreate, decorator as decorator9 } from "@ooneex/command";
7800
7826
  import { TerminalLogger as TerminalLogger9 } from "@ooneex/logger";
7801
7827
  class MakeCommandCommand {
@@ -7810,14 +7836,17 @@ class MakeCommandCommand {
7810
7836
  if (!name) {
7811
7837
  name = await askName({ message: "Enter name" });
7812
7838
  }
7813
- const base = module ? join9("modules", module) : ".";
7839
+ if (module) {
7840
+ await ensureModule(module);
7841
+ }
7842
+ const base = module ? join10("modules", module) : ".";
7814
7843
  const { commandPath, testPath } = await commandCreate({
7815
7844
  name,
7816
- commandDir: join9(base, "src", "commands"),
7817
- testsDir: join9(base, "tests", "commands")
7845
+ commandDir: join10(base, "src", "commands"),
7846
+ testsDir: join10(base, "tests", "commands")
7818
7847
  });
7819
7848
  if (module && module !== "app") {
7820
- const appCommandsRootPath = join9(process.cwd(), "modules", "app", "src", "commands", "commands.ts");
7849
+ const appCommandsRootPath = join10(process.cwd(), "modules", "app", "src", "commands", "commands.ts");
7821
7850
  const appCommandsRootFile = Bun.file(appCommandsRootPath);
7822
7851
  const importLine = `import "@${module}/commands/commands";`;
7823
7852
  if (await appCommandsRootFile.exists()) {
@@ -7832,12 +7861,12 @@ ${importLine}
7832
7861
  `);
7833
7862
  }
7834
7863
  }
7835
- const binCommandRunPath = join9(process.cwd(), "modules", "app", "bin", "command", "run.ts");
7864
+ const binCommandRunPath = join10(process.cwd(), "modules", "app", "bin", "command", "run.ts");
7836
7865
  const binCommandRunFile = Bun.file(binCommandRunPath);
7837
7866
  if (!await binCommandRunFile.exists()) {
7838
7867
  await Bun.write(binCommandRunPath, command_run_default);
7839
7868
  }
7840
- const packageJsonPath = join9(process.cwd(), "modules", "app", "package.json");
7869
+ const packageJsonPath = join10(process.cwd(), "modules", "app", "package.json");
7841
7870
  const packageJsonFile = Bun.file(packageJsonPath);
7842
7871
  if (await packageJsonFile.exists()) {
7843
7872
  const packageJson = await packageJsonFile.json();
@@ -7867,7 +7896,7 @@ MakeCommandCommand = __legacyDecorateClassTS([
7867
7896
  decorator9.command()
7868
7897
  ], MakeCommandCommand);
7869
7898
  // src/commands/MakeCronCommand.ts
7870
- import { basename as basename2, join as join10 } from "path";
7899
+ import { basename as basename2, join as join11 } from "path";
7871
7900
  import { decorator as decorator10 } from "@ooneex/command";
7872
7901
  import { TerminalLogger as TerminalLogger10 } from "@ooneex/logger";
7873
7902
  import { toPascalCase as toPascalCase6 } from "@ooneex/utils";
@@ -7955,33 +7984,36 @@ class MakeCronCommand {
7955
7984
  }
7956
7985
  name = toPascalCase6(name).replace(/Cron$/, "");
7957
7986
  const content = cron_default.replace(/{{NAME}}/g, name);
7958
- const base = module ? join10("modules", module) : ".";
7959
- const cronLocalDir = join10(base, "src", "crons");
7960
- const cronDir = join10(process.cwd(), cronLocalDir);
7961
- const filePath = join10(cronDir, `${name}Cron.ts`);
7987
+ if (module) {
7988
+ await ensureModule(module);
7989
+ }
7990
+ const base = module ? join11("modules", module) : ".";
7991
+ const cronLocalDir = join11(base, "src", "crons");
7992
+ const cronDir = join11(process.cwd(), cronLocalDir);
7993
+ const filePath = join11(cronDir, `${name}Cron.ts`);
7962
7994
  await Bun.write(filePath, content);
7963
7995
  const testContent = cron_test_default.replace(/{{NAME}}/g, name);
7964
- const testsLocalDir = join10(base, "tests", "crons");
7965
- const testsDir = join10(process.cwd(), testsLocalDir);
7966
- const testFilePath = join10(testsDir, `${name}Cron.spec.ts`);
7996
+ const testsLocalDir = join11(base, "tests", "crons");
7997
+ const testsDir = join11(process.cwd(), testsLocalDir);
7998
+ const testFilePath = join11(testsDir, `${name}Cron.spec.ts`);
7967
7999
  await Bun.write(testFilePath, testContent);
7968
8000
  const modulePascalName = module ? toPascalCase6(module) : toPascalCase6(basename2(process.cwd()));
7969
- const modulePath = join10(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
8001
+ const modulePath = join11(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
7970
8002
  if (await Bun.file(modulePath).exists()) {
7971
8003
  await this.addToModule(modulePath, name);
7972
8004
  }
7973
8005
  const logger = new TerminalLogger10;
7974
- logger.success(`${join10(cronLocalDir, name)}Cron.ts created successfully`, undefined, {
8006
+ logger.success(`${join11(cronLocalDir, name)}Cron.ts created successfully`, undefined, {
7975
8007
  showTimestamp: false,
7976
8008
  showArrow: false,
7977
8009
  useSymbol: true
7978
8010
  });
7979
- logger.success(`${join10(testsLocalDir, name)}Cron.spec.ts created successfully`, undefined, {
8011
+ logger.success(`${join11(testsLocalDir, name)}Cron.spec.ts created successfully`, undefined, {
7980
8012
  showTimestamp: false,
7981
8013
  showArrow: false,
7982
8014
  useSymbol: true
7983
8015
  });
7984
- const packageJsonPath = join10(process.cwd(), "package.json");
8016
+ const packageJsonPath = join11(process.cwd(), "package.json");
7985
8017
  const packageJson = await Bun.file(packageJsonPath).json();
7986
8018
  const deps = packageJson.dependencies ?? {};
7987
8019
  const devDeps = packageJson.devDependencies ?? {};
@@ -7999,7 +8031,7 @@ MakeCronCommand = __legacyDecorateClassTS([
7999
8031
  decorator10.command()
8000
8032
  ], MakeCronCommand);
8001
8033
  // src/commands/MakeDatabaseCommand.ts
8002
- import { join as join11 } from "path";
8034
+ import { join as join12 } from "path";
8003
8035
  import { decorator as decorator11 } from "@ooneex/command";
8004
8036
  import { TerminalLogger as TerminalLogger11 } from "@ooneex/logger";
8005
8037
  import { toPascalCase as toPascalCase7 } from "@ooneex/utils";
@@ -8061,28 +8093,31 @@ class MakeDatabaseCommand {
8061
8093
  }
8062
8094
  name = toPascalCase7(name).replace(/DatabaseAdapter$/, "").replace(/Database$/, "");
8063
8095
  const content = database_default.replace(/{{NAME}}/g, name);
8064
- const base = module ? join11("modules", module) : ".";
8065
- const databaseLocalDir = join11(base, "src", "databases");
8066
- const databaseDir = join11(process.cwd(), databaseLocalDir);
8067
- const filePath = join11(databaseDir, `${name}Database.ts`);
8096
+ if (module) {
8097
+ await ensureModule(module);
8098
+ }
8099
+ const base = module ? join12("modules", module) : ".";
8100
+ const databaseLocalDir = join12(base, "src", "databases");
8101
+ const databaseDir = join12(process.cwd(), databaseLocalDir);
8102
+ const filePath = join12(databaseDir, `${name}Database.ts`);
8068
8103
  await Bun.write(filePath, content);
8069
8104
  const testContent = database_test_default.replace(/{{NAME}}/g, name);
8070
- const testsLocalDir = join11(base, "tests", "databases");
8071
- const testsDir = join11(process.cwd(), testsLocalDir);
8072
- const testFilePath = join11(testsDir, `${name}Database.spec.ts`);
8105
+ const testsLocalDir = join12(base, "tests", "databases");
8106
+ const testsDir = join12(process.cwd(), testsLocalDir);
8107
+ const testFilePath = join12(testsDir, `${name}Database.spec.ts`);
8073
8108
  await Bun.write(testFilePath, testContent);
8074
8109
  const logger = new TerminalLogger11;
8075
- logger.success(`${join11(databaseLocalDir, name)}Database.ts created successfully`, undefined, {
8110
+ logger.success(`${join12(databaseLocalDir, name)}Database.ts created successfully`, undefined, {
8076
8111
  showTimestamp: false,
8077
8112
  showArrow: false,
8078
8113
  useSymbol: true
8079
8114
  });
8080
- logger.success(`${join11(testsLocalDir, name)}Database.spec.ts created successfully`, undefined, {
8115
+ logger.success(`${join12(testsLocalDir, name)}Database.spec.ts created successfully`, undefined, {
8081
8116
  showTimestamp: false,
8082
8117
  showArrow: false,
8083
8118
  useSymbol: true
8084
8119
  });
8085
- const packageJsonPath = join11(process.cwd(), "package.json");
8120
+ const packageJsonPath = join12(process.cwd(), "package.json");
8086
8121
  const packageJson = await Bun.file(packageJsonPath).json();
8087
8122
  const deps = packageJson.dependencies ?? {};
8088
8123
  const devDeps = packageJson.devDependencies ?? {};
@@ -8100,7 +8135,7 @@ MakeDatabaseCommand = __legacyDecorateClassTS([
8100
8135
  decorator11.command()
8101
8136
  ], MakeDatabaseCommand);
8102
8137
  // src/commands/MakeDockerCommand.ts
8103
- import { join as join12 } from "path";
8138
+ import { join as join13 } from "path";
8104
8139
  import { decorator as decorator12 } from "@ooneex/command";
8105
8140
  import { TerminalLogger as TerminalLogger12 } from "@ooneex/logger";
8106
8141
  var {YAML } = globalThis.Bun;
@@ -8595,8 +8630,8 @@ class MakeDockerCommand {
8595
8630
  name = await askDockerService({ message: "Select docker service" });
8596
8631
  }
8597
8632
  const templateContent = templates[name];
8598
- const base = join12("modules", "app");
8599
- const composePath = join12(process.cwd(), base, "docker-compose.yml");
8633
+ const base = join13("modules", "app");
8634
+ const composePath = join13(process.cwd(), base, "docker-compose.yml");
8600
8635
  const logger = new TerminalLogger12;
8601
8636
  const composeFile = Bun.file(composePath);
8602
8637
  if (await composeFile.exists()) {
@@ -8656,7 +8691,7 @@ volumes:
8656
8691
  } else {
8657
8692
  await Bun.write(composePath, templateContent);
8658
8693
  }
8659
- const packageJsonPath = join12(process.cwd(), base, "package.json");
8694
+ const packageJsonPath = join13(process.cwd(), base, "package.json");
8660
8695
  const packageJsonFile = Bun.file(packageJsonPath);
8661
8696
  if (await packageJsonFile.exists()) {
8662
8697
  const packageJson = await packageJsonFile.json();
@@ -8681,7 +8716,7 @@ MakeDockerCommand = __legacyDecorateClassTS([
8681
8716
  ], MakeDockerCommand);
8682
8717
  // src/commands/MakeEntityCommand.ts
8683
8718
  var import_pluralize = __toESM(require_pluralize(), 1);
8684
- import { basename as basename3, join as join13 } from "path";
8719
+ import { basename as basename3, join as join14 } from "path";
8685
8720
  import { decorator as decorator13 } from "@ooneex/command";
8686
8721
  import { TerminalLogger as TerminalLogger13 } from "@ooneex/logger";
8687
8722
  import { toPascalCase as toPascalCase8, toSnakeCase as toSnakeCase2 } from "@ooneex/utils";
@@ -8844,28 +8879,31 @@ class MakeEntityCommand {
8844
8879
  tableName = toSnakeCase2(import_pluralize.default(name));
8845
8880
  }
8846
8881
  const content = entity_default.replace(/{{NAME}}/g, name).replace(/{{TABLE_NAME}}/g, tableName);
8847
- const base = module ? join13("modules", module) : ".";
8848
- const entitiesLocalDir = join13(base, "src", "entities");
8849
- const entitiesDir = join13(process.cwd(), entitiesLocalDir);
8850
- const filePath = join13(entitiesDir, `${name}Entity.ts`);
8882
+ if (module) {
8883
+ await ensureModule(module);
8884
+ }
8885
+ const base = module ? join14("modules", module) : ".";
8886
+ const entitiesLocalDir = join14(base, "src", "entities");
8887
+ const entitiesDir = join14(process.cwd(), entitiesLocalDir);
8888
+ const filePath = join14(entitiesDir, `${name}Entity.ts`);
8851
8889
  await Bun.write(filePath, content);
8852
8890
  const testContent = entity_test_default.replace(/{{NAME}}/g, name);
8853
- const testsLocalDir = join13(base, "tests", "entities");
8854
- const testsDir = join13(process.cwd(), testsLocalDir);
8855
- const testFilePath = join13(testsDir, `${name}Entity.spec.ts`);
8891
+ const testsLocalDir = join14(base, "tests", "entities");
8892
+ const testsDir = join14(process.cwd(), testsLocalDir);
8893
+ const testFilePath = join14(testsDir, `${name}Entity.spec.ts`);
8856
8894
  await Bun.write(testFilePath, testContent);
8857
8895
  const modulePascalName = module ? toPascalCase8(module) : toPascalCase8(basename3(process.cwd()));
8858
- const modulePath = join13(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
8896
+ const modulePath = join14(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
8859
8897
  if (await Bun.file(modulePath).exists()) {
8860
8898
  await this.addToModule(modulePath, name);
8861
8899
  }
8862
8900
  const logger = new TerminalLogger13;
8863
- logger.success(`${join13(entitiesLocalDir, name)}Entity.ts created successfully`, undefined, {
8901
+ logger.success(`${join14(entitiesLocalDir, name)}Entity.ts created successfully`, undefined, {
8864
8902
  showTimestamp: false,
8865
8903
  showArrow: false,
8866
8904
  useSymbol: true
8867
8905
  });
8868
- logger.success(`${join13(testsLocalDir, name)}Entity.spec.ts created successfully`, undefined, {
8906
+ logger.success(`${join14(testsLocalDir, name)}Entity.spec.ts created successfully`, undefined, {
8869
8907
  showTimestamp: false,
8870
8908
  showArrow: false,
8871
8909
  useSymbol: true
@@ -8876,7 +8914,7 @@ MakeEntityCommand = __legacyDecorateClassTS([
8876
8914
  decorator13.command()
8877
8915
  ], MakeEntityCommand);
8878
8916
  // src/commands/MakeLoggerCommand.ts
8879
- import { join as join14 } from "path";
8917
+ import { join as join15 } from "path";
8880
8918
  import { decorator as decorator14 } from "@ooneex/command";
8881
8919
  import { TerminalLogger as TerminalLogger14 } from "@ooneex/logger";
8882
8920
  import { toPascalCase as toPascalCase9 } from "@ooneex/utils";
@@ -8980,28 +9018,31 @@ class MakeLoggerCommand {
8980
9018
  }
8981
9019
  name = toPascalCase9(name).replace(/Logger$/, "");
8982
9020
  const content = logger_default.replace(/{{NAME}}/g, name);
8983
- const base = module ? join14("modules", module) : ".";
8984
- const loggerLocalDir = join14(base, "src", "loggers");
8985
- const loggerDir = join14(process.cwd(), loggerLocalDir);
8986
- const filePath = join14(loggerDir, `${name}Logger.ts`);
9021
+ if (module) {
9022
+ await ensureModule(module);
9023
+ }
9024
+ const base = module ? join15("modules", module) : ".";
9025
+ const loggerLocalDir = join15(base, "src", "loggers");
9026
+ const loggerDir = join15(process.cwd(), loggerLocalDir);
9027
+ const filePath = join15(loggerDir, `${name}Logger.ts`);
8987
9028
  await Bun.write(filePath, content);
8988
9029
  const testContent = logger_test_default.replace(/{{NAME}}/g, name);
8989
- const testsLocalDir = join14(base, "tests", "loggers");
8990
- const testsDir = join14(process.cwd(), testsLocalDir);
8991
- const testFilePath = join14(testsDir, `${name}Logger.spec.ts`);
9030
+ const testsLocalDir = join15(base, "tests", "loggers");
9031
+ const testsDir = join15(process.cwd(), testsLocalDir);
9032
+ const testFilePath = join15(testsDir, `${name}Logger.spec.ts`);
8992
9033
  await Bun.write(testFilePath, testContent);
8993
9034
  const logger = new TerminalLogger14;
8994
- logger.success(`${join14(loggerLocalDir, name)}Logger.ts created successfully`, undefined, {
9035
+ logger.success(`${join15(loggerLocalDir, name)}Logger.ts created successfully`, undefined, {
8995
9036
  showTimestamp: false,
8996
9037
  showArrow: false,
8997
9038
  useSymbol: true
8998
9039
  });
8999
- logger.success(`${join14(testsLocalDir, name)}Logger.spec.ts created successfully`, undefined, {
9040
+ logger.success(`${join15(testsLocalDir, name)}Logger.spec.ts created successfully`, undefined, {
9000
9041
  showTimestamp: false,
9001
9042
  showArrow: false,
9002
9043
  useSymbol: true
9003
9044
  });
9004
- const packageJsonPath = join14(process.cwd(), "package.json");
9045
+ const packageJsonPath = join15(process.cwd(), "package.json");
9005
9046
  const packageJson = await Bun.file(packageJsonPath).json();
9006
9047
  const deps = packageJson.dependencies ?? {};
9007
9048
  const devDeps = packageJson.devDependencies ?? {};
@@ -9019,7 +9060,7 @@ MakeLoggerCommand = __legacyDecorateClassTS([
9019
9060
  decorator14.command()
9020
9061
  ], MakeLoggerCommand);
9021
9062
  // src/commands/MakeMailerCommand.ts
9022
- import { join as join15 } from "path";
9063
+ import { join as join16 } from "path";
9023
9064
  import { decorator as decorator15 } from "@ooneex/command";
9024
9065
  import { TerminalLogger as TerminalLogger15 } from "@ooneex/logger";
9025
9066
  import { toPascalCase as toPascalCase10 } from "@ooneex/utils";
@@ -9116,43 +9157,46 @@ class MakeMailerCommand {
9116
9157
  name = toPascalCase10(name).replace(/Mailer$/, "");
9117
9158
  const mailerContent = mailer_default.replace(/{{NAME}}/g, name);
9118
9159
  const templateContent = mailer_template_default.replace(/{{NAME}}/g, name);
9119
- const base = module ? join15("modules", module) : ".";
9120
- const mailerLocalDir = join15(base, "src", "mailers");
9121
- const mailerDir = join15(process.cwd(), mailerLocalDir);
9122
- const mailerFilePath = join15(mailerDir, `${name}Mailer.ts`);
9123
- const templateFilePath = join15(mailerDir, `${name}MailerTemplate.tsx`);
9160
+ if (module) {
9161
+ await ensureModule(module);
9162
+ }
9163
+ const base = module ? join16("modules", module) : ".";
9164
+ const mailerLocalDir = join16(base, "src", "mailers");
9165
+ const mailerDir = join16(process.cwd(), mailerLocalDir);
9166
+ const mailerFilePath = join16(mailerDir, `${name}Mailer.ts`);
9167
+ const templateFilePath = join16(mailerDir, `${name}MailerTemplate.tsx`);
9124
9168
  await Bun.write(mailerFilePath, mailerContent);
9125
9169
  await Bun.write(templateFilePath, templateContent);
9126
9170
  const mailerTestContent = mailer_test_default.replace(/{{NAME}}/g, name);
9127
9171
  const templateTestContent = mailer_template_test_default.replace(/{{NAME}}/g, name);
9128
- const testsLocalDir = join15(base, "tests", "mailers");
9129
- const testsDir = join15(process.cwd(), testsLocalDir);
9130
- const mailerTestFilePath = join15(testsDir, `${name}Mailer.spec.ts`);
9131
- const templateTestFilePath = join15(testsDir, `${name}MailerTemplate.spec.ts`);
9172
+ const testsLocalDir = join16(base, "tests", "mailers");
9173
+ const testsDir = join16(process.cwd(), testsLocalDir);
9174
+ const mailerTestFilePath = join16(testsDir, `${name}Mailer.spec.ts`);
9175
+ const templateTestFilePath = join16(testsDir, `${name}MailerTemplate.spec.ts`);
9132
9176
  await Bun.write(mailerTestFilePath, mailerTestContent);
9133
9177
  await Bun.write(templateTestFilePath, templateTestContent);
9134
9178
  const logger = new TerminalLogger15;
9135
- logger.success(`${join15(mailerLocalDir, name)}Mailer.ts created successfully`, undefined, {
9179
+ logger.success(`${join16(mailerLocalDir, name)}Mailer.ts created successfully`, undefined, {
9136
9180
  showTimestamp: false,
9137
9181
  showArrow: false,
9138
9182
  useSymbol: true
9139
9183
  });
9140
- logger.success(`${join15(mailerLocalDir, name)}MailerTemplate.tsx created successfully`, undefined, {
9184
+ logger.success(`${join16(mailerLocalDir, name)}MailerTemplate.tsx created successfully`, undefined, {
9141
9185
  showTimestamp: false,
9142
9186
  showArrow: false,
9143
9187
  useSymbol: true
9144
9188
  });
9145
- logger.success(`${join15(testsLocalDir, name)}Mailer.spec.ts created successfully`, undefined, {
9189
+ logger.success(`${join16(testsLocalDir, name)}Mailer.spec.ts created successfully`, undefined, {
9146
9190
  showTimestamp: false,
9147
9191
  showArrow: false,
9148
9192
  useSymbol: true
9149
9193
  });
9150
- logger.success(`${join15(testsLocalDir, name)}MailerTemplate.spec.ts created successfully`, undefined, {
9194
+ logger.success(`${join16(testsLocalDir, name)}MailerTemplate.spec.ts created successfully`, undefined, {
9151
9195
  showTimestamp: false,
9152
9196
  showArrow: false,
9153
9197
  useSymbol: true
9154
9198
  });
9155
- const packageJsonPath = join15(process.cwd(), "package.json");
9199
+ const packageJsonPath = join16(process.cwd(), "package.json");
9156
9200
  const packageJson = await Bun.file(packageJsonPath).json();
9157
9201
  const deps = packageJson.dependencies ?? {};
9158
9202
  const devDeps = packageJson.devDependencies ?? {};
@@ -9170,7 +9214,7 @@ MakeMailerCommand = __legacyDecorateClassTS([
9170
9214
  decorator15.command()
9171
9215
  ], MakeMailerCommand);
9172
9216
  // src/commands/MakeMiddlewareCommand.ts
9173
- import { basename as basename4, join as join16 } from "path";
9217
+ import { basename as basename4, join as join17 } from "path";
9174
9218
  import { decorator as decorator16 } from "@ooneex/command";
9175
9219
  import { TerminalLogger as TerminalLogger16 } from "@ooneex/logger";
9176
9220
  import { toPascalCase as toPascalCase11 } from "@ooneex/utils";
@@ -9258,33 +9302,36 @@ class MakeMiddlewareCommand {
9258
9302
  name = toPascalCase11(name).replace(/Middleware$/, "");
9259
9303
  const selectedTemplate = isSocket ? middleware_socket_default : middleware_default;
9260
9304
  const content = selectedTemplate.replace(/{{NAME}}/g, name);
9261
- const base = module ? join16("modules", module) : ".";
9262
- const middlewareLocalDir = join16(base, "src", "middlewares");
9263
- const middlewareDir = join16(process.cwd(), middlewareLocalDir);
9264
- const filePath = join16(middlewareDir, `${name}Middleware.ts`);
9305
+ if (module) {
9306
+ await ensureModule(module);
9307
+ }
9308
+ const base = module ? join17("modules", module) : ".";
9309
+ const middlewareLocalDir = join17(base, "src", "middlewares");
9310
+ const middlewareDir = join17(process.cwd(), middlewareLocalDir);
9311
+ const filePath = join17(middlewareDir, `${name}Middleware.ts`);
9265
9312
  await Bun.write(filePath, content);
9266
9313
  const testContent = middleware_test_default.replace(/{{NAME}}/g, name);
9267
- const testsLocalDir = join16(base, "tests", "middlewares");
9268
- const testsDir = join16(process.cwd(), testsLocalDir);
9269
- const testFilePath = join16(testsDir, `${name}Middleware.spec.ts`);
9314
+ const testsLocalDir = join17(base, "tests", "middlewares");
9315
+ const testsDir = join17(process.cwd(), testsLocalDir);
9316
+ const testFilePath = join17(testsDir, `${name}Middleware.spec.ts`);
9270
9317
  await Bun.write(testFilePath, testContent);
9271
9318
  const modulePascalName = module ? toPascalCase11(module) : toPascalCase11(basename4(process.cwd()));
9272
- const modulePath = join16(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
9319
+ const modulePath = join17(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
9273
9320
  if (await Bun.file(modulePath).exists()) {
9274
9321
  await this.addToModule(modulePath, name);
9275
9322
  }
9276
9323
  const logger = new TerminalLogger16;
9277
- logger.success(`${join16(middlewareLocalDir, name)}Middleware.ts created successfully`, undefined, {
9324
+ logger.success(`${join17(middlewareLocalDir, name)}Middleware.ts created successfully`, undefined, {
9278
9325
  showTimestamp: false,
9279
9326
  showArrow: false,
9280
9327
  useSymbol: true
9281
9328
  });
9282
- logger.success(`${join16(testsLocalDir, name)}Middleware.spec.ts created successfully`, undefined, {
9329
+ logger.success(`${join17(testsLocalDir, name)}Middleware.spec.ts created successfully`, undefined, {
9283
9330
  showTimestamp: false,
9284
9331
  showArrow: false,
9285
9332
  useSymbol: true
9286
9333
  });
9287
- const packageJsonPath = join16(process.cwd(), "package.json");
9334
+ const packageJsonPath = join17(process.cwd(), "package.json");
9288
9335
  const packageJson = await Bun.file(packageJsonPath).json();
9289
9336
  const deps = packageJson.dependencies ?? {};
9290
9337
  const devDeps = packageJson.devDependencies ?? {};
@@ -9302,7 +9349,7 @@ MakeMiddlewareCommand = __legacyDecorateClassTS([
9302
9349
  decorator16.command()
9303
9350
  ], MakeMiddlewareCommand);
9304
9351
  // src/commands/MakeMigrationCommand.ts
9305
- import { join as join17 } from "path";
9352
+ import { join as join18 } from "path";
9306
9353
  import { decorator as decorator17 } from "@ooneex/command";
9307
9354
  import { TerminalLogger as TerminalLogger17 } from "@ooneex/logger";
9308
9355
  import { migrationCreate } from "@ooneex/migrations";
@@ -9329,17 +9376,20 @@ class MakeMigrationCommand {
9329
9376
  }
9330
9377
  async run(options) {
9331
9378
  const { module } = options;
9332
- const base = module ? join17("modules", module) : ".";
9379
+ if (module) {
9380
+ await ensureModule(module);
9381
+ }
9382
+ const base = module ? join18("modules", module) : ".";
9333
9383
  const { migrationPath: filePath } = await migrationCreate({
9334
- migrationsDir: join17(base, "src", "migrations"),
9335
- testsDir: join17(base, "tests", "migrations")
9384
+ migrationsDir: join18(base, "src", "migrations"),
9385
+ testsDir: join18(base, "tests", "migrations")
9336
9386
  });
9337
- const binMigrationUpPath = join17(process.cwd(), base, "bin", "migration", "up.ts");
9387
+ const binMigrationUpPath = join18(process.cwd(), base, "bin", "migration", "up.ts");
9338
9388
  const binMigrationUpFile = Bun.file(binMigrationUpPath);
9339
9389
  if (!await binMigrationUpFile.exists()) {
9340
9390
  await Bun.write(binMigrationUpPath, migration_up_default);
9341
9391
  }
9342
- const packageJsonPath = join17(process.cwd(), "package.json");
9392
+ const packageJsonPath = join18(process.cwd(), "package.json");
9343
9393
  const packageJsonFile = Bun.file(packageJsonPath);
9344
9394
  if (await packageJsonFile.exists()) {
9345
9395
  const packageJson = await packageJsonFile.json();
@@ -9375,7 +9425,7 @@ MakeMigrationCommand = __legacyDecorateClassTS([
9375
9425
  decorator17.command()
9376
9426
  ], MakeMigrationCommand);
9377
9427
  // src/commands/MakePermissionCommand.ts
9378
- import { join as join18 } from "path";
9428
+ import { join as join19 } from "path";
9379
9429
  import { decorator as decorator18 } from "@ooneex/command";
9380
9430
  import { TerminalLogger as TerminalLogger18 } from "@ooneex/logger";
9381
9431
  import { toPascalCase as toPascalCase12 } from "@ooneex/utils";
@@ -9465,28 +9515,31 @@ class MakePermissionCommand {
9465
9515
  }
9466
9516
  name = toPascalCase12(name).replace(/Permission$/, "");
9467
9517
  const content = permission_default.replace(/{{NAME}}/g, name);
9468
- const base = module ? join18("modules", module) : ".";
9469
- const permissionLocalDir = join18(base, "src", "permissions");
9470
- const permissionDir = join18(process.cwd(), permissionLocalDir);
9471
- const filePath = join18(permissionDir, `${name}Permission.ts`);
9518
+ if (module) {
9519
+ await ensureModule(module);
9520
+ }
9521
+ const base = module ? join19("modules", module) : ".";
9522
+ const permissionLocalDir = join19(base, "src", "permissions");
9523
+ const permissionDir = join19(process.cwd(), permissionLocalDir);
9524
+ const filePath = join19(permissionDir, `${name}Permission.ts`);
9472
9525
  await Bun.write(filePath, content);
9473
9526
  const testContent = permission_test_default.replace(/{{NAME}}/g, name);
9474
- const testsLocalDir = join18(base, "tests", "permissions");
9475
- const testsDir = join18(process.cwd(), testsLocalDir);
9476
- const testFilePath = join18(testsDir, `${name}Permission.spec.ts`);
9527
+ const testsLocalDir = join19(base, "tests", "permissions");
9528
+ const testsDir = join19(process.cwd(), testsLocalDir);
9529
+ const testFilePath = join19(testsDir, `${name}Permission.spec.ts`);
9477
9530
  await Bun.write(testFilePath, testContent);
9478
9531
  const logger = new TerminalLogger18;
9479
- logger.success(`${join18(permissionLocalDir, name)}Permission.ts created successfully`, undefined, {
9532
+ logger.success(`${join19(permissionLocalDir, name)}Permission.ts created successfully`, undefined, {
9480
9533
  showTimestamp: false,
9481
9534
  showArrow: false,
9482
9535
  useSymbol: true
9483
9536
  });
9484
- logger.success(`${join18(testsLocalDir, name)}Permission.spec.ts created successfully`, undefined, {
9537
+ logger.success(`${join19(testsLocalDir, name)}Permission.spec.ts created successfully`, undefined, {
9485
9538
  showTimestamp: false,
9486
9539
  showArrow: false,
9487
9540
  useSymbol: true
9488
9541
  });
9489
- const packageJsonPath = join18(process.cwd(), "package.json");
9542
+ const packageJsonPath = join19(process.cwd(), "package.json");
9490
9543
  const packageJson = await Bun.file(packageJsonPath).json();
9491
9544
  const deps = packageJson.dependencies ?? {};
9492
9545
  const devDeps = packageJson.devDependencies ?? {};
@@ -9504,7 +9557,7 @@ MakePermissionCommand = __legacyDecorateClassTS([
9504
9557
  decorator18.command()
9505
9558
  ], MakePermissionCommand);
9506
9559
  // src/commands/MakePubSubCommand.ts
9507
- import { basename as basename5, join as join19 } from "path";
9560
+ import { basename as basename5, join as join20 } from "path";
9508
9561
  import { decorator as decorator19 } from "@ooneex/command";
9509
9562
  import { TerminalLogger as TerminalLogger19 } from "@ooneex/logger";
9510
9563
  import { toKebabCase as toKebabCase4, toPascalCase as toPascalCase13 } from "@ooneex/utils";
@@ -9611,33 +9664,36 @@ class MakePubSubCommand {
9611
9664
  channel = toKebabCase4(name);
9612
9665
  }
9613
9666
  const content = pubsub_default.replace(/{{NAME}}/g, name).replace(/{{CHANNEL}}/g, channel);
9614
- const base = module ? join19("modules", module) : ".";
9615
- const pubSubLocalDir = join19(base, "src", "events");
9616
- const pubSubDir = join19(process.cwd(), pubSubLocalDir);
9617
- const filePath = join19(pubSubDir, `${name}Event.ts`);
9667
+ if (module) {
9668
+ await ensureModule(module);
9669
+ }
9670
+ const base = module ? join20("modules", module) : ".";
9671
+ const pubSubLocalDir = join20(base, "src", "events");
9672
+ const pubSubDir = join20(process.cwd(), pubSubLocalDir);
9673
+ const filePath = join20(pubSubDir, `${name}Event.ts`);
9618
9674
  await Bun.write(filePath, content);
9619
9675
  const testContent = pubsub_test_default.replace(/{{NAME}}/g, name);
9620
- const testsLocalDir = join19(base, "tests", "events");
9621
- const testsDir = join19(process.cwd(), testsLocalDir);
9622
- const testFilePath = join19(testsDir, `${name}Event.spec.ts`);
9676
+ const testsLocalDir = join20(base, "tests", "events");
9677
+ const testsDir = join20(process.cwd(), testsLocalDir);
9678
+ const testFilePath = join20(testsDir, `${name}Event.spec.ts`);
9623
9679
  await Bun.write(testFilePath, testContent);
9624
9680
  const modulePascalName = module ? toPascalCase13(module) : toPascalCase13(basename5(process.cwd()));
9625
- const modulePath = join19(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
9681
+ const modulePath = join20(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
9626
9682
  if (await Bun.file(modulePath).exists()) {
9627
9683
  await this.addToModule(modulePath, name);
9628
9684
  }
9629
9685
  const logger = new TerminalLogger19;
9630
- logger.success(`${join19(pubSubLocalDir, name)}Event.ts created successfully`, undefined, {
9686
+ logger.success(`${join20(pubSubLocalDir, name)}Event.ts created successfully`, undefined, {
9631
9687
  showTimestamp: false,
9632
9688
  showArrow: false,
9633
9689
  useSymbol: true
9634
9690
  });
9635
- logger.success(`${join19(testsLocalDir, name)}Event.spec.ts created successfully`, undefined, {
9691
+ logger.success(`${join20(testsLocalDir, name)}Event.spec.ts created successfully`, undefined, {
9636
9692
  showTimestamp: false,
9637
9693
  showArrow: false,
9638
9694
  useSymbol: true
9639
9695
  });
9640
- const packageJsonPath = join19(process.cwd(), "package.json");
9696
+ const packageJsonPath = join20(process.cwd(), "package.json");
9641
9697
  const packageJson = await Bun.file(packageJsonPath).json();
9642
9698
  const deps = packageJson.dependencies ?? {};
9643
9699
  const devDeps = packageJson.devDependencies ?? {};
@@ -9656,7 +9712,7 @@ MakePubSubCommand = __legacyDecorateClassTS([
9656
9712
  ], MakePubSubCommand);
9657
9713
  // src/commands/MakeReleaseCommand.ts
9658
9714
  import { readdir } from "fs/promises";
9659
- import { join as join20 } from "path";
9715
+ import { join as join21 } from "path";
9660
9716
  import { decorator as decorator20 } from "@ooneex/command";
9661
9717
  import { TerminalLogger as TerminalLogger20 } from "@ooneex/logger";
9662
9718
  var {$ } = globalThis.Bun;
@@ -9689,8 +9745,8 @@ class MakeReleaseCommand {
9689
9745
  { name: "modules", type: "module" }
9690
9746
  ]) {
9691
9747
  try {
9692
- const entries = await readdir(join20(cwd, name), { withFileTypes: true });
9693
- dirs.push(...entries.filter((d) => d.isDirectory()).map((d) => ({ base: join20(name, d.name), type })));
9748
+ const entries = await readdir(join21(cwd, name), { withFileTypes: true });
9749
+ dirs.push(...entries.filter((d) => d.isDirectory()).map((d) => ({ base: join21(name, d.name), type })));
9694
9750
  } catch {}
9695
9751
  }
9696
9752
  const logOptions = { showTimestamp: false, showArrow: false, useSymbol: true };
@@ -9700,8 +9756,8 @@ class MakeReleaseCommand {
9700
9756
  }
9701
9757
  let releasedCount = 0;
9702
9758
  for (const dir of dirs) {
9703
- const fullDir = join20(cwd, dir.base);
9704
- const pkgJsonPath = join20(fullDir, "package.json");
9759
+ const fullDir = join21(cwd, dir.base);
9760
+ const pkgJsonPath = join21(fullDir, "package.json");
9705
9761
  const pkgJsonFile = Bun.file(pkgJsonPath);
9706
9762
  if (!await pkgJsonFile.exists()) {
9707
9763
  continue;
@@ -9719,7 +9775,7 @@ class MakeReleaseCommand {
9719
9775
  await Bun.write(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}
9720
9776
  `);
9721
9777
  await this.updateChangelog(fullDir, newVersion, tag, commits);
9722
- await this.gitAdd(join20(dir.base, "package.json"), join20(dir.base, "CHANGELOG.md"));
9778
+ await this.gitAdd(join21(dir.base, "package.json"), join21(dir.base, "CHANGELOG.md"));
9723
9779
  await this.gitCommit(`chore(release): ${pkgJson.name}@${newVersion}`);
9724
9780
  await this.gitTag(tag, `chore(release): ${pkgJson.name}@${newVersion}`);
9725
9781
  logger.success(`${pkgJson.name}@${newVersion} released (${bumpType} bump, ${commits.length} commit(s))`, undefined, logOptions);
@@ -9816,7 +9872,7 @@ class MakeReleaseCommand {
9816
9872
  }
9817
9873
  }
9818
9874
  async updateChangelog(dir, version, tag, commits) {
9819
- const changelogPath = join20(dir, "CHANGELOG.md");
9875
+ const changelogPath = join21(dir, "CHANGELOG.md");
9820
9876
  const today = new Date().toISOString().split("T")[0];
9821
9877
  const repoUrl = await this.getRepoUrl();
9822
9878
  const grouped = new Map;
@@ -9890,7 +9946,7 @@ MakeReleaseCommand = __legacyDecorateClassTS([
9890
9946
  decorator20.command()
9891
9947
  ], MakeReleaseCommand);
9892
9948
  // src/commands/MakeRepositoryCommand.ts
9893
- import { join as join21 } from "path";
9949
+ import { join as join22 } from "path";
9894
9950
  import { decorator as decorator21 } from "@ooneex/command";
9895
9951
  import { TerminalLogger as TerminalLogger21 } from "@ooneex/logger";
9896
9952
  import { toPascalCase as toPascalCase14 } from "@ooneex/utils";
@@ -10103,28 +10159,31 @@ class MakeRepositoryCommand {
10103
10159
  }
10104
10160
  name = toPascalCase14(name).replace(/Repository$/, "");
10105
10161
  const content = repository_default.replace(/{{NAME}}/g, name);
10106
- const base = module ? join21("modules", module) : ".";
10107
- const repositoriesLocalDir = join21(base, "src", "repositories");
10108
- const repositoriesDir = join21(process.cwd(), repositoriesLocalDir);
10109
- const filePath = join21(repositoriesDir, `${name}Repository.ts`);
10162
+ if (module) {
10163
+ await ensureModule(module);
10164
+ }
10165
+ const base = module ? join22("modules", module) : ".";
10166
+ const repositoriesLocalDir = join22(base, "src", "repositories");
10167
+ const repositoriesDir = join22(process.cwd(), repositoriesLocalDir);
10168
+ const filePath = join22(repositoriesDir, `${name}Repository.ts`);
10110
10169
  await Bun.write(filePath, content);
10111
10170
  const testContent = repository_test_default.replace(/{{NAME}}/g, name);
10112
- const testsLocalDir = join21(base, "tests", "repositories");
10113
- const testsDir = join21(process.cwd(), testsLocalDir);
10114
- const testFilePath = join21(testsDir, `${name}Repository.spec.ts`);
10171
+ const testsLocalDir = join22(base, "tests", "repositories");
10172
+ const testsDir = join22(process.cwd(), testsLocalDir);
10173
+ const testFilePath = join22(testsDir, `${name}Repository.spec.ts`);
10115
10174
  await Bun.write(testFilePath, testContent);
10116
10175
  const logger = new TerminalLogger21;
10117
- logger.success(`${join21(repositoriesLocalDir, name)}Repository.ts created successfully`, undefined, {
10176
+ logger.success(`${join22(repositoriesLocalDir, name)}Repository.ts created successfully`, undefined, {
10118
10177
  showTimestamp: false,
10119
10178
  showArrow: false,
10120
10179
  useSymbol: true
10121
10180
  });
10122
- logger.success(`${join21(testsLocalDir, name)}Repository.spec.ts created successfully`, undefined, {
10181
+ logger.success(`${join22(testsLocalDir, name)}Repository.spec.ts created successfully`, undefined, {
10123
10182
  showTimestamp: false,
10124
10183
  showArrow: false,
10125
10184
  useSymbol: true
10126
10185
  });
10127
- const packageJsonPath = join21(process.cwd(), "package.json");
10186
+ const packageJsonPath = join22(process.cwd(), "package.json");
10128
10187
  const packageJson = await Bun.file(packageJsonPath).json();
10129
10188
  const deps = packageJson.dependencies ?? {};
10130
10189
  const devDeps = packageJson.devDependencies ?? {};
@@ -10142,7 +10201,7 @@ MakeRepositoryCommand = __legacyDecorateClassTS([
10142
10201
  decorator21.command()
10143
10202
  ], MakeRepositoryCommand);
10144
10203
  // src/commands/MakeResourceBookCommand.ts
10145
- import { join as join23 } from "path";
10204
+ import { join as join24 } from "path";
10146
10205
  import { decorator as decorator23 } from "@ooneex/command";
10147
10206
  var {Glob } = globalThis.Bun;
10148
10207
 
@@ -10839,7 +10898,7 @@ export class UpdateBookService implements IService {
10839
10898
  `;
10840
10899
 
10841
10900
  // src/commands/MakeServiceCommand.ts
10842
- import { join as join22 } from "path";
10901
+ import { join as join23 } from "path";
10843
10902
  import { decorator as decorator22 } from "@ooneex/command";
10844
10903
  import { TerminalLogger as TerminalLogger22 } from "@ooneex/logger";
10845
10904
  import { toPascalCase as toPascalCase15 } from "@ooneex/utils";
@@ -10890,28 +10949,31 @@ class MakeServiceCommand {
10890
10949
  }
10891
10950
  name = toPascalCase15(name).replace(/Service$/, "");
10892
10951
  const content = service_default.replace(/{{NAME}}/g, name);
10893
- const base = module ? join22("modules", module) : ".";
10894
- const serviceLocalDir = join22(base, "src", "services");
10895
- const serviceDir = join22(process.cwd(), serviceLocalDir);
10896
- const filePath = join22(serviceDir, `${name}Service.ts`);
10952
+ if (module) {
10953
+ await ensureModule(module);
10954
+ }
10955
+ const base = module ? join23("modules", module) : ".";
10956
+ const serviceLocalDir = join23(base, "src", "services");
10957
+ const serviceDir = join23(process.cwd(), serviceLocalDir);
10958
+ const filePath = join23(serviceDir, `${name}Service.ts`);
10897
10959
  await Bun.write(filePath, content);
10898
10960
  const testContent = service_test_default.replace(/{{NAME}}/g, name);
10899
- const testsLocalDir = join22(base, "tests", "services");
10900
- const testsDir = join22(process.cwd(), testsLocalDir);
10901
- const testFilePath = join22(testsDir, `${name}Service.spec.ts`);
10961
+ const testsLocalDir = join23(base, "tests", "services");
10962
+ const testsDir = join23(process.cwd(), testsLocalDir);
10963
+ const testFilePath = join23(testsDir, `${name}Service.spec.ts`);
10902
10964
  await Bun.write(testFilePath, testContent);
10903
10965
  const logger = new TerminalLogger22;
10904
- logger.success(`${join22(serviceLocalDir, name)}Service.ts created successfully`, undefined, {
10966
+ logger.success(`${join23(serviceLocalDir, name)}Service.ts created successfully`, undefined, {
10905
10967
  showTimestamp: false,
10906
10968
  showArrow: false,
10907
10969
  useSymbol: true
10908
10970
  });
10909
- logger.success(`${join22(testsLocalDir, name)}Service.spec.ts created successfully`, undefined, {
10971
+ logger.success(`${join23(testsLocalDir, name)}Service.spec.ts created successfully`, undefined, {
10910
10972
  showTimestamp: false,
10911
10973
  showArrow: false,
10912
10974
  useSymbol: true
10913
10975
  });
10914
- const packageJsonPath = join22(process.cwd(), "package.json");
10976
+ const packageJsonPath = join23(process.cwd(), "package.json");
10915
10977
  const packageJson = await Bun.file(packageJsonPath).json();
10916
10978
  const deps = packageJson.dependencies ?? {};
10917
10979
  const devDeps = packageJson.devDependencies ?? {};
@@ -10939,7 +11001,7 @@ class MakeResourceBookCommand {
10939
11001
  }
10940
11002
  async run() {
10941
11003
  const module = "book";
10942
- const base = join23("modules", module);
11004
+ const base = join24("modules", module);
10943
11005
  const makeModuleCommand = new MakeModuleCommand;
10944
11006
  await makeModuleCommand.run({ name: module, silent: true, skipMigrations: false, skipSeeds: true });
10945
11007
  const makeEntityCommand = new MakeEntityCommand;
@@ -10959,26 +11021,26 @@ class MakeResourceBookCommand {
10959
11021
  for (const controller of controllers) {
10960
11022
  await makeControllerCommand.run({ ...controller, module, isSocket: false });
10961
11023
  }
10962
- const controllersDir = join23(process.cwd(), base, "src", "controllers");
10963
- await Bun.write(join23(controllersDir, "CreateBookController.ts"), CreateBookController_default);
10964
- await Bun.write(join23(controllersDir, "GetBookController.ts"), GetBookController_default);
10965
- await Bun.write(join23(controllersDir, "ListBooksController.ts"), ListBooksController_default);
10966
- await Bun.write(join23(controllersDir, "UpdateBookController.ts"), UpdateBookController_default);
10967
- await Bun.write(join23(controllersDir, "DeleteBookController.ts"), DeleteBookController_default);
11024
+ const controllersDir = join24(process.cwd(), base, "src", "controllers");
11025
+ await Bun.write(join24(controllersDir, "CreateBookController.ts"), CreateBookController_default);
11026
+ await Bun.write(join24(controllersDir, "GetBookController.ts"), GetBookController_default);
11027
+ await Bun.write(join24(controllersDir, "ListBooksController.ts"), ListBooksController_default);
11028
+ await Bun.write(join24(controllersDir, "UpdateBookController.ts"), UpdateBookController_default);
11029
+ await Bun.write(join24(controllersDir, "DeleteBookController.ts"), DeleteBookController_default);
10968
11030
  const makeServiceCommand = new MakeServiceCommand;
10969
11031
  const services = ["CreateBook", "GetBook", "ListBooks", "UpdateBook", "DeleteBook"];
10970
11032
  for (const name of services) {
10971
11033
  await makeServiceCommand.run({ name, module });
10972
11034
  }
10973
- const servicesDir = join23(process.cwd(), base, "src", "services");
10974
- await Bun.write(join23(servicesDir, "CreateBookService.ts"), CreateBookService_default);
10975
- await Bun.write(join23(servicesDir, "GetBookService.ts"), GetBookService_default);
10976
- await Bun.write(join23(servicesDir, "ListBooksService.ts"), ListBooksService_default);
10977
- await Bun.write(join23(servicesDir, "UpdateBookService.ts"), UpdateBookService_default);
10978
- await Bun.write(join23(servicesDir, "DeleteBookService.ts"), DeleteBookService_default);
10979
- const entityPath = join23(process.cwd(), base, "src", "entities", "BookEntity.ts");
11035
+ const servicesDir = join24(process.cwd(), base, "src", "services");
11036
+ await Bun.write(join24(servicesDir, "CreateBookService.ts"), CreateBookService_default);
11037
+ await Bun.write(join24(servicesDir, "GetBookService.ts"), GetBookService_default);
11038
+ await Bun.write(join24(servicesDir, "ListBooksService.ts"), ListBooksService_default);
11039
+ await Bun.write(join24(servicesDir, "UpdateBookService.ts"), UpdateBookService_default);
11040
+ await Bun.write(join24(servicesDir, "DeleteBookService.ts"), DeleteBookService_default);
11041
+ const entityPath = join24(process.cwd(), base, "src", "entities", "BookEntity.ts");
10980
11042
  await Bun.write(entityPath, BookEntity_default);
10981
- const migrationsDir = join23(process.cwd(), base, "src", "migrations");
11043
+ const migrationsDir = join24(process.cwd(), base, "src", "migrations");
10982
11044
  const glob = new Glob("Migration*.ts");
10983
11045
  for await (const file of glob.scan(migrationsDir)) {
10984
11046
  if (file === "migrations.ts")
@@ -10986,9 +11048,9 @@ class MakeResourceBookCommand {
10986
11048
  const name = file.replace(/\.ts$/, "");
10987
11049
  const version = name.replace("Migration", "");
10988
11050
  const content = BookMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
10989
- await Bun.write(join23(migrationsDir, file), content);
11051
+ await Bun.write(join24(migrationsDir, file), content);
10990
11052
  }
10991
- const repositoryPath = join23(process.cwd(), base, "src", "repositories", "BookRepository.ts");
11053
+ const repositoryPath = join24(process.cwd(), base, "src", "repositories", "BookRepository.ts");
10992
11054
  await Bun.write(repositoryPath, BookRepository_default);
10993
11055
  }
10994
11056
  }
@@ -10996,7 +11058,7 @@ MakeResourceBookCommand = __legacyDecorateClassTS([
10996
11058
  decorator23.command()
10997
11059
  ], MakeResourceBookCommand);
10998
11060
  // src/commands/MakeSeedCommand.ts
10999
- import { join as join24 } from "path";
11061
+ import { join as join25 } from "path";
11000
11062
  import { decorator as decorator24 } from "@ooneex/command";
11001
11063
  import { TerminalLogger as TerminalLogger23 } from "@ooneex/logger";
11002
11064
  import { seedCreate } from "@ooneex/seeds";
@@ -11023,18 +11085,21 @@ class MakeSeedCommand {
11023
11085
  if (!name) {
11024
11086
  name = await askName({ message: "Enter seed name" });
11025
11087
  }
11026
- const base = module ? join24("modules", module) : ".";
11088
+ if (module) {
11089
+ await ensureModule(module);
11090
+ }
11091
+ const base = module ? join25("modules", module) : ".";
11027
11092
  const { seedPath: filePath } = await seedCreate({
11028
11093
  name,
11029
- seedsDir: join24(base, "src", "seeds"),
11030
- testsDir: join24(base, "tests", "seeds")
11094
+ seedsDir: join25(base, "src", "seeds"),
11095
+ testsDir: join25(base, "tests", "seeds")
11031
11096
  });
11032
- const binSeedRunPath = join24(process.cwd(), base, "bin", "seed", "run.ts");
11097
+ const binSeedRunPath = join25(process.cwd(), base, "bin", "seed", "run.ts");
11033
11098
  const binSeedRunFile = Bun.file(binSeedRunPath);
11034
11099
  if (!await binSeedRunFile.exists()) {
11035
11100
  await Bun.write(binSeedRunPath, seed_run_default);
11036
11101
  }
11037
- const packageJsonPath = join24(process.cwd(), "package.json");
11102
+ const packageJsonPath = join25(process.cwd(), "package.json");
11038
11103
  const packageJsonFile = Bun.file(packageJsonPath);
11039
11104
  if (await packageJsonFile.exists()) {
11040
11105
  const packageJson = await packageJsonFile.json();
@@ -11070,7 +11135,7 @@ MakeSeedCommand = __legacyDecorateClassTS([
11070
11135
  decorator24.command()
11071
11136
  ], MakeSeedCommand);
11072
11137
  // src/commands/MakeStorageCommand.ts
11073
- import { join as join25 } from "path";
11138
+ import { join as join26 } from "path";
11074
11139
  import { decorator as decorator25 } from "@ooneex/command";
11075
11140
  import { TerminalLogger as TerminalLogger24 } from "@ooneex/logger";
11076
11141
  import { toPascalCase as toPascalCase16, toSnakeCase as toSnakeCase3 } from "@ooneex/utils";
@@ -11169,28 +11234,31 @@ class MakeStorageCommand {
11169
11234
  name = toPascalCase16(name).replace(/Storage$/, "");
11170
11235
  const nameUpper = toSnakeCase3(name).toUpperCase();
11171
11236
  const content = storage_default.replace(/{{NAME}}/g, name).replace(/{{NAME_UPPER}}/g, nameUpper);
11172
- const base = module ? join25("modules", module) : ".";
11173
- const storageLocalDir = join25(base, "src", "storage");
11174
- const storageDir = join25(process.cwd(), storageLocalDir);
11175
- const filePath = join25(storageDir, `${name}Storage.ts`);
11237
+ if (module) {
11238
+ await ensureModule(module);
11239
+ }
11240
+ const base = module ? join26("modules", module) : ".";
11241
+ const storageLocalDir = join26(base, "src", "storage");
11242
+ const storageDir = join26(process.cwd(), storageLocalDir);
11243
+ const filePath = join26(storageDir, `${name}Storage.ts`);
11176
11244
  await Bun.write(filePath, content);
11177
11245
  const testContent = storage_test_default.replace(/{{NAME}}/g, name);
11178
- const testsLocalDir = join25(base, "tests", "storage");
11179
- const testsDir = join25(process.cwd(), testsLocalDir);
11180
- const testFilePath = join25(testsDir, `${name}Storage.spec.ts`);
11246
+ const testsLocalDir = join26(base, "tests", "storage");
11247
+ const testsDir = join26(process.cwd(), testsLocalDir);
11248
+ const testFilePath = join26(testsDir, `${name}Storage.spec.ts`);
11181
11249
  await Bun.write(testFilePath, testContent);
11182
11250
  const logger = new TerminalLogger24;
11183
- logger.success(`${join25(storageLocalDir, name)}Storage.ts created successfully`, undefined, {
11251
+ logger.success(`${join26(storageLocalDir, name)}Storage.ts created successfully`, undefined, {
11184
11252
  showTimestamp: false,
11185
11253
  showArrow: false,
11186
11254
  useSymbol: true
11187
11255
  });
11188
- logger.success(`${join25(testsLocalDir, name)}Storage.spec.ts created successfully`, undefined, {
11256
+ logger.success(`${join26(testsLocalDir, name)}Storage.spec.ts created successfully`, undefined, {
11189
11257
  showTimestamp: false,
11190
11258
  showArrow: false,
11191
11259
  useSymbol: true
11192
11260
  });
11193
- const packageJsonPath = join25(process.cwd(), "package.json");
11261
+ const packageJsonPath = join26(process.cwd(), "package.json");
11194
11262
  const packageJson = await Bun.file(packageJsonPath).json();
11195
11263
  const deps = packageJson.dependencies ?? {};
11196
11264
  const devDeps = packageJson.devDependencies ?? {};
@@ -11208,7 +11276,7 @@ MakeStorageCommand = __legacyDecorateClassTS([
11208
11276
  decorator25.command()
11209
11277
  ], MakeStorageCommand);
11210
11278
  // src/commands/MakeVectorDatabaseCommand.ts
11211
- import { join as join26 } from "path";
11279
+ import { join as join27 } from "path";
11212
11280
  import { decorator as decorator26 } from "@ooneex/command";
11213
11281
  import { TerminalLogger as TerminalLogger25 } from "@ooneex/logger";
11214
11282
  import { toPascalCase as toPascalCase17 } from "@ooneex/utils";
@@ -11281,28 +11349,31 @@ class MakeVectorDatabaseCommand {
11281
11349
  }
11282
11350
  name = toPascalCase17(name).replace(/VectorDatabase$/, "").replace(/Database$/, "");
11283
11351
  const content = vector_database_default.replace(/{{NAME}}/g, name);
11284
- const base = module ? join26("modules", module) : ".";
11285
- const vectorDatabaseLocalDir = join26(base, "src", "databases");
11286
- const vectorDatabaseDir = join26(process.cwd(), vectorDatabaseLocalDir);
11287
- const filePath = join26(vectorDatabaseDir, `${name}VectorDatabase.ts`);
11352
+ if (module) {
11353
+ await ensureModule(module);
11354
+ }
11355
+ const base = module ? join27("modules", module) : ".";
11356
+ const vectorDatabaseLocalDir = join27(base, "src", "databases");
11357
+ const vectorDatabaseDir = join27(process.cwd(), vectorDatabaseLocalDir);
11358
+ const filePath = join27(vectorDatabaseDir, `${name}VectorDatabase.ts`);
11288
11359
  await Bun.write(filePath, content);
11289
11360
  const testContent = vector_database_test_default.replace(/{{NAME}}/g, name);
11290
- const testsLocalDir = join26(base, "tests", "databases");
11291
- const testsDir = join26(process.cwd(), testsLocalDir);
11292
- const testFilePath = join26(testsDir, `${name}VectorDatabase.spec.ts`);
11361
+ const testsLocalDir = join27(base, "tests", "databases");
11362
+ const testsDir = join27(process.cwd(), testsLocalDir);
11363
+ const testFilePath = join27(testsDir, `${name}VectorDatabase.spec.ts`);
11293
11364
  await Bun.write(testFilePath, testContent);
11294
11365
  const logger = new TerminalLogger25;
11295
- logger.success(`${join26(vectorDatabaseLocalDir, name)}VectorDatabase.ts created successfully`, undefined, {
11366
+ logger.success(`${join27(vectorDatabaseLocalDir, name)}VectorDatabase.ts created successfully`, undefined, {
11296
11367
  showTimestamp: false,
11297
11368
  showArrow: false,
11298
11369
  useSymbol: true
11299
11370
  });
11300
- logger.success(`${join26(testsLocalDir, name)}VectorDatabase.spec.ts created successfully`, undefined, {
11371
+ logger.success(`${join27(testsLocalDir, name)}VectorDatabase.spec.ts created successfully`, undefined, {
11301
11372
  showTimestamp: false,
11302
11373
  showArrow: false,
11303
11374
  useSymbol: true
11304
11375
  });
11305
- const packageJsonPath = join26(process.cwd(), "package.json");
11376
+ const packageJsonPath = join27(process.cwd(), "package.json");
11306
11377
  const packageJson = await Bun.file(packageJsonPath).json();
11307
11378
  const deps = packageJson.dependencies ?? {};
11308
11379
  const devDeps = packageJson.devDependencies ?? {};
@@ -11320,6 +11391,6 @@ MakeVectorDatabaseCommand = __legacyDecorateClassTS([
11320
11391
  decorator26.command()
11321
11392
  ], MakeVectorDatabaseCommand);
11322
11393
  // src/index.ts
11323
- await commandRun();
11394
+ await run();
11324
11395
 
11325
- //# debugId=BB30E412412C23B564756E2164756E21
11396
+ //# debugId=4DF42F0F6B5FA95F64756E2164756E21