This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is koishi-plugin-emojiluna, a smart emoji management plugin for the Koishi chatbot framework. It provides AI-powered emoji categorization, storage management, and a Vue.js-based web interface.
# Build the project using Yakumo
yarn yakumo build
# or
yarn build
# Development workflow
yarn dep # Upgrade dependencies
yarn bump # Version management
yarn pub # Publish to npm# Lint TypeScript files
yarn eslint src --ext=ts
# or
yarn lint
# Auto-fix linting issues
yarn eslint src --ext=ts --fix
# or
yarn lint-fix-
Service Layer (
src/service.ts): MainEmojiLunaServicethat handles:- Emoji storage and management
- AI integration with ChatLuna
- Database operations (emojiluna_emojis, emojiluna_categories tables)
- File system operations for emoji storage
-
Configuration (
src/config.ts): Comprehensive configuration schema including:- AI model settings and prompts
- Storage and categorization options
- Auto-collection and trigger settings
- Backend API configuration
-
Commands (
src/commands.ts): CLI commands for emoji management- Basic emoji retrieval and search
- Image upload handling with AI analysis
- Category and tag management
-
Backend API (
src/backend.ts): HTTP endpoints for web interface integration -
Auto Collector (
src/autoCollector.ts): Automated emoji collection from group chats
- Vue 3 + Element Plus web interface in
client/directory - TypeScript throughout with strict configuration
- Component structure: Home, Tags, Categories views
- Integration with Koishi's client framework
- Koishi: Core chatbot framework
- ChatLuna: AI integration for emoji analysis and categorization
- @langchain/core: AI model abstraction
- Element Plus: Vue UI components
- Vue Router & i18n: Frontend navigation and internationalization
emojiluna_emojis: Main emoji storage (id, name, category, path, size, tags, created_at)emojiluna_categories: Category management (id, name, description, emoji_count, created_at)
The plugin integrates with ChatLuna for:
- Automatic categorization: AI analyzes images to suggest categories
- Content analysis: AI generates names, descriptions, and tags
- Batch processing: AI re-categorization of existing emojis
src/: TypeScript source codeclient/: Vue.js frontend componentslib/: Compiled TypeScript outputdist/: Frontend build output
- Uses Yakumo build system with esbuild
- ESLint with TypeScript, Standard, and Prettier rules
- Node 18+ requirement
- Supports both CommonJS output and ES modules
No specific test configuration found. Tests would likely use the Yakumo mocha integration mentioned in devDependencies.
- Emoji files are stored as PNG with UUID filenames
- AI prompts are highly customizable through configuration
- Supports automatic emoji collection from whitelisted groups
- Includes trigger word matching for automatic emoji responses
- Web interface provides comprehensive management capabilities
- dashboard.vue: Main control panel with three-tab navigation (Emoji Manager, Category Manager, Tag Manager)
- EmojiManager.vue: Main emoji management page with search, filter, batch operations, and preview
- CategoriesManager.vue: Category management page displaying category grid, click to enter category detail
- TagsManager.vue: Tag management page displaying tag grid, click to enter tag detail
- CategoryDetail.vue: Category detail page showing all emojis in the category, supports import/upload/batch move/delete
- TagDetail.vue: Tag detail page showing all emojis with the tag, supports add/remove tag/batch delete
- EmojiCard.vue: Emoji card component with selection mode and hover actions
- EmojiDialog.vue: Edit emoji dialog for modifying category and tags
- AddEmojiDialog.vue: Add emoji dialog supporting file upload and URL modes
- ImageSelector.vue: Image selector for importing from existing emojis
- emoji.vue: Emoji icon component
Called via @koishijs/client's send function:
emojiluna/getEmojiList(options)- Get emoji list (supports pagination, category, tag filtering)emojiluna/searchEmoji(keyword)- Search emojisemojiluna/addEmoji(emojiData)- Add single emojiemojiluna/addEmojis(emojisData[], aiAnalysis)- Batch add emojisemojiluna/deleteEmoji(id)- Delete emojiemojiluna/updateEmojiCategory(id, category)- Update emoji categoryemojiluna/updateEmojiTags(id, tags)- Update emoji tagsemojiluna/analyzeEmoji(id)- AI analyze emoji
emojiluna/getCategories()- Get all categoriesemojiluna/createCategory(name, description?)- Create categoryemojiluna/deleteCategory(name)- Delete category
emojiluna/getAllTags()- Get all tags
emojiluna/getBaseUrl()- Get base URL for emoji access
interface EmojiItem {
id: string
name: string
category: string
tags: string[]
size?: number
}
interface Category {
name: string
description?: string
emojiCount: number
}
interface EmojiAddOptions {
name: string
category: string
tags: string[]
imageData: string // base64 encoded image data
mimeType?: string
}
interface EmojiSearchOptions {
category?: string
tags?: string[]
limit?: number
offset?: number
}- Click selection button to enter selection mode, cards become selectable
- After selection, floating action bar appears at bottom for batch move and delete
- Uses Element Plus
el-dialogcomponent - Forms use
el-formwith validation rules - Supports creatable dropdown selects (categories, tags)
- Uses CSS Grid with auto-fill layout
- Responsive breakpoints for mobile adaptation
- Right-side floating navigation bar, expands on hover to show text
- On mobile, becomes fixed bottom navigation bar