ostree-explorer
v0.1.0
Published
Read-only, dependency-free Javascript library for exploring OSTree repositories
Downloads
106
Maintainers
Readme
Read-only Javascript library for OSTree repositories
This project exists to solve a common problem: you have an OSTree repository with commits in it, and you'd like to browse the filesystem tree of one of the commits. Today, your only option for doing so is to install the ostree command line tool, pull the commit to your local repository, and do ostree ls or similar from there.
But OSTree repositories have a nice, well-defined binary format, defined by GVariants. A .commit object is just a bundle of metadata, with the root hash of the commit and links that allow you to explore the tree representing all the file objects in the repo. We can deserialize and load that data lazily from a remote repository, reading only the parts we need, using HTTP range requests. That's what this project has implemented: a parser for a the subset of the OSTree binary format, and functions to fetch the binary data we need to display enough info for us to browse the filesystem tree, and only that data--we don't need to download the whole image.
It also has a sample self-contained HTML file that implements a simple OSTree repository explorer.
Warning: Here there be AI
I didn't want to write a frigging binary format parser in Javascript. I didn't want to write javascript at all. So I got Claude to do it for me. Basically none of this code was written by human hands; there was a lot of hand-holding, and Claude kept on getting confused about the fact that a "fixed-length array" in the GVariant spec is an array of fixed-length base type (but is, itself, a variable-length type). But we got there in the end, and it was actually kind of fun.
Current limitations
- It doesn't parse summary files, and doesn't know about refs. You just have to pass it a URI to a .commit file, and it'll go from there
- No error handling for stuff like CORS errors
- Only supports OSTree repositories of type
archive(though other types would probably work for everything except the file download and file metadata parsing; pretty sure everything about commit and dirtree objects stays the same across repository variants)
