diff --git a/.changeset/subcommands-options-of.md b/.changeset/subcommands-options-of.md new file mode 100644 index 00000000..097f032e --- /dev/null +++ b/.changeset/subcommands-options-of.md @@ -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. diff --git a/packages/plugin-subcommands-advanced/README.md b/packages/plugin-subcommands-advanced/README.md index c7f4f360..62ae8d4a 100644 --- a/packages/plugin-subcommands-advanced/README.md +++ b/packages/plugin-subcommands-advanced/README.md @@ -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. diff --git a/packages/plugin-subcommands-advanced/package.json b/packages/plugin-subcommands-advanced/package.json index b256b759..d42781da 100644 --- a/packages/plugin-subcommands-advanced/package.json +++ b/packages/plugin-subcommands-advanced/package.json @@ -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" }, diff --git a/packages/plugin-subcommands-advanced/src/lib/structures/command.ts b/packages/plugin-subcommands-advanced/src/lib/structures/command.ts index 13908cc2..77586646 100644 --- a/packages/plugin-subcommands-advanced/src/lib/structures/command.ts +++ b/packages/plugin-subcommands-advanced/src/lib/structures/command.ts @@ -1,4 +1,8 @@ -import { Command as FrameworkCommand, container } from "@wolfstar/http-framework"; +import { + Command as FrameworkCommand, + container, + type CommandOptionsRegistry, +} from "@wolfstar/http-framework"; import { deferSubcommand } from "../utils/functions.js"; import { RegisterSubcommandsHooks } from "../utils/hooks.js"; import type { SubcommandCommandOptions } from "../utils/types.js"; @@ -60,6 +64,7 @@ export class Command< export namespace Command { export type Options = AdvancedCommandOptions; + export type OptionsOf = FrameworkCommand.OptionsOf; export type JSON = FrameworkCommand.JSON; /** @deprecated Use {@linkcode LoaderContext} instead. */ export type Context = LoaderContext; @@ -100,6 +105,7 @@ export class Subcommand< export namespace Subcommand { export type Options = FrameworkCommand.Options; + export type OptionsOf = FrameworkCommand.OptionsOf; export type JSON = FrameworkCommand.JSON; /** @deprecated Use {@linkcode LoaderContext} instead. */ export type Context = LoaderContext; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5f2a2c9e..d591a0d8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -458,11 +458,11 @@ importers: version: 0.38.56 devDependencies: '@wolfstar/http-framework': - specifier: ^6.1.0 - version: 6.1.1(acorn@8.19.0)(magicast@0.5.5)(oxc-parser@0.150.0)(rolldown@1.2.12)(tsdown@0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1))(typescript@7.0.2)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)) + specifier: ^6.2.0 + version: 6.2.2(acorn@8.19.0)(magicast@0.5.5)(oxc-parser@0.150.0)(rolldown@1.2.12)(tsdown@0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1))(typescript@7.0.2)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)) '@wolfstar/http-framework-test-utils': specifier: ^4.0.2 - version: 4.0.2(@wolfstar/http-framework@6.1.1(acorn@8.19.0)(magicast@0.5.5)(oxc-parser@0.150.0)(rolldown@1.2.12)(tsdown@0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1))(typescript@7.0.2)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)))(vitest@5.0.3) + version: 4.0.2(@wolfstar/http-framework@6.2.2(acorn@8.19.0)(magicast@0.5.5)(oxc-parser@0.150.0)(rolldown@1.2.12)(tsdown@0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1))(typescript@7.0.2)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)))(vitest@5.0.3) '@wolfstar/kit': specifier: ^0.1.0 version: 0.1.1(magicast@0.5.5) @@ -2081,6 +2081,25 @@ packages: vite: optional: true + '@wolfstar/cli@2.6.0': + resolution: {integrity: sha512-CG0H8eDV4GW/iOK/vW4DQp6CpZa6VI/RLb/XuejhlGuCw9byODScVmvPXeX4/ksedU6K7e2c+2f3qgpc/vLAOA==} + engines: {node: '>=22'} + hasBin: true + peerDependencies: + nitro: '>=3.0.0-0' + tsdown: '>=0.15.0' + typescript: '>=5.0.0' + vite: '>=6.0.0' + peerDependenciesMeta: + nitro: + optional: true + tsdown: + optional: true + typescript: + optional: true + vite: + optional: true + '@wolfstar/http-framework-test-utils@4.0.2': resolution: {integrity: sha512-FAEoogghBHFj0OSkY7ppPmjcSCovcLKjCRbFaIJ3c9sbmv7lnWbbYInVBdrmJMLepJRLdpxOzabHHveCQ5pCKw==} engines: {node: '>=20'} @@ -2096,6 +2115,11 @@ packages: engines: {node: '>=20'} hasBin: true + '@wolfstar/http-framework@6.2.2': + resolution: {integrity: sha512-VTUU1lINeN/ng0SMIX9Zv6dWasouzvYCwgZnguGViGbFLwQab64haSZ97ZfhPHZRi0VnzhXN0qJAbO+RP/mq7Q==} + engines: {node: '>=20'} + hasBin: true + '@wolfstar/i18next-backend@2.0.12': resolution: {integrity: sha512-5Vq2l0LnUOzqBFZP/WtMaPb4aGua/wviNZ1xeWPgCYvsCgqgmWgB1tVcQcbioYp211fcw9xOaQxCcfXCB1TrUw==} engines: {node: '>=20'} @@ -2109,6 +2133,10 @@ packages: resolution: {integrity: sha512-0dk/A0H1EQy1Lc5X0Rv4TPEZhEoJV1vhGjGnc1RCBZnhkemA61K8+kF2kTR/YHDk3nEmo97NS3GR8K8zNDjiCw==} engines: {node: '>=20'} + '@wolfstar/kit@0.2.0': + resolution: {integrity: sha512-2Xy3gV/LQztOd/FNUqhE0vBR2e2YDYu4ypqNjVuAkkuoXewWlDmmm+8Cveaw8NmA1ya/EuMbjdmZ8qEkhYlsTQ==} + engines: {node: '>=20'} + '@wolfstar/nitro-server@0.2.6': resolution: {integrity: sha512-QnvuDuzSvNd6N6MjnSWle1Gqm+H2dLmfIftYEefpPWn6UTDeIw0npu2aG0cH6B6gYPsEVn5/QkApwqbgs3d2Kw==} engines: {node: '>=22'} @@ -2121,10 +2149,26 @@ packages: vite: optional: true + '@wolfstar/nitro-server@0.2.9': + resolution: {integrity: sha512-A5MRUjhkTVwHqKq57OIkyk2J3Dmf81p2uIFIXmOQICljuuu3Ml/O6wTLeDXGTUltxUwFtLq3fwek2GLoGmxfqA==} + engines: {node: '>=22'} + peerDependencies: + nitro: '>=3.0.0-0' + vite: '>=6.0.0' + peerDependenciesMeta: + nitro: + optional: true + vite: + optional: true + '@wolfstar/schema@0.6.0': resolution: {integrity: sha512-vK0RcEjT+M+hi0yFsgbBQ06XYQNUOWcgbWNgDSezMhjl3wjWIa5Vrt+u4m8hvIcezco3z4Y66sVdChXz95Qo4w==} engines: {node: '>=20'} + '@wolfstar/schema@0.9.0': + resolution: {integrity: sha512-panjxSXHYpmP1r0uZcJg1qgtdqxsADxOqgSPhktB7m75b2W609FplxzcsqFNcBWuoGGPkZeTBRbmATwupLhZNw==} + engines: {node: '>=20'} + '@wolfstar/vite-server@0.4.1': resolution: {integrity: sha512-3Ks5Q349KPN2mRjTW7ftNfH+8WhmdeltsXaTpfvqws3gXGretiAJDd3ovu1228URhBJszz+7dVR9EW/qVQ5WIg==} engines: {node: '>=22'} @@ -2134,6 +2178,15 @@ packages: vite: optional: true + '@wolfstar/vite-server@0.4.4': + resolution: {integrity: sha512-A37Y7O3Onq5Gj+phCfzJ3EriHahAaUIXkSPsn7c65E8H19ppeMTbDx0lISVq6YBa/hrdJnogf1HjmXqgeM56WA==} + engines: {node: '>=22'} + peerDependencies: + vite: '>=6.0.0' + peerDependenciesMeta: + vite: + optional: true + '@yuku-codegen/binding-android-arm64@0.10.2': resolution: {integrity: sha512-Oc2KInVkPfUjEB4PeV6X0NvIoyYTzDe/WmqFrTwBqKs6YKnz4A7XwWQvJTb7M0rLz9a6WgpUUiiS5QKaCi4O/g==} cpu: [arm64] @@ -5535,9 +5588,38 @@ snapshots: - react-devtools-core - utf-8-validate - '@wolfstar/http-framework-test-utils@4.0.2(@wolfstar/http-framework@6.1.1(acorn@8.19.0)(magicast@0.5.5)(oxc-parser@0.150.0)(rolldown@1.2.12)(tsdown@0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1))(typescript@7.0.2)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)))(vitest@5.0.3)': + '@wolfstar/cli@2.6.0(magicast@0.5.5)(tsdown@0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1))(typescript@7.0.2)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1))': + dependencies: + '@clack/prompts': 1.8.1 + '@sapphire/ts-config': 5.0.3 + '@wolfstar/kit': 0.2.0(magicast@0.5.5) + '@wolfstar/nitro-server': 0.2.9(magicast@0.5.5)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)) + '@wolfstar/schema': 0.9.0(magicast@0.5.5) + '@wolfstar/vite-server': 0.4.4(magicast@0.5.5)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)) + chokidar: 5.0.0 + citty: 0.2.2 + colorette: 2.0.20 + hookable: 6.1.2 + ink: 7.1.1(react@19.3.0) + mlly: 1.8.2 + my-bad: 0.2.10(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)) + nostics: 1.3.0 + react: 19.3.0 + untun: 0.2.2 + optionalDependencies: + tsdown: 0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1) + typescript: 7.0.2 + vite: 8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1) + transitivePeerDependencies: + - '@types/react' + - bufferutil + - magicast + - react-devtools-core + - utf-8-validate + + '@wolfstar/http-framework-test-utils@4.0.2(@wolfstar/http-framework@6.2.2(acorn@8.19.0)(magicast@0.5.5)(oxc-parser@0.150.0)(rolldown@1.2.12)(tsdown@0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1))(typescript@7.0.2)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)))(vitest@5.0.3)': dependencies: - '@wolfstar/http-framework': 6.1.1(acorn@8.19.0)(magicast@0.5.5)(oxc-parser@0.150.0)(rolldown@1.2.12)(tsdown@0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1))(typescript@7.0.2)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)) + '@wolfstar/http-framework': 6.2.2(acorn@8.19.0)(magicast@0.5.5)(oxc-parser@0.150.0)(rolldown@1.2.12)(tsdown@0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1))(typescript@7.0.2)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)) optionalDependencies: vitest: 5.0.3(@opentelemetry/api@1.9.1)(@types/node@22.15.21)(@vitest/coverage-v8@5.0.3)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)) @@ -5579,6 +5661,44 @@ snapshots: - vite - webpack + '@wolfstar/http-framework@6.2.2(acorn@8.19.0)(magicast@0.5.5)(oxc-parser@0.150.0)(rolldown@1.2.12)(tsdown@0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1))(typescript@7.0.2)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1))': + dependencies: + '@discordjs/builders': 1.14.1 + '@discordjs/collection': 2.1.1 + '@discordjs/rest': 2.6.3 + '@discordjs/util': 1.2.0 + '@sapphire/pieces': 4.4.1 + '@sapphire/result': 2.8.0 + '@sapphire/utilities': 3.18.2 + '@vladfrangu/async_event_emitter': 2.4.7 + '@wolfstar/cli': 2.6.0(magicast@0.5.5)(tsdown@0.23.0(@arethetypeswrong/core@0.18.5)(oxc-resolver@11.24.2)(publint@0.3.25)(typescript@7.0.2)(unrun@0.3.1))(typescript@7.0.2)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)) + '@wolfstar/schema': 0.9.0(magicast@0.5.5) + chokidar: 5.0.0 + discord-api-types: 0.38.56 + mlly: 1.8.2 + unimport: 7.0.2(acorn@8.19.0)(oxc-parser@0.150.0)(rolldown@1.2.12)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)) + transitivePeerDependencies: + - '@farmfe/core' + - '@rsbuild/core' + - '@rspack/core' + - '@types/react' + - acorn + - bufferutil + - bun-types-no-globals + - esbuild + - magicast + - nitro + - oxc-parser + - react-devtools-core + - rolldown + - rollup + - tsdown + - typescript + - unloader + - utf-8-validate + - vite + - webpack + '@wolfstar/i18next-backend@2.0.12': dependencies: tslib: 2.8.1 @@ -5602,6 +5722,13 @@ snapshots: transitivePeerDependencies: - magicast + '@wolfstar/kit@0.2.0(magicast@0.5.5)': + dependencies: + '@wolfstar/schema': 0.9.0(magicast@0.5.5) + semver: 7.8.5 + transitivePeerDependencies: + - magicast + '@wolfstar/nitro-server@0.2.6(magicast@0.5.5)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1))': dependencies: '@wolfstar/schema': 0.6.0(magicast@0.5.5) @@ -5613,6 +5740,17 @@ snapshots: transitivePeerDependencies: - magicast + '@wolfstar/nitro-server@0.2.9(magicast@0.5.5)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1))': + dependencies: + '@wolfstar/schema': 0.9.0(magicast@0.5.5) + '@wolfstar/vite-server': 0.4.4(magicast@0.5.5)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1)) + chokidar: 5.0.0 + picomatch: 4.0.7 + optionalDependencies: + vite: 8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1) + transitivePeerDependencies: + - magicast + '@wolfstar/schema@0.6.0(magicast@0.5.5)': dependencies: c12: 3.3.4(magicast@0.5.5) @@ -5620,6 +5758,13 @@ snapshots: transitivePeerDependencies: - magicast + '@wolfstar/schema@0.9.0(magicast@0.5.5)': + dependencies: + c12: 3.3.4(magicast@0.5.5) + nostics: 1.3.0 + transitivePeerDependencies: + - magicast + '@wolfstar/vite-server@0.4.1(magicast@0.5.5)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1))': dependencies: '@wolfstar/schema': 0.6.0(magicast@0.5.5) @@ -5629,6 +5774,15 @@ snapshots: transitivePeerDependencies: - magicast + '@wolfstar/vite-server@0.4.4(magicast@0.5.5)(vite@8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1))': + dependencies: + '@wolfstar/schema': 0.9.0(magicast@0.5.5) + srvx: 1.0.5 + optionalDependencies: + vite: 8.3.3(@types/node@22.15.21)(jiti@2.7.0)(yaml@2.9.1) + transitivePeerDependencies: + - magicast + '@yuku-codegen/binding-android-arm64@0.10.2': optional: true diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 3bf39760..e9e5a093 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -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"