moonbitstack screening the desk sc–03 github

screening

A résumé in, a list of reasons out. The reader never guesses what a document meant.

01the deskof 04

Everything on this page is the library compiled to JavaScript. It reads the document you type and returns the tags and sentences the MoonBit side would return.

Uppercase a letter in name, add a hyphen at the end, push the description past 1024 characters, or change the directory — each one has its own tag. A document that does not parse at all comes back as one malformed fault, which is what keeps a batch check running.

application accepted

    02the corpusof 04

    One directory per rule, in both directions.

    These are the documents this library is judged against: for every rule, one directory that meets it and one that breaks it, plus the shapes that make a document refuse to parse. The counts beside them are this page running each one through the same checker as the desk above. Pick any of them to load it.

    One case of the corpus is missing here on purpose: the directory that holds no document at all. A desk that is handed text cannot see a file that is not there, so that case is judged by the tree reader instead.

    03the tagsof 04

    A fault has two faces: a tag a program matches on, and a sentence a person reads.

    Fault tags and when each one is reported
    TagReported when
    unexpected-fieldsThe header holds keys the specification does not define.
    missing-nameThere is no name.
    name-emptyname is empty, blank, or not text.
    name-too-longname is past 64 characters.
    name-not-lowercasename has an uppercase letter.
    name-edge-hyphenname starts or ends with a hyphen.
    name-double-hyphenname has two hyphens in a row.
    name-bad-charactername has a character that is neither a letter, a digit, nor a hyphen.
    name-mismatchThe directory and name differ after Unicode composition.
    missing-descriptionThere is no description.
    description-emptydescription is empty or blank.
    description-too-longdescription is past 1024 characters.
    compatibility-not-textcompatibility is present but not text.
    compatibility-too-longcompatibility is past 500 characters.
    malformedThe document does not parse; the refusal is carried inside the fault.
    missing-pathA directory that was named does not exist.
    not-a-directoryThe path is a file, not a skill directory.
    missing-documentThe directory holds no SKILL.md and no skill.md.

    04how it runsof 04

    The page is a client, and the glue is one function.

    The desk imports engine/moonskill.js, which is this library compiled for JavaScript with one function added: screen(text, root), which calls parse, validate and Skill::summary and returns their answer as JSON. No rule is written twice. If you change validate and rebuild, this page changes with it.

    The corpus above is the same idea: each directory is read from the repository and judged here, so the counts are not typed into the page.

    screentext → json
    browser glue

    The only glue

    moonbit, abridged
    pub fn screen(text : String, root : String) -> String {
      let skill = @moonskill.parse(text, root=root)
      let faults = @moonskill.validate(skill)
      // …the name, the summary, the location and the faults, as JSON
    }
    top