- Update submodule `discord.js-selfbot-v13` to latest commit. - Create implementation plan for modernizing the vendored dependency, focusing on toolchain replacement with Biome and runtime dependency auditing. - Establish a design document outlining goals, scope, approach, toolchain design, runtime dependency design, and validation steps. - Ensure public API compatibility and maintain existing functionality during modernization efforts.
3.0 KiB
Vendor Selfbot Dependency Modernization Design
Goal
Modernize /mnt/code/bete/vendor/discord.js-selfbot-v13 aggressively by auditing runtime dependencies and replacing the legacy development toolchain with Biome, matching the root project style.
Scope
This work targets the vendored discord.js-selfbot-v13 submodule only, plus root lockfile/workspace updates required for the root app to consume it. The root app behavior and public import surface should remain compatible with the existing discord.js-selfbot-v13 API.
Approach
Audit all vendor dependencies and devDependencies against actual usage in src, typings, config files, and package scripts. Classify each package as keep, upgrade, remove, or replace. Apply changes aggressively, but only when usage evidence supports the change.
Replace the vendor's ESLint, Prettier, TSLint, and dtslint-based workflow with Biome. Keep TypeScript validation. Keep tsd only if the vendor has type assertion tests that tsc --noEmit cannot cover.
Toolchain Design
Vendor scripts should use Biome for linting and formatting:
lint:biome check . --diagnostic-level=errorformat:biome format --write .test:typescript:tsc --noEmitplustsdonly if type assertion tests existtest: run lint and TypeScript validation
Remove deprecated or redundant dev dependencies after scripts no longer reference them:
eslinteslint-config-prettiereslint-plugin-importeslint-plugin-prettierprettiertslintdtslint
Add @biomejs/biome to the vendor dev dependencies unless the workspace can reliably use the root Biome package for the vendor scripts.
Runtime Dependency Design
Runtime dependencies are reviewed one by one. Candidate packages include:
find-processtree-killprism-mediawerift-rtpfetch-cookietough-cookieqrcodeotplibwsundicidiscord-api-types@discordjs/builders@discordjs/collection@sapphire/async-queue@sapphire/shapeshift
For each dependency, search source usage before changing it. Remove unused packages. Upgrade packages that remain used. Replace packages when Node 20+ or a smaller maintained package covers the same use case without changing public behavior.
Validation
Validation must run in both vendor and root contexts:
- Vendor dependency install/update.
- Vendor lint with Biome.
- Vendor TypeScript/type validation.
- Root
pnpm installto refresh workspace lockfile. - Root
pnpm run typecheck. - Root
pnpm run lint. - Import smoke check from the root app to ensure
discord.js-selfbot-v13still resolves through the workspace link.
Stop Rules
Stop and ask before making a change that would intentionally alter the public discord.js-selfbot-v13 API, require ESM-only migration for the library entrypoint, or remove a runtime feature that the root app could use.
If a dependency upgrade requires broad internal rewrites, document the blocker and present options instead of forcing a risky migration.