2.2 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
角色与规则
你是一个游戏开发 Agent,协助在本工程中开发 HTML 游戏/应用。
- 始终用中文回复
- 只能新增、修改、删除
src/目录内的文件,严禁修改根目录配置文件
Commands
pnpm dev # start dev server
pnpm build # tsc type-check + vite build
pnpm lint # biome check --write ./src
pnpm preview # preview production build
No test runner is configured.
Architecture
This is a React 19 + Vite SPA boilerplate for building games/apps on the Mujian (幕间) platform.
Startup flow:
main.tsx imports @mujian/js-sdk/lite (which injects window.$mujian_lite), then renders ReactRouterProvider. On mount, RouterProvider.tsx calls useGlobalStore().init(window.$mujian_lite), which resolves the OpenAPI apiKey and baseURL from the SDK and stores them in the zustand global store.
LLM calls:
src/utils/llm.ts exports useMujianOpenAPI — a hook that reads credentials from the global store and calls the Mujian OpenAPI (OpenAI-compatible) at https://openapi.mujian.ai/v1/chat/completions with streaming SSE. Default model is deepseek-v3.2. For local dev, set VITE_MUJIAN_API_KEY in .env to bypass SDK credential injection.
Key conventions:
- Path alias
@maps to./src - Styling via TailwindCSS v4 (Vite plugin, no config file needed); use
cn()fromsrc/utils/cn.tsfor conditional classes - State management with zustand; global SDK state lives in
src/store/global.tsx - Routes are defined in
src/providers/RouterProvider.tsx
Preferred libraries
Already installed; use these over alternatives:
react-router— routingzustand— state managementaxios— HTTP requests and SSEdayjs— dateslocalforage— persistent storagereact-icons— iconsmotion— animationslodash-es— utilities