hotfpc
Contributing

Tooling

Audience: contributors. The tools for working on hotfpc, the hook and CI.

ToolVersionUsed for
Free Pascal3.2.2 (the pinned compiler); also tested with fpc-toolchain's 3.2.4-rc and 3.3.1building hotfpc; the scenarios use it to build the test programs
fpcresships with fpcturns the agent's source into a resource of hotfpc (build system)
Python3.9 or laterthe scenario tests in tests/scenarios/, the check of the agent in tests/agent/ and the reference check
Lefthook1.5 or laterthe pre-commit hook in lefthook.yml (lefthook install once per clone)
Node.js22 or later, with npx: markdownlint-cli2 0.24.0 and its markdownlint 0.42.0 require itthe Markdown lint (markdownlint-cli2 0.24.0, which npx fetches)
Node.js, for the website22.12 or later, which the site's mermaid 12.2.0 requires; CI builds it with Node.js 24the website (website/)
tmux, vim, asciinema, agg, ffmpegany recentrecording the terminal demo with scripts/record-demo.py; only needed to re-record (demos)

Only fpc is needed to build hotfpc. Everything else is for working on it.

The pre-commit hook

lefthook.yml runs ./build.sh hotfpc tests before each commit that changes the source, which builds hotfpc and runs the unit tests. Before each commit that changes the source or docs/reference/, it also runs the reference check.

The scenarios take about two minutes, so CI runs them, not the hook. Don't bypass the hook with --no-verify unless the maintainer agrees.

The documentation checks

docs/ is written for people who use hotfpc (guides and a reference) and for people who change it (these pages). Two checks keep it honest, and CI's docs job runs both.

The reference check

python3 scripts/check-reference-docs.py

docs/reference/ is written by hand. The check reads source/HotFPC.pas and source/HotFPC.Agent.pas and fails when the reference:

  • doesn't quote the usage text exactly as hotfpc prints it;
  • has no table row of its own for an option in the usage text, or names an option the usage text doesn't have;
  • misses a [hot] line the driver prints, including the error it prints when a compile or link fails without an error from fpc, or a restart reason, note or error the agent sends back;
  • has no table row for a HOT_* environment variable named in source/.

A line counts as documented when its fixed parts appear in order on one line of docs/reference/; the parts filled in at run time can be written as <unit>, <ms> and so on. So a new option or a new [hot] line fails CI until it is documented, usually in command line or output.

Markdown lint

npx --yes markdownlint-cli2@0.24.0

The rules are in .markdownlint-cli2.jsonc: ATX headings, two-space list indents, fenced code blocks with a language; long lines and inline HTML are allowed. CHANGELOG.md is left out.

CI

.github/workflows/ci.yml runs on pull requests and on pushes to main. On Linux x86-64, Linux arm64 (GitHub's ubuntu-24.04-arm runner), macOS arm64 and macOS x86-64 (GitHub's macos-15-intel runner) with fpc 3.2.2 it builds hotfpc, runs the unit tests, the scenarios and the check of the agent on its own. On Windows it builds hotfpc.exe with build.bat, runs the unit tests, and runs the scenarios and the check of the agent with hotfpc.exe. The docs job runs the reference check and the Markdown lint.

.github/workflows/release.yml builds the release binaries for a version tag (releasing), and .github/workflows/pages.yml builds and deploys the website (below).

The website

https://frostney.github.io/hotfpc/ is a landing page and docs/ rendered as it is. It is a Fumadocs site in website/, exported as static files by Next.js with the basePath /hotfpc. Only the landing page and the glue live in website/; every documentation page is a file in docs/, ordered by the meta.json in each folder, with its H1 as its title. Node and the site's packages are for the website only: building hotfpc doesn't need them.

cd website
npm ci
npm run build      # the static export in website/out
npm run start      # website/out at http://localhost:3000/hotfpc/
  • lib/remark-repo-links.mjs maps the links in docs/: a link to a page becomes the page's route, a link to a file under docs/ that isn't a page (the demo recordings, an image) becomes the site's copy of it, which scripts/sync-docs-assets.mjs makes before each build, and any other link in the repository becomes its GitHub URL. A link or image whose target doesn't exist fails the build, and so does a link whose fragment (page.md#section, #section) names no heading of the Markdown file it points to.
  • lib/remark-term-links.mjs links the first mention of a few tools on each page (Free Pascal, raylib, lwpt, Wine).
  • A ```mermaid block is drawn in the browser by components/mermaid.tsx; GitHub draws the same block natively.
  • The site has a static search index, llms.txt, llms-full.txt and a Markdown copy of every page, whose links to pages, sections and files of the site are absolute URLs, an Open Graph image per page and a sitemap. The headings in the Markdown copies are written as GitHub Markdown writes them: lib/source.ts turns off the [#id] that fumadocs puts after each heading by default. The search index takes each page's headings and their ids from the structure fumadocs' MDX preset exports for the page.
  • scripts/check-export.mjs runs after each build and fails it when a search result's #anchor is no id on its page, or when a heading in a Markdown copy or llms-full.txt ends with [#id].
  • package.json pins every package to an exact version, and package-lock.json the rest.

pages.yml builds the site on every pull request, so a broken link fails the pull request, also when the change that breaks it is outside docs/, such as a renamed heading in README.md. It deploys the site from pushes to main.

On this page