@ooneex/cli 1.14.0 → 1.15.1

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/command";
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",
@@ -7360,8 +7382,8 @@ class MakeAppCommand {
7360
7382
  await addDevDeps.exited;
7361
7383
  const huskyInit = Bun.spawn(["bunx", "husky", "init"], { cwd: destination, stdout: "ignore", stderr: "inherit" });
7362
7384
  await huskyInit.exited;
7363
- await Bun.write(join6(destination, ".husky", "pre-commit"), "lint-staged");
7364
- 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"`);
7365
7387
  const logger = new TerminalLogger6;
7366
7388
  logger.success(`${kebabName} created successfully at ${destination}`, undefined, {
7367
7389
  showTimestamp: false,
@@ -7374,7 +7396,7 @@ MakeAppCommand = __legacyDecorateClassTS([
7374
7396
  decorator6.command()
7375
7397
  ], MakeAppCommand);
7376
7398
  // src/commands/MakeCacheCommand.ts
7377
- import { join as join7 } from "path";
7399
+ import { join as join8 } from "path";
7378
7400
  import { decorator as decorator7 } from "@ooneex/command";
7379
7401
  import { TerminalLogger as TerminalLogger7 } from "@ooneex/logger";
7380
7402
  import { toPascalCase as toPascalCase5 } from "@ooneex/utils";
@@ -7449,28 +7471,31 @@ class MakeCacheCommand {
7449
7471
  }
7450
7472
  name = toPascalCase5(name).replace(/Cache$/, "");
7451
7473
  const content = cache_default.replace(/{{NAME}}/g, name);
7452
- const base = module ? join7("modules", module) : ".";
7453
- const cacheLocalDir = join7(base, "src", "cache");
7454
- const cacheDir = join7(process.cwd(), cacheLocalDir);
7455
- 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`);
7456
7481
  await Bun.write(filePath, content);
7457
7482
  const testContent = cache_test_default.replace(/{{NAME}}/g, name);
7458
- const testsLocalDir = join7(base, "tests", "cache");
7459
- const testsDir = join7(process.cwd(), testsLocalDir);
7460
- 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`);
7461
7486
  await Bun.write(testFilePath, testContent);
7462
7487
  const logger = new TerminalLogger7;
7463
- logger.success(`${join7(cacheLocalDir, name)}Cache.ts created successfully`, undefined, {
7488
+ logger.success(`${join8(cacheLocalDir, name)}Cache.ts created successfully`, undefined, {
7464
7489
  showTimestamp: false,
7465
7490
  showArrow: false,
7466
7491
  useSymbol: true
7467
7492
  });
7468
- logger.success(`${join7(testsLocalDir, name)}Cache.spec.ts created successfully`, undefined, {
7493
+ logger.success(`${join8(testsLocalDir, name)}Cache.spec.ts created successfully`, undefined, {
7469
7494
  showTimestamp: false,
7470
7495
  showArrow: false,
7471
7496
  useSymbol: true
7472
7497
  });
7473
- const packageJsonPath = join7(process.cwd(), "package.json");
7498
+ const packageJsonPath = join8(process.cwd(), "package.json");
7474
7499
  const packageJson = await Bun.file(packageJsonPath).json();
7475
7500
  const deps = packageJson.dependencies ?? {};
7476
7501
  const devDeps = packageJson.devDependencies ?? {};
@@ -7488,7 +7513,7 @@ MakeCacheCommand = __legacyDecorateClassTS([
7488
7513
  decorator7.command()
7489
7514
  ], MakeCacheCommand);
7490
7515
  // src/commands/MakeClaudeSkillCommand.ts
7491
- import { join as join8 } from "path";
7516
+ import { join as join9 } from "path";
7492
7517
  import { decorator as decorator8 } from "@ooneex/command";
7493
7518
  import { TerminalLogger as TerminalLogger8 } from "@ooneex/logger";
7494
7519
 
@@ -7777,14 +7802,14 @@ class MakeClaudeSkillCommand {
7777
7802
  return "Generate Claude skills from templates";
7778
7803
  }
7779
7804
  async run() {
7780
- const skillsLocalDir = join8(".claude", "skills");
7781
- const skillsDir = join8(process.cwd(), skillsLocalDir);
7805
+ const skillsLocalDir = join9(".claude", "skills");
7806
+ const skillsDir = join9(process.cwd(), skillsLocalDir);
7782
7807
  const logger = new TerminalLogger8;
7783
7808
  for (const [skillName, content] of Object.entries(skills)) {
7784
7809
  const dirName = skillName.replace(/\./g, "-");
7785
- const filePath = join8(skillsDir, dirName, "SKILL.md");
7810
+ const filePath = join9(skillsDir, dirName, "SKILL.md");
7786
7811
  await Bun.write(filePath, content);
7787
- logger.success(`${join8(skillsLocalDir, dirName, "SKILL.md")} created successfully`, undefined, {
7812
+ logger.success(`${join9(skillsLocalDir, dirName, "SKILL.md")} created successfully`, undefined, {
7788
7813
  showTimestamp: false,
7789
7814
  showArrow: false,
7790
7815
  useSymbol: true
@@ -7796,7 +7821,7 @@ MakeClaudeSkillCommand = __legacyDecorateClassTS([
7796
7821
  decorator8.command()
7797
7822
  ], MakeClaudeSkillCommand);
7798
7823
  // src/commands/MakeCommandCommand.ts
7799
- import { join as join9 } from "path";
7824
+ import { join as join10 } from "path";
7800
7825
  import { commandCreate, decorator as decorator9 } from "@ooneex/command";
7801
7826
  import { TerminalLogger as TerminalLogger9 } from "@ooneex/logger";
7802
7827
  class MakeCommandCommand {
@@ -7811,14 +7836,17 @@ class MakeCommandCommand {
7811
7836
  if (!name) {
7812
7837
  name = await askName({ message: "Enter name" });
7813
7838
  }
7814
- const base = module ? join9("modules", module) : ".";
7839
+ if (module) {
7840
+ await ensureModule(module);
7841
+ }
7842
+ const base = module ? join10("modules", module) : ".";
7815
7843
  const { commandPath, testPath } = await commandCreate({
7816
7844
  name,
7817
- commandDir: join9(base, "src", "commands"),
7818
- testsDir: join9(base, "tests", "commands")
7845
+ commandDir: join10(base, "src", "commands"),
7846
+ testsDir: join10(base, "tests", "commands")
7819
7847
  });
7820
7848
  if (module && module !== "app") {
7821
- const appCommandsRootPath = join9(process.cwd(), "modules", "app", "src", "commands", "commands.ts");
7849
+ const appCommandsRootPath = join10(process.cwd(), "modules", "app", "src", "commands", "commands.ts");
7822
7850
  const appCommandsRootFile = Bun.file(appCommandsRootPath);
7823
7851
  const importLine = `import "@${module}/commands/commands";`;
7824
7852
  if (await appCommandsRootFile.exists()) {
@@ -7833,12 +7861,12 @@ ${importLine}
7833
7861
  `);
7834
7862
  }
7835
7863
  }
7836
- const binCommandRunPath = join9(process.cwd(), "modules", "app", "bin", "command", "run.ts");
7864
+ const binCommandRunPath = join10(process.cwd(), "modules", "app", "bin", "command", "run.ts");
7837
7865
  const binCommandRunFile = Bun.file(binCommandRunPath);
7838
7866
  if (!await binCommandRunFile.exists()) {
7839
7867
  await Bun.write(binCommandRunPath, command_run_default);
7840
7868
  }
7841
- const packageJsonPath = join9(process.cwd(), "modules", "app", "package.json");
7869
+ const packageJsonPath = join10(process.cwd(), "modules", "app", "package.json");
7842
7870
  const packageJsonFile = Bun.file(packageJsonPath);
7843
7871
  if (await packageJsonFile.exists()) {
7844
7872
  const packageJson = await packageJsonFile.json();
@@ -7868,7 +7896,7 @@ MakeCommandCommand = __legacyDecorateClassTS([
7868
7896
  decorator9.command()
7869
7897
  ], MakeCommandCommand);
7870
7898
  // src/commands/MakeCronCommand.ts
7871
- import { basename as basename2, join as join10 } from "path";
7899
+ import { basename as basename2, join as join11 } from "path";
7872
7900
  import { decorator as decorator10 } from "@ooneex/command";
7873
7901
  import { TerminalLogger as TerminalLogger10 } from "@ooneex/logger";
7874
7902
  import { toPascalCase as toPascalCase6 } from "@ooneex/utils";
@@ -7956,33 +7984,36 @@ class MakeCronCommand {
7956
7984
  }
7957
7985
  name = toPascalCase6(name).replace(/Cron$/, "");
7958
7986
  const content = cron_default.replace(/{{NAME}}/g, name);
7959
- const base = module ? join10("modules", module) : ".";
7960
- const cronLocalDir = join10(base, "src", "crons");
7961
- const cronDir = join10(process.cwd(), cronLocalDir);
7962
- 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`);
7963
7994
  await Bun.write(filePath, content);
7964
7995
  const testContent = cron_test_default.replace(/{{NAME}}/g, name);
7965
- const testsLocalDir = join10(base, "tests", "crons");
7966
- const testsDir = join10(process.cwd(), testsLocalDir);
7967
- 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`);
7968
7999
  await Bun.write(testFilePath, testContent);
7969
8000
  const modulePascalName = module ? toPascalCase6(module) : toPascalCase6(basename2(process.cwd()));
7970
- const modulePath = join10(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
8001
+ const modulePath = join11(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
7971
8002
  if (await Bun.file(modulePath).exists()) {
7972
8003
  await this.addToModule(modulePath, name);
7973
8004
  }
7974
8005
  const logger = new TerminalLogger10;
7975
- logger.success(`${join10(cronLocalDir, name)}Cron.ts created successfully`, undefined, {
8006
+ logger.success(`${join11(cronLocalDir, name)}Cron.ts created successfully`, undefined, {
7976
8007
  showTimestamp: false,
7977
8008
  showArrow: false,
7978
8009
  useSymbol: true
7979
8010
  });
7980
- logger.success(`${join10(testsLocalDir, name)}Cron.spec.ts created successfully`, undefined, {
8011
+ logger.success(`${join11(testsLocalDir, name)}Cron.spec.ts created successfully`, undefined, {
7981
8012
  showTimestamp: false,
7982
8013
  showArrow: false,
7983
8014
  useSymbol: true
7984
8015
  });
7985
- const packageJsonPath = join10(process.cwd(), "package.json");
8016
+ const packageJsonPath = join11(process.cwd(), "package.json");
7986
8017
  const packageJson = await Bun.file(packageJsonPath).json();
7987
8018
  const deps = packageJson.dependencies ?? {};
7988
8019
  const devDeps = packageJson.devDependencies ?? {};
@@ -8000,7 +8031,7 @@ MakeCronCommand = __legacyDecorateClassTS([
8000
8031
  decorator10.command()
8001
8032
  ], MakeCronCommand);
8002
8033
  // src/commands/MakeDatabaseCommand.ts
8003
- import { join as join11 } from "path";
8034
+ import { join as join12 } from "path";
8004
8035
  import { decorator as decorator11 } from "@ooneex/command";
8005
8036
  import { TerminalLogger as TerminalLogger11 } from "@ooneex/logger";
8006
8037
  import { toPascalCase as toPascalCase7 } from "@ooneex/utils";
@@ -8062,28 +8093,31 @@ class MakeDatabaseCommand {
8062
8093
  }
8063
8094
  name = toPascalCase7(name).replace(/DatabaseAdapter$/, "").replace(/Database$/, "");
8064
8095
  const content = database_default.replace(/{{NAME}}/g, name);
8065
- const base = module ? join11("modules", module) : ".";
8066
- const databaseLocalDir = join11(base, "src", "databases");
8067
- const databaseDir = join11(process.cwd(), databaseLocalDir);
8068
- 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`);
8069
8103
  await Bun.write(filePath, content);
8070
8104
  const testContent = database_test_default.replace(/{{NAME}}/g, name);
8071
- const testsLocalDir = join11(base, "tests", "databases");
8072
- const testsDir = join11(process.cwd(), testsLocalDir);
8073
- 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`);
8074
8108
  await Bun.write(testFilePath, testContent);
8075
8109
  const logger = new TerminalLogger11;
8076
- logger.success(`${join11(databaseLocalDir, name)}Database.ts created successfully`, undefined, {
8110
+ logger.success(`${join12(databaseLocalDir, name)}Database.ts created successfully`, undefined, {
8077
8111
  showTimestamp: false,
8078
8112
  showArrow: false,
8079
8113
  useSymbol: true
8080
8114
  });
8081
- logger.success(`${join11(testsLocalDir, name)}Database.spec.ts created successfully`, undefined, {
8115
+ logger.success(`${join12(testsLocalDir, name)}Database.spec.ts created successfully`, undefined, {
8082
8116
  showTimestamp: false,
8083
8117
  showArrow: false,
8084
8118
  useSymbol: true
8085
8119
  });
8086
- const packageJsonPath = join11(process.cwd(), "package.json");
8120
+ const packageJsonPath = join12(process.cwd(), "package.json");
8087
8121
  const packageJson = await Bun.file(packageJsonPath).json();
8088
8122
  const deps = packageJson.dependencies ?? {};
8089
8123
  const devDeps = packageJson.devDependencies ?? {};
@@ -8101,7 +8135,7 @@ MakeDatabaseCommand = __legacyDecorateClassTS([
8101
8135
  decorator11.command()
8102
8136
  ], MakeDatabaseCommand);
8103
8137
  // src/commands/MakeDockerCommand.ts
8104
- import { join as join12 } from "path";
8138
+ import { join as join13 } from "path";
8105
8139
  import { decorator as decorator12 } from "@ooneex/command";
8106
8140
  import { TerminalLogger as TerminalLogger12 } from "@ooneex/logger";
8107
8141
  var {YAML } = globalThis.Bun;
@@ -8596,8 +8630,8 @@ class MakeDockerCommand {
8596
8630
  name = await askDockerService({ message: "Select docker service" });
8597
8631
  }
8598
8632
  const templateContent = templates[name];
8599
- const base = join12("modules", "app");
8600
- 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");
8601
8635
  const logger = new TerminalLogger12;
8602
8636
  const composeFile = Bun.file(composePath);
8603
8637
  if (await composeFile.exists()) {
@@ -8657,7 +8691,7 @@ volumes:
8657
8691
  } else {
8658
8692
  await Bun.write(composePath, templateContent);
8659
8693
  }
8660
- const packageJsonPath = join12(process.cwd(), base, "package.json");
8694
+ const packageJsonPath = join13(process.cwd(), base, "package.json");
8661
8695
  const packageJsonFile = Bun.file(packageJsonPath);
8662
8696
  if (await packageJsonFile.exists()) {
8663
8697
  const packageJson = await packageJsonFile.json();
@@ -8682,7 +8716,7 @@ MakeDockerCommand = __legacyDecorateClassTS([
8682
8716
  ], MakeDockerCommand);
8683
8717
  // src/commands/MakeEntityCommand.ts
8684
8718
  var import_pluralize = __toESM(require_pluralize(), 1);
8685
- import { basename as basename3, join as join13 } from "path";
8719
+ import { basename as basename3, join as join14 } from "path";
8686
8720
  import { decorator as decorator13 } from "@ooneex/command";
8687
8721
  import { TerminalLogger as TerminalLogger13 } from "@ooneex/logger";
8688
8722
  import { toPascalCase as toPascalCase8, toSnakeCase as toSnakeCase2 } from "@ooneex/utils";
@@ -8845,28 +8879,31 @@ class MakeEntityCommand {
8845
8879
  tableName = toSnakeCase2(import_pluralize.default(name));
8846
8880
  }
8847
8881
  const content = entity_default.replace(/{{NAME}}/g, name).replace(/{{TABLE_NAME}}/g, tableName);
8848
- const base = module ? join13("modules", module) : ".";
8849
- const entitiesLocalDir = join13(base, "src", "entities");
8850
- const entitiesDir = join13(process.cwd(), entitiesLocalDir);
8851
- 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`);
8852
8889
  await Bun.write(filePath, content);
8853
8890
  const testContent = entity_test_default.replace(/{{NAME}}/g, name);
8854
- const testsLocalDir = join13(base, "tests", "entities");
8855
- const testsDir = join13(process.cwd(), testsLocalDir);
8856
- 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`);
8857
8894
  await Bun.write(testFilePath, testContent);
8858
8895
  const modulePascalName = module ? toPascalCase8(module) : toPascalCase8(basename3(process.cwd()));
8859
- const modulePath = join13(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
8896
+ const modulePath = join14(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
8860
8897
  if (await Bun.file(modulePath).exists()) {
8861
8898
  await this.addToModule(modulePath, name);
8862
8899
  }
8863
8900
  const logger = new TerminalLogger13;
8864
- logger.success(`${join13(entitiesLocalDir, name)}Entity.ts created successfully`, undefined, {
8901
+ logger.success(`${join14(entitiesLocalDir, name)}Entity.ts created successfully`, undefined, {
8865
8902
  showTimestamp: false,
8866
8903
  showArrow: false,
8867
8904
  useSymbol: true
8868
8905
  });
8869
- logger.success(`${join13(testsLocalDir, name)}Entity.spec.ts created successfully`, undefined, {
8906
+ logger.success(`${join14(testsLocalDir, name)}Entity.spec.ts created successfully`, undefined, {
8870
8907
  showTimestamp: false,
8871
8908
  showArrow: false,
8872
8909
  useSymbol: true
@@ -8877,7 +8914,7 @@ MakeEntityCommand = __legacyDecorateClassTS([
8877
8914
  decorator13.command()
8878
8915
  ], MakeEntityCommand);
8879
8916
  // src/commands/MakeLoggerCommand.ts
8880
- import { join as join14 } from "path";
8917
+ import { join as join15 } from "path";
8881
8918
  import { decorator as decorator14 } from "@ooneex/command";
8882
8919
  import { TerminalLogger as TerminalLogger14 } from "@ooneex/logger";
8883
8920
  import { toPascalCase as toPascalCase9 } from "@ooneex/utils";
@@ -8981,28 +9018,31 @@ class MakeLoggerCommand {
8981
9018
  }
8982
9019
  name = toPascalCase9(name).replace(/Logger$/, "");
8983
9020
  const content = logger_default.replace(/{{NAME}}/g, name);
8984
- const base = module ? join14("modules", module) : ".";
8985
- const loggerLocalDir = join14(base, "src", "loggers");
8986
- const loggerDir = join14(process.cwd(), loggerLocalDir);
8987
- 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`);
8988
9028
  await Bun.write(filePath, content);
8989
9029
  const testContent = logger_test_default.replace(/{{NAME}}/g, name);
8990
- const testsLocalDir = join14(base, "tests", "loggers");
8991
- const testsDir = join14(process.cwd(), testsLocalDir);
8992
- 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`);
8993
9033
  await Bun.write(testFilePath, testContent);
8994
9034
  const logger = new TerminalLogger14;
8995
- logger.success(`${join14(loggerLocalDir, name)}Logger.ts created successfully`, undefined, {
9035
+ logger.success(`${join15(loggerLocalDir, name)}Logger.ts created successfully`, undefined, {
8996
9036
  showTimestamp: false,
8997
9037
  showArrow: false,
8998
9038
  useSymbol: true
8999
9039
  });
9000
- logger.success(`${join14(testsLocalDir, name)}Logger.spec.ts created successfully`, undefined, {
9040
+ logger.success(`${join15(testsLocalDir, name)}Logger.spec.ts created successfully`, undefined, {
9001
9041
  showTimestamp: false,
9002
9042
  showArrow: false,
9003
9043
  useSymbol: true
9004
9044
  });
9005
- const packageJsonPath = join14(process.cwd(), "package.json");
9045
+ const packageJsonPath = join15(process.cwd(), "package.json");
9006
9046
  const packageJson = await Bun.file(packageJsonPath).json();
9007
9047
  const deps = packageJson.dependencies ?? {};
9008
9048
  const devDeps = packageJson.devDependencies ?? {};
@@ -9020,7 +9060,7 @@ MakeLoggerCommand = __legacyDecorateClassTS([
9020
9060
  decorator14.command()
9021
9061
  ], MakeLoggerCommand);
9022
9062
  // src/commands/MakeMailerCommand.ts
9023
- import { join as join15 } from "path";
9063
+ import { join as join16 } from "path";
9024
9064
  import { decorator as decorator15 } from "@ooneex/command";
9025
9065
  import { TerminalLogger as TerminalLogger15 } from "@ooneex/logger";
9026
9066
  import { toPascalCase as toPascalCase10 } from "@ooneex/utils";
@@ -9117,43 +9157,46 @@ class MakeMailerCommand {
9117
9157
  name = toPascalCase10(name).replace(/Mailer$/, "");
9118
9158
  const mailerContent = mailer_default.replace(/{{NAME}}/g, name);
9119
9159
  const templateContent = mailer_template_default.replace(/{{NAME}}/g, name);
9120
- const base = module ? join15("modules", module) : ".";
9121
- const mailerLocalDir = join15(base, "src", "mailers");
9122
- const mailerDir = join15(process.cwd(), mailerLocalDir);
9123
- const mailerFilePath = join15(mailerDir, `${name}Mailer.ts`);
9124
- 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`);
9125
9168
  await Bun.write(mailerFilePath, mailerContent);
9126
9169
  await Bun.write(templateFilePath, templateContent);
9127
9170
  const mailerTestContent = mailer_test_default.replace(/{{NAME}}/g, name);
9128
9171
  const templateTestContent = mailer_template_test_default.replace(/{{NAME}}/g, name);
9129
- const testsLocalDir = join15(base, "tests", "mailers");
9130
- const testsDir = join15(process.cwd(), testsLocalDir);
9131
- const mailerTestFilePath = join15(testsDir, `${name}Mailer.spec.ts`);
9132
- 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`);
9133
9176
  await Bun.write(mailerTestFilePath, mailerTestContent);
9134
9177
  await Bun.write(templateTestFilePath, templateTestContent);
9135
9178
  const logger = new TerminalLogger15;
9136
- logger.success(`${join15(mailerLocalDir, name)}Mailer.ts created successfully`, undefined, {
9179
+ logger.success(`${join16(mailerLocalDir, name)}Mailer.ts created successfully`, undefined, {
9137
9180
  showTimestamp: false,
9138
9181
  showArrow: false,
9139
9182
  useSymbol: true
9140
9183
  });
9141
- logger.success(`${join15(mailerLocalDir, name)}MailerTemplate.tsx created successfully`, undefined, {
9184
+ logger.success(`${join16(mailerLocalDir, name)}MailerTemplate.tsx created successfully`, undefined, {
9142
9185
  showTimestamp: false,
9143
9186
  showArrow: false,
9144
9187
  useSymbol: true
9145
9188
  });
9146
- logger.success(`${join15(testsLocalDir, name)}Mailer.spec.ts created successfully`, undefined, {
9189
+ logger.success(`${join16(testsLocalDir, name)}Mailer.spec.ts created successfully`, undefined, {
9147
9190
  showTimestamp: false,
9148
9191
  showArrow: false,
9149
9192
  useSymbol: true
9150
9193
  });
9151
- logger.success(`${join15(testsLocalDir, name)}MailerTemplate.spec.ts created successfully`, undefined, {
9194
+ logger.success(`${join16(testsLocalDir, name)}MailerTemplate.spec.ts created successfully`, undefined, {
9152
9195
  showTimestamp: false,
9153
9196
  showArrow: false,
9154
9197
  useSymbol: true
9155
9198
  });
9156
- const packageJsonPath = join15(process.cwd(), "package.json");
9199
+ const packageJsonPath = join16(process.cwd(), "package.json");
9157
9200
  const packageJson = await Bun.file(packageJsonPath).json();
9158
9201
  const deps = packageJson.dependencies ?? {};
9159
9202
  const devDeps = packageJson.devDependencies ?? {};
@@ -9171,7 +9214,7 @@ MakeMailerCommand = __legacyDecorateClassTS([
9171
9214
  decorator15.command()
9172
9215
  ], MakeMailerCommand);
9173
9216
  // src/commands/MakeMiddlewareCommand.ts
9174
- import { basename as basename4, join as join16 } from "path";
9217
+ import { basename as basename4, join as join17 } from "path";
9175
9218
  import { decorator as decorator16 } from "@ooneex/command";
9176
9219
  import { TerminalLogger as TerminalLogger16 } from "@ooneex/logger";
9177
9220
  import { toPascalCase as toPascalCase11 } from "@ooneex/utils";
@@ -9259,33 +9302,36 @@ class MakeMiddlewareCommand {
9259
9302
  name = toPascalCase11(name).replace(/Middleware$/, "");
9260
9303
  const selectedTemplate = isSocket ? middleware_socket_default : middleware_default;
9261
9304
  const content = selectedTemplate.replace(/{{NAME}}/g, name);
9262
- const base = module ? join16("modules", module) : ".";
9263
- const middlewareLocalDir = join16(base, "src", "middlewares");
9264
- const middlewareDir = join16(process.cwd(), middlewareLocalDir);
9265
- 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`);
9266
9312
  await Bun.write(filePath, content);
9267
9313
  const testContent = middleware_test_default.replace(/{{NAME}}/g, name);
9268
- const testsLocalDir = join16(base, "tests", "middlewares");
9269
- const testsDir = join16(process.cwd(), testsLocalDir);
9270
- 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`);
9271
9317
  await Bun.write(testFilePath, testContent);
9272
9318
  const modulePascalName = module ? toPascalCase11(module) : toPascalCase11(basename4(process.cwd()));
9273
- const modulePath = join16(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
9319
+ const modulePath = join17(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
9274
9320
  if (await Bun.file(modulePath).exists()) {
9275
9321
  await this.addToModule(modulePath, name);
9276
9322
  }
9277
9323
  const logger = new TerminalLogger16;
9278
- logger.success(`${join16(middlewareLocalDir, name)}Middleware.ts created successfully`, undefined, {
9324
+ logger.success(`${join17(middlewareLocalDir, name)}Middleware.ts created successfully`, undefined, {
9279
9325
  showTimestamp: false,
9280
9326
  showArrow: false,
9281
9327
  useSymbol: true
9282
9328
  });
9283
- logger.success(`${join16(testsLocalDir, name)}Middleware.spec.ts created successfully`, undefined, {
9329
+ logger.success(`${join17(testsLocalDir, name)}Middleware.spec.ts created successfully`, undefined, {
9284
9330
  showTimestamp: false,
9285
9331
  showArrow: false,
9286
9332
  useSymbol: true
9287
9333
  });
9288
- const packageJsonPath = join16(process.cwd(), "package.json");
9334
+ const packageJsonPath = join17(process.cwd(), "package.json");
9289
9335
  const packageJson = await Bun.file(packageJsonPath).json();
9290
9336
  const deps = packageJson.dependencies ?? {};
9291
9337
  const devDeps = packageJson.devDependencies ?? {};
@@ -9303,7 +9349,7 @@ MakeMiddlewareCommand = __legacyDecorateClassTS([
9303
9349
  decorator16.command()
9304
9350
  ], MakeMiddlewareCommand);
9305
9351
  // src/commands/MakeMigrationCommand.ts
9306
- import { join as join17 } from "path";
9352
+ import { join as join18 } from "path";
9307
9353
  import { decorator as decorator17 } from "@ooneex/command";
9308
9354
  import { TerminalLogger as TerminalLogger17 } from "@ooneex/logger";
9309
9355
  import { migrationCreate } from "@ooneex/migrations";
@@ -9330,17 +9376,20 @@ class MakeMigrationCommand {
9330
9376
  }
9331
9377
  async run(options) {
9332
9378
  const { module } = options;
9333
- const base = module ? join17("modules", module) : ".";
9379
+ if (module) {
9380
+ await ensureModule(module);
9381
+ }
9382
+ const base = module ? join18("modules", module) : ".";
9334
9383
  const { migrationPath: filePath } = await migrationCreate({
9335
- migrationsDir: join17(base, "src", "migrations"),
9336
- testsDir: join17(base, "tests", "migrations")
9384
+ migrationsDir: join18(base, "src", "migrations"),
9385
+ testsDir: join18(base, "tests", "migrations")
9337
9386
  });
9338
- const binMigrationUpPath = join17(process.cwd(), base, "bin", "migration", "up.ts");
9387
+ const binMigrationUpPath = join18(process.cwd(), base, "bin", "migration", "up.ts");
9339
9388
  const binMigrationUpFile = Bun.file(binMigrationUpPath);
9340
9389
  if (!await binMigrationUpFile.exists()) {
9341
9390
  await Bun.write(binMigrationUpPath, migration_up_default);
9342
9391
  }
9343
- const packageJsonPath = join17(process.cwd(), "package.json");
9392
+ const packageJsonPath = join18(process.cwd(), "package.json");
9344
9393
  const packageJsonFile = Bun.file(packageJsonPath);
9345
9394
  if (await packageJsonFile.exists()) {
9346
9395
  const packageJson = await packageJsonFile.json();
@@ -9376,7 +9425,7 @@ MakeMigrationCommand = __legacyDecorateClassTS([
9376
9425
  decorator17.command()
9377
9426
  ], MakeMigrationCommand);
9378
9427
  // src/commands/MakePermissionCommand.ts
9379
- import { join as join18 } from "path";
9428
+ import { join as join19 } from "path";
9380
9429
  import { decorator as decorator18 } from "@ooneex/command";
9381
9430
  import { TerminalLogger as TerminalLogger18 } from "@ooneex/logger";
9382
9431
  import { toPascalCase as toPascalCase12 } from "@ooneex/utils";
@@ -9466,28 +9515,31 @@ class MakePermissionCommand {
9466
9515
  }
9467
9516
  name = toPascalCase12(name).replace(/Permission$/, "");
9468
9517
  const content = permission_default.replace(/{{NAME}}/g, name);
9469
- const base = module ? join18("modules", module) : ".";
9470
- const permissionLocalDir = join18(base, "src", "permissions");
9471
- const permissionDir = join18(process.cwd(), permissionLocalDir);
9472
- 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`);
9473
9525
  await Bun.write(filePath, content);
9474
9526
  const testContent = permission_test_default.replace(/{{NAME}}/g, name);
9475
- const testsLocalDir = join18(base, "tests", "permissions");
9476
- const testsDir = join18(process.cwd(), testsLocalDir);
9477
- 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`);
9478
9530
  await Bun.write(testFilePath, testContent);
9479
9531
  const logger = new TerminalLogger18;
9480
- logger.success(`${join18(permissionLocalDir, name)}Permission.ts created successfully`, undefined, {
9532
+ logger.success(`${join19(permissionLocalDir, name)}Permission.ts created successfully`, undefined, {
9481
9533
  showTimestamp: false,
9482
9534
  showArrow: false,
9483
9535
  useSymbol: true
9484
9536
  });
9485
- logger.success(`${join18(testsLocalDir, name)}Permission.spec.ts created successfully`, undefined, {
9537
+ logger.success(`${join19(testsLocalDir, name)}Permission.spec.ts created successfully`, undefined, {
9486
9538
  showTimestamp: false,
9487
9539
  showArrow: false,
9488
9540
  useSymbol: true
9489
9541
  });
9490
- const packageJsonPath = join18(process.cwd(), "package.json");
9542
+ const packageJsonPath = join19(process.cwd(), "package.json");
9491
9543
  const packageJson = await Bun.file(packageJsonPath).json();
9492
9544
  const deps = packageJson.dependencies ?? {};
9493
9545
  const devDeps = packageJson.devDependencies ?? {};
@@ -9505,7 +9557,7 @@ MakePermissionCommand = __legacyDecorateClassTS([
9505
9557
  decorator18.command()
9506
9558
  ], MakePermissionCommand);
9507
9559
  // src/commands/MakePubSubCommand.ts
9508
- import { basename as basename5, join as join19 } from "path";
9560
+ import { basename as basename5, join as join20 } from "path";
9509
9561
  import { decorator as decorator19 } from "@ooneex/command";
9510
9562
  import { TerminalLogger as TerminalLogger19 } from "@ooneex/logger";
9511
9563
  import { toKebabCase as toKebabCase4, toPascalCase as toPascalCase13 } from "@ooneex/utils";
@@ -9612,33 +9664,36 @@ class MakePubSubCommand {
9612
9664
  channel = toKebabCase4(name);
9613
9665
  }
9614
9666
  const content = pubsub_default.replace(/{{NAME}}/g, name).replace(/{{CHANNEL}}/g, channel);
9615
- const base = module ? join19("modules", module) : ".";
9616
- const pubSubLocalDir = join19(base, "src", "events");
9617
- const pubSubDir = join19(process.cwd(), pubSubLocalDir);
9618
- 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`);
9619
9674
  await Bun.write(filePath, content);
9620
9675
  const testContent = pubsub_test_default.replace(/{{NAME}}/g, name);
9621
- const testsLocalDir = join19(base, "tests", "events");
9622
- const testsDir = join19(process.cwd(), testsLocalDir);
9623
- 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`);
9624
9679
  await Bun.write(testFilePath, testContent);
9625
9680
  const modulePascalName = module ? toPascalCase13(module) : toPascalCase13(basename5(process.cwd()));
9626
- const modulePath = join19(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
9681
+ const modulePath = join20(process.cwd(), base, "src", `${modulePascalName}Module.ts`);
9627
9682
  if (await Bun.file(modulePath).exists()) {
9628
9683
  await this.addToModule(modulePath, name);
9629
9684
  }
9630
9685
  const logger = new TerminalLogger19;
9631
- logger.success(`${join19(pubSubLocalDir, name)}Event.ts created successfully`, undefined, {
9686
+ logger.success(`${join20(pubSubLocalDir, name)}Event.ts created successfully`, undefined, {
9632
9687
  showTimestamp: false,
9633
9688
  showArrow: false,
9634
9689
  useSymbol: true
9635
9690
  });
9636
- logger.success(`${join19(testsLocalDir, name)}Event.spec.ts created successfully`, undefined, {
9691
+ logger.success(`${join20(testsLocalDir, name)}Event.spec.ts created successfully`, undefined, {
9637
9692
  showTimestamp: false,
9638
9693
  showArrow: false,
9639
9694
  useSymbol: true
9640
9695
  });
9641
- const packageJsonPath = join19(process.cwd(), "package.json");
9696
+ const packageJsonPath = join20(process.cwd(), "package.json");
9642
9697
  const packageJson = await Bun.file(packageJsonPath).json();
9643
9698
  const deps = packageJson.dependencies ?? {};
9644
9699
  const devDeps = packageJson.devDependencies ?? {};
@@ -9657,7 +9712,7 @@ MakePubSubCommand = __legacyDecorateClassTS([
9657
9712
  ], MakePubSubCommand);
9658
9713
  // src/commands/MakeReleaseCommand.ts
9659
9714
  import { readdir } from "fs/promises";
9660
- import { join as join20 } from "path";
9715
+ import { join as join21 } from "path";
9661
9716
  import { decorator as decorator20 } from "@ooneex/command";
9662
9717
  import { TerminalLogger as TerminalLogger20 } from "@ooneex/logger";
9663
9718
  var {$ } = globalThis.Bun;
@@ -9690,8 +9745,8 @@ class MakeReleaseCommand {
9690
9745
  { name: "modules", type: "module" }
9691
9746
  ]) {
9692
9747
  try {
9693
- const entries = await readdir(join20(cwd, name), { withFileTypes: true });
9694
- 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 })));
9695
9750
  } catch {}
9696
9751
  }
9697
9752
  const logOptions = { showTimestamp: false, showArrow: false, useSymbol: true };
@@ -9701,8 +9756,8 @@ class MakeReleaseCommand {
9701
9756
  }
9702
9757
  let releasedCount = 0;
9703
9758
  for (const dir of dirs) {
9704
- const fullDir = join20(cwd, dir.base);
9705
- const pkgJsonPath = join20(fullDir, "package.json");
9759
+ const fullDir = join21(cwd, dir.base);
9760
+ const pkgJsonPath = join21(fullDir, "package.json");
9706
9761
  const pkgJsonFile = Bun.file(pkgJsonPath);
9707
9762
  if (!await pkgJsonFile.exists()) {
9708
9763
  continue;
@@ -9720,7 +9775,7 @@ class MakeReleaseCommand {
9720
9775
  await Bun.write(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}
9721
9776
  `);
9722
9777
  await this.updateChangelog(fullDir, newVersion, tag, commits);
9723
- 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"));
9724
9779
  await this.gitCommit(`chore(release): ${pkgJson.name}@${newVersion}`);
9725
9780
  await this.gitTag(tag, `chore(release): ${pkgJson.name}@${newVersion}`);
9726
9781
  logger.success(`${pkgJson.name}@${newVersion} released (${bumpType} bump, ${commits.length} commit(s))`, undefined, logOptions);
@@ -9817,7 +9872,7 @@ class MakeReleaseCommand {
9817
9872
  }
9818
9873
  }
9819
9874
  async updateChangelog(dir, version, tag, commits) {
9820
- const changelogPath = join20(dir, "CHANGELOG.md");
9875
+ const changelogPath = join21(dir, "CHANGELOG.md");
9821
9876
  const today = new Date().toISOString().split("T")[0];
9822
9877
  const repoUrl = await this.getRepoUrl();
9823
9878
  const grouped = new Map;
@@ -9891,7 +9946,7 @@ MakeReleaseCommand = __legacyDecorateClassTS([
9891
9946
  decorator20.command()
9892
9947
  ], MakeReleaseCommand);
9893
9948
  // src/commands/MakeRepositoryCommand.ts
9894
- import { join as join21 } from "path";
9949
+ import { join as join22 } from "path";
9895
9950
  import { decorator as decorator21 } from "@ooneex/command";
9896
9951
  import { TerminalLogger as TerminalLogger21 } from "@ooneex/logger";
9897
9952
  import { toPascalCase as toPascalCase14 } from "@ooneex/utils";
@@ -10104,28 +10159,31 @@ class MakeRepositoryCommand {
10104
10159
  }
10105
10160
  name = toPascalCase14(name).replace(/Repository$/, "");
10106
10161
  const content = repository_default.replace(/{{NAME}}/g, name);
10107
- const base = module ? join21("modules", module) : ".";
10108
- const repositoriesLocalDir = join21(base, "src", "repositories");
10109
- const repositoriesDir = join21(process.cwd(), repositoriesLocalDir);
10110
- 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`);
10111
10169
  await Bun.write(filePath, content);
10112
10170
  const testContent = repository_test_default.replace(/{{NAME}}/g, name);
10113
- const testsLocalDir = join21(base, "tests", "repositories");
10114
- const testsDir = join21(process.cwd(), testsLocalDir);
10115
- 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`);
10116
10174
  await Bun.write(testFilePath, testContent);
10117
10175
  const logger = new TerminalLogger21;
10118
- logger.success(`${join21(repositoriesLocalDir, name)}Repository.ts created successfully`, undefined, {
10176
+ logger.success(`${join22(repositoriesLocalDir, name)}Repository.ts created successfully`, undefined, {
10119
10177
  showTimestamp: false,
10120
10178
  showArrow: false,
10121
10179
  useSymbol: true
10122
10180
  });
10123
- logger.success(`${join21(testsLocalDir, name)}Repository.spec.ts created successfully`, undefined, {
10181
+ logger.success(`${join22(testsLocalDir, name)}Repository.spec.ts created successfully`, undefined, {
10124
10182
  showTimestamp: false,
10125
10183
  showArrow: false,
10126
10184
  useSymbol: true
10127
10185
  });
10128
- const packageJsonPath = join21(process.cwd(), "package.json");
10186
+ const packageJsonPath = join22(process.cwd(), "package.json");
10129
10187
  const packageJson = await Bun.file(packageJsonPath).json();
10130
10188
  const deps = packageJson.dependencies ?? {};
10131
10189
  const devDeps = packageJson.devDependencies ?? {};
@@ -10143,7 +10201,7 @@ MakeRepositoryCommand = __legacyDecorateClassTS([
10143
10201
  decorator21.command()
10144
10202
  ], MakeRepositoryCommand);
10145
10203
  // src/commands/MakeResourceBookCommand.ts
10146
- import { join as join23 } from "path";
10204
+ import { join as join24 } from "path";
10147
10205
  import { decorator as decorator23 } from "@ooneex/command";
10148
10206
  var {Glob } = globalThis.Bun;
10149
10207
 
@@ -10840,7 +10898,7 @@ export class UpdateBookService implements IService {
10840
10898
  `;
10841
10899
 
10842
10900
  // src/commands/MakeServiceCommand.ts
10843
- import { join as join22 } from "path";
10901
+ import { join as join23 } from "path";
10844
10902
  import { decorator as decorator22 } from "@ooneex/command";
10845
10903
  import { TerminalLogger as TerminalLogger22 } from "@ooneex/logger";
10846
10904
  import { toPascalCase as toPascalCase15 } from "@ooneex/utils";
@@ -10891,28 +10949,31 @@ class MakeServiceCommand {
10891
10949
  }
10892
10950
  name = toPascalCase15(name).replace(/Service$/, "");
10893
10951
  const content = service_default.replace(/{{NAME}}/g, name);
10894
- const base = module ? join22("modules", module) : ".";
10895
- const serviceLocalDir = join22(base, "src", "services");
10896
- const serviceDir = join22(process.cwd(), serviceLocalDir);
10897
- 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`);
10898
10959
  await Bun.write(filePath, content);
10899
10960
  const testContent = service_test_default.replace(/{{NAME}}/g, name);
10900
- const testsLocalDir = join22(base, "tests", "services");
10901
- const testsDir = join22(process.cwd(), testsLocalDir);
10902
- 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`);
10903
10964
  await Bun.write(testFilePath, testContent);
10904
10965
  const logger = new TerminalLogger22;
10905
- logger.success(`${join22(serviceLocalDir, name)}Service.ts created successfully`, undefined, {
10966
+ logger.success(`${join23(serviceLocalDir, name)}Service.ts created successfully`, undefined, {
10906
10967
  showTimestamp: false,
10907
10968
  showArrow: false,
10908
10969
  useSymbol: true
10909
10970
  });
10910
- logger.success(`${join22(testsLocalDir, name)}Service.spec.ts created successfully`, undefined, {
10971
+ logger.success(`${join23(testsLocalDir, name)}Service.spec.ts created successfully`, undefined, {
10911
10972
  showTimestamp: false,
10912
10973
  showArrow: false,
10913
10974
  useSymbol: true
10914
10975
  });
10915
- const packageJsonPath = join22(process.cwd(), "package.json");
10976
+ const packageJsonPath = join23(process.cwd(), "package.json");
10916
10977
  const packageJson = await Bun.file(packageJsonPath).json();
10917
10978
  const deps = packageJson.dependencies ?? {};
10918
10979
  const devDeps = packageJson.devDependencies ?? {};
@@ -10940,7 +11001,7 @@ class MakeResourceBookCommand {
10940
11001
  }
10941
11002
  async run() {
10942
11003
  const module = "book";
10943
- const base = join23("modules", module);
11004
+ const base = join24("modules", module);
10944
11005
  const makeModuleCommand = new MakeModuleCommand;
10945
11006
  await makeModuleCommand.run({ name: module, silent: true, skipMigrations: false, skipSeeds: true });
10946
11007
  const makeEntityCommand = new MakeEntityCommand;
@@ -10960,26 +11021,26 @@ class MakeResourceBookCommand {
10960
11021
  for (const controller of controllers) {
10961
11022
  await makeControllerCommand.run({ ...controller, module, isSocket: false });
10962
11023
  }
10963
- const controllersDir = join23(process.cwd(), base, "src", "controllers");
10964
- await Bun.write(join23(controllersDir, "CreateBookController.ts"), CreateBookController_default);
10965
- await Bun.write(join23(controllersDir, "GetBookController.ts"), GetBookController_default);
10966
- await Bun.write(join23(controllersDir, "ListBooksController.ts"), ListBooksController_default);
10967
- await Bun.write(join23(controllersDir, "UpdateBookController.ts"), UpdateBookController_default);
10968
- 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);
10969
11030
  const makeServiceCommand = new MakeServiceCommand;
10970
11031
  const services = ["CreateBook", "GetBook", "ListBooks", "UpdateBook", "DeleteBook"];
10971
11032
  for (const name of services) {
10972
11033
  await makeServiceCommand.run({ name, module });
10973
11034
  }
10974
- const servicesDir = join23(process.cwd(), base, "src", "services");
10975
- await Bun.write(join23(servicesDir, "CreateBookService.ts"), CreateBookService_default);
10976
- await Bun.write(join23(servicesDir, "GetBookService.ts"), GetBookService_default);
10977
- await Bun.write(join23(servicesDir, "ListBooksService.ts"), ListBooksService_default);
10978
- await Bun.write(join23(servicesDir, "UpdateBookService.ts"), UpdateBookService_default);
10979
- await Bun.write(join23(servicesDir, "DeleteBookService.ts"), DeleteBookService_default);
10980
- 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");
10981
11042
  await Bun.write(entityPath, BookEntity_default);
10982
- const migrationsDir = join23(process.cwd(), base, "src", "migrations");
11043
+ const migrationsDir = join24(process.cwd(), base, "src", "migrations");
10983
11044
  const glob = new Glob("Migration*.ts");
10984
11045
  for await (const file of glob.scan(migrationsDir)) {
10985
11046
  if (file === "migrations.ts")
@@ -10987,9 +11048,9 @@ class MakeResourceBookCommand {
10987
11048
  const name = file.replace(/\.ts$/, "");
10988
11049
  const version = name.replace("Migration", "");
10989
11050
  const content = BookMigration_default.replaceAll("{{ name }}", name).replaceAll("{{ version }}", version);
10990
- await Bun.write(join23(migrationsDir, file), content);
11051
+ await Bun.write(join24(migrationsDir, file), content);
10991
11052
  }
10992
- const repositoryPath = join23(process.cwd(), base, "src", "repositories", "BookRepository.ts");
11053
+ const repositoryPath = join24(process.cwd(), base, "src", "repositories", "BookRepository.ts");
10993
11054
  await Bun.write(repositoryPath, BookRepository_default);
10994
11055
  }
10995
11056
  }
@@ -10997,7 +11058,7 @@ MakeResourceBookCommand = __legacyDecorateClassTS([
10997
11058
  decorator23.command()
10998
11059
  ], MakeResourceBookCommand);
10999
11060
  // src/commands/MakeSeedCommand.ts
11000
- import { join as join24 } from "path";
11061
+ import { join as join25 } from "path";
11001
11062
  import { decorator as decorator24 } from "@ooneex/command";
11002
11063
  import { TerminalLogger as TerminalLogger23 } from "@ooneex/logger";
11003
11064
  import { seedCreate } from "@ooneex/seeds";
@@ -11024,18 +11085,21 @@ class MakeSeedCommand {
11024
11085
  if (!name) {
11025
11086
  name = await askName({ message: "Enter seed name" });
11026
11087
  }
11027
- const base = module ? join24("modules", module) : ".";
11088
+ if (module) {
11089
+ await ensureModule(module);
11090
+ }
11091
+ const base = module ? join25("modules", module) : ".";
11028
11092
  const { seedPath: filePath } = await seedCreate({
11029
11093
  name,
11030
- seedsDir: join24(base, "src", "seeds"),
11031
- testsDir: join24(base, "tests", "seeds")
11094
+ seedsDir: join25(base, "src", "seeds"),
11095
+ testsDir: join25(base, "tests", "seeds")
11032
11096
  });
11033
- const binSeedRunPath = join24(process.cwd(), base, "bin", "seed", "run.ts");
11097
+ const binSeedRunPath = join25(process.cwd(), base, "bin", "seed", "run.ts");
11034
11098
  const binSeedRunFile = Bun.file(binSeedRunPath);
11035
11099
  if (!await binSeedRunFile.exists()) {
11036
11100
  await Bun.write(binSeedRunPath, seed_run_default);
11037
11101
  }
11038
- const packageJsonPath = join24(process.cwd(), "package.json");
11102
+ const packageJsonPath = join25(process.cwd(), "package.json");
11039
11103
  const packageJsonFile = Bun.file(packageJsonPath);
11040
11104
  if (await packageJsonFile.exists()) {
11041
11105
  const packageJson = await packageJsonFile.json();
@@ -11071,7 +11135,7 @@ MakeSeedCommand = __legacyDecorateClassTS([
11071
11135
  decorator24.command()
11072
11136
  ], MakeSeedCommand);
11073
11137
  // src/commands/MakeStorageCommand.ts
11074
- import { join as join25 } from "path";
11138
+ import { join as join26 } from "path";
11075
11139
  import { decorator as decorator25 } from "@ooneex/command";
11076
11140
  import { TerminalLogger as TerminalLogger24 } from "@ooneex/logger";
11077
11141
  import { toPascalCase as toPascalCase16, toSnakeCase as toSnakeCase3 } from "@ooneex/utils";
@@ -11170,28 +11234,31 @@ class MakeStorageCommand {
11170
11234
  name = toPascalCase16(name).replace(/Storage$/, "");
11171
11235
  const nameUpper = toSnakeCase3(name).toUpperCase();
11172
11236
  const content = storage_default.replace(/{{NAME}}/g, name).replace(/{{NAME_UPPER}}/g, nameUpper);
11173
- const base = module ? join25("modules", module) : ".";
11174
- const storageLocalDir = join25(base, "src", "storage");
11175
- const storageDir = join25(process.cwd(), storageLocalDir);
11176
- 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`);
11177
11244
  await Bun.write(filePath, content);
11178
11245
  const testContent = storage_test_default.replace(/{{NAME}}/g, name);
11179
- const testsLocalDir = join25(base, "tests", "storage");
11180
- const testsDir = join25(process.cwd(), testsLocalDir);
11181
- 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`);
11182
11249
  await Bun.write(testFilePath, testContent);
11183
11250
  const logger = new TerminalLogger24;
11184
- logger.success(`${join25(storageLocalDir, name)}Storage.ts created successfully`, undefined, {
11251
+ logger.success(`${join26(storageLocalDir, name)}Storage.ts created successfully`, undefined, {
11185
11252
  showTimestamp: false,
11186
11253
  showArrow: false,
11187
11254
  useSymbol: true
11188
11255
  });
11189
- logger.success(`${join25(testsLocalDir, name)}Storage.spec.ts created successfully`, undefined, {
11256
+ logger.success(`${join26(testsLocalDir, name)}Storage.spec.ts created successfully`, undefined, {
11190
11257
  showTimestamp: false,
11191
11258
  showArrow: false,
11192
11259
  useSymbol: true
11193
11260
  });
11194
- const packageJsonPath = join25(process.cwd(), "package.json");
11261
+ const packageJsonPath = join26(process.cwd(), "package.json");
11195
11262
  const packageJson = await Bun.file(packageJsonPath).json();
11196
11263
  const deps = packageJson.dependencies ?? {};
11197
11264
  const devDeps = packageJson.devDependencies ?? {};
@@ -11209,7 +11276,7 @@ MakeStorageCommand = __legacyDecorateClassTS([
11209
11276
  decorator25.command()
11210
11277
  ], MakeStorageCommand);
11211
11278
  // src/commands/MakeVectorDatabaseCommand.ts
11212
- import { join as join26 } from "path";
11279
+ import { join as join27 } from "path";
11213
11280
  import { decorator as decorator26 } from "@ooneex/command";
11214
11281
  import { TerminalLogger as TerminalLogger25 } from "@ooneex/logger";
11215
11282
  import { toPascalCase as toPascalCase17 } from "@ooneex/utils";
@@ -11282,28 +11349,31 @@ class MakeVectorDatabaseCommand {
11282
11349
  }
11283
11350
  name = toPascalCase17(name).replace(/VectorDatabase$/, "").replace(/Database$/, "");
11284
11351
  const content = vector_database_default.replace(/{{NAME}}/g, name);
11285
- const base = module ? join26("modules", module) : ".";
11286
- const vectorDatabaseLocalDir = join26(base, "src", "databases");
11287
- const vectorDatabaseDir = join26(process.cwd(), vectorDatabaseLocalDir);
11288
- 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`);
11289
11359
  await Bun.write(filePath, content);
11290
11360
  const testContent = vector_database_test_default.replace(/{{NAME}}/g, name);
11291
- const testsLocalDir = join26(base, "tests", "databases");
11292
- const testsDir = join26(process.cwd(), testsLocalDir);
11293
- 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`);
11294
11364
  await Bun.write(testFilePath, testContent);
11295
11365
  const logger = new TerminalLogger25;
11296
- logger.success(`${join26(vectorDatabaseLocalDir, name)}VectorDatabase.ts created successfully`, undefined, {
11366
+ logger.success(`${join27(vectorDatabaseLocalDir, name)}VectorDatabase.ts created successfully`, undefined, {
11297
11367
  showTimestamp: false,
11298
11368
  showArrow: false,
11299
11369
  useSymbol: true
11300
11370
  });
11301
- logger.success(`${join26(testsLocalDir, name)}VectorDatabase.spec.ts created successfully`, undefined, {
11371
+ logger.success(`${join27(testsLocalDir, name)}VectorDatabase.spec.ts created successfully`, undefined, {
11302
11372
  showTimestamp: false,
11303
11373
  showArrow: false,
11304
11374
  useSymbol: true
11305
11375
  });
11306
- const packageJsonPath = join26(process.cwd(), "package.json");
11376
+ const packageJsonPath = join27(process.cwd(), "package.json");
11307
11377
  const packageJson = await Bun.file(packageJsonPath).json();
11308
11378
  const deps = packageJson.dependencies ?? {};
11309
11379
  const devDeps = packageJson.devDependencies ?? {};
@@ -11321,6 +11391,6 @@ MakeVectorDatabaseCommand = __legacyDecorateClassTS([
11321
11391
  decorator26.command()
11322
11392
  ], MakeVectorDatabaseCommand);
11323
11393
  // src/index.ts
11324
- await commandRun();
11394
+ await run();
11325
11395
 
11326
- //# debugId=854BD2D65051C1FE64756E2164756E21
11396
+ //# debugId=4DF42F0F6B5FA95F64756E2164756E21