alepha 0.14.3 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (317) hide show
  1. package/README.md +2 -5
  2. package/dist/api/audits/index.d.ts +620 -811
  3. package/dist/api/audits/index.d.ts.map +1 -1
  4. package/dist/api/files/index.d.ts +185 -377
  5. package/dist/api/files/index.d.ts.map +1 -1
  6. package/dist/api/files/index.js +0 -1
  7. package/dist/api/files/index.js.map +1 -1
  8. package/dist/api/jobs/index.d.ts +245 -435
  9. package/dist/api/jobs/index.d.ts.map +1 -1
  10. package/dist/api/notifications/index.d.ts +238 -429
  11. package/dist/api/notifications/index.d.ts.map +1 -1
  12. package/dist/api/parameters/index.d.ts +236 -427
  13. package/dist/api/parameters/index.d.ts.map +1 -1
  14. package/dist/api/users/index.browser.js +1 -2
  15. package/dist/api/users/index.browser.js.map +1 -1
  16. package/dist/api/users/index.d.ts +1010 -1196
  17. package/dist/api/users/index.d.ts.map +1 -1
  18. package/dist/api/users/index.js +178 -151
  19. package/dist/api/users/index.js.map +1 -1
  20. package/dist/api/verifications/index.d.ts +17 -17
  21. package/dist/api/verifications/index.d.ts.map +1 -1
  22. package/dist/batch/index.d.ts +122 -122
  23. package/dist/batch/index.d.ts.map +1 -1
  24. package/dist/batch/index.js +1 -2
  25. package/dist/batch/index.js.map +1 -1
  26. package/dist/bucket/index.d.ts +163 -163
  27. package/dist/bucket/index.d.ts.map +1 -1
  28. package/dist/cache/core/index.d.ts +46 -46
  29. package/dist/cache/core/index.d.ts.map +1 -1
  30. package/dist/cache/redis/index.d.ts.map +1 -1
  31. package/dist/cli/index.d.ts +384 -285
  32. package/dist/cli/index.d.ts.map +1 -1
  33. package/dist/cli/index.js +1113 -623
  34. package/dist/cli/index.js.map +1 -1
  35. package/dist/command/index.d.ts +299 -300
  36. package/dist/command/index.d.ts.map +1 -1
  37. package/dist/command/index.js +13 -9
  38. package/dist/command/index.js.map +1 -1
  39. package/dist/core/index.browser.js +445 -103
  40. package/dist/core/index.browser.js.map +1 -1
  41. package/dist/core/index.d.ts +733 -625
  42. package/dist/core/index.d.ts.map +1 -1
  43. package/dist/core/index.js +446 -103
  44. package/dist/core/index.js.map +1 -1
  45. package/dist/core/index.native.js +445 -103
  46. package/dist/core/index.native.js.map +1 -1
  47. package/dist/datetime/index.d.ts +44 -44
  48. package/dist/datetime/index.d.ts.map +1 -1
  49. package/dist/datetime/index.js +4 -4
  50. package/dist/datetime/index.js.map +1 -1
  51. package/dist/email/index.d.ts +97 -50
  52. package/dist/email/index.d.ts.map +1 -1
  53. package/dist/email/index.js +129 -33
  54. package/dist/email/index.js.map +1 -1
  55. package/dist/fake/index.d.ts +7981 -14
  56. package/dist/fake/index.d.ts.map +1 -1
  57. package/dist/file/index.d.ts +523 -390
  58. package/dist/file/index.d.ts.map +1 -1
  59. package/dist/file/index.js +253 -1
  60. package/dist/file/index.js.map +1 -1
  61. package/dist/lock/core/index.d.ts +208 -208
  62. package/dist/lock/core/index.d.ts.map +1 -1
  63. package/dist/lock/redis/index.d.ts.map +1 -1
  64. package/dist/logger/index.d.ts +25 -26
  65. package/dist/logger/index.d.ts.map +1 -1
  66. package/dist/logger/index.js +12 -2
  67. package/dist/logger/index.js.map +1 -1
  68. package/dist/mcp/index.d.ts +197 -197
  69. package/dist/mcp/index.d.ts.map +1 -1
  70. package/dist/mcp/index.js +1 -1
  71. package/dist/mcp/index.js.map +1 -1
  72. package/dist/orm/chunk-DtkW-qnP.js +38 -0
  73. package/dist/orm/index.browser.js.map +1 -1
  74. package/dist/orm/index.bun.js +2814 -0
  75. package/dist/orm/index.bun.js.map +1 -0
  76. package/dist/orm/index.d.ts +1228 -1216
  77. package/dist/orm/index.d.ts.map +1 -1
  78. package/dist/orm/index.js +2041 -1967
  79. package/dist/orm/index.js.map +1 -1
  80. package/dist/queue/core/index.d.ts +248 -248
  81. package/dist/queue/core/index.d.ts.map +1 -1
  82. package/dist/queue/redis/index.d.ts.map +1 -1
  83. package/dist/redis/index.bun.js +285 -0
  84. package/dist/redis/index.bun.js.map +1 -0
  85. package/dist/redis/index.d.ts +118 -136
  86. package/dist/redis/index.d.ts.map +1 -1
  87. package/dist/redis/index.js +18 -38
  88. package/dist/redis/index.js.map +1 -1
  89. package/dist/retry/index.d.ts +69 -69
  90. package/dist/retry/index.d.ts.map +1 -1
  91. package/dist/router/index.d.ts +6 -6
  92. package/dist/router/index.d.ts.map +1 -1
  93. package/dist/scheduler/index.d.ts +25 -25
  94. package/dist/scheduler/index.d.ts.map +1 -1
  95. package/dist/security/index.browser.js +5 -1
  96. package/dist/security/index.browser.js.map +1 -1
  97. package/dist/security/index.d.ts +417 -254
  98. package/dist/security/index.d.ts.map +1 -1
  99. package/dist/security/index.js +386 -86
  100. package/dist/security/index.js.map +1 -1
  101. package/dist/server/auth/index.d.ts +110 -110
  102. package/dist/server/auth/index.d.ts.map +1 -1
  103. package/dist/server/auth/index.js +20 -20
  104. package/dist/server/auth/index.js.map +1 -1
  105. package/dist/server/cache/index.d.ts +62 -47
  106. package/dist/server/cache/index.d.ts.map +1 -1
  107. package/dist/server/cache/index.js +56 -3
  108. package/dist/server/cache/index.js.map +1 -1
  109. package/dist/server/compress/index.d.ts +6 -0
  110. package/dist/server/compress/index.d.ts.map +1 -1
  111. package/dist/server/compress/index.js +36 -1
  112. package/dist/server/compress/index.js.map +1 -1
  113. package/dist/server/cookies/index.d.ts +6 -6
  114. package/dist/server/cookies/index.d.ts.map +1 -1
  115. package/dist/server/cookies/index.js +3 -3
  116. package/dist/server/cookies/index.js.map +1 -1
  117. package/dist/server/core/index.browser.js +2 -2
  118. package/dist/server/core/index.browser.js.map +1 -1
  119. package/dist/server/core/index.d.ts +242 -150
  120. package/dist/server/core/index.d.ts.map +1 -1
  121. package/dist/server/core/index.js +294 -125
  122. package/dist/server/core/index.js.map +1 -1
  123. package/dist/server/cors/index.d.ts +11 -12
  124. package/dist/server/cors/index.d.ts.map +1 -1
  125. package/dist/server/health/index.d.ts +0 -1
  126. package/dist/server/health/index.d.ts.map +1 -1
  127. package/dist/server/helmet/index.d.ts +2 -2
  128. package/dist/server/helmet/index.d.ts.map +1 -1
  129. package/dist/server/links/index.browser.js.map +1 -1
  130. package/dist/server/links/index.d.ts +123 -124
  131. package/dist/server/links/index.d.ts.map +1 -1
  132. package/dist/server/links/index.js +1 -2
  133. package/dist/server/links/index.js.map +1 -1
  134. package/dist/server/metrics/index.d.ts.map +1 -1
  135. package/dist/server/multipart/index.d.ts +6 -6
  136. package/dist/server/multipart/index.d.ts.map +1 -1
  137. package/dist/server/proxy/index.d.ts +102 -103
  138. package/dist/server/proxy/index.d.ts.map +1 -1
  139. package/dist/server/rate-limit/index.d.ts +16 -16
  140. package/dist/server/rate-limit/index.d.ts.map +1 -1
  141. package/dist/server/static/index.d.ts +44 -44
  142. package/dist/server/static/index.d.ts.map +1 -1
  143. package/dist/server/static/index.js +4 -0
  144. package/dist/server/static/index.js.map +1 -1
  145. package/dist/server/swagger/index.d.ts +48 -49
  146. package/dist/server/swagger/index.d.ts.map +1 -1
  147. package/dist/server/swagger/index.js +3 -5
  148. package/dist/server/swagger/index.js.map +1 -1
  149. package/dist/sms/index.d.ts +13 -11
  150. package/dist/sms/index.d.ts.map +1 -1
  151. package/dist/sms/index.js +7 -7
  152. package/dist/sms/index.js.map +1 -1
  153. package/dist/thread/index.d.ts +71 -72
  154. package/dist/thread/index.d.ts.map +1 -1
  155. package/dist/topic/core/index.d.ts +318 -318
  156. package/dist/topic/core/index.d.ts.map +1 -1
  157. package/dist/topic/redis/index.d.ts +6 -6
  158. package/dist/topic/redis/index.d.ts.map +1 -1
  159. package/dist/vite/index.d.ts +5805 -249
  160. package/dist/vite/index.d.ts.map +1 -1
  161. package/dist/vite/index.js +599 -513
  162. package/dist/vite/index.js.map +1 -1
  163. package/dist/websocket/index.browser.js +6 -6
  164. package/dist/websocket/index.browser.js.map +1 -1
  165. package/dist/websocket/index.d.ts +247 -247
  166. package/dist/websocket/index.d.ts.map +1 -1
  167. package/dist/websocket/index.js +6 -6
  168. package/dist/websocket/index.js.map +1 -1
  169. package/package.json +9 -14
  170. package/src/api/files/controllers/AdminFileStatsController.ts +0 -1
  171. package/src/api/users/atoms/realmAuthSettingsAtom.ts +5 -0
  172. package/src/api/users/controllers/{UserRealmController.ts → RealmController.ts} +11 -11
  173. package/src/api/users/entities/users.ts +1 -1
  174. package/src/api/users/index.ts +8 -8
  175. package/src/api/users/primitives/{$userRealm.ts → $realm.ts} +17 -19
  176. package/src/api/users/providers/{UserRealmProvider.ts → RealmProvider.ts} +26 -30
  177. package/src/api/users/schemas/{userRealmConfigSchema.ts → realmConfigSchema.ts} +2 -2
  178. package/src/api/users/services/CredentialService.ts +7 -7
  179. package/src/api/users/services/IdentityService.ts +4 -4
  180. package/src/api/users/services/RegistrationService.spec.ts +25 -27
  181. package/src/api/users/services/RegistrationService.ts +38 -27
  182. package/src/api/users/services/SessionCrudService.ts +3 -3
  183. package/src/api/users/services/SessionService.spec.ts +3 -3
  184. package/src/api/users/services/SessionService.ts +28 -9
  185. package/src/api/users/services/UserService.ts +7 -7
  186. package/src/batch/providers/BatchProvider.ts +1 -2
  187. package/src/cli/apps/AlephaCli.ts +0 -2
  188. package/src/cli/apps/AlephaPackageBuilderCli.ts +38 -19
  189. package/src/cli/assets/apiHelloControllerTs.ts +18 -0
  190. package/src/cli/assets/apiIndexTs.ts +16 -0
  191. package/src/cli/assets/claudeMd.ts +303 -0
  192. package/src/cli/assets/mainBrowserTs.ts +2 -2
  193. package/src/cli/assets/mainServerTs.ts +24 -0
  194. package/src/cli/assets/webAppRouterTs.ts +15 -0
  195. package/src/cli/assets/webHelloComponentTsx.ts +16 -0
  196. package/src/cli/assets/webIndexTs.ts +16 -0
  197. package/src/cli/atoms/buildOptions.ts +88 -0
  198. package/src/cli/commands/build.ts +70 -87
  199. package/src/cli/commands/db.ts +21 -22
  200. package/src/cli/commands/deploy.ts +17 -5
  201. package/src/cli/commands/dev.ts +22 -14
  202. package/src/cli/commands/format.ts +8 -2
  203. package/src/cli/commands/gen/env.ts +53 -0
  204. package/src/cli/commands/gen/openapi.ts +1 -1
  205. package/src/cli/commands/gen/resource.ts +15 -0
  206. package/src/cli/commands/gen.ts +7 -1
  207. package/src/cli/commands/init.ts +74 -30
  208. package/src/cli/commands/lint.ts +8 -2
  209. package/src/cli/commands/test.ts +8 -3
  210. package/src/cli/commands/typecheck.ts +5 -1
  211. package/src/cli/commands/verify.ts +5 -3
  212. package/src/cli/defineConfig.ts +49 -7
  213. package/src/cli/index.ts +0 -1
  214. package/src/cli/services/AlephaCliUtils.ts +39 -589
  215. package/src/cli/services/PackageManagerUtils.ts +301 -0
  216. package/src/cli/services/ProjectScaffolder.ts +306 -0
  217. package/src/command/helpers/Runner.spec.ts +2 -2
  218. package/src/command/helpers/Runner.ts +16 -4
  219. package/src/command/primitives/$command.ts +0 -6
  220. package/src/command/providers/CliProvider.ts +1 -3
  221. package/src/core/Alepha.ts +42 -0
  222. package/src/core/__tests__/Alepha-graph.spec.ts +4 -0
  223. package/src/core/index.shared.ts +1 -0
  224. package/src/core/index.ts +2 -0
  225. package/src/core/primitives/$hook.ts +6 -2
  226. package/src/core/primitives/$module.spec.ts +4 -0
  227. package/src/core/providers/AlsProvider.ts +1 -1
  228. package/src/core/providers/CodecManager.spec.ts +12 -6
  229. package/src/core/providers/CodecManager.ts +26 -6
  230. package/src/core/providers/EventManager.ts +169 -13
  231. package/src/core/providers/KeylessJsonSchemaCodec.spec.ts +621 -0
  232. package/src/core/providers/KeylessJsonSchemaCodec.ts +407 -0
  233. package/src/core/providers/StateManager.spec.ts +27 -16
  234. package/src/email/providers/LocalEmailProvider.spec.ts +111 -87
  235. package/src/email/providers/LocalEmailProvider.ts +52 -15
  236. package/src/email/providers/NodemailerEmailProvider.ts +167 -56
  237. package/src/file/errors/FileError.ts +7 -0
  238. package/src/file/index.ts +9 -1
  239. package/src/file/providers/MemoryFileSystemProvider.ts +393 -0
  240. package/src/logger/index.ts +15 -3
  241. package/src/mcp/transports/StdioMcpTransport.ts +1 -1
  242. package/src/orm/index.browser.ts +1 -19
  243. package/src/orm/index.bun.ts +77 -0
  244. package/src/orm/index.shared-server.ts +22 -0
  245. package/src/orm/index.shared.ts +15 -0
  246. package/src/orm/index.ts +13 -39
  247. package/src/orm/providers/drivers/BunPostgresProvider.ts +3 -5
  248. package/src/orm/providers/drivers/BunSqliteProvider.ts +1 -1
  249. package/src/orm/providers/drivers/CloudflareD1Provider.ts +4 -0
  250. package/src/orm/providers/drivers/DatabaseProvider.ts +4 -0
  251. package/src/orm/providers/drivers/PglitePostgresProvider.ts +4 -0
  252. package/src/orm/services/Repository.ts +8 -0
  253. package/src/queue/core/providers/WorkerProvider.spec.ts +48 -32
  254. package/src/redis/index.bun.ts +35 -0
  255. package/src/redis/providers/BunRedisProvider.ts +12 -43
  256. package/src/redis/providers/BunRedisSubscriberProvider.ts +2 -3
  257. package/src/redis/providers/NodeRedisProvider.ts +16 -34
  258. package/src/{server/security → security}/__tests__/BasicAuth.spec.ts +11 -11
  259. package/src/{server/security → security}/__tests__/ServerSecurityProvider-realm.spec.ts +21 -16
  260. package/src/{server/security/providers → security/__tests__}/ServerSecurityProvider.spec.ts +5 -5
  261. package/src/security/index.browser.ts +5 -0
  262. package/src/security/index.ts +90 -7
  263. package/src/security/primitives/{$realm.spec.ts → $issuer.spec.ts} +11 -11
  264. package/src/security/primitives/{$realm.ts → $issuer.ts} +20 -17
  265. package/src/security/primitives/$role.ts +5 -5
  266. package/src/security/primitives/$serviceAccount.spec.ts +5 -5
  267. package/src/security/primitives/$serviceAccount.ts +3 -3
  268. package/src/{server/security → security}/providers/ServerSecurityProvider.ts +5 -7
  269. package/src/server/auth/primitives/$auth.ts +10 -10
  270. package/src/server/auth/primitives/$authCredentials.ts +3 -3
  271. package/src/server/auth/primitives/$authGithub.ts +3 -3
  272. package/src/server/auth/primitives/$authGoogle.ts +3 -3
  273. package/src/server/auth/providers/ServerAuthProvider.ts +13 -13
  274. package/src/server/cache/providers/ServerCacheProvider.spec.ts +183 -0
  275. package/src/server/cache/providers/ServerCacheProvider.ts +95 -10
  276. package/src/server/compress/providers/ServerCompressProvider.ts +61 -2
  277. package/src/server/cookies/providers/ServerCookiesProvider.ts +3 -3
  278. package/src/server/core/helpers/ServerReply.ts +2 -2
  279. package/src/server/core/providers/NodeHttpServerProvider.ts +25 -6
  280. package/src/server/core/providers/ServerBodyParserProvider.ts +19 -23
  281. package/src/server/core/providers/ServerLoggerProvider.ts +23 -19
  282. package/src/server/core/providers/ServerProvider.ts +155 -22
  283. package/src/server/core/providers/ServerRouterProvider.ts +259 -115
  284. package/src/server/core/providers/ServerTimingProvider.ts +2 -2
  285. package/src/server/links/index.ts +1 -1
  286. package/src/server/links/providers/LinkProvider.ts +1 -1
  287. package/src/server/static/providers/ServerStaticProvider.ts +10 -0
  288. package/src/server/swagger/index.ts +1 -1
  289. package/src/server/swagger/providers/ServerSwaggerProvider.ts +5 -8
  290. package/src/sms/providers/LocalSmsProvider.spec.ts +153 -111
  291. package/src/sms/providers/LocalSmsProvider.ts +8 -7
  292. package/src/vite/helpers/boot.ts +28 -17
  293. package/src/vite/helpers/importViteReact.ts +13 -0
  294. package/src/vite/index.ts +1 -21
  295. package/src/vite/plugins/viteAlephaDev.ts +16 -1
  296. package/src/vite/plugins/viteAlephaSsrPreload.ts +222 -0
  297. package/src/vite/tasks/buildClient.ts +11 -0
  298. package/src/vite/tasks/buildServer.ts +59 -4
  299. package/src/vite/tasks/devServer.ts +71 -0
  300. package/src/vite/tasks/generateCloudflare.ts +7 -0
  301. package/src/vite/tasks/index.ts +2 -1
  302. package/dist/server/security/index.browser.js +0 -13
  303. package/dist/server/security/index.browser.js.map +0 -1
  304. package/dist/server/security/index.d.ts +0 -173
  305. package/dist/server/security/index.d.ts.map +0 -1
  306. package/dist/server/security/index.js +0 -311
  307. package/dist/server/security/index.js.map +0 -1
  308. package/src/cli/assets/appRouterTs.ts +0 -9
  309. package/src/cli/assets/mainTs.ts +0 -13
  310. package/src/cli/assets/viteConfigTs.ts +0 -14
  311. package/src/cli/commands/run.ts +0 -24
  312. package/src/server/security/index.browser.ts +0 -10
  313. package/src/server/security/index.ts +0 -94
  314. package/src/vite/plugins/viteAlepha.ts +0 -37
  315. package/src/vite/plugins/viteAlephaBuild.ts +0 -281
  316. /package/src/{server/security → security}/primitives/$basicAuth.ts +0 -0
  317. /package/src/{server/security → security}/providers/ServerBasicAuthProvider.ts +0 -0
@@ -14,28 +14,28 @@ declare class CommandError extends AlephaError {
14
14
  //#region ../../src/command/helpers/Asker.d.ts
15
15
  interface AskOptions<T extends TSchema = TString> {
16
16
  /**
17
- * Response schema expected.
18
- *
19
- * Recommended schemas:
20
- * - t.text() - for free text input
21
- * - t.number() - for numeric input
22
- * - t.boolean() - for yes/no input (accepts "true", "false", "1", "0")
23
- * - t.enum(["option1", "option2"]) - for predefined options
24
- *
25
- * You can use schema.default to provide a default value.
26
- *
27
- * @example
28
- * ```ts
29
- * ask("What is your name?", { schema: t.text({ default: "John Doe" }) })
30
- * ```
31
- *
32
- * @default TString
33
- */
17
+ * Response schema expected.
18
+ *
19
+ * Recommended schemas:
20
+ * - t.text() - for free text input
21
+ * - t.number() - for numeric input
22
+ * - t.boolean() - for yes/no input (accepts "true", "false", "1", "0")
23
+ * - t.enum(["option1", "option2"]) - for predefined options
24
+ *
25
+ * You can use schema.default to provide a default value.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * ask("What is your name?", { schema: t.text({ default: "John Doe" }) })
30
+ * ```
31
+ *
32
+ * @default TString
33
+ */
34
34
  schema?: T;
35
35
  /**
36
- * Custom validation function.
37
- * Throws an AlephaError in case of validation failure.
38
- */
36
+ * Custom validation function.
37
+ * Throws an AlephaError in case of validation failure.
38
+ */
39
39
  validate?: (value: Static<T>) => void;
40
40
  }
41
41
  interface AskMethod {
@@ -56,10 +56,10 @@ declare class Asker {
56
56
  declare class EnvUtils {
57
57
  protected readonly log: alepha_logger0.Logger;
58
58
  /**
59
- * Load environment variables from .env files into process.env.
60
- * By default, it loads from ".env" and ".env.local".
61
- * You can specify additional files to load, e.g. [".env", ".env.production"].
62
- */
59
+ * Load environment variables from .env files into process.env.
60
+ * By default, it loads from ".env" and ".env.local".
61
+ * You can specify additional files to load, e.g. [".env", ".env.production"].
62
+ */
63
63
  loadEnv(root: string, files?: string[]): Promise<void>;
64
64
  }
65
65
  //#endregion
@@ -85,40 +85,40 @@ declare class PrettyPrint {
85
85
  dim: string;
86
86
  };
87
87
  /**
88
- * Start a new command session with header
89
- */
88
+ * Start a new command session with header
89
+ */
90
90
  startCommand(cliName: string, commandName: string): void;
91
91
  /**
92
- * End the command session with footer
93
- */
92
+ * End the command session with footer
93
+ */
94
94
  endCommand(): void;
95
95
  /**
96
- * Start an animated spinner with a task name
97
- */
96
+ * Start an animated spinner with a task name
97
+ */
98
98
  startSpinner(id: string, taskName: string): void;
99
99
  /**
100
- * Stop the spinner and show success with a tick
101
- */
100
+ * Stop the spinner and show success with a tick
101
+ */
102
102
  success(id: string, taskName?: string, duration?: string): void;
103
103
  /**
104
- * Stop the spinner and show error with a cross
105
- */
104
+ * Stop the spinner and show error with a cross
105
+ */
106
106
  error(id: string, taskName?: string): void;
107
107
  /**
108
- * Update the display for all tasks
109
- */
108
+ * Update the display for all tasks
109
+ */
110
110
  protected updateDisplay(): void;
111
111
  /**
112
- * Check if all tasks are done and stop the interval
113
- */
112
+ * Check if all tasks are done and stop the interval
113
+ */
114
114
  protected checkIfAllDone(): void;
115
115
  /**
116
- * Stop the spinner without showing any symbol
117
- */
116
+ * Stop the spinner without showing any symbol
117
+ */
118
118
  stopSpinner(): void;
119
119
  /**
120
- * Clear all tasks
121
- */
120
+ * Clear all tasks
121
+ */
122
122
  clear(): void;
123
123
  }
124
124
  //#endregion
@@ -133,9 +133,13 @@ interface Timer {
133
133
  }
134
134
  interface RunOptions {
135
135
  /**
136
- * Rename the command for logging purposes.
137
- */
136
+ * Rename the command for logging purposes.
137
+ */
138
138
  alias?: string;
139
+ /**
140
+ * Root directory to execute the command in.
141
+ */
142
+ root?: string;
139
143
  }
140
144
  interface RunnerMethod {
141
145
  (cmd: string | Task | Array<string | Task>, options?: RunOptions | (() => any)): Promise<string>;
@@ -155,21 +159,23 @@ declare class Runner {
155
159
  constructor();
156
160
  protected get useDynamicLogger(): boolean;
157
161
  /**
158
- * Start a new command session with header (for pretty print mode)
159
- */
162
+ * Start a new command session with header (for pretty print mode)
163
+ */
160
164
  startCommand(cliName: string, commandName: string): void;
161
165
  protected createRunMethod(): RunnerMethod;
162
- protected exec(cmd: string): Promise<string>;
163
- /**
164
- * Executes one or more tasks.
165
- *
166
- * @param task - A single task or an array of tasks to run in parallel.
167
- */
166
+ protected exec(cmd: string, opts?: {
167
+ root?: string;
168
+ }): Promise<string>;
169
+ /**
170
+ * Executes one or more tasks.
171
+ *
172
+ * @param task - A single task or an array of tasks to run in parallel.
173
+ */
168
174
  protected execute(task: Task | Task[]): Promise<string>;
169
175
  /**
170
- * Prints a summary of all executed tasks and their durations.
171
- */
172
- summary(): void;
176
+ * Prints a summary of all executed tasks and their durations.
177
+ */
178
+ end(): void;
173
179
  protected executeTask(task: Task): Promise<string>;
174
180
  protected renderTable(data: string[][]): void;
175
181
  }
@@ -187,208 +193,203 @@ declare const $command: {
187
193
  };
188
194
  interface CommandPrimitiveOptions<T extends TObject, A extends TSchema, E extends TObject = TObject> {
189
195
  /**
190
- * The handler function to execute when the command is matched.
191
- *
192
- * For parent commands with children, the handler is called when:
193
- * - The parent command is invoked without a subcommand
194
- * - The parent command is invoked with --help (to show available subcommands)
195
- */
196
+ * The handler function to execute when the command is matched.
197
+ *
198
+ * For parent commands with children, the handler is called when:
199
+ * - The parent command is invoked without a subcommand
200
+ * - The parent command is invoked with --help (to show available subcommands)
201
+ */
196
202
  handler: (args: CommandHandlerArgs<T, A, E>) => Async<void>;
197
203
  /**
198
- * The name of the command. If omitted, the property key is used.
199
- *
200
- * An empty string "" denotes the root command.
201
- */
204
+ * The name of the command. If omitted, the property key is used.
205
+ *
206
+ * An empty string "" denotes the root command.
207
+ */
202
208
  name?: string;
203
209
  /**
204
- * A short description of the command, shown in the help message.
205
- */
210
+ * A short description of the command, shown in the help message.
211
+ */
206
212
  description?: string;
207
213
  /**
208
- * An array of alternative names for the command.
209
- */
214
+ * An array of alternative names for the command.
215
+ */
210
216
  aliases?: string[];
211
217
  /**
212
- * A TypeBox object schema defining the flags for the command.
213
- */
218
+ * A TypeBox object schema defining the flags for the command.
219
+ */
214
220
  flags?: T;
215
221
  /**
216
- * A TypeBox object schema defining required environment variables.
217
- *
218
- * Environment variables are validated before the handler runs (fail fast).
219
- * They are displayed in the help output under "Env:" section.
220
- *
221
- * @example
222
- * ```ts
223
- * $command({
224
- * env: t.object({
225
- * VERCEL_TOKEN: t.text({ description: "Vercel API token" }),
226
- * VERCEL_ORG_ID: t.optional(t.text({ description: "Organization ID" })),
227
- * }),
228
- * handler: async ({ env }) => {
229
- * // env.VERCEL_TOKEN is typed & guaranteed to exist
230
- * console.log(env.VERCEL_TOKEN);
231
- * }
232
- * })
233
- * ```
234
- */
222
+ * A TypeBox object schema defining required environment variables.
223
+ *
224
+ * Environment variables are validated before the handler runs (fail fast).
225
+ * They are displayed in the help output under "Env:" section.
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * $command({
230
+ * env: t.object({
231
+ * VERCEL_TOKEN: t.text({ description: "Vercel API token" }),
232
+ * VERCEL_ORG_ID: t.optional(t.text({ description: "Organization ID" })),
233
+ * }),
234
+ * handler: async ({ env }) => {
235
+ * // env.VERCEL_TOKEN is typed & guaranteed to exist
236
+ * console.log(env.VERCEL_TOKEN);
237
+ * }
238
+ * })
239
+ * ```
240
+ */
235
241
  env?: E;
236
242
  /**
237
- * An optional TypeBox schema defining the arguments for the command.
238
- *
239
- * @example
240
- * args: t.text()
241
- * my-cli command <arg1: string>
242
- *
243
- * args: t.optional(t.text())
244
- * my-cli command [arg1: string]
245
- *
246
- * args: t.tuple([t.text(), t.number()])
247
- * my-cli command <arg1: string> <arg2: number>
248
- *
249
- * args: t.tuple([t.text(), t.optional(t.number())])
250
- * my-cli command <arg1: string> [arg2: number]
251
- */
243
+ * An optional TypeBox schema defining the arguments for the command.
244
+ *
245
+ * @example
246
+ * args: t.text()
247
+ * my-cli command <arg1: string>
248
+ *
249
+ * args: t.optional(t.text())
250
+ * my-cli command [arg1: string]
251
+ *
252
+ * args: t.tuple([t.text(), t.number()])
253
+ * my-cli command <arg1: string> <arg2: number>
254
+ *
255
+ * args: t.tuple([t.text(), t.optional(t.number())])
256
+ * my-cli command <arg1: string> [arg2: number]
257
+ */
252
258
  args?: A;
253
259
  /**
254
- * If false, skip summary message at the end of the command execution.
255
- * Summary will display only if ({ run }) method calls were made.
256
- */
257
- summary?: boolean;
258
- /**
259
- * Marks this command as the root command.
260
- * Equivalent to setting name to an empty string "".
261
- */
260
+ * Marks this command as the root command.
261
+ * Equivalent to setting name to an empty string "".
262
+ */
262
263
  root?: boolean;
263
264
  /**
264
- * Run this command's handler BEFORE the specified target command.
265
- *
266
- * Pre-hooks are not listed in help and cannot be called directly.
267
- * They receive the same parsed flags and args as the target command.
268
- *
269
- * @example
270
- * ```ts
271
- * class BuildCommands {
272
- * prebuild = $command({
273
- * pre: "build",
274
- * handler: async ({ run }) => {
275
- * await run("cleaning dist folder...", () => fs.rm("dist"));
276
- * }
277
- * });
278
- *
279
- * build = $command({
280
- * name: "build",
281
- * handler: async () => { ... }
282
- * });
283
- * }
284
- * ```
285
- */
265
+ * Run this command's handler BEFORE the specified target command.
266
+ *
267
+ * Pre-hooks are not listed in help and cannot be called directly.
268
+ * They receive the same parsed flags and args as the target command.
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * class BuildCommands {
273
+ * prebuild = $command({
274
+ * pre: "build",
275
+ * handler: async ({ run }) => {
276
+ * await run("cleaning dist folder...", () => fs.rm("dist"));
277
+ * }
278
+ * });
279
+ *
280
+ * build = $command({
281
+ * name: "build",
282
+ * handler: async () => { ... }
283
+ * });
284
+ * }
285
+ * ```
286
+ */
286
287
  pre?: string;
287
288
  /**
288
- * Run this command's handler AFTER the specified target command.
289
- *
290
- * Post-hooks are not listed in help and cannot be called directly.
291
- * They receive the same parsed flags and args as the target command.
292
- *
293
- * @example
294
- * ```ts
295
- * class BuildCommands {
296
- * build = $command({
297
- * name: "build",
298
- * handler: async () => { ... }
299
- * });
300
- *
301
- * postbuild = $command({
302
- * post: "build",
303
- * handler: async ({ run }) => {
304
- * await run("generating checksums...", generateChecksums);
305
- * }
306
- * });
307
- * }
308
- * ```
309
- */
289
+ * Run this command's handler AFTER the specified target command.
290
+ *
291
+ * Post-hooks are not listed in help and cannot be called directly.
292
+ * They receive the same parsed flags and args as the target command.
293
+ *
294
+ * @example
295
+ * ```ts
296
+ * class BuildCommands {
297
+ * build = $command({
298
+ * name: "build",
299
+ * handler: async () => { ... }
300
+ * });
301
+ *
302
+ * postbuild = $command({
303
+ * post: "build",
304
+ * handler: async ({ run }) => {
305
+ * await run("generating checksums...", generateChecksums);
306
+ * }
307
+ * });
308
+ * }
309
+ * ```
310
+ */
310
311
  post?: string;
311
312
  /**
312
- * If true, this command will be hidden from the help output.
313
- */
313
+ * If true, this command will be hidden from the help output.
314
+ */
314
315
  hide?: boolean;
315
316
  /**
316
- * Adds a `--mode, -m` flag to load environment files.
317
- *
318
- * When enabled:
319
- * - Loads `.env` and `.env.local` by default
320
- * - With `--mode production`, also loads `.env.production` and `.env.production.local`
321
- * - The mode value is exposed in the handler as `mode: string | undefined`
322
- *
323
- * Set to `true` to enable with no default, or a string to set a default mode.
324
- *
325
- * This follows Vite's environment loading convention.
326
- * @see https://vite.dev/guide/env-and-mode
327
- *
328
- * @example
329
- * ```ts
330
- * // No default mode
331
- * build = $command({
332
- * mode: true,
333
- * handler: async ({ mode }) => {
334
- * console.log(`Building for ${mode ?? 'development'}...`);
335
- * }
336
- * });
337
- *
338
- * // Default mode "production"
339
- * deploy = $command({
340
- * mode: "production",
341
- * handler: async ({ mode }) => {
342
- * console.log(`Deploying for ${mode}...`); // always defined
343
- * }
344
- * });
345
- * ```
346
- *
347
- * Usage:
348
- * - `cli build` - loads .env (mode = undefined)
349
- * - `cli build --mode production` - loads .env and .env.production
350
- * - `cli deploy` - loads .env and .env.production (default mode)
351
- * - `cli deploy --mode staging` - loads .env and .env.staging
352
- */
317
+ * Adds a `--mode, -m` flag to load environment files.
318
+ *
319
+ * When enabled:
320
+ * - Loads `.env` and `.env.local` by default
321
+ * - With `--mode production`, also loads `.env.production` and `.env.production.local`
322
+ * - The mode value is exposed in the handler as `mode: string | undefined`
323
+ *
324
+ * Set to `true` to enable with no default, or a string to set a default mode.
325
+ *
326
+ * This follows Vite's environment loading convention.
327
+ * @see https://vite.dev/guide/env-and-mode
328
+ *
329
+ * @example
330
+ * ```ts
331
+ * // No default mode
332
+ * build = $command({
333
+ * mode: true,
334
+ * handler: async ({ mode }) => {
335
+ * console.log(`Building for ${mode ?? 'development'}...`);
336
+ * }
337
+ * });
338
+ *
339
+ * // Default mode "production"
340
+ * deploy = $command({
341
+ * mode: "production",
342
+ * handler: async ({ mode }) => {
343
+ * console.log(`Deploying for ${mode}...`); // always defined
344
+ * }
345
+ * });
346
+ * ```
347
+ *
348
+ * Usage:
349
+ * - `cli build` - loads .env (mode = undefined)
350
+ * - `cli build --mode production` - loads .env and .env.production
351
+ * - `cli deploy` - loads .env and .env.production (default mode)
352
+ * - `cli deploy --mode staging` - loads .env and .env.staging
353
+ */
353
354
  mode?: boolean | string;
354
355
  /**
355
- * Child commands (subcommands) for this command.
356
- *
357
- * When children are defined, the command becomes a parent command that
358
- * can be invoked with space-separated subcommands:
359
- *
360
- * @example
361
- * ```ts
362
- * class DeployCommands {
363
- * // Subcommands
364
- * vercel = $command({
365
- * description: "Deploy to Vercel",
366
- * handler: async () => { ... }
367
- * });
368
- *
369
- * cloudflare = $command({
370
- * description: "Deploy to Cloudflare",
371
- * handler: async () => { ... }
372
- * });
373
- *
374
- * // Parent command with children
375
- * deploy = $command({
376
- * description: "Deploy the application",
377
- * children: [this.vercel, this.cloudflare],
378
- * handler: async () => {
379
- * // Called when "deploy" is invoked without subcommand
380
- * console.log("Available: deploy vercel, deploy cloudflare");
381
- * }
382
- * });
383
- * }
384
- * ```
385
- *
386
- * This allows CLI usage like:
387
- * - `cli deploy vercel` - runs the vercel subcommand
388
- * - `cli deploy cloudflare` - runs the cloudflare subcommand
389
- * - `cli deploy` - runs the parent handler (shows available subcommands)
390
- * - `cli deploy --help` - shows help with all available subcommands
391
- */
356
+ * Child commands (subcommands) for this command.
357
+ *
358
+ * When children are defined, the command becomes a parent command that
359
+ * can be invoked with space-separated subcommands:
360
+ *
361
+ * @example
362
+ * ```ts
363
+ * class DeployCommands {
364
+ * // Subcommands
365
+ * vercel = $command({
366
+ * description: "Deploy to Vercel",
367
+ * handler: async () => { ... }
368
+ * });
369
+ *
370
+ * cloudflare = $command({
371
+ * description: "Deploy to Cloudflare",
372
+ * handler: async () => { ... }
373
+ * });
374
+ *
375
+ * // Parent command with children
376
+ * deploy = $command({
377
+ * description: "Deploy the application",
378
+ * children: [this.vercel, this.cloudflare],
379
+ * handler: async () => {
380
+ * // Called when "deploy" is invoked without subcommand
381
+ * console.log("Available: deploy vercel, deploy cloudflare");
382
+ * }
383
+ * });
384
+ * }
385
+ * ```
386
+ *
387
+ * This allows CLI usage like:
388
+ * - `cli deploy vercel` - runs the vercel subcommand
389
+ * - `cli deploy cloudflare` - runs the cloudflare subcommand
390
+ * - `cli deploy` - runs the parent handler (shows available subcommands)
391
+ * - `cli deploy --help` - shows help with all available subcommands
392
+ */
392
393
  children?: CommandPrimitive<any, any>[];
393
394
  }
394
395
  declare class CommandPrimitive<T extends TObject = TObject, A extends TSchema = TSchema, E extends TObject = TObject> extends Primitive<CommandPrimitiveOptions<T, A, E>> {
@@ -398,16 +399,16 @@ declare class CommandPrimitive<T extends TObject = TObject, A extends TSchema =
398
399
  protected onInit(): void;
399
400
  get name(): string;
400
401
  /**
401
- * Get the child commands (subcommands) for this command.
402
- */
402
+ * Get the child commands (subcommands) for this command.
403
+ */
403
404
  get children(): CommandPrimitive<any, any>[];
404
405
  /**
405
- * Check if this command has child commands (is a parent command).
406
- */
406
+ * Check if this command has child commands (is a parent command).
407
+ */
407
408
  get hasChildren(): boolean;
408
409
  /**
409
- * Find a child command by name or alias.
410
- */
410
+ * Find a child command by name or alias.
411
+ */
411
412
  findChild(name: string): CommandPrimitive<any, any> | undefined;
412
413
  }
413
414
  interface CommandHandlerArgs<T extends TObject, A extends TSchema = TSchema, E extends TObject = TObject> {
@@ -419,31 +420,31 @@ interface CommandHandlerArgs<T extends TObject, A extends TSchema = TSchema, E e
419
420
  glob: typeof glob;
420
421
  fs: typeof fs;
421
422
  /**
422
- * The root directory where the command is executed.
423
- */
423
+ * The root directory where the command is executed.
424
+ */
424
425
  root: string;
425
426
  /**
426
- * Display help for the current command.
427
- *
428
- * Useful for parent commands with children to show available subcommands
429
- * when invoked without a specific subcommand.
430
- *
431
- * @example
432
- * ```ts
433
- * deploy = $command({
434
- * children: [this.vercel, this.cloudflare],
435
- * handler: async ({ help }) => {
436
- * help(); // Shows available subcommands
437
- * }
438
- * });
439
- * ```
440
- */
427
+ * Display help for the current command.
428
+ *
429
+ * Useful for parent commands with children to show available subcommands
430
+ * when invoked without a specific subcommand.
431
+ *
432
+ * @example
433
+ * ```ts
434
+ * deploy = $command({
435
+ * children: [this.vercel, this.cloudflare],
436
+ * handler: async ({ help }) => {
437
+ * help(); // Shows available subcommands
438
+ * }
439
+ * });
440
+ * ```
441
+ */
441
442
  help: () => void;
442
443
  /**
443
- * The current execution mode (e.g., "development", "production", "staging").
444
- *
445
- * Use --mode flag to set this value when running the command.
446
- */
444
+ * The current execution mode (e.g., "development", "production", "staging").
445
+ *
446
+ * Use --mode flag to set this value when running the command.
447
+ */
447
448
  mode?: string;
448
449
  }
449
450
  //#endregion
@@ -532,21 +533,21 @@ declare class CliProvider {
532
533
  };
533
534
  protected readonly onReady: alepha1.HookPrimitive<"ready">;
534
535
  /**
535
- * Execute a command with the given argv.
536
- */
536
+ * Execute a command with the given argv.
537
+ */
537
538
  protected executeCommand(command: CommandPrimitive<TObject>, argv: string[], isRootCommand: boolean): Promise<void>;
538
539
  /**
539
- * Remove consumed command path arguments from argv.
540
- */
540
+ * Remove consumed command path arguments from argv.
541
+ */
541
542
  protected removeConsumedArgs(argv: string[], consumedArgs: string[]): string[];
542
543
  /**
543
- * Resolve a command from positional arguments.
544
- *
545
- * Supports:
546
- * 1. Space-separated subcommands: `deploy vercel` -> finds deploy command, then vercel child
547
- * 2. Colon notation (backwards compat): `deploy:vercel` -> finds command with name "deploy:vercel"
548
- * 3. Simple commands: `build` -> finds command with name "build"
549
- */
544
+ * Resolve a command from positional arguments.
545
+ *
546
+ * Supports:
547
+ * 1. Space-separated subcommands: `deploy vercel` -> finds deploy command, then vercel child
548
+ * 2. Colon notation (backwards compat): `deploy:vercel` -> finds command with name "deploy:vercel"
549
+ * 3. Simple commands: `build` -> finds command with name "build"
550
+ */
550
551
  protected resolveCommand(positionalArgs: string[]): {
551
552
  command: CommandPrimitive<TObject> | undefined;
552
553
  consumedArgs: string[];
@@ -554,16 +555,16 @@ declare class CliProvider {
554
555
  get commands(): CommandPrimitive<any>[];
555
556
  protected findCommand(name: string): CommandPrimitive<TObject> | undefined;
556
557
  /**
557
- * Find all pre-hooks for a command.
558
- */
558
+ * Find all pre-hooks for a command.
559
+ */
559
560
  protected findPreHooks(commandName: string): CommandPrimitive<TObject>[];
560
561
  /**
561
- * Find all post-hooks for a command.
562
- */
562
+ * Find all post-hooks for a command.
563
+ */
563
564
  protected findPostHooks(commandName: string): CommandPrimitive<TObject>[];
564
565
  /**
565
- * Get global flags (help only, root command flags are NOT global).
566
- */
566
+ * Get global flags (help only, root command flags are NOT global).
567
+ */
567
568
  protected getAllGlobalFlags(): Record<string, {
568
569
  aliases: string[];
569
570
  description?: string;
@@ -572,12 +573,12 @@ declare class CliProvider {
572
573
  protected parseCommandFlags(argv: string[], schema: TObject): Record<string, any>;
573
574
  protected parseCommandEnv(schema: TObject, commandName: string): Record<string, any>;
574
575
  /**
575
- * Parse --mode or -m flag from argv.
576
- */
576
+ * Parse --mode or -m flag from argv.
577
+ */
577
578
  protected parseModeFlag(argv: string[]): string | undefined;
578
579
  /**
579
- * Load environment files based on mode.
580
- */
580
+ * Load environment files based on mode.
581
+ */
581
582
  protected loadModeEnv(root: string, mode: string | undefined): Promise<void>;
582
583
  protected parseFlags(argv: string[], flagDefs: {
583
584
  key: string;
@@ -585,8 +586,8 @@ declare class CliProvider {
585
586
  schema: TSchema;
586
587
  }[]): Record<string, any>;
587
588
  /**
588
- * Get indices of argv elements that are consumed by flags (including space-separated values).
589
- */
589
+ * Get indices of argv elements that are consumed by flags (including space-separated values).
590
+ */
590
591
  protected getFlagConsumedIndices(argv: string[], flagDefs: {
591
592
  key: string;
592
593
  aliases: string[];
@@ -598,24 +599,24 @@ declare class CliProvider {
598
599
  protected getTypeName(schema: TSchema): string;
599
600
  printHelp(command?: CommandPrimitive<any>): void;
600
601
  /**
601
- * Generate colored args usage string for help display.
602
- */
602
+ * Generate colored args usage string for help display.
603
+ */
603
604
  protected generateColoredArgsUsage(schema?: TSchema): string;
604
605
  /**
605
- * Get the full command path (e.g., "deploy vercel" for a child command).
606
- */
606
+ * Get the full command path (e.g., "deploy vercel" for a child command).
607
+ */
607
608
  protected getCommandPath(command: CommandPrimitive<any>): string;
608
609
  /**
609
- * Find the parent command of a given command.
610
- */
610
+ * Find the parent command of a given command.
611
+ */
611
612
  protected findParentCommand(command: CommandPrimitive<any>): CommandPrimitive<any> | undefined;
612
613
  /**
613
- * Get top-level commands (commands that are not children of other commands).
614
- */
614
+ * Get top-level commands (commands that are not children of other commands).
615
+ */
615
616
  protected getTopLevelCommands(): CommandPrimitive<any>[];
616
617
  /**
617
- * Get max length for child command display.
618
- */
618
+ * Get max length for child command display.
619
+ */
619
620
  protected getMaxChildCmdLength(children: CommandPrimitive<any>[]): number;
620
621
  protected getMaxCmdLength(commands: CommandPrimitive[]): number;
621
622
  private getMaxFlagLength;
@@ -635,15 +636,13 @@ declare const AlephaCommand: alepha1.Service<alepha1.Module>;
635
636
  declare module "typebox" {
636
637
  interface StringOptions {
637
638
  /**
638
- * Additional aliases for the flags.
639
- *
640
- * @module alepha.command
641
- */
639
+ * Additional aliases for the flags.
640
+ *
641
+ * @module alepha.command
642
+ */
642
643
  aliases?: string[];
643
644
  }
644
- }
645
- //# sourceMappingURL=index.d.ts.map
646
-
645
+ } //# sourceMappingURL=index.d.ts.map
647
646
  //#endregion
648
647
  export { $command, AlephaCommand, AskMethod, AskOptions, Asker, CliProvider, CliProviderOptions, CommandError, CommandHandlerArgs, CommandPrimitive, CommandPrimitiveOptions, EnvUtils, PrettyPrint, RunOptions, Runner, RunnerMethod, Task, cliOptions };
649
648
  //# sourceMappingURL=index.d.ts.map