This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Firefly is a feature-rich static blog theme built on Astro 6 with Svelte 5 for interactive components. It's a fork of Fuwari extended with extensive features. Primary language is Chinese (Simplified) with i18n for en, zh_TW, ja, ru.
| Command | Purpose |
|---|---|
pnpm dev |
Dev server at localhost:4321 |
pnpm build |
Production build (icons → LQIPs → Astro build → Pagefind indexing) |
pnpm preview |
Preview production build |
pnpm check |
astro check for type/error checking |
pnpm type-check |
tsc --noEmit --isolatedDeclarations |
pnpm lint |
Biome lint + auto-fix |
pnpm format |
Biome format |
pnpm new-post <filename> |
Scaffold a new blog post |
Package manager is pnpm (enforced). Node.js >= 22 required.
.astrocomponents for static content and layouts.sveltecomponents for interactive UI (search, settings, pagination, archive) — mounted withclient:loadorclient:visible- Swup.js handles SPA-like page transitions with multiple container targets
All features are toggled/configured via TypeScript files in src/config/, exported through the barrel at src/config/index.ts. Key configs:
siteConfig.ts— core site settings, theme, paginationsidebarConfig.ts— sidebar layout (left/right/both, widget ordering)commentConfig.ts,analyticsConfig.ts,fontConfig.ts, etc.
Layout.astro— base HTML shell (head, body, theme init, analytics, Swup hooks)MainGridLayout.astro— full page grid with sidebar(s), navbar, wallpaper, footer
Defined in src/content.config.ts:
posts— blog posts (.md/.mdx) with frontmatter: title, published, tags, category, draft, pinned, password, comment, etc.spec— special pages (about, guestbook)
src/components/— organized by domain:analytics/,comment/,common/,controls/,features/,layout/,misc/,pages/,widget/src/plugins/— 15 custom remark/rehype plugins (Mermaid, PlantUML, KaTeX, GitHub cards, reading time, etc.)src/i18n/— translation keys ini18nKey.ts, language files inlanguages/*.ts, lookup viatranslation.tssrc/utils/— content sorting, crypto (encrypted posts), date formatting, image processing/LQIP, TOC generationsrc/pages/— Astro file-based routingscripts/— build-time utilities (generate-icons.js,generate-lqips.ts,new-post.js)
@components/*, @assets/*, @constants/*, @utils/*, @i18n/*, @layouts/* → ./src/<dir>/*; @/* → ./src/*
- Biome enforces: tab indentation, double quotes, recommended lint rules
- Relaxed rules for
.svelte/.astrofiles (useConst off, noUnusedVariables off) - Commit convention: Conventional Commits (
feat:,fix:,chore:, etc.)
Multi-step: scripts/generate-icons.js → scripts/generate-lqips.ts → astro build → pagefind --site dist
Icons/LQIP data are generated into src/constants/ and committed. Regenerate with pnpm icons or pnpm lqips.
- Vercel (default,
vercel.json) - Cloudflare Workers (
wrangler.jsonc, setCF_WORKERSenv var) - Static output to
dist/