feat(author): a source names the version of its type it was built with, and the build writes it

Merged
AL
2d ago
+217-23

Part of #219, its last item to build: "the source handed over beside a package is built again later, on the build page, with a newer pack, so it should name the pack it was built with". #219 stays open.

What changes

  • A build hands back the source with builtWith, the content type and the pack's version of it, beside type: "builtWith": "H5P.Blanks 1.14". It is result.source and result.builtWith, in Node and in a page.
  • A build of a source that names another version of the same type says so. Where it builds, a note: builtWith was H5P.TrueFalse 1.2 and this pack has H5P.TrueFalse 1.8: its fields may have changed since, so play it through before handing it over. Where it has problems, one more line with them, since a field that changed may have made them. Alone it is never a problem.
  • The command line writes <package>.source.json beside the package, as the MCP server already did; both now write result.source. It is never written over: a name that is taken stops the build before a package is made. The one exception is the file being built (the usual name of a source that was handed over), which is rewritten by a rename, and only where what it names has changed. A quiz in the quiz format stays as written.
  • The skill's hand-over gives the file the build wrote, not the one the chat wrote (built-here.md, one sentence).

Two choices, the owner's

  • The type's version, not the pack's. Every build route knows it, a build from a parts/ folder too, whose index names no pack; and it says what moved.
  • The build writes it, since a model writes the source before there is a build.

Not in this change

  • The build page showing the field: the organisation's site, once it pins a release with this.
  • A read leaves builtWith out; the next build writes it.
  • buildPackage itself still writes the package alone.

Tested

  • Author: 280 Node tests and 2 in Chromium pass, four of them new (the result, the note and the problem line, a value that is no version, the command line's file). MCP: 21. Skills project: 82. Type checks of both packages.
  • The changed hand-over step on Haiku, one run, with the build's output and the folder's files given: it handed over rivers.h5p and rivers.source.json with the fixed line as written.

Behaviour that changes for people

  • h5p-author build a.json b.h5p now also writes b.source.json, and refuses where that name is taken by another file.
  • A source may carry builtWith; sourceSchema has the field, described as a build's to write.

Summary by cubic

Part of #219: a source handed over beside a package is built again later, often with a newer pack, so a build now stamps the source it returns with builtWith, the content type and the pack's version of it (H5P.Blanks 1.14), beside its type, and says so when a source names another version of its type. The command line now writes that built source as <output>.source.json beside the package, and the skill's hand-over gives that file, not the one the chat wrote.

Behavior changes

  • h5p-author build a.json b.h5p now writes b.source.json too, and refuses before a package is made where that name is taken by another file; the file being built is the exception, kept up to date. A quiz in the quiz format built to a new name is kept beside the package as the source it was built as, which takes the field; the file itself stays as written. The MCP server likewise writes the source the build returned, not the one given.
  • builtWith is a field of sourceSchema, described as a build's to write and left out of the fields a problem lists as a source's; a value that is not a name and a version is a problem saying to leave it out.
  • buildPackage hands back source and builtWith in Node and on a page, and still writes the package alone.