Butter CMS Utilities is an unofficial, client-side utility suite for Butter CMS. It provides tools not available out of the box, runs entirely in the browser, and stores all configurations in the browser local storage.
Current features: Search Content (across pages, collections, and blog posts), Audit for ugly HTML (across pages, collections, and blog posts)
Stack: Vue 3 (Composition API), TypeScript (Strict), Vite, Pinia, SCSS, Vitest, pnpm
pnpm install # Install dependencies
pnpm run dev # Start dev server (http://localhost:5173)
pnpm run build # Build for production
pnpm run typecheck # TypeScript type checking - must pass before completion
pnpm run lint # ESLint with auto-fixes - must pass before completion
pnpm run format # Format with Prettier - must pass before completion
pnpm run test:unit # Run Vitest (add file path for specific tests) - must pass before completionVue Components:
- Always use
<script setup lang="ts">with Composition API - PascalCase filenames (e.g.
SearchContent.vue) - Full prop types:
defineProps<{ ... }>() - Emit events with camelCase names:
defineEmits<{ ... }>() - Never mutate props - emit events to parent instead
TypeScript:
- Strict mode enabled - no
anytypes - Use type inference where clear, explicit types for props/interfaces
- Prefer
unknownoveranyfor truly dynamic values
Reactivity & performance:
ref()for primitives and arraysshallowRef()for large arrays/objects that are always replaced wholesale, never mutated deeply (e.g., search result lists)reactive()only for complex objectscomputed()for derived statev-memoonv-forlists to optimize re-renders- Use
defineAsyncComponent()where appropriate - Fail fast and handle errors gracefully
- This project can often deal with large datasets and needs to crawl large JSON objects
Component Design:
- Single responsibility principle
- Reuse existing components before creating new ones
Design:
- All design tokens are defined in _variables.scss and _colors.scss
- Use clean, legibility-first design
- No UI frameworks
- Use existing components from
src/components/where possible - Aim for WCAG 2.2 AA accessibility standard
Testing:
- New unit tests to be added for everything
src/core/andsrc/features/aim for 95%+ coverage- Everything else aim for 90%+ coverage
- All tests should test something meaningful
Pinia with localStorage persistence:
- App loads → hydrates from
localStorage.butter_cms_config - User updates config → watchers save to localStorage
- Store has single
configref with deep watchers
Important: Maintain backwards compatibility for localStorage schemas
- Tone: Professional, helpful, concise
- Privacy: Emphasize client-side execution, zero data collection, read-only token (never write permission token)
- Add new features to
featuresarray insrc/components/WhatsNew.vue. Modal auto-shows based onbutter_cms_last_visitlocalStorage key. - Update
./README.mdand./agents.mdwhen key changes are made to the project