@webability/core 1.1.2 → 1.1.3
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/NOTICES.md +44 -0
- package/dist/index.cjs +41 -33
- package/dist/index.d.cts +31 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +41 -33
- package/package.json +13 -12
package/dist/index.d.cts
CHANGED
|
@@ -38,6 +38,15 @@ interface DetectedIssue {
|
|
|
38
38
|
imageSrc?: string;
|
|
39
39
|
/** Optional: outer HTML snippet (first 300 chars) for Claude context. */
|
|
40
40
|
outerHtml?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Detector-side signal that the finding is ambiguous and should land in
|
|
43
|
+
* `ScanResult.incomplete[]` (e.g. contrast against a gradient). The scanner
|
|
44
|
+
* propagates this to ScanIssue.confidence so the confidence classifier
|
|
45
|
+
* doesn't have to reverse-engineer the situation from HTML strings.
|
|
46
|
+
*/
|
|
47
|
+
needsReview?: boolean;
|
|
48
|
+
/** Why this finding needs review — surfaced to MCP/SDK consumers. */
|
|
49
|
+
reviewReason?: string;
|
|
41
50
|
}
|
|
42
51
|
/** Every fix detector must implement this interface. */
|
|
43
52
|
interface FixDetector {
|
|
@@ -72,6 +81,15 @@ interface SiteTheme {
|
|
|
72
81
|
type IssueSource = 'webability' | 'axe-core' | 'deep-analysis';
|
|
73
82
|
type IssueImpact = 'critical' | 'serious' | 'moderate' | 'minor';
|
|
74
83
|
type WcagLevel = 'A' | 'AA' | 'AAA';
|
|
84
|
+
/**
|
|
85
|
+
* Confidence tier for a scan finding. Mirrors axe-core's three-tier output —
|
|
86
|
+
* `high` is a confirmed violation safe to act on; `needs_review` is ambiguous
|
|
87
|
+
* (e.g. text on a gradient background, mid-animation opacity, marketing imagery
|
|
88
|
+
* that may legitimately contain text). Consumers should never auto-apply fixes
|
|
89
|
+
* to `needs_review` findings — they belong in the `incomplete[]` bucket and
|
|
90
|
+
* require human judgment.
|
|
91
|
+
*/
|
|
92
|
+
type IssueConfidence = 'high' | 'needs_review';
|
|
75
93
|
interface ScanIssue {
|
|
76
94
|
id: string;
|
|
77
95
|
source: IssueSource;
|
|
@@ -82,6 +100,10 @@ interface ScanIssue {
|
|
|
82
100
|
message: string;
|
|
83
101
|
selector: string;
|
|
84
102
|
html?: string;
|
|
103
|
+
/** When set, this issue is ambiguous and lives in `ScanResult.incomplete[]`. */
|
|
104
|
+
confidence?: IssueConfidence;
|
|
105
|
+
/** Why the classifier demoted this issue. Surfaced to MCP/SDK consumers. */
|
|
106
|
+
reviewReason?: string;
|
|
85
107
|
fix?: {
|
|
86
108
|
attribute: string;
|
|
87
109
|
currentValue: string;
|
|
@@ -92,13 +114,22 @@ interface ScanIssue {
|
|
|
92
114
|
interface ScanResult {
|
|
93
115
|
url: string;
|
|
94
116
|
timestamp: string;
|
|
117
|
+
/** High-confidence violations. Safe to surface as bugs. */
|
|
95
118
|
issues: ScanIssue[];
|
|
119
|
+
/**
|
|
120
|
+
* Findings the classifier or axe-core flagged as ambiguous. Show to the user
|
|
121
|
+
* for review — never auto-fix. Empty array (not omitted) when no incompletes,
|
|
122
|
+
* so consumers can rely on the field.
|
|
123
|
+
*/
|
|
124
|
+
incomplete: ScanIssue[];
|
|
96
125
|
summary: {
|
|
97
126
|
total: number;
|
|
98
127
|
critical: number;
|
|
99
128
|
serious: number;
|
|
100
129
|
moderate: number;
|
|
101
130
|
minor: number;
|
|
131
|
+
/** Count of items in `incomplete[]`. */
|
|
132
|
+
incomplete: number;
|
|
102
133
|
};
|
|
103
134
|
axeResults?: unknown;
|
|
104
135
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,15 @@ interface DetectedIssue {
|
|
|
38
38
|
imageSrc?: string;
|
|
39
39
|
/** Optional: outer HTML snippet (first 300 chars) for Claude context. */
|
|
40
40
|
outerHtml?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Detector-side signal that the finding is ambiguous and should land in
|
|
43
|
+
* `ScanResult.incomplete[]` (e.g. contrast against a gradient). The scanner
|
|
44
|
+
* propagates this to ScanIssue.confidence so the confidence classifier
|
|
45
|
+
* doesn't have to reverse-engineer the situation from HTML strings.
|
|
46
|
+
*/
|
|
47
|
+
needsReview?: boolean;
|
|
48
|
+
/** Why this finding needs review — surfaced to MCP/SDK consumers. */
|
|
49
|
+
reviewReason?: string;
|
|
41
50
|
}
|
|
42
51
|
/** Every fix detector must implement this interface. */
|
|
43
52
|
interface FixDetector {
|
|
@@ -72,6 +81,15 @@ interface SiteTheme {
|
|
|
72
81
|
type IssueSource = 'webability' | 'axe-core' | 'deep-analysis';
|
|
73
82
|
type IssueImpact = 'critical' | 'serious' | 'moderate' | 'minor';
|
|
74
83
|
type WcagLevel = 'A' | 'AA' | 'AAA';
|
|
84
|
+
/**
|
|
85
|
+
* Confidence tier for a scan finding. Mirrors axe-core's three-tier output —
|
|
86
|
+
* `high` is a confirmed violation safe to act on; `needs_review` is ambiguous
|
|
87
|
+
* (e.g. text on a gradient background, mid-animation opacity, marketing imagery
|
|
88
|
+
* that may legitimately contain text). Consumers should never auto-apply fixes
|
|
89
|
+
* to `needs_review` findings — they belong in the `incomplete[]` bucket and
|
|
90
|
+
* require human judgment.
|
|
91
|
+
*/
|
|
92
|
+
type IssueConfidence = 'high' | 'needs_review';
|
|
75
93
|
interface ScanIssue {
|
|
76
94
|
id: string;
|
|
77
95
|
source: IssueSource;
|
|
@@ -82,6 +100,10 @@ interface ScanIssue {
|
|
|
82
100
|
message: string;
|
|
83
101
|
selector: string;
|
|
84
102
|
html?: string;
|
|
103
|
+
/** When set, this issue is ambiguous and lives in `ScanResult.incomplete[]`. */
|
|
104
|
+
confidence?: IssueConfidence;
|
|
105
|
+
/** Why the classifier demoted this issue. Surfaced to MCP/SDK consumers. */
|
|
106
|
+
reviewReason?: string;
|
|
85
107
|
fix?: {
|
|
86
108
|
attribute: string;
|
|
87
109
|
currentValue: string;
|
|
@@ -92,13 +114,22 @@ interface ScanIssue {
|
|
|
92
114
|
interface ScanResult {
|
|
93
115
|
url: string;
|
|
94
116
|
timestamp: string;
|
|
117
|
+
/** High-confidence violations. Safe to surface as bugs. */
|
|
95
118
|
issues: ScanIssue[];
|
|
119
|
+
/**
|
|
120
|
+
* Findings the classifier or axe-core flagged as ambiguous. Show to the user
|
|
121
|
+
* for review — never auto-fix. Empty array (not omitted) when no incompletes,
|
|
122
|
+
* so consumers can rely on the field.
|
|
123
|
+
*/
|
|
124
|
+
incomplete: ScanIssue[];
|
|
96
125
|
summary: {
|
|
97
126
|
total: number;
|
|
98
127
|
critical: number;
|
|
99
128
|
serious: number;
|
|
100
129
|
moderate: number;
|
|
101
130
|
minor: number;
|
|
131
|
+
/** Count of items in `incomplete[]`. */
|
|
132
|
+
incomplete: number;
|
|
102
133
|
};
|
|
103
134
|
axeResults?: unknown;
|
|
104
135
|
}
|