@konvert7/klint 0.35.2 → 0.37.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konvert7/klint",
3
- "version": "0.35.2",
3
+ "version": "0.37.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": {
@@ -54,7 +54,7 @@
54
54
  "knip": "knip-bun",
55
55
  "klint": "bun cli.ts --engine auto",
56
56
  "jscpd": "jscpd --noTips",
57
- "schema": "bun tools/generate-schema.ts",
57
+ "schema": "cargo run --quiet -p klint-rs --example generate_schema -- $npm_package_version",
58
58
  "lint-staged": "lint-staged",
59
59
  "prepare": "bun .husky/install.mjs"
60
60
  },
@@ -70,13 +70,13 @@
70
70
  "zod": "^4.4.3"
71
71
  },
72
72
  "optionalDependencies": {
73
- "@konvert7/klint-darwin-arm64": "0.35.2",
74
- "@konvert7/klint-darwin-x64": "0.35.2",
75
- "@konvert7/klint-linux-x64": "0.35.2",
76
- "@konvert7/klint-win32-x64": "0.35.2"
73
+ "@konvert7/klint-darwin-arm64": "0.37.0",
74
+ "@konvert7/klint-darwin-x64": "0.37.0",
75
+ "@konvert7/klint-linux-x64": "0.37.0",
76
+ "@konvert7/klint-win32-x64": "0.37.0"
77
77
  },
78
78
  "devDependencies": {
79
- "@biomejs/biome": "2.4.7",
79
+ "@biomejs/biome": "2.6.4",
80
80
  "@commitlint/cli": "^20.5.3",
81
81
  "@commitlint/config-conventional": "^20.5.3",
82
82
  "@semantic-release/changelog": "^6.0.3",
@@ -61,11 +61,11 @@ Every run is recorded in `.klint/stats.json` next to the config. The folder igno
61
61
 
62
62
  | Command or flag | Use |
63
63
  |---|---|
64
- | `klint stats [--config <dir>]` | Print runs and errors prevented, in total and per rule. Use it to answer "how much has klint caught?" |
64
+ | `klint stats [--config <dir>]` | Print runs, violations reported and errors prevented, in total and per rule. Use it to answer "how much has klint caught?" |
65
65
  | `--hook` | Put it only in agent hook commands, e.g. `klint --json --hook`. Leave it off when you run klint yourself, so your runs count as direct. |
66
66
  | `KLINT_NO_STATS=1` | Turn recording off for a run, e.g. in a throwaway fixture. |
67
67
 
68
- An error counts as prevented once, when a later run no longer reports it. Errors match by rule, file and message, so moving code to another line is not a fix. Warnings are not tracked.
68
+ Every violation a run reports counts as reported, repeats included; klint's own `klint/*` advisories do not. An error counts as prevented once, when a later run no longer reports it. Errors match by rule, file and message, so moving code to another line is not a fix. Warnings are not tracked.
69
69
 
70
70
  ## Primitive reference
71
71
 
@@ -30,11 +30,12 @@ export async function prepare(pluginConfig = {}, context) {
30
30
  packageJson.version = version;
31
31
  writePackageJson(cwd, packageJson);
32
32
 
33
- regenerateSchema(cwd, pluginConfig.spawnSync ?? spawnSync);
33
+ regenerateSchema(cwd, version, pluginConfig.spawnSync ?? spawnSync);
34
34
  }
35
35
 
36
- function regenerateSchema(cwd, spawn) {
37
- const result = spawn("bun", ["tools/generate-schema.ts"], {
36
+ function regenerateSchema(cwd, version, spawn) {
37
+ const args = ["run", "--quiet", "-p", "klint-rs", "--example", "generate_schema", "--", version];
38
+ const result = spawn("cargo", args, {
38
39
  cwd,
39
40
  encoding: "utf-8",
40
41
  stdio: "inherit",
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env bun
2
- import { readFileSync, writeFileSync } from "node:fs";
3
- import { resolve } from "node:path";
4
- import { stringify as toYaml } from "yaml";
5
- import { KlintConfigSchema } from "../core/config.schema";
6
- import { schemaUrlForVersion } from "../core/schema-version";
7
-
8
- const raw = KlintConfigSchema.toJSONSchema() as Record<string, unknown>;
9
-
10
- // Set Draft-07 (broad editor compatibility) instead of 2020-12.
11
- delete raw.$schema;
12
-
13
- function packageVersion(): string {
14
- const manifest = readFileSync(resolve(import.meta.dir, "../package.json"), "utf-8");
15
- try {
16
- return (JSON.parse(manifest) as { version?: string }).version ?? "0.0.0";
17
- } catch {
18
- throw new Error("package.json is not valid JSON — cannot stamp the schema version");
19
- }
20
- }
21
-
22
- const schema = {
23
- $schema: "http://json-schema.org/draft-07/schema#",
24
- $id: schemaUrlForVersion(packageVersion()),
25
- ...raw,
26
- };
27
-
28
- const jsonOutPath = resolve(import.meta.dir, "../klint.schema.json");
29
- writeFileSync(jsonOutPath, `${JSON.stringify(schema, null, 2)}\n`);
30
- process.stdout.write(`Generated ${jsonOutPath}\n`);
31
-
32
- const yamlOutPath = resolve(import.meta.dir, "../klint.schema.yaml");
33
- writeFileSync(yamlOutPath, toYaml(schema, { lineWidth: 120 }));
34
- process.stdout.write(`Generated ${yamlOutPath}\n`);