|
| 1 | +---- MODULE CommandFrontmatter ---- |
| 2 | +\* Models parseCommandFrontmatter (src/services/command/commands.ts). |
| 3 | +\* Both callers, scanCommandDirectory and tryLoadCommand, use it. The property test covers both. |
| 4 | +\* Source: the header language in a workspace command file. Sink: the gray-matter engine call. |
| 5 | +\* Failure: a command file header selects an executable engine and the extension runs its code. |
| 6 | +\* Invariant: NoExecutableEngine. gray-matter is an oracle. Only the header language is modeled. |
| 7 | +\* Expect: Fixed holds. None fails at once. NoBomStrip fails with a BOM and an executable header. |
| 8 | +\* Result: Fixed holds in 6 states. None fails in 1 state. NoBomStrip fails in 1 state, with a BOM. |
| 9 | +\* Replay: gray-matter runs a js header in the real library. The guard in the code stops it. |
| 10 | +\* Not modeled: the YAML and JSON parsers. The command body. |
| 11 | +\* Cost: TLC runs in under 1 second. Agent time is not measured. |
| 12 | +\* Review: 1 covered (bot thread on double BOM, PR 2455), 0 added, 0 gap. |
| 13 | +\* Replay: two BOMs do not run code in gray-matter. It is a false alarm. A test case stays. |
| 14 | + |
| 15 | +CONSTANT Variant \* "Fixed", "None" or "NoBomStrip" |
| 16 | + |
| 17 | +VARIABLE in |
| 18 | + |
| 19 | +\* "exec" = js or javascript in any case. "data" = yaml, yml, json or no language. |
| 20 | +\* "other" = any other name. gray-matter finds no engine for it. |
| 21 | +Inputs == [bom : BOOLEAN, lang : {"data", "exec", "other"}] |
| 22 | + |
| 23 | +\* The guard reads the header language. Without the BOM strip it misses the header. |
| 24 | +GuardSeesHeader(i) == Variant = "Fixed" \/ (Variant = "NoBomStrip" /\ ~i.bom) |
| 25 | +Rejected(i) == GuardSeesHeader(i) /\ i.lang # "data" |
| 26 | +Executed(i) == i.lang = "exec" /\ ~Rejected(i) |
| 27 | + |
| 28 | +TypeOK == in \in Inputs |
| 29 | + |
| 30 | +Init == in \in Inputs |
| 31 | +Next == UNCHANGED in |
| 32 | +Spec == Init /\ [][Next]_in |
| 33 | + |
| 34 | +\* Safety: no input reaches an executable engine. |
| 35 | +NoExecutableEngine == ~Executed(in) |
| 36 | + |
| 37 | +==== |
0 commit comments