This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
vShell is a desktop SSH client management tool (similar to FinalShell) built with Wails 3 (Go backend + Vue 3 frontend). It is a purely local application — no cloud/server components.
wails3 dev # Run in development mode with hot-reload
wails3 build # Build production executable
cd frontend && npm run build # Build frontend onlyFrontend-only (from frontend/):
npm run dev # Vite dev server
npm run build # vue-tsc + vite production build
npm run build:dev # vue-tsc + vite dev build (no minify)Go-only:
go build . # Build Go backend
go test ./... # Run testsapp/app.go—AppServiceis the Wails service exposing all bound methods to the frontend (CRUD for connections/groups/quick-commands, SSH connect/disconnect, SFTP operations, SSH key management, local filesystem access, file editing). It orchestrates the managers.app/sshconfig.go— SSH config file (~/.ssh/config) import/export logic.app/icons/— PNG menu bar icons (save, close) embedded via//go:embed.ssh/client.go—Managerholds active SSH sessions, handles connect/disconnect, buildsssh.ClientConfigwith encrypted credentials.ssh/session.go—Sessionwraps an SSH session with PTY. Uses aflushingWriterthat buffers stdout/stderr and emits events every 50ms to avoid per-byte overhead.ssh/monitor.go—Monitorreuses the SSH client to periodically exec commands (/proc/stat,/proc/meminfo, etc.) for server resource monitoring.sftp/manager.go+sftp/client.go— SFTP operations with a concurrency pool (3 concurrent transfers). Wrapsio.Reader/io.Writerfor progress tracking via events.portforward/forward.go— Local port forwarding vianet.Listen→ssh.Client.Dial→ bidirectionalio.Copy.zmodem/zmodem.go— Zmodem file transfer protocol support (minimal/stub).db/db.go— SQLite viamodernc.org/sqlite(pure Go, no CGO). Stored at~/Library/Application Support/vshell/vshell.db(macOS). Single connection (SetMaxOpenConns(1)).db/migrations.go— Inline SQL migrations run on startup. Tables:groups,connections,quick_commands,port_forwards.crypto/crypto.go— AES-256-GCM encryption for passwords, private keys, and passphrases stored in the database.models/— Data models:Connection,Group,QuickCommand,PortForward.
- UI Library: Naive UI (strict — never use Element Plus, Ant Design, or browser native dialogs).
- CSS Framework: UnoCSS (presetUno + custom theme colors/shortcuts in
uno.config.ts). - State: Pinia stores in
stores/—connection.ts,terminal.ts,sftp.ts,monitor.ts,settings.ts,layout.ts,transfers.ts,sshkey.ts,sshconfig.ts. - Routing: Vue Router.
- i18n:
vue-i18nwithlocales/zh-CN.tsandlocales/en.ts. - Terminal: xterm.js (
@xterm/xtermv6) with addons: fit, search, serialize, web-links, webgl. - Editor: Monaco Editor for remote file editing (
components/terminal/EditorTab.vue). - Charts: ECharts for server resource monitoring.
- Icons: Iconify with Lucide icon set, loaded via
unplugin-icons. - Components: Organized by domain —
sidebar/,terminal/,sftp/,monitor/,settings/,keys/,config/,activity/,panels/,common/. - Composables:
useTerminal.ts,useTerminalManager.ts,useEvents.ts,useShortcuts.ts,useDragTransfer.ts.
Terminal data must use Wails Events system, never Call/Bind:
- Input: xterm
onData→Events.Emit("terminal:stdin", {sessionID, data})→ Gosession.StdinPipe.Write(data) - Output: Go goroutine reads stdout →
flushingWriterbuffers and emits →Events.Emit("terminal:stdout", {sessionID, data})→ frontendxterm.write(data) - Resize: xterm
onResize→Events.Emit("terminal:resize", {sessionID, rows, cols})→ Gosession.WindowChange(rows, cols)
Backend-to-frontend uses Wails Event.Emit. Frontend-to-backend for terminal/streaming uses Events.Emit. CRUD operations use direct Wails service method calls (the application.NewService binding pattern).
Native menu actions (Settings, Save, Close Tab) are emitted from Go to frontend via Wails Events: menu:settings, menu:save, menu:close-tab.
- Terminal data: Always use Wails Events for terminal I/O — never use synchronous
Call/Bind. - Sensitive data encryption: Passwords, private keys, and passphrases must be encrypted with AES-256-GCM before database storage. Never store plaintext.
- UI components: Always use Naive UI components — no browser native
alert/confirm, no other UI libraries. - PTY requirement: SSH sessions must call
RequestPty("xterm-256color", ...)thenShell(), never exec single commands as interactive terminals. - No cloud features: This is a purely local desktop app. No server-side code, no cloud sync, no registration/login.
- No CGO: Use
modernc.org/sqlite(pure Go SQLite driver), notmattn/go-sqlite3.
- Wails config: Wails 3 uses
build/config.yml(notwails.json). App window options are inmain.goviaapplication.Options. - Vite port: Default
9245, configurable viaWAILS_VITE_PORTenv var. - Go version: 1.25.0
- Wails version: v3.0.0-alpha.92 (alpha API may change)