ROLESconstno test imports itconst ROLES: readonly ["host", "dialect", "plugin"]The roles a library has in a family: a closed union.
The families of the libraries of commons and the names held for them (commons 0027-commons-libraries FR-023, FR-024; commons 0033-kanon FR-021, FR-024): what the family field of a manifest says, the reservations (names no library may take unless it is of the family they are held for), and the findings of the two sides of a family held together, the host's table and each member's manifest.
Pure: it takes the libraries as data and returns one sentence for each finding. A library names its host and its role (host, dialect or plugin); the host's kanon table says what its dialects and plugins are and how their packages are named (@intellectual-frontiers/kanon: family, instances, plugins), so the name of a member is checked against the host's rule and never against a rule written here. A reservation is data: an exact name or a prefix, and the host that may hold it. It reserves a name without a folder, so that no empty library is created to hold one.
Spec: 0001-libraries FR-016
ROLESconstno test imports itconst ROLES: readonly ["host", "dialect", "plugin"]The roles a library has in a family: a closed union.
Roletypeno test imports ittype Role = (typeof ROLES)[number];The role of a library in a family.
LibraryFamilytypeno test imports ittype LibraryFamily = { readonly host: string; readonly role: Role };What a manifest says of its family: the host's library name and its own role.
Matchtypeno test imports ittype Match = { readonly kind: "exact"; readonly name: string } | { readonly kind: "prefix"; readonly prefix: string };How a reservation holds names: one exact name, or every name that begins with a prefix.
Reservationtypeno test imports ittype Reservation = { readonly match: Match; readonly host: string; readonly reason: string };A held name: what it matches, the host whose family may use it and why it is held.
RESERVEDconstconst RESERVED: readonly Reservation[]The names held, as data: the check reads them and no folder holds them.
decodeFamilyfunctionfunction decodeFamily(input: { readonly host: string; readonly role: "dialect" | "host" | "plugin"; }): Result<LibraryFamily, string>The family field of a manifest, from what it says: the host's name and the role, or why it is not one.
Entrytypetype Entry = { readonly name: string; readonly family?: LibraryFamily; readonly kanon?: Table };What the check reads of a library: its name, its family and its table.
reservationFindingsfunctionfunction reservationFindings(libraries: readonly Entry[], reserved?: readonly Reservation[]): readonly string[]The findings of the names held: a library whose name a reservation holds and that is not of the family the name is held for.
familyFindingsfunctionfunction familyFindings(libraries: readonly Entry[]): readonly string[]The findings of a family held together: each member's name against the host's rule, each declared member registered, and each registered member declared (0033-kanon FR-021).