feat(skills): h5p-to-scorm, an H5P package as a SCORM zip for an LMS
The skill
skills/h5p-to-scorm/SKILL.md takes an agent from an .h5p to a SCORM zip in the user's LMS:
- What to ask first: which LMS. A pass mark, completion as 100 and SCORM 2004 come up only when they matter.
- A check that plays the package as the zip will:
--libraries pack --no-refresh-libraries --no-downgrade-libraries. - The command in its three forms, and what to do about each refusal.
- The Supported LMSs table, with the setting each LMS needs.
- What to tell the user: the LMS must be https; the package's code runs on the LMS's site; how to try the zip as a student; 1.2's 4,096-character limit.
It only names options that are on npm now (embed 1.6.2, verify 1.4.1), since a skill installs from main.
Also in this PR:
- The README's skills section is a table, like the packages one.
- h5p-author's hand-over mentions the new skill.
- The embed README points to the skill.
Found by the tests: --completion-score's example never finishes (#160)
The help, the embed README and the SCORM page all said the option was for content like "a presentation without questions". But such a presentation never finishes. Played to its last slide, it sends only progressed, so the activity stays incomplete whether or not the option is set. Course Presentation 1.27 and Interactive Book 1.15 send completed only from their summary page, and they only show that page when they contain tasks.
The content that really finishes without a score is a questionnaire, or a branching scenario with no scoring. The zip records both as 100.
So the bridge was right and the example was wrong. It's corrected in the command's help, the embed README, both copies of the SCORM page (packages/embed/site/ and the demo's) and design/scorm.md.
Tests
apps/skills/tests/to-scorm.test.ts has three tests and runs in about 21 s. They take the skill's commands exactly as it writes them, run them on packages built by h5p-author, then play each zip as a learner. The zip is served as an LMS serves it, and the launch page runs under a stand-in LMS page that keeps the values between launches.
- SCORM 1.2 with the skill's pass mark. A quiz played over two sessions.
- The stand-in reads the mark from the manifest, as Moodle does.
- Session 1: the learner answers question 1, moves on, and leaves. The LMS holds
incompleteandsuspend, plus base64 saved state under 4,096 characters. - Session 2: the quiz resumes on question 2. The learner scores 2 of 3, a score the quiz's own 50% passes and the mark of 80 fails.
- Result:
failedat 66.67, one interaction per question, and the session ends with nothing left to resume.
- SCORM 2004 with completion as 100.
- A questionnaire submitted, and a branching scenario played to an ending, are each recorded as completed with a score of 100.
- The questionnaire keeps that result after a relaunch.
- A presentation without questions, every slide seen, stays
incompletewith no score.
- The skill's LMS table matches the embed README's Supported LMSs: the same LMSs, added the same way, with the same 2004 column.
Mutation check: I made the bridge ignore the pass mark, then made it write the state as UTF-16 instead of base64. Test 1 failed both times.
Runs:
- Three runs in a row all passed.
- The whole
apps/skillssuite passes: 76 tests in 61 s. apps/skillsand embed typechecks pass.
Not verified
- A real LMS. LMS testing is paused, and the skill tells the agent it can't check one.
- The skill's prose in an agent session.
Release
The skill reaches users from main once this merges. The corrected help text and SCORM page reach npm with the next embed release; with #158 that's 1.7.0, and this goes under fixes.
Summary by cubic
Adds h5p-to-scorm, a fifth agent skill that turns an .h5p into a SCORM zip for an LMS, and fixes --completion-score's example: tests showed a presentation without questions never finishes, so it now names a questionnaire or a branching scenario without scoring.
New Features
- The skill asks which LMS the zip goes to, checks the package as the zip will play it, runs the command in its three forms, and gives the setting each supported LMS needs. The check distinguishes a package that does not play (exit 1, to fix) from a check that could not run (exit 2, never change the package);
${'No such file'}from the zip's command is a wrong path or folder, checked before asking for the file. apps/skills/tests/to-scorm.test.tsruns the skill's commands as written and plays the zips under a stand-in LMS: a two-session quiz in SCORM 1.2 that the skill's pass mark decides, and in 2004 a questionnaire and a branching scenario counted as 100 while a presentation without questions stays incomplete; a third test holds the content the skill names as resuming or restarting to the pack's libraries.- The README's skills section is now a table; h5p-author's hand-over points to the new skill.
Bug Fixes
- The example is corrected in the command's help, the embed README, both SCORM pages, and
design/scorm.md, and the wording now says "a presentation or book with no questions in it". - The skill and README now say only content types with
getCurrentState()resume; an Accordion, Image Hotspots, Flashcards, or a Timeline starts over. - A CodeQL string-escaping warning in the new test is fixed.