This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
MouseInc.Settingsis the Vue 3 + TypeScript settings UI for the MouseInc desktop app.- The UI is not standalone in normal use: it talks to a local MouseInc process over WebSocket and edits MouseInc JSON config data.
# install deps
npm install
# start dev server (opens browser)
npm run dev
# production build
npm run build
# preview built output
npm run preview
# lint all source files
npm run lint
# lint with autofix
npm run lint:fix
# lint a single file (closest equivalent to a single-test workflow)
npx eslint src/view/switch.vue- There is currently no automated test runner configured in this repository (
package.jsonhas notestscript, and there are no project test files undersrc/,test/, ortests/). - Validation is currently lint + manual UI verification.
- MouseInc can open the localhost dev settings page when launching settings while holding
SHIFT. - WebSocket endpoint is built in
src/components/main/main.vueasws://127.0.0.1:{port}/ws.portcomes from URL query paramport; falls back to80.
- Main message flow:
- on connect: send
{"type":"load_settings"} - on save: send
{"type":"save_settings","config":"<formatted JSON string>"} - on reset: send
{"type":"reset_settings"}
- on connect: send
src/main.tscreates app, router, Vuex store, and i18n.- Language is normalized from localStorage key
local(zh-CN/zh-TW/en-US) with fallback tozh-CN.
src/components/main/main.vueis the primary shell:- sidebar + breadcrumb + header actions + page content
- WebSocket connection lifecycle
- save/reset/refresh actions
modifiedstate detection and save button enablement
- Route definitions live in
src/router/routers.ts. - Main groups:
/(switches/exclusions)/gesture(gesture behavior, gesture list, global/custom matches, demo)/other(edge/corner/copy/hotkey/keycast/i18n)
src/router/index.tsadds loading overlay and updates page title after navigation.
src/store/index.tsholds:cfg: current MouseInc config objectgestures: gesture preview map (sign -> image)local: current UI localebreadCrumbList
setSettingsperforms compatibility normalization (notably defaultingOcrServiceandHotCorner) and injectsWheelSwitchUp/Downfromplaceholdergesture assets.- Many pages edit nested
cfgdirectly; this is an existing pattern in this codebase.
- Pages under
src/view/*.vueeach edit different config domains (switch,settings,list,match,custom_match, etc.). src/view/components/json.vueis a key shared action editor:- dual UI/raw modes
- JSON repair via
jsonrepair - formatting via
js-beautify
src/libs/util.tsbuilds menu/breadcrumb from routes and resolves translated titles.- Locale files are in
src/locale/lang/*.js. src/config/index.tsenables i18n (useI18n: true) and defines default home route name (switch).
src/index.lessdefines global design tokens and system dark/light theme viaprefers-color-scheme.src/styles/common.lessprovides shared page/card/table/dialog utility styles used across view pages.
vite.config.jskey behavior:- base path:
/mouseinc/ - aliases:
@ -> src,_c -> src/components - auto-import/plugins for Vue, Vue Router, Vuex, Vue I18n, and Element Plus
- CSS injected by JS (
vite-plugin-css-injected-by-js) andcssCodeSplit: false - hashed output filenames with manual
vendorchunk
- base path:
- CI workflow:
.github/workflows/build-and-package.ymlruns onmainpush/PR, uses Node 22, and executesnpm install+npm run build.
docs/docs/config.mddocuments MouseInc config keys and action structure (MouseGesture,MatchGlobal,MatchCustom,Hotkeys,WheelEdge,HotCorner, etc.).- When uncertain about a field shape, align with
docs/docs/config.mdand current runtime usage insrc/view/*+src/store/index.ts.