@decantr/verifier 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { EssenceFile } from '@decantr/essence-spec';
2
1
  import { ReviewExecutionPack } from '@decantr/core';
2
+ import { EssenceFile } from '@decantr/essence-spec';
3
3
 
4
4
  interface RuntimeAudit {
5
5
  distPresent: boolean;
@@ -53,6 +53,68 @@ interface BuiltDistAuditOptions {
53
53
  declare function emptyRuntimeAudit(failures?: string[]): RuntimeAudit;
54
54
  declare function auditBuiltDist(projectRoot: string, options?: BuiltDistAuditOptions): Promise<RuntimeAudit>;
55
55
 
56
+ /**
57
+ * v2.1 Tier C4 — Experiential interaction verifier.
58
+ *
59
+ * Scans generated source files for evidence that declared `interactions[]`
60
+ * (from pattern.v2.json) are actually implemented. This is the enforcement
61
+ * layer that converts the structural-vs-experiential gap (user audit:
62
+ * "experiential reads like guidance, nothing fails when I skip it") into
63
+ * a hard-edged structural check, on par with the other guard rules.
64
+ *
65
+ * Scanner is intentionally simple: regex/substring signal matching, not
66
+ * full AST analysis. Each interaction defines one or more signals that
67
+ * MUST appear somewhere in the project source. A signal is either:
68
+ * - a CSS class name (e.g., `d-pulse` for status-pulse)
69
+ * - a regex (e.g., /onPointer(Down|Move)/ for drag-nodes)
70
+ * If no signal matches, the interaction is marked as "missing" and the
71
+ * guard rule emits a violation.
72
+ *
73
+ * Why grep, not AST: scaffolds use diverse file shapes (JSX, MDX, plain
74
+ * HTML in marketing sites). A regex scan handles all of them; a real AST
75
+ * matcher would need framework-specific parsers per blueprint kind. Grep
76
+ * gets us 80% of the value at 10% of the complexity.
77
+ */
78
+ /** Either a literal substring or a regex pattern. */
79
+ type InteractionSignal = string | RegExp;
80
+ interface InteractionRequirement {
81
+ /** The interaction name from pattern.v2.json's enum. */
82
+ interaction: string;
83
+ /**
84
+ * One or more signals; ANY match satisfies the requirement. Allows
85
+ * authors flexibility — e.g., either `d-pulse` class OR a custom
86
+ * `@keyframes pulse` declaration both count for status-pulse.
87
+ */
88
+ signals: InteractionSignal[];
89
+ /** Human-readable suggestion when signals don't match. */
90
+ suggestion: string;
91
+ }
92
+ /**
93
+ * Mapping from canonical interaction name (pattern.v2.json enum) to its
94
+ * required signals. Add entries as new interactions are introduced.
95
+ */
96
+ declare const INTERACTION_SIGNALS: Record<string, InteractionRequirement>;
97
+ interface InteractionMissingFinding {
98
+ interaction: string;
99
+ suggestion: string;
100
+ }
101
+ /**
102
+ * Scan a source-tree map (file path → file contents) for evidence of each
103
+ * declared interaction. Returns a list of interactions whose signals were
104
+ * not found anywhere in the source.
105
+ *
106
+ * @param interactions Declared interactions from one or more page packs.
107
+ * Duplicates collapse to a single check.
108
+ * @param sources Map of file path → file contents to scan.
109
+ * @returns List of interactions that have no matching signal.
110
+ */
111
+ declare function verifyInteractionsInSource(interactions: string[], sources: Map<string, string>): InteractionMissingFinding[];
112
+ /**
113
+ * Convenience: list every recognized interaction name. Useful for
114
+ * documentation, validation, and surfacing the canonical enum.
115
+ */
116
+ declare function listKnownInteractions(): string[];
117
+
56
118
  declare const VERIFICATION_SCHEMA_URLS: {
57
119
  readonly common: "https://decantr.ai/schemas/verification-report.common.v1.json";
58
120
  readonly projectAudit: "https://decantr.ai/schemas/project-audit-report.v1.json";
@@ -235,4 +297,4 @@ declare function auditProject(projectRoot: string): Promise<ProjectAuditReport>;
235
297
  declare function critiqueSource({ filePath, code, reviewPack, packManifest, treatmentsCss, }: CritiqueSourceInput): FileCritiqueReport;
236
298
  declare function critiqueFile(filePath: string, projectRoot: string): Promise<FileCritiqueReport>;
237
299
 
238
- export { type BuiltDistAuditOptions, type CritiqueSourceInput, type FileCritiqueReport, type PackManifest, type ProjectAuditReport, type RuntimeAudit, type ShowcaseShortlistVerificationEntry, type ShowcaseShortlistVerificationReport, VERIFICATION_SCHEMA_URLS, type VerificationFinding, type VerificationScore, type VerificationSeverity, auditBuiltDist, auditProject, critiqueFile, critiqueSource, emptyRuntimeAudit, extractRouteHintsFromEssence };
300
+ export { type BuiltDistAuditOptions, type CritiqueSourceInput, type FileCritiqueReport, INTERACTION_SIGNALS, type InteractionMissingFinding, type InteractionRequirement, type InteractionSignal, type PackManifest, type ProjectAuditReport, type RuntimeAudit, type ShowcaseShortlistVerificationEntry, type ShowcaseShortlistVerificationReport, VERIFICATION_SCHEMA_URLS, type VerificationFinding, type VerificationScore, type VerificationSeverity, auditBuiltDist, auditProject, critiqueFile, critiqueSource, emptyRuntimeAudit, extractRouteHintsFromEssence, listKnownInteractions, verifyInteractionsInSource };