Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/subcommands-options-of.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wolfstar/plugin-subcommands-advanced": minor
---

Add `Command.OptionsOf` and `Subcommand.OptionsOf`, re-exporting the framework's `Command.OptionsOf` so command classes that import `Command` from this package can type their generated options (`stars codegen`). Requires `@wolfstar/http-framework` 6.2.0 or later for the type.
1 change: 1 addition & 0 deletions packages/plugin-subcommands-advanced/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,4 @@ You do not need to call the optional `hooks.subcommands` / `hooks.groups` helper
- HTTP-only: there is no message-command support (unlike the Sapphire original).
- Child classes should **not** use `@RegisterCommand` — only the parent registers the top-level slash command.
- Subcommand groups must still be declared on the parent (via `@RegisterCommand` builder or `registerApplicationCommands`).
- `Command.OptionsOf` / `Subcommand.OptionsOf` re-export the framework's `Command.OptionsOf` (options generated by `stars codegen`). The type needs `@wolfstar/http-framework` 6.2.0 or later; on an older framework it fails to resolve when type-checking with `skipLibCheck` off.
2 changes: 1 addition & 1 deletion packages/plugin-subcommands-advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"discord-api-types": "^0.38.33"
},
"devDependencies": {
"@wolfstar/http-framework": "^6.1.0",
"@wolfstar/http-framework": "^6.2.0",
"@wolfstar/http-framework-test-utils": "^4.0.2",
"@wolfstar/kit": "^0.1.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { Command as FrameworkCommand, container } from "@wolfstar/http-framework";
import {
Command as FrameworkCommand,
container,
type CommandOptionsRegistry,
Comment thread
pullfrog[bot] marked this conversation as resolved.
} from "@wolfstar/http-framework";
import { deferSubcommand } from "../utils/functions.js";
import { RegisterSubcommandsHooks } from "../utils/hooks.js";
import type { SubcommandCommandOptions } from "../utils/types.js";
Expand Down Expand Up @@ -60,6 +64,7 @@ export class Command<

export namespace Command {
export type Options = AdvancedCommandOptions;
export type OptionsOf<K extends keyof CommandOptionsRegistry> = FrameworkCommand.OptionsOf<K>;
export type JSON = FrameworkCommand.JSON;
/** @deprecated Use {@linkcode LoaderContext} instead. */
export type Context = LoaderContext;
Expand Down Expand Up @@ -100,6 +105,7 @@ export class Subcommand<

export namespace Subcommand {
export type Options = FrameworkCommand.Options;
export type OptionsOf<K extends keyof CommandOptionsRegistry> = FrameworkCommand.OptionsOf<K>;
export type JSON = FrameworkCommand.JSON;
/** @deprecated Use {@linkcode LoaderContext} instead. */
export type Context = LoaderContext;
Expand Down
164 changes: 159 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ allowBuilds:
esbuild: true
msgpackr-extract: false
minimumReleaseAgeExclude:
- "@wolfstar/http-framework@3.4.0 || 6.1.0"
- "@wolfstar/cli@2.2.0"
- "@wolfstar/kit@0.1.0"
- "@wolfstar/nitro-server@0.2.5"
- "@wolfstar/http-framework@3.4.0 || 6.1.0 || 6.2.2"
- "@wolfstar/cli@2.2.0 || 2.6.0"
- "@wolfstar/kit@0.1.0 || 0.2.0"
- "@wolfstar/nitro-server@0.2.5 || 0.2.9"
- "@wolfstar/schema@0.9.0"
- "@wolfstar/vite-server@0.4.4"
Loading