This file is the canonical repository instruction set for AI coding assistants.
Web++ is an evolving, cross-platform C++ web framework. It provides HTTP abstractions, static and dynamic routing,
protocol adapters, URI/Unicode processing, traits and allocator support, storage, I/O, and related utilities. The
project does not use C++ modules and has no src/ tree. Library implementation is predominantly template- and
header-based under webpp/, while CMake exposes it as the webpp static target.
Some prose documentation explicitly says that it is incomplete or outdated. Resolve conflicts in this order:
- Tests and the current implementation
CMakeLists.txt,CMakePresets.json, and CI- Component README files
- Root-level prose, old examples, and
todo.md
Never "fix" code merely to make it agree with stale prose.
Tie-breakers for the cases the order alone does not settle:
- When tests and the implementation disagree with each other, determine which side violates the pinned or current
standard (for URI/URL behavior use
tools/whatwg-url-specs) instead of siding with one by default. - When refreshed standards fixtures (e.g.,
tests/assets/whatwg/urltestdata.json) encode newer behavior than the snapshot pinned in a component README, the tests win; report the pin discrepancy and only update the pin with the user's approval.
cmake --preset dev-default # configure once (WEBPP_DEV=ON, build dir: build/)
cmake --build build --target test-uri -j $(nproc) # build one test: tests/foo_bar_test.cpp -> test-foo-bar
ctest --test-dir build -R '^test-uri$' --output-on-failure # run it; CI equivalent: ctest --preset tests -R ...
clang-format --dry-run -Werror <changed files> # format check before finishingBeware: plain ctest -R exits 0 when the filter matches nothing, so confirm the test actually ran (ctest -N -R '^test-uri$' lists matches). The test presets set noTestsAction=error and exit 8 instead.
webpp/: public library headers and implementationhttp/,headers/,cgi/,fcgi/, andprotocol/: HTTP models, routing, and protocol integrationuri/,unicode/, andip/: standards-sensitive parsing and normalizationtraits/,memory/, andstd/: customization, allocator propagation, STL aliases/polyfills, and iSTL helpersio/,async/,socket/, andconcurrency/: low-level and asynchronous facilitiesstorage/,db/,json/,crypto/,views/, andmiddleware/: framework services
tests/: unit tests (*_test.cpp), fuzz targets (*_fuzz.cpp), shared test support, and standards fixtures.tests/assets/whatwg/urltestdata.jsonis the vendored WPT URL fixture thattests/uri_whatwg_test.cppmirrors.examples/: runnable integration examplesbenchmarks/: focused performance experiments; do not treat benchmark code as the public APIsdk/: thewppandwsdkdeveloper toolscmake/,CMakeLists.txt, andCMakePresets.json: build configuration and dependency setupdocs/and componentREADME.mdfiles: project documentation.agents/skills/: agent skills (whatwg-url-specsfor the WHATWG URL Standard,webpp-build-testfor CMake/CTest)tools/: developer scripts, includingwhatwg-url-specsfor querying the WHATWG URL Standard
Component documentation map (read the closest one for the subsystem you touch):
| Topic | Files |
|---|---|
| Overview | README.md, webpp/README.md, docs/index.md |
| HTTP | webpp/http/README.md, webpp/headers/README.md, webpp/http/bodies/README.md |
| URI | webpp/uri/README.md |
| Unicode | webpp/unicode/README.md, webpp/unicode/details/README.md |
| Traits/STL/memory | webpp/traits/README.md, webpp/std/README.md, webpp/memory/README.md |
| I/O | webpp/io/README.md |
| Storage | webpp/storage/README.md |
| Middleware | webpp/middleware/README.md |
| SDK | sdk/README.md |
| Benchmarks | benchmarks/README.md |
When adding or removing a public header, update ALL_SOURCES_SHORT in webpp/CMakeLists.txt.
tools/whatwg-url-specs fetches, caches, and queries the WHATWG URL Standard. Use it when implementing or reviewing
standards-sensitive URI/URL behavior instead of relying on memory/instinct:
tools/whatwg-url-specs list # section/definition/algorithm tree
tools/whatwg-url-specs url-parsing # targeted section or term lookupThe whatwg-url-specs skill documents the full usage.
- Preserve the existing namespace and directory boundaries. Put code in the narrowest existing subsystem.
- Public library code must remain compatible with the target's C++20 baseline. Tests and GCC development builds may use C++23 where their CMake targets already request it. Do not raise the library baseline incidentally.
- Prefer the project's
webpp::stlcompatibility aliases for standard-library facilities where surrounding code uses them.webpp::istlis for Web++ extensions; it must not depend on unrelated Web++ subsystems. - Preserve concepts-based contracts, traits customization, allocator propagation, and character-type genericity.
Avoid silently replacing them with hard-coded
std::string,char, global allocation, or runtime polymorphism. - Preserve compile-time behavior in static routing and other constexpr-heavy code. Use
constexpr,consteval, concepts,static_assert,noexcept, and[[nodiscard]]when the semantics justify them, not as decoration. - Avoid adding virtual dispatch or ownership indirection on performance-sensitive paths without an explicit design reason.
- URI, IDNA, Unicode, HTTP, and IP behavior is standards-sensitive. Consult the relevant component README, fixtures, and nearby tests before changing it. Keep pinned-standard behavior unless the task explicitly requests an update or refreshed tests already encode newer behavior (see the tie-breakers).
- Do not hand-edit generated Unicode tables or imported fixtures without also preserving their generation/update path.
- Follow
.clang-format(4-space indentation, 120-column limit) and the applicable.clang-tidyconfiguration. Runclang-format --dry-run -Werroron changed files before finishing. - Match naming in the subsystem being edited. The codebase commonly uses
snake_casefor types, functions, variables, and aliases, and PascalCase for concepts and test suites. Do not impose an unrelated naming scheme or perform broad renames. - Keep the existing
WEBPP_*header guards and namespace-closing comments in public headers. - Add Doxygen-style documentation for new public APIs when the surrounding interface is documented.
- Keep includes minimal and consistent with nearby headers. Do not bypass
webpp::stl/polyfill boundaries casually. - Prefer focused changes. Do not combine requested work with unrelated cleanup.
- Search first: use ripgrep (or your own search tools) to locate the symbol, behavior, or expectation, then read only the relevant ranges. Do not re-read files whose relevant parts are already in your context, and consult the component doc map only for the subsystem you touch.
- Inspect the closest analogous implementation before editing.
- Make the smallest coherent change and add or update the closest focused test.
- Verify with the Quick Reference commands (the
webpp-build-testskill documents presets and drift). - If failures appear outside your change, establish a baseline before judging them:
git stashyour change, rebuild and rerun the same tests, compare the set of failing test names, thengit stash pop. Report pre-existing failures as a delta; do not fix unrelated failures unless asked. - Finish with
git statusandgit diff, and review every changed line.
Preserve pre-existing user changes. The user may be editing files concurrently: stage by explicit path
(git add <file>), never git add -A or git add .. Build directories, downloaded dependencies, IDE state, and
generated artifacts must not be committed.
Configure with the CI development configuration:
cmake --preset dev-defaultDerive focused test targets from their sources:
tests/uri_test.cpp -> test-uri
tests/http_parser_test.cpp -> test-http-parser
Build and run one test:
cmake --build build --target test-uri -j $(nproc)
ctest --test-dir build -R '^test-uri$' --output-on-failureFocused and CI presets (cmake --build --preset test-uri, ctest --preset tests ...) work as alternatives; the
webpp-build-test skill documents them. The preset lists in CMakePresets.json are enumerated manually and can lag
behind current tests/*_test.cpp sources — report such drift instead of editing the presets just to run one test.
For the complete unit-test suite, build the targets derived from current sources rather than trusting a stale
enumeration; -- -k keeps going past targets that fail to compile, and report those separately:
cmake --build build --target $(ls tests/*_test.cpp | sed 's|.*/||; s|_test\.cpp$||; s|_|-|g; s|^|test-|') \
-j $(nproc) -- -k
ctest --test-dir build --output-on-failureUse the named GCC, Clang, release, examples, or benchmark presets only when relevant to the change. Fuzz targets are
Clang-only when FUZZ_TESTS is enabled. A benchmark run is performance evidence, not a correctness test.
Always run real verification after code or build-system changes. Documentation-only and AI-configuration changes must still run their own format, parse, type-check, or smoke validation. Do not claim a command passed without its real exit status. If dependencies, compiler support, network access, or time prevents a check, report the exact command and reason.
Before finishing:
- Confirm the diff contains only intended files.
- State what changed and why.
- List the exact verification commands and results.
- Call out unverified platforms, standards edge cases, or compatibility risks.
- Commit messages: short imperative summary, optionally suffixed with
; #issue(e.g.Fix ipv6 bug; #774). - Do not commit, push, or open a pull request unless the user asks.