@konvert7/klint 0.29.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konvert7/klint",
3
- "version": "0.29.0",
3
+ "version": "0.31.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": {
@@ -14,7 +14,9 @@
14
14
  "plugins",
15
15
  "skill",
16
16
  "tools",
17
- "README.md"
17
+ "README.md",
18
+ "klint.schema.json",
19
+ "klint.schema.yaml"
18
20
  ],
19
21
  "engines": {
20
22
  "bun": ">=1.3.0"
@@ -65,10 +67,10 @@
65
67
  "zod": "^4.4.3"
66
68
  },
67
69
  "optionalDependencies": {
68
- "@konvert7/klint-darwin-arm64": "0.29.0",
69
- "@konvert7/klint-darwin-x64": "0.29.0",
70
- "@konvert7/klint-linux-x64": "0.29.0",
71
- "@konvert7/klint-win32-x64": "0.29.0"
70
+ "@konvert7/klint-darwin-arm64": "0.31.0",
71
+ "@konvert7/klint-darwin-x64": "0.31.0",
72
+ "@konvert7/klint-linux-x64": "0.31.0",
73
+ "@konvert7/klint-win32-x64": "0.31.0"
72
74
  },
73
75
  "devDependencies": {
74
76
  "@biomejs/biome": "2.4.7",
@@ -1,17 +1,27 @@
1
1
  #!/usr/bin/env bun
2
- import { writeFileSync } from "node:fs";
2
+ import { readFileSync, writeFileSync } from "node:fs";
3
3
  import { resolve } from "node:path";
4
4
  import { stringify as toYaml } from "yaml";
5
5
  import { KlintConfigSchema } from "../core/config.schema";
6
+ import { schemaUrlForVersion } from "../core/schema-version";
6
7
 
7
8
  const raw = KlintConfigSchema.toJSONSchema() as Record<string, unknown>;
8
9
 
9
10
  // Set Draft-07 (broad editor compatibility) instead of 2020-12.
10
11
  delete raw.$schema;
11
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
+
12
22
  const schema = {
13
23
  $schema: "http://json-schema.org/draft-07/schema#",
14
- $id: "https://klint.dev/schema.json",
24
+ $id: schemaUrlForVersion(packageVersion()),
15
25
  ...raw,
16
26
  };
17
27
 
@@ -1,5 +1,5 @@
1
1
  import { existsSync, readFileSync, writeFileSync } from "node:fs";
2
- import { join } from "node:path";
2
+ import { dirname, join } from "node:path";
3
3
  import { spawnSync } from "node:child_process";
4
4
 
5
5
  const NATIVE_PACKAGES = [
@@ -57,6 +57,8 @@ export async function prepare(_, context) {
57
57
  if (!existsSync(binary)) {
58
58
  throw new Error(`Missing native binary for ${nativePackage.name}: ${binary}`);
59
59
  }
60
+
61
+ writeFileSync(join(dirname(binary), "VERSION"), `${version}\n`);
60
62
  }
61
63
  }
62
64
 
@@ -18,7 +18,7 @@ export async function verifyConditions(_, context) {
18
18
  }
19
19
  }
20
20
 
21
- export async function prepare(_, context) {
21
+ export async function prepare(pluginConfig = {}, context) {
22
22
  const cwd = context.cwd ?? process.cwd();
23
23
  const version = context.nextRelease?.version;
24
24
 
@@ -29,6 +29,20 @@ export async function prepare(_, context) {
29
29
  const packageJson = readPackageJson(cwd);
30
30
  packageJson.version = version;
31
31
  writePackageJson(cwd, packageJson);
32
+
33
+ regenerateSchema(cwd, pluginConfig.spawnSync ?? spawnSync);
34
+ }
35
+
36
+ function regenerateSchema(cwd, spawn) {
37
+ const result = spawn("bun", ["tools/generate-schema.ts"], {
38
+ cwd,
39
+ encoding: "utf-8",
40
+ stdio: "inherit",
41
+ });
42
+
43
+ if ((result.status ?? -1) !== 0) {
44
+ throw new Error(`Schema generation failed with exit code ${result.status ?? -1}`);
45
+ }
32
46
  }
33
47
 
34
48
  export async function publish(pluginConfig = {}, context) {