import type { MemoModel } from '../model/semantic.js'; import type { KindRegistry } from '../model/kind-registry.js'; import type { StandardsLibrary, StandardClauseInfo, UnknownRegimeCitation } from './standards-library.js'; export type EvidenceCategory = 'verification' | 'risk-control' | 'approval'; export interface EvidenceRef { category: EvidenceCategory; /** Element the evidence link reaches. */ elementId: string; elementName: string; elementKind: string; /** Relationship type the link was made with, e.g. "verifiedBy". */ via: string; } /** One `clauses:` citation from a document that exists in the project. */ export interface DocumentClauseCitation { /** Document id as the project knows it, e.g. "DOC-RMP-001". */ documentId: string; documentTitle: string; /** Resolved standard designation. */ designation: string; clauseNumber: string; } export interface StandardsReportInput { library: StandardsLibrary; /** The project's model. Absent means nothing is claimed — every clause is a gap. */ model?: MemoModel; /** Resolves supertypes so an evidence anchor matches its subtypes. */ kindRegistry?: KindRegistry; /** * Regimes to scope `required()` to. Empty or absent means the project * declared none, and every standard the library carries is reported — * stated as such rather than silently assuming a market. */ regimes?: string[]; /** Where `regimes` came from, for the report header. */ regimeSource?: RegimeSource; /** Clause citations from documents that exist in the project. */ documentClauses?: DocumentClauseCitation[]; } export type RegimeSource = 'project' | 'flag' | 'none'; export type ClauseStatus = 'evidenced' | 'claimed' | 'gap'; export interface ClaimantRef { elementId: string; name: string; kind: string; } export interface ClauseRow { /** SysML usage name of the clause instance. */ name: string; /** The `id` attribute, e.g. "STD-IEC-62304-5-2-2". */ id?: string; clauseNumber: string; /** MEMO-authored scope phrase; absent where MEMO has no verified reading. */ title?: string; normativeStrength?: string; status: ClauseStatus; /** Elements whose ConformsTo edge targets this clause. */ claimants: ClaimantRef[]; /** Documents whose frontmatter cites this clause. */ documents: Array<{ documentId: string; documentTitle: string; }>; evidence: EvidenceRef[]; } export interface StandardTotals { clauses: number; claimed: number; evidenced: number; gaps: number; } export interface StandardRow { designation: string; edition?: string; issuer?: string; /** Regimes this standard has standing in. Empty = no regime mandates it. */ regimes: string[]; /** * True when a declared regime pulls this standard into `required()`. * False for a standard the project's regimes do not reach, and for a * method/reference standard no regime mandates — both are still reported, * because a project may legitimately claim clauses of either. */ required: boolean; clauses: ClauseRow[]; totals: StandardTotals; } export interface StandardsReport { /** Regimes the report was scoped to. */ regimes: string[]; regimeSource: RegimeSource; /** Every `RegulatoryRegimeKind` member, for a "did you mean" on a bad flag. */ regimeVocabulary: string[]; /** Standards a declared regime requires. */ standards: StandardRow[]; /** * Standards no declared regime requires: method and reference standards, * and packs outside the declared regimes. Reported separately rather than * dropped — a clause claimed here is still traceability, and a pack that * vanished from the output would look like a pack that does not exist. */ unrequired: StandardRow[]; /** Totals over `standards` only — the required set is what "gaps" means. */ totals: StandardTotals; /** Defects in the packs themselves, surfaced rather than swallowed. */ unknownRegimes: UnknownRegimeCitation[]; orphanClauses: StandardClauseInfo[]; /** True when the library could not be located at all. */ libraryMissing: boolean; /** * False when no kind registry was available, so the evidence anchors could * not be widened to their subtypes. * * Without it a `MarkdownDocumentSource` is not recognised as a * `ControlledArtifact` and its approval does not count — the report * UNDER-states evidence. That is the safer direction to fail in, but it is * still a wrong number, so it is stated rather than left to be inferred * from a suspiciously low column. */ evidenceResolvable: boolean; } export declare function computeStandardsReport(input: StandardsReportInput): StandardsReport; /** A document that exists in the project, as the workbench store hands it over. */ export interface ProjectDocument { id: string; title: string; /** Template the document was created from, e.g. "iso-14971/rmp". */ templateId?: string; /** Raw markdown including frontmatter, when the document has its own. */ content?: string; } /** * Resolve the clauses cited by documents that EXIST in the project. * * Existence is the point. The clause list a template carries says what a * document of that type would claim; only a document actually present in * `dhf/documents/` claims it. A checklist built from the template set would * report full coverage for a project that has written nothing. * * A document's own frontmatter wins over its template's, because the workbench * merges hand edits back into the file and a document that has narrowed or * extended its claim has said so there. */ export declare function collectDocumentClauses(docs: ProjectDocument[], library: StandardsLibrary, customTemplateDir?: string): DocumentClauseCitation[]; /** * The regimes a project declares on its `ProjectMethodBinding`. * * Not application settings: `MEMOConfig` carries how a command runs, never what * the model means, and `settings-boundary.ts` rejects semantic fields outright. * A submission target selects which clauses a project is answerable for, which * is squarely semantic, so it is declared in `model/catalog/project.sysml` like * the methodology selection beside it. * * The attribute arrives from the builder as the qualified members joined by * commas — `"RegulatoryRegimeKind::CE, RegulatoryRegimeKind::MDR"`. One * spelling only: an unqualified member is not a synonym, it is skipped and * reported, the same rule the enum carries everywhere else in MEMO. */ export declare function readDeclaredRegimes(model: MemoModel | undefined): { regimes: string[]; /** Entries that were not qualified members, verbatim. */ rejected: string[]; }; export interface StandardsReportFilter { /** Substring of a designation, case-insensitive. */ standard?: string; /** Keep only gap clauses (and only standards that have some). */ gapsOnly?: boolean; } /** * Narrow a computed report. Filtering is separate from computing so the totals * a filtered view shows are the totals of what it shows — a `--gaps-only` * table whose "Clauses" column still counted the claimed ones would be a * different kind of lie than the one this whole area exists to remove. */ export declare function filterStandardsReport(report: StandardsReport, filter: StandardsReportFilter): StandardsReport; /** * Clause numbers sort numerically segment by segment, so §8 precedes §14. * `localeCompare` put IEC 60601-1 clause 14 above clause 8 in the Phase 3.0 * conformance matrix; a compliance table ordered 10, 11, 14, 8, 9 reads as * broken long before a reader works out why. Non-numeric segments — 820.30(c), * V.A — fall back to a string compare within the segment. */ export declare function byClauseNumber(a: { clauseNumber: string; }, b: { clauseNumber: string; }): number; //# sourceMappingURL=standards-report.d.ts.map