@xeno-js/cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/.github/.copilot-instruction.md +73 -0
  2. package/.github/agents/git-operator.agent.md +86 -0
  3. package/.github/agents/unit-tester.agent.md +68 -0
  4. package/.husky/commit-msg +1 -0
  5. package/.husky/pre-commit +1 -0
  6. package/.husky/pre-push +1 -0
  7. package/.prettierignore +7 -0
  8. package/.prettierrc.json +37 -0
  9. package/LICENSE +15 -0
  10. package/README.md +236 -0
  11. package/commitlint.config.cjs +39 -0
  12. package/dist/domain/contracts/icommand-cli.contracts.js +2 -0
  13. package/dist/domain/contracts/icommand-runner.contracts.js +2 -0
  14. package/dist/domain/contracts/idispatch.contracts.js +2 -0
  15. package/dist/domain/contracts/ifile-service.contracts.js +2 -0
  16. package/dist/domain/contracts/igenerator.contracts.js +2 -0
  17. package/dist/domain/contracts/index.js +2 -0
  18. package/dist/domain/contracts/iscaffold-strategy.contracts.js +2 -0
  19. package/dist/domain/index.js +2 -0
  20. package/dist/generator.contracts.js +13 -0
  21. package/dist/index.js +31 -0
  22. package/dist/infrastructure/bootstrap/bootstrapper.js +32 -0
  23. package/dist/infrastructure/bootstrap/index.js +17 -0
  24. package/dist/infrastructure/builder/builder.js +16 -0
  25. package/dist/infrastructure/builder/builder.test.js +30 -0
  26. package/dist/infrastructure/builder/index.js +17 -0
  27. package/dist/infrastructure/command_launcher/command.utils.js +30 -0
  28. package/dist/infrastructure/command_launcher/index.js +2 -0
  29. package/dist/infrastructure/commands/command-runner.service.js +36 -0
  30. package/dist/infrastructure/commands/generate.command.js +48 -0
  31. package/dist/infrastructure/commands/help.command.js +44 -0
  32. package/dist/infrastructure/commands/index.js +20 -0
  33. package/dist/infrastructure/commands/new-project.command.js +43 -0
  34. package/dist/infrastructure/dispatcher/dispatcher.js +39 -0
  35. package/dist/infrastructure/dispatcher/index.js +17 -0
  36. package/dist/infrastructure/file/file.service.js +13 -0
  37. package/dist/infrastructure/file/index.js +17 -0
  38. package/dist/infrastructure/generators/bootstrap.generator.js +118 -0
  39. package/dist/infrastructure/generators/core/bootstrap.generator.js +118 -0
  40. package/dist/infrastructure/generators/core/command/cqrs.generator.js +49 -0
  41. package/dist/infrastructure/generators/core/command/generate-command.generator.js +163 -0
  42. package/dist/infrastructure/generators/core/command/generate-query.generator.js +131 -0
  43. package/dist/infrastructure/generators/core/drizzle-sql-lite.generator.js +78 -0
  44. package/dist/infrastructure/generators/core/drizzle.generator.js +85 -0
  45. package/dist/infrastructure/generators/core/env.generator.js +69 -0
  46. package/dist/infrastructure/generators/core/index.js +25 -0
  47. package/dist/infrastructure/generators/core/main.generator.js +45 -0
  48. package/dist/infrastructure/generators/core/packagejson.generator.js +78 -0
  49. package/dist/infrastructure/generators/core/readme.generator.js +431 -0
  50. package/dist/infrastructure/generators/core/registry.generator.js +46 -0
  51. package/dist/infrastructure/generators/core/tsconfig.generator.js +41 -0
  52. package/dist/infrastructure/generators/core-packagejson.generator.js +78 -0
  53. package/dist/infrastructure/generators/drizzle-sql-lite.generator.js +78 -0
  54. package/dist/infrastructure/generators/drizzle.generator.js +85 -0
  55. package/dist/infrastructure/generators/env-vue.generator.js +40 -0
  56. package/dist/infrastructure/generators/env.generator.js +71 -0
  57. package/dist/infrastructure/generators/gitignore.generator.js +62 -0
  58. package/dist/infrastructure/generators/index.js +26 -0
  59. package/dist/infrastructure/generators/main.generator.js +45 -0
  60. package/dist/infrastructure/generators/readme.generator.js +431 -0
  61. package/dist/infrastructure/generators/registry.generator.js +46 -0
  62. package/dist/infrastructure/generators/tsconfig-vue.generator.js +39 -0
  63. package/dist/infrastructure/generators/tsconfig.generator.js +41 -0
  64. package/dist/infrastructure/generators/vite-config.generator.js +39 -0
  65. package/dist/infrastructure/generators/vue/app-vue.generator.js +26 -0
  66. package/dist/infrastructure/generators/vue/bootstrap-ts.generator.js +59 -0
  67. package/dist/infrastructure/generators/vue/command_query/cqrs.generator.js +36 -0
  68. package/dist/infrastructure/generators/vue/command_query/generate-command-vue.generator.js +139 -0
  69. package/dist/infrastructure/generators/vue/command_query/generate-query-vue.generator.js +147 -0
  70. package/dist/infrastructure/generators/vue/env.generator.js +40 -0
  71. package/dist/infrastructure/generators/vue/index-html.generator.js +29 -0
  72. package/dist/infrastructure/generators/vue/index.js +28 -0
  73. package/dist/infrastructure/generators/vue/main.generator.js +45 -0
  74. package/dist/infrastructure/generators/vue/packagejson.generator.js +59 -0
  75. package/dist/infrastructure/generators/vue/readme.generator.js +394 -0
  76. package/dist/infrastructure/generators/vue/registry-ts.generator.js +28 -0
  77. package/dist/infrastructure/generators/vue/router.generator.js +33 -0
  78. package/dist/infrastructure/generators/vue/tailwind.generator.js +19 -0
  79. package/dist/infrastructure/generators/vue/tsconfig.generator.js +39 -0
  80. package/dist/infrastructure/generators/vue/use-app.generator.js +43 -0
  81. package/dist/infrastructure/generators/vue/vite-config.generator.js +39 -0
  82. package/dist/infrastructure/generators/vue-packagejson.generator.js +59 -0
  83. package/dist/infrastructure/generators/vue-readme.generator.js +53 -0
  84. package/dist/infrastructure/generators/vue-source-files.generator.js +136 -0
  85. package/dist/infrastructure/index.js +21 -0
  86. package/dist/infrastructure/strategies/core-scaffold.strategy.js +99 -0
  87. package/dist/infrastructure/strategies/index.js +18 -0
  88. package/dist/infrastructure/strategies/vue-scaffold.strategy.js +79 -0
  89. package/dist/scaffolding.engine.js +60 -0
  90. package/dist/shared/constants/command.constants.js +19 -0
  91. package/dist/shared/constants/core.constants.js +10 -0
  92. package/dist/shared/constants/index.js +18 -0
  93. package/dist/shared/index.js +18 -0
  94. package/dist/shared/types/common.types.js +2 -0
  95. package/dist/shared/types/index.js +2 -0
  96. package/dist/shared/utils/guards.utils.js +310 -0
  97. package/dist/shared/utils/index.js +18 -0
  98. package/dist/shared/utils/string.utils.js +62 -0
  99. package/eslint.config.mjs +305 -0
  100. package/lint-staged.config.mjs +5 -0
  101. package/logo/logo.png +0 -0
  102. package/package.json +65 -0
  103. package/src/domain/contracts/icommand-cli.contracts.ts +13 -0
  104. package/src/domain/contracts/icommand-runner.contracts.ts +3 -0
  105. package/src/domain/contracts/idispatch.contracts.ts +3 -0
  106. package/src/domain/contracts/ifile-service.contracts.ts +3 -0
  107. package/src/domain/contracts/igenerator.contracts.ts +5 -0
  108. package/src/domain/contracts/index.ts +6 -0
  109. package/src/domain/contracts/iscaffold-strategy.contracts.ts +7 -0
  110. package/src/domain/index.ts +1 -0
  111. package/src/index.ts +30 -0
  112. package/src/infrastructure/bootstrap/bootstrapper.ts +30 -0
  113. package/src/infrastructure/bootstrap/index.ts +1 -0
  114. package/src/infrastructure/builder/builder.test.ts +36 -0
  115. package/src/infrastructure/builder/builder.ts +15 -0
  116. package/src/infrastructure/builder/index.ts +1 -0
  117. package/src/infrastructure/command_launcher/command.utils.ts +31 -0
  118. package/src/infrastructure/command_launcher/index.ts +0 -0
  119. package/src/infrastructure/commands/command-runner.service.ts +36 -0
  120. package/src/infrastructure/commands/generate.command.ts +55 -0
  121. package/src/infrastructure/commands/help.command.ts +63 -0
  122. package/src/infrastructure/commands/index.ts +4 -0
  123. package/src/infrastructure/commands/new-project.command.ts +47 -0
  124. package/src/infrastructure/dispatcher/dispatcher.ts +45 -0
  125. package/src/infrastructure/dispatcher/index.ts +1 -0
  126. package/src/infrastructure/file/file.service.ts +14 -0
  127. package/src/infrastructure/file/index.ts +1 -0
  128. package/src/infrastructure/generators/core/bootstrap.generator.ts +118 -0
  129. package/src/infrastructure/generators/core/command/cqrs.generator.ts +63 -0
  130. package/src/infrastructure/generators/core/command/generate-command.generator.ts +191 -0
  131. package/src/infrastructure/generators/core/command/generate-query.generator.ts +150 -0
  132. package/src/infrastructure/generators/core/drizzle-sql-lite.generator.ts +76 -0
  133. package/src/infrastructure/generators/core/drizzle.generator.ts +86 -0
  134. package/src/infrastructure/generators/core/env.generator.ts +69 -0
  135. package/src/infrastructure/generators/core/index.ts +9 -0
  136. package/src/infrastructure/generators/core/main.generator.ts +41 -0
  137. package/src/infrastructure/generators/core/packagejson.generator.ts +70 -0
  138. package/src/infrastructure/generators/core/readme.generator.ts +427 -0
  139. package/src/infrastructure/generators/core/registry.generator.ts +40 -0
  140. package/src/infrastructure/generators/core/tsconfig.generator.ts +39 -0
  141. package/src/infrastructure/generators/gitignore.generator.ts +60 -0
  142. package/src/infrastructure/generators/vue/app-vue.generator.ts +21 -0
  143. package/src/infrastructure/generators/vue/bootstrap-ts.generator.ts +60 -0
  144. package/src/infrastructure/generators/vue/command_query/cqrs.generator.ts +36 -0
  145. package/src/infrastructure/generators/vue/command_query/generate-command-vue.generator.ts +153 -0
  146. package/src/infrastructure/generators/vue/command_query/generate-query-vue.generator.ts +161 -0
  147. package/src/infrastructure/generators/vue/env.generator.ts +39 -0
  148. package/src/infrastructure/generators/vue/index-html.generator.ts +24 -0
  149. package/src/infrastructure/generators/vue/index.ts +12 -0
  150. package/src/infrastructure/generators/vue/main.generator.ts +41 -0
  151. package/src/infrastructure/generators/vue/packagejson.generator.ts +50 -0
  152. package/src/infrastructure/generators/vue/readme.generator.ts +389 -0
  153. package/src/infrastructure/generators/vue/registry-ts.generator.ts +26 -0
  154. package/src/infrastructure/generators/vue/router.generator.ts +35 -0
  155. package/src/infrastructure/generators/vue/tailwind.generator.ts +17 -0
  156. package/src/infrastructure/generators/vue/tsconfig.generator.ts +38 -0
  157. package/src/infrastructure/generators/vue/use-app.generator.ts +38 -0
  158. package/src/infrastructure/generators/vue/vite-config.generator.ts +35 -0
  159. package/src/infrastructure/index.ts +5 -0
  160. package/src/infrastructure/strategies/core-scaffold.strategy.ts +100 -0
  161. package/src/infrastructure/strategies/index.ts +2 -0
  162. package/src/infrastructure/strategies/vue-scaffold.strategy.ts +79 -0
  163. package/src/shared/constants/command.constants.ts +18 -0
  164. package/src/shared/constants/core.constants.ts +7 -0
  165. package/src/shared/constants/index.ts +2 -0
  166. package/src/shared/index.ts +3 -0
  167. package/src/shared/types/common.types.ts +68 -0
  168. package/src/shared/types/index.ts +1 -0
  169. package/src/shared/utils/guards.utils.ts +334 -0
  170. package/src/shared/utils/index.ts +2 -0
  171. package/src/shared/utils/string.utils.ts +60 -0
  172. package/tsconfig.json +15 -0
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.RegistryGenerator = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const shared_1 = require("../../../shared");
9
+ class RegistryGenerator {
10
+ _fileService;
11
+ constructor(_fileService) {
12
+ this._fileService = _fileService;
13
+ }
14
+ async generate(projectPath, options) {
15
+ let dbImport = '';
16
+ let registryType = '';
17
+ if (options.database !== shared_1.CORE_CONSTANTS.NONE) {
18
+ if (options.database === shared_1.CORE_CONSTANTS.DRIZZLE) {
19
+ dbImport = `import type { DbSchema } from './schema';`;
20
+ registryType = `XenoRegistry<DbSchema>`;
21
+ }
22
+ else if (options.database === shared_1.CORE_CONSTANTS.SQL_LITE) {
23
+ dbImport = `import type { SqliteSchema } from './schema';`;
24
+ registryType = `XenoRegistry<SqliteSchema>`;
25
+ }
26
+ }
27
+ else {
28
+ registryType = `XenoRegistry`;
29
+ }
30
+ const content = `import type { XenoRegistry } from '@xeno-js/core';
31
+ ${dbImport}
32
+
33
+ /**
34
+ * @file registry.ts
35
+ * @description Centralized Type Contract for Dependency Injection.
36
+ */
37
+ export interface MyRegistry extends ${registryType} {
38
+ // Add your application injection tokens here
39
+ // e.g., USER_REPOSITORY: IUserRepository;
40
+ }
41
+ `;
42
+ const filePath = node_path_1.default.join(projectPath, 'src', 'registry.ts');
43
+ await this._fileService.writeFileRecursive(filePath, content);
44
+ }
45
+ }
46
+ exports.RegistryGenerator = RegistryGenerator;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.TsconfigGenerator = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const shared_1 = require("../../../shared");
9
+ class TsconfigGenerator {
10
+ _fileService;
11
+ constructor(_fileService) {
12
+ this._fileService = _fileService;
13
+ }
14
+ async generate(projectPath, options) {
15
+ const tsconfig = {
16
+ compilerOptions: {
17
+ target: 'ES2022',
18
+ module: 'ESNext',
19
+ moduleResolution: 'bundler',
20
+ strict: true,
21
+ esModuleInterop: true,
22
+ skipLibCheck: true,
23
+ forceConsistentCasingInFileNames: true,
24
+ outDir: './dist',
25
+ rootDir: './src',
26
+ types: ['node'],
27
+ paths: {
28
+ '@/*': ['./src/*'],
29
+ },
30
+ },
31
+ include: ['src/**/*.ts'],
32
+ };
33
+ if (options.database === shared_1.CORE_CONSTANTS.DRIZZLE ||
34
+ options.database === shared_1.CORE_CONSTANTS.SQL_LITE) {
35
+ tsconfig.include.push('drizzle.config.ts');
36
+ }
37
+ const filePath = node_path_1.default.join(projectPath, 'tsconfig.json');
38
+ await this._fileService.writeFileRecursive(filePath, JSON.stringify(tsconfig, null, 2));
39
+ }
40
+ }
41
+ exports.TsconfigGenerator = TsconfigGenerator;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PackageJsonCoreGenerator = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const shared_1 = require("../../shared");
9
+ class PackageJsonCoreGenerator {
10
+ _fileService;
11
+ constructor(_fileService) {
12
+ this._fileService = _fileService;
13
+ }
14
+ async generate(projectPath, options) {
15
+ const packageJson = {
16
+ name: options.targetDir,
17
+ version: '1.0.0',
18
+ private: true,
19
+ main: './dist/index.js',
20
+ module: './dist/index.js',
21
+ types: './dist/index.d.ts',
22
+ scripts: {
23
+ start: 'tsx src/main.ts',
24
+ build: 'tsc --project tsconfig.json',
25
+ g: 'xeno-js generate',
26
+ },
27
+ dependencies: {
28
+ '@xeno-js/core': 'latest',
29
+ 'dotenv': '^16.4.5',
30
+ },
31
+ devDependencies: {
32
+ '@types/node': '^20.0.0',
33
+ 'tsx': '^4.7.0',
34
+ 'typescript': '^5.4.0',
35
+ },
36
+ };
37
+ // Database & ORM
38
+ if (options.database !== shared_1.CORE_CONSTANTS.NONE) {
39
+ if (options.database === shared_1.CORE_CONSTANTS.DRIZZLE) {
40
+ packageJson.dependencies['drizzle-orm'] = '^0.45.2';
41
+ packageJson.dependencies['pg'] = '^8.22.0';
42
+ packageJson.dependencies['postgres'] = '^3.4.9';
43
+ packageJson.devDependencies['@types/pg'] = '^8.11.0';
44
+ packageJson.devDependencies['drizzle-kit'] = '^0.31.10';
45
+ packageJson.scripts['db:migrate'] = 'drizzle-kit migrate';
46
+ }
47
+ else if (options.database === shared_1.CORE_CONSTANTS.SQL_LITE) {
48
+ packageJson.dependencies['drizzle-orm'] = '^0.45.2';
49
+ packageJson.dependencies['@libsql/client'] = '^0.14.0';
50
+ packageJson.devDependencies['drizzle-kit'] = '^0.31.10';
51
+ }
52
+ packageJson.scripts['db:generate'] = 'drizzle-kit generate';
53
+ packageJson.scripts['db:push'] = 'drizzle-kit push';
54
+ }
55
+ // HTTP / External Calls
56
+ if (options.axios)
57
+ packageJson.dependencies['axios'] = '^1.16.1';
58
+ if (options.cockatiel)
59
+ packageJson.dependencies['cockatiel'] = '^4.0.0';
60
+ // Logging & Observability
61
+ if (options.pino) {
62
+ packageJson.dependencies['pino'] = '^10.3.1';
63
+ packageJson.devDependencies['pino-pretty'] = '^11.2.2';
64
+ }
65
+ if (options.sentry)
66
+ packageJson.dependencies['@sentry/node'] = '^7.64.0';
67
+ // Services
68
+ if (options.redis)
69
+ packageJson.dependencies['ioredis'] = '^5.3.1';
70
+ if (options.supabase)
71
+ packageJson.dependencies['@supabase/supabase-js'] = '^2.35.0';
72
+ if (options.zod)
73
+ packageJson.dependencies['zod'] = '^4.4.3';
74
+ const filePath = node_path_1.default.join(projectPath, 'package.json');
75
+ await this._fileService.writeFileRecursive(filePath, JSON.stringify(packageJson, null, 2));
76
+ }
77
+ }
78
+ exports.PackageJsonCoreGenerator = PackageJsonCoreGenerator;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DrizzleSqlLiteGenerator = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ /**
9
+ * @class DrizzleSqlLiteGenerator
10
+ * @description Generates a Drizzle configuration file (drizzle.config.ts) and a
11
+ * SQLite schema example (src/infrastructure/db/sqlite-schema.ts) when the user
12
+ * opts to use SQLite/libSQL instead of Postgres.
13
+ */
14
+ class DrizzleSqlLiteGenerator {
15
+ _fileService;
16
+ constructor(_fileService) {
17
+ this._fileService = _fileService;
18
+ }
19
+ async generate(projectPath, _options) {
20
+ const configContent = this.composeDrizzleConfig();
21
+ const filePath = node_path_1.default.join(projectPath, 'drizzle.config.ts');
22
+ await this._fileService.writeFileRecursive(filePath, configContent);
23
+ const schemaPath = node_path_1.default.join(projectPath, 'src', 'schema.ts');
24
+ const schemaContent = this.composeSchema();
25
+ await this._fileService.writeFileRecursive(schemaPath, schemaContent);
26
+ }
27
+ composeDrizzleConfig() {
28
+ return `import 'dotenv/config';
29
+ import { defineConfig } from 'drizzle-kit';
30
+
31
+ /**
32
+ * Drizzle Kit configuration for SQLite / libSQL.
33
+ * Uses environment variable SQLITE_DATABASE_URL to locate the database.
34
+ */
35
+ export default defineConfig({
36
+ schema: './src/schema.ts',
37
+ out: './drizzle',
38
+ dialect: 'sqlite',
39
+ dbCredentials: {
40
+ url: process.env.SQLITE_DATABASE_URL!,
41
+ },
42
+ verbose: true,
43
+ strict: true,
44
+ });
45
+ `;
46
+ }
47
+ composeSchema() {
48
+ return `import { sqliteTable, integer, text } from 'drizzle-orm/sqlite-core';
49
+
50
+ /**
51
+ * Example SQLite schema using Drizzle's libsql primitives.
52
+ * Place your application tables here (this file is scaffolded by the CLI when
53
+ * the user opts into SQLite support).
54
+ */
55
+ export const usersTable = sqliteTable('users', {
56
+ id: integer('id').primaryKey().notNull(),
57
+ name: text('name').notNull(),
58
+ description: text('description'),
59
+ });
60
+
61
+ /**
62
+ * Types inferred from the schema.
63
+ * - UserDto: Represents the shape of the data retrieved from the database ($inferSelect).
64
+ * - NewUserDto: Represents the shape of the data required to insert a new record ($inferInsert).
65
+ */
66
+ export type UserDto = typeof usersTable.$inferSelect;
67
+ export type NewUserDto = typeof usersTable.$inferInsert;
68
+
69
+ /**
70
+ * Centralized Database Schema dictionary.
71
+ */
72
+ export type SqliteSchema = {
73
+ users: typeof usersTable;
74
+ };
75
+ `;
76
+ }
77
+ }
78
+ exports.DrizzleSqlLiteGenerator = DrizzleSqlLiteGenerator;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.DrizzleGenerator = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ /**
9
+ * @class DrizzleGenerator
10
+ * @description Generates the Drizzle configuration file (drizzle.config.ts) and a basic schema file (src/schema.ts) for database scaffolding.
11
+ * The generator is only invoked if the user has opted to include database support in their project.
12
+ *
13
+ * @author Xeno
14
+ * @version 1.0.0
15
+ * @license ISC
16
+ * @since 2025-09-30
17
+ * @link https://github.com/Mattia-Carcione/xeno-js
18
+ */
19
+ class DrizzleGenerator {
20
+ _fileService;
21
+ constructor(_fileService) {
22
+ this._fileService = _fileService;
23
+ }
24
+ async generate(projectPath, _options) {
25
+ const configContent = this.composeDrizzleConfig();
26
+ const filePath = node_path_1.default.join(projectPath, 'drizzle.config.ts');
27
+ await this._fileService.writeFileRecursive(filePath, configContent);
28
+ const schemaContent = this.composeSchema();
29
+ await this._fileService.writeFileRecursive(node_path_1.default.join(projectPath, 'src', 'schema.ts'), schemaContent);
30
+ }
31
+ composeDrizzleConfig() {
32
+ return `import 'dotenv/config';
33
+ import { defineConfig } from 'drizzle-kit';
34
+
35
+ /**
36
+ * Drizzle Kit configuration file.
37
+ * Defines the schema location, migration output directory, and database connection.
38
+ */
39
+ export default defineConfig({
40
+ schema: './src/schema.ts',
41
+ out: './drizzle',
42
+ dialect: 'postgresql',
43
+ dbCredentials: {
44
+ url: process.env.DATABASE_URL!,
45
+ },
46
+ verbose: true,
47
+ strict: true,
48
+ });
49
+ `;
50
+ }
51
+ composeSchema() {
52
+ return `import { boolean, pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core';
53
+
54
+ /**
55
+ * @description Define your database tables here.
56
+ * The 'usersTable' serves as a baseline example.
57
+ * You can add more tables, relations, and indexes according to your domain requirements.
58
+ */
59
+ export const usersTable = pgTable('users', {
60
+ id: serial('id').primaryKey(),
61
+ name: text('name').notNull(),
62
+ email: text('email').notNull().unique(),
63
+ isDeleted: boolean('is_deleted').notNull().default(false),
64
+ deletedAt: timestamp('deleted_at'),
65
+ createdAt: timestamp('created_at').defaultNow(),
66
+ });
67
+
68
+ /**
69
+ * Types inferred from the schema.
70
+ * - UserDto: Represents the shape of the data retrieved from the database ($inferSelect).
71
+ * - NewUserDto: Represents the shape of the data required to insert a new record ($inferInsert).
72
+ */
73
+ export type UserDto = typeof usersTable.$inferSelect;
74
+ export type NewUserDto = typeof usersTable.$inferInsert;
75
+
76
+ /**
77
+ * Centralized Database Schema dictionary.
78
+ */
79
+ export type DbSchema = {
80
+ users: typeof usersTable;
81
+ };
82
+ `;
83
+ }
84
+ }
85
+ exports.DrizzleGenerator = DrizzleGenerator;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EnvVueGenerator = void 0;
7
+ // src/infrastructure/generators/env-vue.generator.ts
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ class EnvVueGenerator {
10
+ _fileService;
11
+ constructor(_fileService) {
12
+ this._fileService = _fileService;
13
+ }
14
+ async generate(projectPath, options) {
15
+ let content = `# ─────────────────────────────────────────────────────────────────────────────
16
+ # Xeno VUE APPLICATION ENVIRONMENT VARIABLES
17
+ # ─────────────────────────────────────────────────────────────────────────────
18
+ VITE_APP_ENV=development
19
+ `;
20
+ if (options.axios) {
21
+ content += `\n# --- Axios ---
22
+ VITE_API_BASE_URL=http://localhost:3000
23
+ `;
24
+ }
25
+ if (options.supabase) {
26
+ content += `\n# --- Authentication (Supabase) ---
27
+ VITE_SUPABASE_URL=https://your-project.supabase.co
28
+ VITE_SUPABASE_KEY=your-anon-key
29
+ `;
30
+ }
31
+ if (options.sentry) {
32
+ content += `\n# --- Error Tracking (Sentry) ---
33
+ VITE_SENTRY_DSN=https://your-sentry-dsn@o0.ingest.sentry.io/0
34
+ `;
35
+ }
36
+ await this._fileService.writeFileRecursive(node_path_1.default.join(projectPath, '.env'), content);
37
+ await this._fileService.writeFileRecursive(node_path_1.default.join(projectPath, '.env.example'), content);
38
+ }
39
+ }
40
+ exports.EnvVueGenerator = EnvVueGenerator;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EnvGenerator = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const shared_1 = require("../../shared");
9
+ const file_service_1 = require("../file/file.service");
10
+ class EnvGenerator {
11
+ _fileService;
12
+ constructor(_fileService) {
13
+ this._fileService = _fileService;
14
+ }
15
+ async generate(projectPath, options) {
16
+ const fileUtils = new file_service_1.FileUtils();
17
+ let content = `# ─────────────────────────────────────────────────────────────────────────────
18
+ # Xeno APPLICATION ENVIRONMENT VARIABLES
19
+ # ─────────────────────────────────────────────────────────────────────────────
20
+ NODE_ENV=development
21
+ `;
22
+ // Configurazione Database
23
+ if (options.database !== shared_1.CORE_CONSTANTS.NONE) {
24
+ if (options.database === shared_1.CORE_CONSTANTS.DRIZZLE) {
25
+ content += `\n# --- Database (PostgreSQL) ---
26
+ DATABASE_URL=postgres://postgres:password@localhost:5432/xeno_db
27
+ `;
28
+ }
29
+ else if (options.database === shared_1.CORE_CONSTANTS.SQL_LITE) {
30
+ content += `\n# --- Database (SQLite) ---
31
+ SQLITE_DATABASE_URL=file:./dev.sqlite
32
+ `;
33
+ }
34
+ }
35
+ if (options.axios) {
36
+ content += `\n# --- Axios ---
37
+ BASE_URL=
38
+ `;
39
+ }
40
+ // Configurazione Redis (Caching, Idempotenza, Concorrenza)
41
+ if (options.redis) {
42
+ content += `\n# --- Cache (Redis) ---
43
+ REDIS_HOST=localhost
44
+ REDIS_PORT=6379
45
+ REDIS_PASSWORD=
46
+ REDIS_USERNAME=
47
+ REDIS_TLS=false
48
+ `;
49
+ }
50
+ // Configurazione Supabase (Autenticazione)
51
+ if (options.supabase) {
52
+ content += `\n# --- Authentication (Supabase) ---
53
+ SUPABASE_URL=https://your-project.supabase.co
54
+ SUPABASE_KEY=your-anon-key
55
+ `;
56
+ }
57
+ // Configurazione Logging & Observability
58
+ if (options.sentry) {
59
+ content += `\n# --- Error Tracking (Sentry) ---
60
+ SENTRY_DSN=https://your-sentry-dsn@o0.ingest.sentry.io/0
61
+ SENTRY_ENVIRONMENT=development
62
+ `;
63
+ }
64
+ // Creiamo sia il file effettivo che il file di esempio
65
+ const envPath = node_path_1.default.join(projectPath, '.env');
66
+ const envExamplePath = node_path_1.default.join(projectPath, '.env.example');
67
+ await fileUtils.writeFileRecursive(envPath, content);
68
+ await fileUtils.writeFileRecursive(envExamplePath, content);
69
+ }
70
+ }
71
+ exports.EnvGenerator = EnvGenerator;
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.GitIgnoreGenerator = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const shared_1 = require("../../shared");
9
+ class GitIgnoreGenerator {
10
+ _fileService;
11
+ constructor(_fileService) {
12
+ this._fileService = _fileService;
13
+ }
14
+ async generate(projectPath, options) {
15
+ let content = `# Dependencies
16
+ node_modules/
17
+
18
+ # Build artifacts
19
+ dist/
20
+ out/
21
+ build/
22
+
23
+ # Environment variables
24
+ # We ignore actual .env files for security, but keep .env.example for documentation
25
+ .env
26
+ .env.local
27
+ .env.*
28
+ !.env.example
29
+
30
+ # Logs
31
+ *.log
32
+ logs/
33
+ npm-debug.log*
34
+
35
+ # Test coverage
36
+ coverage/
37
+ .nyc_output/
38
+
39
+ # OS and IDE
40
+ .DS_Store
41
+ Thumbs.db
42
+ .vscode/
43
+ .idea/
44
+ `;
45
+ if (options.database === shared_1.CORE_CONSTANTS.SQL_LITE) {
46
+ content += `\n# SQLite Database
47
+ *.sqlite
48
+ *.sqlite3
49
+ *.sqlite-journal
50
+ `;
51
+ }
52
+ // Ignora la cartella di compilazione locale di Vercel se l'ambiente lo richiede
53
+ if (options.targetEnv === shared_1.CORE_CONSTANTS.VERCEL) {
54
+ content += `\n# Vercel
55
+ .vercel/
56
+ `;
57
+ }
58
+ const filePath = node_path_1.default.join(projectPath, '.gitignore');
59
+ await this._fileService.writeFileRecursive(filePath, content);
60
+ }
61
+ }
62
+ exports.GitIgnoreGenerator = GitIgnoreGenerator;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./bootstrap.generator"), exports);
18
+ __exportStar(require("./core-packagejson.generator"), exports);
19
+ __exportStar(require("./drizzle.generator"), exports);
20
+ __exportStar(require("./drizzle-sql-lite.generator"), exports);
21
+ __exportStar(require("./env.generator"), exports);
22
+ __exportStar(require("./gitignore.generator"), exports);
23
+ __exportStar(require("./main.generator"), exports);
24
+ __exportStar(require("./readme.generator"), exports);
25
+ __exportStar(require("./registry.generator"), exports);
26
+ __exportStar(require("./tsconfig.generator"), exports);
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MainGenerator = void 0;
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ class MainGenerator {
9
+ _fileService;
10
+ constructor(_fileService) {
11
+ this._fileService = _fileService;
12
+ }
13
+ async generate(projectPath, options) {
14
+ const content = `import 'dotenv/config';
15
+ import { bootstrap } from './bootstrap';
16
+ import { TOKENS } from '@xeno-js/core';
17
+
18
+ /**
19
+ * Main Application Entry Point
20
+ */
21
+ async function main() {
22
+ try {
23
+ console.info('⏳ Bootstrapping ${options.targetDir} application...');
24
+
25
+ // Initialize the dependency injection container and infrastructure modules
26
+ const container = await bootstrap();
27
+
28
+ const logger = container.resolve(TOKENS.LOGGER)
29
+ logger.info('✅ Application started successfully!');
30
+
31
+ // TODO: Implement your logic here
32
+
33
+ } catch (error) {
34
+ console.error('❌ Critical error during startup:', error);
35
+ process.exit(1);
36
+ }
37
+ }
38
+
39
+ main();
40
+ `;
41
+ const filePath = node_path_1.default.join(projectPath, 'src', 'main.ts');
42
+ await this._fileService.writeFileRecursive(filePath, content);
43
+ }
44
+ }
45
+ exports.MainGenerator = MainGenerator;