Skip to content

Commit dd78331

Browse files
Copilotfinger563
andauthored
Add .github/copilot-instructions.md (#604)
* Initial plan * Add .github/copilot-instructions.md with repository guidelines Co-authored-by: finger563 <213467+finger563@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: finger563 <213467+finger563@users.noreply.github.com>
1 parent 94696fb commit dd78331

1 file changed

Lines changed: 113 additions & 0 deletions

File tree

.github/copilot-instructions.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Copilot Instructions for ESPP
2+
3+
## Repository Overview
4+
5+
ESPP (Espressif++) is a C++ component library for ESP32/ESP-IDF. It targets ESP-IDF v5.5.1+ and provides ~120 reusable components published to the [ESP Component Registry](https://components.espressif.com) under the `espp` namespace.
6+
7+
## Repository Structure
8+
9+
```
10+
components/ # All library components (one directory per component)
11+
doc/ # Documentation (Doxygen + Sphinx/RST)
12+
.github/workflows/ # CI: build.yml and upload_components.yml
13+
lib/ # External library submodules
14+
pc/ # PC-side utilities
15+
python/ # Python utilities
16+
```
17+
18+
## Component Structure
19+
20+
Every component follows this layout (use `components/task` as a reference):
21+
22+
```
23+
components/<name>/
24+
├── CMakeLists.txt # idf_component_register(...)
25+
├── README.md # Component overview
26+
├── idf_component.yml # IDF Component Manager manifest
27+
├── include/
28+
│ └── <name>.hpp # Public header(s)
29+
├── src/
30+
│ └── <name>.cpp # Implementation (if any)
31+
└── example/
32+
├── CMakeLists.txt # ESP-IDF project cmake
33+
├── README.md # Example documentation
34+
├── sdkconfig.defaults # Default config (add more for multiple targets)
35+
└── main/
36+
├── CMakeLists.txt # idf_component_register(...)
37+
└── <name>_example.cpp
38+
```
39+
40+
Some examples also include `partitions.csv` or multiple `sdkconfig.defaults.*` files for different hardware targets.
41+
42+
## When Adding a New Component
43+
44+
Complete **all** of the following steps (in alphabetical order where required):
45+
46+
### 1. Component Files
47+
- Create the full directory structure above under `components/<name>/`
48+
- `CMakeLists.txt`: use `idf_component_register(INCLUDE_DIRS "include" SRC_DIRS "src" REQUIRES ...)`
49+
- `idf_component.yml`: include license, description, url, repository, maintainers, documentation, examples, tags, and dependencies
50+
- `example/CMakeLists.txt`: set `EXTRA_COMPONENT_DIRS` to `"../../../components/"` and list required components
51+
52+
### 2. Documentation — `doc/Doxyfile`
53+
Add entries in **alphabetical order** to both sections:
54+
55+
```
56+
INPUT = \
57+
...
58+
$(PROJECT_PATH)/components/<name>/include/<name>.hpp \
59+
...
60+
61+
EXAMPLE_PATH = \
62+
...
63+
$(PROJECT_PATH)/components/<name>/example/main/<name>_example.cpp \
64+
...
65+
```
66+
67+
### 3. Documentation — `doc/en/`
68+
Add two files (use existing files as a template):
69+
70+
- `doc/en/<name>.rst` — RST page describing the component API. Include a `toctree` pointing to the example and an `include-build-file` directive for the API reference.
71+
- `doc/en/<name>_example.md` — Markdown file that simply includes the component's example README:
72+
````
73+
```{include} ../../components/<name>/example/README.md
74+
```
75+
````
76+
77+
If the component belongs to a logical group (e.g., `display`, `imu`, `network`), place the files in the appropriate subdirectory under `doc/en/`.
78+
79+
### 4. CI — `.github/workflows/build.yml`
80+
Add a matrix entry in **alphabetical order** inside the `strategy.matrix.test` list. Choose the most appropriate target (`esp32`, `esp32s3`, or `esp32p4`):
81+
82+
```yaml
83+
- path: 'components/<name>/example'
84+
target: esp32s3
85+
```
86+
87+
### 5. CI — `.github/workflows/upload_components.yml`
88+
Add the component path in **alphabetical order** inside the `components:` block:
89+
90+
```yaml
91+
components/<name>
92+
```
93+
94+
## Code Style
95+
96+
- C++20 standard
97+
- Follow `.clang-format` for formatting
98+
- Use `espp` namespace
99+
- Follow the patterns of existing components for logging (`espp::Logger`), configuration structs (`Config`), and task usage
100+
101+
## Building & Testing
102+
103+
- Build examples using ESP-IDF v5.5.1: `idf.py build` from the example directory
104+
- CI uses `espressif/esp-idf-ci-action@v1` with `esp_idf_version: v5.5.1`
105+
- Pre-commit hooks are configured in `.pre-commit-config.yaml`
106+
107+
## Keeping Things Up to Date
108+
109+
When modifying an **existing** component:
110+
- Update `README.md` and example `README.md` if behavior changes
111+
- Update `idf_component.yml` version as appropriate
112+
- Update the RST file in `doc/en/` if the API description changes
113+
- Keep all entries in `Doxyfile`, `build.yml`, and `upload_components.yml` in alphabetical order

0 commit comments

Comments
 (0)