prooflint 0.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.
@@ -0,0 +1,418 @@
1
+ import { z } from 'zod';
2
+
3
+ declare const SeveritySchema: z.ZodEnum<["error", "warning", "info"]>;
4
+ type Severity = z.infer<typeof SeveritySchema>;
5
+ declare const PatternRuleSchema: z.ZodObject<{
6
+ id: z.ZodString;
7
+ type: z.ZodLiteral<"pattern">;
8
+ description: z.ZodOptional<z.ZodString>;
9
+ severity: z.ZodDefault<z.ZodEnum<["error", "warning", "info"]>>;
10
+ patterns: z.ZodArray<z.ZodObject<{
11
+ regex: z.ZodString;
12
+ message: z.ZodString;
13
+ flags: z.ZodOptional<z.ZodString>;
14
+ }, "strip", z.ZodTypeAny, {
15
+ message: string;
16
+ regex: string;
17
+ flags?: string | undefined;
18
+ }, {
19
+ message: string;
20
+ regex: string;
21
+ flags?: string | undefined;
22
+ }>, "many">;
23
+ }, "strip", z.ZodTypeAny, {
24
+ type: "pattern";
25
+ id: string;
26
+ severity: "error" | "warning" | "info";
27
+ patterns: {
28
+ message: string;
29
+ regex: string;
30
+ flags?: string | undefined;
31
+ }[];
32
+ description?: string | undefined;
33
+ }, {
34
+ type: "pattern";
35
+ id: string;
36
+ patterns: {
37
+ message: string;
38
+ regex: string;
39
+ flags?: string | undefined;
40
+ }[];
41
+ description?: string | undefined;
42
+ severity?: "error" | "warning" | "info" | undefined;
43
+ }>;
44
+ type PatternRule = z.infer<typeof PatternRuleSchema>;
45
+ declare const DictionaryRuleSchema: z.ZodObject<{
46
+ id: z.ZodString;
47
+ type: z.ZodLiteral<"dictionary">;
48
+ description: z.ZodOptional<z.ZodString>;
49
+ severity: z.ZodDefault<z.ZodEnum<["error", "warning", "info"]>>;
50
+ terms: z.ZodArray<z.ZodObject<{
51
+ prefer: z.ZodString;
52
+ avoid: z.ZodArray<z.ZodString, "many">;
53
+ }, "strip", z.ZodTypeAny, {
54
+ prefer: string;
55
+ avoid: string[];
56
+ }, {
57
+ prefer: string;
58
+ avoid: string[];
59
+ }>, "many">;
60
+ }, "strip", z.ZodTypeAny, {
61
+ type: "dictionary";
62
+ id: string;
63
+ severity: "error" | "warning" | "info";
64
+ terms: {
65
+ prefer: string;
66
+ avoid: string[];
67
+ }[];
68
+ description?: string | undefined;
69
+ }, {
70
+ type: "dictionary";
71
+ id: string;
72
+ terms: {
73
+ prefer: string;
74
+ avoid: string[];
75
+ }[];
76
+ description?: string | undefined;
77
+ severity?: "error" | "warning" | "info" | undefined;
78
+ }>;
79
+ type DictionaryRule = z.infer<typeof DictionaryRuleSchema>;
80
+ declare const StructureRuleSchema: z.ZodObject<{
81
+ id: z.ZodString;
82
+ type: z.ZodLiteral<"structure">;
83
+ description: z.ZodOptional<z.ZodString>;
84
+ severity: z.ZodDefault<z.ZodEnum<["error", "warning", "info"]>>;
85
+ target: z.ZodDefault<z.ZodEnum<["sentence", "heading"]>>;
86
+ max_chars: z.ZodOptional<z.ZodNumber>;
87
+ max_level: z.ZodOptional<z.ZodNumber>;
88
+ no_period: z.ZodOptional<z.ZodBoolean>;
89
+ }, "strip", z.ZodTypeAny, {
90
+ type: "structure";
91
+ id: string;
92
+ severity: "error" | "warning" | "info";
93
+ target: "heading" | "sentence";
94
+ description?: string | undefined;
95
+ max_chars?: number | undefined;
96
+ max_level?: number | undefined;
97
+ no_period?: boolean | undefined;
98
+ }, {
99
+ type: "structure";
100
+ id: string;
101
+ description?: string | undefined;
102
+ severity?: "error" | "warning" | "info" | undefined;
103
+ target?: "heading" | "sentence" | undefined;
104
+ max_chars?: number | undefined;
105
+ max_level?: number | undefined;
106
+ no_period?: boolean | undefined;
107
+ }>;
108
+ type StructureRule = z.infer<typeof StructureRuleSchema>;
109
+ declare const RuleSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
110
+ id: z.ZodString;
111
+ type: z.ZodLiteral<"pattern">;
112
+ description: z.ZodOptional<z.ZodString>;
113
+ severity: z.ZodDefault<z.ZodEnum<["error", "warning", "info"]>>;
114
+ patterns: z.ZodArray<z.ZodObject<{
115
+ regex: z.ZodString;
116
+ message: z.ZodString;
117
+ flags: z.ZodOptional<z.ZodString>;
118
+ }, "strip", z.ZodTypeAny, {
119
+ message: string;
120
+ regex: string;
121
+ flags?: string | undefined;
122
+ }, {
123
+ message: string;
124
+ regex: string;
125
+ flags?: string | undefined;
126
+ }>, "many">;
127
+ }, "strip", z.ZodTypeAny, {
128
+ type: "pattern";
129
+ id: string;
130
+ severity: "error" | "warning" | "info";
131
+ patterns: {
132
+ message: string;
133
+ regex: string;
134
+ flags?: string | undefined;
135
+ }[];
136
+ description?: string | undefined;
137
+ }, {
138
+ type: "pattern";
139
+ id: string;
140
+ patterns: {
141
+ message: string;
142
+ regex: string;
143
+ flags?: string | undefined;
144
+ }[];
145
+ description?: string | undefined;
146
+ severity?: "error" | "warning" | "info" | undefined;
147
+ }>, z.ZodObject<{
148
+ id: z.ZodString;
149
+ type: z.ZodLiteral<"dictionary">;
150
+ description: z.ZodOptional<z.ZodString>;
151
+ severity: z.ZodDefault<z.ZodEnum<["error", "warning", "info"]>>;
152
+ terms: z.ZodArray<z.ZodObject<{
153
+ prefer: z.ZodString;
154
+ avoid: z.ZodArray<z.ZodString, "many">;
155
+ }, "strip", z.ZodTypeAny, {
156
+ prefer: string;
157
+ avoid: string[];
158
+ }, {
159
+ prefer: string;
160
+ avoid: string[];
161
+ }>, "many">;
162
+ }, "strip", z.ZodTypeAny, {
163
+ type: "dictionary";
164
+ id: string;
165
+ severity: "error" | "warning" | "info";
166
+ terms: {
167
+ prefer: string;
168
+ avoid: string[];
169
+ }[];
170
+ description?: string | undefined;
171
+ }, {
172
+ type: "dictionary";
173
+ id: string;
174
+ terms: {
175
+ prefer: string;
176
+ avoid: string[];
177
+ }[];
178
+ description?: string | undefined;
179
+ severity?: "error" | "warning" | "info" | undefined;
180
+ }>, z.ZodObject<{
181
+ id: z.ZodString;
182
+ type: z.ZodLiteral<"structure">;
183
+ description: z.ZodOptional<z.ZodString>;
184
+ severity: z.ZodDefault<z.ZodEnum<["error", "warning", "info"]>>;
185
+ target: z.ZodDefault<z.ZodEnum<["sentence", "heading"]>>;
186
+ max_chars: z.ZodOptional<z.ZodNumber>;
187
+ max_level: z.ZodOptional<z.ZodNumber>;
188
+ no_period: z.ZodOptional<z.ZodBoolean>;
189
+ }, "strip", z.ZodTypeAny, {
190
+ type: "structure";
191
+ id: string;
192
+ severity: "error" | "warning" | "info";
193
+ target: "heading" | "sentence";
194
+ description?: string | undefined;
195
+ max_chars?: number | undefined;
196
+ max_level?: number | undefined;
197
+ no_period?: boolean | undefined;
198
+ }, {
199
+ type: "structure";
200
+ id: string;
201
+ description?: string | undefined;
202
+ severity?: "error" | "warning" | "info" | undefined;
203
+ target?: "heading" | "sentence" | undefined;
204
+ max_chars?: number | undefined;
205
+ max_level?: number | undefined;
206
+ no_period?: boolean | undefined;
207
+ }>]>;
208
+ type Rule = z.infer<typeof RuleSchema>;
209
+ declare const ConfigSchema: z.ZodObject<{
210
+ rules: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
211
+ id: z.ZodString;
212
+ type: z.ZodLiteral<"pattern">;
213
+ description: z.ZodOptional<z.ZodString>;
214
+ severity: z.ZodDefault<z.ZodEnum<["error", "warning", "info"]>>;
215
+ patterns: z.ZodArray<z.ZodObject<{
216
+ regex: z.ZodString;
217
+ message: z.ZodString;
218
+ flags: z.ZodOptional<z.ZodString>;
219
+ }, "strip", z.ZodTypeAny, {
220
+ message: string;
221
+ regex: string;
222
+ flags?: string | undefined;
223
+ }, {
224
+ message: string;
225
+ regex: string;
226
+ flags?: string | undefined;
227
+ }>, "many">;
228
+ }, "strip", z.ZodTypeAny, {
229
+ type: "pattern";
230
+ id: string;
231
+ severity: "error" | "warning" | "info";
232
+ patterns: {
233
+ message: string;
234
+ regex: string;
235
+ flags?: string | undefined;
236
+ }[];
237
+ description?: string | undefined;
238
+ }, {
239
+ type: "pattern";
240
+ id: string;
241
+ patterns: {
242
+ message: string;
243
+ regex: string;
244
+ flags?: string | undefined;
245
+ }[];
246
+ description?: string | undefined;
247
+ severity?: "error" | "warning" | "info" | undefined;
248
+ }>, z.ZodObject<{
249
+ id: z.ZodString;
250
+ type: z.ZodLiteral<"dictionary">;
251
+ description: z.ZodOptional<z.ZodString>;
252
+ severity: z.ZodDefault<z.ZodEnum<["error", "warning", "info"]>>;
253
+ terms: z.ZodArray<z.ZodObject<{
254
+ prefer: z.ZodString;
255
+ avoid: z.ZodArray<z.ZodString, "many">;
256
+ }, "strip", z.ZodTypeAny, {
257
+ prefer: string;
258
+ avoid: string[];
259
+ }, {
260
+ prefer: string;
261
+ avoid: string[];
262
+ }>, "many">;
263
+ }, "strip", z.ZodTypeAny, {
264
+ type: "dictionary";
265
+ id: string;
266
+ severity: "error" | "warning" | "info";
267
+ terms: {
268
+ prefer: string;
269
+ avoid: string[];
270
+ }[];
271
+ description?: string | undefined;
272
+ }, {
273
+ type: "dictionary";
274
+ id: string;
275
+ terms: {
276
+ prefer: string;
277
+ avoid: string[];
278
+ }[];
279
+ description?: string | undefined;
280
+ severity?: "error" | "warning" | "info" | undefined;
281
+ }>, z.ZodObject<{
282
+ id: z.ZodString;
283
+ type: z.ZodLiteral<"structure">;
284
+ description: z.ZodOptional<z.ZodString>;
285
+ severity: z.ZodDefault<z.ZodEnum<["error", "warning", "info"]>>;
286
+ target: z.ZodDefault<z.ZodEnum<["sentence", "heading"]>>;
287
+ max_chars: z.ZodOptional<z.ZodNumber>;
288
+ max_level: z.ZodOptional<z.ZodNumber>;
289
+ no_period: z.ZodOptional<z.ZodBoolean>;
290
+ }, "strip", z.ZodTypeAny, {
291
+ type: "structure";
292
+ id: string;
293
+ severity: "error" | "warning" | "info";
294
+ target: "heading" | "sentence";
295
+ description?: string | undefined;
296
+ max_chars?: number | undefined;
297
+ max_level?: number | undefined;
298
+ no_period?: boolean | undefined;
299
+ }, {
300
+ type: "structure";
301
+ id: string;
302
+ description?: string | undefined;
303
+ severity?: "error" | "warning" | "info" | undefined;
304
+ target?: "heading" | "sentence" | undefined;
305
+ max_chars?: number | undefined;
306
+ max_level?: number | undefined;
307
+ no_period?: boolean | undefined;
308
+ }>]>, "many">>;
309
+ context: z.ZodOptional<z.ZodObject<{
310
+ glossary: z.ZodOptional<z.ZodString>;
311
+ style_guide: z.ZodOptional<z.ZodString>;
312
+ }, "strip", z.ZodTypeAny, {
313
+ glossary?: string | undefined;
314
+ style_guide?: string | undefined;
315
+ }, {
316
+ glossary?: string | undefined;
317
+ style_guide?: string | undefined;
318
+ }>>;
319
+ }, "strip", z.ZodTypeAny, {
320
+ rules: ({
321
+ type: "pattern";
322
+ id: string;
323
+ severity: "error" | "warning" | "info";
324
+ patterns: {
325
+ message: string;
326
+ regex: string;
327
+ flags?: string | undefined;
328
+ }[];
329
+ description?: string | undefined;
330
+ } | {
331
+ type: "dictionary";
332
+ id: string;
333
+ severity: "error" | "warning" | "info";
334
+ terms: {
335
+ prefer: string;
336
+ avoid: string[];
337
+ }[];
338
+ description?: string | undefined;
339
+ } | {
340
+ type: "structure";
341
+ id: string;
342
+ severity: "error" | "warning" | "info";
343
+ target: "heading" | "sentence";
344
+ description?: string | undefined;
345
+ max_chars?: number | undefined;
346
+ max_level?: number | undefined;
347
+ no_period?: boolean | undefined;
348
+ })[];
349
+ context?: {
350
+ glossary?: string | undefined;
351
+ style_guide?: string | undefined;
352
+ } | undefined;
353
+ }, {
354
+ rules?: ({
355
+ type: "pattern";
356
+ id: string;
357
+ patterns: {
358
+ message: string;
359
+ regex: string;
360
+ flags?: string | undefined;
361
+ }[];
362
+ description?: string | undefined;
363
+ severity?: "error" | "warning" | "info" | undefined;
364
+ } | {
365
+ type: "dictionary";
366
+ id: string;
367
+ terms: {
368
+ prefer: string;
369
+ avoid: string[];
370
+ }[];
371
+ description?: string | undefined;
372
+ severity?: "error" | "warning" | "info" | undefined;
373
+ } | {
374
+ type: "structure";
375
+ id: string;
376
+ description?: string | undefined;
377
+ severity?: "error" | "warning" | "info" | undefined;
378
+ target?: "heading" | "sentence" | undefined;
379
+ max_chars?: number | undefined;
380
+ max_level?: number | undefined;
381
+ no_period?: boolean | undefined;
382
+ })[] | undefined;
383
+ context?: {
384
+ glossary?: string | undefined;
385
+ style_guide?: string | undefined;
386
+ } | undefined;
387
+ }>;
388
+ type Config = z.infer<typeof ConfigSchema>;
389
+ interface LintMessage {
390
+ ruleId: string;
391
+ severity: Severity;
392
+ message: string;
393
+ line: number;
394
+ column: number;
395
+ source?: string;
396
+ }
397
+ interface LintResult {
398
+ filePath: string;
399
+ messages: LintMessage[];
400
+ errorCount: number;
401
+ warningCount: number;
402
+ infoCount: number;
403
+ }
404
+
405
+ declare function lintText(content: string, filePath: string, config: Config): LintResult;
406
+ declare function lintFile(filePath: string, config: Config): LintResult;
407
+ declare function lintFiles(filePaths: string[], config: Config): LintResult[];
408
+
409
+ declare function findConfigFile(cwd?: string): string | null;
410
+ declare function loadConfig(configPath: string): Config;
411
+ declare function loadConfigFromCwd(cwd?: string): Config;
412
+
413
+ declare function formatConsole(results: LintResult[]): string;
414
+ declare function hasErrors(results: LintResult[]): boolean;
415
+
416
+ declare function formatJson(results: LintResult[]): string;
417
+
418
+ export { type Config, type DictionaryRule, type LintMessage, type LintResult, type PatternRule, type Rule, type Severity, type StructureRule, findConfigFile, formatConsole, formatJson, hasErrors, lintFile, lintFiles, lintText, loadConfig, loadConfigFromCwd };