alepha 0.13.4 → 0.13.6

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 (132) hide show
  1. package/dist/api-files/index.browser.js +5 -5
  2. package/dist/api-files/index.d.ts +191 -191
  3. package/dist/api-files/index.js +9 -9
  4. package/dist/api-jobs/index.browser.js +5 -5
  5. package/dist/api-jobs/index.d.ts +173 -173
  6. package/dist/api-jobs/index.js +9 -9
  7. package/dist/api-notifications/index.browser.js +11 -11
  8. package/dist/api-notifications/index.d.ts +11 -11
  9. package/dist/api-notifications/index.js +11 -11
  10. package/dist/api-parameters/index.browser.js +2 -2
  11. package/dist/api-parameters/index.d.ts +3 -3
  12. package/dist/api-parameters/index.js +3 -3
  13. package/dist/api-users/index.browser.js +6 -6
  14. package/dist/api-users/index.d.ts +832 -832
  15. package/dist/api-users/index.js +36 -36
  16. package/dist/api-verifications/index.browser.js +5 -5
  17. package/dist/api-verifications/index.d.ts +21 -21
  18. package/dist/api-verifications/index.js +10 -10
  19. package/dist/batch/index.d.ts +3 -3
  20. package/dist/batch/index.js +3 -3
  21. package/dist/bin/index.js +1 -1
  22. package/dist/bucket/index.d.ts +6 -6
  23. package/dist/bucket/index.js +7 -7
  24. package/dist/cache/index.d.ts +4 -4
  25. package/dist/cache/index.js +5 -5
  26. package/dist/cache-redis/index.d.ts +2 -2
  27. package/dist/cache-redis/index.js +2 -2
  28. package/dist/cli/{dist-lGnqsKpu.js → dist-BlfFtOk2.js} +16 -16
  29. package/dist/cli/{dist-lGnqsKpu.js.map → dist-BlfFtOk2.js.map} +1 -1
  30. package/dist/cli/index.d.ts +31 -75
  31. package/dist/cli/index.js +94 -171
  32. package/dist/cli/index.js.map +1 -1
  33. package/dist/command/index.d.ts +8 -8
  34. package/dist/command/index.js +11 -10
  35. package/dist/command/index.js.map +1 -1
  36. package/dist/core/index.browser.js +35 -35
  37. package/dist/core/index.d.ts +39 -39
  38. package/dist/core/index.js +35 -35
  39. package/dist/core/index.native.js +35 -35
  40. package/dist/datetime/index.d.ts +3 -3
  41. package/dist/datetime/index.js +3 -3
  42. package/dist/email/index.d.ts +11 -11
  43. package/dist/email/index.js +42 -42
  44. package/dist/fake/index.d.ts +2 -2
  45. package/dist/fake/index.js +5 -5
  46. package/dist/file/index.d.ts +4 -4
  47. package/dist/file/index.js +4 -4
  48. package/dist/lock/index.d.ts +5 -5
  49. package/dist/lock/index.js +5 -5
  50. package/dist/lock-redis/index.d.ts +2 -2
  51. package/dist/lock-redis/index.js +2 -2
  52. package/dist/logger/index.d.ts +11 -11
  53. package/dist/logger/index.js +12 -12
  54. package/dist/orm/index.browser.js +12 -12
  55. package/dist/orm/index.d.ts +52 -52
  56. package/dist/orm/index.js +32 -32
  57. package/dist/queue/index.d.ts +7 -7
  58. package/dist/queue/index.js +6 -6
  59. package/dist/queue-redis/index.d.ts +2 -2
  60. package/dist/queue-redis/index.js +2 -2
  61. package/dist/redis/index.d.ts +3 -3
  62. package/dist/redis/index.js +3 -3
  63. package/dist/retry/index.d.ts +5 -5
  64. package/dist/retry/index.js +5 -5
  65. package/dist/router/index.d.ts +1 -1
  66. package/dist/router/index.js +1 -1
  67. package/dist/scheduler/index.d.ts +10 -10
  68. package/dist/scheduler/index.js +7 -7
  69. package/dist/security/index.browser.js +7 -7
  70. package/dist/security/index.d.ts +43 -43
  71. package/dist/security/index.js +46 -46
  72. package/dist/server/index.browser.js +14 -14
  73. package/dist/server/index.d.ts +26 -26
  74. package/dist/server/index.js +26 -26
  75. package/dist/server-auth/index.browser.js +6 -6
  76. package/dist/server-auth/index.d.ts +163 -163
  77. package/dist/server-auth/index.js +13 -13
  78. package/dist/server-cache/index.d.ts +2 -2
  79. package/dist/server-cache/index.js +2 -2
  80. package/dist/server-compress/index.d.ts +2 -2
  81. package/dist/server-compress/index.js +2 -2
  82. package/dist/server-cookies/index.browser.js +3 -3
  83. package/dist/server-cookies/index.d.ts +4 -4
  84. package/dist/server-cookies/index.js +4 -4
  85. package/dist/server-cors/index.d.ts +3 -3
  86. package/dist/server-cors/index.js +3 -3
  87. package/dist/server-health/index.d.ts +3 -3
  88. package/dist/server-health/index.js +3 -3
  89. package/dist/server-helmet/index.d.ts +2 -2
  90. package/dist/server-helmet/index.js +2 -2
  91. package/dist/server-links/index.browser.js +5 -5
  92. package/dist/server-links/index.d.ts +40 -40
  93. package/dist/server-links/index.js +7 -7
  94. package/dist/server-metrics/index.d.ts +2 -2
  95. package/dist/server-metrics/index.js +86 -86
  96. package/dist/server-multipart/index.d.ts +2 -2
  97. package/dist/server-multipart/index.js +2 -2
  98. package/dist/server-proxy/index.d.ts +3 -3
  99. package/dist/server-proxy/index.js +3 -3
  100. package/dist/server-rate-limit/index.d.ts +3 -3
  101. package/dist/server-rate-limit/index.js +3 -3
  102. package/dist/server-security/index.browser.js +1 -1
  103. package/dist/server-security/index.d.ts +13 -13
  104. package/dist/server-security/index.js +4 -4
  105. package/dist/server-static/index.d.ts +3 -3
  106. package/dist/server-static/index.js +3 -3
  107. package/dist/server-swagger/index.d.ts +3 -3
  108. package/dist/server-swagger/index.js +3 -3
  109. package/dist/sms/index.d.ts +6 -6
  110. package/dist/sms/index.js +6 -6
  111. package/dist/thread/index.d.ts +3 -3
  112. package/dist/thread/index.js +3 -3
  113. package/dist/topic/index.d.ts +6 -6
  114. package/dist/topic/index.js +6 -6
  115. package/dist/topic-redis/index.d.ts +2 -2
  116. package/dist/topic-redis/index.js +2 -2
  117. package/dist/vite/index.d.ts +17 -17
  118. package/dist/vite/index.js +20 -20
  119. package/dist/websocket/index.browser.js +9 -9
  120. package/dist/websocket/index.d.ts +10 -10
  121. package/dist/websocket/index.js +10 -10
  122. package/package.json +5 -4
  123. package/src/cli/apps/AlephaCli.ts +1 -2
  124. package/src/cli/commands/BiomeCommands.ts +4 -6
  125. package/src/cli/commands/CoreCommands.ts +2 -2
  126. package/src/cli/commands/DrizzleCommands.ts +76 -78
  127. package/src/cli/commands/VerifyCommands.ts +3 -5
  128. package/src/cli/commands/ViteCommands.ts +6 -8
  129. package/src/cli/index.ts +1 -1
  130. package/src/cli/services/{ProjectUtils.ts → AlephaCliUtils.ts} +101 -16
  131. package/src/command/providers/CliProvider.ts +12 -4
  132. package/src/cli/services/ProcessRunner.ts +0 -89
@@ -3,12 +3,12 @@ import { Alepha } from "alepha";
3
3
  import { FileSystemProvider } from "alepha/file";
4
4
  import * as alepha_command0 from "alepha/command";
5
5
  import { CliProvider } from "alepha/command";
6
- import * as alepha_logger4 from "alepha/logger";
6
+ import * as alepha_logger3 from "alepha/logger";
7
7
 
8
- //#region src/cli/apps/AlephaCli.d.ts
8
+ //#region ../../src/cli/apps/AlephaCli.d.ts
9
9
  declare const AlephaCli: alepha0.Service<alepha0.Module>;
10
10
  //#endregion
11
- //#region src/cli/apps/AlephaPackageBuilderCli.d.ts
11
+ //#region ../../src/cli/apps/AlephaPackageBuilderCli.d.ts
12
12
  interface Module {
13
13
  name: string;
14
14
  dependencies: string[];
@@ -24,19 +24,20 @@ declare class AlephaPackageBuilderCli {
24
24
  }
25
25
  declare function analyzeModules(srcDir: string, packageName: string): Promise<Module[]>;
26
26
  //#endregion
27
- //#region src/cli/services/ProcessRunner.d.ts
27
+ //#region ../../src/cli/services/AlephaCliUtils.d.ts
28
28
  /**
29
- * Service for running external processes with logging support.
29
+ * Utility service for common project operations used by CLI commands.
30
30
  *
31
- * This service wraps Node.js child_process functionality and provides:
32
- * - Automatic logging of executed commands
33
- * - Promise-based execution
34
- * - Inherited stdio for seamless output
35
- * - Working directory context
36
- * - Config file management in node_modules/.alepha
31
+ * This service provides helper methods for:
32
+ * - Project configuration file management (tsconfig.json, package.json, etc.)
33
+ * - Package manager setup (Yarn, npm, pnpm)
34
+ * - Sample project downloading
35
+ * - Drizzle ORM/Kit utilities
36
+ * - Alepha instance loading
37
37
  */
38
- declare class ProcessRunner {
39
- protected readonly log: alepha_logger4.Logger;
38
+ declare class AlephaCliUtils {
39
+ protected readonly log: alepha_logger3.Logger;
40
+ protected readonly fs: FileSystemProvider;
40
41
  /**
41
42
  * Execute a command using npx with inherited stdio.
42
43
  *
@@ -68,23 +69,6 @@ declare class ProcessRunner {
68
69
  * ```
69
70
  */
70
71
  writeConfigFile(name: string, content: string, root?: string): Promise<string>;
71
- }
72
- //#endregion
73
- //#region src/cli/services/ProjectUtils.d.ts
74
- /**
75
- * Utility service for common project operations used by CLI commands.
76
- *
77
- * This service provides helper methods for:
78
- * - Project configuration file management (tsconfig.json, package.json, etc.)
79
- * - Package manager setup (Yarn, npm, pnpm)
80
- * - Sample project downloading
81
- * - Drizzle ORM/Kit utilities
82
- * - Alepha instance loading
83
- */
84
- declare class ProjectUtils {
85
- protected readonly log: alepha_logger4.Logger;
86
- protected readonly runner: ProcessRunner;
87
- protected readonly fs: FileSystemProvider;
88
72
  /**
89
73
  * Ensure Yarn is configured in the project directory.
90
74
  *
@@ -138,7 +122,7 @@ declare class ProjectUtils {
138
122
  * Creates a standard Alepha vite.config.ts if none exists.
139
123
  */
140
124
  ensureViteConfig(root: string, serverEntry?: string): Promise<void>;
141
- protected checkFileExists(root: string, name: string, checkParentDirectories?: boolean): Promise<boolean>;
125
+ protected checkFileExists(root: string, name: string, checkParentDirectories?: boolean): Promise<string | undefined>;
142
126
  protected ensureFileExists(root: string, name: string, content: string, checkParentDirectories?: boolean): Promise<void>;
143
127
  /**
144
128
  * Get the path to Biome configuration file.
@@ -218,20 +202,19 @@ interface DependencyModes {
218
202
  ui?: boolean;
219
203
  }
220
204
  //#endregion
221
- //#region src/cli/commands/BiomeCommands.d.ts
205
+ //#region ../../src/cli/commands/BiomeCommands.d.ts
222
206
  declare class BiomeCommands {
223
- protected readonly log: alepha_logger4.Logger;
224
- protected readonly runner: ProcessRunner;
225
- protected readonly utils: ProjectUtils;
207
+ protected readonly log: alepha_logger3.Logger;
208
+ protected readonly utils: AlephaCliUtils;
226
209
  readonly format: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
227
210
  readonly lint: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
228
211
  }
229
212
  //#endregion
230
- //#region src/cli/commands/CoreCommands.d.ts
213
+ //#region ../../src/cli/commands/CoreCommands.d.ts
231
214
  declare class CoreCommands {
232
- protected readonly log: alepha_logger4.Logger;
215
+ protected readonly log: alepha_logger3.Logger;
233
216
  protected readonly cli: CliProvider;
234
- protected readonly utils: ProjectUtils;
217
+ protected readonly utils: AlephaCliUtils;
235
218
  /**
236
219
  * Called when no command is provided
237
220
  */
@@ -254,11 +237,10 @@ declare class CoreCommands {
254
237
  }>, alepha0.TSchema>;
255
238
  }
256
239
  //#endregion
257
- //#region src/cli/commands/DrizzleCommands.d.ts
240
+ //#region ../../src/cli/commands/DrizzleCommands.d.ts
258
241
  declare class DrizzleCommands {
259
- log: alepha_logger4.Logger;
260
- runner: ProcessRunner;
261
- utils: ProjectUtils;
242
+ log: alepha_logger3.Logger;
243
+ utils: AlephaCliUtils;
262
244
  /**
263
245
  * Check if database migrations are up to date.
264
246
  */
@@ -311,36 +293,11 @@ declare class DrizzleCommands {
311
293
  studio: alepha_command0.CommandPrimitive<alepha0.TObject<{
312
294
  provider: alepha0.TOptional<alepha0.TString>;
313
295
  }>, alepha0.TOptional<alepha0.TString>>;
314
- /**
315
- * Drop database schema (development only)
316
- *
317
- * @experimental
318
- */
319
- drop: alepha_command0.CommandPrimitive<alepha0.TObject<{
320
- provider: alepha0.TOptional<alepha0.TString>;
321
- }>, alepha0.TOptional<alepha0.TString>>;
322
- /**
323
- * Seed database with initial data
324
- *
325
- * @experimental
326
- */
327
- seed: alepha_command0.CommandPrimitive<alepha0.TObject<{
328
- provider: alepha0.TOptional<alepha0.TString>;
329
- }>, alepha0.TOptional<alepha0.TString>>;
330
- /**
331
- * Show pending database migrations status
332
- *
333
- * @experimental
334
- */
335
- status: alepha_command0.CommandPrimitive<alepha0.TObject<{
336
- provider: alepha0.TOptional<alepha0.TString>;
337
- }>, alepha0.TOptional<alepha0.TString>>;
338
296
  }
339
297
  //#endregion
340
- //#region src/cli/commands/VerifyCommands.d.ts
298
+ //#region ../../src/cli/commands/VerifyCommands.d.ts
341
299
  declare class VerifyCommands {
342
- protected readonly processRunner: ProcessRunner;
343
- protected readonly utils: ProjectUtils;
300
+ protected readonly utils: AlephaCliUtils;
344
301
  /**
345
302
  * Run a series of verification commands to ensure code quality and correctness.
346
303
  *
@@ -361,11 +318,10 @@ declare class VerifyCommands {
361
318
  readonly typecheck: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
362
319
  }
363
320
  //#endregion
364
- //#region src/cli/commands/ViteCommands.d.ts
321
+ //#region ../../src/cli/commands/ViteCommands.d.ts
365
322
  declare class ViteCommands {
366
- protected readonly log: alepha_logger4.Logger;
367
- protected readonly runner: ProcessRunner;
368
- protected readonly utils: ProjectUtils;
323
+ protected readonly log: alepha_logger3.Logger;
324
+ protected readonly utils: AlephaCliUtils;
369
325
  protected readonly env: {
370
326
  VITEST_ARGS: string;
371
327
  };
@@ -390,8 +346,8 @@ declare class ViteCommands {
390
346
  readonly test: alepha_command0.CommandPrimitive<alepha0.TObject<alepha0.TProperties>, alepha0.TSchema>;
391
347
  }
392
348
  //#endregion
393
- //#region src/cli/version.d.ts
349
+ //#region ../../src/cli/version.d.ts
394
350
  declare const version: any;
395
351
  //#endregion
396
- export { AlephaCli, AlephaPackageBuilderCli, BiomeCommands, CoreCommands, DependencyModes, DrizzleCommands, ProjectUtils, VerifyCommands, ViteCommands, analyzeModules, version };
352
+ export { AlephaCli, AlephaCliUtils, AlephaPackageBuilderCli, BiomeCommands, CoreCommands, DependencyModes, DrizzleCommands, VerifyCommands, ViteCommands, analyzeModules, version };
397
353
  //# sourceMappingURL=index.d.ts.map
package/dist/cli/index.js CHANGED
@@ -10,75 +10,7 @@ import { tsImport } from "tsx/esm/api";
10
10
  import { readFileSync } from "node:fs";
11
11
  import * as os from "node:os";
12
12
 
13
- //#region src/cli/services/ProcessRunner.ts
14
- /**
15
- * Service for running external processes with logging support.
16
- *
17
- * This service wraps Node.js child_process functionality and provides:
18
- * - Automatic logging of executed commands
19
- * - Promise-based execution
20
- * - Inherited stdio for seamless output
21
- * - Working directory context
22
- * - Config file management in node_modules/.alepha
23
- */
24
- var ProcessRunner = class {
25
- log = $logger();
26
- /**
27
- * Execute a command using npx with inherited stdio.
28
- *
29
- * @param command - The command to execute (will be passed to npx)
30
- * @param env - Optional environment variables to set for the command
31
- * @returns Promise that resolves when the process exits
32
- *
33
- * @example
34
- * ```ts
35
- * const runner = alepha.inject(ProcessRunner);
36
- * await runner.exec("tsx watch src/index.ts");
37
- * ```
38
- */
39
- async exec(command, env = {}) {
40
- this.log.debug(`Executing command: npx ${command}`, { cwd: process.cwd() });
41
- const prog = spawn("npx", command.split(" "), {
42
- stdio: "inherit",
43
- cwd: process.cwd(),
44
- env: {
45
- ...process.env,
46
- ...env,
47
- NODE_OPTIONS: "--import tsx"
48
- }
49
- });
50
- await new Promise((resolve) => prog.on("exit", () => {
51
- resolve();
52
- }));
53
- }
54
- /**
55
- * Write a configuration file to node_modules/.alepha directory.
56
- *
57
- * Creates the .alepha directory if it doesn't exist and writes the file with the given content.
58
- *
59
- * @param name - The name of the config file to create
60
- * @param content - The content to write to the file
61
- * @param root - The root directory (defaults to process.cwd())
62
- * @returns The absolute path to the created file
63
- *
64
- * @example
65
- * ```ts
66
- * const runner = alepha.inject(ProcessRunner);
67
- * const configPath = await runner.writeConfigFile("biome.json", biomeConfig);
68
- * ```
69
- */
70
- async writeConfigFile(name, content, root = process.cwd()) {
71
- const dir = join(root, "node_modules", ".alepha");
72
- await mkdir(dir, { recursive: true }).catch(() => null);
73
- const path = join(dir, name);
74
- await writeFile(path, content);
75
- this.log.debug(`Config file written: ${path}`);
76
- return path;
77
- }
78
- };
79
-
80
- //#endregion
81
- //#region src/cli/assets/appRouterTs.ts
13
+ //#region ../../src/cli/assets/appRouterTs.ts
82
14
  const appRouterTs = () => `
83
15
  import { $page } from "@alepha/react";
84
16
 
@@ -90,7 +22,7 @@ export class AppRouter {
90
22
  `.trim();
91
23
 
92
24
  //#endregion
93
- //#region src/cli/assets/biomeJson.ts
25
+ //#region ../../src/cli/assets/biomeJson.ts
94
26
  const biomeJson = `
95
27
  {
96
28
  "$schema": "https://biomejs.dev/schemas/latest/schema.json",
@@ -126,7 +58,7 @@ const biomeJson = `
126
58
  `.trim();
127
59
 
128
60
  //#endregion
129
- //#region src/cli/assets/indexHtml.ts
61
+ //#region ../../src/cli/assets/indexHtml.ts
130
62
  const indexHtml = (browserEntry) => `
131
63
  <!DOCTYPE html>
132
64
  <html lang="en">
@@ -142,7 +74,7 @@ const indexHtml = (browserEntry) => `
142
74
  `.trim();
143
75
 
144
76
  //#endregion
145
- //#region src/cli/assets/mainBrowserTs.ts
77
+ //#region ../../src/cli/assets/mainBrowserTs.ts
146
78
  const mainBrowserTs = () => `
147
79
  import { Alepha, run } from "alepha";
148
80
  import { AppRouter } from "./AppRouter.ts";
@@ -155,7 +87,7 @@ run(alepha);
155
87
  `.trim();
156
88
 
157
89
  //#endregion
158
- //#region src/cli/assets/tsconfigJson.ts
90
+ //#region ../../src/cli/assets/tsconfigJson.ts
159
91
  const tsconfigJson = `
160
92
  {
161
93
  "extends": "alepha/tsconfig.base"
@@ -163,7 +95,7 @@ const tsconfigJson = `
163
95
  `.trim();
164
96
 
165
97
  //#endregion
166
- //#region src/cli/assets/viteConfigTs.ts
98
+ //#region ../../src/cli/assets/viteConfigTs.ts
167
99
  const viteConfigTs = (serverEntry) => `
168
100
  import { viteAlepha } from "alepha/vite";
169
101
 
@@ -178,12 +110,12 @@ export default {
178
110
  `.trim();
179
111
 
180
112
  //#endregion
181
- //#region src/cli/version.ts
113
+ //#region ../../src/cli/version.ts
182
114
  const packageJson = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf-8"));
183
115
  const version = packageJson.version;
184
116
 
185
117
  //#endregion
186
- //#region src/cli/services/ProjectUtils.ts
118
+ //#region ../../src/cli/services/AlephaCliUtils.ts
187
119
  /**
188
120
  * Utility service for common project operations used by CLI commands.
189
121
  *
@@ -194,11 +126,66 @@ const version = packageJson.version;
194
126
  * - Drizzle ORM/Kit utilities
195
127
  * - Alepha instance loading
196
128
  */
197
- var ProjectUtils = class {
129
+ var AlephaCliUtils = class {
198
130
  log = $logger();
199
- runner = $inject(ProcessRunner);
200
131
  fs = $inject(FileSystemProvider);
201
132
  /**
133
+ * Execute a command using npx with inherited stdio.
134
+ *
135
+ * @param command - The command to execute (will be passed to npx)
136
+ * @param env - Optional environment variables to set for the command
137
+ * @returns Promise that resolves when the process exits
138
+ *
139
+ * @example
140
+ * ```ts
141
+ * const runner = alepha.inject(ProcessRunner);
142
+ * await runner.exec("tsx watch src/index.ts");
143
+ * ```
144
+ */
145
+ async exec(command, env = {}) {
146
+ const root = process.cwd();
147
+ this.log.debug(`Executing command: ${command}`, { cwd: root });
148
+ const suffix = process.platform === "win32" ? ".cmd" : "";
149
+ const [app, ...args] = command.split(" ");
150
+ const execPath = await this.checkFileExists(root, `node_modules/.bin/${app}${suffix}`, true);
151
+ if (!execPath) throw new AlephaError(`Could not find executable for command '${app}'. Make sure the package is installed.`);
152
+ const prog = spawn(execPath, args, {
153
+ stdio: "inherit",
154
+ cwd: root,
155
+ env: {
156
+ ...process.env,
157
+ ...env
158
+ }
159
+ });
160
+ await new Promise((resolve) => prog.on("exit", () => {
161
+ resolve();
162
+ }));
163
+ }
164
+ /**
165
+ * Write a configuration file to node_modules/.alepha directory.
166
+ *
167
+ * Creates the .alepha directory if it doesn't exist and writes the file with the given content.
168
+ *
169
+ * @param name - The name of the config file to create
170
+ * @param content - The content to write to the file
171
+ * @param root - The root directory (defaults to process.cwd())
172
+ * @returns The absolute path to the created file
173
+ *
174
+ * @example
175
+ * ```ts
176
+ * const runner = alepha.inject(ProcessRunner);
177
+ * const configPath = await runner.writeConfigFile("biome.json", biomeConfig);
178
+ * ```
179
+ */
180
+ async writeConfigFile(name, content, root = process.cwd()) {
181
+ const dir = join(root, "node_modules", ".alepha");
182
+ await mkdir(dir, { recursive: true }).catch(() => null);
183
+ const path = join(dir, name);
184
+ await writeFile(path, content);
185
+ this.log.debug(`Config file written: ${path}`);
186
+ return path;
187
+ }
188
+ /**
202
189
  * Ensure Yarn is configured in the project directory.
203
190
  *
204
191
  * Creates a .yarnrc.yml file with node-modules linker if it doesn't exist.
@@ -302,19 +289,18 @@ var ProjectUtils = class {
302
289
  const configPath = join(root, name);
303
290
  if (!checkParentDirectories) try {
304
291
  await access(configPath);
305
- return true;
292
+ return configPath;
306
293
  } catch {
307
- return false;
294
+ return;
308
295
  }
309
- let found = false;
310
296
  let currentDir = root;
311
297
  const maxIterations = 10;
312
298
  let level = 0;
313
299
  while (level < maxIterations) {
314
300
  try {
315
- await access(join(currentDir, name));
316
- found = true;
317
- break;
301
+ const maybe = join(currentDir, name);
302
+ await access(maybe);
303
+ return maybe;
318
304
  } catch {
319
305
  const parentDir = join(currentDir, "..");
320
306
  if (parentDir === currentDir) break;
@@ -322,7 +308,6 @@ var ProjectUtils = class {
322
308
  }
323
309
  level += 1;
324
310
  }
325
- return found;
326
311
  }
327
312
  async ensureFileExists(root, name, content, checkParentDirectories = false) {
328
313
  if (!await this.checkFileExists(root, name, checkParentDirectories)) await writeFile(join(root, name), content);
@@ -400,7 +385,7 @@ ${models.map((it) => `export const ${it} = models["${it}"];`).join("\n")}
400
385
  const models = Object.keys(options.kit.getModels(options.provider));
401
386
  const entitiesJs = this.generateEntitiesJs(options.entry, options.providerName, models);
402
387
  const config = {
403
- schema: await this.runner.writeConfigFile("entities.js", entitiesJs, options.rootDir),
388
+ schema: await this.writeConfigFile("entities.js", entitiesJs, options.rootDir),
404
389
  out: `./migrations/${options.providerName}`,
405
390
  dialect: options.dialect,
406
391
  dbCredentials: { url: options.providerUrl }
@@ -413,7 +398,7 @@ ${models.map((it) => `export const ${it} = models["${it}"];`).join("\n")}
413
398
  }
414
399
  if (options.providerName === "pglite") config.driver = "pglite";
415
400
  const drizzleConfigJs = `export default ${JSON.stringify(config, null, 2)}`;
416
- return await this.runner.writeConfigFile("drizzle.config.js", drizzleConfigJs, options.rootDir);
401
+ return await this.writeConfigFile("drizzle.config.js", drizzleConfigJs, options.rootDir);
417
402
  }
418
403
  async loadEnvFile(root) {
419
404
  const envPath = join(root, ".env");
@@ -469,7 +454,7 @@ ${models.map((it) => `export const ${it} = models["${it}"];`).join("\n")}
469
454
  rootDir
470
455
  });
471
456
  const flags = options.commandFlags ? ` ${options.commandFlags}` : "";
472
- await this.runner.exec(`drizzle-kit ${options.command} --config=${drizzleConfigJsPath}${flags}`);
457
+ await this.exec(`drizzle-kit ${options.command} --config=${drizzleConfigJsPath}${flags}`, { NODE_OPTIONS: "--import tsx" });
473
458
  }
474
459
  }
475
460
  async getPackageManager(root) {
@@ -500,17 +485,16 @@ ${models.map((it) => `export const ${it} = models["${it}"];`).join("\n")}
500
485
  };
501
486
 
502
487
  //#endregion
503
- //#region src/cli/commands/BiomeCommands.ts
488
+ //#region ../../src/cli/commands/BiomeCommands.ts
504
489
  var BiomeCommands = class {
505
490
  log = $logger();
506
- runner = $inject(ProcessRunner);
507
- utils = $inject(ProjectUtils);
491
+ utils = $inject(AlephaCliUtils);
508
492
  format = $command({
509
493
  name: "format",
510
494
  description: "Format the codebase using Biome",
511
495
  handler: async ({ root }) => {
512
496
  await this.utils.ensureConfig(root, { biomeJson: true });
513
- await this.runner.exec(`biome format --fix`);
497
+ await this.utils.exec(`biome format --fix`);
514
498
  }
515
499
  });
516
500
  lint = $command({
@@ -518,17 +502,17 @@ var BiomeCommands = class {
518
502
  description: "Run linter across the codebase using Biome",
519
503
  handler: async ({ root }) => {
520
504
  await this.utils.ensureConfig(root, { biomeJson: true });
521
- await this.runner.exec(`biome check --formatter-enabled=false --fix`);
505
+ await this.utils.exec(`biome check --formatter-enabled=false --fix`);
522
506
  }
523
507
  });
524
508
  };
525
509
 
526
510
  //#endregion
527
- //#region src/cli/commands/CoreCommands.ts
511
+ //#region ../../src/cli/commands/CoreCommands.ts
528
512
  var CoreCommands = class {
529
513
  log = $logger();
530
514
  cli = $inject(CliProvider);
531
- utils = $inject(ProjectUtils);
515
+ utils = $inject(AlephaCliUtils);
532
516
  /**
533
517
  * Called when no command is provided
534
518
  */
@@ -594,12 +578,11 @@ var CoreCommands = class {
594
578
  };
595
579
 
596
580
  //#endregion
597
- //#region src/cli/commands/DrizzleCommands.ts
581
+ //#region ../../src/cli/commands/DrizzleCommands.ts
598
582
  const drizzleCommandFlags = t.object({ provider: t.optional(t.text({ description: "Database provider name to target (e.g., 'postgres', 'sqlite')" })) });
599
583
  var DrizzleCommands = class {
600
584
  log = $logger();
601
- runner = $inject(ProcessRunner);
602
- utils = $inject(ProjectUtils);
585
+ utils = $inject(AlephaCliUtils);
603
586
  /**
604
587
  * Check if database migrations are up to date.
605
588
  */
@@ -772,70 +755,12 @@ var DrizzleCommands = class {
772
755
  });
773
756
  }
774
757
  });
775
- /**
776
- * Drop database schema (development only)
777
- *
778
- * @experimental
779
- */
780
- drop = $command({
781
- name: "db:drop",
782
- description: "Drop database schema (development only)",
783
- summary: false,
784
- args: t.optional(t.text({
785
- title: "path",
786
- description: "Path to the Alepha server entry file"
787
- })),
788
- flags: drizzleCommandFlags,
789
- handler: async ({ flags }) => {
790
- this.log.warn("db:drop is not yet implemented");
791
- if (flags.provider) this.log.info(`Provider filter: ${flags.provider}`);
792
- }
793
- });
794
- /**
795
- * Seed database with initial data
796
- *
797
- * @experimental
798
- */
799
- seed = $command({
800
- name: "db:seed",
801
- description: "Seed database with initial data",
802
- summary: false,
803
- args: t.optional(t.text({
804
- title: "path",
805
- description: "Path to the Alepha server entry file"
806
- })),
807
- flags: drizzleCommandFlags,
808
- handler: async ({ flags }) => {
809
- this.log.warn("db:seed is not yet implemented");
810
- if (flags.provider) this.log.info(`Provider filter: ${flags.provider}`);
811
- }
812
- });
813
- /**
814
- * Show pending database migrations status
815
- *
816
- * @experimental
817
- */
818
- status = $command({
819
- name: "db:status",
820
- description: "Show pending database migrations status",
821
- summary: false,
822
- args: t.optional(t.text({
823
- title: "path",
824
- description: "Path to the Alepha server entry file"
825
- })),
826
- flags: drizzleCommandFlags,
827
- handler: async ({ flags }) => {
828
- this.log.warn("db:status is not yet implemented");
829
- if (flags.provider) this.log.info(`Provider filter: ${flags.provider}`);
830
- }
831
- });
832
758
  };
833
759
 
834
760
  //#endregion
835
- //#region src/cli/commands/VerifyCommands.ts
761
+ //#region ../../src/cli/commands/VerifyCommands.ts
836
762
  var VerifyCommands = class {
837
- processRunner = $inject(ProcessRunner);
838
- utils = $inject(ProjectUtils);
763
+ utils = $inject(AlephaCliUtils);
839
764
  /**
840
765
  * Run a series of verification commands to ensure code quality and correctness.
841
766
  *
@@ -870,17 +795,16 @@ var VerifyCommands = class {
870
795
  name: "typecheck",
871
796
  description: "Check TypeScript types across the codebase",
872
797
  handler: async () => {
873
- await this.processRunner.exec("tsc --noEmit");
798
+ await this.utils.exec("tsc --noEmit");
874
799
  }
875
800
  });
876
801
  };
877
802
 
878
803
  //#endregion
879
- //#region src/cli/commands/ViteCommands.ts
804
+ //#region ../../src/cli/commands/ViteCommands.ts
880
805
  var ViteCommands = class {
881
806
  log = $logger();
882
- runner = $inject(ProcessRunner);
883
- utils = $inject(ProjectUtils);
807
+ utils = $inject(AlephaCliUtils);
884
808
  env = $env(t.object({ VITEST_ARGS: t.string({ default: "" }) }));
885
809
  run = $command({
886
810
  name: "run",
@@ -896,7 +820,7 @@ var ViteCommands = class {
896
820
  }),
897
821
  handler: async ({ args, flags, root }) => {
898
822
  await this.utils.ensureTsConfig(root);
899
- await this.runner.exec(`tsx ${flags.watch ? "watch " : ""}${args}`);
823
+ await this.utils.exec(`tsx ${flags.watch ? "watch " : ""}${args}`);
900
824
  }
901
825
  });
902
826
  /**
@@ -926,10 +850,10 @@ var ViteCommands = class {
926
850
  let cmd = "tsx --watch";
927
851
  if (await this.utils.exists(root, ".env")) cmd += ` --env-file=./.env`;
928
852
  cmd += ` ${entry}`;
929
- await this.runner.exec(cmd);
853
+ await this.utils.exec(cmd);
930
854
  return;
931
855
  }
932
- await this.runner.exec(`vite`);
856
+ await this.utils.exec(`vite`);
933
857
  }
934
858
  });
935
859
  build = $command({
@@ -1056,18 +980,18 @@ var ViteCommands = class {
1056
980
  viteConfigTs: true
1057
981
  });
1058
982
  try {
1059
- await import("./dist-lGnqsKpu.js");
983
+ await import("./dist-BlfFtOk2.js");
1060
984
  } catch {
1061
985
  this.log.error("Vitest is not installed. Please install it with `npm install -D vitest` or `yarn add -D vitest`.");
1062
986
  process.exit(1);
1063
987
  }
1064
- await this.runner.exec(`vitest run ${this.env.VITEST_ARGS}`);
988
+ await this.utils.exec(`vitest run ${this.env.VITEST_ARGS}`);
1065
989
  }
1066
990
  });
1067
991
  };
1068
992
 
1069
993
  //#endregion
1070
- //#region src/cli/apps/AlephaCli.ts
994
+ //#region ../../src/cli/apps/AlephaCli.ts
1071
995
  var AlephaCliExtension = class {
1072
996
  alepha = $inject(Alepha);
1073
997
  fs = $inject(FileSystemProvider);
@@ -1086,7 +1010,6 @@ const AlephaCli = $module({
1086
1010
  name: "alepha.cli",
1087
1011
  services: [
1088
1012
  AlephaCliExtension,
1089
- ProcessRunner,
1090
1013
  CoreCommands,
1091
1014
  DrizzleCommands,
1092
1015
  VerifyCommands,
@@ -1096,7 +1019,7 @@ const AlephaCli = $module({
1096
1019
  });
1097
1020
 
1098
1021
  //#endregion
1099
- //#region src/cli/apps/AlephaPackageBuilderCli.ts
1022
+ //#region ../../src/cli/apps/AlephaPackageBuilderCli.ts
1100
1023
  var AlephaPackageBuilderCli = class {
1101
1024
  src = "src";
1102
1025
  dist = "dist";
@@ -1277,5 +1200,5 @@ async function analyzeModules(srcDir, packageName) {
1277
1200
  }
1278
1201
 
1279
1202
  //#endregion
1280
- export { AlephaCli, AlephaPackageBuilderCli, BiomeCommands, CoreCommands, DrizzleCommands, ProjectUtils, VerifyCommands, ViteCommands, analyzeModules, version };
1203
+ export { AlephaCli, AlephaCliUtils, AlephaPackageBuilderCli, BiomeCommands, CoreCommands, DrizzleCommands, VerifyCommands, ViteCommands, analyzeModules, version };
1281
1204
  //# sourceMappingURL=index.js.map