commandkit 1.2.1-dev.20260414125348 → 1.2.1-dev.20260920033200

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 (269) hide show
  1. package/README.md +1 -1
  2. package/cache.cjs +2 -0
  3. package/cache.d.ts +1 -0
  4. package/dist/{ActionRow-Bt9qi0Mb.d.ts → ActionRow-DSh9roc5.d.ts} +2 -3
  5. package/dist/{Button-DxJLcZIU.d.ts → Button-BPsE5ju0.d.ts} +5 -6
  6. package/dist/{ButtonKit-BfcyvWfj.d.ts → ButtonKit-CNPmVg3h.d.ts} +2 -3
  7. package/dist/{ChannelSelectMenuKit-DYkudikb.d.ts → ChannelSelectMenuKit-CcOdaLQ6.d.ts} +3 -4
  8. package/dist/{CommandTree-DwfiCsOl.d.ts → CommandTree-qu-8oAEV.d.ts} +1 -1
  9. package/dist/{CommandsRouter-D-b3xv38.d.ts → CommandsRouter-Co225Ae5.d.ts} +24 -4
  10. package/dist/{EventInterceptor-D9JKMcfi.d.ts → EventInterceptor-wg378vJp.d.ts} +1 -2
  11. package/dist/{EventsRouter-Dyr_oJJD.d.ts → EventsRouter-Bt63ZuEF.d.ts} +21 -2
  12. package/dist/{MentionableSelectMenuKit-Mu4xqP6B.d.ts → MentionableSelectMenuKit-8_Nkgn_a.d.ts} +3 -4
  13. package/dist/{MessageCommandParser-UTKsRvb9.d.ts → MessageCommandParser-BYbxHOSK.d.ts} +1 -2
  14. package/dist/{Modal-v9rrcMl-.d.ts → Modal-DbWK6VmV.d.ts} +5 -6
  15. package/dist/{ModalKit-XJSM65SV.d.ts → ModalKit-CnmUVpw-.d.ts} +2 -3
  16. package/dist/{RoleSelectMenuKit-CCjcp3HY.d.ts → RoleSelectMenuKit-Bei7DHqD.d.ts} +3 -4
  17. package/dist/{SelectMenu-CY0vvoSu.d.ts → SelectMenu-Bce_PClo.d.ts} +8 -9
  18. package/dist/{StringSelectMenuKit-G5nBTicX.d.ts → StringSelectMenuKit-CBeB9HqT.d.ts} +3 -4
  19. package/dist/TreeArtifact-D6FZ5SVd.d.ts +27 -0
  20. package/dist/{UserSelectMenuKit-D3SO_fXA.d.ts → UserSelectMenuKit-DZmeZ_Tp.d.ts} +3 -4
  21. package/dist/analytics/analytics-engine.d.ts +1 -1
  22. package/dist/analytics/analytics-engine.js +1 -1
  23. package/dist/analytics/analytics-provider.d.ts +1 -1
  24. package/dist/analytics/constants.js +0 -1
  25. package/dist/analytics/constants.js.map +1 -1
  26. package/dist/analytics/utils.js +1 -1
  27. package/dist/{analytics-engine-BYA0ongA.d.ts → analytics-engine-Bz1p7ud3.d.ts} +51 -15
  28. package/dist/app/commands/AppCommandRunner.d.ts +1 -1
  29. package/dist/app/commands/AppCommandRunner.js +1 -1
  30. package/dist/app/commands/Context.d.ts +1 -1
  31. package/dist/app/commands/Context.js +1 -1
  32. package/dist/app/commands/MessageCommandParser.d.ts +1 -1
  33. package/dist/app/commands/MessageCommandParser.js +4 -1
  34. package/dist/app/commands/MessageCommandParser.js.map +1 -1
  35. package/dist/app/commands/helpers.d.ts +1 -1
  36. package/dist/app/commands/helpers.js +0 -1
  37. package/dist/app/commands/helpers.js.map +1 -1
  38. package/dist/app/events/EventWorkerContext.d.ts +3 -3
  39. package/dist/app/events/EventWorkerContext.js +0 -1
  40. package/dist/app/events/EventWorkerContext.js.map +1 -1
  41. package/dist/app/handlers/AppCommandHandler.d.ts +1 -1
  42. package/dist/app/handlers/AppCommandHandler.js +1 -1
  43. package/dist/app/handlers/AppEventsHandler.d.ts +1 -1
  44. package/dist/app/handlers/AppEventsHandler.js +1 -1
  45. package/dist/app/index.d.ts +5 -5
  46. package/dist/app/index.js +1 -1
  47. package/dist/app/interrupt/signals.d.ts +1 -1
  48. package/dist/app/interrupt/signals.js.map +1 -1
  49. package/dist/app/middlewares/permissions.d.ts +1 -2
  50. package/dist/app/middlewares/permissions.js +1 -1
  51. package/dist/app/register/CommandRegistrar.d.ts +1 -1
  52. package/dist/app/register/CommandRegistrar.js +1 -1
  53. package/dist/app/router/CommandTree.d.ts +1 -1
  54. package/dist/app/router/CommandsRouter.d.ts +2 -2
  55. package/dist/app/router/CommandsRouter.js +60 -1
  56. package/dist/app/router/CommandsRouter.js.map +1 -1
  57. package/dist/app/router/EventsRouter.d.ts +2 -2
  58. package/dist/app/router/EventsRouter.js +56 -3
  59. package/dist/app/router/EventsRouter.js.map +1 -1
  60. package/dist/app/router/TreeArtifact.d.ts +2 -0
  61. package/dist/app/router/TreeArtifact.js +87 -0
  62. package/dist/app/router/TreeArtifact.js.map +1 -0
  63. package/dist/app/router/index.d.ts +6 -4
  64. package/dist/app/router/index.js +8 -1
  65. package/dist/{checkbox-CvQGiyRe.d.ts → checkbox-DoR0Pcxm.d.ts} +2 -3
  66. package/dist/cli/app-process.d.ts +2 -4
  67. package/dist/cli/app-process.js +0 -1
  68. package/dist/cli/app-process.js.map +1 -1
  69. package/dist/cli/build.d.ts +4 -9
  70. package/dist/cli/build.js +30 -4
  71. package/dist/cli/build.js.map +1 -1
  72. package/dist/cli/common.d.ts +3 -6
  73. package/dist/cli/common.js +2 -2
  74. package/dist/cli/common.js.map +1 -1
  75. package/dist/cli/development.d.ts +4 -5
  76. package/dist/cli/development.js +11 -11
  77. package/dist/cli/development.js.map +1 -1
  78. package/dist/cli/env.js.map +1 -1
  79. package/dist/cli/generators.js +0 -1
  80. package/dist/cli/generators.js.map +1 -1
  81. package/dist/cli/information.js +4 -5
  82. package/dist/cli/information.js.map +1 -1
  83. package/dist/cli/init.d.ts +1 -3
  84. package/dist/cli/init.js +37 -12
  85. package/dist/cli/init.js.map +1 -1
  86. package/dist/cli/production.d.ts +1 -3
  87. package/dist/cli/production.js +1 -2
  88. package/dist/cli/production.js.map +1 -1
  89. package/dist/cli/type-checker.js +0 -1
  90. package/dist/cli/type-checker.js.map +1 -1
  91. package/dist/cli/utils.d.ts +0 -1
  92. package/dist/cli/utils.js.map +1 -1
  93. package/dist/{commandkit-DTqT800J.js → commandkit-gJ4YjTy4.js} +165 -87
  94. package/dist/commandkit-gJ4YjTy4.js.map +1 -0
  95. package/dist/commandkit.d.ts +1 -1
  96. package/dist/commandkit.js +1 -1
  97. package/dist/{common-CCvvgnxi.d.ts → common-CIbPzguv.d.ts} +2 -3
  98. package/dist/components/common/EventInterceptor.d.ts +1 -1
  99. package/dist/components/common/EventInterceptor.js +1 -0
  100. package/dist/components/common/EventInterceptor.js.map +1 -1
  101. package/dist/components/common/element.d.ts +1 -1
  102. package/dist/components/common/element.js +1 -1
  103. package/dist/components/common/types.d.ts +1 -1
  104. package/dist/components/display/common.d.ts +0 -1
  105. package/dist/components/display/common.js +1 -1
  106. package/dist/components/display/container.d.ts +1 -1
  107. package/dist/components/display/container.js +1 -1
  108. package/dist/components/display/file.d.ts +1 -1
  109. package/dist/components/display/file.js +0 -1
  110. package/dist/components/display/file.js.map +1 -1
  111. package/dist/components/display/index.d.ts +9 -8
  112. package/dist/components/display/index.js +1 -1
  113. package/dist/components/display/label.d.ts +1 -1
  114. package/dist/components/display/label.js +1 -1
  115. package/dist/components/display/media-gallery.d.ts +1 -1
  116. package/dist/components/display/media-gallery.js +1 -1
  117. package/dist/components/display/poll.d.ts +1 -1
  118. package/dist/components/display/poll.js +4 -10
  119. package/dist/components/display/poll.js.map +1 -1
  120. package/dist/components/display/section.d.ts +1 -1
  121. package/dist/components/display/section.js +1 -1
  122. package/dist/components/display/separator.d.ts +1 -1
  123. package/dist/components/display/separator.js +0 -1
  124. package/dist/components/display/separator.js.map +1 -1
  125. package/dist/components/display/text-display.d.ts +1 -1
  126. package/dist/components/display/text-display.js +0 -1
  127. package/dist/components/display/text-display.js.map +1 -1
  128. package/dist/components/index.d.ts +25 -24
  129. package/dist/components/index.js +1 -1
  130. package/dist/components/interactive/action-row/ActionRow.d.ts +1 -1
  131. package/dist/components/interactive/action-row/ActionRow.js +0 -1
  132. package/dist/components/interactive/action-row/ActionRow.js.map +1 -1
  133. package/dist/components/interactive/button/Button.d.ts +1 -1
  134. package/dist/components/interactive/button/Button.js +1 -1
  135. package/dist/components/interactive/button/ButtonKit.d.ts +1 -1
  136. package/dist/components/interactive/button/ButtonKit.js +1 -1
  137. package/dist/components/interactive/checkbox/checkbox.d.ts +1 -1
  138. package/dist/components/interactive/checkbox/checkbox.js +1 -1
  139. package/dist/components/interactive/modal/Modal.d.ts +1 -1
  140. package/dist/components/interactive/modal/Modal.js +1 -1
  141. package/dist/components/interactive/modal/ModalKit.d.ts +1 -1
  142. package/dist/components/interactive/modal/ModalKit.js +1 -1
  143. package/dist/components/interactive/radio/radio.d.ts +1 -1
  144. package/dist/components/interactive/radio/radio.js +1 -1
  145. package/dist/components/interactive/select-menu/ChannelSelectMenuKit.d.ts +1 -1
  146. package/dist/components/interactive/select-menu/ChannelSelectMenuKit.js +1 -1
  147. package/dist/components/interactive/select-menu/MentionableSelectMenuKit.d.ts +1 -1
  148. package/dist/components/interactive/select-menu/MentionableSelectMenuKit.js +1 -1
  149. package/dist/components/interactive/select-menu/RoleSelectMenuKit.d.ts +1 -1
  150. package/dist/components/interactive/select-menu/RoleSelectMenuKit.js +1 -1
  151. package/dist/components/interactive/select-menu/SelectMenu.d.ts +1 -1
  152. package/dist/components/interactive/select-menu/SelectMenu.js +1 -1
  153. package/dist/components/interactive/select-menu/StringSelectMenuKit.d.ts +1 -1
  154. package/dist/components/interactive/select-menu/StringSelectMenuKit.js +1 -1
  155. package/dist/components/interactive/select-menu/UserSelectMenuKit.d.ts +1 -1
  156. package/dist/components/interactive/select-menu/UserSelectMenuKit.js +1 -1
  157. package/dist/components/interactive/select-menu/common.d.ts +1 -1
  158. package/dist/config/config.d.ts +1 -2
  159. package/dist/config/config.js +1 -1
  160. package/dist/config/default.d.ts +1 -2
  161. package/dist/config/default.js +1 -1
  162. package/dist/config/loader.d.ts +1 -2
  163. package/dist/config/loader.js +1 -1
  164. package/dist/config/types.d.ts +1 -1
  165. package/dist/config/utils.d.ts +1 -1
  166. package/dist/config/utils.js.map +1 -1
  167. package/dist/{constants-D_sgdBHy.d.ts → constants-B7AfnOFa.d.ts} +1 -1
  168. package/dist/{constants-GWSfiS4h.d.ts → constants-kWgE3L9F.d.ts} +15 -2
  169. package/dist/{container-B7Kmw__R.d.ts → container-NVgblXmw.d.ts} +1 -2
  170. package/dist/context/async-context.d.ts +1 -1
  171. package/dist/context/async-context.js +1 -1
  172. package/dist/context/environment.d.ts +1 -1
  173. package/dist/context/environment.js +1 -1
  174. package/dist/{element-DeLvTMfZ.d.ts → element-BMZYAAQ-.d.ts} +3 -4
  175. package/dist/events/CommandKitEventsChannel.d.ts +1 -1
  176. package/dist/events/CommandKitEventsChannel.js +3 -2
  177. package/dist/events/CommandKitEventsChannel.js.map +1 -1
  178. package/dist/{file-BP8aoN3A.d.ts → file-DYAmr697.d.ts} +1 -2
  179. package/dist/flags/FlagProvider.d.ts +1 -1
  180. package/dist/flags/FlagProvider.js +1 -0
  181. package/dist/flags/FlagProvider.js.map +1 -1
  182. package/dist/flags/feature-flags.d.ts +1 -1
  183. package/dist/flags/feature-flags.js +1 -1
  184. package/dist/flags/store.d.ts +1 -1
  185. package/dist/flags/store.js +0 -1
  186. package/dist/flags/store.js.map +1 -1
  187. package/dist/{helpers-C5jRrAM1.d.ts → helpers-vlnRvNJv.d.ts} +1 -2
  188. package/dist/index-CAFaKBs_.d.ts +8 -0
  189. package/dist/index-COt7nfC9.d.ts +2 -0
  190. package/dist/index-DvqHpiuh.d.ts +16 -0
  191. package/dist/index.d.ts +37 -34
  192. package/dist/index.js +9 -2
  193. package/dist/kv/constants.d.ts +1 -1
  194. package/dist/kv/constants.js.map +1 -1
  195. package/dist/kv/dotprops.js.map +1 -1
  196. package/dist/kv/kv.d.ts +0 -1
  197. package/dist/kv/kv.js +1 -1
  198. package/dist/kv/kv.js.map +1 -1
  199. package/dist/kv/serde.d.ts +1 -2
  200. package/dist/kv/serde.js +27 -27
  201. package/dist/kv/serde.js.map +1 -1
  202. package/dist/{label-CqHiBMXP.d.ts → label-DClaYktn.d.ts} +1 -2
  203. package/dist/logger/DefaultLogger.d.ts +0 -1
  204. package/dist/logger/DefaultLogger.js +1 -1
  205. package/dist/logger/Logger.d.ts +0 -1
  206. package/dist/logger/Logger.js +1 -1
  207. package/dist/logger/NoopLogger.d.ts +0 -1
  208. package/dist/logger/NoopLogger.js.map +1 -1
  209. package/dist/{media-gallery-hFfa57Kd.d.ts → media-gallery-z2Snzz-u.d.ts} +1 -2
  210. package/dist/plugins/CompilerPlugin.d.ts +1 -1
  211. package/dist/plugins/CompilerPlugin.js +2 -2
  212. package/dist/plugins/CompilerPlugin.js.map +1 -1
  213. package/dist/plugins/PluginCommon.d.ts +1 -1
  214. package/dist/plugins/PluginCommon.js +1 -1
  215. package/dist/plugins/PluginCommon.js.map +1 -1
  216. package/dist/plugins/RuntimePlugin.d.ts +1 -1
  217. package/dist/plugins/RuntimePlugin.js +2 -2
  218. package/dist/plugins/RuntimePlugin.js.map +1 -1
  219. package/dist/plugins/index.d.ts +1 -1
  220. package/dist/plugins/index.js +1 -1
  221. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +1 -1
  222. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +1 -1
  223. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +1 -1
  224. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +1 -1
  225. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +1 -1
  226. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +1 -1
  227. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +1 -2
  228. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +1 -1
  229. package/dist/plugins/plugin-runtime/runtime.d.ts +1 -1
  230. package/dist/plugins/types.d.ts +1 -1
  231. package/dist/{poll-ElAd5Z2K.d.ts → poll-D2QDStsw.d.ts} +4 -14
  232. package/dist/{radio-Dcd4YIZx.d.ts → radio-CJH_N4lq.d.ts} +2 -3
  233. package/dist/{section-BqDLXlp3.d.ts → section-DrFBT5b-.d.ts} +1 -2
  234. package/dist/{separator-DSaCa1Tc.d.ts → separator-BVm3w6yd.d.ts} +1 -2
  235. package/dist/{signals-DVOXPkQK.d.ts → signals-DRMDrCOn.d.ts} +1 -1
  236. package/dist/{text-display-D-0dD7bR.d.ts → text-display-BG0nNqy3.d.ts} +1 -2
  237. package/dist/{types-DZy7U-Ld.d.ts → types-ur7SvktF.d.ts} +1 -1
  238. package/dist/types.d.ts +1 -1
  239. package/dist/utils/colors.d.ts +1 -3
  240. package/dist/utils/colors.js +0 -1
  241. package/dist/utils/colors.js.map +1 -1
  242. package/dist/utils/constants.d.ts +2 -2
  243. package/dist/utils/constants.js +19 -0
  244. package/dist/utils/constants.js.map +1 -1
  245. package/dist/utils/dev-hooks.d.ts +1 -1
  246. package/dist/utils/dev-hooks.js +1 -1
  247. package/dist/utils/error-codes.js +15 -0
  248. package/dist/utils/error-codes.js.map +1 -1
  249. package/dist/utils/resolve-file-url.js +2 -2
  250. package/dist/utils/resolve-file-url.js.map +1 -1
  251. package/dist/utils/types-package.d.ts +6 -2
  252. package/dist/utils/types-package.js +31 -38
  253. package/dist/utils/types-package.js.map +1 -1
  254. package/dist/utils/useful-stuff/async-queue.js.map +1 -1
  255. package/dist/utils/useful-stuff/mutex.js.map +1 -1
  256. package/dist/utils/useful-stuff/ratelimiter.js +4 -1
  257. package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
  258. package/dist/utils/useful-stuff/semaphore.js.map +1 -1
  259. package/dist/utils/utilities.js +1 -1
  260. package/dist/utils/warning.d.ts +1 -5
  261. package/dist/utils/warning.js.map +1 -1
  262. package/dist/version.js +1 -1
  263. package/dist/version.js.map +1 -1
  264. package/package.json +17 -17
  265. package/dist/commandkit-DTqT800J.js.map +0 -1
  266. package/dist/index-CQiOqvUC.d.ts +0 -1
  267. package/dist/index-CTLjHn5u.d.ts +0 -1
  268. package/dist/index-LKrIp3Oo.d.ts +0 -1
  269. /package/dist/{chunk-BE-pF4vm.js → rolldown-runtime-C_NdSu1c.js} +0 -0
@@ -1,5 +1,6 @@
1
- const require_chunk = require('./chunk-BE-pF4vm.js');
1
+ const require_rolldown_runtime = require('./rolldown-runtime-C_NdSu1c.js');
2
2
  const require_utils_colors = require('./utils/colors.js');
3
+ require('./components/interactive/action-row/ActionRow.js');
3
4
  const require_utils_error_codes = require('./utils/error-codes.js');
4
5
  const require_plugins_CompilerPlugin = require('./plugins/CompilerPlugin.js');
5
6
  const require_plugins_RuntimePlugin = require('./plugins/RuntimePlugin.js');
@@ -16,11 +17,18 @@ const require_app_commands_helpers = require('./app/commands/helpers.js');
16
17
  const require_app_commands_MessageCommandParser = require('./app/commands/MessageCommandParser.js');
17
18
  const require_app_router_CommandsRouter = require('./app/router/CommandsRouter.js');
18
19
  const require_app_router_EventsRouter = require('./app/router/EventsRouter.js');
20
+ const require_app_router_TreeArtifact = require('./app/router/TreeArtifact.js');
21
+ require('./app/router/index.js');
22
+ const require_version = require('./version.js');
23
+ require('./components/display/file.js');
24
+ require('./components/display/separator.js');
25
+ require('./components/display/text-display.js');
26
+ require('./components/display/poll.js');
19
27
  const require_cli_common = require('./cli/common.js');
20
28
  const require_events_CommandKitEventsChannel = require('./events/CommandKitEventsChannel.js');
21
29
  const require_flags_store = require('./flags/store.js');
22
30
  let node_events = require("node:events");
23
- node_events = require_chunk.__toESM(node_events);
31
+ node_events = require_rolldown_runtime.__toESM(node_events);
24
32
  let discord_js = require("discord.js");
25
33
  let node_async_hooks = require("node:async_hooks");
26
34
  let node_crypto = require("node:crypto");
@@ -28,6 +36,7 @@ let node_console = require("node:console");
28
36
  let util = require("util");
29
37
  let node_fs = require("node:fs");
30
38
  let node_path = require("node:path");
39
+ let node_fs_promises = require("node:fs/promises");
31
40
 
32
41
  //#region src/context/async-context.ts
33
42
  const kCommandWorker = Symbol("commandkitCommandWorker");
@@ -387,17 +396,6 @@ var ModalKit = class extends discord_js.ModalBuilder {
387
396
 
388
397
  //#endregion
389
398
  //#region src/logger/DefaultLogger.ts
390
- /**
391
- * Log levels for the logger.
392
- */
393
- var LogLevel = /* @__PURE__ */ function(LogLevel) {
394
- LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
395
- LogLevel[LogLevel["INFO"] = 1] = "INFO";
396
- LogLevel[LogLevel["WARN"] = 2] = "WARN";
397
- LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
398
- LogLevel[LogLevel["DEFAULT"] = 4] = "DEFAULT";
399
- return LogLevel;
400
- }(LogLevel || {});
401
399
  const execHandlerKind = {
402
400
  autocomplete: "Autocomplete",
403
401
  messageContextMenu: "MessageContextMenu",
@@ -406,18 +404,18 @@ const execHandlerKind = {
406
404
  message: "Message"
407
405
  };
408
406
  const TextColorMap = {
409
- [LogLevel.DEBUG]: require_utils_colors.default.blue,
410
- [LogLevel.INFO]: require_utils_colors.default.green,
411
- [LogLevel.WARN]: require_utils_colors.default.yellow,
412
- [LogLevel.ERROR]: require_utils_colors.default.red,
413
- [LogLevel.DEFAULT]: require_utils_colors.default.white
407
+ [0]: require_utils_colors.default.blue,
408
+ [1]: require_utils_colors.default.green,
409
+ [2]: require_utils_colors.default.yellow,
410
+ [3]: require_utils_colors.default.red,
411
+ [4]: require_utils_colors.default.white
414
412
  };
415
413
  const TextBgColorMap = {
416
- [LogLevel.DEBUG]: require_utils_colors.default.bgBlue,
417
- [LogLevel.INFO]: require_utils_colors.default.bgGreen,
418
- [LogLevel.WARN]: require_utils_colors.default.bgYellow,
419
- [LogLevel.ERROR]: require_utils_colors.default.bgRed,
420
- [LogLevel.DEFAULT]: require_utils_colors.default.bgWhite
414
+ [0]: require_utils_colors.default.bgBlue,
415
+ [1]: require_utils_colors.default.bgGreen,
416
+ [2]: require_utils_colors.default.bgYellow,
417
+ [3]: require_utils_colors.default.bgRed,
418
+ [4]: require_utils_colors.default.bgWhite
421
419
  };
422
420
  const BoxChars = {
423
421
  vertical: "│",
@@ -431,6 +429,8 @@ const BoxChars = {
431
429
  * It formats the log messages with timestamps, log levels, and context information.
432
430
  */
433
431
  var DefaultLogger = class {
432
+ stdout;
433
+ stderr;
434
434
  logger;
435
435
  /**
436
436
  * Creates a new instance of DefaultLogger.
@@ -463,16 +463,16 @@ var DefaultLogger = class {
463
463
  _getLevelLabel(level) {
464
464
  let label;
465
465
  switch (level) {
466
- case LogLevel.DEBUG:
466
+ case 0:
467
467
  label = "[DEBUG]";
468
468
  break;
469
- case LogLevel.INFO:
469
+ case 1:
470
470
  label = "[INFO]";
471
471
  break;
472
- case LogLevel.WARN:
472
+ case 2:
473
473
  label = "[WARN]";
474
474
  break;
475
- case LogLevel.ERROR:
475
+ case 3:
476
476
  label = "[ERROR]";
477
477
  break;
478
478
  default: label = "[LOG]";
@@ -513,24 +513,24 @@ var DefaultLogger = class {
513
513
  else this.logger.log(`${prefix} ${require_utils_colors.default.dim(BoxChars.corner)}`, colorFn(result));
514
514
  }
515
515
  debug(messageOrStrings, ...values) {
516
- if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(LogLevel.DEBUG, messageOrStrings, ...values);
517
- else this._log(LogLevel.DEBUG, messageOrStrings);
516
+ if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(0, messageOrStrings, ...values);
517
+ else this._log(0, messageOrStrings);
518
518
  }
519
519
  error(messageOrStrings, ...values) {
520
- if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(LogLevel.ERROR, messageOrStrings, ...values);
521
- else this._log(LogLevel.ERROR, messageOrStrings);
520
+ if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(3, messageOrStrings, ...values);
521
+ else this._log(3, messageOrStrings);
522
522
  }
523
523
  log(messageOrStrings, ...values) {
524
- if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(LogLevel.DEFAULT, messageOrStrings, ...values);
525
- else this._log(LogLevel.DEFAULT, messageOrStrings);
524
+ if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(4, messageOrStrings, ...values);
525
+ else this._log(4, messageOrStrings);
526
526
  }
527
527
  info(messageOrStrings, ...values) {
528
- if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(LogLevel.INFO, messageOrStrings, ...values);
529
- else this._log(LogLevel.INFO, messageOrStrings);
528
+ if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(1, messageOrStrings, ...values);
529
+ else this._log(1, messageOrStrings);
530
530
  }
531
531
  warn(messageOrStrings, ...values) {
532
- if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(LogLevel.WARN, messageOrStrings, ...values);
533
- else this._log(LogLevel.WARN, messageOrStrings);
532
+ if (this._isTemplateStringsArray(messageOrStrings)) this._logTemplate(2, messageOrStrings, ...values);
533
+ else this._log(2, messageOrStrings);
534
534
  }
535
535
  _isTemplateStringsArray(value) {
536
536
  return Array.isArray(value) && "raw" in value && Array.isArray(value.raw);
@@ -801,6 +801,7 @@ function createProxy(target) {
801
801
  * Represents the runtime environment for CommandKit plugins.
802
802
  */
803
803
  var CommandKitPluginRuntime = class {
804
+ commandkit;
804
805
  plugins = new discord_js.Collection();
805
806
  /**
806
807
  * Creates a new instance of CommandKitPluginRuntime.
@@ -836,7 +837,12 @@ var CommandKitPluginRuntime = class {
836
837
  * @param plugin The plugin to pre-load.
837
838
  */
838
839
  async preload(plugin) {
839
- for (const entrypoint of plugin.preload) await (entrypoint.startsWith("module:") ? import(entrypoint.slice(7)) : import(require_utils_resolve_file_url.toFileURL(`${getCurrentDirectory()}/${entrypoint}`)));
840
+ for (const entrypoint of plugin.preload) {
841
+ const path = entrypoint.startsWith("module:") ? entrypoint.slice(7) : require_utils_resolve_file_url.toFileURL(`${getCurrentDirectory()}/${entrypoint}`);
842
+ Logger.debug`Preloading plugin entrypoint: ${path}`;
843
+ const result = await import(path);
844
+ Logger.debug`Preloaded plugin entrypoint: ${path} with result: ${result}`;
845
+ }
840
846
  }
841
847
  /**
842
848
  * Soft registers a plugin in the runtime.
@@ -918,19 +924,11 @@ var CommandKitPluginRuntime = class {
918
924
  //#endregion
919
925
  //#region src/plugins/plugin-runtime/CompilerPluginRuntime.ts
920
926
  /**
921
- * Enum representing the execution mode of a plugin.
922
- * It can be either 'activate' or 'deactivate'.
923
- * @private
924
- */
925
- var PluginExecutionMode = /* @__PURE__ */ function(PluginExecutionMode) {
926
- PluginExecutionMode["Activate"] = "activate";
927
- PluginExecutionMode["Deactivate"] = "deactivate";
928
- return PluginExecutionMode;
929
- }(PluginExecutionMode || {});
930
- /**
931
927
  * CompilerPluginRuntime is a runtime for managing compiler plugins in CommandKit.
932
928
  */
933
929
  var CompilerPluginRuntime = class {
930
+ plugins;
931
+ isDevMode;
934
932
  name = "CompilerPluginRuntime";
935
933
  initialized = false;
936
934
  templates = /* @__PURE__ */ new Map();
@@ -965,7 +963,7 @@ var CompilerPluginRuntime = class {
965
963
  */
966
964
  registerTemplate(name, handler) {
967
965
  const ctx = this.#pluginContext.getStore();
968
- if (!ctx || ctx.mode !== PluginExecutionMode.Activate) throw new Error("registerTemplate() must be called inside activate() method");
966
+ if (!ctx || ctx.mode !== "activate") throw new Error("registerTemplate() must be called inside activate() method");
969
967
  if (this.templates.has(name)) throw new Error(`Template "${name}" already exists`);
970
968
  this.templates.set(name, {
971
969
  handler,
@@ -979,7 +977,7 @@ var CompilerPluginRuntime = class {
979
977
  */
980
978
  unregisterTemplate(name) {
981
979
  const ctx = this.#pluginContext.getStore();
982
- if (!ctx || ctx.mode !== PluginExecutionMode.Deactivate) throw new Error("unregisterTemplate() must be called inside deactivate() method");
980
+ if (!ctx || ctx.mode !== "deactivate") throw new Error("unregisterTemplate() must be called inside deactivate() method");
983
981
  const template = this.templates.get(name);
984
982
  if (!template) throw new Error(`Template "${name}" does not exist`);
985
983
  if (template.plugin !== ctx.plugin) throw new Error(`Template "${name}" is owned by plugin "${template.plugin.name}" and cannot be unregistered by "${ctx.plugin.name}"`);
@@ -1043,7 +1041,7 @@ var CompilerPluginRuntime = class {
1043
1041
  for (const plugin of this.plugins) try {
1044
1042
  await this.#pluginContext.run({
1045
1043
  plugin,
1046
- mode: PluginExecutionMode.Activate
1044
+ mode: "activate"
1047
1045
  }, async () => {
1048
1046
  var _plugin$activate;
1049
1047
  await ((_plugin$activate = plugin.activate) === null || _plugin$activate === void 0 ? void 0 : _plugin$activate.call(plugin, this));
@@ -1062,7 +1060,7 @@ var CompilerPluginRuntime = class {
1062
1060
  for (const plugin of this.plugins) try {
1063
1061
  await this.#pluginContext.run({
1064
1062
  plugin,
1065
- mode: PluginExecutionMode.Deactivate
1063
+ mode: "deactivate"
1066
1064
  }, async () => {
1067
1065
  var _plugin$deactivate;
1068
1066
  await ((_plugin$deactivate = plugin.deactivate) === null || _plugin$deactivate === void 0 ? void 0 : _plugin$deactivate.call(plugin, this));
@@ -1129,7 +1127,8 @@ var MacroPlugin = class extends require_plugins_CompilerPlugin.CompilerPlugin {
1129
1127
  name = "MacroPlugin";
1130
1128
  macroTransformer;
1131
1129
  async activate() {
1132
- this.macroTransformer = new (await (import("use-macro"))).MacroTransformer();
1130
+ const transform = await import("use-macro");
1131
+ this.macroTransformer = new transform.MacroTransformer();
1133
1132
  }
1134
1133
  async deactivate() {
1135
1134
  this.macroTransformer = null;
@@ -1177,7 +1176,11 @@ const defaultConfig = {
1177
1176
  production: false
1178
1177
  },
1179
1178
  jsxDefaultOptionalComponents: true,
1180
- experimental: { devServerRuntime: null }
1179
+ experimental: {
1180
+ devServerRuntime: null,
1181
+ pregenerateCommands: false,
1182
+ incrementalRouter: false
1183
+ }
1181
1184
  };
1182
1185
 
1183
1186
  //#endregion
@@ -1194,7 +1197,7 @@ function getConfig() {
1194
1197
  * @param config The configuration to use.
1195
1198
  */
1196
1199
  function defineConfig(config = {}) {
1197
- var _config$compilerOptio, _config$compilerOptio2, _config$compilerOptio3;
1200
+ var _config$compilerOptio, _config$compilerOptio2, _config$compilerOptio3, _config$experimental, _config$experimental2;
1198
1201
  defined = require_config_utils.mergeDeep(config, require_config_utils.mergeDeep({}, defaultConfig));
1199
1202
  defined = {
1200
1203
  compilerOptions: {
@@ -1236,7 +1239,9 @@ function defineConfig(config = {}) {
1236
1239
  jsxDefaultOptionalComponents: config.jsxDefaultOptionalComponents ?? defaultConfig.jsxDefaultOptionalComponents,
1237
1240
  experimental: {
1238
1241
  ...defaultConfig.experimental,
1239
- ...config.experimental
1242
+ ...config.experimental,
1243
+ pregenerateCommands: ((_config$experimental = config.experimental) === null || _config$experimental === void 0 ? void 0 : _config$experimental.pregenerateCommands) ?? defaultConfig.experimental.pregenerateCommands,
1244
+ incrementalRouter: ((_config$experimental2 = config.experimental) === null || _config$experimental2 === void 0 ? void 0 : _config$experimental2.incrementalRouter) ?? defaultConfig.experimental.incrementalRouter
1240
1245
  }
1241
1246
  };
1242
1247
  return defined;
@@ -1305,6 +1310,7 @@ function applyDefaultOptionalComponentBehavior(props) {
1305
1310
  * Represents the execution environment for CommandKit commands.
1306
1311
  */
1307
1312
  var CommandKitEnvironment = class {
1313
+ commandkit;
1308
1314
  #data = {
1309
1315
  executionError: null,
1310
1316
  type: null,
@@ -1512,6 +1518,8 @@ const CommandExecutionMode = {
1512
1518
  * command metadata, and various utility methods for command execution.
1513
1519
  */
1514
1520
  var Context = class Context {
1521
+ commandkit;
1522
+ config;
1515
1523
  /**
1516
1524
  * The interaction that triggered the command.
1517
1525
  */
@@ -1783,6 +1791,7 @@ var MiddlewareContext = class extends Context {
1783
1791
  * Manages middleware execution, environment setup, and command invocation.
1784
1792
  */
1785
1793
  var AppCommandRunner = class {
1794
+ handler;
1786
1795
  /**
1787
1796
  * Creates a new AppCommandRunner instance.
1788
1797
  * @param handler - The app command handler instance to use for command execution
@@ -1803,7 +1812,7 @@ var AppCommandRunner = class {
1803
1812
  const executionMode = this.getExecutionMode(source);
1804
1813
  let runCommand = null;
1805
1814
  const env = new CommandKitEnvironment(commandkit);
1806
- env.setType(CommandKitEnvironmentType.CommandHandler);
1815
+ env.setType("COMMAND_HANDLER");
1807
1816
  env.variables.set("commandHandlerType", "app");
1808
1817
  env.variables.set("currentCommandName", prepared.command.data.command.__routeKey ?? prepared.command.command.name);
1809
1818
  env.variables.set("execHandlerKind", executionMode);
@@ -2025,6 +2034,7 @@ async function beforeExecute(ctx) {
2025
2034
  * Handles registration of Discord application commands (slash commands, context menus).
2026
2035
  */
2027
2036
  var CommandRegistrar = class {
2037
+ commandkit;
2028
2038
  /**
2029
2039
  * @private
2030
2040
  * @internal
@@ -2380,6 +2390,7 @@ const middlewareDataSchema = {
2380
2390
  * Manages both slash commands and message commands with middleware support.
2381
2391
  */
2382
2392
  var AppCommandHandler = class {
2393
+ commandkit;
2383
2394
  /**
2384
2395
  * @private
2385
2396
  * @internal
@@ -2459,7 +2470,9 @@ var AppCommandHandler = class {
2459
2470
  const children = node.childIds;
2460
2471
  children.forEach((childId, idx) => {
2461
2472
  const isLastChild = idx === children.length - 1;
2462
- printHierarchicalNode(childId, indent + (isLastChild ? "└─" : "├─"), indent + (isLastChild ? " " : "│ "));
2473
+ const childPrefix = indent + (isLastChild ? "└─" : "├─");
2474
+ const childIndent = indent + (isLastChild ? " " : "│ ");
2475
+ printHierarchicalNode(childId, childPrefix, childIndent);
2463
2476
  });
2464
2477
  };
2465
2478
  const categoryBuckets = {};
@@ -2525,14 +2538,17 @@ var AppCommandHandler = class {
2525
2538
  console.log(`${require_utils_colors.default.green(rootPrefix)} ${require_utils_colors.default.yellow(root.token)}${hasMw}`);
2526
2539
  root.childIds.forEach((childId, idx) => {
2527
2540
  const isLastChild = idx === root.childIds.length - 1;
2528
- printHierarchicalNode(childId, rootChildIndent + (isLastChild ? "└─" : "├─"), rootChildIndent + (isLastChild ? " " : "│ "));
2541
+ const childPrefix = rootChildIndent + (isLastChild ? "└─" : "├─");
2542
+ const childIndentNext = rootChildIndent + (isLastChild ? " " : "│ ");
2543
+ printHierarchicalNode(childId, childPrefix, childIndentNext);
2529
2544
  });
2530
2545
  entryIndex++;
2531
2546
  });
2532
2547
  if (hasChildren) {
2533
2548
  const children = categoryTree[category].sort();
2534
2549
  children.forEach((childCategory, idx) => {
2535
- printCategory(childCategory, childIndent, idx === children.length - 1, childIndent);
2550
+ const childIsLast = idx === children.length - 1;
2551
+ printCategory(childCategory, childIndent, childIsLast, childIndent);
2536
2552
  });
2537
2553
  }
2538
2554
  };
@@ -2549,7 +2565,8 @@ var AppCommandHandler = class {
2549
2565
  return true;
2550
2566
  }).sort();
2551
2567
  topLevelCategories.forEach((category, index) => {
2552
- printCategory(category, "", index === topLevelCategories.length - 1);
2568
+ const isLast = index === topLevelCategories.length - 1;
2569
+ printCategory(category, "", isLast);
2553
2570
  });
2554
2571
  }
2555
2572
  /**
@@ -2638,11 +2655,7 @@ var AppCommandHandler = class {
2638
2655
  if (getConfig().disablePrefixCommands && source instanceof discord_js.Message) return null;
2639
2656
  let parser;
2640
2657
  let routeKey;
2641
- let usedCommandOverride = false;
2642
- if (cmdName) {
2643
- routeKey = this.normalizeRouteKey(cmdName);
2644
- usedCommandOverride = true;
2645
- }
2658
+ if (cmdName) routeKey = this.normalizeRouteKey(cmdName);
2646
2659
  if (!routeKey) if (source instanceof discord_js.Message) {
2647
2660
  if (source.author.bot) return null;
2648
2661
  const prefix = await this.commandkit.appConfig.getMessageCommandPrefix(source);
@@ -2672,7 +2685,7 @@ var AppCommandHandler = class {
2672
2685
  routeKey = this.buildInteractionRouteKey(source);
2673
2686
  }
2674
2687
  const hint = require_app_commands_helpers.isInteractionSource(source) ? source.isUserContextMenuCommand() ? "user" : source.isMessageContextMenuCommand() ? "message" : void 0 : void 0;
2675
- const loadedCommand = hint ? this.findCommandByName(routeKey, hint) : this.findCommandByRoute(routeKey, usedCommandOverride);
2688
+ const loadedCommand = hint ? this.findCommandByName(routeKey, hint) : this.findCommandByRoute(routeKey);
2676
2689
  if (!loadedCommand) return null;
2677
2690
  if ((source instanceof discord_js.CommandInteraction || source instanceof discord_js.AutocompleteInteraction) && source.guildId && ((_loadedCommand$metada3 = loadedCommand.metadata) === null || _loadedCommand$metada3 === void 0 || (_loadedCommand$metada3 = _loadedCommand$metada3.guilds) === null || _loadedCommand$metada3 === void 0 ? void 0 : _loadedCommand$metada3.length) && !((_loadedCommand$metada4 = loadedCommand.metadata) === null || _loadedCommand$metada4 === void 0 ? void 0 : _loadedCommand$metada4.guilds.includes(source.guildId))) return null;
2678
2691
  if (source instanceof discord_js.Message) {
@@ -2756,9 +2769,14 @@ var AppCommandHandler = class {
2756
2769
  /**
2757
2770
  * Reloads all commands and middleware from scratch.
2758
2771
  */
2759
- async reloadCommands() {
2760
- var _this$commandkit$comm2;
2761
- await ((_this$commandkit$comm2 = this.commandkit.commandsRouter) === null || _this$commandkit$comm2 === void 0 ? void 0 : _this$commandkit$comm2.scan());
2772
+ async reloadCommands(path, changeType) {
2773
+ if (this.commandkit.config.experimental.incrementalRouter && path) {
2774
+ var _this$commandkit$comm2;
2775
+ await ((_this$commandkit$comm2 = this.commandkit.commandsRouter) === null || _this$commandkit$comm2 === void 0 ? void 0 : _this$commandkit$comm2.scanIncremental(path, changeType));
2776
+ } else {
2777
+ var _this$commandkit$comm3;
2778
+ await ((_this$commandkit$comm3 = this.commandkit.commandsRouter) === null || _this$commandkit$comm3 === void 0 ? void 0 : _this$commandkit$comm3.scan());
2779
+ }
2762
2780
  this.loadedCommands.clear();
2763
2781
  this.loadedMiddlewares.clear();
2764
2782
  this.runtimeRouteIndex.clear();
@@ -2826,7 +2844,7 @@ var AppCommandHandler = class {
2826
2844
  if (require_utils_constants.COMMANDKIT_IS_DEV) {
2827
2845
  const commandNames = Array.from(this.runtimeRouteIndex.keys());
2828
2846
  const aliases = Array.from(this.runtimeRouteIndex.values()).flatMap((v) => v.metadata.aliases || []);
2829
- await require_utils_types_package.rewriteCommandDeclaration(`type CommandTypeData = ${Array.from(new Set([...commandNames, ...aliases])).map((name) => JSON.stringify(name)).join(" | ")}`);
2847
+ await require_utils_types_package.rewriteCommandDeclaration(Array.from(/* @__PURE__ */ new Set([...commandNames, ...aliases])));
2830
2848
  }
2831
2849
  await this.commandkit.plugins.execute((ctx, plugin) => {
2832
2850
  return plugin.onAfterCommandsLoad(ctx);
@@ -2991,15 +3009,21 @@ var AppCommandHandler = class {
2991
3009
  const isRootHierarchyLeaf = node.kind === "command";
2992
3010
  const hasContextMenuHandlers = !!(commandFileData.userContextMenu || commandFileData.messageContextMenu);
2993
3011
  const hasExecutableSlashHandlers = !!(commandFileData.chatInput || commandFileData.message || commandFileData.autocomplete);
3012
+ const sanitizedCommandFileData = { ...commandFileData };
2994
3013
  if (!isRootHierarchyLeaf && hasContextMenuHandlers) throw new Error(`Invalid export for hierarchical node ${routeKey}: context menu handlers are only supported for top-level root commands.`);
2995
3014
  if (node.executable && handlerCount === 0) throw new Error(`Invalid export for hierarchical node ${routeKey}: executable leaves must provide at least one handler function`);
2996
- if (!node.executable && hasExecutableSlashHandlers) throw new Error(`Invalid export for hierarchical node ${routeKey}: non-leaf hierarchical nodes cannot export executable slash/prefix handlers`);
3015
+ if (!node.executable && hasExecutableSlashHandlers) {
3016
+ Logger.warn`Ignoring ${require_utils_colors.default.yellow("executable handlers")} exported by ${require_utils_colors.default.cyan("[non-leaf]")} hierarchical node ${require_utils_colors.default.magenta(`[${routeKey}]`)}. Move ${require_utils_colors.default.yellow("chatInput")}, ${require_utils_colors.default.yellow("message")}, or ${require_utils_colors.default.yellow("autocomplete")} handlers to a ${require_utils_colors.default.green("[leaf]")} command node.`;
3017
+ delete sanitizedCommandFileData.chatInput;
3018
+ delete sanitizedCommandFileData.message;
3019
+ delete sanitizedCommandFileData.autocomplete;
3020
+ }
2997
3021
  const loadedCommand = {
2998
3022
  discordId: null,
2999
3023
  command,
3000
3024
  metadata: resolvedMetadata,
3001
3025
  data: {
3002
- ...commandFileData,
3026
+ ...sanitizedCommandFileData,
3003
3027
  metadata: resolvedMetadata,
3004
3028
  command: {
3005
3029
  ...commandJson,
@@ -3102,6 +3126,7 @@ function setFlagProvider(provider) {
3102
3126
  * Class representing a feature flag in CommandKit.
3103
3127
  */
3104
3128
  var FeatureFlag = class {
3129
+ options;
3105
3130
  commandkit;
3106
3131
  /**
3107
3132
  * Create a new feature flag.
@@ -4269,6 +4294,7 @@ function Label(props) {
4269
4294
  * Handles Discord.js events and CommandKit custom events with support for namespacing and middleware.
4270
4295
  */
4271
4296
  var AppEventsHandler = class {
4297
+ commandkit;
4272
4298
  /**
4273
4299
  * @private
4274
4300
  * @internal
@@ -4298,8 +4324,19 @@ var AppEventsHandler = class {
4298
4324
  /**
4299
4325
  * Reloads all events by unregistering existing ones and loading them again.
4300
4326
  */
4301
- async reloadEvents() {
4327
+ async reloadEvents(path, changeType) {
4302
4328
  this.unregisterAll();
4329
+ if (this.commandkit.config.experimental.incrementalRouter && path) {
4330
+ await this.commandkit.plugins.execute((ctx, plugin) => {
4331
+ return plugin.onBeforeEventsLoad(ctx);
4332
+ });
4333
+ await this.commandkit.eventsRouter.scanIncremental(path, changeType);
4334
+ await this.loadEventsFromTree(this.commandkit.eventsRouter.toJSON());
4335
+ await this.commandkit.plugins.execute((ctx, plugin) => {
4336
+ return plugin.onAfterEventsLoad(ctx);
4337
+ });
4338
+ return;
4339
+ }
4303
4340
  await this.loadEvents();
4304
4341
  }
4305
4342
  /**
@@ -4310,6 +4347,17 @@ var AppEventsHandler = class {
4310
4347
  return plugin.onBeforeEventsLoad(ctx);
4311
4348
  });
4312
4349
  const events = await this.commandkit.eventsRouter.scan();
4350
+ await this.loadEventsFromTree(events);
4351
+ await this.commandkit.plugins.execute((ctx, plugin) => {
4352
+ return plugin.onAfterEventsLoad(ctx);
4353
+ });
4354
+ }
4355
+ /**
4356
+ * @private
4357
+ * @internal
4358
+ */
4359
+ async loadEventsFromTree(events) {
4360
+ this.loadedEvents.clear();
4313
4361
  for (const event of Object.values(events)) {
4314
4362
  const listeners = [];
4315
4363
  for (const listener of event.listeners) {
@@ -4336,9 +4384,6 @@ var AppEventsHandler = class {
4336
4384
  Logger.info(`✨ Loaded event ${event.event}${event.namespace ? ` of namespace ${event.namespace}` : ""} with ${len} listener${len === 1 ? "" : "s"}`);
4337
4385
  }
4338
4386
  this.registerAllClientEvents();
4339
- await this.commandkit.plugins.execute((ctx, plugin) => {
4340
- return plugin.onAfterEventsLoad(ctx);
4341
- });
4342
4387
  }
4343
4388
  /**
4344
4389
  * Unregisters all event listeners and clears loaded events.
@@ -4477,6 +4522,11 @@ var AppEventsHandler = class {
4477
4522
  once: false,
4478
4523
  parallel: false
4479
4524
  } : void 0,
4525
+ onceListener: onceListeners.length > 0 ? {
4526
+ handler: onceHandler,
4527
+ once: true,
4528
+ parallel: false
4529
+ } : void 0,
4480
4530
  executedOnceListeners
4481
4531
  });
4482
4532
  if (namespace) {
@@ -4494,11 +4544,11 @@ var AppEventsHandler = class {
4494
4544
  */
4495
4545
  unregisterAllClientListeners() {
4496
4546
  const client = this.commandkit.client;
4497
- for (const [key, { name, mainListener, namespace }] of this.loadedEvents.entries()) {
4547
+ for (const [key, { name, mainListener, onceListener, namespace }] of this.loadedEvents.entries()) {
4498
4548
  if (mainListener) if (namespace) this.commandkit.events.off(namespace, name, mainListener.handler);
4499
4549
  else client.off(name, mainListener.handler);
4500
- else if (namespace) this.commandkit.events.removeAllListeners(namespace, name);
4501
- else client.removeAllListeners(name);
4550
+ if (onceListener) if (namespace) this.commandkit.events.off(namespace, name, onceListener.handler);
4551
+ else client.off(name, onceListener.handler);
4502
4552
  this.loadedEvents.delete(key);
4503
4553
  Logger.info(`🗑️ Unregistered event ${name}${namespace ? ` of namespace ${namespace}` : ""}`);
4504
4554
  }
@@ -4554,8 +4604,9 @@ function registerDevHooks(commandkit) {
4554
4604
  if (!require_utils_constants.COMMANDKIT_IS_DEV) return;
4555
4605
  process.on("message", async (message) => {
4556
4606
  if (typeof message !== "object" || message === null) return;
4557
- const { event, path, id } = message;
4607
+ const { event, path: maybePath, id, changeType } = message;
4558
4608
  if (!event) return;
4609
+ const path = maybePath ?? "";
4559
4610
  if (process.env.COMMANDKIT_DEBUG_HMR === "true") Logger.info(`Received HMR event: ${event}${path ? ` for ${path}` : ""}`);
4560
4611
  let accepted = false, prevented = false, handled = false;
4561
4612
  const hmrEvent = {
@@ -4566,7 +4617,8 @@ function registerDevHooks(commandkit) {
4566
4617
  prevented = true;
4567
4618
  },
4568
4619
  path,
4569
- event
4620
+ event,
4621
+ changeType
4570
4622
  };
4571
4623
  try {
4572
4624
  await commandkit.plugins.execute(async (ctx, plugin) => {
@@ -4577,11 +4629,11 @@ function registerDevHooks(commandkit) {
4577
4629
  if (prevented) return;
4578
4630
  switch (event) {
4579
4631
  case require_utils_constants.HMREventType.ReloadCommands:
4580
- await commandkit.commandHandler.reloadCommands();
4632
+ await commandkit.commandHandler.reloadCommands(path, changeType);
4581
4633
  handled = true;
4582
4634
  break;
4583
4635
  case require_utils_constants.HMREventType.ReloadEvents:
4584
- await commandkit.eventHandler.reloadEvents();
4636
+ await commandkit.eventHandler.reloadEvents(path, changeType);
4585
4637
  handled = true;
4586
4638
  break;
4587
4639
  case require_utils_constants.HMREventType.Unknown:
@@ -4644,6 +4696,7 @@ function noAnalytics() {
4644
4696
  * This class allows you to register a provider, set a filter for events, and track or identify events.
4645
4697
  */
4646
4698
  var AnalyticsEngine = class {
4699
+ commandkit;
4647
4700
  #provider = null;
4648
4701
  #filter = null;
4649
4702
  /**
@@ -4763,6 +4816,7 @@ function onApplicationBootstrap(fn) {
4763
4816
  */
4764
4817
  var CommandKit = class CommandKit extends node_events.default {
4765
4818
  #started = false;
4819
+ #hydratedFromArtifact = false;
4766
4820
  #clientProxy = createProxy({});
4767
4821
  #client;
4768
4822
  /**
@@ -4967,11 +5021,35 @@ var CommandKit = class CommandKit extends node_events.default {
4967
5021
  await this.plugins.execute((ctx, plugin) => {
4968
5022
  return plugin.onEventsRouterInit(ctx);
4969
5023
  });
5024
+ this.#hydratedFromArtifact = await this.#hydrateRoutersFromArtifact();
4970
5025
  await this.#initEvents();
4971
5026
  await this.#initCommands();
4972
5027
  }
5028
+ async #hydrateRoutersFromArtifact() {
5029
+ if (require_utils_constants.COMMANDKIT_IS_DEV) return false;
5030
+ if (require_utils_constants.COMMANDKIT_BOOTSTRAP_MODE !== "production") return false;
5031
+ if (!this.config.experimental.pregenerateCommands) return false;
5032
+ const outputRoot = getCurrentDirectory();
5033
+ const artifactPath = (0, node_path.join)(outputRoot, require_app_router_TreeArtifact.ROUTER_TREE_ARTIFACT_DIRECTORY, require_app_router_TreeArtifact.ROUTER_TREE_ARTIFACT_FILE);
5034
+ if (!(0, node_fs.existsSync)(artifactPath)) return false;
5035
+ try {
5036
+ const json = await (0, node_fs_promises.readFile)(artifactPath, "utf8");
5037
+ const parsed = JSON.parse(json);
5038
+ if (!require_app_router_TreeArtifact.validateRouterTreeArtifact(parsed, "1.2.1-dev.20260920033200")) {
5039
+ Logger.warn(`Ignoring router tree artifact at ${artifactPath}: schema/version mismatch. Falling back to dynamic filesystem resolution.`);
5040
+ return false;
5041
+ }
5042
+ const hydrated = require_app_router_TreeArtifact.hydrateRouterTreeArtifact(parsed, outputRoot);
5043
+ this.commandsRouter.populate(hydrated.commands);
5044
+ this.eventsRouter.populate(hydrated.events);
5045
+ return true;
5046
+ } catch (error) {
5047
+ Logger.warn(`Failed to load router tree artifact at ${artifactPath}. Falling back to dynamic filesystem resolution. ${error}`);
5048
+ return false;
5049
+ }
5050
+ }
4973
5051
  async #initCommands() {
4974
- if (this.commandsRouter.isValidPath()) {
5052
+ if (!this.#hydratedFromArtifact && this.commandsRouter.isValidPath()) {
4975
5053
  const result = await this.commandsRouter.scan();
4976
5054
  if (require_utils_constants.COMMANDKIT_IS_DEV) (0, node_fs.writeFileSync)("./.commandkit/commands.json", JSON.stringify(result, null, 2));
4977
5055
  }
@@ -4979,7 +5057,7 @@ var CommandKit = class CommandKit extends node_events.default {
4979
5057
  this.commandHandler.printBanner();
4980
5058
  }
4981
5059
  async #initEvents() {
4982
- if (this.eventsRouter.isValidPath()) await this.eventsRouter.scan();
5060
+ if (!this.#hydratedFromArtifact && this.eventsRouter.isValidPath()) await this.eventsRouter.scan();
4983
5061
  await this.eventHandler.loadEvents();
4984
5062
  }
4985
5063
  /**
@@ -5588,4 +5666,4 @@ Object.defineProperty(exports, 'useStore', {
5588
5666
  return useStore;
5589
5667
  }
5590
5668
  });
5591
- //# sourceMappingURL=commandkit-DTqT800J.js.map
5669
+ //# sourceMappingURL=commandkit-gJ4YjTy4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commandkit-gJ4YjTy4.js","names":[],"sources":[],"mappings":""}
@@ -1,2 +1,2 @@
1
- import { c as CommandKitConfiguration, d as onBootstrap, l as commandkit, o as BootstrapFunction, s as CommandKit, u as onApplicationBootstrap } from "./analytics-engine-BYA0ongA.js";
1
+ import { c as CommandKitConfiguration, d as onBootstrap, l as commandkit, o as BootstrapFunction, s as CommandKit, u as onApplicationBootstrap } from "./analytics-engine-Bz1p7ud3.js";
2
2
  export { BootstrapFunction, CommandKit, CommandKitConfiguration, commandkit, onApplicationBootstrap, onBootstrap };
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_commandkit = require('./commandkit-DTqT800J.js');
2
+ const require_commandkit = require('./commandkit-gJ4YjTy4.js');
3
3
 
4
4
  exports.CommandKit = require_commandkit.CommandKit;
5
5
  exports.commandkit = require_commandkit.commandkit;
@@ -1,6 +1,5 @@
1
- import { n as EventInterceptorContextData } from "./EventInterceptor-D9JKMcfi.js";
1
+ import { n as EventInterceptorContextData } from "./EventInterceptor-wg378vJp.js";
2
2
  import { Awaitable, Events } from "discord.js";
3
-
4
3
  //#region src/components/interactive/select-menu/common.d.ts
5
4
  /**
6
5
  * The predicate function that filters select menu interactions.
@@ -26,4 +25,4 @@ type CommandKitSelectMenuBuilderOnEnd = (reason: string) => Awaitable<void>;
26
25
  type CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData = EventInterceptorContextData<Events.InteractionCreate>;
27
26
  //#endregion
28
27
  export { OnSelectMenuKitSubmit as a, OnSelectMenuKitEnd as i, CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData as n, SelectMenuKitPredicate as o, CommandKitSelectMenuBuilderOnEnd as r, CommandKitSelectMenuBuilderInteractionCollectorDispatch as t };
29
- //# sourceMappingURL=common-CCvvgnxi.d.ts.map
28
+ //# sourceMappingURL=common-CIbPzguv.d.ts.map
@@ -1,2 +1,2 @@
1
- import { n as EventInterceptorContextData, r as EventInterceptorErrorHandler, t as EventInterceptor } from "../../EventInterceptor-D9JKMcfi.js";
1
+ import { n as EventInterceptorContextData, r as EventInterceptorErrorHandler, t as EventInterceptor } from "../../EventInterceptor-wg378vJp.js";
2
2
  export { EventInterceptor, EventInterceptorContextData, EventInterceptorErrorHandler };
@@ -6,6 +6,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
6
6
  * It also supports automatic cleanup of expired subscriptions.
7
7
  */
8
8
  var EventInterceptor = class {
9
+ client;
9
10
  subscribers = /* @__PURE__ */ new Map();
10
11
  globalHandlers = /* @__PURE__ */ new Map();
11
12
  cleanupTimer = null;