@automattic/commands is a config-driven CMD+K command palette for React, built on top of cmdk. The planned public API lets a consumer pass a flat Command[] and get a themed palette with fuzzy search, route variable resolution, recently-used tracking, and zero CSS import.
The repo is currently a buildable, testable, publishable skeleton. src/index.ts is a one-line re-export of Command from cmdk. Planned work will replace it with the config-driven <Commands> wrapper.
- Language: TypeScript, strict mode,
react-jsxtransform - UI: React 18+ (peer dependency), cmdk (runtime dependency)
- Bundler: tsup — dual ESM/CJS +
.d.tsoutput todist/ - Tests: Vitest + React Testing Library, jsdom environment, tests co-located as
*.test.ts(x) - Playground: Vite, served from
playground/ - Lint: ESLint 9 flat config via
@automattic/eslint-plugin-wpvip(recommended preset) - Format:
wp-prettier(tabs, single quotes, spaces inside brackets) - Package manager: pnpm (pinned via
packageManager: pnpm@10.14.0). Do not use npm or yarn. - Node: 24 from
.nvmrc
This repo pins Node 24 (.nvmrc) and pnpm 10.14.0 (packageManager in package.json).
- Activate Node 24:
- nvm:
nvm use - fnm:
fnm use
- nvm:
- Make pnpm available via Corepack (once per Node version):
corepack enable- Corepack picks up
packageManager: pnpm@10.14.0frompackage.jsonand fetches the right version on first use.
- Install dependencies:
pnpm install
| Command | What it does |
|---|---|
pnpm install |
Install dependencies |
pnpm build |
Build ESM + CJS + types to dist/ via tsup |
pnpm dev |
Start Vite playground with HMR against src/ at :5173 |
pnpm dev:dist |
Build with tsup, then serve the playground against dist/ |
pnpm test |
Run Vitest once |
pnpm test:watch |
Run Vitest in watch mode |
pnpm lint |
ESLint |
pnpm lint:fix |
ESLint with --fix |
pnpm format |
Prettier --write |
pnpm format:check |
Prettier --check (used by CI) |
src/ Library source and co-located tests
playground/
vite.config.ts Aliases @automattic/commands to src/ or dist/ via --mode
.nvmrc Pins Node 24
.prettierrc Extends wp-prettier
eslint.config.js ESLint 9 flat config
tsconfig.build.json Library-only, used by tsup
tsconfig.json IDE + ESLint, noEmit, wider include
tsup.config.ts Bundler config, points at tsconfig.build.json
vitest.config.ts Test runner config (jsdom)
vitest.setup.ts jest-dom matchers + ResizeObserver shim
- Publishing surface is
src/index.ts. tsup follows that entry; anything not reachable from it does not ship. - Keep the two tsconfigs separate.
tsconfig.build.jsonis tsup-only;tsconfig.jsonis for IDE + ESLint withnoEmit. Don't merge them. - Tests go next to source as
*.test.ts(x)and run in jsdom.ResizeObserveris shimmed invitest.setup.tsbecause cmdk needs it. - For everything else, let the lint preset and
pnpm format:checktell you what to fix.
pnpm lint— cleanpnpm format:check— clean (usepnpm formatto auto-fix)pnpm test— passespnpm build— producesdist/index.js,dist/index.cjs,dist/index.d.ts,dist/index.d.cts- UI and playground changes can't be verified by
pnpm test. Runpnpm devand inspect in a browser, or flag that UI verification is pending.
- Subject line: imperative, capitalized, ≤50 chars, no trailing period
- Body: explain why — what problem the change solves, what it replaces
- Keep commits atomic; split refactors from behavior changes
- PR description: Summary + What changed + Manual testing checklist