This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
KolaBiliHelper is an Electron + Vue 3 desktop music player application for Bilibili.
- Frontend: Vue 3 + TypeScript + Composition API
- Desktop: Electron + electron-vite
- State: Pinia + pinia-plugin-persistedstate
- UI: Naive UI + Tailwind CSS 4 + SCSS
- Build: Vite + electron-vite
- Lint: ESLint 9 + @antfu/eslint-config
# Development
pnpm dev # Start dev environment
# Build
pnpm build # Type-check + electron-vite build
pnpm build:nocheck # Build without type checking
pnpm build:win/mac/linux # Platform-specific builds
# Type checking
pnpm typecheck # Both node and web
pnpm typecheck:node # Electron main process
pnpm typecheck:web # Vue renderer
# Linting
pnpm lint # Run ESLint
pnpm lint:fix # Auto-fix issueskolaBiliHelper/
├── electron/ # Electron main process
│ ├── main/ # Main process (Node.js): index, tray, ipcMain, utils
│ ├── preload/ # Preload scripts
│ └── server/ # Embedded HTTP server
├── src/ # Renderer (Vue 3)
│ ├── api/ # API modules (bilibili, search, wbi)
│ ├── assets/ # Static assets (CSS, SVG)
│ ├── components/ # Vue components
│ │ ├── card/ # SongCard
│ │ ├── common/ # TextContainer
│ │ ├── control/ # PlayerControl, Volume, Progress
│ │ ├── global/ # AppProvider, Loading, Like
│ │ ├── layout/ # Header, Sidebar
│ │ ├── list/ # SongList, SearchList
│ │ ├── menus/ # Context menus
│ │ └── modals/ # LoginModal, PlaylistModal, CloseAppModal
│ ├── hooks/ # Composables
│ ├── plugins/ # Plugins (store setup)
│ ├── router/ # Vue Router
│ ├── stores/ # Pinia stores (play, search, system, user)
│ ├── types/ # TypeScript definitions (app.d.ts)
│ └── utils/ # Utilities (request, adapter, player, helper, time)
├── constants/ # Constants
│ ├── ipcChannels.ts # IPC channel definitions
│ ├── pageId.ts # Page identifiers
│ ├── playStatus.ts # Play status constants
│ ├── renderer.ts # Renderer constants
│ ├── urls.ts # URL constants
│ └── browserExtension.ts # Browser extension constants
└── index.html
@/*→src/*@constants/*→constants/*
| Type | Convention | Examples |
|---|---|---|
| Variables, functions, refs, props, hooks | camelCase |
currentSong, usePlayStore |
| Components, component files | PascalCase |
SongCard.vue, PlayerControl |
| Constants | UPPER_SNAKE_CASE |
HISTORY_MAX, PLAY_MODE |
| Folders, HTML classes, slots, props in templates | kebab-case |
player-control, class="flex gap-2" |
| Interfaces, types | I prefix + PascalCase |
ISong, IPlaylist |
| Enums | E prefix + PascalCase |
EPlayState |
| API functions | api prefix |
apiGetUser, apiSearchSongs |
| Global state instances | store prefix |
storeUser, storePlay |
| Data transformers (global only) | transform prefix |
transformDate |
- Use
<script setup lang="ts">with Composition API - File names:
PascalCase.vue - Template access:
props.xxexplicitly (no destructuring) - Structure order: script → template → style
- Props ordering: visible → model → emit → setup
- Composition API style:
defineStore('name', () => {...}) - Use
storeToRefsfor reactive destructuring - Store files:
src/stores/{name}Store.ts - Export type:
PlaySongModeinplayStore.ts
- ipcChannels.ts: IPC channel strings (DATA_FROM_PLUGIN, PLAY_STATUS_CHANGE, WINDOW_*, etc.)
- pageId.ts: Page identifiers (HISTORY_PAGE, LIKED_PAGE, PLUGIN_PAGE)
- playStatus.ts: Playback status constants
- renderer.ts: Renderer constants (HISTORY_MAX)
- HTTP requests via axios
requestinstance inutils/request.ts - Bilibili APIs in
api/bilibili.ts,api/search.ts,api/wbi.ts - WBI signature for authenticated requests
- Strict type checking, avoid
any - Global types in
types/app.d.ts - Use interfaces for data structures
- Path aliases for imports
- Tailwind CSS for utility classes
- SCSS +
scopedfor custom styles - Theme colors via CSS variables
- Main process:
electron/main/ - Preload scripts:
electron/preload/ - IPC communication for renderer ↔ main
- Tray functionality in
electron/main/tray.ts - IPC channels defined in
constants/ipcChannels.ts
- Follow @antfu/eslint-config module ordering
- No inline exports
- All named exports at file end
- JSDoc/TSDoc comments for functions
- No semicolons
- Single quotes
- Trailing commas
interface ISong {
id: string
bvid: string
title: string
artist: string
pic: string
duration: number | string
url?: string
custom?: {
source?: 'browser-extension' | 'client-search'
}
}HISTORY_PAGE: Recently playedLIKED_PAGE: Liked songsPLUGIN_PAGE: Songs from browser extension
Format: feat(模块名): 描述、fix(模块名): 描述、test(模块名): 描述
Examples:
feat(player): 添加播放进度同步
fix(search): 修复搜索结果排序
refactor(api): 重构 WBI 签名逻辑