ShtukbaseStandard

Collections

collections · version 0.2.1
Shtukbase Basicin Basic3 norms3 checks

What a collection is: a folder of pages of one type and a page describing their fields. The kinds of fields on one page and three schema norms with checks: a relation points to a record of the right collection, a value is from the list, a required field is filled.

About the package

The package explains what a collection is and what fields there are, and brings three schema norms; their enforcers are the package checks. A collection schema (properties: in its page) already says which field points to which collection, which values are valid and what is required; the package checks read the schemas and compare the records with them. New collections come under the check by themselves.

The checks do not let a violation pass: they print what they find, one line per record, and finish with an error.

Where the boundary is

  • Here: the collection format, the kinds of fields, relations, values, requiredness.
  • A field of kind "phase" (the state of a record) is checked by the package contours.
  • The norm "One kind of record, one place" is checked by the package layers.
  • Which collections a project has is decided by the packages that bring them.

The checks are written in TypeScript and run by Bun from the project root. The shared part is checks/lib/: pages.ts (reading pages, front matter, paths, collection records), speclib.ts (the project, the result of a rule, the run), schemalib.ts (schemas, values, findings) and runner.ts (running one check as an action); the checks of other packages build on it.

Norms 3

"Blocks": the enforcer stops a violation. "Observes": it only notes it. Level MUST means required; SHOULD means yes by default.

Actions 3

NameWhat it doesFileWhen
relationsA relation field points to an existing record of the right collection
norm SCH-R01
checks/s01_relations.ts
check
valuesSelect, date, number and checkbox values are valid
norm SCH-R02
checks/s02_values.ts
check
requiredRequired fields are filled
norm SCH-R03
checks/s03_required.ts
check

shtuk check runs the checks; shtuk run collections <name> runs any action. "After install" actions run by themselves only if the package comes from a trusted source.

Pages 5

They go into the project at these paths.

Package files 9

They go into .shtukbase/packages/collections/; actions run from there.