Repository navigation
h5p-author: any content type in the pack, from a package and a file per type - #101
Merged
Merged
Conversation
…file per type (#100) The h5p-author skill built Multiple Choice and Question Set from a bundled script. It now builds 28 content types: the agent chooses the type with the user, reads one file for it, and writes a source of only what differs from the type's defaults. - packages/author, @missing-elements/h5p-author 0.1.0: `build` and `schema`, the library pack pinned, every written value checked as H5P's editor would, media copied and described, layouts for the types the editor gives a widget of their own (Course Presentation, Interactive Video, Branching Scenario, Game Map, Find the Hotspot). - The sweep's ContentGenerator moved into the package; the sweep runs it lenient with its own fill, and generates the same bytes for all 55 types. - The skill: a router SKILL.md, references/authoring.md, and references/types/<Type>.md with notes, a tested example and the fields, generated from the pack and kept current by the weekly refresh. - The quiz format stays a source the build takes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CodeQL flagged four patterns on the pull request: polynomial backtracking in the markup reader's comment, in its tag pattern and in the tag stripper, and the emptiness check's tag-removing replace. A comment left open now runs to the end, as a browser reads it; the tag pattern's spaces and name have one reading each, and the slash of `<br />` comes off the attributes as the content check takes it off; the strippers stop at the next `<`; the emptiness check uses stripTags. Over 244,358 inputs (the type files' examples, written cases and a fuzz) and three fields, the stored text and the problems are the old ones except after a comment left open. The sweep's content for its 55 types is byte for byte the same, and 2 million characters take 8 ms where 40,000 took 3 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ut check (#100) Found reviewing the pull request by hand. - A hosted video is taken only at an address H5P.Video plays. It chooses a player by its own pattern for each host and hands an address none matches to its HTML5 player, so `youtube.com/shorts/`, `player.vimeo.com` and `panopto.com` addresses outside `/Panopto/…?id=` built and then did not play. A Short's or a live stream's address is written as its video's watch address; any other address on those hosts is refused, naming the form. The test holds each accepted address to the patterns read from H5P.Video's scripts in the pack. - A JPEG's segments are walked to its frame header through the file. Reading the first 64 kB refused a picture whose colour profile or XMP put the frame header further in. - An existing output, or a missing folder for it, is refused before any work, with a message that says so; the error keeps its EEXIST code. - The Game Map layout test reached its assertions only with the network: its map was a web address. It is a picture beside the source now, and passes. - isFaststart and slowStart went, read by nothing since the normalizer moves the index; fieldAt lost a line the next one overwrote. The test helpers that write pictures and video are one file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… downloads, Echo360 (#100) The rest of what reviewing the pull request by hand found. - An Interactive Video poster is sized by what it holds. H5P's editor starts every interaction at 10 by 10 em and leaves the rest to the author's mouse; seen in Chrome, 10 by 10 showed two of a question's four answers and hid its Check button behind a scroll. A question now gets 17 by 16, a text as much width as keeps it short, a picture its own shape as the editor gives one; a link, a label and a hotspot keep 10 by 10. Interactions nobody placed are kept a gap apart from what shows at the same time, by their sizes, and a note says when the video has no room left. The type file says how to size a poster by hand. - A quiz in the quiz format has all its problems listed at once, each by its path, as a SourceError, where it stopped at the first as a plain Error. - A download is given up after a minute with no byte, not after two minutes in all, which a large video over a slow link outlasts. - An Echo360 address is kept as the editor keeps it, video/Echo360, when H5P.Video plays it, and any other on Echo360 is refused by name. The checks for an address on a host are now plain tests of its host name: a pattern written for Echo360 took quadratic time on a long name. - A list's item keeps the marker of a widget's field, so a number in such a list takes decimals, as one outside a list does. - The skill says again that the package carries the libraries under their own licences, listed in the pack's libraries.txt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ack refresh (#100) The rules taken from H5P's editor now name where they come from: h5p-editor-php-library at 3bec259 and H5PEditor.ShowWhen 1.0.9 in generator.mjs, and for the layouts the editors the pack's content types name in editorDependencies, at the newest release of that minor: H5PEditor.InteractiveVideo 1.26.3, H5PEditor.BranchingScenario 1.5.13, H5PEditor.GameMap 1.2.5. Each rule names the script it follows, and the two files list where they depart from it. AGENTS.md says how to move them to a newer editor. Checking the rules against those commits found: - a number's steps were counted from min; the editor's value % step counts from 0; - a showWhen path skipped the level the editor gives a list and a group of one field, which only Advent Calendar's door cover reached (optional either way; the pack's other 98 rules resolve alike); - two comments said the editor sets what it does not: a Branching Question's own nextContentId, which it deletes, and a Game Map stage's type, which it keeps out of the content. Both are still written, being hidden and required fields. The weekly pack refresh now runs h5p-author's tests and apps/skills' against the new pack and says in its pull request whether every type file's example still builds and plays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #100.
The h5p-author skill now builds 28 content types instead of two. The agent chooses the type with the user first, reads one short file for it, and writes a source holding only what differs from the type's defaults. A new package,
@missing-elements/h5p-author, does the rest and checks every field the way H5P's editor would.What changed
packages/author, published as a command:build <source> <output>andschema <Type>. It replaces the skill's bundledbuild-quiz.mjs. The library pack is a pinned dependency, sonpx @missing-elements/h5p-author@latest build …needs no project setup;--librariesnames anotherparts/folder.ContentGenerator, moved into the package so there is one copy. The sweep runs it lenient with its own sample fill. Its 55 generated types came out byte for byte the same after the move.showWhenconditions, whole numbers only where the editor shows its number field,<p>or<div>byenterMode.references/types/<Type>.mdwith notes, an example and its fields; the fields section is generated from the pack, and the weekly pack refresh rewrites it. Four parts other content holds (Text, Image, Video and Interactive Video's Text) have files too.Checked
pnpm sweep, 55 types × 2 modes, on the moved generatorpnpm typecheckI also looked at the screenshots of the slide layout, the game map, the hotspots and the interactive video.
After the first push
player.vimeo.comand anypanopto.comaddress used to build and then not play. A JPEG's size is read past a large colour profile. An existing output is refused before any work. The Game Map layout test now reaches its assertions without the network. Two unused functions are gone.SourceError. A download is given up after a minute with no byte rather than two minutes in all. Echo360 addresses are taken as the editor takes them. A widget's list keeps its decimals. The skill again says the libraries come under their own licences.showWhenpath climbs through lists and one-field groups as the editor's does. Neither changes anything the pack builds today. It also corrected two comments that credited the editor with fields it doesn't set. The weekly pack refresh now runs h5p-author's tests and the skills' against the new pack, and its pull request says whether every example still builds and plays.Tokens
At four characters a token, against the published skill:
SKILL.md is 5.7 kB, above the issue's 3 kB estimate: the catalogue table is about half of it.
Before and after merging
mainand callsnpx @missing-elements/h5p-author@latest, so 0.1.0 needs publishing right after the merge; until then the skill's build step fails. Thennpx skills update -g.prepublishOnlyrefuses to publish while the pinned pack version is not on npm with this checkout's index, as the player's does.Not done
Layout for Drag and Drop and Crossword, editing an existing package, and any judgement of whether content is right, which stays the person's, in the preview.
🤖 Generated with Claude Code