@alint-js/plugin-simplicity 0.0.33 → 0.0.35

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/dist/index.d.mts CHANGED
@@ -85,7 +85,627 @@ interface SourceText {
85
85
  text: string;
86
86
  }
87
87
  //#endregion
88
- //#region ../core/dist/types-CR_Grd6q.d.mts
88
+ //#region ../../node_modules/.pnpm/valibot@1.4.2_typescript@6.0.3/node_modules/valibot/dist/index.d.mts
89
+ //#endregion
90
+ //#region src/types/metadata.d.ts
91
+ /**
92
+ * Base metadata interface.
93
+ */
94
+ interface BaseMetadata$1<TInput$1> {
95
+ /**
96
+ * The object kind.
97
+ */
98
+ readonly kind: "metadata";
99
+ /**
100
+ * The metadata type.
101
+ */
102
+ readonly type: string;
103
+ /**
104
+ * The metadata reference.
105
+ */
106
+ readonly reference: (...args: any[]) => BaseMetadata$1<any>;
107
+ /**
108
+ * The input, output and issue type.
109
+ *
110
+ * @internal
111
+ */
112
+ readonly "~types"?: {
113
+ readonly input: TInput$1;
114
+ readonly output: TInput$1;
115
+ readonly issue: never;
116
+ } | undefined;
117
+ }
118
+ //#endregion
119
+ //#region src/types/dataset.d.ts
120
+ /**
121
+ * Unknown dataset interface.
122
+ */
123
+ interface UnknownDataset$1 {
124
+ /**
125
+ * Whether is's typed.
126
+ */
127
+ typed?: false;
128
+ /**
129
+ * The dataset value.
130
+ */
131
+ value: unknown;
132
+ /**
133
+ * The dataset issues.
134
+ */
135
+ issues?: undefined;
136
+ }
137
+ /**
138
+ * Success dataset interface.
139
+ */
140
+ interface SuccessDataset$1<TValue$1> {
141
+ /**
142
+ * Whether is's typed.
143
+ */
144
+ typed: true;
145
+ /**
146
+ * The dataset value.
147
+ */
148
+ value: TValue$1;
149
+ /**
150
+ * The dataset issues.
151
+ */
152
+ issues?: undefined;
153
+ }
154
+ /**
155
+ * Partial dataset interface.
156
+ */
157
+ interface PartialDataset$1<TValue$1, TIssue extends BaseIssue$1<unknown>> {
158
+ /**
159
+ * Whether is's typed.
160
+ */
161
+ typed: true;
162
+ /**
163
+ * The dataset value.
164
+ */
165
+ value: TValue$1;
166
+ /**
167
+ * The dataset issues.
168
+ */
169
+ issues: [TIssue, ...TIssue[]];
170
+ }
171
+ /**
172
+ * Failure dataset interface.
173
+ */
174
+ interface FailureDataset$1<TIssue extends BaseIssue$1<unknown>> {
175
+ /**
176
+ * Whether is's typed.
177
+ */
178
+ typed: false;
179
+ /**
180
+ * The dataset value.
181
+ */
182
+ value: unknown;
183
+ /**
184
+ * The dataset issues.
185
+ */
186
+ issues: [TIssue, ...TIssue[]];
187
+ }
188
+ /**
189
+ * Output dataset type.
190
+ */
191
+ type OutputDataset$1<TValue$1, TIssue extends BaseIssue$1<unknown>> = SuccessDataset$1<TValue$1> | PartialDataset$1<TValue$1, TIssue> | FailureDataset$1<TIssue>;
192
+ //#endregion
193
+ //#region src/types/standard.d.ts
194
+ /**
195
+ * The Standard Schema properties interface.
196
+ */
197
+ interface StandardProps$1<TInput$1, TOutput$1> {
198
+ /**
199
+ * The version number of the standard.
200
+ */
201
+ readonly version: 1;
202
+ /**
203
+ * The vendor name of the schema library.
204
+ */
205
+ readonly vendor: "valibot";
206
+ /**
207
+ * Validates unknown input values.
208
+ */
209
+ readonly validate: (value: unknown) => StandardResult$1<TOutput$1> | Promise<StandardResult$1<TOutput$1>>;
210
+ /**
211
+ * Inferred types associated with the schema.
212
+ */
213
+ readonly types?: StandardTypes$1<TInput$1, TOutput$1> | undefined;
214
+ }
215
+ /**
216
+ * The result interface of the validate function.
217
+ */
218
+ type StandardResult$1<TOutput$1> = StandardSuccessResult$1<TOutput$1> | StandardFailureResult$1;
219
+ /**
220
+ * The result interface if validation succeeds.
221
+ */
222
+ interface StandardSuccessResult$1<TOutput$1> {
223
+ /**
224
+ * The typed output value.
225
+ */
226
+ readonly value: TOutput$1;
227
+ /**
228
+ * The non-existent issues.
229
+ */
230
+ readonly issues?: undefined;
231
+ }
232
+ /**
233
+ * The result interface if validation fails.
234
+ */
235
+ interface StandardFailureResult$1 {
236
+ /**
237
+ * The issues of failed validation.
238
+ */
239
+ readonly issues: readonly StandardIssue$1[];
240
+ }
241
+ /**
242
+ * The issue interface of the failure output.
243
+ */
244
+ interface StandardIssue$1 {
245
+ /**
246
+ * The error message of the issue.
247
+ */
248
+ readonly message: string;
249
+ /**
250
+ * The path of the issue, if any.
251
+ */
252
+ readonly path?: readonly (PropertyKey | StandardPathItem$1)[] | undefined;
253
+ }
254
+ /**
255
+ * The path item interface of the issue.
256
+ */
257
+ interface StandardPathItem$1 {
258
+ /**
259
+ * The key of the path item.
260
+ */
261
+ readonly key: PropertyKey;
262
+ }
263
+ /**
264
+ * The Standard Schema types interface.
265
+ */
266
+ interface StandardTypes$1<TInput$1, TOutput$1> {
267
+ /**
268
+ * The input type of the schema.
269
+ */
270
+ readonly input: TInput$1;
271
+ /**
272
+ * The output type of the schema.
273
+ */
274
+ readonly output: TOutput$1;
275
+ }
276
+ //#endregion
277
+ //#region src/types/schema.d.ts
278
+ /**
279
+ * Base schema interface.
280
+ */
281
+ interface BaseSchema$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> {
282
+ /**
283
+ * The object kind.
284
+ */
285
+ readonly kind: "schema";
286
+ /**
287
+ * The schema type.
288
+ */
289
+ readonly type: string;
290
+ /**
291
+ * The schema reference.
292
+ */
293
+ readonly reference: (...args: any[]) => BaseSchema$1<unknown, unknown, BaseIssue$1<unknown>>;
294
+ /**
295
+ * The expected property.
296
+ */
297
+ readonly expects: string;
298
+ /**
299
+ * Whether it's async.
300
+ */
301
+ readonly async: false;
302
+ /**
303
+ * The Standard Schema properties.
304
+ *
305
+ * @internal
306
+ */
307
+ readonly "~standard": StandardProps$1<TInput$1, TOutput$1>;
308
+ /**
309
+ * Parses unknown input values.
310
+ *
311
+ * @param dataset The input dataset.
312
+ * @param config The configuration.
313
+ *
314
+ * @returns The output dataset.
315
+ *
316
+ * @internal
317
+ */
318
+ readonly "~run": (dataset: UnknownDataset$1, config: Config$1<BaseIssue$1<unknown>>) => OutputDataset$1<TOutput$1, TIssue>;
319
+ /**
320
+ * The input, output and issue type.
321
+ *
322
+ * @internal
323
+ */
324
+ readonly "~types"?: {
325
+ readonly input: TInput$1;
326
+ readonly output: TOutput$1;
327
+ readonly issue: TIssue;
328
+ } | undefined;
329
+ }
330
+ /**
331
+ * Base schema async interface.
332
+ */
333
+ interface BaseSchemaAsync$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> extends Omit<BaseSchema$1<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
334
+ /**
335
+ * The schema reference.
336
+ */
337
+ readonly reference: (...args: any[]) => BaseSchema$1<unknown, unknown, BaseIssue$1<unknown>> | BaseSchemaAsync$1<unknown, unknown, BaseIssue$1<unknown>>;
338
+ /**
339
+ * Whether it's async.
340
+ */
341
+ readonly async: true;
342
+ /**
343
+ * Parses unknown input values.
344
+ *
345
+ * @param dataset The input dataset.
346
+ * @param config The configuration.
347
+ *
348
+ * @returns The output dataset.
349
+ *
350
+ * @internal
351
+ */
352
+ readonly "~run": (dataset: UnknownDataset$1, config: Config$1<BaseIssue$1<unknown>>) => Promise<OutputDataset$1<TOutput$1, TIssue>>;
353
+ }
354
+ /**
355
+ * Generic schema type.
356
+ */
357
+ type GenericSchema<TInput$1 = unknown, TOutput$1 = TInput$1, TIssue extends BaseIssue$1<unknown> = BaseIssue$1<unknown>> = BaseSchema$1<TInput$1, TOutput$1, TIssue>;
358
+ //#endregion
359
+ //#region src/types/transformation.d.ts
360
+ /**
361
+ * Base transformation interface.
362
+ */
363
+ interface BaseTransformation$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> {
364
+ /**
365
+ * The object kind.
366
+ */
367
+ readonly kind: "transformation";
368
+ /**
369
+ * The transformation type.
370
+ */
371
+ readonly type: string;
372
+ /**
373
+ * The transformation reference.
374
+ */
375
+ readonly reference: (...args: any[]) => BaseTransformation$1<any, any, BaseIssue$1<unknown>>;
376
+ /**
377
+ * Whether it's async.
378
+ */
379
+ readonly async: false;
380
+ /**
381
+ * Transforms known input values.
382
+ *
383
+ * @param dataset The input dataset.
384
+ * @param config The configuration.
385
+ *
386
+ * @returns The output dataset.
387
+ *
388
+ * @internal
389
+ */
390
+ readonly "~run": (dataset: SuccessDataset$1<TInput$1>, config: Config$1<BaseIssue$1<unknown>>) => OutputDataset$1<TOutput$1, BaseIssue$1<unknown> | TIssue>;
391
+ /**
392
+ * The input, output and issue type.
393
+ *
394
+ * @internal
395
+ */
396
+ readonly "~types"?: {
397
+ readonly input: TInput$1;
398
+ readonly output: TOutput$1;
399
+ readonly issue: TIssue;
400
+ } | undefined;
401
+ }
402
+ /**
403
+ * Base transformation async interface.
404
+ */
405
+ interface BaseTransformationAsync$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> extends Omit<BaseTransformation$1<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
406
+ /**
407
+ * The transformation reference.
408
+ */
409
+ readonly reference: (...args: any[]) => BaseTransformation$1<any, any, BaseIssue$1<unknown>> | BaseTransformationAsync$1<any, any, BaseIssue$1<unknown>>;
410
+ /**
411
+ * Whether it's async.
412
+ */
413
+ readonly async: true;
414
+ /**
415
+ * Transforms known input values.
416
+ *
417
+ * @param dataset The input dataset.
418
+ * @param config The configuration.
419
+ *
420
+ * @returns The output dataset.
421
+ *
422
+ * @internal
423
+ */
424
+ readonly "~run": (dataset: SuccessDataset$1<TInput$1>, config: Config$1<BaseIssue$1<unknown>>) => Promise<OutputDataset$1<TOutput$1, BaseIssue$1<unknown> | TIssue>>;
425
+ }
426
+ //#endregion
427
+ //#region src/types/validation.d.ts
428
+ /**
429
+ * Base validation interface.
430
+ */
431
+ interface BaseValidation$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> {
432
+ /**
433
+ * The object kind.
434
+ */
435
+ readonly kind: "validation";
436
+ /**
437
+ * The validation type.
438
+ */
439
+ readonly type: string;
440
+ /**
441
+ * The validation reference.
442
+ */
443
+ readonly reference: (...args: any[]) => BaseValidation$1<any, any, BaseIssue$1<unknown>>;
444
+ /**
445
+ * The expected property.
446
+ */
447
+ readonly expects: string | null;
448
+ /**
449
+ * Whether it's async.
450
+ */
451
+ readonly async: false;
452
+ /**
453
+ * Validates known input values.
454
+ *
455
+ * @param dataset The input dataset.
456
+ * @param config The configuration.
457
+ *
458
+ * @returns The output dataset.
459
+ *
460
+ * @internal
461
+ */
462
+ readonly "~run": (dataset: OutputDataset$1<TInput$1, BaseIssue$1<unknown>>, config: Config$1<BaseIssue$1<unknown>>) => OutputDataset$1<TOutput$1, BaseIssue$1<unknown> | TIssue>;
463
+ /**
464
+ * The input, output and issue type.
465
+ *
466
+ * @internal
467
+ */
468
+ readonly "~types"?: {
469
+ readonly input: TInput$1;
470
+ readonly output: TOutput$1;
471
+ readonly issue: TIssue;
472
+ } | undefined;
473
+ }
474
+ /**
475
+ * Base validation async interface.
476
+ */
477
+ interface BaseValidationAsync$1<TInput$1, TOutput$1, TIssue extends BaseIssue$1<unknown>> extends Omit<BaseValidation$1<TInput$1, TOutput$1, TIssue>, "reference" | "async" | "~run"> {
478
+ /**
479
+ * The validation reference.
480
+ */
481
+ readonly reference: (...args: any[]) => BaseValidation$1<any, any, BaseIssue$1<unknown>> | BaseValidationAsync$1<any, any, BaseIssue$1<unknown>>;
482
+ /**
483
+ * Whether it's async.
484
+ */
485
+ readonly async: true;
486
+ /**
487
+ * Validates known input values.
488
+ *
489
+ * @param dataset The input dataset.
490
+ * @param config The configuration.
491
+ *
492
+ * @returns The output dataset.
493
+ *
494
+ * @internal
495
+ */
496
+ readonly "~run": (dataset: OutputDataset$1<TInput$1, BaseIssue$1<unknown>>, config: Config$1<BaseIssue$1<unknown>>) => Promise<OutputDataset$1<TOutput$1, BaseIssue$1<unknown> | TIssue>>;
497
+ }
498
+ /**
499
+ * Infer output type.
500
+ */
501
+ type InferOutput$1<TItem$1 extends BaseSchema$1<unknown, unknown, BaseIssue$1<unknown>> | BaseSchemaAsync$1<unknown, unknown, BaseIssue$1<unknown>> | BaseValidation$1<any, unknown, BaseIssue$1<unknown>> | BaseValidationAsync$1<any, unknown, BaseIssue$1<unknown>> | BaseTransformation$1<any, unknown, BaseIssue$1<unknown>> | BaseTransformationAsync$1<any, unknown, BaseIssue$1<unknown>> | BaseMetadata$1<any>> = NonNullable<TItem$1["~types"]>["output"];
502
+ /**
503
+ * Constructs a type that is maybe readonly.
504
+ */
505
+ type MaybeReadonly$1<TValue$1> = TValue$1 | Readonly<TValue$1>;
506
+ //#endregion
507
+ //#region src/types/other.d.ts
508
+ /**
509
+ * Error message type.
510
+ */
511
+ type ErrorMessage$1<TIssue extends BaseIssue$1<unknown>> = ((issue: TIssue) => string) | string;
512
+ //#endregion
513
+ //#region src/types/issue.d.ts
514
+ /**
515
+ * Array path item interface.
516
+ */
517
+ interface ArrayPathItem$1 {
518
+ /**
519
+ * The path item type.
520
+ */
521
+ readonly type: "array";
522
+ /**
523
+ * The path item origin.
524
+ */
525
+ readonly origin: "value";
526
+ /**
527
+ * The path item input.
528
+ */
529
+ readonly input: MaybeReadonly$1<unknown[]>;
530
+ /**
531
+ * The path item key.
532
+ */
533
+ readonly key: number;
534
+ /**
535
+ * The path item value.
536
+ */
537
+ readonly value: unknown;
538
+ }
539
+ /**
540
+ * Map path item interface.
541
+ */
542
+ interface MapPathItem$1 {
543
+ /**
544
+ * The path item type.
545
+ */
546
+ readonly type: "map";
547
+ /**
548
+ * The path item origin.
549
+ */
550
+ readonly origin: "key" | "value";
551
+ /**
552
+ * The path item input.
553
+ */
554
+ readonly input: Map<unknown, unknown>;
555
+ /**
556
+ * The path item key.
557
+ */
558
+ readonly key: unknown;
559
+ /**
560
+ * The path item value.
561
+ */
562
+ readonly value: unknown;
563
+ }
564
+ /**
565
+ * Object path item interface.
566
+ */
567
+ interface ObjectPathItem$1 {
568
+ /**
569
+ * The path item type.
570
+ */
571
+ readonly type: "object";
572
+ /**
573
+ * The path item origin.
574
+ */
575
+ readonly origin: "key" | "value";
576
+ /**
577
+ * The path item input.
578
+ */
579
+ readonly input: Record<string, unknown>;
580
+ /**
581
+ * The path item key.
582
+ */
583
+ readonly key: string;
584
+ /**
585
+ * The path item value.
586
+ */
587
+ readonly value: unknown;
588
+ }
589
+ /**
590
+ * Set path item interface.
591
+ */
592
+ interface SetPathItem$1 {
593
+ /**
594
+ * The path item type.
595
+ */
596
+ readonly type: "set";
597
+ /**
598
+ * The path item origin.
599
+ */
600
+ readonly origin: "value";
601
+ /**
602
+ * The path item input.
603
+ */
604
+ readonly input: Set<unknown>;
605
+ /**
606
+ * The path item key.
607
+ */
608
+ readonly key: null;
609
+ /**
610
+ * The path item key.
611
+ */
612
+ readonly value: unknown;
613
+ }
614
+ /**
615
+ * Unknown path item interface.
616
+ */
617
+ interface UnknownPathItem$1 {
618
+ /**
619
+ * The path item type.
620
+ */
621
+ readonly type: "unknown";
622
+ /**
623
+ * The path item origin.
624
+ */
625
+ readonly origin: "key" | "value";
626
+ /**
627
+ * The path item input.
628
+ */
629
+ readonly input: unknown;
630
+ /**
631
+ * The path item key.
632
+ */
633
+ readonly key: unknown;
634
+ /**
635
+ * The path item value.
636
+ */
637
+ readonly value: unknown;
638
+ }
639
+ /**
640
+ * Issue path item type.
641
+ */
642
+ type IssuePathItem$1 = ArrayPathItem$1 | MapPathItem$1 | ObjectPathItem$1 | SetPathItem$1 | UnknownPathItem$1;
643
+ /**
644
+ * Base issue interface.
645
+ */
646
+ interface BaseIssue$1<TInput$1> extends Config$1<BaseIssue$1<TInput$1>> {
647
+ /**
648
+ * The issue kind.
649
+ */
650
+ readonly kind: "schema" | "validation" | "transformation";
651
+ /**
652
+ * The issue type.
653
+ */
654
+ readonly type: string;
655
+ /**
656
+ * The raw input data.
657
+ */
658
+ readonly input: TInput$1;
659
+ /**
660
+ * The expected property.
661
+ */
662
+ readonly expected: string | null;
663
+ /**
664
+ * The received property.
665
+ */
666
+ readonly received: string;
667
+ /**
668
+ * The error message.
669
+ */
670
+ readonly message: string;
671
+ /**
672
+ * The input requirement.
673
+ */
674
+ readonly requirement?: unknown | undefined;
675
+ /**
676
+ * The issue path.
677
+ */
678
+ readonly path?: [IssuePathItem$1, ...IssuePathItem$1[]] | undefined;
679
+ /**
680
+ * The sub issues.
681
+ */
682
+ readonly issues?: [BaseIssue$1<TInput$1>, ...BaseIssue$1<TInput$1>[]] | undefined;
683
+ }
684
+ //#endregion
685
+ //#region src/types/config.d.ts
686
+ /**
687
+ * Config interface.
688
+ */
689
+ interface Config$1<TIssue extends BaseIssue$1<unknown>> {
690
+ /**
691
+ * The selected language.
692
+ */
693
+ readonly lang?: string | undefined;
694
+ /**
695
+ * The error message.
696
+ */
697
+ readonly message?: ErrorMessage$1<TIssue> | undefined;
698
+ /**
699
+ * Whether it should be aborted early.
700
+ */
701
+ readonly abortEarly?: boolean | undefined;
702
+ /**
703
+ * Whether a pipe should be aborted early.
704
+ */
705
+ readonly abortPipeEarly?: boolean | undefined;
706
+ }
707
+ //#endregion
708
+ //#region ../core/dist/types-m5T_UL76.d.mts
89
709
  //#region src/config/types.d.ts
90
710
  type ModelSize = 'large' | 'medium' | 'small';
91
711
  interface RunnerCacheConfig {
@@ -208,11 +828,11 @@ interface LanguageDefinition {
208
828
  extract: (file: SourceFile, context: LanguageContext) => Awaitable<SourceTarget[]>;
209
829
  name: string;
210
830
  }
211
- interface PluginDefinition {
831
+ interface PluginDefinition<Rules extends Record<string, RuleDefinition<any>> = Record<string, RuleDefinition<any>>> {
212
832
  configs?: Record<string, AlintConfigInput>;
213
833
  languages?: Record<string, LanguageDefinition>;
214
834
  processors?: Record<string, ProcessorDefinition>;
215
- rules?: Record<string, RuleDefinition>;
835
+ rules?: Rules;
216
836
  }
217
837
  interface ProcessorDefinition {
218
838
  postprocess?: (diagnostics: DiagnosticDescriptor[], context: ProcessorPostprocessContext) => Awaitable<DiagnosticDescriptor[]>;
@@ -227,8 +847,8 @@ interface ProjectTarget {
227
847
  type RuleCacheConfig = boolean | {
228
848
  level?: 'target';
229
849
  };
230
- type RuleConfigEntry = [RuleSeverity] | RuleSeverity;
231
- interface RuleContext {
850
+ type RuleConfigEntry<Options extends readonly unknown[] = readonly []> = readonly [RuleSeverity, ...Partial<Options>] | RuleSeverity;
851
+ interface RuleContext<Options extends readonly unknown[] = readonly []> {
232
852
  agent?: AgentAdapter;
233
853
  cwd: string;
234
854
  id: string;
@@ -240,6 +860,7 @@ interface RuleContext {
240
860
  recordUsage: (usage: RuleInferenceUsageRecord) => void;
241
861
  };
242
862
  model: (selector?: ModelRequirement | string) => Promise<ResolvedModel>;
863
+ options: Options;
243
864
  outputLanguage?: string;
244
865
  report: (diagnostic: DiagnosticDescriptor) => void;
245
866
  settings: Record<string, unknown>;
@@ -252,12 +873,13 @@ interface RuleContext {
252
873
  signal?: AbortSignal;
253
874
  src: SourceRuntime;
254
875
  }
255
- interface RuleDefinition {
876
+ interface RuleDefinition<OptionsSchema extends RuleOptionsSchema = []> {
256
877
  cache?: RuleCacheConfig;
257
878
  /** Additional stable rule inputs, such as imported prompts, that invalidate cached results when changed. */
258
879
  cacheKey?: unknown;
259
- create: (context: RuleContext) => RuleHandlers;
880
+ create: (context: RuleContext<RuleOptionsOutput<OptionsSchema>>) => RuleHandlers;
260
881
  model?: ModelRequirement;
882
+ options?: OptionsSchema;
261
883
  }
262
884
  type RuleHandlers = RuleSpecializedHandlers | RuleWithHandler;
263
885
  interface RuleInferenceUsageRecord {
@@ -270,6 +892,8 @@ interface RuleInferenceUsageRecord {
270
892
  ruleId?: string;
271
893
  totalTokens?: number;
272
894
  }
895
+ type RuleOptionsOutput<OptionsSchema extends RuleOptionsSchema> = { readonly [Index in keyof OptionsSchema]: InferOutput$1<OptionsSchema[Index]>; };
896
+ type RuleOptionsSchema = readonly GenericSchema[];
273
897
  type RuleSeverity = 'error' | 'off' | 'warn';
274
898
  interface RuleSpecializedHandlers {
275
899
  onTargetClass?: (target: ClassTarget) => Awaitable<void>;
@@ -344,114 +968,6 @@ declare function tokenize(text: string, commentRanges: readonly SourceRange[], i
344
968
  /** Shared token fraction of the larger bag. Ranks candidates, decides nothing. */
345
969
  declare function tokenOverlap(left: readonly string[], right: readonly string[]): number;
346
970
  //#endregion
347
- //#region ../core/dist/types-CR_Grd6q.d.mts
348
- /** Agent-agnostic tool definition. Each adapter translates it to its framework's tool format. */
349
- interface AgentTool {
350
- description: string;
351
- execute: (input: unknown) => Promise<unknown> | unknown;
352
- name: string;
353
- parameters: Record<string, unknown>;
354
- }
355
- //#endregion
356
- //#region src/rules/no-duplicated-helper/tools.d.ts
357
- interface AgentFinding {
358
- helperId: string;
359
- reason: string;
360
- twinId: string;
361
- }
362
- interface DuplicateToolsOptions {
363
- /** Mutated by `report_duplicate`; the caller reads it once the agent stops. */
364
- findings: AgentFinding[];
365
- index: RepoIndex;
366
- /** Helpers of the file under review: the only ones the agent may report on. */
367
- reviewing: readonly IndexedHelper[];
368
- }
369
- declare function createDuplicateTools(options: DuplicateToolsOptions): AgentTool[];
370
- //#endregion
371
- //#region src/repo/cache.d.ts
372
- interface ReviewCache {
373
- /** A review is returned only to a run whose `fingerprint` matches the one it was decided against. */
374
- get: (filePath: string) => AgentFinding[] | undefined;
375
- set: (filePath: string, findings: AgentFinding[]) => Promise<void>;
376
- }
377
- declare function reviewCacheFor(ctx: RuleContext, options: {
378
- cwd: string;
379
- enabled: boolean;
380
- fingerprint: string;
381
- }): Promise<ReviewCache>;
382
- //#endregion
383
- //#region src/repo/index.d.ts
384
- interface IndexedHelper {
385
- alphaFingerprint: string;
386
- /** Comments and formatting removed, names left alone, so `search_helper_bodies` searches real code. */
387
- body: string;
388
- bodyIsSingleExpression: boolean;
389
- /** Statements in the body, not counting comments. */
390
- bodyStatements: number;
391
- exactFingerprint: string;
392
- exported: boolean;
393
- filePath: string;
394
- /** `packages/cli/src/lint.ts:57`. Unique, and a model can quote it back. */
395
- id: string;
396
- language: ExtractLanguage;
397
- line: number;
398
- lines: number;
399
- name: string;
400
- text: string;
401
- tokens: string[];
402
- /**
403
- * How often a function of this name is called across the workspace.
404
- *
405
- * Counted by NAME, not by binding, so two `isEmpty` helpers share a count and `x.isEmpty()` counts too.
406
- * Only ever handed to the judge as an approximate fact.
407
- */
408
- usageCount: number;
409
- }
410
- interface RepoIndex {
411
- byAlpha: Map<string, IndexedHelper[]>;
412
- byExact: Map<string, IndexedHelper[]>;
413
- byId: Map<string, IndexedHelper>;
414
- /** Every helper in the workspace, in one hash. What a cached review is stamped with. */
415
- fingerprint: string;
416
- helpers: IndexedHelper[];
417
- }
418
- interface RepoIndexOptions {
419
- cwd: string;
420
- ignores: readonly string[];
421
- maxLines: number;
422
- minTokens: number;
423
- }
424
- /** Helpers of one file, in source order. */
425
- declare function helpersIn(index: RepoIndex, filePath: string): IndexedHelper[];
426
- declare function repoIndexFor(ctx: RuleContext, options: RepoIndexOptions): Promise<RepoIndex>;
427
- /** Every other helper sharing a fingerprint. A helper is never its own twin. */
428
- declare function twinsOf(index: RepoIndex, helper: IndexedHelper, kind: 'alpha' | 'exact'): IndexedHelper[];
429
- //#endregion
430
- //#region src/rules/no-duplicated-helper/prompt.d.ts
431
- declare const duplicatedHelperInstructions: string;
432
- /**
433
- * The nearest helpers are pasted in rather than fetched: measured, the agent spent three of its four steps discovering what to read,
434
- * and every step re-sends the system prompt and every tool schema.
435
- */
436
- declare function buildDuplicatedHelperPrompt(options: {
437
- candidates: readonly IndexedHelper[];
438
- filePath: string;
439
- helpers: readonly IndexedHelper[];
440
- }): string;
441
- //#endregion
442
- //#region src/rules/no-duplicated-helper/rule.d.ts
443
- /**
444
- * Reports a small helper already implemented somewhere else in the workspace.
445
- *
446
- * Identical bodies and renamed-only copies are settled by AST fingerprints, with no model. What
447
- * a fingerprint cannot settle goes to an agent holding the whole index as tools.
448
- */
449
- declare const duplicatedHelperRule: RuleDefinition;
450
- //#endregion
451
- //#region src/rules/no-needless-helper/prompt.d.ts
452
- declare const needlessHelperPrompt: string;
453
- declare function buildNeedlessHelperPrompt(helpers: readonly IndexedHelper[]): string;
454
- //#endregion
455
971
  //#region ../../node_modules/.pnpm/valibot@1.4.2_typescript@6.0.3/node_modules/valibot/dist/index.d.mts
456
972
  //#endregion
457
973
  //#region src/methods/fallback/fallback.d.ts
@@ -2049,6 +2565,114 @@ interface ReadonlyAction<TInput$1> extends BaseTransformation<TInput$1, Readonly
2049
2565
  */
2050
2566
  declare function readonly<TInput$1>(): ReadonlyAction<TInput$1>;
2051
2567
  //#endregion
2568
+ //#region ../core/dist/types-m5T_UL76.d.mts
2569
+ /** Agent-agnostic tool definition. Each adapter translates it to its framework's tool format. */
2570
+ interface AgentTool {
2571
+ description: string;
2572
+ execute: (input: unknown) => Promise<unknown> | unknown;
2573
+ name: string;
2574
+ parameters: Record<string, unknown>;
2575
+ }
2576
+ //#endregion
2577
+ //#region src/rules/no-duplicated-helper/tools.d.ts
2578
+ interface AgentFinding {
2579
+ helperId: string;
2580
+ reason: string;
2581
+ twinId: string;
2582
+ }
2583
+ interface DuplicateToolsOptions {
2584
+ /** Mutated by `report_duplicate`; the caller reads it once the agent stops. */
2585
+ findings: AgentFinding[];
2586
+ index: RepoIndex;
2587
+ /** Helpers of the file under review: the only ones the agent may report on. */
2588
+ reviewing: readonly IndexedHelper[];
2589
+ }
2590
+ declare function createDuplicateTools(options: DuplicateToolsOptions): AgentTool[];
2591
+ //#endregion
2592
+ //#region src/repo/cache.d.ts
2593
+ interface ReviewCache {
2594
+ /** A review is returned only to a run whose `fingerprint` matches the one it was decided against. */
2595
+ get: (filePath: string) => AgentFinding[] | undefined;
2596
+ set: (filePath: string, findings: AgentFinding[]) => Promise<void>;
2597
+ }
2598
+ declare function reviewCacheFor(ctx: RuleContext, options: {
2599
+ cwd: string;
2600
+ enabled: boolean;
2601
+ fingerprint: string;
2602
+ }): Promise<ReviewCache>;
2603
+ //#endregion
2604
+ //#region src/repo/index.d.ts
2605
+ interface IndexedHelper {
2606
+ alphaFingerprint: string;
2607
+ /** Comments and formatting removed, names left alone, so `search_helper_bodies` searches real code. */
2608
+ body: string;
2609
+ bodyIsSingleExpression: boolean;
2610
+ /** Statements in the body, not counting comments. */
2611
+ bodyStatements: number;
2612
+ exactFingerprint: string;
2613
+ exported: boolean;
2614
+ filePath: string;
2615
+ /** `packages/cli/src/lint.ts:57`. Unique, and a model can quote it back. */
2616
+ id: string;
2617
+ language: ExtractLanguage;
2618
+ line: number;
2619
+ lines: number;
2620
+ name: string;
2621
+ text: string;
2622
+ tokens: string[];
2623
+ /**
2624
+ * How often a function of this name is called across the workspace.
2625
+ *
2626
+ * Counted by NAME, not by binding, so two `isEmpty` helpers share a count and `x.isEmpty()` counts too.
2627
+ * Only ever handed to the judge as an approximate fact.
2628
+ */
2629
+ usageCount: number;
2630
+ }
2631
+ interface RepoIndex {
2632
+ byAlpha: Map<string, IndexedHelper[]>;
2633
+ byExact: Map<string, IndexedHelper[]>;
2634
+ byId: Map<string, IndexedHelper>;
2635
+ /** Every helper in the workspace, in one hash. What a cached review is stamped with. */
2636
+ fingerprint: string;
2637
+ helpers: IndexedHelper[];
2638
+ }
2639
+ interface RepoIndexOptions {
2640
+ cwd: string;
2641
+ ignores: readonly string[];
2642
+ maxLines: number;
2643
+ minTokens: number;
2644
+ }
2645
+ /** Helpers of one file, in source order. */
2646
+ declare function helpersIn(index: RepoIndex, filePath: string): IndexedHelper[];
2647
+ declare function repoIndexFor(ctx: RuleContext, options: RepoIndexOptions): Promise<RepoIndex>;
2648
+ /** Every other helper sharing a fingerprint. A helper is never its own twin. */
2649
+ declare function twinsOf(index: RepoIndex, helper: IndexedHelper, kind: 'alpha' | 'exact'): IndexedHelper[];
2650
+ //#endregion
2651
+ //#region src/rules/no-duplicated-helper/prompt.d.ts
2652
+ declare const duplicatedHelperInstructions: string;
2653
+ /**
2654
+ * The nearest helpers are pasted in rather than fetched: measured, the agent spent three of its four steps discovering what to read,
2655
+ * and every step re-sends the system prompt and every tool schema.
2656
+ */
2657
+ declare function buildDuplicatedHelperPrompt(options: {
2658
+ candidates: readonly IndexedHelper[];
2659
+ filePath: string;
2660
+ helpers: readonly IndexedHelper[];
2661
+ }): string;
2662
+ //#endregion
2663
+ //#region src/rules/no-duplicated-helper/rule.d.ts
2664
+ /**
2665
+ * Reports a small helper already implemented somewhere else in the workspace.
2666
+ *
2667
+ * Identical bodies and renamed-only copies are settled by AST fingerprints, with no model. What
2668
+ * a fingerprint cannot settle goes to an agent holding the whole index as tools.
2669
+ */
2670
+ declare const duplicatedHelperRule: RuleDefinition<[]>;
2671
+ //#endregion
2672
+ //#region src/rules/no-needless-helper/prompt.d.ts
2673
+ declare const needlessHelperPrompt: string;
2674
+ declare function buildNeedlessHelperPrompt(helpers: readonly IndexedHelper[]): string;
2675
+ //#endregion
2052
2676
  //#region src/rules/no-needless-helper/rule.d.ts
2053
2677
  declare const needlessHelperResponseSchema: ObjectSchema<{
2054
2678
  readonly findings: ArraySchema<ObjectSchema<{
@@ -2064,7 +2688,7 @@ declare const needlessHelperResponseSchema: ObjectSchema<{
2064
2688
  * should not exist. The deterministic half only finds candidates and gathers facts (usage
2065
2689
  * count, exported), which are given to the model rather than applied as filters.
2066
2690
  */
2067
- declare const needlessHelperRule: RuleDefinition;
2691
+ declare const needlessHelperRule: RuleDefinition<[]>;
2068
2692
  //#endregion
2069
2693
  //#region src/rules/shared/settings.d.ts
2070
2694
  declare const settingsSchema: ObjectSchema<{
@@ -2082,6 +2706,9 @@ declare const settingsSchema: ObjectSchema<{
2082
2706
  type SimplicitySettings = InferOutput<typeof settingsSchema>;
2083
2707
  //#endregion
2084
2708
  //#region src/index.d.ts
2085
- declare const simplicityPlugin: PluginDefinition;
2709
+ declare const simplicityPlugin: PluginDefinition<{
2710
+ readonly 'no-duplicated-helper': RuleDefinition<[]>;
2711
+ readonly 'no-needless-helper': RuleDefinition<[]>;
2712
+ }>;
2086
2713
  //#endregion
2087
2714
  export { type AgentFinding, type CallSite, type DuplicateToolsOptions, type ExtractLanguage, type ExtractedFunction, type IndexedHelper, type RepoIndex, type RepoIndexOptions, type ReviewCache, type SimplicitySettings, type SourceExtract, alphaFingerprint, buildDuplicatedHelperPrompt, buildNeedlessHelperPrompt, createDuplicateTools, simplicityPlugin as default, simplicityPlugin, duplicatedHelperInstructions, duplicatedHelperRule, exactFingerprint, extractSource, helpersIn, needlessHelperPrompt, needlessHelperResponseSchema, needlessHelperRule, normalizedBody, repoIndexFor, resolveExtractLanguage, reviewCacheFor, tokenOverlap, tokenize, twinsOf };
package/dist/index.mjs CHANGED
@@ -125,7 +125,7 @@ const sleepWithAbort = async (ms, signal) => {
125
125
  });
126
126
  };
127
127
  //#endregion
128
- //#region ../core/dist/agent-weXkvGkc.mjs
128
+ //#region ../core/dist/agent-B6GG68NX.mjs
129
129
  function defineTool(tool) {
130
130
  return tool;
131
131
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@alint-js/plugin-simplicity",
3
3
  "type": "module",
4
- "version": "0.0.33",
4
+ "version": "0.0.35",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.mts",
@@ -21,10 +21,10 @@
21
21
  "typescript": "^6.0.3",
22
22
  "valibot": "^1.4.2",
23
23
  "web-tree-sitter": "^0.24.7",
24
- "@alint-js/agent-apeira": "0.0.33",
25
- "@alint-js/core": "0.0.33",
26
- "@alint-js/plugin": "0.0.33",
27
- "@alint-js/tools-fs": "0.0.33"
24
+ "@alint-js/agent-apeira": "0.0.35",
25
+ "@alint-js/core": "0.0.35",
26
+ "@alint-js/plugin": "0.0.35",
27
+ "@alint-js/tools-fs": "0.0.35"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "tsdown",