diff --git a/.agents/skills/webcpp-build-and-lanes/SKILL.md b/.agents/skills/webcpp-build-and-lanes/SKILL.md new file mode 100644 index 00000000..3ca01fae --- /dev/null +++ b/.agents/skills/webcpp-build-and-lanes/SKILL.md @@ -0,0 +1,35 @@ +--- +name: webcpp-build-and-lanes +description: "Build and test webcpp: targets (native, wasip2, wasip3, emscripten), a library's lanes and own lanes, the Jamfile rules, the report, CI, and what counts as green." +--- + +# Building and testing webcpp + +The rules are in `AGENTS.md`: chapter 1 ("Prerequisites", "The build commands"), chapter 9 +(Targets, The Jamfile API, Tests, Lanes, The report, CI), chapter 10 (Process) and chapter 12 (b2 +facts). The CI is `.github/workflows/library.yml`, which `ci.yml` and each library call. + +## Iterating on one library +``` +unset CPATH CPLUS_INCLUDE_PATH C_INCLUDE_PATH +b2 libs//test libs//example +b2 toolset=clang-wasip2 testing.launcher=wasmtime libs//test libs//example # and clang-wasip3 +b2 toolset=emscripten libs//test libs//example # no launcher +b2 declared-targets -d0 && b2 declared-lanes -d0 # what CI will run +``` +One toolset per command. Test and example Jamfiles use only the `webcpp.*` rules of chapter 9. + +## A lane, as CI runs it +`b2 -a --dump-tests --out-xml=.xml toolset= libs//test libs//example`, +then `tools/report/report.py`; b2's exit status is not the verdict. `tools/ci/matrix.py` runs +plan, lane and own lane the CI's way. Parallel lanes use distinct `--build-dir`. + +## Green, before asking for a merge (chapter 10) +1. Every declared lane and own lane from scratch (`b2 -a`), oracle included. +2. `b2 -a doc`. +3. `tools/lint/lint.sh ...` prints `lint: clean`. +4. Every `tools/**/*_test.py` whose subject changed. +5. CI green, the library's and the superproject's. + +## When something is odd +Read chapter 12 before debugging b2: most surprises are recorded there. diff --git a/.agents/skills/webcpp-docs-site-release/SKILL.md b/.agents/skills/webcpp-docs-site-release/SKILL.md new file mode 100644 index 00000000..7cfeea65 --- /dev/null +++ b/.agents/skills/webcpp-docs-site-release/SKILL.md @@ -0,0 +1,26 @@ +--- +name: webcpp-docs-site-release +description: "Write a library's page and Doc Comments, build the site, or prepare a release of webcpp." +--- + +# Docs, site and releases + +The rules are in `AGENTS.md`: chapter 7 (Doc Comments and the API reference), chapter 8 +(Documentation), chapter 9 ("The site", "CI") and chapter 11 ("The changelog", "Releases"). The +site's own rules are `site/AGENTS.md`, and its specification is the organization's `site` +capability in webcpporg/proposals. + +## A library's page +1. Doc Comments for every public symbol, with the commands chapter 7 allows. +2. The page's sections as chapter 8 lists them; C++ only by include of an example or a tagged region. +3. Counts by the build's attributes (`{n-tests}` ...), never typed. +4. `b2 -a libs//doc` passes doc-check and MrDocs strict. + +## The site +`b2 site` (preview) or `b2 site -sWEBCPP_SITE=release -sWEBCPP_SITE_VERSION=`, then +`b2 site-serve`. The superproject's CI builds and publishes the preview; nothing is published by hand. + +## A release +Only when the owner asks, following chapter 11's numbered steps: `b2 check-release`, +`b2 whats-new` (the owner approves the highlights), `b2 -a dist`; the tag and the GitHub Release +are the owner's. diff --git a/.agents/skills/webcpp-library-conventions/SKILL.md b/.agents/skills/webcpp-library-conventions/SKILL.md new file mode 100644 index 00000000..29fba1ad --- /dev/null +++ b/.agents/skills/webcpp-library-conventions/SKILL.md @@ -0,0 +1,28 @@ +--- +name: webcpp-library-conventions +description: "Create, review or specify a webcpp library: its names, layout, configuration header, errors and exceptions, and the checklist of a new library." +--- + +# A webcpp library's conventions + +The rules are in `AGENTS.md`: chapter 2 ("The checklist of a new library", "Third-party code"), +chapter 3 (Names), chapter 6 (C++ rules, C libraries, exceptions and RTTI, what the lint +enforces), chapter 7 (Doc Comments). A library's own `AGENTS.md` adds only what is specific to it. + +## New library +1. Choose the kind: own, port (skill `webcpp-port-methodology`) or wrapper. +2. Until the owner makes `webcpporg/`, work in a local `git init` at `libs/`. +3. Write the checklist files of chapter 2: `meta/libraries.json`, `build.jam` (target + `/webcpp///`), README, `AGENTS.md`, licence files, `doc/changelog.adoc`, CI calling + the superproject's `library.yml`. +4. `/config.hpp>` includes `` first and defines + `WEBCPP__NO_EXCEPTIONS`; every public header includes it first. +5. See `b2 libs//test` build the headers-alone tests of an empty convenience header. + +## Reviewing code +- Names against the table of chapter 3: namespace `webcpp::`, `detail`, macros + `WEBCPP__*`, include guards, error category `webcpp.`, snake_case. +- Errors as values; headers that must compile without exceptions do; allocation as specified. +- What a target lacks is declared, not skipped (chapter 9, "Tests"). +- Every public symbol documented (skill `webcpp-docs-site-release`). +- The lint: `tools/lint/lint.sh` (chapter 6) prints `lint: clean`. diff --git a/.agents/skills/webcpp-port-methodology/SKILL.md b/.agents/skills/webcpp-port-methodology/SKILL.md new file mode 100644 index 00000000..225926ba --- /dev/null +++ b/.agents/skills/webcpp-port-methodology/SKILL.md @@ -0,0 +1,30 @@ +--- +name: webcpp-port-methodology +description: "Port a library from another language into webcpp, or specify such a port: choosing and pinning the original, its licence, the oracle and twins, and fidelity." +--- + +# Porting a library + +The rules are in `AGENTS.md`: chapter 2 ("Choosing"), chapter 4 (Fidelity), chapter 5 (Evidence: +oracle and twins) and chapter 10 ("Porting a library, step by step"). xstate is the model +(`libs/xstate/AGENTS.md`, `libs/xstate/test/oracle/`). + +## Steps +1. Pin the original at an exact release; record it in `meta/libraries.json` (`"port-of"`) and the + library's `AGENTS.md`. Check its licence against chapter 2; keep its notice in + `LICENSE-.txt`. +2. Make `libs/` (skill `webcpp-library-conventions`). +3. Port the original's tests as data-driven cases; write the oracle in `test/oracle/` (the pinned + original, its scripts, the Jamfile with `webcpp.original`, `webcpp.cases`, `webcpp.twins`, + `webcpp.lane`); write expected results only with `b2 libs//test/oracle//update-expected`. + See the cases fail. +4. Port the code header by header, with Doc Comments, until the cases pass natively, then on every + declared target. +5. Write the page: the guide with each example's twin, the guarantees, the testing chapter, the + reference and the appendix "Differences", each difference with `example/diff_.cpp` and + its twin. +6. The definition of green from scratch (skill `webcpp-build-and-lanes`), oracle lane included: + `b2 -a libs//test/oracle//oracle`. + +## Never +- State by hand what the original does; edit an expected result; leave a difference unrecorded. diff --git a/.agents/skills/webcpp-text-and-commits/SKILL.md b/.agents/skills/webcpp-text-and-commits/SKILL.md new file mode 100644 index 00000000..e61f4e18 --- /dev/null +++ b/.agents/skills/webcpp-text-and-commits/SKILL.md @@ -0,0 +1,30 @@ +--- +name: webcpp-text-and-commits +description: "Before writing any file, commit message or proposal text for a webcpporg repository: the rules on language, forbidden text, commit form and outward actions." +--- + +# Text and commits in webcpp + +The rules are in the superproject's `AGENTS.md`, chapter 11 "Commits and text" +(https://github.com/webcpporg/webcpp/blob/main/AGENTS.md). This is a checklist, not a copy. + +## Before writing a file +1. English only, in files, comments and commit messages. +2. No em dash (U+2014): use a plain dash. No banned word (the regex `veru[s]`, any case). +3. No personal data: no home directory paths (write `/Users/you/` as the placeholder), no + private addresses. Name people only by the identity they publish under. +4. A source file opens with the licence notice of chapter 11, in its language's comment form. + +## Before committing +1. Commit under your own git identity, a name and address you control (a GitHub noreply address + is fine), as chapter 11 says; never under another person's identity. +2. No trailer of any kind: no `Co-authored-by`, no `Signed-off-by`, no agent name. +3. Stage explicit paths, never `git add -A`; a submodule's commit is recorded, never its files. +4. Subject: plain, says what the change does, prefixed by the part it touches (`xactor: ...`). +5. Check: `git log -1 --format=%B | git interpret-trailers --parse` prints nothing. A last paragraph + that starts with `word:` (`std::` does) is read as a trailer: start it otherwise. +6. A change a user can see adds its changelog line in the same commit (chapter 11, "The changelog"). + +## Outward actions +Pushing, merging, creating repositories, changing settings and touching credentials belong to the +owner, unless the owner asks for that specific action. An outside change is a pull request from a fork. diff --git a/.github/workflows/skills.yml b/.github/workflows/skills.yml new file mode 100644 index 00000000..fd038bb0 --- /dev/null +++ b/.github/workflows/skills.yml @@ -0,0 +1,58 @@ +# Copyright (c) 2026 WebCpp.org +# +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# https://www.boost.org/LICENSE_1_0.txt) + +name: Agent skills + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +jobs: + front-matter: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Install the YAML parser + run: | + python3 -m venv "$RUNNER_TEMP/skills-venv" + "$RUNNER_TEMP/skills-venv/bin/python" -m pip install PyYAML==6.0.3 + - name: Validate skill metadata + run: | + "$RUNNER_TEMP/skills-venv/bin/python" - <<'PY' + import re + from pathlib import Path + import yaml + + paths = sorted(Path('.agents/skills').glob('*/SKILL.md')) + failures = [] + for path in paths: + try: + parts = re.split(r'^---\s*$', path.read_text(), maxsplit=2, flags=re.M) + if len(parts) != 3 or parts[0].strip(): + raise ValueError('expected opening and closing YAML delimiters') + metadata = yaml.safe_load(parts[1]) + if not isinstance(metadata, dict): + raise ValueError('front matter must be a mapping') + name = metadata.get('name') + if name != path.parent.name or not re.fullmatch(r'[a-z0-9]+(?:-[a-z0-9]+)*', name): + raise ValueError('name must match its kebab-case directory') + description = metadata.get('description') + if not isinstance(description, str) or not description.strip(): + raise ValueError('description must be a nonempty string') + except (ValueError, yaml.YAMLError) as error: + failures.append(f'{path}: {error}') + if not paths: + failures.append('no agent skills found') + for failure in failures: + print(failure) + print(f'{len(paths)} skills, {len(failures)} problems') + raise SystemExit(bool(failures)) + PY diff --git a/AGENTS.md b/AGENTS.md index 7320c754..c7d97dd2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,6 +8,11 @@ only what is specific to that library: the original and its version, how its oracle drives the original, its particular cautions. Read this file first, then the library's. +Agent skills, short playbooks that point into this file for recurring +tasks, are in `.agents/skills//SKILL.md`: the library's conventions, a +port, the build and its lanes, the documentation and the site, and text and +commits. They never replace a rule here; where one disagrees, this file wins. + This file describes the tree as it is. What is still to come is listed in the roadmap (chapter 13), to which every other mention of it refers. Every command below runs from the superproject's root, in a shell where `CPATH`, @@ -2457,7 +2462,9 @@ superproject's new `main`. `main` is the only branch. --> ``` - The lint checks each of these. + The lint checks each of these. Markdown files, including `SKILL.md`, do + not need this source-file notice; upstream licence and attribution + notices are preserved. - **History.** A repository whose code was moved from elsewhere starts from one import commit; the history of the code it was moved from is not carried over. diff --git a/doc/releases/0.1.0.adoc b/doc/releases/0.1.0.adoc index df8053f7..3cc46eb5 100644 --- a/doc/releases/0.1.0.adoc +++ b/doc/releases/0.1.0.adoc @@ -52,6 +52,7 @@ None. [#webcpp-0-1-0-tools-and-build] == Tools and build +* Added agent skills with validated metadata for common contributor workflows. * *Breaking change:* changed wasip2 programs to build with exceptions, as wasip3 does; whether a program uses them is its developer's choice. * Added emscripten as a tested target (Emscripten 6.0.11 under Node):