The only glue
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
}
A résumé in, a list of reasons out. The reader never guesses what a document meant.
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.
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.
A fault has two faces: a tag a program matches on, and a sentence a person reads.
| Tag | Reported when |
|---|---|
unexpected-fields | The header holds keys the specification does not define. |
missing-name | There is no name. |
name-empty | name is empty, blank, or not text. |
name-too-long | name is past 64 characters. |
name-not-lowercase | name has an uppercase letter. |
name-edge-hyphen | name starts or ends with a hyphen. |
name-double-hyphen | name has two hyphens in a row. |
name-bad-character | name has a character that is neither a letter, a digit, nor a hyphen. |
name-mismatch | The directory and name differ after Unicode composition. |
missing-description | There is no description. |
description-empty | description is empty or blank. |
description-too-long | description is past 1024 characters. |
compatibility-not-text | compatibility is present but not text. |
compatibility-too-long | compatibility is past 500 characters. |
malformed | The document does not parse; the refusal is carried inside the fault. |
missing-path | A directory that was named does not exist. |
not-a-directory | The path is a file, not a skill directory. |
missing-document | The directory holds no SKILL.md and no skill.md. |
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.
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
}