Skip to content

Latest commit

 

History

History
90 lines (69 loc) · 3.95 KB

File metadata and controls

90 lines (69 loc) · 3.95 KB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Project Overview

EcuBus-Pro is an open-source automotive ECU (Electronic Control Unit) development and testing tool built with Electron. It serves as an alternative to commercial tools like CAN-OE.

Key Features:

  • Cross-platform (Windows, Linux, macOS)
  • Multi-hardware support (PEAK, Kvaser, Vector, ZLG, Toomotss, EcuBus-LinCable, SLCAN, GS_USB)
  • Protocol support: CAN/CAN-FD, LIN, DoIP, SOME/IP
  • UDS diagnostic capabilities
  • TypeScript-based scripting and HIL testing framework
  • DBC/LDF database support
  • Panel builder for custom UI creation

Architecture

This is an Electron application with a clear separation between main and renderer processes:

Main Process (src/main/):

  • docan/ - CAN protocol native module (C++)
  • dolin/ - LIN protocol native module (C++)
  • doip/ - DoIP protocol implementation
  • uds/ - Unified Diagnostic Services
  • vsomeip/ - SOME/IP protocol with C++ bindings
  • worker/ - Third-party scripts provided to users (must run npm run worker:js after any changes)
  • ipc/ - IPC communication handlers

Renderer Process (src/renderer/src/):

  • Vue 3 + TypeScript frontend
  • views/ - UI pages (home, uds, ostrace, etc.)
  • stores/ - Pinia state management
  • router/ - Vue Router
  • database/ - DBC/LDF/ORTI parsers

CLI (src/cli/): Command-line interface for automation

Development Commands

Command Description
npm run dev Start development server with HMR
npm run build Build production version (runs typecheck first)
npm run start Preview production build
npm run test Run tests with Vitest
npm run lint Run ESLint with auto-fix
npm run format Run Prettier format
npm run typecheck Run TypeScript type checks for both node and web
npm run worker Build worker processes (requires Python/build tools)
npm run worker:js Build worker scripts (JS only) - MUST RUN after any changes to src/main/worker/
npm run native Build all native modules (docan, dolin, someip)
npm run docan Build CAN native module
npm run dolin Build LIN native module
npm run someip Build SOME/IP native module
npm run build:win Build for Windows (NSIS installer)
npm run build:linux Build for Linux (deb, rpm)
npm run build:mac Build for macOS
npm run docs:dev Start VitePress docs dev server
npm run docs:build Build VitePress documentation

Note: Native module builds require Python and build tools (Visual Studio on Windows, gcc on Linux).

Key Configuration Files

  • package.json - Dependencies, scripts, and vendor hardware support config
  • electron-builder.yml - Electron builder configuration
  • electron.vite.config.ts - Vite configuration for Electron
  • tsconfig.json, tsconfig.node.json, tsconfig.web.json - TypeScript configs
  • vitest.config.ts - Vitest test configuration
  • webpack.config.js - Webpack config for workers

Internationalization

The project uses i18next for internationalization with support for English and Chinese. Translation files are located in resources/locales/.

Frontend Development Guidelines

UI Component Library:

  • Prefer using Element Plus components for all UI implementation
  • For tables:
    • Simple tables: Use el-table (from Element Plus)
    • Complex tables: Use vxe-table

Important Notes

SWIG Generated Files: All *_wrap.cxx files are generated by SWIG (Simplified Wrapper and Interface Generator). These files should be ignored and never modified manually. They are generated from the corresponding .i interface files.

Worker Scripts: The src/main/worker/ directory contains scripts provided to third-party users, all code in here should has detailed typedoc format comments. Any changes to this directory must be followed by running npm run worker:js to rebuild the worker scripts.