Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# AGENTS.md

> This file is read automatically by AI coding agents before making any changes to the codebase.

## What this repo is

The Lilka SDK — a PlatformIO library (`lib/lilka/`) that provides hardware abstractions for the Lilka console (ESP32-S3/C3). It is consumed by [KeiraOS](https://github.com/lilka-dev/keira) as a sibling directory dependency.

## Non-obvious conventions

- `String` (Arduino) is the only Arduino type allowed — use it for all string handling; prefer esp-idf for everything else
- Use `#pragma once` — never `#ifndef` include guards (some legacy headers still use `#ifndef`, don't copy that pattern)
- All SDK subsystems are exposed as `extern` singletons (e.g. `lilka::board`, `lilka::audio`, `lilka::resources`) — never instantiate them manually
- Hardware pin numbers must come from `lilka/config.h` `LILKA_GPIO_*` / `LILKA_*` defines — never hardcode GPIO numbers
- Images loaded via `lilka::resources.loadImage()` are heap-allocated — always `delete` them after use
- Always use C-style file API (`fopen`, `fread`, `fwrite`, `fclose`) with canonical paths (`/sd/...`, `/spiffs/...`) — never use `SD.open()`, `SPIFFS.open()`, or any Arduino filesystem wrappers
- Use `vTaskDelay()` instead of `delay()`

## What not to touch

- `lib/lilka/src/lilka/version_auto_gen.h` — auto-generated at build time
- `lib/lilka/src/contrib/` — vendored third-party code, don't reformat
- `.pio/` — generated by PlatformIO

## Adding a new subsystem

- Add header to `lib/lilka/src/lilka/`
- Expose a single `extern` singleton instance
- Include it in `lib/lilka/src/lilka.h`
- Initialize in `lilka::begin()` (`lib/lilka/src/lilka/sdk.cpp`)
- Document public API with Doxygen (`///` comments)

## Adding icons/images

- Place PNG in `lib/lilka/src/lilka/icons/`
- Run `make icons` — it converts PNGs to `.h` files via `tools/image2code/image2code.py`
- Never hand-edit generated `.h` image files

## Code quality

- clang-format-20 enforced in CI
- Run `make clang-format` and `make cppcheck` before committing — both must pass
- Run `make check` to run both at once
- `make todo` lists all `TODO` / `FIXME` / `XXX` in the codebase
- `make guidelines` lists all `GUIDELINE` comments — read them before changing related code
Loading