commandkit 1.0.0-dev.20250514140214 → 1.0.0-dev.20250515152130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as discord_js from 'discord.js';
2
- import { RESTPostAPIApplicationCommandsJSONBody, Client, Interaction, CacheType, ClientEvents, Awaitable, ButtonBuilder, ButtonInteraction, Events, ModalBuilder, ModalSubmitInteraction, ActionRowBuilder, TextInputBuilder, ButtonStyle, ComponentEmojiResolvable, TextInputStyle, StringSelectMenuInteraction, StringSelectMenuBuilder, ChannelSelectMenuInteraction, ChannelSelectMenuBuilder, MentionableSelectMenuInteraction, MentionableSelectMenuBuilder, UserSelectMenuInteraction, UserSelectMenuBuilder, RoleSelectMenuInteraction, RoleSelectMenuBuilder, BaseSelectMenuComponentData, StringSelectMenuOptionBuilder, SelectMenuComponentOptionData, APISelectMenuOption, UserSelectMenuComponentData, RoleSelectMenuComponentData, MentionableSelectMenuComponentData, ChannelSelectMenuComponentData, ContainerComponentData, ComponentBuilder, ContainerBuilder, FileComponentData, FileBuilder, MediaGalleryItemBuilder, MediaGalleryBuilder, ThumbnailBuilder, TextDisplayBuilder, SectionBuilder, SeparatorComponentData, SeparatorBuilder, TextDisplayComponentData, Message as Message$1, ApplicationCommandOptionType, GuildMember, Attachment, User, Role, CommandInteractionOption, ChatInputCommandInteraction, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, AutocompleteInteraction, Guild, TextBasedChannel, Locale, Collection, SlashCommandBuilder, ContextMenuCommandBuilder } from 'discord.js';
2
+ import { RESTPostAPIApplicationCommandsJSONBody, Client, Interaction, CacheType, ClientEvents, Awaitable, ButtonBuilder, ButtonInteraction, Events, ModalBuilder, ModalSubmitInteraction, ActionRowBuilder, TextInputBuilder, ButtonStyle, ComponentEmojiResolvable, TextInputStyle, StringSelectMenuInteraction, StringSelectMenuBuilder, ChannelSelectMenuInteraction, ChannelSelectMenuBuilder, MentionableSelectMenuInteraction, MentionableSelectMenuBuilder, UserSelectMenuInteraction, UserSelectMenuBuilder, RoleSelectMenuInteraction, RoleSelectMenuBuilder, BaseSelectMenuComponentData, StringSelectMenuOptionBuilder, SelectMenuComponentOptionData, APISelectMenuOption, UserSelectMenuComponentData, RoleSelectMenuComponentData, MentionableSelectMenuComponentData, ChannelSelectMenuComponentData, ContainerComponentData, ComponentBuilder, ContainerBuilder, FileComponentData, FileBuilder, MediaGalleryItemBuilder, MediaGalleryBuilder, ThumbnailBuilder, TextDisplayBuilder, SectionBuilder, SeparatorComponentData, SeparatorBuilder, TextDisplayComponentData, Message as Message$1, ApplicationCommandOptionType, GuildMember, Attachment, User, Role, CommandInteractionOption, ChatInputCommandInteraction, MessageContextMenuCommandInteraction, UserContextMenuCommandInteraction, AutocompleteInteraction, Guild, TextBasedChannel, Locale, Collection, SlashCommandBuilder, ContextMenuCommandBuilder, ContextMenuCommandInteraction } from 'discord.js';
3
3
  import EventEmitter from 'node:events';
4
4
  import { Channel } from 'diagnostics_channel';
5
5
  import { DirectiveTransformerOptions } from 'directive-to-hof';
@@ -1657,6 +1657,61 @@ declare class CommandKitPluginRuntime {
1657
1657
  execute<R = any>(f: AsyncFunction<[CommandKitPluginRuntime, RuntimePlugin], R | undefined>): Promise<true | R | undefined>;
1658
1658
  }
1659
1659
 
1660
+ type MaybePromise<T> = T | Promise<T>;
1661
+ type IdentifyFunction<R> = (context: EvaluationContext) => MaybePromise<R>;
1662
+ type DecideFunction<E, R> = (data: {
1663
+ entities: E;
1664
+ }) => MaybePromise<R>;
1665
+ interface FeatureFlagDefinition<R, Entity> {
1666
+ key: string;
1667
+ description?: string;
1668
+ identify?: IdentifyFunction<Entity>;
1669
+ decide: DecideFunction<Entity, R>;
1670
+ }
1671
+ interface CommandFlagContext {
1672
+ client: Client<true>;
1673
+ commandkit: CommandKit;
1674
+ command: {
1675
+ interaction?: ChatInputCommandInteraction | AutocompleteInteraction | ContextMenuCommandInteraction;
1676
+ message?: Message$1;
1677
+ guild: Guild | null;
1678
+ channel: TextBasedChannel | null;
1679
+ command: LoadedCommand;
1680
+ };
1681
+ event: null;
1682
+ }
1683
+ interface EventFlagContext {
1684
+ client: Client<true>;
1685
+ commandkit: CommandKit;
1686
+ event: {
1687
+ data: ParsedEvent;
1688
+ event: string;
1689
+ namespace: string | null;
1690
+ arguments: any[];
1691
+ argumentsAs<E extends keyof ClientEvents>(event: E): ClientEvents[E];
1692
+ };
1693
+ command: null;
1694
+ }
1695
+ type EvaluationContext = CommandFlagContext | EventFlagContext;
1696
+ type CustomEvaluationFunction<E> = () => MaybePromise<E>;
1697
+ type CustomEvaluationContext<E> = {
1698
+ identify: E | CustomEvaluationFunction<E>;
1699
+ };
1700
+ interface FlagRunner<E, R> {
1701
+ (): Promise<R>;
1702
+ run(context: CustomEvaluationContext<E>): Promise<R>;
1703
+ }
1704
+ declare class FeatureFlag<R, T> {
1705
+ private options;
1706
+ constructor(options: FeatureFlagDefinition<R, T>);
1707
+ private getContext;
1708
+ execute(res?: T): Promise<R>;
1709
+ }
1710
+ declare function flag<Returns = boolean, Entity = Record<any, any>>(options: FeatureFlagDefinition<Returns, Entity>): FlagRunner<Entity, Returns>;
1711
+
1712
+ declare class FlagStore extends Collection<string, FeatureFlag<any, any>> {
1713
+ }
1714
+
1660
1715
  interface CommandKitConfiguration {
1661
1716
  defaultLocale: Locale;
1662
1717
  getMessageCommandPrefix: (message: Message$1) => Awaitable<string | string[]>;
@@ -1699,6 +1754,7 @@ declare class CommandKit extends EventEmitter {
1699
1754
  static readonly Fragment: typeof Fragment;
1700
1755
  readonly config: CommandKitConfiguration;
1701
1756
  readonly store: Map<string, any>;
1757
+ readonly flags: FlagStore;
1702
1758
  commandsRouter: CommandsRouter;
1703
1759
  eventsRouter: EventsRouter;
1704
1760
  readonly commandHandler: AppCommandHandler;
@@ -1937,6 +1993,7 @@ interface EventWorkerContext {
1937
1993
  namespace: string | null;
1938
1994
  data: ParsedEvent;
1939
1995
  commandkit: CommandKit;
1996
+ arguments: any[];
1940
1997
  }
1941
1998
  declare const eventWorkerContext: AsyncLocalStorage<EventWorkerContext>;
1942
1999
  declare function runInEventWorkerContext<T>(context: EventWorkerContext, callback: () => T): T;
@@ -1949,4 +2006,4 @@ declare function getEventWorkerContext(): EventWorkerContext;
1949
2006
  */
1950
2007
  declare function bootstrapCommandkitCLI(argv: string[], options?: commander.ParseOptions | undefined): Promise<void>;
1951
2008
 
1952
- export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type BootstrapFunction, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, COMMANDKIT_BOOTSTRAP_MODE, COMMANDKIT_CACHE_TAG, COMMANDKIT_IS_DEV, COMMANDKIT_IS_TEST, ChannelSelectMenu, ChannelSelectMenuKit, type ChannelSelectMenuKitPredicate, type ChannelSelectMenuProps, type ChatInputCommand, type ChatInputCommandContext, type Command, type CommandBuilderLike, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitHMREvent, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandKitPlugin, CommandKitPluginRuntime, type CommandKitSelectMenuBuilderInteractionCollectorDispatch, type CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, type CommandKitSelectMenuBuilderOnEnd, CommandRegistrar, type CommandSource, type CommandTypeData, CommandsRouter, type CommandsRouterOptions, type CommonBuilderKit, CommonDirectiveTransformer, type CommonDirectiveTransformerOptions, type CommonPluginRuntime, type CommonSelectMenuProps, CompilerPlugin, CompilerPluginRuntime, Container, type ContainerProps, Context, type ContextParameters, DefaultLogger, ElementType, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, type EventWorkerContext, EventsRouter, type EventsRouterOptions, type EventsTree, File, type FileProps, Fragment, type FragmentElementProps, type GenericFunction, HMREventType, type ILogger, type InteractionCommandContext, type InteractionCommandMiddlewareContext, type LoadedCommand, type Loader, type Location, Logger, type LoggerImpl, type MaybeArray, type MaybeFalsey, MediaGallery, MediaGalleryItem, type MediaGalleryItemProps, type MediaGalleryProps, MentionableSelectMenu, MentionableSelectMenuKit, type MentionableSelectMenuKitPredicate, type MentionableSelectMenuProps, type Message, type MessageCommand, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommand, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type Middleware, MiddlewareContext, type MiddlewareContextArgs, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnChannelSelectMenuKitSubmit, type OnLoadArgs, type OnLoadOptions, type OnLoadResult, type OnMentionableSelectMenuKitSubmit, type OnModalKitEnd, type OnModalKitSubmit, type OnResolveArgs, type OnResolveOptions, type OnResolveResult, type OnRoleSelectMenuKitSubmit, type OnSelectMenuKitEnd, type OnSelectMenuKitSubmit, type OnStringSelectMenuKitSubmit, type OnUserSelectMenuKitSubmit, ParagraphInput, type ParsedCommandData, type ParsedEvent, type ParsedMessageCommand, type PluginTransformParameters, type PreRegisterCommandsEvent, type PreparedAppCommandExecution, type ResolvableCommand, type ResolveBuilderInteraction, type ResolveKind, type ResolveResult, RoleSelectMenu, RoleSelectMenuKit, type RoleSelectMenuKitPredicate, type RoleSelectMenuProps, type RunCommand, RuntimePlugin, Section, type SectionProps, type SelectMenuKitPredicate, type SelectMenuProps, Separator, type SeparatorProps, type Setup, ShortInput, type SlashCommandMiddlewareContext, StopEventPropagationError, StringSelectMenu, StringSelectMenuKit, type StringSelectMenuKitPredicate, StringSelectMenuOption, type StringSelectMenuOptionProps, type StringSelectMenuProps, TextDisplay, type TextDisplayProps, TextInput, type TextInputProps, Thumbnail, type ThumbnailProps, type TransformedResult, type UserContextMenuCommand, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, UserSelectMenu, UserSelectMenuKit, type UserSelectMenuKitPredicate, type UserSelectMenuProps, after, bootstrapCommandkitCLI, cancelAfter, commandkit, createElement, createLogger, debounce, CommandKit as default, defineConfig, devOnly, eventWorkerContext, exitContext, exitMiddleware, fromEsbuildPlugin, getCommandKit, getConfig, getContext, getCurrentDirectory, getElement, getEventWorkerContext, getSourceDirectories, isCommandKitElement, isCompilerPlugin, isInteractionSource, isMessageSource, isRuntimePlugin, createElement as jsx, createElement as jsxs, makeContextAwareFunction, onApplicationBootstrap, onBootstrap, provideContext, redirect, rethrow, runInEventWorkerContext, stopEvents, useEnvironment, version };
2009
+ export { ActionRow, type ActionRowProps, type AnyCommandExecute, type AnyCommandKitElement, AppCommandHandler, type AsyncFunction, type AutocompleteCommand, type AutocompleteCommandContext, type AutocompleteCommandMiddlewareContext, type BootstrapFunction, Button, type ButtonChildrenLike, ButtonKit, type ButtonKitPredicate, type ButtonProps, COMMANDKIT_BOOTSTRAP_MODE, COMMANDKIT_CACHE_TAG, COMMANDKIT_IS_DEV, COMMANDKIT_IS_TEST, ChannelSelectMenu, ChannelSelectMenuKit, type ChannelSelectMenuKitPredicate, type ChannelSelectMenuProps, type ChatInputCommand, type ChatInputCommandContext, type Command, type CommandBuilderLike, type CommandContext, type CommandContextOptions, type CommandData, CommandExecutionMode, type CommandFlagContext, CommandKit, type CommandKitButtonBuilderInteractionCollectorDispatch, type CommandKitButtonBuilderInteractionCollectorDispatchContextData, type CommandKitButtonBuilderOnEnd, type CommandKitConfiguration, type CommandKitElement, type CommandKitElementData, CommandKitEnvironment, type CommandKitEnvironmentInternalData, CommandKitEnvironmentType, type CommandKitHMREvent, type CommandKitLoggerOptions, type CommandKitModalBuilderInteractionCollectorDispatch, type CommandKitModalBuilderInteractionCollectorDispatchContextData, type CommandKitModalBuilderOnEnd, type CommandKitOptions, type CommandKitPlugin, CommandKitPluginRuntime, type CommandKitSelectMenuBuilderInteractionCollectorDispatch, type CommandKitSelectMenuBuilderInteractionCollectorDispatchContextData, type CommandKitSelectMenuBuilderOnEnd, CommandRegistrar, type CommandSource, type CommandTypeData, CommandsRouter, type CommandsRouterOptions, type CommonBuilderKit, CommonDirectiveTransformer, type CommonDirectiveTransformerOptions, type CommonPluginRuntime, type CommonSelectMenuProps, CompilerPlugin, CompilerPluginRuntime, Container, type ContainerProps, Context, type ContextParameters, type CustomEvaluationContext, type CustomEvaluationFunction, type DecideFunction, DefaultLogger, ElementType, type EvaluationContext, type EventFlagContext, EventInterceptor, type EventInterceptorContextData, type EventInterceptorErrorHandler, type EventWorkerContext, EventsRouter, type EventsRouterOptions, type EventsTree, FeatureFlag, type FeatureFlagDefinition, File, type FileProps, type FlagRunner, Fragment, type FragmentElementProps, type GenericFunction, HMREventType, type ILogger, type IdentifyFunction, type InteractionCommandContext, type InteractionCommandMiddlewareContext, type LoadedCommand, type Loader, type Location, Logger, type LoggerImpl, type MaybeArray, type MaybeFalsey, type MaybePromise, MediaGallery, MediaGalleryItem, type MediaGalleryItemProps, type MediaGalleryProps, MentionableSelectMenu, MentionableSelectMenuKit, type MentionableSelectMenuKitPredicate, type MentionableSelectMenuProps, type Message, type MessageCommand, type MessageCommandContext, type MessageCommandMiddlewareContext, MessageCommandOptions, type MessageCommandOptionsSchema, MessageCommandParser, type MessageContextMenuCommand, type MessageContextMenuCommandContext, type MessageContextMenuCommandMiddlewareContext, type Middleware, MiddlewareContext, type MiddlewareContextArgs, Modal, ModalKit, type ModalKitPredicate, type ModalProps, type OnButtonKitClick, type OnButtonKitEnd, type OnChannelSelectMenuKitSubmit, type OnLoadArgs, type OnLoadOptions, type OnLoadResult, type OnMentionableSelectMenuKitSubmit, type OnModalKitEnd, type OnModalKitSubmit, type OnResolveArgs, type OnResolveOptions, type OnResolveResult, type OnRoleSelectMenuKitSubmit, type OnSelectMenuKitEnd, type OnSelectMenuKitSubmit, type OnStringSelectMenuKitSubmit, type OnUserSelectMenuKitSubmit, ParagraphInput, type ParsedCommandData, type ParsedEvent, type ParsedMessageCommand, type PluginTransformParameters, type PreRegisterCommandsEvent, type PreparedAppCommandExecution, type ResolvableCommand, type ResolveBuilderInteraction, type ResolveKind, type ResolveResult, RoleSelectMenu, RoleSelectMenuKit, type RoleSelectMenuKitPredicate, type RoleSelectMenuProps, type RunCommand, RuntimePlugin, Section, type SectionProps, type SelectMenuKitPredicate, type SelectMenuProps, Separator, type SeparatorProps, type Setup, ShortInput, type SlashCommandMiddlewareContext, StopEventPropagationError, StringSelectMenu, StringSelectMenuKit, type StringSelectMenuKitPredicate, StringSelectMenuOption, type StringSelectMenuOptionProps, type StringSelectMenuProps, TextDisplay, type TextDisplayProps, TextInput, type TextInputProps, Thumbnail, type ThumbnailProps, type TransformedResult, type UserContextMenuCommand, type UserContextMenuCommandContext, type UserContextMenuCommandMiddlewareContext, UserSelectMenu, UserSelectMenuKit, type UserSelectMenuKitPredicate, type UserSelectMenuProps, after, bootstrapCommandkitCLI, cancelAfter, commandkit, createElement, createLogger, debounce, CommandKit as default, defineConfig, devOnly, eventWorkerContext, exitContext, exitMiddleware, flag, fromEsbuildPlugin, getCommandKit, getConfig, getContext, getCurrentDirectory, getElement, getEventWorkerContext, getSourceDirectories, isCommandKitElement, isCompilerPlugin, isInteractionSource, isMessageSource, isRuntimePlugin, createElement as jsx, createElement as jsxs, makeContextAwareFunction, onApplicationBootstrap, onBootstrap, provideContext, redirect, rethrow, runInEventWorkerContext, stopEvents, useEnvironment, version };
package/dist/index.js CHANGED
@@ -4924,7 +4924,8 @@ var init_AppEventsHandler = __esm({
4924
4924
  event: name,
4925
4925
  namespace: namespace ?? null,
4926
4926
  data: data.event,
4927
- commandkit: this.commandkit
4927
+ commandkit: this.commandkit,
4928
+ arguments: args
4928
4929
  },
4929
4930
  async () => {
4930
4931
  for (const listener of onListeners) {
@@ -4955,7 +4956,8 @@ var init_AppEventsHandler = __esm({
4955
4956
  event: name,
4956
4957
  namespace: namespace ?? null,
4957
4958
  data: data.event,
4958
- commandkit: this.commandkit
4959
+ commandkit: this.commandkit,
4960
+ arguments: args
4959
4961
  },
4960
4962
  async () => {
4961
4963
  try {
@@ -5339,6 +5341,20 @@ var init_CommandKitEventsChannel = __esm({
5339
5341
  }
5340
5342
  });
5341
5343
 
5344
+ // src/flags/store.ts
5345
+ var import_discord26, _FlagStore, FlagStore;
5346
+ var init_store = __esm({
5347
+ "src/flags/store.ts"() {
5348
+ "use strict";
5349
+ init_cjs_shims();
5350
+ import_discord26 = require("discord.js");
5351
+ _FlagStore = class _FlagStore extends import_discord26.Collection {
5352
+ };
5353
+ __name(_FlagStore, "FlagStore");
5354
+ FlagStore = _FlagStore;
5355
+ }
5356
+ });
5357
+
5342
5358
  // src/CommandKit.ts
5343
5359
  function onBootstrap(fn) {
5344
5360
  bootstrapHooks.add(fn);
@@ -5346,7 +5362,7 @@ function onBootstrap(fn) {
5346
5362
  function onApplicationBootstrap(fn) {
5347
5363
  onApplicationBootstrapHooks.add(fn);
5348
5364
  }
5349
- var import_node_events2, import_discord26, import_node_path7, import_node_fs7, commandkit, bootstrapHooks, onApplicationBootstrapHooks, _started, _CommandKit_instances, bootstrapHooks_fn, applicationBootstrapHooks_fn, init_fn, initCommands_fn, initEvents_fn, _CommandKit, CommandKit;
5365
+ var import_node_events2, import_discord27, import_node_path7, import_node_fs7, commandkit, bootstrapHooks, onApplicationBootstrapHooks, _started, _CommandKit_instances, bootstrapHooks_fn, applicationBootstrapHooks_fn, init_fn, initCommands_fn, initEvents_fn, _CommandKit, CommandKit;
5350
5366
  var init_CommandKit = __esm({
5351
5367
  "src/CommandKit.ts"() {
5352
5368
  "use strict";
@@ -5355,7 +5371,7 @@ var init_CommandKit = __esm({
5355
5371
  init_colors();
5356
5372
  init_components();
5357
5373
  init_EventInterceptor();
5358
- import_discord26 = require("discord.js");
5374
+ import_discord27 = require("discord.js");
5359
5375
  init_utilities();
5360
5376
  import_node_path7 = require("path");
5361
5377
  init_AppCommandHandler();
@@ -5370,6 +5386,7 @@ var init_CommandKit = __esm({
5370
5386
  init_plugins();
5371
5387
  init_types_package();
5372
5388
  init_Logger();
5389
+ init_store();
5373
5390
  bootstrapHooks = /* @__PURE__ */ new Set();
5374
5391
  onApplicationBootstrapHooks = /* @__PURE__ */ new Set();
5375
5392
  __name(onBootstrap, "onBootstrap");
@@ -5401,10 +5418,11 @@ var init_CommandKit = __esm({
5401
5418
  __privateAdd(this, _started, false);
5402
5419
  __publicField(this, "eventInterceptor");
5403
5420
  __publicField(this, "config", {
5404
- defaultLocale: import_discord26.Locale.EnglishUS,
5421
+ defaultLocale: import_discord27.Locale.EnglishUS,
5405
5422
  getMessageCommandPrefix: /* @__PURE__ */ __name(() => "!", "getMessageCommandPrefix")
5406
5423
  });
5407
5424
  __publicField(this, "store", /* @__PURE__ */ new Map());
5425
+ __publicField(this, "flags", new FlagStore());
5408
5426
  __publicField(this, "commandsRouter");
5409
5427
  __publicField(this, "eventsRouter");
5410
5428
  __publicField(this, "commandHandler", new AppCommandHandler(this));
@@ -5445,7 +5463,7 @@ var init_CommandKit = __esm({
5445
5463
  this.commandHandler.registerCommandHandler();
5446
5464
  this.incrementClientListenersCount();
5447
5465
  if (token !== false && !this.options.client.isReady()) {
5448
- this.client.once(import_discord26.Events.ClientReady, async () => {
5466
+ this.client.once(import_discord27.Events.ClientReady, async () => {
5449
5467
  await this.commandHandler.registrar.register();
5450
5468
  });
5451
5469
  await this.plugins.execute((ctx, plugin) => {
@@ -5637,7 +5655,7 @@ var init_version = __esm({
5637
5655
  "use strict";
5638
5656
  init_cjs_shims();
5639
5657
  version = /* @__MACRO__ $version */
5640
- "1.0.0-dev.20250514140214";
5658
+ "1.0.0-dev.20250515152130";
5641
5659
  }
5642
5660
  });
5643
5661
 
@@ -5908,9 +5926,9 @@ ${wrapInAsyncIIFE([envScript(isDev), antiCrashScript, requireScript])}
5908
5926
  ` : wrapInAsyncIIFE([envScript(isDev), requireScript])}
5909
5927
 
5910
5928
  import { CommandKit } from 'commandkit';
5911
- import app from './app.js';
5912
5929
 
5913
5930
  async function bootstrap() {
5931
+ const app = await import('./app.js').then((m) => m.default ?? m);
5914
5932
  const commandkit = new CommandKit({
5915
5933
  client: app,
5916
5934
  });
@@ -6541,6 +6559,7 @@ __export(index_exports, {
6541
6559
  ElementType: () => ElementType,
6542
6560
  EventInterceptor: () => EventInterceptor,
6543
6561
  EventsRouter: () => EventsRouter,
6562
+ FeatureFlag: () => FeatureFlag,
6544
6563
  File: () => File,
6545
6564
  Fragment: () => Fragment,
6546
6565
  HMREventType: () => HMREventType,
@@ -6583,6 +6602,7 @@ __export(index_exports, {
6583
6602
  eventWorkerContext: () => eventWorkerContext,
6584
6603
  exitContext: () => exitContext,
6585
6604
  exitMiddleware: () => exitMiddleware,
6605
+ flag: () => flag,
6586
6606
  fromEsbuildPlugin: () => fromEsbuildPlugin,
6587
6607
  getCommandKit: () => getCommandKit,
6588
6608
  getConfig: () => getConfig,
@@ -6628,9 +6648,9 @@ init_CommandRegistrar();
6628
6648
 
6629
6649
  // src/app/commands/helpers.ts
6630
6650
  init_cjs_shims();
6631
- var import_discord27 = require("discord.js");
6651
+ var import_discord28 = require("discord.js");
6632
6652
  function isMessageSource(source) {
6633
- return source instanceof import_discord27.Message;
6653
+ return source instanceof import_discord28.Message;
6634
6654
  }
6635
6655
  __name(isMessageSource, "isMessageSource");
6636
6656
  function isInteractionSource(source) {
@@ -6649,6 +6669,100 @@ init_Logger();
6649
6669
  init_router();
6650
6670
  init_version();
6651
6671
  init_plugins();
6672
+
6673
+ // src/flags/feature-flags.ts
6674
+ init_cjs_shims();
6675
+ init_async_context();
6676
+ init_EventWorkerContext();
6677
+ var _FeatureFlag = class _FeatureFlag {
6678
+ constructor(options) {
6679
+ this.options = options;
6680
+ const FlagStore2 = getCommandKit(true).flags;
6681
+ if (FlagStore2.has(options.key)) {
6682
+ throw new Error(`Feature flag with key "${options.key}" already exists.`);
6683
+ }
6684
+ FlagStore2.set(options.key, this);
6685
+ }
6686
+ getContext() {
6687
+ const env = getContext();
6688
+ if (env == null ? void 0 : env.context) {
6689
+ const {
6690
+ client,
6691
+ commandkit: commandkit2,
6692
+ interaction,
6693
+ message,
6694
+ guild,
6695
+ channel,
6696
+ command
6697
+ } = env.context;
6698
+ return {
6699
+ client,
6700
+ commandkit: commandkit2,
6701
+ command: {
6702
+ interaction,
6703
+ message,
6704
+ guild,
6705
+ channel,
6706
+ command
6707
+ },
6708
+ event: null
6709
+ };
6710
+ }
6711
+ const eventCtx = eventWorkerContext.getStore();
6712
+ if (eventCtx) {
6713
+ const { commandkit: commandkit2, data, event, namespace } = eventCtx;
6714
+ return {
6715
+ client: commandkit2.client,
6716
+ commandkit: commandkit2,
6717
+ event: {
6718
+ data,
6719
+ event,
6720
+ namespace,
6721
+ arguments: eventCtx.arguments,
6722
+ argumentsAs: /* @__PURE__ */ __name((eventName) => {
6723
+ const args = eventCtx.arguments;
6724
+ return args;
6725
+ }, "argumentsAs")
6726
+ },
6727
+ command: null
6728
+ };
6729
+ }
6730
+ throw new Error(
6731
+ "Could not determine the execution context. Feature flags may only be used inside a command or event."
6732
+ );
6733
+ }
6734
+ async execute(res) {
6735
+ const { decide, identify } = this.options;
6736
+ const entities = res ?? await (async () => {
6737
+ const ctx = this.getContext();
6738
+ return await (identify == null ? void 0 : identify(ctx)) ?? {};
6739
+ })();
6740
+ const decisionResult = await decide({
6741
+ entities
6742
+ });
6743
+ return decisionResult;
6744
+ }
6745
+ };
6746
+ __name(_FeatureFlag, "FeatureFlag");
6747
+ var FeatureFlag = _FeatureFlag;
6748
+ function flag(options) {
6749
+ const flag2 = new FeatureFlag(options);
6750
+ const runner = flag2.execute.bind(flag2, void 0);
6751
+ runner.run = async function(ctx) {
6752
+ if (!(ctx == null ? void 0 : ctx.identify)) {
6753
+ throw new Error(
6754
+ "Custom evaluation context must have an identify function or object."
6755
+ );
6756
+ }
6757
+ const context2 = typeof ctx === "function" ? await ctx() : ctx;
6758
+ const decisionResult = await flag2.execute(context2);
6759
+ return decisionResult;
6760
+ };
6761
+ return runner;
6762
+ }
6763
+ __name(flag, "flag");
6764
+
6765
+ // src/index.ts
6652
6766
  init_utilities();
6653
6767
  init_constants();
6654
6768
  init_EventWorkerContext();
@@ -6741,6 +6855,7 @@ var index_default = CommandKit;
6741
6855
  ElementType,
6742
6856
  EventInterceptor,
6743
6857
  EventsRouter,
6858
+ FeatureFlag,
6744
6859
  File,
6745
6860
  Fragment,
6746
6861
  HMREventType,
@@ -6782,6 +6897,7 @@ var index_default = CommandKit;
6782
6897
  eventWorkerContext,
6783
6898
  exitContext,
6784
6899
  exitMiddleware,
6900
+ flag,
6785
6901
  fromEsbuildPlugin,
6786
6902
  getCommandKit,
6787
6903
  getConfig,