From 0cf3e8ed40ad9f305cdac2eda933ebb40a8dda92 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Thu, 9 Apr 2026 15:12:57 +0800 Subject: [PATCH] improve agent md --- AGENTS.md | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 92 +---------------------------------------------- GEMINI.md | 1 + 3 files changed, 108 insertions(+), 91 deletions(-) create mode 100644 AGENTS.md create mode 100644 GEMINI.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 000000000..68526d66d --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,106 @@ +# RustDesk Guide + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Development Commands + +### Build Commands +- `cargo run` - Build and run the desktop application (requires libsciter library) +- `python3 build.py --flutter` - Build Flutter version (desktop) +- `python3 build.py --flutter --release` - Build Flutter version in release mode +- `python3 build.py --hwcodec` - Build with hardware codec support +- `python3 build.py --vram` - Build with VRAM feature (Windows only) +- `cargo build --release` - Build Rust binary in release mode +- `cargo build --features hwcodec` - Build with specific features + +### Flutter Mobile Commands +- `cd flutter && flutter build android` - Build Android APK +- `cd flutter && flutter build ios` - Build iOS app +- `cd flutter && flutter run` - Run Flutter app in development mode +- `cd flutter && flutter test` - Run Flutter tests + +### Testing +- `cargo test` - Run Rust tests +- `cd flutter && flutter test` - Run Flutter tests + +### Platform-Specific Build Scripts +- `flutter/build_android.sh` - Android build script +- `flutter/build_ios.sh` - iOS build script +- `flutter/build_fdroid.sh` - F-Droid build script + +## Project Architecture + +### Directory Structure +- **`src/`** - Main Rust application code + - `src/ui/` - Legacy Sciter UI (deprecated, use Flutter instead) + - `src/server/` - Audio/clipboard/input/video services and network connections + - `src/client.rs` - Peer connection handling + - `src/platform/` - Platform-specific code +- **`flutter/`** - Flutter UI code for desktop and mobile +- **`libs/`** - Core libraries + - `libs/hbb_common/` - Video codec, config, network wrapper, protobuf, file transfer utilities + - `libs/scrap/` - Screen capture functionality + - `libs/enigo/` - Platform-specific keyboard/mouse control + - `libs/clipboard/` - Cross-platform clipboard implementation + +### Key Components +- **Remote Desktop Protocol**: Custom protocol implemented in `src/rendezvous_mediator.rs` for communicating with rustdesk-server +- **Screen Capture**: Platform-specific screen capture in `libs/scrap/` +- **Input Handling**: Cross-platform input simulation in `libs/enigo/` +- **Audio/Video Services**: Real-time audio/video streaming in `src/server/` +- **File Transfer**: Secure file transfer implementation in `libs/hbb_common/` + +### UI Architecture +- **Legacy UI**: Sciter-based (deprecated) - files in `src/ui/` +- **Modern UI**: Flutter-based - files in `flutter/` + - Desktop: `flutter/lib/desktop/` + - Mobile: `flutter/lib/mobile/` + - Shared: `flutter/lib/common/` and `flutter/lib/models/` + +## Important Build Notes + +### Dependencies +- Requires vcpkg for C++ dependencies: `libvpx`, `libyuv`, `opus`, `aom` +- Set `VCPKG_ROOT` environment variable +- Download appropriate Sciter library for legacy UI support + +### Ignore Patterns +When working with files, ignore these directories: +- `target/` - Rust build artifacts +- `flutter/build/` - Flutter build output +- `flutter/.dart_tool/` - Flutter tooling files + +### Cross-Platform Considerations +- Windows builds require additional DLLs and virtual display drivers +- macOS builds need proper signing and notarization for distribution +- Linux builds support multiple package formats (deb, rpm, AppImage) +- Mobile builds require platform-specific toolchains (Android SDK, Xcode) + +### Feature Flags +- `hwcodec` - Hardware video encoding/decoding +- `vram` - VRAM optimization (Windows only) +- `flutter` - Enable Flutter UI +- `unix-file-copy-paste` - Unix file clipboard support +- `screencapturekit` - macOS ScreenCaptureKit (macOS only) + +### Config +All configurations or options are under `libs/hbb_common/src/config.rs` file, 4 types: +- Settings +- Local +- Display +- Built-in + +## Rust Rules + +- In Rust code, do not introduce `unwrap()` or `expect()`. +- Allowed exceptions: +- Tests may use `unwrap()` or `expect()` when it keeps the test focused and readable. +- Lock acquisition may use `unwrap()` only when the locking API makes that the practical option and the failure mode is poison handling rather than normal control flow. +- Outside those exceptions, propagate errors, handle them explicitly, or use safer fallbacks instead of `unwrap()` and `expect()`. + +## Editing Hygiene + +- Do not introduce formatting-only changes. +- Do not run repository-wide formatters or reflow unrelated code unless the + user explicitly asks for formatting. +- Keep diffs limited to semantic changes required for the task. diff --git a/CLAUDE.md b/CLAUDE.md index 8d46e1fa1..c31706425 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,91 +1 @@ -# CLAUDE.md - -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. - -## Development Commands - -### Build Commands -- `cargo run` - Build and run the desktop application (requires libsciter library) -- `python3 build.py --flutter` - Build Flutter version (desktop) -- `python3 build.py --flutter --release` - Build Flutter version in release mode -- `python3 build.py --hwcodec` - Build with hardware codec support -- `python3 build.py --vram` - Build with VRAM feature (Windows only) -- `cargo build --release` - Build Rust binary in release mode -- `cargo build --features hwcodec` - Build with specific features - -### Flutter Mobile Commands -- `cd flutter && flutter build android` - Build Android APK -- `cd flutter && flutter build ios` - Build iOS app -- `cd flutter && flutter run` - Run Flutter app in development mode -- `cd flutter && flutter test` - Run Flutter tests - -### Testing -- `cargo test` - Run Rust tests -- `cd flutter && flutter test` - Run Flutter tests - -### Platform-Specific Build Scripts -- `flutter/build_android.sh` - Android build script -- `flutter/build_ios.sh` - iOS build script -- `flutter/build_fdroid.sh` - F-Droid build script - -## Project Architecture - -### Directory Structure -- **`src/`** - Main Rust application code - - `src/ui/` - Legacy Sciter UI (deprecated, use Flutter instead) - - `src/server/` - Audio/clipboard/input/video services and network connections - - `src/client.rs` - Peer connection handling - - `src/platform/` - Platform-specific code -- **`flutter/`** - Flutter UI code for desktop and mobile -- **`libs/`** - Core libraries - - `libs/hbb_common/` - Video codec, config, network wrapper, protobuf, file transfer utilities - - `libs/scrap/` - Screen capture functionality - - `libs/enigo/` - Platform-specific keyboard/mouse control - - `libs/clipboard/` - Cross-platform clipboard implementation - -### Key Components -- **Remote Desktop Protocol**: Custom protocol implemented in `src/rendezvous_mediator.rs` for communicating with rustdesk-server -- **Screen Capture**: Platform-specific screen capture in `libs/scrap/` -- **Input Handling**: Cross-platform input simulation in `libs/enigo/` -- **Audio/Video Services**: Real-time audio/video streaming in `src/server/` -- **File Transfer**: Secure file transfer implementation in `libs/hbb_common/` - -### UI Architecture -- **Legacy UI**: Sciter-based (deprecated) - files in `src/ui/` -- **Modern UI**: Flutter-based - files in `flutter/` - - Desktop: `flutter/lib/desktop/` - - Mobile: `flutter/lib/mobile/` - - Shared: `flutter/lib/common/` and `flutter/lib/models/` - -## Important Build Notes - -### Dependencies -- Requires vcpkg for C++ dependencies: `libvpx`, `libyuv`, `opus`, `aom` -- Set `VCPKG_ROOT` environment variable -- Download appropriate Sciter library for legacy UI support - -### Ignore Patterns -When working with files, ignore these directories: -- `target/` - Rust build artifacts -- `flutter/build/` - Flutter build output -- `flutter/.dart_tool/` - Flutter tooling files - -### Cross-Platform Considerations -- Windows builds require additional DLLs and virtual display drivers -- macOS builds need proper signing and notarization for distribution -- Linux builds support multiple package formats (deb, rpm, AppImage) -- Mobile builds require platform-specific toolchains (Android SDK, Xcode) - -### Feature Flags -- `hwcodec` - Hardware video encoding/decoding -- `vram` - VRAM optimization (Windows only) -- `flutter` - Enable Flutter UI -- `unix-file-copy-paste` - Unix file clipboard support -- `screencapturekit` - macOS ScreenCaptureKit (macOS only) - -### Config -All configurations or options are under `libs/hbb_common/src/config.rs` file, 4 types: -- Settings -- Local -- Display -- Built-in +AGENTS.md diff --git a/GEMINI.md b/GEMINI.md new file mode 100644 index 000000000..c31706425 --- /dev/null +++ b/GEMINI.md @@ -0,0 +1 @@ +AGENTS.md