diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index d0f1bc34..78ef7ab6 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,4 +1,5 @@ -# The documentation site on GitHub Pages, rebuilt on every push to main: +# The documentation site on GitHub Pages: built on every pull request, which +# fails if agents/ is not what the pages write, and deployed from main. # odoc's reference from the .mli files and the islands compiled by Melange, # then Starlight's pages around them. name: docs @@ -6,24 +7,23 @@ name: docs on: push: branches: [main] + pull_request: +# A build reads the repository and nothing more; the deploy job alone is +# given the rights to publish. permissions: contents: read - pages: write - id-token: write +# A newer push to a pull request replaces its build; main's deploys queue +# and always finish. concurrency: - group: pages - cancel-in-progress: true + group: pages-${{ github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: - deploy: + build: runs-on: ubuntu-24.04 - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} steps: - - uses: actions/configure-pages@v6 - uses: actions/checkout@v5 - uses: ocaml/setup-ocaml@v3 with: @@ -42,8 +42,23 @@ jobs: # the token, past its limit for a runner's shared address. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # The build writes agents/ from the pages: a page changed without it + # differs here. + - run: git add --intent-to-add agents/ && git diff --exit-code agents/ - uses: actions/upload-pages-artifact@v5 with: path: _build/docs + deploy: + needs: build + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-24.04 + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - uses: actions/configure-pages@v6 - uses: actions/deploy-pages@v5 id: deployment diff --git a/AGENTS.md b/AGENTS.md index ec523063..6e511fbc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -23,8 +23,7 @@ make setup # once: the switch solidtype, all dependencies, and make test # the ppx's lowering, the plugin's rewrite, the # libraries' tests and the example's make lint # formatting, the plugin's and the generators' types, - # litany, the release build, the generated bindings, and - # agents/ against the pages + # litany, the release build and the generated bindings make fmt # format in place make example # the board, built by Vite into _build/example-dist, and # its Astro page, into _build/example-astro @@ -32,10 +31,10 @@ make example-serve # the board and its API, served on http://localhost:4420, # its tasks in BOARD_DB, example/board.db, migrated first make docs # the documentation site, odoc's reference copied into # docs/public/reference, built by Astro into _build/docs, - # as .github/workflows/docs.yml publishes it from main + # as .github/workflows/docs.yml publishes it from main, + # and agents/ from its pages make docs-serve # the documentation site built, served on DOCS_PORT with # search -make agents # agents/ written from the documentation's pages make release VERSION=1.2.3 # tag and release ``` @@ -183,18 +182,16 @@ docs/ the documentation, a Starlight site in Hypha's look, ignored, since Starlight serves public/ as it is agents.md what an agent knows before any page -- the packages and how solidtype is written -- which the theme puts - at the head of llms.txt; each group's note, and the - skill's description and the parts agents have been - seen writing by hand instead, are in astro.config.mjs + at the head of llms.txt; each group's note is in + astro.config.mjs src/pages/demo/ the Astro page's demo, pages of Astro's own outside Starlight: a route per tea, its islands given props, under a basket the client router keeps; the page imports their sources as @demo/?raw agents/ the documentation for a user's agent, generated by - starlight-theme-hypha from the pages, `make agents`: + starlight-hypha-agents from the pages, `make docs`: llms.txt, the catalogue; pages/, each page as - Markdown, its examples written in; skills/solidtype/, - the skill that sends an agent there; installed by the + Markdown, its examples written in; installed by the root dune into $(opam var solidtype:doc), and llms.txt alone, its links to solidtype's pages, into every other package's doc/ @@ -705,15 +702,15 @@ break. `_ Jsx.component`, never a function type, and an OCaml component is `Jsx.component make`. Why: Melange wraps an external function used as a value in a closure, which no JSX tag can name. -- **`agents/` is generated, never edited.** starlight-theme-hypha writes it - from the documentation's pages, `docs/agents.md` and the `agents` options - in `docs/astro.config.mjs`: a page changed is `make agents` run in the +- **`agents/` is generated, never edited.** starlight-hypha-agents writes it + from the documentation's pages, `docs/agents.md` and its options in + `docs/astro.config.mjs`: a page changed is `make docs` run in the same commit. A module with a page of its own names the page's installed path, `$(opam var solidtype:doc)/pages/.md`, in its `.mli`'s opening comment, and `generate/rhp.ts` writes it for rhp's generated components. Why: a user's agent reads what the release installs, offline, and a page - it reads must be the release's. Test: `make lint` runs `HYPHA_AGENTS=check - astro sync`, which fails on each file that differs from the pages. + it reads must be the release's. Test: the docs workflow builds the + pages on every pull request and fails if `agents/` then differs. - **Tests of what runs in a browser are OCaml, run by vitest.** Alcotest does not build for Melange; `melange-jest` reaches the globals vitest shares with Jest. The ppx, native, is tested by its expectations. Why: diff --git a/CHANGES.md b/CHANGES.md index b217508c..a5079816 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## Unreleased + +- Breaking: the skill, `skills/solidtype`, is no longer installed. The + documentation for an agent is `llms.txt` and every page in Markdown, in + `$(opam var solidtype:doc)`, and the README's *With an agent* gives the + line for a project's `AGENTS.md` that sends an agent there. + ## 0.12.0 (2026-11-20) - HeroUI's `Data_grid`: rows given as data, each known by its `row_id`, and diff --git a/Makefile b/Makefile index 9decb42a..b515656a 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ DOCS_PORT ?= 4321 REFERENCE = solidtype solidtype-kobalte solidtype-headless solidtype-heroui solidtype-rhp solidtype-internationalized-date solidtype-gravity-icons ppx_solidtype odoc.support .DEFAULT_GOAL := help -.PHONY: help setup build test lint fmt example example-serve docs docs-serve agents generate release +.PHONY: help setup build test lint fmt example example-serve docs docs-serve generate release help: ## list targets @grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \ @@ -30,10 +30,8 @@ test: build node_modules ## run the tests $(OPAM) dune test --force $(OPAM) bun run test -# Release is the profile opam installs with. agents/ is checked from docs/, -# where Astro finds its config, by reading the pages without building the -# site. -lint: node_modules ## check formatting, types, litany, the release build, bindings and agents/ +# Release is the profile opam installs with. +lint: node_modules ## check formatting, types, litany, the release build and bindings $(OPAM) dune build @all @fmt $(OPAM) dune build --profile release @all $(OPAM) litany check @@ -45,7 +43,6 @@ lint: node_modules ## check formatting, types, litany, the release build, bindin $(OPAM) bun generate/rhp.ts --check $(OPAM) bun generate/internationalized_date.ts --check $(OPAM) bun generate/gravity_icons.ts --check - cd docs && HYPHA_AGENTS=check bunx astro sync fmt: ## format the code $(OPAM) dune fmt @@ -77,11 +74,6 @@ docs: build node_modules ## build the documentation site docs-serve: docs ## serve the built documentation site cd docs && bun --bun astro preview --open --port $(DOCS_PORT) -# Each page as Markdown, llms.txt and the skill, from the documentation's -# pages, for the solidtype package to install. -agents: node_modules ## write agents/ from the documentation's pages - cd docs && HYPHA_AGENTS=write bunx astro sync - generate: node_modules ## write the generated bindings $(OPAM) bun generate/html.ts $(OPAM) bun generate/kobalte.ts diff --git a/README.md b/README.md index 2510247b..9ebef2b6 100644 --- a/README.md +++ b/README.md @@ -37,28 +37,14 @@ Setting up dune and Vite to build it: ## With an agent -Each release installs its documentation for an agent with it: `llms.txt`, -every page in Markdown, and a skill that sends the agent there before it -writes code with solidtype. With opam alone, copy the skill into your -project, into `.agents/skills/` for Codex, Cursor and most agents or -`.claude/skills/` for Claude Code: - -```sh -mkdir -p .agents/skills -cp -r $(opam var solidtype:doc)/skills/solidtype .agents/skills/ -``` - -With Node or Bun: - -```sh -npx skills add hyphatech/solidtype -``` - -An agent that reads no skills is told in your project's `AGENTS.md`: +Each release installs its documentation for an agent with it, at +`$(opam var solidtype:doc)`: `llms.txt`, and every page in Markdown. An +agent reads it when your project's `AGENTS.md` tells it to: ```md -Before writing code with solidtype, read `$(opam var solidtype:doc)/llms.txt` -and the page of each part the work needs; build from its parts. +Before writing code with solidtype, read `$(opam var solidtype:doc)/llms.txt` and +the pages it lists for the parts you need, and use those parts rather than +writing your own. ``` ## Licence diff --git a/agents/skills/solidtype/SKILL.md b/agents/skills/solidtype/SKILL.md deleted file mode 100644 index 0bcdbc85..00000000 --- a/agents/skills/solidtype/SKILL.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: solidtype -description: "Use before writing or changing OCaml code that uses solidtype or its packages: Solid's components, signals and stores in OCaml's JSX (.mlx), Kobalte's components, HeroUI's ported onto them (buttons, fields, lists, tabs, overlays, tables), rhp's charts, Gravity UI's icons and @internationalized/date." ---- - -# solidtype - -solidtype's documentation is installed with its opam package, `solidtype`, at the release the code builds against. Read it before writing code with solidtype, and build from the parts it gives. - -1. Read the catalogue, `$(opam var solidtype:doc)/llms.txt`: every page, a line each, by what it is for. Only where it is not installed, read https://hyphatech.github.io/solidtype/llms.txt, which may document a newer release than the code builds against. -2. Read the page of each part the work needs, `$(opam var solidtype:doc)/pages/.md`, its examples among them. -3. Build from those parts, and write by hand only what none of them does. - -## Written by hand instead of a part - -Each of these is easily written by hand where solidtype has a part; look for the part first: - -- a raw `