Skip to content

Commit d4b3b68

Browse files
committed
chore: improve support for agents
Signed-off-by: Henry Schreiner <henryfs@princeton.edu> Assisted-by: OpenCode:Kimi-K2.5 Assisted-by: Copilot:Claude-Haiku-4.5
1 parent fdb0d4f commit d4b3b68

2 files changed

Lines changed: 151 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- .github/workflows/copilot-setup-steps.yml
10+
pull_request:
11+
paths:
12+
- .github/workflows/copilot-setup-steps.yml
13+
14+
permissions: {}
15+
16+
jobs:
17+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
18+
copilot-setup-steps:
19+
runs-on: ubuntu-latest
20+
21+
# Set the permissions to the lowest permissions possible needed for your steps.
22+
# Copilot will be given its own token for its operations.
23+
permissions:
24+
contents: read
25+
26+
steps:
27+
- uses: actions/checkout@v5
28+
29+
- name: Install system dependencies
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y \
33+
doxygen \
34+
clang-tidy
35+
36+
- name: Install pre-commit hooks
37+
run: |
38+
pipx install prek
39+
prek install-hooks
40+

AGENTS.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# CLI11 Agent Guide
2+
3+
Header-only C++11 command line parser library. CMake is the primary build
4+
system; Meson and Bazel are also supported.
5+
6+
## Quick Build & Test
7+
8+
```bash
9+
# Default workflow (configure + build + test)
10+
cmake --workflow default
11+
12+
# Or manually
13+
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
14+
cmake --build build -j4
15+
cmake --build build --target test # or: cd build && ctest --output-on-failure
16+
```
17+
18+
## Running a Single Test
19+
20+
Tests are individual Catch2 executables in `build/tests/`.
21+
22+
```bash
23+
# Run one test executable directly
24+
./build/tests/AppTest
25+
26+
# Or via CTest with a regex
27+
ctest -R AppTest --output-on-failure
28+
```
29+
30+
## Key CMake Options
31+
32+
| Option | Default | Purpose |
33+
| -------------------------- | ----------------------- | --------------------------------------- |
34+
| `CLI11_BUILD_TESTS` | `ON` (if top-level) | Build Catch2 test suite |
35+
| `CLI11_BUILD_EXAMPLES` | `ON` (if top-level) | Build `examples/` |
36+
| `CLI11_BUILD_DOCS` | `ON` (if Doxygen found) | Build Doxygen docs |
37+
| `CLI11_SINGLE_FILE` | `OFF` | Generate single `CLI11.hpp` header |
38+
| `CLI11_PRECOMPILED` | `OFF` | Build static lib instead of header-only |
39+
| `CLI11_WARNINGS_AS_ERRORS` | `OFF` | Turn warnings into errors |
40+
| `CLI11_SANITIZERS` | `OFF` | Enable ASan/TSan/UBSan |
41+
| `CLI11_BOOST` | `OFF` | Enable Boost.Optional tests |
42+
| `CLI11_CUDA_TESTS` | `OFF` | Compile tests with NVCC |
43+
44+
`CLI11_SINGLE_FILE` and `CLI11_PRECOMPILED` are mutually exclusive.
45+
46+
## Presets
47+
48+
- `default` — Debug, Ninja, `CLI11_WARNINGS_AS_ERRORS=ON`, export compile
49+
commands.
50+
- `tidy` — Inherits `default`, adds `clang-tidy` with warnings-as-errors.
51+
52+
```bash
53+
cmake --preset tidy
54+
cmake --build --preset tidy
55+
```
56+
57+
## Single Header Generation
58+
59+
Requires Python. Enable with `CLI11_SINGLE_FILE=ON`:
60+
61+
```bash
62+
cmake -S . -B build -DCLI11_SINGLE_FILE=ON
63+
cmake --build build --target CLI11-generate-single-file
64+
# Output: build/single-include/CLI11.hpp
65+
```
66+
67+
Script: `scripts/MakeSingleHeader.py`.
68+
69+
## Library Structure
70+
71+
- `include/CLI/` — Public headers. The umbrella header is `CLI.hpp`.
72+
- `include/CLI/impl/``_inl.hpp` implementation headers included by the main
73+
headers.
74+
- `src/``.cpp` files used **only** when `CLI11_PRECOMPILED=ON`.
75+
- `single-include/` — CMake rules for the single-header build.
76+
- `tests/` — Catch2 tests. `main.cpp` + `catch.hpp` provide the test runner.
77+
- `tests/data/` — Test data files copied to the build dir automatically.
78+
- `examples/` — Standalone example programs.
79+
- `book/` — Extra documentation/examples built only when top-level.
80+
81+
## Testing Notes
82+
83+
- Catch2 is auto-downloaded (v2.13.10 header) if not found on the system. Both
84+
Catch2 v2 and v3 are supported.
85+
- Some tests launch helper applications (`ensure_utf8`, `ensure_utf8_twice`)
86+
built from `tests/applications/`.
87+
- `FuzzFailTest` requires C++17.
88+
- `WindowsTest` is only built on Windows.
89+
- `DeprecatedTest` compiles with `-Wno-deprecated-declarations`.
90+
- `TimerTest` is in `CLI11_MULTIONLY_TESTS` (exercises multi-threading).
91+
92+
## Code Style & Linting
93+
94+
Pre-commit hooks are configured in `.pre-commit-config.yaml`:
95+
96+
- `clang-format` for C++/C/CUDA
97+
- `cmake-format` for CMake
98+
- `black` for Python
99+
- `prettier` for YAML/Markdown/JSON/etc.
100+
- `codespell` for typos
101+
- `markdownlint-cli2`
102+
- Custom checks: disallow a few common mistakes Run locally:
103+
104+
```bash
105+
prek -a
106+
```
107+
108+
## Version Source of Truth
109+
110+
The version string is read from `include/CLI/Version.hpp` at configure time. Do
111+
not edit project version in `CMakeLists.txt`.

0 commit comments

Comments
 (0)