Expand description
Packs: folders of ordinary node files (planes, types, link types, rules) that can be added to a model.
A pack folder holds one pack node (the manifest) and the nodes it provides. Every provided node carries
fields.pack: <name>@<version>, so once copied into a model it is still known to come from the pack.
Adding is a copy with checks: required packs must be there, and a node that already exists is only
replaced if it came from the same pack (an upgrade). Anything else is a conflict, and nothing is written.
The manifest kept in a model also records installed: a hash of every node as the pack provided it. That is
what lets us tell a node you changed from one you did not, so an upgrade replaces what is untouched, keeps what
you edited, and a removal does not throw your work away.
Structs§
- Added
- Pack
- Problem
- Something wrong, or worth a look, in a pack.
errormeans it should not be shared as it is. - Removed
- What
removedid. - Status
- What has become of an installed pack’s nodes.
Enums§
- Clash
- What to do when a pack defines a type or link type whose name the model already defines.
Functions§
- add
- Copy a single pack into a model whose requirements are already in place. See
add_treefor the checks. - add_
tree - Add
nameand everything it needs or includes to a model (seeplan). Nothing is written unless every pack in the plan can go in: requirements met (at a version that satisfies the range), no namespace shared with a different pack, and no clash with something the pack does not own (unlessforce). Nodes you changed since an earlier version of the pack went in are kept, not overwritten (unlessforce). Returns what happened to each pack, in the order added. - add_
tree_ with add_tree, with a choice for what to do when a type or link type name is already defined (seeClash).- export
- Write a pack that was made in the model out to a pack folder
<packs>/<name>/, so other models can add it: the manifest (without the install record) and every node that carries its tag. Returns the node count. The folder is checked as a pack before it replaces an earlier export. - installed
- The packs a model already has, as (name, version), from its
packnodes. - lint
- Check packs against each other and against what a pack is for:
- list_
packs - Every pack folder directly inside
dir, by name. - node_
hash - A hash of what a node says, not how its file is laid out: reformatting a file does not change it.
- pack_
from_ texts - Build a pack from (file stem, file text) pairs;
labelnames it in errors. Folders and the copy in the binary both come here. - plan
- The packs to add for
name, dependencies first: itsrequires, then the pack itself, then itsincludes.onlylimits which of the root’s children come along (a collection lets you pick);Nonetakes them all. - read_
pack - Read one pack folder and check it hangs together.
- remove
- Take a pack out of a model: its manifest and every node it provided. Refused (nothing is deleted) while another
pack in the model requires it, while nodes of yours link to, sit under or are placed on its nodes, or while you
have changed some of its nodes;
forcedeletes anyway. - satisfies
- Does
versionsatisfyrange? A range is one or more space-separated comparators, all of which must hold:^1.2.3(compatible: below the next major, or next minor while major is 0),~1.2.3(below the next minor),>=,>,<=,<,=or a bare1.2.3(exact). Empty or*accepts anything, even a version that is not x.y.z. - status
- For every pack in the model: which of its nodes you have changed or deleted. Needs no copy of the pack, because the manifest remembers what it installed. A pack installed before hashes were recorded reports everything clean.
- valid_
namespace - Lower-case letters and digits in words joined by single dashes: it sits before the
--in every id.