@wolfstar/http-framework. They live outside this
repository, in wolfstar-project/plugins, and release on their own
schedule. Adding one never bumps the core framework, and the framework has no required dependency on any of them.
Available plugins
Browse the source on GitHub or the generated
API reference for the full surface of each one.
Installing a plugin
Activating a plugin with modules
On @wolfstar/http-framework 6.1 and later, every plugin ships a ./module entry. List it in modules in
stars.config, and the stars CLI installs it while it loads the project. Set the
module’s options under its own top-level key of stars.config. The module entries need the optional
@wolfstar/kit peer dependency at ^0.2.0 || ^0.3.0, so install it next to the plugin.
meta.configKey:
The
cache, gateway, sharder, and subcommandsAdvanced keys take no options yet. They only reserve the name.
The [specifier, options] tuple of modules still works. Its options are merged over the key, so they win.
The optional @wolfstar/schema peer dependency types each key in defineConfig.
TypeScript only loads that type once the module is imported, so import the module in stars.config.ts.
The CLI writes module options into the built entry, so they must be JSON-serialisable. Set anything else, such as
functions, client instances, or per-process values, through the plugin’s ClientOptions key. Each plugin merges that
key over the module options.
What a module does depends on the plugin:
plugin-i18next,plugin-api,plugin-logger,plugin-broker,plugin-opentelemetry, andplugin-subcommands-advancedregister their runtime plugin in the bot.plugin-cache,plugin-gateway, andplugin-sharderare libraries. Their module only adds the package to the auto imports, and takes no options. You still construct their classes yourself.
Without the stars CLI
Plugins that register hooks also ship a ./plugin entry: a definePlugin
factory. Pass it to the plugins client option:
The /register fallback
The side-effecting /register entry point still works on framework v3, v5, and v6. Import it before the client is
created, with configuration passed as a client option:
Registering only modules
By default, thestars CLI activates every installed @wolfstar/plugin-* package that is not a module by injecting
its /register import. Set future.compatibilityVersion: 7 to let stars.config alone decide what registers. Only
the packages in modules, and the modules they install, are then registered:
PLUGINS_NOT_REGISTERED about an installed plugin that no module
covers. List that plugin in modules, import it in the bot yourself, or go back to version 6. Below version 7,
stars info (the by name row) and stars doctor (the plugins check) list the plugins still registered through
/register.
Check each plugin’s package page for its exact entry points and options. See
@wolfstar/plugin-i18next, @wolfstar/plugin-api,
@wolfstar/plugin-logger, and
@wolfstar/plugin-subcommands-advanced.
Coming from @wolfstar/http-framework-i18n?
That package has been removed. Its replacement is @wolfstar/plugin-i18next. Follow the migration guide.
Writing your own plugin
A plugin has two parts:- A runtime plugin, defined with
definePluginfrom@wolfstar/http-framework. It names itself and implements the client lifecycle hooks it needs, each called with(client, options). - A module, defined with
defineModulefrom@wolfstar/kit. It lets projects activate the plugin frommodulesinstars.config, and registers the runtime plugin by source.
./plugin and ./module. Projects that use the stars CLI list
my-plugin/module in modules. Other projects pass the ./plugin factory to the plugins client option.
Read an existing plugin’s source, such as
plugin-i18next, as a template, and
open a pull request against wolfstar-project/plugins to have it
added to this list.