This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
MultiPost is a browser extension that enables one-click content publishing to multiple social media platforms. Built with Plasmo framework, it supports 30+ platforms including Zhihu, Weibo, Xiaohongshu, Bilibili, X, Instagram, and more.
pnpm dev # Start development server with hot reload
pnpm build # Build and package extension for production
pnpm lint # Run ESLint
pnpm lint:fix # Auto-fix ESLint issuesNote: Do not run pnpm build for testing during development. Use pnpm dev instead.
The extension handles four content types, each with platform-specific implementations:
- Dynamic (
src/sync/dynamic/): Short-form posts (text, images) - Article (
src/sync/article/): Long-form articles with HTML/Markdown - Video (
src/sync/video/): Video uploads with metadata - Podcast (
src/sync/podcast/): Audio content
SyncData: Main payload containing platforms list, content data, and auto-publish flagPlatformInfo: Platform configuration including inject URL and functionDynamicData,ArticleData,VideoData,PodcastData: Content-specific interfaces
Each platform has an injectFunction that:
- Opens the platform's publishing page (
injectUrl) - Uses DOM manipulation to fill in content
- Handles file uploads and form submissions
Platform maps: DynamicInfoMap, ArticleInfoMap, VideoInfoMap, PodcastInfoMap
- Background (
src/background/): Service worker handling message routing, tab management, API services - Popup (
src/popup/): Extension popup UI - Sidepanel (
src/sidepanel/): Side panel interface - Content Scripts (
src/contents/): Page helpers and scrapers - Tabs (
src/tabs/): Standalone pages (publish, refresh-accounts, trust-domain)
Background script (src/background/index.ts) routes messages:
MULTIPOST_EXTENSION_PUBLISH: Opens publish popupMULTIPOST_EXTENSION_PUBLISH_NOW: Creates tabs and injects scriptsMULTIPOST_EXTENSION_PLATFORMS: Returns available platformsMULTIPOST_EXTENSION_GET_ACCOUNT_INFOS: Returns logged-in account info
- Framework: Plasmo 0.90.5 (Manifest V3)
- UI: HeroUI + Tailwind CSS
- Icons: lucide-react (prefer over @iconify/react)
- Storage: @plasmohq/storage
- Use interfaces over types
- Use maps instead of enums
- Use functional components with TypeScript interfaces
- Naming: PascalCase for components/interfaces, camelCase for functions/variables, SNAKE_CASE for constants
- Mobile-first responsive design
- Use
bg-backgroundandtext-foregroundfor theme support - Use semantic color variables (e.g.,
bg-primary-600notbg-blue-600) - Use
gapfor spacing instead of margins
- Store translations in
/locales/[locale]/messages.json - Use
chrome.i18n.getMessage('key')for all UI text - Default locale:
zh_CN - Console.log statements do not need i18n
- Create platform handler in appropriate directory (
src/sync/dynamic/,src/sync/article/, etc.) - Export inject function that manipulates the platform's DOM
- Add entry to corresponding InfoMap (e.g.,
DynamicInfoMapinsrc/sync/dynamic.ts) - Add account getter in
src/sync/account/if platform requires login detection - Add i18n keys for platform name