diff --git a/.changeset/accept-kit-0-3.md b/.changeset/accept-kit-0-3.md new file mode 100644 index 00000000..c7ea4ba3 --- /dev/null +++ b/.changeset/accept-kit-0-3.md @@ -0,0 +1,14 @@ +--- +"@wolfstar/plugin-api": patch +"@wolfstar/plugin-broker": patch +"@wolfstar/plugin-cache": patch +"@wolfstar/plugin-gateway": patch +"@wolfstar/plugin-i18next": patch +"@wolfstar/plugin-logger": patch +"@wolfstar/plugin-opentelemetry": patch +"@wolfstar/plugin-scheduled-tasks": patch +"@wolfstar/plugin-sharder": patch +"@wolfstar/plugin-subcommands-advanced": patch +--- + +Accept `@wolfstar/kit` 0.3 and `@wolfstar/schema` 0.12 as peers, next to the previous ranges. diff --git a/.changeset/require-node-22.md b/.changeset/require-node-22.md new file mode 100644 index 00000000..71d6e512 --- /dev/null +++ b/.changeset/require-node-22.md @@ -0,0 +1,12 @@ +--- +"@wolfstar/plugin-api": major +"@wolfstar/plugin-i18next": major +"@wolfstar/plugin-subcommands-advanced": major +"@wolfstar/plugin-broker": minor +"@wolfstar/plugin-cache": minor +"@wolfstar/plugin-logger": minor +"@wolfstar/plugin-scheduled-tasks": minor +"@wolfstar/plugin-sharder": minor +--- + +Require Node.js 22 or later. Node.js 20 is no longer supported. diff --git a/AGENTS.md b/AGENTS.md index 12134fa9..55008130 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -19,7 +19,7 @@ There is **no runnable app, frontend, backend, dev server, or database**. "Runni ## Stack -- **Language:** TypeScript (`7.0.2` major, bumped from `~5.8.3`), Node `^22.11 || ^24 || >=26` (the range required by Changesets v3, raised from `>=20`; most published packages still declare `>=20.0.0`, `plugin-api` declares `>=20.18.1` (`undici`), `plugin-gateway` `>=24.17.0`, and `plugin-opentelemetry` `>=22.15.0` (the OpenTelemetry SDK packages)). `mise.toml` pins Node 24 + pnpm 12 (matches CI). +- **Language:** TypeScript (`7.0.2` major, bumped from `~5.8.3`), Node `^22.11 || ^24 || >=26` (the range required by Changesets v3, raised from `>=20`; published packages declare `>=22.0.0`, except `plugin-gateway` `>=24.17.0`, `plugin-opentelemetry` `>=22.15.0` (the OpenTelemetry SDK packages) and `plugin-i18next` `>=22.22.0` (`chokidar` 6)). `mise.toml` pins Node 24 + pnpm 12 (matches CI). - **Package manager:** `pnpm` (corepack-pinned via `packageManager` in root `package.json`; Renovate bumps it often — check that field for the exact pin, don't hardcode it here; if `pnpm` is ever missing, run `corepack enable`). Workspaces via `pnpm-workspace.yaml`. - **Monorepo runner:** `turbo` (`turbo run build`; `test` `dependsOn: ["^build"]`, so a build is triggered as needed). - **Bundler:** `tsdown` per package (→ `dist/esm/`, shared options in `scripts/tsdown.config.ts`). @@ -86,7 +86,7 @@ pnpm exec knip # unused code/dependency check (CI's - Non-trivial structural work (cross-package parity ports, manager/API redesigns, new plugin scaffolding) gets a design doc under `docs/superpowers/` before implementation: a plan at `docs/superpowers/plans/-.md` and, for anything with real design decisions, a matching spec at `docs/superpowers/specs/--design.md` (e.g. `docs/superpowers/specs/2026-10-05-message-types-parity-design.md`). PR descriptions for such changes link the spec/plan instead of re-explaining the design. Check this directory for prior art before redesigning an area that already has one. - Activation has two paths. `plugin-scheduled-tasks` and `plugin-opentelemetry` are module-only (their `./register` is a no-op); `plugin-opentelemetry` also ships a third entrypoint, `./preload` (loaded with `--import`), which starts the OpenTelemetry SDK before the bot's own imports run — `./register` cannot do this, since it only runs after the bot has already started importing. The older plugins ship `./module` (default export: `defineModule` from `@wolfstar/kit`, optional peer) and, for those with runtime hooks, `./plugin` (default export: a `definePlugin` factory); `./register` stays the legacy class + `Client.plugins.register*Hook` path for framework v3/v5/v6. Both call the same functions in `src/hooks.ts`, so change behaviour there. The `stars` CLI never imports `/register` itself; it only preloads the sources registered through `ctx.addPlugin`, so a user's own `import "/register"` (or passing the `./plugin` factory to `plugins` while also importing `/register`) still double-installs the hooks. `tests/module-entries.test.ts` checks that every `src/module.ts` (except `plugin-scheduled-tasks`, excluded on purpose) is exported, built and has kit and schema as optional peers. - `plugin-opentelemetry` has process-level tests (`tests/preload.test.ts`: worker thread, `SIGTERM`, WebSocket handshake) that spawn Node with the preload. The CI unit job runs vitest with no build, so the test builds `src/preload.ts` itself with `tsdown` into `packages/plugin-opentelemetry/node_modules/.cache/preload-test/`. The `SIGTERM` cases are skipped on Windows (a Windows process cannot handle the signal); run them in WSL or Linux. Interaction spans are made the active span with `context.attach` (`@opentelemetry/api` 1.10), because the framework's `*Run` events do not wrap the command. `protobufjs` is denied in `allowBuilds` (its postinstall is not needed). -- Module config keys: every `defineModule` sets `meta.configKey`, so a project writes the options under that top-level key of `stars.config` instead of the `[specifier, options]` tuple (the tuple is merged over the key and wins). Needs `@wolfstar/kit` `^0.2.0` (the peer and dev range of every package with a `src/module.ts`), and each `module.ts` augments `StarsConfig` from `@wolfstar/schema` (an optional peer and devDependency) to type the key. Keys: `plugin-api` `api`, `plugin-broker` `broker`, `plugin-cache` `cache`, `plugin-gateway` `gateway`, `plugin-i18next` `i18n`, `plugin-logger` `logger`, `plugin-opentelemetry` `opentelemetry`, `plugin-scheduled-tasks` `scheduledTasks`, `plugin-sharder` `sharder`, `plugin-subcommands-advanced` `subcommandsAdvanced`; `cache`, `gateway`, `sharder` and `subcommandsAdvanced` take no options yet and only reserve the name. A key must be unique and not a built-in key (`BUILT_IN_CONFIG_KEYS` of `@wolfstar/schema`); renaming one is a breaking change. `tests/module-config-keys.test.ts` runs every module through kit's `setupModules`. What sits under a key is written into the build, so it must be JSON. +- Module config keys: every `defineModule` sets `meta.configKey`, so a project writes the options under that top-level key of `stars.config` instead of the `[specifier, options]` tuple (the tuple is merged over the key and wins). Needs `@wolfstar/kit` `^0.2.0 || ^0.3.0` as the peer range (dev range `^0.2.0`) of every package with a `src/module.ts`, and each `module.ts` augments `StarsConfig` from `@wolfstar/schema` (an optional peer and devDependency) to type the key. Keys: `plugin-api` `api`, `plugin-broker` `broker`, `plugin-cache` `cache`, `plugin-gateway` `gateway`, `plugin-i18next` `i18n`, `plugin-logger` `logger`, `plugin-opentelemetry` `opentelemetry`, `plugin-scheduled-tasks` `scheduledTasks`, `plugin-sharder` `sharder`, `plugin-subcommands-advanced` `subcommandsAdvanced`; `cache`, `gateway`, `sharder` and `subcommandsAdvanced` take no options yet and only reserve the name. A key must be unique and not a built-in key (`BUILT_IN_CONFIG_KEYS` of `@wolfstar/schema`); renaming one is a breaking change. `tests/module-config-keys.test.ts` runs every module through kit's `setupModules`. What sits under a key is written into the build, so it must be JSON. ## Notes for agents diff --git a/packages/plugin-api/README.md b/packages/plugin-api/README.md index 8b996973..cfbdb4dd 100644 --- a/packages/plugin-api/README.md +++ b/packages/plugin-api/README.md @@ -27,7 +27,7 @@ claims every path on its port and 404s anything that doesn't match, so this plug pnpm add @wolfstar/plugin-api ``` -Requires Node.js `>=20.18.1`. +Requires Node.js `>=22.0.0`. ## Usage @@ -254,7 +254,7 @@ listeners log with `container.logger.fatal(error)` and answer a generic `500`. middleware have empty bodies. - Listener piece names are PascalCase (`PluginServerRequest`, …), and `ServerEvent.Error` carries an optional request/response. -- `@wolfstar/http-framework` peer range is `^3.6.0 || ^5.0.0`; Node.js `>=20.18.1`. +- `@wolfstar/http-framework` peer range is `^3.6.0 || ^5.0.0 || ^6.0.0`; Node.js `>=22.0.0`. ## Scope diff --git a/packages/plugin-api/package.json b/packages/plugin-api/package.json index c26e4ec1..5f05e57a 100644 --- a/packages/plugin-api/package.json +++ b/packages/plugin-api/package.json @@ -78,8 +78,8 @@ }, "peerDependencies": { "@wolfstar/http-framework": "^3.6.0 || ^5.0.0 || ^6.0.0", - "@wolfstar/kit": "^0.2.0", - "@wolfstar/schema": "^0.9.0" + "@wolfstar/kit": "^0.2.0 || ^0.3.0", + "@wolfstar/schema": "^0.9.0 || ^0.12.0" }, "peerDependenciesMeta": { "@wolfstar/kit": { @@ -90,6 +90,6 @@ } }, "engines": { - "node": ">=20.18.1" + "node": ">=22.0.0" } } diff --git a/packages/plugin-broker/package.json b/packages/plugin-broker/package.json index c3a0a26f..ca2440e0 100644 --- a/packages/plugin-broker/package.json +++ b/packages/plugin-broker/package.json @@ -81,8 +81,8 @@ }, "peerDependencies": { "@wolfstar/http-framework": "^3.4.0 || ^5.0.0 || ^6.0.0", - "@wolfstar/kit": "^0.2.0", - "@wolfstar/schema": "^0.9.0" + "@wolfstar/kit": "^0.2.0 || ^0.3.0", + "@wolfstar/schema": "^0.9.0 || ^0.12.0" }, "peerDependenciesMeta": { "@wolfstar/kit": { @@ -93,6 +93,6 @@ } }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } } diff --git a/packages/plugin-cache/package.json b/packages/plugin-cache/package.json index 2f55a1ba..b38ebc01 100644 --- a/packages/plugin-cache/package.json +++ b/packages/plugin-cache/package.json @@ -75,8 +75,8 @@ "msgpackr": "^2.1.0" }, "peerDependencies": { - "@wolfstar/kit": "^0.2.0", - "@wolfstar/schema": "^0.9.0", + "@wolfstar/kit": "^0.2.0 || ^0.3.0", + "@wolfstar/schema": "^0.9.0 || ^0.12.0", "msgpackr": "^2.0.0" }, "peerDependenciesMeta": { @@ -91,6 +91,6 @@ } }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } } diff --git a/packages/plugin-gateway/package.json b/packages/plugin-gateway/package.json index ac229a47..6646c37e 100644 --- a/packages/plugin-gateway/package.json +++ b/packages/plugin-gateway/package.json @@ -75,8 +75,8 @@ }, "peerDependencies": { "@wolfstar/http-framework": "^3.4.0 || ^5.0.0 || ^6.0.0", - "@wolfstar/kit": "^0.2.0", - "@wolfstar/schema": "^0.9.0" + "@wolfstar/kit": "^0.2.0 || ^0.3.0", + "@wolfstar/schema": "^0.9.0 || ^0.12.0" }, "peerDependenciesMeta": { "@wolfstar/kit": { diff --git a/packages/plugin-i18next/package.json b/packages/plugin-i18next/package.json index c46b9cbe..457e27d6 100644 --- a/packages/plugin-i18next/package.json +++ b/packages/plugin-i18next/package.json @@ -85,8 +85,8 @@ "peerDependencies": { "@wolfstar/http-framework": "^3.1.0 || ^5.0.0 || ^6.0.0", "@wolfstar/i18next-type-generator": "^3.0.0", - "@wolfstar/kit": "^0.2.0", - "@wolfstar/schema": "^0.9.0" + "@wolfstar/kit": "^0.2.0 || ^0.3.0", + "@wolfstar/schema": "^0.9.0 || ^0.12.0" }, "peerDependenciesMeta": { "@wolfstar/i18next-type-generator": { @@ -100,6 +100,6 @@ } }, "engines": { - "node": ">=20.0.0" + "node": ">=22.22.0" } } diff --git a/packages/plugin-logger/package.json b/packages/plugin-logger/package.json index dd68770d..6a1d3db5 100644 --- a/packages/plugin-logger/package.json +++ b/packages/plugin-logger/package.json @@ -99,8 +99,8 @@ }, "peerDependencies": { "@wolfstar/http-framework": "^3.4.0 || ^5.0.0 || ^6.0.0", - "@wolfstar/kit": "^0.2.0", - "@wolfstar/schema": "^0.9.0", + "@wolfstar/kit": "^0.2.0 || ^0.3.0", + "@wolfstar/schema": "^0.9.0 || ^0.12.0", "consola": "^3.0.0", "evlog": "^2.30.0", "winston": "^3.0.0" @@ -123,6 +123,6 @@ } }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } } diff --git a/packages/plugin-opentelemetry/package.json b/packages/plugin-opentelemetry/package.json index af924642..c415ef44 100644 --- a/packages/plugin-opentelemetry/package.json +++ b/packages/plugin-opentelemetry/package.json @@ -94,8 +94,8 @@ "peerDependencies": { "@opentelemetry/api": "^1.10.0", "@wolfstar/http-framework": "^6.1.0", - "@wolfstar/kit": "^0.2.0", - "@wolfstar/schema": "^0.9.0" + "@wolfstar/kit": "^0.2.0 || ^0.3.0", + "@wolfstar/schema": "^0.9.0 || ^0.12.0" }, "peerDependenciesMeta": { "@wolfstar/kit": { diff --git a/packages/plugin-scheduled-tasks/package.json b/packages/plugin-scheduled-tasks/package.json index 081a74a9..18572686 100644 --- a/packages/plugin-scheduled-tasks/package.json +++ b/packages/plugin-scheduled-tasks/package.json @@ -72,8 +72,8 @@ }, "peerDependencies": { "@wolfstar/http-framework": "^6.1.0", - "@wolfstar/kit": "^0.2.0", - "@wolfstar/schema": "^0.9.0" + "@wolfstar/kit": "^0.2.0 || ^0.3.0", + "@wolfstar/schema": "^0.9.0 || ^0.12.0" }, "peerDependenciesMeta": { "@wolfstar/schema": { @@ -81,6 +81,6 @@ } }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } } diff --git a/packages/plugin-sharder/package.json b/packages/plugin-sharder/package.json index 940b39f6..8bf7da88 100644 --- a/packages/plugin-sharder/package.json +++ b/packages/plugin-sharder/package.json @@ -69,8 +69,8 @@ "@wolfstar/schema": "^0.9.0" }, "peerDependencies": { - "@wolfstar/kit": "^0.2.0", - "@wolfstar/schema": "^0.9.0" + "@wolfstar/kit": "^0.2.0 || ^0.3.0", + "@wolfstar/schema": "^0.9.0 || ^0.12.0" }, "peerDependenciesMeta": { "@wolfstar/kit": { @@ -81,6 +81,6 @@ } }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } } diff --git a/packages/plugin-subcommands-advanced/package.json b/packages/plugin-subcommands-advanced/package.json index 7067784c..b44c1e84 100644 --- a/packages/plugin-subcommands-advanced/package.json +++ b/packages/plugin-subcommands-advanced/package.json @@ -78,8 +78,8 @@ }, "peerDependencies": { "@wolfstar/http-framework": "^3.1.0 || ^5.0.0 || ^6.0.0", - "@wolfstar/kit": "^0.2.0", - "@wolfstar/schema": "^0.9.0" + "@wolfstar/kit": "^0.2.0 || ^0.3.0", + "@wolfstar/schema": "^0.9.0 || ^0.12.0" }, "peerDependenciesMeta": { "@wolfstar/kit": { @@ -90,6 +90,6 @@ } }, "engines": { - "node": ">=20.0.0" + "node": ">=22.0.0" } } diff --git a/tests/module-entries.test.ts b/tests/module-entries.test.ts index ecfe5970..29a400b0 100644 --- a/tests/module-entries.test.ts +++ b/tests/module-entries.test.ts @@ -48,7 +48,7 @@ describe.each(entries)("$manifest.name module entries", ({ manifest, tsdown, has }); test("declares @wolfstar/kit as an optional peer and a devDependency", () => { - expect(manifest.peerDependencies?.["@wolfstar/kit"]).toBe("^0.2.0"); + expect(manifest.peerDependencies?.["@wolfstar/kit"]).toBe("^0.2.0 || ^0.3.0"); expect(manifest.peerDependenciesMeta?.["@wolfstar/kit"]?.optional).toBe(true); expect(manifest.devDependencies?.["@wolfstar/kit"]).toBeDefined(); });