@decantr/verifier 1.1.1 → 2.1.0

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/README.md CHANGED
@@ -16,7 +16,9 @@ npm install @decantr/verifier
16
16
  - `auditProject()` for project-level Decantr audits
17
17
  - `auditBuiltDist()` for built-output runtime verification against emitted HTML, assets, and route hints
18
18
  - `critiqueFile()` for file-level review against compiled review-pack contracts
19
- - schema-backed report types for project audits, Project Health, file critiques, and showcase verification
19
+ - `createContractAssertions()` for explicit route, shell, accessibility, context, and design-token assertions derived from Essence/context
20
+ - `createEvidenceBundle()` for privacy-redacted local evidence artifacts used by AI repair loops and CI
21
+ - schema-backed report types for project audits, Project Health, Evidence Bundles, Workspace Health, file critiques, and showcase verification
20
22
  - `ProjectHealthReport`, `ProjectHealthFinding`, and `ProjectHealthRemediation` types for the CLI's end-user health surface
21
23
  - published verifier report schemas are exercised by AJV-backed round-trip tests against real audit, critique, and shortlist-report outputs
22
24
  - project audits include runtime evidence when a built `dist/` output is present:
@@ -31,9 +33,16 @@ npm install @decantr/verifier
31
33
  ## Example
32
34
 
33
35
  ```ts
34
- import { auditProject, critiqueFile, type ProjectHealthReport } from '@decantr/verifier';
36
+ import {
37
+ auditProject,
38
+ createContractAssertions,
39
+ createEvidenceBundle,
40
+ critiqueFile,
41
+ type ProjectHealthReport,
42
+ } from '@decantr/verifier';
35
43
 
36
44
  const audit = await auditProject(process.cwd());
45
+ const assertions = createContractAssertions(process.cwd(), audit);
37
46
  const critique = await critiqueFile('./src/pages/overview.tsx', process.cwd());
38
47
 
39
48
  function isBlocking(report: ProjectHealthReport) {
@@ -46,12 +55,14 @@ function isBlocking(report: ProjectHealthReport) {
46
55
  - `@decantr/verifier/schema/verification-report.common.v1.json`
47
56
  - `@decantr/verifier/schema/project-audit-report.v1.json`
48
57
  - `@decantr/verifier/schema/project-health-report.v1.json`
58
+ - `@decantr/verifier/schema/evidence-bundle.v1.json`
59
+ - `@decantr/verifier/schema/workspace-health-report.v1.json`
49
60
  - `@decantr/verifier/schema/file-critique-report.v1.json`
50
61
  - `@decantr/verifier/schema/showcase-shortlist-report.v1.json`
51
62
 
52
63
  ## Compatibility
53
64
 
54
- `@decantr/verifier` is stable in the `1.x` line for the documented verifier APIs and published report-schema exports.
65
+ `@decantr/verifier` is stable in the `2.x` line for the documented verifier APIs and published report-schema exports.
55
66
 
56
67
  - new checks and additive report fields may appear in compatible releases
57
68
  - breaking report-shape or exported API changes require a major version
package/dist/index.d.ts CHANGED
@@ -54,7 +54,7 @@ declare function emptyRuntimeAudit(failures?: string[]): RuntimeAudit;
54
54
  declare function auditBuiltDist(projectRoot: string, options?: BuiltDistAuditOptions): Promise<RuntimeAudit>;
55
55
 
56
56
  /**
57
- * v2.1 Tier C4 — Experiential interaction verifier.
57
+ * Experiential interaction verifier.
58
58
  *
59
59
  * Scans generated source files for evidence that declared `interactions[]`
60
60
  * (from pattern.v2.json) are actually implemented. This is the enforcement
@@ -119,12 +119,14 @@ declare const VERIFICATION_SCHEMA_URLS: {
119
119
  readonly common: "https://decantr.ai/schemas/verification-report.common.v1.json";
120
120
  readonly projectAudit: "https://decantr.ai/schemas/project-audit-report.v1.json";
121
121
  readonly projectHealth: "https://decantr.ai/schemas/project-health-report.v1.json";
122
+ readonly evidenceBundle: "https://decantr.ai/schemas/evidence-bundle.v1.json";
123
+ readonly workspaceHealth: "https://decantr.ai/schemas/workspace-health-report.v1.json";
122
124
  readonly fileCritique: "https://decantr.ai/schemas/file-critique-report.v1.json";
123
125
  readonly showcaseShortlist: "https://decantr.ai/schemas/showcase-shortlist-report.v1.json";
124
126
  };
125
127
  type VerificationSeverity = 'error' | 'warn' | 'info';
126
128
  type ProjectHealthStatus = 'healthy' | 'warning' | 'error';
127
- type ProjectHealthFindingSource = 'audit' | 'check' | 'brownfield' | 'runtime' | 'pack' | 'interaction';
129
+ type ProjectHealthFindingSource = 'audit' | 'assertion' | 'browser' | 'check' | 'brownfield' | 'design-token' | 'runtime' | 'pack' | 'interaction';
128
130
  interface VerificationFinding {
129
131
  id: string;
130
132
  category: string;
@@ -248,6 +250,98 @@ interface ProjectHealthReport {
248
250
  };
249
251
  findings: ProjectHealthFinding[];
250
252
  }
253
+ type ContractAssertionCategory = 'route' | 'shell' | 'region' | 'interaction' | 'accessibility' | 'design-token' | 'context' | 'policy';
254
+ interface ContractAssertion {
255
+ id: string;
256
+ category: ContractAssertionCategory;
257
+ status: 'passed' | 'failed' | 'not_applicable';
258
+ severity: VerificationSeverity;
259
+ message: string;
260
+ evidence: string[];
261
+ target?: string;
262
+ rule: string;
263
+ suggestedFix?: string;
264
+ }
265
+ interface EvidenceProvenanceEntry {
266
+ path: string;
267
+ present: boolean;
268
+ hash: string | null;
269
+ generatedAt: string | null;
270
+ }
271
+ interface EvidenceBundle {
272
+ $schema: string;
273
+ generatedAt: string;
274
+ project: {
275
+ id: string;
276
+ rootLabel: string;
277
+ };
278
+ toolchain: {
279
+ verifierVersion: string | null;
280
+ };
281
+ privacy: {
282
+ localOnly: boolean;
283
+ redactedFields: string[];
284
+ screenshotsLocalOnly: boolean;
285
+ };
286
+ health: {
287
+ status: ProjectHealthStatus;
288
+ score: number;
289
+ errorCount: number;
290
+ warnCount: number;
291
+ infoCount: number;
292
+ findingCount: number;
293
+ };
294
+ provenance: {
295
+ essence: EvidenceProvenanceEntry;
296
+ packManifest: EvidenceProvenanceEntry;
297
+ reviewPack: EvidenceProvenanceEntry;
298
+ workspaceConfig?: EvidenceProvenanceEntry;
299
+ designTokens?: EvidenceProvenanceEntry;
300
+ };
301
+ assertions: ContractAssertion[];
302
+ findings: Array<{
303
+ id: string;
304
+ source: ProjectHealthFindingSource;
305
+ category: string;
306
+ severity: VerificationSeverity;
307
+ message: string;
308
+ evidence: string[];
309
+ target?: string;
310
+ rule?: string;
311
+ suggestedFix?: string;
312
+ remediationSummary: string;
313
+ commands: string[];
314
+ promptCommand: string;
315
+ }>;
316
+ browser?: {
317
+ enabled: boolean;
318
+ status: 'not_requested' | 'unavailable' | 'passed' | 'failed';
319
+ baseUrl: string | null;
320
+ screenshots: string[];
321
+ findings: string[];
322
+ };
323
+ designTokens?: {
324
+ source: string;
325
+ status: 'not_requested' | 'passed' | 'warning' | 'error';
326
+ compared: number;
327
+ matched: number;
328
+ missing: string[];
329
+ };
330
+ }
331
+ interface EvidenceBundleInput {
332
+ projectRoot: string;
333
+ report: ProjectHealthReport;
334
+ audit?: ProjectAuditReport | null;
335
+ assertions?: ContractAssertion[];
336
+ verifierVersion?: string | null;
337
+ workspaceConfigPath?: string | null;
338
+ designTokensPath?: string | null;
339
+ browser?: EvidenceBundle['browser'];
340
+ designTokens?: EvidenceBundle['designTokens'];
341
+ }
342
+ declare const EVIDENCE_BUNDLE_SCHEMA_URL = "https://decantr.ai/schemas/evidence-bundle.v1.json";
343
+ declare function createContractAssertions(projectRoot: string, audit?: ProjectAuditReport | null): ContractAssertion[];
344
+ declare function createEvidenceBundle(input: EvidenceBundleInput): EvidenceBundle;
251
345
  interface FileCritiqueReport {
252
346
  $schema: string;
253
347
  file: string;
@@ -362,4 +456,4 @@ declare function auditProject(projectRoot: string): Promise<ProjectAuditReport>;
362
456
  declare function critiqueSource({ filePath, code, reviewPack, packManifest, treatmentsCss, }: CritiqueSourceInput): FileCritiqueReport;
363
457
  declare function critiqueFile(filePath: string, projectRoot: string): Promise<FileCritiqueReport>;
364
458
 
365
- export { type BuiltDistAuditOptions, type CritiqueSourceInput, type FileCritiqueReport, INTERACTION_SIGNALS, type InteractionMissingFinding, type InteractionRequirement, type InteractionSignal, type PackManifest, type ProjectAuditReport, type ProjectHealthFinding, type ProjectHealthFindingSource, type ProjectHealthPackSummary, type ProjectHealthRemediation, type ProjectHealthReport, type ProjectHealthRouteSummary, type ProjectHealthStatus, type RuntimeAudit, type ShowcaseShortlistVerificationEntry, type ShowcaseShortlistVerificationReport, VERIFICATION_SCHEMA_URLS, type VerificationFinding, type VerificationScore, type VerificationSeverity, auditBuiltDist, auditProject, critiqueFile, critiqueSource, emptyRuntimeAudit, extractRouteHintsFromEssence, listKnownInteractions, verifyInteractionsInSource };
459
+ export { type BuiltDistAuditOptions, type ContractAssertion, type ContractAssertionCategory, type CritiqueSourceInput, EVIDENCE_BUNDLE_SCHEMA_URL, type EvidenceBundle, type EvidenceBundleInput, type EvidenceProvenanceEntry, type FileCritiqueReport, INTERACTION_SIGNALS, type InteractionMissingFinding, type InteractionRequirement, type InteractionSignal, type PackManifest, type ProjectAuditReport, type ProjectHealthFinding, type ProjectHealthFindingSource, type ProjectHealthPackSummary, type ProjectHealthRemediation, type ProjectHealthReport, type ProjectHealthRouteSummary, type ProjectHealthStatus, type RuntimeAudit, type ShowcaseShortlistVerificationEntry, type ShowcaseShortlistVerificationReport, VERIFICATION_SCHEMA_URLS, type VerificationFinding, type VerificationScore, type VerificationSeverity, auditBuiltDist, auditProject, createContractAssertions, createEvidenceBundle, critiqueFile, critiqueSource, emptyRuntimeAudit, extractRouteHintsFromEssence, listKnownInteractions, verifyInteractionsInSource };