Repository navigation
Read a package back into its source: h5p-author read, and h5p_read in the MCP server (#236) - #237
Merged
Merged
Conversation
) readPackage and h5p-author read write the source a build would take to make a package again, its media beside it: its own fields from h5p.json, its content less what a build fills in, by the generator's own rules walked back (ContentGenerator.written). The source is built again in memory and held to the content as checked. Content for other versions of its libraries than the pack's is refused, with both named.
…ld again (#236) Reads a package in the server's folders into a new folder beside it, and answers with the source, each file named where it was written, for h5p_build. The instructions gain one line for changing a package the person has.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 18 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
- Every path is checked against the folder before anything is made, with or without `within`, so a link in the folder that leads out of it stops the read; `inside` resolves a folder not there yet as it does a path. - A file named by a path a read cannot write is left out of the source, which so names no file outside its folder. - A read that fails takes away the folders it made, where they are empty. - A file's licence H5P does not list, or a copyright source that is no web address, is left out with a note; copyrights compare in one order. - Authors left out or given the role "Author", a licence version a source cannot take, and a year that is none are noted; a part's authors that are no list no longer stop the read. - wrapText splits paragraphs at a blank line in Windows line endings. - The round trip compares the media written with the package's bytes. - The README's two unclear sentences, and the refusal's, reworded.
A file the package lacks was passed back by its path in the package, which h5p_build looked for in the first folder. Every local path is now named in the read's folder, so a build looks for it there and nowhere else. The tests check the source file written, compare paths portably, and read a package that lacks its picture.
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 12 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
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 #236. Step 3 of #219.
What changes
readPackageandh5p-author read <package.h5p> <folder>. They write the source a build would take to make the package again,<name>.source.json, with the package's media beside it.paramsare the content ascheckContentreturns it, less what a build fills in.ContentGenerator.writtenwalks the generator back: for each field, what the generator writes when nothing is written, worked out at the field's own level. So defaults, interface texts equal to the content language's translation, part ids and the titles a build gives all drop out. Positions and sizes are kept.readhook beside the layouts'beforeandafter.h5p_read. It reads a package in the server's folders into a new folder beside it. It answers with the source, each file named by its full path in that folder, ready forh5p_build, which looks for a file the package lacks there and nowhere else. The instructions gain one line.wrapTextandunwrapTextin text.mjs (the plain branch ofmarkupText, which now also splits paragraphs at a blank line in Windows line endings), andCOPYRIGHT_FIELDSandwrittenCopyrightin media.mjs.Tested
h5p_readwrites beside the package and names files where it wrote them, the read source builds again, a file the package lacks is looked for in the read's folder only, and refusals say why.pnpm typecheck.Found, not done here
SKILL.mddoes not offerreadyet.Release
h5p-author 0.13.0 first, then h5p-mcp 0.2.0, which needs
readPackage.Summary by cubic
Adds
h5p-author read(andreadPackage) to turn a.h5ppackage back into the source a build would take to make it, with the package's media beside it, so a package can be changed and rebuilt. The MCP server gains theh5p_readtool for the same flow.The read
Versions and safety
h5p_readnames files by the folder it read into, so a package missing media still builds from what was written.h5p-author0.13.0 releases first;h5p-mcp0.2.0 depends on itsreadPackage.Written for commit f47a2c5. Summary will update on new commits.