You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3
+
This file provides guidance to Claude Code when working with code in this repository.
4
4
5
5
## Project Overview
6
6
7
-
Framework System is a Rust library and CLI tool for interacting with Framework Computer hardware. It targets Linux, Windows, UEFI, and FreeBSD. The MSRV is 1.81.
7
+
Check the README.md for infos about the project and how to build.
8
+
9
+
If we're on NixOS we should build with `nix develop` shell for fast iteration.
10
+
We can also use `nix build` with various targets, for example to test windows build: `nix build .#windows`
8
11
9
12
## Development and Testing advice
10
13
@@ -13,77 +16,4 @@ Most commands must be run as root, try to run them with sudo, usually I have fin
13
16
By default build in debug mode that's way faster than `--release` builds.
14
17
On every commit all builds, lints and tests must keep working.
15
18
We also must not break other platforms (Windows, Linux, FreeBSD, UEFI).
16
-
17
-
## Build Commands
18
-
19
-
```bash
20
-
# Build library and CLI tool (default members: framework_lib, framework_tool)
21
-
cargo build
22
-
cargo build --release
23
-
24
-
# Build with specific features
25
-
cargo build -p framework_lib --features nvidia
26
-
27
-
# Build UEFI application (separate target, not in default workspace members)
28
-
cd framework_uefi && make
29
-
30
-
# Run tests (only framework_lib has tests)
31
-
cargo test -p framework_lib
32
-
33
-
# Linting (CI enforces -D warnings)
34
-
cargo clippy -- -D warnings
35
-
cargo fmt --check
36
-
37
-
# Generate docs (CI enforces -D warnings)
38
-
RUSTDOCFLAGS="-Dwarnings" cargo doc
39
-
40
-
# Generate shell completions (must stay in sync; CI checks this)
41
-
cargo run -- --completions bash > completions/bash/framework_tool
42
-
cargo run -- --completions zsh > completions/zsh/_framework_tool
43
-
cargo run -- --completions fish > completions/fish/framework_tool.fish
44
-
```
45
-
46
-
## Architecture
47
-
48
-
### Workspace Structure
49
-
50
-
-**framework_lib/** — Core library. Contains all hardware interaction logic, command parsing, and platform abstractions. Supports `no_std` (for UEFI) via the `uefi` feature flag.
51
-
-**framework_tool/** — Thin CLI binary wrapping `framework_lib::commandline`. Entry point is ~55 lines.
52
-
-**framework_uefi/** — UEFI shell application. Built separately via Makefile (not a default workspace member). Uses `no_std` with `alloc`.
53
-
54
-
### Key Modules in framework_lib
55
-
56
-
-`chromium_ec/` — Chrome EC controller communication. Multiple driver backends: `cros_ec` (Linux kernel), `portio` (direct I/O for UEFI/FreeBSD), `windows` (Windows driver). Commands defined in `commands.rs`.
57
-
-`ccgx/` — USB Power Delivery controller (CCG5/CCG6/CCG8) firmware parsing and device management. `binary.rs` handles firmware binary parsing.
58
-
-`commandline/` — CLI implementation. `clap_std.rs` for std platforms (uses clap), `uefi.rs` for UEFI-specific parsing.
59
-
-`smbios.rs` — SMBIOS table parsing for hardware identification.
60
-
-`power.rs` — Battery, AC adapter, and PD port information.
61
-
-`csme.rs` — Intel CSME/ME firmware info parsing.
62
-
-`util.rs` — Platform detection and identification. `Platform` enum identifies specific hardware models. Platform detection is cached globally via `lazy_static`.
-**no_std compatibility:** UEFI builds use `#![no_std]` with `alloc`. `lazy_static` uses `spin::Mutex` for no_std, `std::sync::Mutex` for std. Custom `no_std_compat` wrapper bridges standard library types.
-`rusb` — USB device access (audio card, camera, input modules)
77
-
-`nvidia` — NVIDIA GPU monitoring
78
-
79
-
### Custom Dependency Forks
80
-
81
-
The project patches `uefi`, `uefi-services`, and uses custom forks of `smbios-lib` and `rust-hwio` for no_std/FreeBSD support. See `[patch.crates-io]` in the root Cargo.toml.
82
-
83
-
## CI Pipeline
84
-
85
-
Runs on every push: Linux build, Windows build, UEFI build, FreeBSD build, tests, lints (clippy + fmt), doc generation. CI also verifies shell completions are up-to-date and that no untracked changes are introduced by the build.
86
-
87
-
## Test Binaries
88
-
89
-
`framework_lib/test_bins/` contains firmware binary dumps and SMBIOS dumps used for unit tests. Tests parse these files to validate binary parsing logic.
19
+
Shell completions should also be updated if we change the commandline, see completions/README.md
0 commit comments