archivo del paquete→ .shtukbase/packages/decisions/checks/d01_record.ts
checks/d01_record.ts
22 líneas, 1.2 KB.
El archivo tal como está en el paquete: el código y sus comentarios no se traducen.
- // DEC-R01 (the fields part). An accepted or replaced decision names who decided (`by`), when (`decidedOn`) and
- // what it is about (`about`), and has a text. Whether the text holds the options and the reason is not judged.
- // The shared part is norms-core's (this package requires it), side by side in .shtukbase/packages/.
- import { empty, main, records, status } from '../../norms-core/checks/pagelib.ts';
- const MADE = ['accepted', 'replaced'];
- const FIELDS: [string, string][] = [['by', 'who decided'], ['decidedOn', 'date'], ['about', 'what about']];
- export const RULE = { id: 'dec-r01', title: 'An accepted decision: who decided, when, what about, and the text' };
- export function check(): string[] {
- const out: string[] = [];
- for (const [addr, head, body] of records('knowledge/decisions')) {
- if (!MADE.includes(status(head))) continue;
- const miss = FIELDS.filter(([f]) => empty(head[f])).map(([f, ru]) => `${f} (${ru})`);
- if (miss.length) out.push(`${addr}: the accepted decision does not fill ${miss.join(', ')}`);
- if (!body.trim()) out.push(`${addr}: the decision has no text: what was decided, which options there were, why this one`);
- }
- return out;
- }
- if (import.meta.main) main({ RULE, check });