@konvert7/klint 0.30.0 → 0.31.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,999 @@
1
+ $schema: http://json-schema.org/draft-07/schema#
2
+ $id: https://raw.githubusercontent.com/konvert7/klint/refs/tags/v0.31.0/klint.schema.json
3
+ type: object
4
+ properties:
5
+ $schema:
6
+ description: JSON Schema reference. Use ./klint.schema.json for local validation, or a version-tagged URL such as
7
+ https://raw.githubusercontent.com/konvert7/klint/refs/tags/v0.29.0/klint.schema.json to pin the schema. A tagged
8
+ URL naming a version other than the installed one raises a klint/schema-version warning.
9
+ type: string
10
+ root:
11
+ description: Root directory used to resolve include paths and report relative file names. Defaults to the directory
12
+ containing klint.config.json.
13
+ type: string
14
+ include:
15
+ description: 'Glob patterns selecting which TypeScript files to lint. Prefix with ! to exclude. Defaults to ["."] which
16
+ lints all .ts files under root. Example: ["src", "klint", "!**/node_modules/**"]'
17
+ type: array
18
+ items:
19
+ type: string
20
+ plugins:
21
+ description: 'Named rule bundles to enable. Each plugin applies a default set of rules at "error" severity. Individual
22
+ rules from the bundle can be overridden or silenced via the rules map. Available: "sonar".'
23
+ type: array
24
+ items:
25
+ type: string
26
+ enum:
27
+ - sonar
28
+ rules:
29
+ description: 'Map of rule name → severity or options. Example: { "no-floating-promise": "error", "no-sync-in-async": {
30
+ "severity": "warn", "include": ["src/hooks/**"] } }.'
31
+ type: object
32
+ properties:
33
+ no-unguarded-json-parse:
34
+ description: Flags `JSON.parse()` calls that aren't wrapped in try/catch — malformed input crashes the process.
35
+ examples:
36
+ - "no-unguarded-json-parse: error"
37
+ anyOf:
38
+ - type: string
39
+ enum:
40
+ - error
41
+ - warn
42
+ - off
43
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
44
+ - type: object
45
+ properties:
46
+ severity:
47
+ type: string
48
+ enum:
49
+ - error
50
+ - warn
51
+ - off
52
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
53
+ include:
54
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
55
+ "!src/hooks/scripts/**"]'
56
+ type: array
57
+ items:
58
+ type: string
59
+ additionalProperties: false
60
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
61
+ no-sync-in-async:
62
+ description: Flags synchronous I/O (`readFileSync`, `execSync`, etc.) inside async functions — blocks the event loop
63
+ when an async equivalent is available.
64
+ examples:
65
+ - "no-sync-in-async: error"
66
+ - |-
67
+ no-sync-in-async:
68
+ severity: warn
69
+ include: ["src/server/**"]
70
+ anyOf:
71
+ - type: string
72
+ enum:
73
+ - error
74
+ - warn
75
+ - off
76
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
77
+ - type: object
78
+ properties:
79
+ severity:
80
+ type: string
81
+ enum:
82
+ - error
83
+ - warn
84
+ - off
85
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
86
+ include:
87
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
88
+ "!src/hooks/scripts/**"]'
89
+ type: array
90
+ items:
91
+ type: string
92
+ additionalProperties: false
93
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
94
+ no-floating-promise:
95
+ description: Flags Promise-returning expressions that aren't awaited or `.catch()`-handled — silent failures and
96
+ unpredictable execution order.
97
+ examples:
98
+ - "no-floating-promise: error"
99
+ anyOf:
100
+ - type: string
101
+ enum:
102
+ - error
103
+ - warn
104
+ - off
105
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
106
+ - type: object
107
+ properties:
108
+ severity:
109
+ type: string
110
+ enum:
111
+ - error
112
+ - warn
113
+ - off
114
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
115
+ include:
116
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
117
+ "!src/hooks/scripts/**"]'
118
+ type: array
119
+ items:
120
+ type: string
121
+ additionalProperties: false
122
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
123
+ no-misused-promises:
124
+ description: Flags Promises passed where the type expects a non-thenable (e.g. an `if` condition, a `void` callback).
125
+ The Promise's truthiness — not its resolved value — drives the branch.
126
+ examples:
127
+ - "no-misused-promises: error"
128
+ anyOf:
129
+ - type: string
130
+ enum:
131
+ - error
132
+ - warn
133
+ - off
134
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
135
+ - type: object
136
+ properties:
137
+ severity:
138
+ type: string
139
+ enum:
140
+ - error
141
+ - warn
142
+ - off
143
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
144
+ include:
145
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
146
+ "!src/hooks/scripts/**"]'
147
+ type: array
148
+ items:
149
+ type: string
150
+ additionalProperties: false
151
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
152
+ no-async-predicate:
153
+ description: Flags `async` functions passed to `.filter`/`.some`/`.every`/`.find`/`.findIndex`. Array methods coerce the
154
+ returned promise to truthy, so every element appears to match.
155
+ examples:
156
+ - "no-async-predicate: error"
157
+ anyOf:
158
+ - type: string
159
+ enum:
160
+ - error
161
+ - warn
162
+ - off
163
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
164
+ - type: object
165
+ properties:
166
+ severity:
167
+ type: string
168
+ enum:
169
+ - error
170
+ - warn
171
+ - off
172
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
173
+ include:
174
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
175
+ "!src/hooks/scripts/**"]'
176
+ type: array
177
+ items:
178
+ type: string
179
+ additionalProperties: false
180
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
181
+ no-date-equality:
182
+ description: Flags `Date` comparisons with `==`/`===`/`!=`/`!==` — these compare object identity, not the time value.
183
+ Use `.getTime()` instead.
184
+ examples:
185
+ - "no-date-equality: error"
186
+ anyOf:
187
+ - type: string
188
+ enum:
189
+ - error
190
+ - warn
191
+ - off
192
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
193
+ - type: object
194
+ properties:
195
+ severity:
196
+ type: string
197
+ enum:
198
+ - error
199
+ - warn
200
+ - off
201
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
202
+ include:
203
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
204
+ "!src/hooks/scripts/**"]'
205
+ type: array
206
+ items:
207
+ type: string
208
+ additionalProperties: false
209
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
210
+ no-optional-chain-on-non-nullable:
211
+ description: Flags `?.` on receivers whose static type cannot be `null` or `undefined`. The optional chain is dead code
212
+ and obscures the real shape.
213
+ examples:
214
+ - "no-optional-chain-on-non-nullable: warn"
215
+ anyOf:
216
+ - type: string
217
+ enum:
218
+ - error
219
+ - warn
220
+ - off
221
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
222
+ - type: object
223
+ properties:
224
+ severity:
225
+ type: string
226
+ enum:
227
+ - error
228
+ - warn
229
+ - off
230
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
231
+ include:
232
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
233
+ "!src/hooks/scripts/**"]'
234
+ type: array
235
+ items:
236
+ type: string
237
+ additionalProperties: false
238
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
239
+ no-object-in-template:
240
+ description: Flags non-primitive objects interpolated into template literals — produces `[object Object]` unless
241
+ `toString()` is overridden.
242
+ examples:
243
+ - "no-object-in-template: error"
244
+ anyOf:
245
+ - type: string
246
+ enum:
247
+ - error
248
+ - warn
249
+ - off
250
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
251
+ - type: object
252
+ properties:
253
+ severity:
254
+ type: string
255
+ enum:
256
+ - error
257
+ - warn
258
+ - off
259
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
260
+ include:
261
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
262
+ "!src/hooks/scripts/**"]'
263
+ type: array
264
+ items:
265
+ type: string
266
+ additionalProperties: false
267
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
268
+ no-nested-template-literals:
269
+ description: Flags template literals nested inside template literals — almost always unreadable; extract to a variable.
270
+ examples:
271
+ - "no-nested-template-literals: warn"
272
+ anyOf:
273
+ - type: string
274
+ enum:
275
+ - error
276
+ - warn
277
+ - off
278
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
279
+ - type: object
280
+ properties:
281
+ severity:
282
+ type: string
283
+ enum:
284
+ - error
285
+ - warn
286
+ - off
287
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
288
+ include:
289
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
290
+ "!src/hooks/scripts/**"]'
291
+ type: array
292
+ items:
293
+ type: string
294
+ additionalProperties: false
295
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
296
+ no-consecutive-array-push:
297
+ description: Flags consecutive `arr.push(x); arr.push(y);` calls — combine into `arr.push(x, y)` or `arr.push(...items)`.
298
+ examples:
299
+ - "no-consecutive-array-push: warn"
300
+ anyOf:
301
+ - type: string
302
+ enum:
303
+ - error
304
+ - warn
305
+ - off
306
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
307
+ - type: object
308
+ properties:
309
+ severity:
310
+ type: string
311
+ enum:
312
+ - error
313
+ - warn
314
+ - off
315
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
316
+ include:
317
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
318
+ "!src/hooks/scripts/**"]'
319
+ type: array
320
+ items:
321
+ type: string
322
+ additionalProperties: false
323
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
324
+ no-string-match:
325
+ description: Flags `String#match` — prefer `.matchAll()` for iteration or `.test()` for boolean checks. `.match()`
326
+ returns different shapes depending on the `/g` flag.
327
+ examples:
328
+ - "no-string-match: error"
329
+ anyOf:
330
+ - type: string
331
+ enum:
332
+ - error
333
+ - warn
334
+ - off
335
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
336
+ - type: object
337
+ properties:
338
+ severity:
339
+ type: string
340
+ enum:
341
+ - error
342
+ - warn
343
+ - off
344
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
345
+ include:
346
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
347
+ "!src/hooks/scripts/**"]'
348
+ type: array
349
+ items:
350
+ type: string
351
+ additionalProperties: false
352
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
353
+ sonar/prefer-string-replaceall:
354
+ description: Flags `.replace(/x/g, y)` on strings — `.replaceAll('x', y)` is clearer and faster for all-occurrence
355
+ replacements.
356
+ examples:
357
+ - "sonar/prefer-string-replaceall: error"
358
+ anyOf:
359
+ - type: string
360
+ enum:
361
+ - error
362
+ - warn
363
+ - off
364
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
365
+ - type: object
366
+ properties:
367
+ severity:
368
+ type: string
369
+ enum:
370
+ - error
371
+ - warn
372
+ - off
373
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
374
+ include:
375
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
376
+ "!src/hooks/scripts/**"]'
377
+ type: array
378
+ items:
379
+ type: string
380
+ additionalProperties: false
381
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
382
+ sonar/prefer-string-raw-regexp:
383
+ description: Flags regex literals built from escape-heavy string concatenation — `String.raw` drops the double backslashes.
384
+ examples:
385
+ - "sonar/prefer-string-raw-regexp: warn"
386
+ anyOf:
387
+ - type: string
388
+ enum:
389
+ - error
390
+ - warn
391
+ - off
392
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
393
+ - type: object
394
+ properties:
395
+ severity:
396
+ type: string
397
+ enum:
398
+ - error
399
+ - warn
400
+ - off
401
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
402
+ include:
403
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
404
+ "!src/hooks/scripts/**"]'
405
+ type: array
406
+ items:
407
+ type: string
408
+ additionalProperties: false
409
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
410
+ sonar/prefer-string-raw:
411
+ description: Flags string literals with multiple backslash escapes — `String.raw` is more readable (Windows paths, regex
412
+ source, etc.).
413
+ examples:
414
+ - "sonar/prefer-string-raw: warn"
415
+ anyOf:
416
+ - type: string
417
+ enum:
418
+ - error
419
+ - warn
420
+ - off
421
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
422
+ - type: object
423
+ properties:
424
+ severity:
425
+ type: string
426
+ enum:
427
+ - error
428
+ - warn
429
+ - off
430
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
431
+ include:
432
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
433
+ "!src/hooks/scripts/**"]'
434
+ type: array
435
+ items:
436
+ type: string
437
+ additionalProperties: false
438
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
439
+ sonar/prefer-nullish-coalescing-assign:
440
+ description: Flags explicit nullish assignment guards — `x ??= y` is the dedicated nullish assignment operator.
441
+ examples:
442
+ - "sonar/prefer-nullish-coalescing-assign: warn"
443
+ anyOf:
444
+ - type: string
445
+ enum:
446
+ - error
447
+ - warn
448
+ - off
449
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
450
+ - type: object
451
+ properties:
452
+ severity:
453
+ type: string
454
+ enum:
455
+ - error
456
+ - warn
457
+ - off
458
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
459
+ include:
460
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
461
+ "!src/hooks/scripts/**"]'
462
+ type: array
463
+ items:
464
+ type: string
465
+ additionalProperties: false
466
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
467
+ sonar/no-single-char-class:
468
+ description: Flags single-character character classes in regex (e.g. `/[a]/`) — drop the brackets; the regex matches the
469
+ same.
470
+ examples:
471
+ - "sonar/no-single-char-class: warn"
472
+ anyOf:
473
+ - type: string
474
+ enum:
475
+ - error
476
+ - warn
477
+ - off
478
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
479
+ - type: object
480
+ properties:
481
+ severity:
482
+ type: string
483
+ enum:
484
+ - error
485
+ - warn
486
+ - off
487
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
488
+ include:
489
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
490
+ "!src/hooks/scripts/**"]'
491
+ type: array
492
+ items:
493
+ type: string
494
+ additionalProperties: false
495
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
496
+ sonar/prefer-at:
497
+ description: Flags negative-index access via `arr[arr.length - 1]` — `.at(-1)` reads cleaner for last-element access.
498
+ examples:
499
+ - "sonar/prefer-at: warn"
500
+ anyOf:
501
+ - type: string
502
+ enum:
503
+ - error
504
+ - warn
505
+ - off
506
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
507
+ - type: object
508
+ properties:
509
+ severity:
510
+ type: string
511
+ enum:
512
+ - error
513
+ - warn
514
+ - off
515
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
516
+ include:
517
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
518
+ "!src/hooks/scripts/**"]'
519
+ type: array
520
+ items:
521
+ type: string
522
+ additionalProperties: false
523
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
524
+ additionalProperties:
525
+ anyOf:
526
+ - type: string
527
+ enum:
528
+ - error
529
+ - warn
530
+ - off
531
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
532
+ - type: object
533
+ properties:
534
+ severity:
535
+ type: string
536
+ enum:
537
+ - error
538
+ - warn
539
+ - off
540
+ description: Rule severity. "error" exits with code 2; "warn" reports but exits 0; "off" silences.
541
+ include:
542
+ description: 'Glob patterns scoping this rule to a subset of files. Prefix with ! to exclude. Example: ["src/hooks/**",
543
+ "!src/hooks/scripts/**"]'
544
+ type: array
545
+ items:
546
+ type: string
547
+ additionalProperties: false
548
+ description: Rule options object. Omit severity to default to "error". Add include to scope the rule to specific files.
549
+ arch:
550
+ type: object
551
+ properties:
552
+ layers:
553
+ type: object
554
+ propertyNames:
555
+ type: string
556
+ additionalProperties:
557
+ type: array
558
+ items:
559
+ type: string
560
+ description: Named architectural zones. Keys are arbitrary layer names; values are glob patterns matching the files in
561
+ that layer. Other arch rules reference these names instead of repeating globs.
562
+ examples:
563
+ - |-
564
+ layers:
565
+ core: ["src/hooks/lib/**", "src/tools/**"]
566
+ skills: ["assets/skills/**"]
567
+ dao: ["src/dao/**"]
568
+ imports:
569
+ description: Import-boundary rules. The dependency graph your README claims you have.
570
+ type: array
571
+ items:
572
+ type: object
573
+ properties:
574
+ from:
575
+ anyOf:
576
+ - type: string
577
+ - type: array
578
+ items:
579
+ type: string
580
+ description: Source — a layer name or glob(s) for the files this rule applies to. Imports originating in `from` are
581
+ checked against `deny`/`allow`.
582
+ deny:
583
+ description: Layer name(s) or glob(s) the source is not allowed to import from. Mutually exclusive in spirit with
584
+ `allow` (use one or the other).
585
+ anyOf:
586
+ - type: string
587
+ - type: array
588
+ items:
589
+ type: string
590
+ allow:
591
+ description: Allowlist of layer name(s) / glob(s) the source may import from. Anything not matching `allow` is denied.
592
+ anyOf:
593
+ - type: string
594
+ - type: array
595
+ items:
596
+ type: string
597
+ deny-packages:
598
+ description: "Package specifier(s) the source is not allowed to import — npm packages, `node:` builtins, Python pip
599
+ packages and stdlib modules, Swift system frameworks, and external Rust crates, which `deny`/`allow`
600
+ cannot reach because they never resolve to a project file. Matching is per segment: `/` in
601
+ TypeScript/JavaScript, so `next` also covers `next/headers` while `nextra` is unaffected; `.` in Python
602
+ and Swift, so `os` also covers `os.path` while `oscrypto` is unaffected; and `::` in Rust, so `tokio`
603
+ also covers `tokio::sync::Mutex` while `tokio_util` is unaffected. Python, Swift, and Rust sources are
604
+ checked by the Rust engine."
605
+ anyOf:
606
+ - type: string
607
+ - type: array
608
+ items:
609
+ type: string
610
+ type-only:
611
+ description: When set to "allow", `import type` statements that would otherwise be denied are permitted. In Python,
612
+ imports inside an `if TYPE_CHECKING:` block are exempted the same way. Useful for type-only references
613
+ across layers.
614
+ type: string
615
+ const: allow
616
+ message:
617
+ description: Custom error message reported when the rule is violated. Shown in the agent's event stream alongside
618
+ file:line.
619
+ type: string
620
+ severity:
621
+ type: string
622
+ enum:
623
+ - error
624
+ - warn
625
+ description: Severity for the arch rule. "error" exits with code 2; "warn" reports but exits 0. (arch rules cannot be
626
+ "off" — remove the entry instead.)
627
+ required:
628
+ - from
629
+ additionalProperties: false
630
+ description: An import-boundary rule. Restricts which layers a source can or cannot import from.
631
+ examples:
632
+ - |-
633
+ arch:
634
+ imports:
635
+ - from: skills
636
+ deny: core
637
+ message: "Skills must be self-contained and portable"
638
+ severity: warn
639
+ - |-
640
+ arch:
641
+ imports:
642
+ - from: ["src/dao/**"]
643
+ allow: ["src/dao/**", "src/prisma/**", "src/types/**"]
644
+ forbidden:
645
+ description: Forbidden-pattern rules. Block literal strings scoped to a layer.
646
+ type: array
647
+ items:
648
+ anyOf:
649
+ - type: object
650
+ properties:
651
+ pattern:
652
+ type: string
653
+ description: "Pattern to search for, scanned per line. A literal substring by default (e.g. a console logging call).
654
+ Prefix with `re:` to match a regular expression instead (e.g. `re:\\bp-\\[\\d+px\\]`). Regexes must
655
+ use the common JS/RE2 subset — no lookaround or backreferences — so the TS and Rust engines agree.
656
+ Note: a literal pattern that itself begins with `re:` cannot be expressed; such a value is always
657
+ read as a regex."
658
+ in:
659
+ anyOf:
660
+ - type: string
661
+ - type: array
662
+ items:
663
+ type: string
664
+ description: Layer name(s) or glob(s) the pattern is forbidden in. Files outside the scope are not checked.
665
+ message:
666
+ type: string
667
+ description: Required error message explaining why the pattern is forbidden. Shown to the agent so it can fix the call
668
+ site.
669
+ severity:
670
+ type: string
671
+ enum:
672
+ - error
673
+ - warn
674
+ description: Severity for the arch rule. "error" exits with code 2; "warn" reports but exits 0. (arch rules cannot be
675
+ "off" — remove the entry instead.)
676
+ required:
677
+ - pattern
678
+ - in
679
+ - message
680
+ additionalProperties: false
681
+ - type: object
682
+ properties:
683
+ jsx-element:
684
+ anyOf:
685
+ - type: string
686
+ - type: array
687
+ items:
688
+ type: string
689
+ description: JSX intrinsic element name(s) to forbid (e.g. `button`, `input`, `label`). AST-matched on opening and
690
+ self-closing tag names — robust to whitespace, attributes, and naming collisions like
691
+ `<buttonGroup>`.
692
+ in:
693
+ anyOf:
694
+ - type: string
695
+ - type: array
696
+ items:
697
+ type: string
698
+ description: Layer name(s) or glob(s) the element is forbidden in. Files outside the scope are not checked.
699
+ message:
700
+ type: string
701
+ description: Required error message explaining why the raw element is forbidden. Typically points at the design-system
702
+ replacement (e.g. `Use <Button /> from @/components/ui/button`).
703
+ severity:
704
+ type: string
705
+ enum:
706
+ - error
707
+ - warn
708
+ description: Severity for the arch rule. "error" exits with code 2; "warn" reports but exits 0. (arch rules cannot be
709
+ "off" — remove the entry instead.)
710
+ required:
711
+ - jsx-element
712
+ - in
713
+ - message
714
+ additionalProperties: false
715
+ description: A forbidden-pattern rule. Blocks either a literal substring (`pattern:`) or a JSX element (`jsx-element:`)
716
+ inside specific layers.
717
+ examples:
718
+ - |-
719
+ arch:
720
+ forbidden:
721
+ - pattern: "debugLog("
722
+ in: core
723
+ message: "Leaks into the agent event stream"
724
+ - |-
725
+ arch:
726
+ forbidden:
727
+ - jsx-element: ["button", "input", "label"]
728
+ in: ["src/app/**/*.tsx", "src/components/**/*.tsx", "!src/components/ui/**"]
729
+ message: "Use the design-system primitives in @/components/ui/* instead of raw HTML elements."
730
+ singleton:
731
+ description: Singleton-location rules. Pin a pattern to one file; every other touch is a violation.
732
+ type: array
733
+ items:
734
+ anyOf:
735
+ - type: object
736
+ properties:
737
+ pattern:
738
+ type: string
739
+ description: "Pattern whose appearance is allowed only at one location, scanned per line. A literal substring by default
740
+ (e.g. `process.env.API_KEY`). Prefix with `re:` to match a regular expression instead. Regexes must
741
+ use the common JS/RE2 subset — no lookaround or backreferences — so the TS and Rust engines agree.
742
+ Note: a literal pattern that itself begins with `re:` cannot be expressed; such a value is always
743
+ read as a regex."
744
+ only:
745
+ type: string
746
+ description: The single file path where this pattern is allowed. Every other occurrence becomes a violation.
747
+ in:
748
+ description: Optional scope. Limit the scan to these layers/globs; defaults to all files in `include`.
749
+ anyOf:
750
+ - type: string
751
+ - type: array
752
+ items:
753
+ type: string
754
+ message:
755
+ type: string
756
+ severity:
757
+ type: string
758
+ enum:
759
+ - error
760
+ - warn
761
+ description: Severity for the arch rule. "error" exits with code 2; "warn" reports but exits 0. (arch rules cannot be
762
+ "off" — remove the entry instead.)
763
+ required:
764
+ - pattern
765
+ - only
766
+ - message
767
+ additionalProperties: false
768
+ - type: object
769
+ properties:
770
+ jsx-element:
771
+ anyOf:
772
+ - type: string
773
+ - type: array
774
+ items:
775
+ type: string
776
+ description: JSX intrinsic element name(s) allowed only inside the `only` file. AST-matched on tag names.
777
+ only:
778
+ type: string
779
+ description: The single file path where the element is allowed (typically the design-system primitive that wraps it).
780
+ in:
781
+ anyOf:
782
+ - type: string
783
+ - type: array
784
+ items:
785
+ type: string
786
+ description: Either a single layer name / glob pattern or an array of them. Layer names defined in `arch.layers` are
787
+ resolved to their glob lists.
788
+ message:
789
+ type: string
790
+ severity:
791
+ type: string
792
+ enum:
793
+ - error
794
+ - warn
795
+ description: Severity for the arch rule. "error" exits with code 2; "warn" reports but exits 0. (arch rules cannot be
796
+ "off" — remove the entry instead.)
797
+ required:
798
+ - jsx-element
799
+ - only
800
+ - message
801
+ additionalProperties: false
802
+ description: A singleton-location rule. Pins a pattern or JSX element to exactly one file — the only honest way to
803
+ enforce a module of record or a design-system primitive.
804
+ examples:
805
+ - |-
806
+ arch:
807
+ singleton:
808
+ - pattern: "process.env.API_KEY"
809
+ only: "src/lib/auth.ts"
810
+ message: "API key access must funnel through the auth module."
811
+ - |-
812
+ arch:
813
+ singleton:
814
+ - jsx-element: "button"
815
+ only: "src/components/ui/button.tsx"
816
+ in: ["src/**/*.tsx"]
817
+ message: "Raw <button> belongs only to the Button primitive."
818
+ maxLines:
819
+ description: Per-file line-count limits. Cap how long files in a layer may grow, with different ceilings per scope.
820
+ type: array
821
+ items:
822
+ type: object
823
+ properties:
824
+ limit:
825
+ type: integer
826
+ exclusiveMinimum: 0
827
+ maximum: 9007199254740991
828
+ description: Maximum number of physical lines a file may contain. Counts every line including blanks and comments. A
829
+ file with more lines than this is a violation.
830
+ in:
831
+ anyOf:
832
+ - type: string
833
+ - type: array
834
+ items:
835
+ type: string
836
+ description: Layer name(s) or glob(s) the limit applies to. Files outside the scope are not checked.
837
+ message:
838
+ description: Optional error message. Defaults to a message naming the limit (e.g. 'File exceeds the maximum of 300
839
+ lines').
840
+ type: string
841
+ severity:
842
+ type: string
843
+ enum:
844
+ - error
845
+ - warn
846
+ description: Severity for the arch rule. "error" exits with code 2; "warn" reports but exits 0. (arch rules cannot be
847
+ "off" — remove the entry instead.)
848
+ required:
849
+ - limit
850
+ - in
851
+ additionalProperties: false
852
+ description: A per-file line-count limit. Caps how long any file in scope may grow — the honest way to keep modules
853
+ small without a formatter dependency.
854
+ examples:
855
+ - |-
856
+ arch:
857
+ maxLines:
858
+ - limit: 300
859
+ in: src/**
860
+ message: "Split this module"
861
+ - |-
862
+ arch:
863
+ maxLines:
864
+ - limit: 300
865
+ in: src/**
866
+ - limit: 600
867
+ in: tests/**
868
+ maxCommentDensity:
869
+ description: Per-file comment-density ceilings. Cap the share of a file that may be explanatory comments; doc-comments
870
+ are exempt by default.
871
+ type: array
872
+ items:
873
+ type: object
874
+ properties:
875
+ limit:
876
+ type: number
877
+ exclusiveMinimum: 0
878
+ maximum: 100
879
+ description: Maximum percentage of a file's physical lines that may be comment lines. Denominator is total physical
880
+ lines (code + comments + blanks), the same count `maxLines` uses. A file above this ratio is a
881
+ violation.
882
+ countDocComments:
883
+ description: "Count doc-comments toward the limit. Doc-comments are `/** … */` JSDoc blocks (TS/JS), `///` (Swift), and
884
+ `///` or `//!` (Rust); ordinary `//`, `/* */`, and `#` comments are always counted. Defaults to false,
885
+ so documentation is exempt and only explanatory/inline comments are capped. Has no effect on Python:
886
+ docstrings are string expressions rather than comments, so they never count toward either limit."
887
+ type: boolean
888
+ ignore:
889
+ description: Comment lines matching these patterns are structural, not prose — marker comments a build or codegen step
890
+ reads, for example — and count toward neither limit. A literal substring by default; prefix with `re:`
891
+ for a regex. Ignored lines still count in the density denominator (they are physical lines) and still
892
+ hold a comment block together, so a marker cannot be used to split an over-tall block.
893
+ anyOf:
894
+ - type: string
895
+ - type: array
896
+ items:
897
+ type: string
898
+ in:
899
+ anyOf:
900
+ - type: string
901
+ - type: array
902
+ items:
903
+ type: string
904
+ description: Layer name(s) or glob(s) the limit applies to. Files outside the scope are not checked.
905
+ message:
906
+ description: Optional error message. Defaults to a message naming the measured density and the limit.
907
+ type: string
908
+ severity:
909
+ type: string
910
+ enum:
911
+ - error
912
+ - warn
913
+ description: Severity for the arch rule. "error" exits with code 2; "warn" reports but exits 0. (arch rules cannot be
914
+ "off" — remove the entry instead.)
915
+ required:
916
+ - limit
917
+ - in
918
+ additionalProperties: false
919
+ description: A per-file comment-density ceiling. Caps how much of a file may be explanatory comments — the honest way to
920
+ push intent into code and names rather than prose (and to keep token cost down), while leaving doc-comments
921
+ free by default.
922
+ examples:
923
+ - |-
924
+ arch:
925
+ maxCommentDensity:
926
+ - limit: 5
927
+ in: src/**
928
+ message: "Encode intent in names, not comments"
929
+ - |-
930
+ arch:
931
+ maxCommentDensity:
932
+ - limit: 10
933
+ countDocComments: true
934
+ in: src/**
935
+ maxCommentBlock:
936
+ description: Per-block comment-height caps. Limit how many comment lines may stack together; doc-comments are exempt by
937
+ default.
938
+ type: array
939
+ items:
940
+ type: object
941
+ properties:
942
+ limit:
943
+ type: integer
944
+ exclusiveMinimum: 0
945
+ maximum: 9007199254740991
946
+ description: Maximum number of consecutive comment lines allowed in a single block. A run of more comment lines than
947
+ this — e.g. a tall comment stacked above a statement — is a violation, reported at the first offending
948
+ line.
949
+ countDocComments:
950
+ description: "Count doc-comments toward the limit. Doc-comments are `/** … */` JSDoc blocks (TS/JS), `///` (Swift), and
951
+ `///` or `//!` (Rust); ordinary `//`, `/* */`, and `#` comments are always counted. Defaults to false,
952
+ so documentation is exempt and only explanatory/inline comments are capped. Has no effect on Python:
953
+ docstrings are string expressions rather than comments, so they never count toward either limit."
954
+ type: boolean
955
+ ignore:
956
+ description: Comment lines matching these patterns are structural, not prose — marker comments a build or codegen step
957
+ reads, for example — and count toward neither limit. A literal substring by default; prefix with `re:`
958
+ for a regex. Ignored lines still count in the density denominator (they are physical lines) and still
959
+ hold a comment block together, so a marker cannot be used to split an over-tall block.
960
+ anyOf:
961
+ - type: string
962
+ - type: array
963
+ items:
964
+ type: string
965
+ in:
966
+ anyOf:
967
+ - type: string
968
+ - type: array
969
+ items:
970
+ type: string
971
+ description: Layer name(s) or glob(s) the limit applies to. Files outside the scope are not checked.
972
+ message:
973
+ description: Optional error message. Defaults to a message naming the consecutive-line limit.
974
+ type: string
975
+ severity:
976
+ type: string
977
+ enum:
978
+ - error
979
+ - warn
980
+ description: Severity for the arch rule. "error" exits with code 2; "warn" reports but exits 0. (arch rules cannot be
981
+ "off" — remove the entry instead.)
982
+ required:
983
+ - limit
984
+ - in
985
+ additionalProperties: false
986
+ description: A per-block comment-height cap. Limits how many comment lines may stack together, so comments stay terse
987
+ and a long explanation becomes a well-named function instead. Doc-comments are exempt by default.
988
+ examples:
989
+ - |-
990
+ arch:
991
+ maxCommentBlock:
992
+ - limit: 2
993
+ in: src/**
994
+ message: "Extract a named function instead of a comment block"
995
+ additionalProperties: false
996
+ description: Architecture-as-Code constraints — layers, import boundaries, forbidden patterns, singleton locations,
997
+ comment budgets. Enforced by the arch engine alongside the rule set.
998
+ additionalProperties: false
999
+ description: klint configuration. Lives at klint.yaml (or klint.config.json) next to biome.json and knip.json.