changes.doneWhenItemsfunctionno test imports itfunction doneWhenItems(body: IssueBody): readonly CheckItem[]The items under Done when, in order.
The body of a capability's change request as the check reads it (commons 0020-ifccm FR-003, FR-004, FR-006): its sections Why, Today, Scope and Done when in that order, its checkbox items (- [ ], - [x]) and the requirements its Done when names (NNNN-slug FR-nnn).
A section is a Markdown heading of any level whose text is the section's name (a trailing colon is allowed, case is not significant) and the lines under it up to the next heading of the same or a higher level. Lines inside a fenced code block are not read. The body is the text a Git host gives for an issue, so that a GitHub issue and a GitLab issue read the same.
import { parseIssueBody, unticked } from "./issue-body.ts";
const body = parseIssueBody("## Why\nx\n## Done when\n- [x] 0020-ifccm FR-005 by the test\n- [ ] 0020-ifccm FR-006\n");
unticked(body).length; // 1changes.doneWhenItemsfunctionno test imports itfunction doneWhenItems(body: IssueBody): readonly CheckItem[]The items under Done when, in order.
changes.doneWhenRequirementsfunctionno test imports itfunction doneWhenRequirements(body: IssueBody): readonly string[]The requirements the Done when section names (0020-ifccm FR-003).
changes.parseIssueBodyfunctionno test imports itfunction parseIssueBody(body: string): IssueBodyA body read: its sections, and every checkbox item with the section it is under.
changes.requirementsInfunctionno test imports itfunction requirementsIn(text: string): readonly string[]The requirements a text names, NNNN-slug FR-nnn each once: 0020-ifccm FR-005, FR-007 to FR-009 gives FR-005, FR-007, FR-008 and FR-009.
changes.SECTIONSconstno test imports itconst SECTIONS: readonly ["Why", "Today", "Scope", "Done when"]The sections of a capability's change request, in order (0020-ifccm FR-003).
changes.sectionOffunctionno test imports itfunction sectionOf(body: IssueBody, name: "Done when" | "Scope" | "Today" | "Why"): Section | undefinedThe section called name (case does not matter), or undefined.
changes.sectionProblemsfunctionno test imports itfunction sectionProblems(body: IssueBody): readonly SectionProblem[]What is wrong with the four sections a capability's change request must have, in order (0020-ifccm FR-003).
changes.untickedfunctionno test imports itfunction unticked(body: IssueBody): readonly CheckItem[]The items that are not ticked, in the order of the body.
changes.CheckItemtypeno test imports ittype CheckItem = { readonly text: string; readonly checked: boolean; readonly line: number; readonly section: string | undefined };A checkbox item: its text, whether it is ticked, its line and the section it is under (none before the first heading).
changes.IssueBodytypeno test imports ittype IssueBody = { readonly sections: readonly Section[]; readonly items: readonly CheckItem[] };A body as the check reads it.
changes.Sectiontypeno test imports ittype Section = { readonly name: string; readonly level: number; readonly line: number; readonly end: number; readonly text: string };A section of a body: its heading as written, its level, its line, the line after its last (end) and the text under it.
changes.SectionNametypeno test imports ittype SectionName = (typeof SECTIONS)[number];The name of one of those sections.
changes.SectionProblemtypeno test imports ittype SectionProblem =
| { readonly kind: "missing"; readonly name: SectionName }
| { readonly kind: "order"; readonly name: SectionName; readonly before: SectionName };What is wrong with a capability's sections: one missing, or two out of order.
doneWhenItemsfunctionfunction doneWhenItems(body: IssueBody): readonly CheckItem[]The items under Done when, in order.
doneWhenRequirementsfunctionfunction doneWhenRequirements(body: IssueBody): readonly string[]The requirements the Done when section names (0020-ifccm FR-003).
parseIssueBodyfunctionfunction parseIssueBody(body: string): IssueBodyA body read: its sections, and every checkbox item with the section it is under.
requirementsInfunctionfunction requirementsIn(text: string): readonly string[]The requirements a text names, NNNN-slug FR-nnn each once: 0020-ifccm FR-005, FR-007 to FR-009 gives FR-005, FR-007, FR-008 and FR-009.
SECTIONSconstno test imports itconst SECTIONS: readonly ["Why", "Today", "Scope", "Done when"]The sections of a capability's change request, in order (0020-ifccm FR-003).
sectionOffunctionno test imports itfunction sectionOf(body: IssueBody, name: "Done when" | "Scope" | "Today" | "Why"): Section | undefinedThe section called name (case does not matter), or undefined.
sectionProblemsfunctionfunction sectionProblems(body: IssueBody): readonly SectionProblem[]What is wrong with the four sections a capability's change request must have, in order (0020-ifccm FR-003).
untickedfunctionfunction unticked(body: IssueBody): readonly CheckItem[]The items that are not ticked, in the order of the body.
CheckItemtypeno test imports ittype CheckItem = { readonly text: string; readonly checked: boolean; readonly line: number; readonly section: string | undefined };A checkbox item: its text, whether it is ticked, its line and the section it is under (none before the first heading).
IssueBodytypeno test imports ittype IssueBody = { readonly sections: readonly Section[]; readonly items: readonly CheckItem[] };A body as the check reads it.
Sectiontypeno test imports ittype Section = { readonly name: string; readonly level: number; readonly line: number; readonly end: number; readonly text: string };A section of a body: its heading as written, its level, its line, the line after its last (end) and the text under it.
SectionNametypeno test imports ittype SectionName = (typeof SECTIONS)[number];The name of one of those sections.
SectionProblemtypeno test imports ittype SectionProblem =
| { readonly kind: "missing"; readonly name: SectionName }
| { readonly kind: "order"; readonly name: SectionName; readonly before: SectionName };What is wrong with a capability's sections: one missing, or two out of order.