@wolfstar/plugin-subcommands-advanced 2.0.0 → 2.0.2-next-20260830110414
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-BuJfV_kf.d.ts","names":[],"sources":["../../src/lib/utils/types.ts","../../src/lib/structures/command.ts","../../src/lib/utils/decorators.ts","../../src/lib/utils/functions.ts","../../src/lib/utils/hooks.ts","../../src/lib/utils/strategy.ts","../../src/lib/utils/wiring.ts","../../src/index.ts"],"mappings":";;;;;;;;KAOY,4BACR;EACE,UAAU,KAAK;IACjB,KAAK,mEAEH,SAAS,+BACT,kBAAkB,cACf;;;;UAKQ;;;;EAIf;;;;EAIA,iBAAiB;;;;;UAMF;;;;EAIf;;;;EAIA;;;;EAIA,iBAAiB;;;;;UAMF;EACf,qBAAqB;EACrB,4BAA4B;;;;;UAMb;EACf,cAAc;EACd,cAAc;EACd;;;;;UAMe;;;;;;;EAOf;;;;KClEU,yBAAyB,QAAiB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;cA2BnD,UACX,gBAAgB,yBAAyB,gCACjC,QAAiB;EACN,YAAA,SAAS,QAAiB,eAAe,UAAS;;kBA8BtD;OACH,UAAU;OACV,OAAO,QAAiB;;OAExB,UAAU;OACV,gBAAgB,QAAiB;OACjC,uBAAuB,QAAiB;OACxC,0BAA0B,QAAiB;OAC3C,gCAAgC,QAAiB;OACjD,WAAW,QAAiB;;;;;;;;;;;;;;;;;;;;;cAsB7B,WACX,gBAAgB,QAAiB,UAAU,QAAiB,iBACpD,QAAiB;;;;WAIT;;;;;kBAGD;OACH,UAAU,QAAiB;OAC3B,OAAO,QAAiB;;OAExB,UAAU;OACV,gBAAgB,QAAiB;OACjC,uBAAuB,QAAiB;OACxC,0BAA0B,QAAiB;OAC3C,gCAAgC,QAAiB;OACjD,WAAW,QAAiB;;;;
|
|
1
|
+
{"version":3,"file":"index-BuJfV_kf.d.ts","names":[],"sources":["../../src/lib/utils/types.ts","../../src/lib/structures/command.ts","../../src/lib/utils/decorators.ts","../../src/lib/utils/functions.ts","../../src/lib/utils/hooks.ts","../../src/lib/utils/strategy.ts","../../src/lib/utils/wiring.ts","../../src/index.ts"],"mappings":";;;;;;;;KAOY,4BACR;EACE,UAAU,KAAK;IACjB,KAAK,mEAEH,SAAS,+BACT,kBAAkB,cACf;;;;UAKQ;;;;EAIf;;;;EAIA,iBAAiB;;;;;UAMF;;;;EAIf;;;;EAIA;;;;EAIA,iBAAiB;;;;;UAMF;EACf,qBAAqB;EACrB,4BAA4B;;;;;UAMb;EACf,cAAc;EACd,cAAc;EACd;;;;;UAMe;;;;;;;EAOf;;;;KClEU,yBAAyB,QAAiB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;cA2BnD,UACX,gBAAgB,yBAAyB,gCACjC,QAAiB;EACN,YAAA,SAAS,QAAiB,eAAe,UAAS;;kBA8BtD;OACH,UAAU;OACV,OAAO,QAAiB;;OAExB,UAAU;OACV,gBAAgB,QAAiB;OACjC,uBAAuB,QAAiB;OACxC,0BAA0B,QAAiB;OAC3C,gCAAgC,QAAiB;OACjD,WAAW,QAAiB;;;;;;;;;;;;;;;;;;;;;cAsB7B,WACX,gBAAgB,QAAiB,UAAU,QAAiB,iBACpD,QAAiB;;;;WAIT;;;;;kBAGD;OACH,UAAU,QAAiB;OAC3B,OAAO,QAAiB;;OAExB,UAAU;OACV,gBAAgB,QAAiB;OACjC,uBAAuB,QAAiB;OACxC,0BAA0B,QAAiB;OAC3C,gCAAgC,QAAiB;OACjD,WAAW,QAAiB;;;;KC1GrC,6BAA6B,gBAAgB;;;;;;;;;;;;;;;;iBAiBlC,qBACd,2BACA,iBAAiB,6BAEQ,UAAU,oBAAoB,QAAQ,MAAI;;;;;;;;;;;;;;;;;;iBAyCrD,0BACd,2BACA,mBACA,iBAAiB,6BAEQ,UAAU,oBAAoB,QAAQ,MAAI;;;;;;cCvExD,qBAAqB,mBAEhC,mBAAmB;;;;cAMR,0BAA0B,mBAErC,mBAAmB,mBAAmB;;;;iBAMxB,qBACd,YAAY,4BACX;;;;iBA2Ba,qBAAqB;;;;iBAOrB,0BAA0B,mBAAmB;;;;iBAO7C,wBACd,OAAO,SACP,2BACA,YAAY,4BACX;;;;iBAmBa,6BACd,OAAO,SACP,2BACA,mBACA,YAAY,4BACX;;;;;;;;;cCrFU;;;;EAIQ,YAAA,OAAA,SAAO,UAAY;;;;EAmBxB,OAAA,OAAA,SAAO,UAAY;;;;;;;;;;;cCvBtB,0CAA0C;EACrC,OAAO,OAAO,cAAc,OAAO,UAAO,mCAAA;;;;;;;iBCG5C,yBAAyB;;;;;;;;;;;iBAczB,sBAAsB,QAAQ;;;;iBAyI9B;;;;YCvIJ;;;;IAIR,sBAAsB"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as RegisterAsSubcommand, c as Subcommand, d as analyzeSubcommandGroupParsed, f as parseSlashSubcommand, g as subcommandMethodName, h as subcommandGroupMethodName, i as wireParentSubcommands, l as RegisterSubcommandsHooks, m as subCommandsRegistry, n as clearSubcommandRegistries, o as RegisterAsSubcommandGroup, p as subCommandsGroupRegistry, r as hasRegisteredSubcommands, s as Command, t as SubcommandsAdvancedLoaderStrategy, u as analyzeSubCommandParsed } from "./src-
|
|
1
|
+
import { a as RegisterAsSubcommand, c as Subcommand, d as analyzeSubcommandGroupParsed, f as parseSlashSubcommand, g as subcommandMethodName, h as subcommandGroupMethodName, i as wireParentSubcommands, l as RegisterSubcommandsHooks, m as subCommandsRegistry, n as clearSubcommandRegistries, o as RegisterAsSubcommandGroup, p as subCommandsGroupRegistry, r as hasRegisteredSubcommands, s as Command, t as SubcommandsAdvancedLoaderStrategy, u as analyzeSubCommandParsed } from "./src-DNdsrn4L.js";
|
|
2
2
|
|
|
3
3
|
export { Command, RegisterAsSubcommand, RegisterAsSubcommandGroup, RegisterSubcommandsHooks, Subcommand, SubcommandsAdvancedLoaderStrategy, analyzeSubCommandParsed, analyzeSubcommandGroupParsed, clearSubcommandRegistries, hasRegisteredSubcommands, parseSlashSubcommand, subCommandsGroupRegistry, subCommandsRegistry, subcommandGroupMethodName, subcommandMethodName, wireParentSubcommands };
|
package/dist/esm/register.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as SubcommandsAdvancedLoaderStrategy } from "./src-
|
|
1
|
+
import { t as SubcommandsAdvancedLoaderStrategy } from "./src-DNdsrn4L.js";
|
|
2
2
|
import { Client, Plugin, container, postInitialization } from "@wolfstar/http-framework";
|
|
3
3
|
|
|
4
4
|
//#region src/register.ts
|
|
@@ -209,7 +209,7 @@ var Subcommand = class extends Command {
|
|
|
209
209
|
*/
|
|
210
210
|
function RegisterAsSubcommand(parentCommandName, slashSubcommand) {
|
|
211
211
|
return function decorate(target) {
|
|
212
|
-
|
|
212
|
+
const decorated = class extends target {
|
|
213
213
|
constructor(...args) {
|
|
214
214
|
const [context, baseOptions = {}] = args;
|
|
215
215
|
const parsed = parseSlashSubcommand(slashSubcommand);
|
|
@@ -221,6 +221,8 @@ function RegisterAsSubcommand(parentCommandName, slashSubcommand) {
|
|
|
221
221
|
analyzeSubCommandParsed(this, parentCommandName, slashSubcommand);
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
+
applicationCommandRegistry.ensure(decorated);
|
|
225
|
+
return decorated;
|
|
224
226
|
};
|
|
225
227
|
}
|
|
226
228
|
/**
|
|
@@ -242,7 +244,7 @@ function RegisterAsSubcommand(parentCommandName, slashSubcommand) {
|
|
|
242
244
|
*/
|
|
243
245
|
function RegisterAsSubcommandGroup(parentCommandName, groupName, slashSubcommand) {
|
|
244
246
|
return function decorate(target) {
|
|
245
|
-
|
|
247
|
+
const decorated = class extends target {
|
|
246
248
|
constructor(...args) {
|
|
247
249
|
const [context, baseOptions = {}] = args;
|
|
248
250
|
const parsed = parseSlashSubcommand(slashSubcommand);
|
|
@@ -254,6 +256,8 @@ function RegisterAsSubcommandGroup(parentCommandName, groupName, slashSubcommand
|
|
|
254
256
|
analyzeSubcommandGroupParsed(this, parentCommandName, groupName, slashSubcommand);
|
|
255
257
|
}
|
|
256
258
|
};
|
|
259
|
+
applicationCommandRegistry.ensure(decorated);
|
|
260
|
+
return decorated;
|
|
257
261
|
};
|
|
258
262
|
}
|
|
259
263
|
|
|
@@ -381,4 +385,4 @@ var SubcommandsAdvancedLoaderStrategy = class extends CommandLoaderStrategy {
|
|
|
381
385
|
|
|
382
386
|
//#endregion
|
|
383
387
|
export { RegisterAsSubcommand as a, Subcommand as c, analyzeSubcommandGroupParsed as d, parseSlashSubcommand as f, subcommandMethodName as g, subcommandGroupMethodName as h, wireParentSubcommands as i, RegisterSubcommandsHooks as l, subCommandsRegistry as m, clearSubcommandRegistries as n, RegisterAsSubcommandGroup as o, subCommandsGroupRegistry as p, hasRegisteredSubcommands as r, Command$1 as s, SubcommandsAdvancedLoaderStrategy as t, analyzeSubCommandParsed as u };
|
|
384
|
-
//# sourceMappingURL=src-
|
|
388
|
+
//# sourceMappingURL=src-DNdsrn4L.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"src-DNdsrn4L.js","names":["Command","FrameworkCommand"],"sources":["../../src/lib/utils/functions.ts","../../src/lib/utils/hooks.ts","../../src/lib/structures/command.ts","../../src/lib/utils/decorators.ts","../../src/lib/utils/wiring.ts","../../src/lib/utils/strategy.ts"],"sourcesContent":["import { SlashCommandSubcommandBuilder } from \"@discordjs/builders\";\nimport { Collection } from \"@discordjs/collection\";\nimport { container, type Command } from \"@wolfstar/http-framework\";\nimport type { SlashSubcommandResolvable, SubcommandMappingCollection } from \"./types.js\";\n\n/**\n * Registry of direct subcommands keyed by parent command name, then subcommand name.\n */\nexport const subCommandsRegistry: Collection<\n string,\n Collection<string, SubcommandMappingCollection>\n> = new Collection();\n\n/**\n * Registry of grouped subcommands keyed by parent → group → subcommand name.\n */\nexport const subCommandsGroupRegistry: Collection<\n string,\n Collection<string, Collection<string, SubcommandMappingCollection>>\n> = new Collection();\n\n/**\n * Normalize slash subcommand input into a builder.\n */\nexport function parseSlashSubcommand(\n subcommand: SlashSubcommandResolvable,\n): SlashCommandSubcommandBuilder {\n if (typeof subcommand === \"function\") {\n const builder = new SlashCommandSubcommandBuilder();\n return subcommand(builder, container) ?? builder;\n }\n\n if (subcommand instanceof SlashCommandSubcommandBuilder) {\n return subcommand;\n }\n\n if (\n typeof subcommand === \"object\" &&\n subcommand !== null &&\n \"toJSON\" in subcommand &&\n typeof subcommand.toJSON === \"function\"\n ) {\n const json = (subcommand as { toJSON: () => { name: string; description: string } }).toJSON();\n return new SlashCommandSubcommandBuilder().setName(json.name).setDescription(json.description);\n }\n\n const data = subcommand as { name: string; description: string };\n return new SlashCommandSubcommandBuilder().setName(data.name).setDescription(data.description);\n}\n\n/**\n * Stable method name linked on the parent command for a direct subcommand.\n */\nexport function subcommandMethodName(subcommandName: string): string {\n return `__wolfstar_sc_${subcommandName}`;\n}\n\n/**\n * Stable method name linked on the parent command for a grouped subcommand.\n */\nexport function subcommandGroupMethodName(groupName: string, subcommandName: string): string {\n return `__wolfstar_sc_${groupName}_${subcommandName}`;\n}\n\n/**\n * Register a command piece as a direct subcommand of `parentCommandName`.\n */\nexport function analyzeSubCommandParsed(\n piece: Command,\n parentCommandName: string,\n subcommand: SlashSubcommandResolvable,\n): Command {\n const subcommandParsed = parseSlashSubcommand(subcommand);\n const subcommandName = subcommandParsed.name;\n const methodName = subcommandMethodName(subcommandName);\n const entry: SubcommandMappingCollection = {\n slashCommand: subcommandParsed,\n commandPiece: piece,\n methodName,\n };\n\n const registry = subCommandsRegistry.ensure(parentCommandName, () => new Collection());\n registry.set(subcommandName, entry);\n\n return piece;\n}\n\n/**\n * Register a command piece as a subcommand inside a group of `parentCommandName`.\n */\nexport function analyzeSubcommandGroupParsed(\n piece: Command,\n parentCommandName: string,\n groupName: string,\n subcommand: SlashSubcommandResolvable,\n): Command {\n const subcommandParsed = parseSlashSubcommand(subcommand);\n const subcommandName = subcommandParsed.name;\n const methodName = subcommandGroupMethodName(groupName, subcommandName);\n const entry: SubcommandMappingCollection = {\n slashCommand: subcommandParsed,\n commandPiece: piece,\n methodName,\n };\n\n const parentRegistry = subCommandsGroupRegistry.ensure(parentCommandName, () => new Collection());\n const groupRegistry = parentRegistry.ensure(groupName, () => new Collection());\n groupRegistry.set(subcommandName, entry);\n\n return piece;\n}\n","import type { SlashCommandBuilder } from \"@discordjs/builders\";\nimport type { Command } from \"@wolfstar/http-framework\";\nimport { subCommandsGroupRegistry, subCommandsRegistry } from \"./functions.js\";\n\n/**\n * Optional hooks for parent commands that register chat-input commands imperatively\n * via {@link Command.registerApplicationCommands}. Prefer relying on the automatic\n * wiring performed by {@link SubcommandsAdvancedLoaderStrategy}; these helpers are\n * useful when you want to inspect or manually attach builders during registration.\n */\nexport const RegisterSubcommandsHooks = {\n /**\n * Attach registered direct subcommands onto a {@link SlashCommandBuilder}.\n */\n subcommands(piece: Command, context?: SlashCommandBuilder): void {\n const subcommands = subCommandsRegistry.get(piece.router.chatInputName ?? piece.name);\n if (!subcommands) {\n console.warn(\n `[plugin-subcommands-advanced]: No direct subcommands registered for parent \"${piece.router.chatInputName ?? piece.name}\".`,\n );\n return;\n }\n\n if (!context) return;\n\n for (const { slashCommand } of subcommands.values()) {\n context.addSubcommand(slashCommand);\n }\n },\n\n /**\n * Attach registered grouped subcommands onto matching groups on a {@link SlashCommandBuilder}.\n */\n groups(piece: Command, context?: SlashCommandBuilder): void {\n const groups = subCommandsGroupRegistry.get(piece.router.chatInputName ?? piece.name);\n if (!groups) {\n console.warn(\n `[plugin-subcommands-advanced]: No subcommand groups registered for parent \"${piece.router.chatInputName ?? piece.name}\".`,\n );\n return;\n }\n\n if (!context) return;\n\n for (const [groupName, commands] of groups) {\n const group = context.options.find((option) => {\n const data =\n \"toJSON\" in option && typeof option.toJSON === \"function\" ? option.toJSON() : null;\n return data && typeof data === \"object\" && \"name\" in data && data.name === groupName;\n }) as { addSubcommand?(subcommand: unknown): unknown } | undefined;\n\n if (!group?.addSubcommand) continue;\n\n for (const { slashCommand } of commands.values()) {\n group.addSubcommand(slashCommand);\n }\n }\n },\n};\n","import { Command as FrameworkCommand, container } from \"@wolfstar/http-framework\";\nimport {\n analyzeSubCommandParsed,\n analyzeSubcommandGroupParsed,\n parseSlashSubcommand,\n} from \"../utils/functions.js\";\nimport { RegisterSubcommandsHooks } from \"../utils/hooks.js\";\nimport type { SubcommandCommandOptions } from \"../utils/types.js\";\n\nexport type AdvancedCommandOptions = FrameworkCommand.Options & SubcommandCommandOptions;\n\n/**\n * Command class that can register itself as a modular subcommand (or grouped subcommand)\n * of a parent {@link Subcommand} / chat-input command.\n *\n * @example\n * ```typescript\n * import { Command } from '@wolfstar/plugin-subcommands-advanced';\n *\n * export class PingCommand extends Command {\n * public constructor(context: Command.LoaderContext, options: Command.Options) {\n * super(context, {\n * ...options,\n * registerSubCommand: {\n * parentCommandName: 'utils',\n * slashSubcommand: (builder) => builder.setName('ping').setDescription('Ping!')\n * }\n * });\n * }\n *\n * public override chatInputRun(interaction: Command.ChatInputInteraction) {\n * return interaction.reply({ content: 'Pong!' });\n * }\n * }\n * ```\n */\nexport class Command<\n Options extends AdvancedCommandOptions = AdvancedCommandOptions,\n> extends FrameworkCommand<Options> {\n public constructor(context: FrameworkCommand.LoaderContext, options: Options = {} as Options) {\n const nameCommandsAutogenerated =\n container.client?.options.subcommandsAdvanced?.nameCommandsAutogenerated === true;\n let name = options.name;\n\n if (options.registerSubCommand && nameCommandsAutogenerated) {\n const parsed = parseSlashSubcommand(options.registerSubCommand.slashSubcommand);\n name = `${options.registerSubCommand.parentCommandName}/${parsed.name}`;\n }\n\n if (options.registerSubcommandInGroup && nameCommandsAutogenerated) {\n const parsed = parseSlashSubcommand(options.registerSubcommandInGroup.slashSubcommand);\n name = `${options.registerSubcommandInGroup.parentCommandName}/${options.registerSubcommandInGroup.groupName}/${parsed.name}`;\n }\n\n super(context, { ...options, name } as Options);\n\n if (this.options.registerSubCommand) {\n const { parentCommandName, slashSubcommand } = this.options.registerSubCommand;\n analyzeSubCommandParsed(this, parentCommandName, slashSubcommand);\n }\n\n if (this.options.registerSubcommandInGroup) {\n const { parentCommandName, groupName, slashSubcommand } =\n this.options.registerSubcommandInGroup;\n analyzeSubcommandGroupParsed(this, parentCommandName, groupName, slashSubcommand);\n }\n }\n}\n\nexport namespace Command {\n export type Options = AdvancedCommandOptions;\n export type JSON = FrameworkCommand.JSON;\n /** @deprecated Use {@linkcode LoaderContext} instead. */\n export type Context = LoaderContext;\n export type LoaderContext = FrameworkCommand.LoaderContext;\n export type ChatInputInteraction = FrameworkCommand.ChatInputInteraction;\n export type AutocompleteInteraction = FrameworkCommand.AutocompleteInteraction;\n export type ApplicationCommandInteraction = FrameworkCommand.ApplicationCommandInteraction;\n export type Registry = FrameworkCommand.Registry;\n}\n\n/**\n * Parent command marker. Extend this for the chat-input command that owns modular\n * subcommands. Wiring of children is performed automatically by the plugin loader\n * strategy after all pieces are constructed.\n *\n * @example\n * ```typescript\n * import { RegisterCommand } from '@wolfstar/http-framework';\n * import { Subcommand } from '@wolfstar/plugin-subcommands-advanced';\n *\n * @RegisterCommand((builder) =>\n * builder\n * .setName('utils')\n * .setDescription('Utility commands')\n * .addSubcommandGroup((group) => group.setName('poll').setDescription('Polls'))\n * )\n * export class UtilsCommand extends Subcommand {}\n * ```\n */\nexport class Subcommand<\n Options extends FrameworkCommand.Options = FrameworkCommand.Options,\n> extends FrameworkCommand<Options> {\n /**\n * Optional hooks for imperative {@link registerApplicationCommands} usage.\n */\n public readonly hooks = RegisterSubcommandsHooks;\n}\n\nexport namespace Subcommand {\n export type Options = FrameworkCommand.Options;\n export type JSON = FrameworkCommand.JSON;\n /** @deprecated Use {@linkcode LoaderContext} instead. */\n export type Context = LoaderContext;\n export type LoaderContext = FrameworkCommand.LoaderContext;\n export type ChatInputInteraction = FrameworkCommand.ChatInputInteraction;\n export type AutocompleteInteraction = FrameworkCommand.AutocompleteInteraction;\n export type ApplicationCommandInteraction = FrameworkCommand.ApplicationCommandInteraction;\n export type Registry = FrameworkCommand.Registry;\n}\n","import {\n applicationCommandRegistry,\n Command as FrameworkCommand,\n container,\n} from \"@wolfstar/http-framework\";\nimport {\n analyzeSubCommandParsed,\n analyzeSubcommandGroupParsed,\n parseSlashSubcommand,\n} from \"./functions.js\";\nimport type { SlashSubcommandResolvable } from \"./types.js\";\n\ntype CommandConstructor = new (...args: any[]) => FrameworkCommand;\n\n/**\n * Class decorator that registers the decorated command as a direct subcommand of `parentCommandName`.\n *\n * @example\n * ```typescript\n * import { Command, RegisterAsSubcommand } from '@wolfstar/plugin-subcommands-advanced';\n *\n * @RegisterAsSubcommand('utils', (builder) => builder.setName('ping').setDescription('Ping!'))\n * export class PingCommand extends Command {\n * public override chatInputRun(interaction: Command.ChatInputInteraction) {\n * return interaction.reply({ content: 'Pong!' });\n * }\n * }\n * ```\n */\nexport function RegisterAsSubcommand(\n parentCommandName: string,\n slashSubcommand: SlashSubcommandResolvable,\n) {\n return function decorate<T extends CommandConstructor>(target: T): T {\n const decorated = class extends target {\n public constructor(...args: any[]) {\n const [context, baseOptions = {}] = args as [\n FrameworkCommand.LoaderContext,\n FrameworkCommand.Options,\n ];\n const parsed = parseSlashSubcommand(slashSubcommand);\n const name =\n container.client?.options.subcommandsAdvanced?.nameCommandsAutogenerated === true\n ? `${parentCommandName}/${parsed.name}`\n : baseOptions.name;\n\n super(context, { ...baseOptions, name });\n analyzeSubCommandParsed(this, parentCommandName, slashSubcommand);\n }\n } as T;\n\n applicationCommandRegistry.ensure(decorated as unknown as typeof FrameworkCommand);\n\n return decorated;\n };\n}\n\n/**\n * Class decorator that registers the decorated command as a subcommand inside a group.\n *\n * @example\n * ```typescript\n * import { Command, RegisterAsSubcommandGroup } from '@wolfstar/plugin-subcommands-advanced';\n *\n * @RegisterAsSubcommandGroup('utils', 'poll', (builder) =>\n * builder.setName('create').setDescription('Create a poll')\n * )\n * export class PollCreateCommand extends Command {\n * public override chatInputRun(interaction: Command.ChatInputInteraction) {\n * return interaction.reply({ content: 'Created!' });\n * }\n * }\n * ```\n */\nexport function RegisterAsSubcommandGroup(\n parentCommandName: string,\n groupName: string,\n slashSubcommand: SlashSubcommandResolvable,\n) {\n return function decorate<T extends CommandConstructor>(target: T): T {\n const decorated = class extends target {\n public constructor(...args: any[]) {\n const [context, baseOptions = {}] = args as [\n FrameworkCommand.LoaderContext,\n FrameworkCommand.Options,\n ];\n const parsed = parseSlashSubcommand(slashSubcommand);\n const name =\n container.client?.options.subcommandsAdvanced?.nameCommandsAutogenerated === true\n ? `${parentCommandName}/${groupName}/${parsed.name}`\n : baseOptions.name;\n\n super(context, { ...baseOptions, name });\n analyzeSubcommandGroupParsed(this, parentCommandName, groupName, slashSubcommand);\n }\n } as T;\n\n applicationCommandRegistry.ensure(decorated as unknown as typeof FrameworkCommand);\n\n return decorated;\n };\n}\n","import { applicationCommandRegistry, CommandRouter, type Command } from \"@wolfstar/http-framework\";\nimport {\n ApplicationCommandOptionType,\n type APIApplicationCommandSubcommandGroupOption,\n type RESTPostAPIChatInputApplicationCommandsJSONBody,\n} from \"discord-api-types/v10\";\nimport { subCommandsGroupRegistry, subCommandsRegistry } from \"./functions.js\";\nimport type { SubcommandMappingCollection } from \"./types.js\";\n\nconst wiredParents = new WeakSet<Command>();\n\n/**\n * Whether this piece is a parent that has registered modular subcommands.\n */\nexport function hasRegisteredSubcommands(parentName: string): boolean {\n return subCommandsRegistry.has(parentName) || subCommandsGroupRegistry.has(parentName);\n}\n\n/**\n * Install delegate methods on the parent and rebuild its chat-input resolver + router\n * so modular child command classes handle each subcommand.\n *\n * Must run after every command piece has been constructed (e.g. from\n * {@link CommandLoaderStrategy.onLoad}), so the registries contain every child.\n *\n * Delegates are installed on the parent **prototype** so reconstructed instances\n * (Store `loadAll` rebuilds pieces) still satisfy {@link CommandRouter}'s method checks.\n */\nexport function wireParentSubcommands(parent: Command): void {\n const parentName = parent.router.chatInputName;\n if (!parentName || !hasRegisteredSubcommands(parentName)) return;\n if (wiredParents.has(parent)) return;\n\n const ctor = parent.constructor as typeof Command;\n const existing = applicationCommandRegistry.get(ctor);\n const chatInput = existing?.chatInput;\n if (!chatInput) {\n console.warn(\n `[plugin-subcommands-advanced]: Parent command \"${parentName}\" has no chat-input registration; skipping wiring.`,\n );\n return;\n }\n\n const snapshot = chatInput.toJSON();\n applicationCommandRegistry.delete(ctor);\n\n const resolver = applicationCommandRegistry.ensure(ctor).makeChatInput();\n resolver.setCommand(baseCommandData(snapshot));\n\n for (const option of snapshot.options ?? []) {\n if (option.type === ApplicationCommandOptionType.SubcommandGroup) {\n resolver.addSubcommandGroup(groupDataWithoutSubcommands(option), getLinkedMethod(option));\n for (const subcommand of option.options ?? []) {\n resolver.addSubcommand(subcommand, getLinkedMethod(subcommand), option.name);\n }\n } else if (option.type === ApplicationCommandOptionType.Subcommand) {\n resolver.addSubcommand(option, getLinkedMethod(option));\n }\n }\n\n const direct = subCommandsRegistry.get(parentName);\n if (direct) {\n for (const entry of direct.values()) {\n installDelegate(ctor, parentName, entry);\n resolver.addSubcommand(entry.slashCommand, entry.methodName);\n }\n }\n\n const groups = subCommandsGroupRegistry.get(parentName);\n if (groups) {\n for (const [groupName, commands] of groups) {\n for (const entry of commands.values()) {\n installDelegate(ctor, parentName, entry);\n resolver.addSubcommand(entry.slashCommand, entry.methodName, groupName);\n }\n }\n }\n\n Object.defineProperty(parent, \"router\", {\n value: new CommandRouter(parent),\n configurable: true,\n enumerable: true,\n writable: false,\n });\n\n wiredParents.add(parent);\n}\n\nfunction baseCommandData(snapshot: RESTPostAPIChatInputApplicationCommandsJSONBody) {\n const { options: _options, ...rest } = snapshot;\n return rest;\n}\n\nfunction groupDataWithoutSubcommands(group: APIApplicationCommandSubcommandGroupOption) {\n const { options: _options, type: _type, ...rest } = group;\n return rest;\n}\n\n/**\n * `http-framework` links a subcommand (or group) option to its handler method by\n * defining a non-enumerable symbol property on the resolved option object. The\n * symbol is not exported, so it is recovered here by its description to preserve\n * framework-native subcommand routing when the resolver is rebuilt.\n */\nconst LINKED_METHOD_SYMBOL_DESCRIPTION = \"decorated-command.method.link\";\n\nfunction getLinkedMethod(option: object): string | null {\n for (const symbol of Object.getOwnPropertySymbols(option)) {\n if (symbol.description === LINKED_METHOD_SYMBOL_DESCRIPTION) {\n return (Reflect.get(option, symbol) as string | undefined) ?? null;\n }\n }\n\n return null;\n}\n\nfunction installDelegate(\n parentCtor: typeof Command,\n parentName: string,\n entry: SubcommandMappingCollection,\n): void {\n const { methodName } = entry;\n\n Object.defineProperty(parentCtor.prototype, methodName, {\n configurable: true,\n enumerable: false,\n writable: true,\n value(this: Command, interaction: Command.ApplicationCommandInteraction, args: object) {\n const resolved = lookupEntry(parentName, methodName);\n if (!resolved) {\n throw new Error(\n `[plugin-subcommands-advanced]: No child command registered for parent \"${parentName}\" method \"${methodName}\".`,\n );\n }\n return resolved.commandPiece.chatInputRun(interaction, args);\n },\n });\n}\n\nfunction lookupEntry(\n parentName: string,\n methodName: string,\n): SubcommandMappingCollection | undefined {\n const direct = subCommandsRegistry.get(parentName);\n if (direct) {\n for (const entry of direct.values()) {\n if (entry.methodName === methodName) return entry;\n }\n }\n\n const groups = subCommandsGroupRegistry.get(parentName);\n if (groups) {\n for (const commands of groups.values()) {\n for (const entry of commands.values()) {\n if (entry.methodName === methodName) return entry;\n }\n }\n }\n\n return undefined;\n}\n\n/**\n * Reset subcommand registries (useful between tests).\n */\nexport function clearSubcommandRegistries(): void {\n subCommandsRegistry.clear();\n subCommandsGroupRegistry.clear();\n}\n","import { CommandLoaderStrategy, type Command, type CommandStore } from \"@wolfstar/http-framework\";\nimport { hasRegisteredSubcommands, wireParentSubcommands } from \"./wiring.js\";\n\n/**\n * Loader strategy that wires modular subcommands onto parent commands before\n * chat-input mappings are published to {@link CommandStore.router}.\n *\n * {@link CommandStore.loadAll} constructs every piece first (children populate the\n * registries), then inserts them — {@link onLoad} therefore sees a complete registry.\n */\nexport class SubcommandsAdvancedLoaderStrategy extends CommandLoaderStrategy {\n public override onLoad(store: CommandStore, piece: Command) {\n const parentName = piece.router.chatInputName;\n if (parentName && hasRegisteredSubcommands(parentName)) {\n wireParentSubcommands(piece);\n }\n\n return super.onLoad(store, piece);\n }\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,sBAGT,IAAI,WAAW;;;;AAKnB,MAAa,2BAGT,IAAI,WAAW;;;;AAKnB,SAAgB,qBACd,YAC+B;CAC/B,IAAI,OAAO,eAAe,YAAY;EACpC,MAAM,UAAU,IAAI,8BAA8B;EAClD,OAAO,WAAW,SAAS,SAAS,KAAK;CAC3C;CAEA,IAAI,sBAAsB,+BACxB,OAAO;CAGT,IACE,OAAO,eAAe,YACtB,eAAe,QACf,YAAY,cACZ,OAAO,WAAW,WAAW,YAC7B;EACA,MAAM,OAAQ,WAAuE,OAAO;EAC5F,OAAO,IAAI,8BAA8B,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,eAAe,KAAK,WAAW;CAC/F;CAEA,MAAM,OAAO;CACb,OAAO,IAAI,8BAA8B,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,CAAC,eAAe,KAAK,WAAW;AAC/F;;;;AAKA,SAAgB,qBAAqB,gBAAgC;CACnE,OAAO,iBAAiB;AAC1B;;;;AAKA,SAAgB,0BAA0B,WAAmB,gBAAgC;CAC3F,OAAO,iBAAiB,UAAU,GAAG;AACvC;;;;AAKA,SAAgB,wBACd,OACA,mBACA,YACS;CACT,MAAM,mBAAmB,qBAAqB,UAAU;CACxD,MAAM,iBAAiB,iBAAiB;CAExC,MAAM,QAAqC;EACzC,cAAc;EACd,cAAc;EACd,YAJiB,qBAAqB,cAI7B;CACX;CAGA,AADiB,oBAAoB,OAAO,yBAAyB,IAAI,WAAW,CAC7E,CAAC,CAAC,IAAI,gBAAgB,KAAK;CAElC,OAAO;AACT;;;;AAKA,SAAgB,6BACd,OACA,mBACA,WACA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S,gBACP,YACA,YACA,OACM;CACN,MAAM,EAAE,eAAe;CAEvB,OAAO,eAAe,WAAW,WAAW,YAAY;EACtD,cAAc;EACd,YAAY;EACZ,UAAU;EACV,MAAqB,aAAoD,MAAc;GACrF,MAAM,WAAW,YAAY,YAAY,UAAU;GACnD,IAAI,CAAC,UACH,MAAM,IAAI,MACR,0EAA0E,WAAW,YAAY,WAAW,GAC9G;GAEF,OAAO,SAAS,aAAa,aAAa,aAAa,IAAI;EAC7D;CACF,CAAC;AACH;AAEA,SAAS,YACP,YACA,YACyC;CACzC,MAAM,SAAS,oBAAoB,IAAI,UAAU;CACjD,IAAI,QACF;OAAK,MAAM,SAAS,OAAO,OAAO,GAChC,IAAI,MAAM,eAAe,YAAY,OAAO;CAC9C;CAGF,MAAM,SAAS,yBAAyB,IAAI,UAAU;CACtD,IAAI,QACF;OAAK,MAAM,YAAY,OAAO,OAAO,GACnC,KAAK,MAAM,SAAS,SAAS,OAAO,GAClC,IAAI,MAAM,eAAe,YAAY,OAAO;CAEhD;AAIJ;;;;AAKA,SAAgB,4BAAkC;CAChD,oBAAoB,MAAM;CAC1B,yBAAyB,MAAM;AACjC;;;;;;;;;;;AC9JA,IAAa,oCAAb,cAAuD,sBAAsB;CAC3E,AAAgB,OAAO,OAAqB,OAAgB;EAC1D,MAAM,aAAa,MAAM,OAAO;EAChC,IAAI,cAAc,yBAAyB,UAAU,GACnD,sBAAsB,KAAK;EAG7B,OAAO,MAAM,OAAO,OAAO,KAAK;CAClC;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wolfstar/plugin-subcommands-advanced",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2-next-20260830110414",
|
|
4
4
|
"description": "Plugin for @wolfstar/http-framework to modularize slash subcommands into separate command classes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"discord",
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"provenance": true
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@discordjs/builders": "^1.
|
|
51
|
+
"@discordjs/builders": "^1.14.1",
|
|
52
52
|
"@discordjs/collection": "^2.1.1",
|
|
53
53
|
"discord-api-types": "^0.38.33"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@wolfstar/http-framework": "^3.1.
|
|
57
|
-
"@wolfstar/http-framework-test-utils": "^3.0.
|
|
56
|
+
"@wolfstar/http-framework": "^3.1.3",
|
|
57
|
+
"@wolfstar/http-framework-test-utils": "^3.0.4"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
60
|
"@wolfstar/http-framework": "^3.1.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-JCzq0KZw.js","names":["Command","FrameworkCommand"],"sources":["../../src/lib/utils/functions.ts","../../src/lib/utils/hooks.ts","../../src/lib/structures/command.ts","../../src/lib/utils/decorators.ts","../../src/lib/utils/wiring.ts","../../src/lib/utils/strategy.ts"],"sourcesContent":["import { SlashCommandSubcommandBuilder } from \"@discordjs/builders\";\nimport { Collection } from \"@discordjs/collection\";\nimport { container, type Command } from \"@wolfstar/http-framework\";\nimport type { SlashSubcommandResolvable, SubcommandMappingCollection } from \"./types.js\";\n\n/**\n * Registry of direct subcommands keyed by parent command name, then subcommand name.\n */\nexport const subCommandsRegistry: Collection<\n string,\n Collection<string, SubcommandMappingCollection>\n> = new Collection();\n\n/**\n * Registry of grouped subcommands keyed by parent → group → subcommand name.\n */\nexport const subCommandsGroupRegistry: Collection<\n string,\n Collection<string, Collection<string, SubcommandMappingCollection>>\n> = new Collection();\n\n/**\n * Normalize slash subcommand input into a builder.\n */\nexport function parseSlashSubcommand(\n subcommand: SlashSubcommandResolvable,\n): SlashCommandSubcommandBuilder {\n if (typeof subcommand === \"function\") {\n const builder = new SlashCommandSubcommandBuilder();\n return subcommand(builder, container) ?? builder;\n }\n\n if (subcommand instanceof SlashCommandSubcommandBuilder) {\n return subcommand;\n }\n\n if (\n typeof subcommand === \"object\" &&\n subcommand !== null &&\n \"toJSON\" in subcommand &&\n typeof subcommand.toJSON === \"function\"\n ) {\n const json = (subcommand as { toJSON: () => { name: string; description: string } }).toJSON();\n return new SlashCommandSubcommandBuilder().setName(json.name).setDescription(json.description);\n }\n\n const data = subcommand as { name: string; description: string };\n return new SlashCommandSubcommandBuilder().setName(data.name).setDescription(data.description);\n}\n\n/**\n * Stable method name linked on the parent command for a direct subcommand.\n */\nexport function subcommandMethodName(subcommandName: string): string {\n return `__wolfstar_sc_${subcommandName}`;\n}\n\n/**\n * Stable method name linked on the parent command for a grouped subcommand.\n */\nexport function subcommandGroupMethodName(groupName: string, subcommandName: string): string {\n return `__wolfstar_sc_${groupName}_${subcommandName}`;\n}\n\n/**\n * Register a command piece as a direct subcommand of `parentCommandName`.\n */\nexport function analyzeSubCommandParsed(\n piece: Command,\n parentCommandName: string,\n subcommand: SlashSubcommandResolvable,\n): Command {\n const subcommandParsed = parseSlashSubcommand(subcommand);\n const subcommandName = subcommandParsed.name;\n const methodName = subcommandMethodName(subcommandName);\n const entry: SubcommandMappingCollection = {\n slashCommand: subcommandParsed,\n commandPiece: piece,\n methodName,\n };\n\n const registry = subCommandsRegistry.ensure(parentCommandName, () => new Collection());\n registry.set(subcommandName, entry);\n\n return piece;\n}\n\n/**\n * Register a command piece as a subcommand inside a group of `parentCommandName`.\n */\nexport function analyzeSubcommandGroupParsed(\n piece: Command,\n parentCommandName: string,\n groupName: string,\n subcommand: SlashSubcommandResolvable,\n): Command {\n const subcommandParsed = parseSlashSubcommand(subcommand);\n const subcommandName = subcommandParsed.name;\n const methodName = subcommandGroupMethodName(groupName, subcommandName);\n const entry: SubcommandMappingCollection = {\n slashCommand: subcommandParsed,\n commandPiece: piece,\n methodName,\n };\n\n const parentRegistry = subCommandsGroupRegistry.ensure(parentCommandName, () => new Collection());\n const groupRegistry = parentRegistry.ensure(groupName, () => new Collection());\n groupRegistry.set(subcommandName, entry);\n\n return piece;\n}\n","import type { SlashCommandBuilder } from \"@discordjs/builders\";\nimport type { Command } from \"@wolfstar/http-framework\";\nimport { subCommandsGroupRegistry, subCommandsRegistry } from \"./functions.js\";\n\n/**\n * Optional hooks for parent commands that register chat-input commands imperatively\n * via {@link Command.registerApplicationCommands}. Prefer relying on the automatic\n * wiring performed by {@link SubcommandsAdvancedLoaderStrategy}; these helpers are\n * useful when you want to inspect or manually attach builders during registration.\n */\nexport const RegisterSubcommandsHooks = {\n /**\n * Attach registered direct subcommands onto a {@link SlashCommandBuilder}.\n */\n subcommands(piece: Command, context?: SlashCommandBuilder): void {\n const subcommands = subCommandsRegistry.get(piece.router.chatInputName ?? piece.name);\n if (!subcommands) {\n console.warn(\n `[plugin-subcommands-advanced]: No direct subcommands registered for parent \"${piece.router.chatInputName ?? piece.name}\".`,\n );\n return;\n }\n\n if (!context) return;\n\n for (const { slashCommand } of subcommands.values()) {\n context.addSubcommand(slashCommand);\n }\n },\n\n /**\n * Attach registered grouped subcommands onto matching groups on a {@link SlashCommandBuilder}.\n */\n groups(piece: Command, context?: SlashCommandBuilder): void {\n const groups = subCommandsGroupRegistry.get(piece.router.chatInputName ?? piece.name);\n if (!groups) {\n console.warn(\n `[plugin-subcommands-advanced]: No subcommand groups registered for parent \"${piece.router.chatInputName ?? piece.name}\".`,\n );\n return;\n }\n\n if (!context) return;\n\n for (const [groupName, commands] of groups) {\n const group = context.options.find((option) => {\n const data =\n \"toJSON\" in option && typeof option.toJSON === \"function\" ? option.toJSON() : null;\n return data && typeof data === \"object\" && \"name\" in data && data.name === groupName;\n }) as { addSubcommand?(subcommand: unknown): unknown } | undefined;\n\n if (!group?.addSubcommand) continue;\n\n for (const { slashCommand } of commands.values()) {\n group.addSubcommand(slashCommand);\n }\n }\n },\n};\n","import { Command as FrameworkCommand, container } from \"@wolfstar/http-framework\";\nimport {\n analyzeSubCommandParsed,\n analyzeSubcommandGroupParsed,\n parseSlashSubcommand,\n} from \"../utils/functions.js\";\nimport { RegisterSubcommandsHooks } from \"../utils/hooks.js\";\nimport type { SubcommandCommandOptions } from \"../utils/types.js\";\n\nexport type AdvancedCommandOptions = FrameworkCommand.Options & SubcommandCommandOptions;\n\n/**\n * Command class that can register itself as a modular subcommand (or grouped subcommand)\n * of a parent {@link Subcommand} / chat-input command.\n *\n * @example\n * ```typescript\n * import { Command } from '@wolfstar/plugin-subcommands-advanced';\n *\n * export class PingCommand extends Command {\n * public constructor(context: Command.LoaderContext, options: Command.Options) {\n * super(context, {\n * ...options,\n * registerSubCommand: {\n * parentCommandName: 'utils',\n * slashSubcommand: (builder) => builder.setName('ping').setDescription('Ping!')\n * }\n * });\n * }\n *\n * public override chatInputRun(interaction: Command.ChatInputInteraction) {\n * return interaction.reply({ content: 'Pong!' });\n * }\n * }\n * ```\n */\nexport class Command<\n Options extends AdvancedCommandOptions = AdvancedCommandOptions,\n> extends FrameworkCommand<Options> {\n public constructor(context: FrameworkCommand.LoaderContext, options: Options = {} as Options) {\n const nameCommandsAutogenerated =\n container.client?.options.subcommandsAdvanced?.nameCommandsAutogenerated === true;\n let name = options.name;\n\n if (options.registerSubCommand && nameCommandsAutogenerated) {\n const parsed = parseSlashSubcommand(options.registerSubCommand.slashSubcommand);\n name = `${options.registerSubCommand.parentCommandName}/${parsed.name}`;\n }\n\n if (options.registerSubcommandInGroup && nameCommandsAutogenerated) {\n const parsed = parseSlashSubcommand(options.registerSubcommandInGroup.slashSubcommand);\n name = `${options.registerSubcommandInGroup.parentCommandName}/${options.registerSubcommandInGroup.groupName}/${parsed.name}`;\n }\n\n super(context, { ...options, name } as Options);\n\n if (this.options.registerSubCommand) {\n const { parentCommandName, slashSubcommand } = this.options.registerSubCommand;\n analyzeSubCommandParsed(this, parentCommandName, slashSubcommand);\n }\n\n if (this.options.registerSubcommandInGroup) {\n const { parentCommandName, groupName, slashSubcommand } =\n this.options.registerSubcommandInGroup;\n analyzeSubcommandGroupParsed(this, parentCommandName, groupName, slashSubcommand);\n }\n }\n}\n\nexport namespace Command {\n export type Options = AdvancedCommandOptions;\n export type JSON = FrameworkCommand.JSON;\n /** @deprecated Use {@linkcode LoaderContext} instead. */\n export type Context = LoaderContext;\n export type LoaderContext = FrameworkCommand.LoaderContext;\n export type ChatInputInteraction = FrameworkCommand.ChatInputInteraction;\n export type AutocompleteInteraction = FrameworkCommand.AutocompleteInteraction;\n export type ApplicationCommandInteraction = FrameworkCommand.ApplicationCommandInteraction;\n export type Registry = FrameworkCommand.Registry;\n}\n\n/**\n * Parent command marker. Extend this for the chat-input command that owns modular\n * subcommands. Wiring of children is performed automatically by the plugin loader\n * strategy after all pieces are constructed.\n *\n * @example\n * ```typescript\n * import { RegisterCommand } from '@wolfstar/http-framework';\n * import { Subcommand } from '@wolfstar/plugin-subcommands-advanced';\n *\n * @RegisterCommand((builder) =>\n * builder\n * .setName('utils')\n * .setDescription('Utility commands')\n * .addSubcommandGroup((group) => group.setName('poll').setDescription('Polls'))\n * )\n * export class UtilsCommand extends Subcommand {}\n * ```\n */\nexport class Subcommand<\n Options extends FrameworkCommand.Options = FrameworkCommand.Options,\n> extends FrameworkCommand<Options> {\n /**\n * Optional hooks for imperative {@link registerApplicationCommands} usage.\n */\n public readonly hooks = RegisterSubcommandsHooks;\n}\n\nexport namespace Subcommand {\n export type Options = FrameworkCommand.Options;\n export type JSON = FrameworkCommand.JSON;\n /** @deprecated Use {@linkcode LoaderContext} instead. */\n export type Context = LoaderContext;\n export type LoaderContext = FrameworkCommand.LoaderContext;\n export type ChatInputInteraction = FrameworkCommand.ChatInputInteraction;\n export type AutocompleteInteraction = FrameworkCommand.AutocompleteInteraction;\n export type ApplicationCommandInteraction = FrameworkCommand.ApplicationCommandInteraction;\n export type Registry = FrameworkCommand.Registry;\n}\n","import { Command as FrameworkCommand, container } from \"@wolfstar/http-framework\";\nimport {\n analyzeSubCommandParsed,\n analyzeSubcommandGroupParsed,\n parseSlashSubcommand,\n} from \"./functions.js\";\nimport type { SlashSubcommandResolvable } from \"./types.js\";\n\ntype CommandConstructor = new (...args: any[]) => FrameworkCommand;\n\n/**\n * Class decorator that registers the decorated command as a direct subcommand of `parentCommandName`.\n *\n * @example\n * ```typescript\n * import { Command, RegisterAsSubcommand } from '@wolfstar/plugin-subcommands-advanced';\n *\n * @RegisterAsSubcommand('utils', (builder) => builder.setName('ping').setDescription('Ping!'))\n * export class PingCommand extends Command {\n * public override chatInputRun(interaction: Command.ChatInputInteraction) {\n * return interaction.reply({ content: 'Pong!' });\n * }\n * }\n * ```\n */\nexport function RegisterAsSubcommand(\n parentCommandName: string,\n slashSubcommand: SlashSubcommandResolvable,\n) {\n return function decorate<T extends CommandConstructor>(target: T): T {\n return class extends target {\n public constructor(...args: any[]) {\n const [context, baseOptions = {}] = args as [\n FrameworkCommand.LoaderContext,\n FrameworkCommand.Options,\n ];\n const parsed = parseSlashSubcommand(slashSubcommand);\n const name =\n container.client?.options.subcommandsAdvanced?.nameCommandsAutogenerated === true\n ? `${parentCommandName}/${parsed.name}`\n : baseOptions.name;\n\n super(context, { ...baseOptions, name });\n analyzeSubCommandParsed(this, parentCommandName, slashSubcommand);\n }\n } as T;\n };\n}\n\n/**\n * Class decorator that registers the decorated command as a subcommand inside a group.\n *\n * @example\n * ```typescript\n * import { Command, RegisterAsSubcommandGroup } from '@wolfstar/plugin-subcommands-advanced';\n *\n * @RegisterAsSubcommandGroup('utils', 'poll', (builder) =>\n * builder.setName('create').setDescription('Create a poll')\n * )\n * export class PollCreateCommand extends Command {\n * public override chatInputRun(interaction: Command.ChatInputInteraction) {\n * return interaction.reply({ content: 'Created!' });\n * }\n * }\n * ```\n */\nexport function RegisterAsSubcommandGroup(\n parentCommandName: string,\n groupName: string,\n slashSubcommand: SlashSubcommandResolvable,\n) {\n return function decorate<T extends CommandConstructor>(target: T): T {\n return class extends target {\n public constructor(...args: any[]) {\n const [context, baseOptions = {}] = args as [\n FrameworkCommand.LoaderContext,\n FrameworkCommand.Options,\n ];\n const parsed = parseSlashSubcommand(slashSubcommand);\n const name =\n container.client?.options.subcommandsAdvanced?.nameCommandsAutogenerated === true\n ? `${parentCommandName}/${groupName}/${parsed.name}`\n : baseOptions.name;\n\n super(context, { ...baseOptions, name });\n analyzeSubcommandGroupParsed(this, parentCommandName, groupName, slashSubcommand);\n }\n } as T;\n };\n}\n","import { applicationCommandRegistry, CommandRouter, type Command } from \"@wolfstar/http-framework\";\nimport {\n ApplicationCommandOptionType,\n type APIApplicationCommandSubcommandGroupOption,\n type RESTPostAPIChatInputApplicationCommandsJSONBody,\n} from \"discord-api-types/v10\";\nimport { subCommandsGroupRegistry, subCommandsRegistry } from \"./functions.js\";\nimport type { SubcommandMappingCollection } from \"./types.js\";\n\nconst wiredParents = new WeakSet<Command>();\n\n/**\n * Whether this piece is a parent that has registered modular subcommands.\n */\nexport function hasRegisteredSubcommands(parentName: string): boolean {\n return subCommandsRegistry.has(parentName) || subCommandsGroupRegistry.has(parentName);\n}\n\n/**\n * Install delegate methods on the parent and rebuild its chat-input resolver + router\n * so modular child command classes handle each subcommand.\n *\n * Must run after every command piece has been constructed (e.g. from\n * {@link CommandLoaderStrategy.onLoad}), so the registries contain every child.\n *\n * Delegates are installed on the parent **prototype** so reconstructed instances\n * (Store `loadAll` rebuilds pieces) still satisfy {@link CommandRouter}'s method checks.\n */\nexport function wireParentSubcommands(parent: Command): void {\n const parentName = parent.router.chatInputName;\n if (!parentName || !hasRegisteredSubcommands(parentName)) return;\n if (wiredParents.has(parent)) return;\n\n const ctor = parent.constructor as typeof Command;\n const existing = applicationCommandRegistry.get(ctor);\n const chatInput = existing?.chatInput;\n if (!chatInput) {\n console.warn(\n `[plugin-subcommands-advanced]: Parent command \"${parentName}\" has no chat-input registration; skipping wiring.`,\n );\n return;\n }\n\n const snapshot = chatInput.toJSON();\n applicationCommandRegistry.delete(ctor);\n\n const resolver = applicationCommandRegistry.ensure(ctor).makeChatInput();\n resolver.setCommand(baseCommandData(snapshot));\n\n for (const option of snapshot.options ?? []) {\n if (option.type === ApplicationCommandOptionType.SubcommandGroup) {\n resolver.addSubcommandGroup(groupDataWithoutSubcommands(option), getLinkedMethod(option));\n for (const subcommand of option.options ?? []) {\n resolver.addSubcommand(subcommand, getLinkedMethod(subcommand), option.name);\n }\n } else if (option.type === ApplicationCommandOptionType.Subcommand) {\n resolver.addSubcommand(option, getLinkedMethod(option));\n }\n }\n\n const direct = subCommandsRegistry.get(parentName);\n if (direct) {\n for (const entry of direct.values()) {\n installDelegate(ctor, parentName, entry);\n resolver.addSubcommand(entry.slashCommand, entry.methodName);\n }\n }\n\n const groups = subCommandsGroupRegistry.get(parentName);\n if (groups) {\n for (const [groupName, commands] of groups) {\n for (const entry of commands.values()) {\n installDelegate(ctor, parentName, entry);\n resolver.addSubcommand(entry.slashCommand, entry.methodName, groupName);\n }\n }\n }\n\n Object.defineProperty(parent, \"router\", {\n value: new CommandRouter(parent),\n configurable: true,\n enumerable: true,\n writable: false,\n });\n\n wiredParents.add(parent);\n}\n\nfunction baseCommandData(snapshot: RESTPostAPIChatInputApplicationCommandsJSONBody) {\n const { options: _options, ...rest } = snapshot;\n return rest;\n}\n\nfunction groupDataWithoutSubcommands(group: APIApplicationCommandSubcommandGroupOption) {\n const { options: _options, type: _type, ...rest } = group;\n return rest;\n}\n\n/**\n * `http-framework` links a subcommand (or group) option to its handler method by\n * defining a non-enumerable symbol property on the resolved option object. The\n * symbol is not exported, so it is recovered here by its description to preserve\n * framework-native subcommand routing when the resolver is rebuilt.\n */\nconst LINKED_METHOD_SYMBOL_DESCRIPTION = \"decorated-command.method.link\";\n\nfunction getLinkedMethod(option: object): string | null {\n for (const symbol of Object.getOwnPropertySymbols(option)) {\n if (symbol.description === LINKED_METHOD_SYMBOL_DESCRIPTION) {\n return (Reflect.get(option, symbol) as string | undefined) ?? null;\n }\n }\n\n return null;\n}\n\nfunction installDelegate(\n parentCtor: typeof Command,\n parentName: string,\n entry: SubcommandMappingCollection,\n): void {\n const { methodName } = entry;\n\n Object.defineProperty(parentCtor.prototype, methodName, {\n configurable: true,\n enumerable: false,\n writable: true,\n value(this: Command, interaction: Command.ApplicationCommandInteraction, args: object) {\n const resolved = lookupEntry(parentName, methodName);\n if (!resolved) {\n throw new Error(\n `[plugin-subcommands-advanced]: No child command registered for parent \"${parentName}\" method \"${methodName}\".`,\n );\n }\n return resolved.commandPiece.chatInputRun(interaction, args);\n },\n });\n}\n\nfunction lookupEntry(\n parentName: string,\n methodName: string,\n): SubcommandMappingCollection | undefined {\n const direct = subCommandsRegistry.get(parentName);\n if (direct) {\n for (const entry of direct.values()) {\n if (entry.methodName === methodName) return entry;\n }\n }\n\n const groups = subCommandsGroupRegistry.get(parentName);\n if (groups) {\n for (const commands of groups.values()) {\n for (const entry of commands.values()) {\n if (entry.methodName === methodName) return entry;\n }\n }\n }\n\n return undefined;\n}\n\n/**\n * Reset subcommand registries (useful between tests).\n */\nexport function clearSubcommandRegistries(): void {\n subCommandsRegistry.clear();\n subCommandsGroupRegistry.clear();\n}\n","import { CommandLoaderStrategy, type Command, type CommandStore } from \"@wolfstar/http-framework\";\nimport { hasRegisteredSubcommands, wireParentSubcommands } from \"./wiring.js\";\n\n/**\n * Loader strategy that wires modular subcommands onto parent commands before\n * chat-input mappings are published to {@link CommandStore.router}.\n *\n * {@link CommandStore.loadAll} constructs every piece first (children populate the\n * registries), then inserts them — {@link onLoad} therefore sees a complete registry.\n */\nexport class SubcommandsAdvancedLoaderStrategy extends CommandLoaderStrategy {\n public override onLoad(store: CommandStore, piece: Command) {\n const parentName = piece.router.chatInputName;\n if (parentName && hasRegisteredSubcommands(parentName)) {\n wireParentSubcommands(piece);\n }\n\n return super.onLoad(store, piece);\n }\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,sBAGT,IAAI,WAAW;;;;AAKnB,MAAa,2BAGT,IAAI,WAAW;;;;AAKnB,SAAgB,qBACd,YAC+B;CAC/B,IAAI,OAAO,eAAe,YAAY;EACpC,MAAM,UAAU,IAAI,8BAA8B;EAClD,OAA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