From 85b3773b05964f29030dc7edb17acfdc3f552434 Mon Sep 17 00:00:00 2001 From: Till Adam Date: Thu, 1 Jan 2026 20:19:56 +0100 Subject: [PATCH 1/4] Add CLAUDE.md for Claude Code guidance Provides build commands, testing instructions, architecture overview, and platform prerequisites to help Claude Code navigate the repository. --- CLAUDE.md | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000000..a2d982f8197 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,139 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project Overview + +Slint is a declarative GUI toolkit for building native user interfaces across embedded systems, desktops, mobile, and web platforms. UIs are written in `.slint` markup files and connected to business logic in Rust, C++, JavaScript, or Python. + +## Build Commands + +### Rust (Primary) +```sh +cargo build # Build the workspace +cargo build --release # Release build +cargo test # Run tests (requires cargo build first!) +cargo build --workspace --exclude uefi-demo --release # Build all examples +``` + +### Running Examples +```sh +cargo run --release -p gallery # Run the gallery example +cargo run --release --bin slint-viewer -- path/to/file.slint # View a .slint file +``` + +### C++ Build +```sh +cargo build --lib -p slint-cpp # Build C++ library +mkdir cppbuild && cd cppbuild +cmake -GNinja .. +cmake --build . +``` + +### Node.js Build +```sh +cd api/node && npm install +``` + +## Testing + +**Important**: Run `cargo build` before `cargo test` - the dynamic library must exist first. + +### Test Drivers +```sh +cargo test -p test-driver-interpreter # Fast interpreter tests +cargo test -p test-driver-rust # Rust API tests +cargo test -p test-driver-cpp # C++ tests (build slint-cpp first) +cargo test -p test-driver-nodejs # Node.js tests +cargo test -p doctests # Documentation snippet tests +``` + +### Filtered Testing +```sh +SLINT_TEST_FILTER=layout cargo test -p test-driver-rust # Filter by name +``` + +### Syntax Tests (Compiler Errors) +```sh +cargo test -p i-slint-compiler --features display-diagnostics --test syntax_tests +SLINT_SYNTAX_TEST_UPDATE=1 cargo test -p i-slint-compiler --test syntax_tests # Update expected errors +``` + +### Screenshot Tests +```sh +cargo test -p test-driver-screenshots # Compare against references +SLINT_CREATE_SCREENSHOTS=1 cargo test -p test-driver-screenshots # Generate references +``` + +## Architecture + +### Core Components + +- **`internal/compiler/`** - Slint language compiler (lexer, parser, code generators) + - `parser/` - .slint syntax parsing using Rowan + - `passes/` - Optimization passes + - `generator/` - Code generators for C++, Rust, Python, JS + - `tests/syntax/` - Syntax error test cases + +- **`internal/core/`** - Runtime library (properties, layout, animations, accessibility) + +- **`internal/interpreter/`** - Dynamic compilation for scripting languages + +- **`internal/backends/`** - Platform windowing/input: + - `winit/` - Cross-platform (primary) + - `qt/` - Qt integration + - `android-activity/`, `linuxkms/` + +- **`internal/renderers/`** - Rendering engines: + - `femtovg/` - OpenGL ES 2.0 + - `skia/` - Skia graphics + - `software/` - CPU-only fallback + +### Language APIs (`api/`) + +- `rs/slint/` - Rust public crate +- `rs/macros/` - `slint!` procedural macro +- `rs/build/` - Build script support +- `cpp/` - C++ API with CMake integration +- `node/` - Node.js bindings (Neon) +- `python/` - Python bindings (PyO3) + +### Tools + +- `tools/lsp/` - Language Server Protocol for editor integration +- `tools/compiler/` - CLI compiler +- `tools/viewer/` - .slint file viewer with hot reload + +### Key Patterns + +- Internal crates (`internal/`) are not semver-stable - they use exact version pinning +- FFI modules are gated with `#[cfg(feature = "ffi")]` +- C++ headers generated via `cargo xtask cbindgen` +- Extensive Cargo features control renderers (`renderer-femtovg`, `renderer-skia`, `renderer-software`) and backends (`backend-winit`, `backend-qt`) + +## Code Style + +- Rust: `rustfmt` enforced in CI +- C++: `clang-format` enforced in CI +- Linear git history preferred (rebase/squash merges) + +## Platform Prerequisites + +### Linux +```sh +# Debian/Ubuntu +sudo apt install libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev \ + libfontconfig-dev libssl-dev clang libavcodec-dev libavformat-dev \ + libavutil-dev libavfilter-dev libavdevice-dev libasound2-dev pkg-config +``` + +### macOS +```sh +xcode-select --install +brew install pkg-config ffmpeg +``` + +### Windows +- Enable symlinks: `git clone -c core.symlinks=true https://github.com/slint-ui/slint` +- Install MSVC Build Tools +- FFMPEG via vcpkg or manual installation From fb80c2d97ad193ab18c0c0ae68948dcc7254e2c1 Mon Sep 17 00:00:00 2001 From: Till Adam Date: Wed, 14 Jan 2026 16:38:48 +0100 Subject: [PATCH 2/4] rename the CLAUDE.md file to the more neutral AGENTS.md --- CLAUDE.md => AGENTS.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename CLAUDE.md => AGENTS.md (100%) diff --git a/CLAUDE.md b/AGENTS.md similarity index 100% rename from CLAUDE.md rename to AGENTS.md From d75eb90b35fa274f33606275e81820fc50ad1b2d Mon Sep 17 00:00:00 2001 From: Till Adam Date: Thu, 22 Jan 2026 11:43:03 +0100 Subject: [PATCH 3/4] Update AGENTS.md to reflect current codebase structure - Rename header from CLAUDE.md to AGENTS.md - Add missing internal components (core-macros, common) - Add missing backends (selector, testing) - Add missing tools (slintpad, figma_import, tr-extractor, updater) - Add wasm-interpreter API - Add new Editor Support section with all editor integrations --- AGENTS.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index a2d982f8197..a925e680fdf 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,6 +1,6 @@ -# CLAUDE.md +# AGENTS.md -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. +This file provides guidance to AI coding assistants when working with code in this repository. ## Project Overview @@ -77,12 +77,19 @@ SLINT_CREATE_SCREENSHOTS=1 cargo test -p test-driver-screenshots # Generate ref - **`internal/core/`** - Runtime library (properties, layout, animations, accessibility) +- **`internal/core-macros/`** - Procedural macros for i-slint-core + +- **`internal/common/`** - Shared code and data structures between compiler and runtime + - **`internal/interpreter/`** - Dynamic compilation for scripting languages - **`internal/backends/`** - Platform windowing/input: - `winit/` - Cross-platform (primary) - `qt/` - Qt integration - - `android-activity/`, `linuxkms/` + - `android-activity/` - Android platform support + - `linuxkms/` - Linux KMS/DRM direct rendering + - `selector/` - Runtime backend selection + - `testing/` - Testing backend for automated tests - **`internal/renderers/`** - Rendering engines: - `femtovg/` - OpenGL ES 2.0 @@ -97,12 +104,25 @@ SLINT_CREATE_SCREENSHOTS=1 cargo test -p test-driver-screenshots # Generate ref - `cpp/` - C++ API with CMake integration - `node/` - Node.js bindings (Neon) - `python/` - Python bindings (PyO3) +- `wasm-interpreter/` - WebAssembly bindings for browser use ### Tools - `tools/lsp/` - Language Server Protocol for editor integration - `tools/compiler/` - CLI compiler - `tools/viewer/` - .slint file viewer with hot reload +- `tools/slintpad/` - Web-based Slint editor/playground +- `tools/figma_import/` - Import designs from Figma +- `tools/tr-extractor/` - Translation string extractor for i18n +- `tools/updater/` - Migration tool for Slint version updates + +### Editor Support (`editors/`) + +- `vscode/` - Visual Studio Code extension +- `zed/` - Zed editor integration +- `kate/` - Kate editor syntax highlighting +- `sublime/` - Sublime Text support +- `tree-sitter-slint/` - Tree-sitter grammar for syntax highlighting ### Key Patterns From ed8d6d3f9b7d67e7f0da74bdf7cbb2b884161c01 Mon Sep 17 00:00:00 2001 From: Till Adam Date: Thu, 22 Jan 2026 11:57:11 +0100 Subject: [PATCH 4/4] Update AGENTS.md Co-authored-by: Simon Hausmann --- AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index a925e680fdf..62d37a39e3d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -32,7 +32,7 @@ cmake --build . ### Node.js Build ```sh -cd api/node && npm install +cd api/node && pnpm install ``` ## Testing