Package
seedcord v0.22.0

About
seedcord is the CLI a bot project runs during development and at build time. It reads seedcord.config.ts and gives you a dev server with hot reload, a production build, the codegen that types your commands, and a way to deploy those commands to Discord.
It loads your bot through Vite every time, with any Vite plugin you add. Those plugins, your .env modes, and bundled data files you set up in dev work the same way in the build. One seedcord build makes a Node or Bun server, a single Bun binary, a Cloudflare Worker, or a package another app installs and starts.
seedcord is pre-1.0, so a minor version can break your bot. Each release's changelog says what changed and how to update.
Installation
pnpm create seedcord adds it to a new project. To add it to an existing one:
pnpm add -D seedcord viteRun it through your project's scripts, like pnpm dev. A global seedcord throws CliNotProjectInstall, because the CLI has to load the same seedcord packages your bot imports.
Commands
| command | what it does |
|---|---|
seedcord dev |
runs the bot from the config file, reloading changed modules in place |
seedcord build |
type checks the bot and bundles it into outDir with Vite. An edge bot builds into a Cloudflare worker |
seedcord codegen |
writes the typed augmentations for your commands and config |
seedcord commands |
deploys, lists and cleans up your commands on Discord |
codegen --check verifies the committed augmentations match your source. Run it in CI.
commands reads DISCORD_BOT_TOKEN from your environment or .env:
seedcord commands # pick what to do from a menu
seedcord commands deploy # show what changes, then ask before deploying
seedcord commands deploy --yes # deploy without asking
seedcord commands deploy --force # also deploy scopes that match the last deploy
seedcord commands list # show the commands Discord has
seedcord commands list --all-guilds # include every guild the bot is in
seedcord commands list --json # print them as JSON
seedcord commands clean # pick guilds, then delete commands that duplicate a global one
seedcord commands clean --all-guilds # list those duplicates in every guild
seedcord commands clean --all-guilds --yes # delete them
seedcord commands purge # pick where, then delete every command there
seedcord commands purge --guilds 111 222 # list every command in those guilds
seedcord commands purge --global --yes # delete every global commandIn CI, or anywhere without a terminal, nothing changes on Discord unless you pass --yes.
On the http transport, dev also opens a cloudflared tunnel and points Discord's interactions URL at it.
Pass --verbose to any command for the resolved config and full error stacks.
Config
defineConfig types seedcord.config.ts:
import yaml from '@rollup/plugin-yaml';
import { defineConfig } from 'seedcord';
export default defineConfig({
root: './src',
instance: './bot.ts',
build: { start: './index.ts' },
files: ['./locales'],
vitePlugins: () => [yaml()]
});instanceis the file that exports your bot.build.startis the file that starts it. Leave it out to build the bot as a package.fileslists the folders of data files the build bundles. The bot reads them withreadFiles.vitePluginstakes any Vite plugin, and each one runs in dev and in the build. With the YAML plugin above, a handler can import a.yamlfile.
ENV=staging pnpm build builds in staging mode and loads your .env.staging files. envapt reads the same mode in your bot.
The config guide covers every key.
Edge bots
A cloudflare.config.ts beside seedcord.config.ts turns an http bot into a Cloudflare Worker. seedcord dev runs it in workerd, and seedcord build writes a worker you deploy with cf deploy --prebuilt. The Workers guide covers the setup.