@nifrajs/agent-review 3.5.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/src/types.ts ADDED
@@ -0,0 +1,174 @@
1
+ /** Stable version of the content-free review report contract. */
2
+ export const REVIEW_REPORT_VERSION = 1 as const
3
+
4
+ export type ReviewStatus = "pass" | "fail" | "inconclusive"
5
+
6
+ export type ReviewCheckId =
7
+ | "typecheck"
8
+ | "typed-client"
9
+ | "server-boundary"
10
+ | "route-boundary"
11
+ | "pipeline"
12
+ | "security"
13
+ | "route-assurance"
14
+ | "capability-provenance"
15
+ | "manifest"
16
+ | "dependency"
17
+ | "contract-witness"
18
+ | "coverage"
19
+ | "hydration"
20
+ | "configuration"
21
+
22
+ export type ReviewCheckStatus = "pass" | "fail" | "skipped" | "unavailable" | "error"
23
+
24
+ export type ReviewSeverity = "error" | "warning" | "info"
25
+
26
+ export type ReviewCategory =
27
+ | "correctness"
28
+ | "security"
29
+ | "boundary"
30
+ | "assurance"
31
+ | "capability"
32
+ | "contract"
33
+ | "dependency"
34
+ | "hydration"
35
+ | "coverage"
36
+ | "configuration"
37
+ | "operational"
38
+
39
+ export type ReviewEvidenceSource =
40
+ | "check"
41
+ | "assurance"
42
+ | "capability"
43
+ | "manifest"
44
+ | "contract"
45
+ | "coverage"
46
+ | "git-scope"
47
+ | "collector"
48
+
49
+ export type ReviewDurationBucket = "none" | "fast" | "standard" | "slow" | "timeout"
50
+
51
+ export type ReviewReasonCode =
52
+ | "not-configured"
53
+ | "config-missing"
54
+ | "config-invalid"
55
+ | "collector-error"
56
+ | "collector-unavailable"
57
+ | "diagnostics-truncated"
58
+ | "missing-typescript"
59
+ | "invalid-target"
60
+ | "invalid-git-ref"
61
+ | "invalid-git-scope"
62
+ | "filtered-out-of-scope"
63
+ | "fix-failed"
64
+ | "fix-no-op"
65
+ | "unsupported"
66
+
67
+ export type ReviewParserErrorCode =
68
+ | "invalid-root"
69
+ | "unknown-key"
70
+ | "forbidden-content"
71
+ | "invalid-type"
72
+ | "invalid-enum"
73
+ | "invalid-id"
74
+ | "invalid-reference"
75
+ | "invalid-path"
76
+ | "invalid-digest"
77
+ | "duplicate-id"
78
+ | "missing-required"
79
+ | "oversized"
80
+ | "derived-field-mismatch"
81
+ | "non-canonical"
82
+
83
+ export type ReviewFixRecipeId = "manifest.sync" | "workspace-dist.rebuild"
84
+
85
+ export type ReviewFixStatus = "planned" | "changed" | "no-op" | "failed"
86
+
87
+ export interface ReviewCounts {
88
+ readonly findings: number
89
+ readonly errors: number
90
+ readonly warnings: number
91
+ readonly info: number
92
+ readonly outOfScope: number
93
+ }
94
+
95
+ export interface ReviewEvidenceRef {
96
+ readonly source: ReviewEvidenceSource
97
+ readonly token: string
98
+ readonly digest: string
99
+ readonly path?: string
100
+ }
101
+
102
+ export interface ReviewLocation {
103
+ readonly path: string
104
+ readonly line?: number
105
+ readonly column?: number
106
+ }
107
+
108
+ export interface ReviewFixRef {
109
+ readonly recipe: ReviewFixRecipeId
110
+ }
111
+
112
+ export interface ReviewFinding {
113
+ readonly id: string
114
+ readonly check: ReviewCheckId
115
+ readonly code: string
116
+ readonly severity: ReviewSeverity
117
+ readonly category: ReviewCategory
118
+ readonly location?: ReviewLocation
119
+ readonly evidence: readonly ReviewEvidenceRef[]
120
+ readonly fix?: ReviewFixRef
121
+ }
122
+
123
+ export interface ReviewCheckResult {
124
+ readonly id: ReviewCheckId
125
+ readonly required: boolean
126
+ readonly status: ReviewCheckStatus
127
+ /** Display-only timing bucket. It is deliberately excluded from report digests. */
128
+ readonly duration: ReviewDurationBucket
129
+ readonly counts: ReviewCounts
130
+ readonly findingIds: readonly string[]
131
+ readonly evidence: readonly ReviewEvidenceRef[]
132
+ readonly reasonCode?: ReviewReasonCode
133
+ }
134
+
135
+ export interface ReviewScope {
136
+ readonly kind: "project" | "diff"
137
+ readonly state: "valid" | "invalid"
138
+ readonly gitRef?: string
139
+ readonly changedPaths: readonly string[]
140
+ /** SHA-256 of the canonical changed-path list. */
141
+ readonly pathDigest: string
142
+ readonly outOfScopeCount: number
143
+ readonly reasonCode?: ReviewReasonCode
144
+ }
145
+
146
+ export interface ReviewFixResult {
147
+ readonly recipe: ReviewFixRecipeId
148
+ readonly status: ReviewFixStatus
149
+ readonly changedPaths?: readonly string[]
150
+ readonly reasonCode?: ReviewReasonCode
151
+ }
152
+
153
+ export interface ReviewReport {
154
+ readonly version: typeof REVIEW_REPORT_VERSION
155
+ readonly strict: boolean
156
+ readonly scope: ReviewScope
157
+ readonly checks: readonly ReviewCheckResult[]
158
+ readonly findings: readonly ReviewFinding[]
159
+ readonly fixes?: readonly ReviewFixResult[]
160
+ readonly blocking: number
161
+ readonly ok: boolean
162
+ readonly status: ReviewStatus
163
+ /** Lowercase SHA-256 of the canonical report without this field or display-only durations. */
164
+ readonly digest: string
165
+ }
166
+
167
+ /** Sanitized structural inputs accepted by the deterministic composer. */
168
+ export interface ReviewReportDraft {
169
+ readonly strict: boolean
170
+ readonly scope: ReviewScope
171
+ readonly checks: readonly ReviewCheckResult[]
172
+ readonly findings: readonly ReviewFinding[]
173
+ readonly fixes?: readonly ReviewFixResult[]
174
+ }