@decantr/verifier 1.0.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 +56 -0
- package/dist/index.d.ts +238 -0
- package/dist/index.js +8523 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
- package/schema/file-critique-report.v1.json +46 -0
- package/schema/project-audit-report.v1.json +308 -0
- package/schema/showcase-shortlist-report.v1.json +378 -0
- package/schema/verification-report.common.v1.json +76 -0
package/README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# @decantr/verifier
|
|
2
|
+
|
|
3
|
+
Support status: `core-supported`
|
|
4
|
+
Release channel: `stable`
|
|
5
|
+
|
|
6
|
+
Shared Decantr verification, critique, and report-schema engine used by the CLI, MCP server, and future CI/hosted verification surfaces.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @decantr/verifier
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What It Exports
|
|
15
|
+
|
|
16
|
+
- `auditProject()` for project-level Decantr audits
|
|
17
|
+
- `auditBuiltDist()` for built-output runtime verification against emitted HTML, assets, and route hints
|
|
18
|
+
- `critiqueFile()` for file-level review against compiled review-pack contracts
|
|
19
|
+
- schema-backed report types for project audits, file critiques, and showcase verification
|
|
20
|
+
- published verifier report schemas are exercised by AJV-backed round-trip tests against real audit, critique, and shortlist-report outputs
|
|
21
|
+
- project audits include runtime evidence when a built `dist/` output is present:
|
|
22
|
+
- root document
|
|
23
|
+
- document title
|
|
24
|
+
- document `lang` and `viewport` metadata
|
|
25
|
+
- emitted assets
|
|
26
|
+
- route-document coverage
|
|
27
|
+
- built asset byte budgets for JS, CSS, and total payload
|
|
28
|
+
- auth-topology warnings when the essence declares authentication without clear gateway or entry routes
|
|
29
|
+
|
|
30
|
+
## Example
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { auditProject, critiqueFile } from '@decantr/verifier';
|
|
34
|
+
|
|
35
|
+
const audit = await auditProject(process.cwd());
|
|
36
|
+
const critique = await critiqueFile('./src/pages/overview.tsx', process.cwd());
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Schema Exports
|
|
40
|
+
|
|
41
|
+
- `@decantr/verifier/schema/verification-report.common.v1.json`
|
|
42
|
+
- `@decantr/verifier/schema/project-audit-report.v1.json`
|
|
43
|
+
- `@decantr/verifier/schema/file-critique-report.v1.json`
|
|
44
|
+
- `@decantr/verifier/schema/showcase-shortlist-report.v1.json`
|
|
45
|
+
|
|
46
|
+
## Compatibility
|
|
47
|
+
|
|
48
|
+
`@decantr/verifier` is stable in the `1.x` line for the documented verifier APIs and published report-schema exports.
|
|
49
|
+
|
|
50
|
+
- new checks and additive report fields may appear in compatible releases
|
|
51
|
+
- breaking report-shape or exported API changes require a major version
|
|
52
|
+
- hosted and CLI verifier consumers should treat the published schemas as the supported contract surface
|
|
53
|
+
|
|
54
|
+
## License
|
|
55
|
+
|
|
56
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { EssenceFile } from '@decantr/essence-spec';
|
|
2
|
+
import { ReviewExecutionPack } from '@decantr/core';
|
|
3
|
+
|
|
4
|
+
interface RuntimeAudit {
|
|
5
|
+
distPresent: boolean;
|
|
6
|
+
indexPresent: boolean;
|
|
7
|
+
checked: boolean;
|
|
8
|
+
passed: boolean | null;
|
|
9
|
+
rootDocumentOk: boolean;
|
|
10
|
+
titleOk: boolean;
|
|
11
|
+
langOk: boolean;
|
|
12
|
+
viewportOk: boolean;
|
|
13
|
+
charsetOk: boolean;
|
|
14
|
+
cspSignalOk: boolean;
|
|
15
|
+
inlineScriptCount: number;
|
|
16
|
+
inlineEventHandlerCount: number;
|
|
17
|
+
externalScriptsWithoutIntegrityCount: number;
|
|
18
|
+
externalScriptsWithIntegrityMissingCrossoriginCount: number;
|
|
19
|
+
externalStylesheetsWithoutIntegrityCount: number;
|
|
20
|
+
externalStylesheetsWithIntegrityMissingCrossoriginCount: number;
|
|
21
|
+
externalScriptsWithInsecureTransportCount: number;
|
|
22
|
+
externalStylesheetsWithInsecureTransportCount: number;
|
|
23
|
+
externalMediaSourcesWithInsecureTransportCount: number;
|
|
24
|
+
externalBlankLinksWithoutRelCount: number;
|
|
25
|
+
externalIframesWithoutSandboxCount: number;
|
|
26
|
+
externalIframesWithInsecureTransportCount: number;
|
|
27
|
+
jsEvalSignalCount: number;
|
|
28
|
+
jsHtmlInjectionSignalCount: number;
|
|
29
|
+
jsInsecureTransportSignalCount: number;
|
|
30
|
+
jsSecretSignalCount: number;
|
|
31
|
+
assetCount: number;
|
|
32
|
+
assetsPassed: number;
|
|
33
|
+
routeHintsChecked: string[];
|
|
34
|
+
routeHintsMatched: number;
|
|
35
|
+
routeHintsCoverageOk: boolean;
|
|
36
|
+
routeDocumentsChecked: number;
|
|
37
|
+
routeDocumentsPassed: number;
|
|
38
|
+
routeDocumentsHardenedCount: number;
|
|
39
|
+
routeDocumentsCoverageOk: boolean;
|
|
40
|
+
routeDocumentsHardeningOk: boolean;
|
|
41
|
+
fullRouteCoverageOk: boolean;
|
|
42
|
+
totalAssetBytes: number;
|
|
43
|
+
jsAssetBytes: number;
|
|
44
|
+
cssAssetBytes: number;
|
|
45
|
+
largestAssetPath: string | null;
|
|
46
|
+
largestAssetBytes: number;
|
|
47
|
+
failures: string[];
|
|
48
|
+
}
|
|
49
|
+
interface BuiltDistAuditOptions {
|
|
50
|
+
distDir?: string;
|
|
51
|
+
routeHints?: string[];
|
|
52
|
+
}
|
|
53
|
+
declare function emptyRuntimeAudit(failures?: string[]): RuntimeAudit;
|
|
54
|
+
declare function auditBuiltDist(projectRoot: string, options?: BuiltDistAuditOptions): Promise<RuntimeAudit>;
|
|
55
|
+
|
|
56
|
+
declare const VERIFICATION_SCHEMA_URLS: {
|
|
57
|
+
readonly common: "https://decantr.ai/schemas/verification-report.common.v1.json";
|
|
58
|
+
readonly projectAudit: "https://decantr.ai/schemas/project-audit-report.v1.json";
|
|
59
|
+
readonly fileCritique: "https://decantr.ai/schemas/file-critique-report.v1.json";
|
|
60
|
+
readonly showcaseShortlist: "https://decantr.ai/schemas/showcase-shortlist-report.v1.json";
|
|
61
|
+
};
|
|
62
|
+
type VerificationSeverity = 'error' | 'warn' | 'info';
|
|
63
|
+
interface VerificationFinding {
|
|
64
|
+
id: string;
|
|
65
|
+
category: string;
|
|
66
|
+
severity: VerificationSeverity;
|
|
67
|
+
message: string;
|
|
68
|
+
evidence: string[];
|
|
69
|
+
target?: string;
|
|
70
|
+
file?: string;
|
|
71
|
+
rule?: string;
|
|
72
|
+
suggestedFix?: string;
|
|
73
|
+
}
|
|
74
|
+
interface VerificationScore {
|
|
75
|
+
category: string;
|
|
76
|
+
focusArea: string;
|
|
77
|
+
score: number;
|
|
78
|
+
details: string;
|
|
79
|
+
suggestions: string[];
|
|
80
|
+
}
|
|
81
|
+
interface PackManifestEntry {
|
|
82
|
+
id: string;
|
|
83
|
+
markdown: string;
|
|
84
|
+
json: string;
|
|
85
|
+
}
|
|
86
|
+
interface PackManifest {
|
|
87
|
+
$schema?: string;
|
|
88
|
+
version: string;
|
|
89
|
+
generatedAt: string;
|
|
90
|
+
scaffold: PackManifestEntry | null;
|
|
91
|
+
review?: PackManifestEntry | null;
|
|
92
|
+
sections: Array<PackManifestEntry & {
|
|
93
|
+
pageIds: string[];
|
|
94
|
+
}>;
|
|
95
|
+
pages: Array<PackManifestEntry & {
|
|
96
|
+
sectionId: string | null;
|
|
97
|
+
sectionRole: string | null;
|
|
98
|
+
}>;
|
|
99
|
+
mutations?: Array<PackManifestEntry & {
|
|
100
|
+
mutationType: string;
|
|
101
|
+
}>;
|
|
102
|
+
}
|
|
103
|
+
interface ProjectAuditReport {
|
|
104
|
+
$schema: string;
|
|
105
|
+
projectRoot: string;
|
|
106
|
+
valid: boolean;
|
|
107
|
+
essence: EssenceFile | null;
|
|
108
|
+
reviewPack: ReviewExecutionPack | null;
|
|
109
|
+
packManifest: PackManifest | null;
|
|
110
|
+
runtimeAudit: RuntimeAudit;
|
|
111
|
+
findings: VerificationFinding[];
|
|
112
|
+
summary: {
|
|
113
|
+
errorCount: number;
|
|
114
|
+
warnCount: number;
|
|
115
|
+
infoCount: number;
|
|
116
|
+
essenceVersion: string | null;
|
|
117
|
+
reviewPackPresent: boolean;
|
|
118
|
+
packManifestPresent: boolean;
|
|
119
|
+
runtimeAuditChecked: boolean;
|
|
120
|
+
runtimePassed: boolean | null;
|
|
121
|
+
pageCount: number;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
interface FileCritiqueReport {
|
|
125
|
+
$schema: string;
|
|
126
|
+
file: string;
|
|
127
|
+
overall: number;
|
|
128
|
+
scores: VerificationScore[];
|
|
129
|
+
findings: VerificationFinding[];
|
|
130
|
+
focusAreas: string[];
|
|
131
|
+
reviewPack: ReviewExecutionPack | null;
|
|
132
|
+
}
|
|
133
|
+
interface CritiqueSourceInput {
|
|
134
|
+
filePath: string;
|
|
135
|
+
code: string;
|
|
136
|
+
reviewPack?: ReviewExecutionPack | null;
|
|
137
|
+
packManifest?: PackManifest | null;
|
|
138
|
+
treatmentsCss?: string;
|
|
139
|
+
}
|
|
140
|
+
interface ShowcaseShortlistVerificationEntry {
|
|
141
|
+
slug: string;
|
|
142
|
+
target: string | null;
|
|
143
|
+
classification: 'pending' | 'A' | 'B' | 'C' | 'D';
|
|
144
|
+
verificationStatus: 'pending' | 'build-green' | 'build-red' | 'smoke-green' | 'smoke-red';
|
|
145
|
+
build: {
|
|
146
|
+
passed: boolean | null;
|
|
147
|
+
durationMs: number;
|
|
148
|
+
};
|
|
149
|
+
smoke: {
|
|
150
|
+
passed: boolean | null;
|
|
151
|
+
durationMs: number;
|
|
152
|
+
rootDocumentOk: boolean;
|
|
153
|
+
titleOk: boolean;
|
|
154
|
+
langOk: boolean;
|
|
155
|
+
viewportOk: boolean;
|
|
156
|
+
charsetOk: boolean;
|
|
157
|
+
cspSignalOk: boolean;
|
|
158
|
+
inlineScriptCount: number;
|
|
159
|
+
inlineEventHandlerCount: number;
|
|
160
|
+
externalScriptsWithoutIntegrityCount: number;
|
|
161
|
+
externalScriptsWithIntegrityMissingCrossoriginCount: number;
|
|
162
|
+
externalStylesheetsWithoutIntegrityCount: number;
|
|
163
|
+
externalStylesheetsWithIntegrityMissingCrossoriginCount: number;
|
|
164
|
+
externalScriptsWithInsecureTransportCount: number;
|
|
165
|
+
externalStylesheetsWithInsecureTransportCount: number;
|
|
166
|
+
externalMediaSourcesWithInsecureTransportCount: number;
|
|
167
|
+
externalBlankLinksWithoutRelCount: number;
|
|
168
|
+
externalIframesWithoutSandboxCount: number;
|
|
169
|
+
externalIframesWithInsecureTransportCount: number;
|
|
170
|
+
jsEvalSignalCount: number;
|
|
171
|
+
jsHtmlInjectionSignalCount: number;
|
|
172
|
+
jsInsecureTransportSignalCount: number;
|
|
173
|
+
jsSecretSignalCount: number;
|
|
174
|
+
assetCount: number;
|
|
175
|
+
assetsPassed: number;
|
|
176
|
+
routeHintsChecked: string[];
|
|
177
|
+
routeHintsMatched: number;
|
|
178
|
+
routeHintsCoverageOk: boolean;
|
|
179
|
+
routeDocumentsChecked: number;
|
|
180
|
+
routeDocumentsPassed: number;
|
|
181
|
+
routeDocumentsCoverageOk: boolean;
|
|
182
|
+
fullRouteCoverageOk: boolean;
|
|
183
|
+
totalAssetBytes: number;
|
|
184
|
+
jsAssetBytes: number;
|
|
185
|
+
cssAssetBytes: number;
|
|
186
|
+
largestAssetPath: string | null;
|
|
187
|
+
largestAssetBytes: number;
|
|
188
|
+
failures: string[];
|
|
189
|
+
};
|
|
190
|
+
drift: {
|
|
191
|
+
signal: 'lower' | 'moderate' | 'elevated';
|
|
192
|
+
penalty: number;
|
|
193
|
+
inlineStyleCount: number;
|
|
194
|
+
hardcodedColorCount: number;
|
|
195
|
+
utilityLeakageCount: number;
|
|
196
|
+
decantrTreatmentCount: number;
|
|
197
|
+
hasPackManifest: boolean;
|
|
198
|
+
hasDist: boolean;
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
interface ShowcaseShortlistVerificationReport {
|
|
202
|
+
$schema: string;
|
|
203
|
+
generatedAt: string;
|
|
204
|
+
dryRun: boolean;
|
|
205
|
+
summary: {
|
|
206
|
+
appCount: number;
|
|
207
|
+
passedBuilds: number;
|
|
208
|
+
failedBuilds: number;
|
|
209
|
+
averageDurationMs: number;
|
|
210
|
+
passedSmokes: number;
|
|
211
|
+
failedSmokes: number;
|
|
212
|
+
averageSmokeDurationMs: number;
|
|
213
|
+
appsWithTitleOkCount: number;
|
|
214
|
+
appsWithLangOkCount: number;
|
|
215
|
+
appsWithViewportOkCount: number;
|
|
216
|
+
appsWithCharsetOkCount: number;
|
|
217
|
+
appsWithoutInlineScriptsCount: number;
|
|
218
|
+
appsWithCspSignalCount: number;
|
|
219
|
+
appsWithExternalScriptIntegrityCount: number;
|
|
220
|
+
appsWithoutInsecureRemoteAssetTransportCount: number;
|
|
221
|
+
appsWithRouteCoverageCount: number;
|
|
222
|
+
appsWithFullRouteCoverageCount: number;
|
|
223
|
+
averageTotalAssetBytes: number;
|
|
224
|
+
averageJsAssetBytes: number;
|
|
225
|
+
averageCssAssetBytes: number;
|
|
226
|
+
lowerDriftCount: number;
|
|
227
|
+
moderateDriftCount: number;
|
|
228
|
+
elevatedDriftCount: number;
|
|
229
|
+
withPackManifestCount: number;
|
|
230
|
+
};
|
|
231
|
+
results: ShowcaseShortlistVerificationEntry[];
|
|
232
|
+
}
|
|
233
|
+
declare function extractRouteHintsFromEssence(essence: EssenceFile | null): string[];
|
|
234
|
+
declare function auditProject(projectRoot: string): Promise<ProjectAuditReport>;
|
|
235
|
+
declare function critiqueSource({ filePath, code, reviewPack, packManifest, treatmentsCss, }: CritiqueSourceInput): FileCritiqueReport;
|
|
236
|
+
declare function critiqueFile(filePath: string, projectRoot: string): Promise<FileCritiqueReport>;
|
|
237
|
+
|
|
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 };
|