@konvert7/klint 0.22.0 → 0.23.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.
Files changed (2) hide show
  1. package/README.md +80 -3
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # klint
2
2
 
3
- Architecture and type-aware linting for TypeScript projects.
3
+ Architecture-as-Code linting for TypeScript, Python, and Swift projects.
4
4
 
5
- Biome and oxlint are excellent at syntax, style, and fast local correctness. klint handles the rules that need project context: layer boundaries, singleton ownership, forbidden patterns, custom repository policies, and type-aware checks that should block an AI agent or CI run before code lands.
5
+ Biome, oxlint, Ruff, and SwiftLint are excellent at syntax, style, and fast local correctness. klint handles the rules that need project context: layer boundaries, singleton ownership, forbidden patterns, custom repository policies, and type-aware TypeScript checks that should block an AI agent or CI run before code lands.
6
6
 
7
7
  Use klint when "please follow AGENTS.md" is not strong enough. Put the rule in `klint.yaml`, run `klint`, and make the constraint executable.
8
8
 
@@ -190,7 +190,7 @@ arch:
190
190
  message: "Client code must not import server-only modules"
191
191
  ```
192
192
 
193
- `include` selects `.ts` files to lint. Patterns support `**` globs and `!` negation.
193
+ `include` selects source files to lint. Patterns support `**` globs and `!` negation.
194
194
 
195
195
  `plugins` enables bundled rule groups. Today, `sonar` provides focused code-quality rules.
196
196
 
@@ -279,6 +279,83 @@ arch:
279
279
  message: "Use the auth module"
280
280
  ```
281
281
 
282
+ ### Python Architecture Checks
283
+
284
+ The Rust engine can apply architecture rules to Python projects:
285
+
286
+ ```yaml
287
+ include: ["src"]
288
+
289
+ rules: {}
290
+
291
+ arch:
292
+ layers:
293
+ jobs: ["src/app/jobs/**"]
294
+ lib: ["src/app/lib/**"]
295
+ config: ["src/app/config.py"]
296
+
297
+ imports:
298
+ - from: jobs
299
+ deny: lib
300
+ message: "Jobs must use service APIs, not import lib directly"
301
+
302
+ forbidden:
303
+ - pattern: "print("
304
+ in: jobs
305
+ message: "Use the logger"
306
+
307
+ singleton:
308
+ - pattern: "os.environ[\"API_KEY\"]"
309
+ only: "src/app/config.py"
310
+ in: ["src/**"]
311
+ message: "Use app config"
312
+ ```
313
+
314
+ Python import checks support relative imports such as
315
+ `from ..lib.auth import load_key` and project-resolvable absolute imports such
316
+ as `from app.lib.auth import load_key`. External packages that do not resolve to
317
+ project files, such as `requests`, are ignored. This is architecture
318
+ enforcement, not full packaging or virtual-environment analysis.
319
+
320
+ ### Swift Architecture Checks
321
+
322
+ The Rust engine can apply architecture rules to Swift projects:
323
+
324
+ ```yaml
325
+ include: ["Sources"]
326
+
327
+ rules: {}
328
+
329
+ arch:
330
+ layers:
331
+ ui: ["Sources/App/UI/**"]
332
+ core: ["Sources/App/Core/**"]
333
+ config: ["Sources/App/Config/**"]
334
+
335
+ imports:
336
+ - from: ui
337
+ deny: core
338
+ message: "UI must use app services, not import Core directly"
339
+
340
+ forbidden:
341
+ - pattern: "URLSession.shared"
342
+ in: ui
343
+ message: "Use the networking client"
344
+
345
+ singleton:
346
+ - pattern: "ProcessInfo.processInfo.environment[\"API_KEY\"]"
347
+ only: "Sources/App/Config/AppConfig.swift"
348
+ in: ["Sources/**"]
349
+ message: "Use AppConfig"
350
+ ```
351
+
352
+ Swift import checks parse declarations such as `import Core`,
353
+ `@_exported import Core`, and `import struct Models.User`. Imported modules
354
+ resolve against discovered project Swift directories and file stems. System or
355
+ package modules that are not present in the project, such as `Foundation`, are
356
+ ignored. This is architecture enforcement, not full SwiftPM or Xcode build graph
357
+ analysis.
358
+
282
359
  ## Built-in Rules
283
360
 
284
361
  | Rule | Type-aware | Description |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konvert7/klint",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "Architecture-as-Code linter for TypeScript. Enforce layer boundaries, import rules, and singleton patterns in YAML.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -64,10 +64,10 @@
64
64
  "zod": "^4.4.3"
65
65
  },
66
66
  "optionalDependencies": {
67
- "@konvert7/klint-darwin-arm64": "0.22.0",
68
- "@konvert7/klint-darwin-x64": "0.22.0",
69
- "@konvert7/klint-linux-x64": "0.22.0",
70
- "@konvert7/klint-win32-x64": "0.22.0"
67
+ "@konvert7/klint-darwin-arm64": "0.23.0",
68
+ "@konvert7/klint-darwin-x64": "0.23.0",
69
+ "@konvert7/klint-linux-x64": "0.23.0",
70
+ "@konvert7/klint-win32-x64": "0.23.0"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@biomejs/biome": "2.4.7",