feat(author): say which H5P core a site needs to take a package

Merged
AL
16h ago
+102-20

Closes #245.

H5P's upload check refuses a package when a library in it asks for a newer core than the site has. The message names that library, not the package. With pack 1.1.0, 50 of the 57 runnable libraries need core 1.28: 31 ask for it themselves, and the rest carry a library that does. A Moodle site before April 2026's point releases therefore refuses nearly every package built today.

What changes

  • The build: coreApiOf (in lib/install.mjs, exported from ./core) finds the newest core API among the libraries a package carries, counting those carried for the upload check. A library that names none counts as 1.0, as H5P reads it. A version without a minor counts as .0, and one that is not two whole numbers is ignored. Every build result has it as coreApi, in Node and in a page.

  • The line: coreApiLine writes it as one line. For 1.28 the line names the releases that have it, as checked on 2026-11-19:

    Needs H5P core 1.28 or newer on a site it is uploaded to: Moodle 4.5.11, 5.0.7 or 5.1.4 and later, or the WordPress H5P plugin 1.17 and later. An older site refuses it.

    For any other version it says the version alone.

  • Where it shows:

    • h5p-author build prints the line right after "Built …". build --check does not, since it writes no package.
    • h5p_build's answer gives it second, after its "Built …" line.
  • Docs:

    • The author README shows the line in its sample output and says what it means.
    • The README now names Moodle 4.5.15 as the release that accepted every example, since Moodle 4.5.0 to 4.5.10 refuse them.
    • The MCP README, design/author.md and design/mcp.md say the same.

Where the releases come from

  • The check itself: H5P's validator, H5PValidator::isValidH5pData in h5p-php-library, error api-version-unsupported.
  • Moodle: h5plib_v128 (MDL-88092) is first in 4.5.11, 5.0.7 and 5.1.4, all tagged 2026-04-16, and an upgrade step makes it the default. Moodle 4.4 has v127.
  • WordPress: every 1.17 tag of the H5P plugin on svn has 1.28. 1.16.0 has 1.27.
  • Drupal and Lumi: h5p/h5p-core 1.28.0 came out on 2026-03-03, and Lumi's server library has 1.28. Neither is named in the line, since their releases do not map onto it as simply.

Tested

  • Typecheck and suites: pnpm typecheck passes, and so do the author's node suite (266 tests) and the MCP suite (21).
  • New test: a built Question Set's coreApi equals the newest coreApi among the library.json files in the written package. It also covers a library that names none, numbers written as strings, a missing minor, values that are not whole numbers, and the line for 1.28 and for 1.29.
  • The command and the server: the command's test now expects the line right after "Built …", and the MCP build test expects it in the answer.

Not done

The skill does not tell the model to pass the line on. It reaches the model with the build's output, and a skill change would need its own check on Haiku.


Summary by cubic

Builds now say which H5P core a site needs to accept the package. H5P's upload check refuses a package when a library in it asks for a newer core than the site has, and its error names only that library; with pack 1.1.0, 50 of the 57 runnable libraries ask for 1.28, so a package built today is refused by an older site without saying why.

  • buildPackage returns coreApi, the newest core API among the libraries a package carries, in Node and in a page; a library naming none counts as 1.0, a missing minor as 0, and anything not two whole numbers is passed over.
  • h5p-author build and h5p_build print a line naming that core after the "Built …" line — for 1.28 it names the first releases that have it (Moodle 4.5.11, 5.0.7 or 5.1.4, WordPress plugin 1.17). build --check does not, since it writes no package.
  • Docs updated; the author README now names Moodle 4.5.15 as the release that accepts every example.