claude-code-jsonl-validator 0.1.3-beta.1 → 0.1.3-beta.11

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/cli.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- //#region \0rolldown/runtime.js
2
+ // \0rolldown/runtime.js
3
3
  var __create = Object.create;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -16,18 +16,17 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
20
20
  value: mod,
21
21
  enumerable: true
22
22
  }) : target, mod));
23
- //#endregion
24
- const require_validate = require("./validate-xB-c5Gv6.cjs");
23
+ const require_validate = require("./validate-D7JiHavJ.cjs");
25
24
  let node_fs = require("node:fs");
26
25
  let node_fs_promises = require("node:fs/promises");
27
26
  let node_readline = require("node:readline");
28
27
  let node_path = require("node:path");
29
28
  node_path = __toESM(node_path, 1);
30
- //#region src/cli.ts
29
+ // src/cli.ts
31
30
  /** `.jsonl` を再帰収集する。 */
32
31
  async function collectJsonl(dir) {
33
32
  const out = [];
@@ -79,4 +78,3 @@ main().catch((error) => {
79
78
  console.error(error);
80
79
  process.exit(1);
81
80
  });
82
- //#endregion
package/dist/cli.d.cts CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {}
package/dist/cli.d.ts CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {}
package/dist/cli.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { n as hasFindings, r as validateLine, t as aggregateReport } from "./validate-D3RwKa-F.js";
2
+ import { n as hasFindings, r as validateLine, t as aggregateReport } from "./validate-BC7LgJjI.js";
3
3
  import { createReadStream } from "node:fs";
4
4
  import { readdir, stat } from "node:fs/promises";
5
5
  import { createInterface } from "node:readline";
6
6
  import path from "node:path";
7
- //#region src/cli.ts
7
+ // src/cli.ts
8
8
  /** `.jsonl` を再帰収集する。 */
9
9
  async function collectJsonl(dir) {
10
10
  const out = [];
@@ -56,7 +56,6 @@ main().catch((error) => {
56
56
  console.error(error);
57
57
  process.exit(1);
58
58
  });
59
- //#endregion
60
59
  export {};
61
60
 
62
61
  //# sourceMappingURL=cli.js.map
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_validate = require("./validate-xB-c5Gv6.cjs");
2
+ const require_validate = require("./validate-D7JiHavJ.cjs");
3
3
  exports.aggregateReport = require_validate.aggregateReport;
4
4
  exports.hasFindings = require_validate.hasFindings;
5
5
  exports.validateLine = require_validate.validateLine;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/validate.d.ts
2
1
  /** 検出種別。 */
3
2
  type FindingKind = 'no-type' | 'unknown-type' | 'schema-mismatch' | 'unknown-field';
4
3
  /** 1 件の検出。 */
@@ -15,19 +14,18 @@ interface Finding {
15
14
  *
16
15
  * @param obj - パース済みの生 JSON
17
16
  */
18
- declare function validateLine(obj: unknown): Finding[];
17
+ export declare function validateLine(obj: unknown): Finding[];
19
18
  /**
20
19
  * findings を type ごとに集計する。
21
20
  *
22
21
  * @param findings - 全 findings
23
22
  */
24
- declare function aggregateReport(findings: Finding[]): Map<string, Finding[]>;
23
+ export declare function aggregateReport(findings: Finding[]): Map<string, Finding[]>;
25
24
  /**
26
25
  * レポートに 1 件でも finding があれば true。
27
26
  *
28
27
  * @param report - 集計済みレポート
29
28
  */
30
- declare function hasFindings(report: Map<string, Finding[]>): boolean;
31
- //#endregion
32
- export { type Finding, type FindingKind, aggregateReport, hasFindings, validateLine };
29
+ export declare function hasFindings(report: Map<string, Finding[]>): boolean;
30
+ export type { Finding, FindingKind };
33
31
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/validate.ts"],"mappings":";;KAGY,WAAA;;UAOK,OAAA;EAPM;EASrB,IAAA;EACA,IAAA,EAAM,WAAW;EAHK;EAKtB,KAAA;EACA,OAAA;AAAA;;;;;;iBAiBc,YAAA,CAAa,GAAA,YAAe,OAAO;AAAnD;;;;AAAmD;AAAnD,iBAoDgB,eAAA,CAAgB,QAAA,EAAU,OAAA,KAAY,GAAA,SAAY,OAAA;;;;;;iBAelD,WAAA,CAAY,MAAA,EAAQ,GAAG,SAAS,OAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/validate.ts"],"mappings":";KAGY;;UAOK;;EAEf;EACA,MAAM;;EAEN;EACA;;;;;;;wBAiBc,aAAa,eAAe;;;;;;wBAoD5B,gBAAgB,UAAU,YAAY,YAAY;;;;;;wBAelD,YAAY,QAAQ,YAAY"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/validate.d.ts
2
1
  /** 検出種別。 */
3
2
  type FindingKind = 'no-type' | 'unknown-type' | 'schema-mismatch' | 'unknown-field';
4
3
  /** 1 件の検出。 */
@@ -15,19 +14,18 @@ interface Finding {
15
14
  *
16
15
  * @param obj - パース済みの生 JSON
17
16
  */
18
- declare function validateLine(obj: unknown): Finding[];
17
+ export declare function validateLine(obj: unknown): Finding[];
19
18
  /**
20
19
  * findings を type ごとに集計する。
21
20
  *
22
21
  * @param findings - 全 findings
23
22
  */
24
- declare function aggregateReport(findings: Finding[]): Map<string, Finding[]>;
23
+ export declare function aggregateReport(findings: Finding[]): Map<string, Finding[]>;
25
24
  /**
26
25
  * レポートに 1 件でも finding があれば true。
27
26
  *
28
27
  * @param report - 集計済みレポート
29
28
  */
30
- declare function hasFindings(report: Map<string, Finding[]>): boolean;
31
- //#endregion
32
- export { type Finding, type FindingKind, aggregateReport, hasFindings, validateLine };
29
+ export declare function hasFindings(report: Map<string, Finding[]>): boolean;
30
+ export type { Finding, FindingKind };
33
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/validate.ts"],"mappings":";;KAGY,WAAA;;UAOK,OAAA;EAPM;EASrB,IAAA;EACA,IAAA,EAAM,WAAW;EAHK;EAKtB,KAAA;EACA,OAAA;AAAA;;;;;;iBAiBc,YAAA,CAAa,GAAA,YAAe,OAAO;AAAnD;;;;AAAmD;AAAnD,iBAoDgB,eAAA,CAAgB,QAAA,EAAU,OAAA,KAAY,GAAA,SAAY,OAAA;;;;;;iBAelD,WAAA,CAAY,MAAA,EAAQ,GAAG,SAAS,OAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/validate.ts"],"mappings":";KAGY;;UAOK;;EAEf;EACA,MAAM;;EAEN;EACA;;;;;;;wBAiBc,aAAa,eAAe;;;;;;wBAoD5B,gBAAgB,UAAU,YAAY,YAAY;;;;;;wBAelD,YAAY,QAAQ,YAAY"}
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
- import { n as hasFindings, r as validateLine, t as aggregateReport } from "./validate-D3RwKa-F.js";
2
- export { aggregateReport, hasFindings, validateLine };
1
+ export { t as aggregateReport, n as hasFindings, r as validateLine } from "./validate-BC7LgJjI.js";
@@ -1,5 +1,5 @@
1
1
  import { entrySchemas, knownTypeSchema } from "claude-code-jsonl-generator";
2
- //#region src/validate.ts
2
+ // src/validate.ts
3
3
  /** 既知 type のスキーマが宣言しているトップレベルキー集合を取り出す。 */
4
4
  function knownKeysOf(type) {
5
5
  const schema = entrySchemas[type];
@@ -72,7 +72,6 @@ function hasFindings(report) {
72
72
  for (const bucket of report.values()) if (bucket.length > 0) return true;
73
73
  return false;
74
74
  }
75
- //#endregion
76
75
  export { hasFindings as n, validateLine as r, aggregateReport as t };
77
76
 
78
- //# sourceMappingURL=validate-D3RwKa-F.js.map
77
+ //# sourceMappingURL=validate-BC7LgJjI.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validate-D3RwKa-F.js","names":[],"sources":["../src/validate.ts"],"sourcesContent":["import { entrySchemas, knownTypeSchema } from 'claude-code-jsonl-generator'\n\n/** 検出種別。 */\nexport type FindingKind =\n | 'no-type'\n | 'unknown-type'\n | 'schema-mismatch'\n | 'unknown-field'\n\n/** 1 件の検出。 */\nexport interface Finding {\n /** 対象 type (type 無しの場合は '<no-type>')。 */\n type: string\n kind: FindingKind\n /** unknown-field のときのフィールド名。 */\n field?: string\n message: string\n}\n\n/** 既知 type のスキーマが宣言しているトップレベルキー集合を取り出す。 */\nfunction knownKeysOf(type: string): Set<string> | undefined {\n const schema = (\n entrySchemas as Record<string, { shape?: Record<string, unknown> } | undefined>\n )[type]\n if (!schema?.shape) return undefined\n return new Set(Object.keys(schema.shape))\n}\n\n/**\n * 1 行 (パース済み JSON) を検証して findings を返す。\n *\n * @param obj - パース済みの生 JSON\n */\nexport function validateLine(obj: unknown): Finding[] {\n const findings: Finding[] = []\n if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {\n return [{ type: '<no-type>', kind: 'no-type', message: 'not a JSON object' }]\n }\n const record = obj as Record<string, unknown>\n const type = record.type\n if (typeof type !== 'string') {\n return [{ type: '<no-type>', kind: 'no-type', message: 'missing string \"type\"' }]\n }\n\n const schema = knownTypeSchema(type)\n if (schema === undefined) {\n return [{ type, kind: 'unknown-type', message: `unknown type \"${type}\"` }]\n }\n\n // スキーマ検証 (必須欠落・型不一致)\n const parsed = schema.safeParse(record)\n if (!parsed.success) {\n for (const issue of parsed.error.issues) {\n findings.push({\n type,\n kind: 'schema-mismatch',\n field: issue.path.join('.') || undefined,\n message: `${issue.path.join('.')}: ${issue.message}`,\n })\n }\n }\n\n // 未知フィールド検出 (スキーマが列挙するキー以外)\n const known = knownKeysOf(type)\n if (known) {\n for (const key of Object.keys(record)) {\n if (!known.has(key)) {\n findings.push({\n type,\n kind: 'unknown-field',\n field: key,\n message: `unknown field \"${key}\" on type \"${type}\"`,\n })\n }\n }\n }\n\n return findings\n}\n\n/**\n * findings を type ごとに集計する。\n *\n * @param findings - 全 findings\n */\nexport function aggregateReport(findings: Finding[]): Map<string, Finding[]> {\n const report = new Map<string, Finding[]>()\n for (const f of findings) {\n const bucket = report.get(f.type) ?? []\n bucket.push(f)\n report.set(f.type, bucket)\n }\n return report\n}\n\n/**\n * レポートに 1 件でも finding があれば true。\n *\n * @param report - 集計済みレポート\n */\nexport function hasFindings(report: Map<string, Finding[]>): boolean {\n for (const bucket of report.values()) {\n if (bucket.length > 0) return true\n }\n return false\n}\n"],"mappings":";;;AAoBA,SAAS,YAAY,MAAuC;CAC1D,MAAM,SACJ,aACA;CACF,IAAI,CAAC,QAAQ,OAAO,OAAO,KAAA;CAC3B,OAAO,IAAI,IAAI,OAAO,KAAK,OAAO,KAAK,CAAC;AAC1C;;;;;;AAOA,SAAgB,aAAa,KAAyB;CACpD,MAAM,WAAsB,CAAC;CAC7B,IAAI,OAAO,QAAQ,YAAY,QAAQ,QAAQ,MAAM,QAAQ,GAAG,GAC9D,OAAO,CAAC;EAAE,MAAM;EAAa,MAAM;EAAW,SAAS;CAAoB,CAAC;CAE9E,MAAM,SAAS;CACf,MAAM,OAAO,OAAO;CACpB,IAAI,OAAO,SAAS,UAClB,OAAO,CAAC;EAAE,MAAM;EAAa,MAAM;EAAW,SAAS;CAAwB,CAAC;CAGlF,MAAM,SAAS,gBAAgB,IAAI;CACnC,IAAI,WAAW,KAAA,GACb,OAAO,CAAC;EAAE;EAAM,MAAM;EAAgB,SAAS,iBAAiB,KAAK;CAAG,CAAC;CAI3E,MAAM,SAAS,OAAO,UAAU,MAAM;CACtC,IAAI,CAAC,OAAO,SACV,KAAK,MAAM,SAAS,OAAO,MAAM,QAC/B,SAAS,KAAK;EACZ;EACA,MAAM;EACN,OAAO,MAAM,KAAK,KAAK,GAAG,KAAK,KAAA;EAC/B,SAAS,GAAG,MAAM,KAAK,KAAK,GAAG,EAAE,IAAI,MAAM;CAC7C,CAAC;CAKL,MAAM,QAAQ,YAAY,IAAI;CAC9B,IAAI;OACG,MAAM,OAAO,OAAO,KAAK,MAAM,GAClC,IAAI,CAAC,MAAM,IAAI,GAAG,GAChB,SAAS,KAAK;GACZ;GACA,MAAM;GACN,OAAO;GACP,SAAS,kBAAkB,IAAI,aAAa,KAAK;EACnD,CAAC;CAAA;CAKP,OAAO;AACT;;;;;;AAOA,SAAgB,gBAAgB,UAA6C;CAC3E,MAAM,yBAAS,IAAI,IAAuB;CAC1C,KAAK,MAAM,KAAK,UAAU;EACxB,MAAM,SAAS,OAAO,IAAI,EAAE,IAAI,KAAK,CAAC;EACtC,OAAO,KAAK,CAAC;EACb,OAAO,IAAI,EAAE,MAAM,MAAM;CAC3B;CACA,OAAO;AACT;;;;;;AAOA,SAAgB,YAAY,QAAyC;CACnE,KAAK,MAAM,UAAU,OAAO,OAAO,GACjC,IAAI,OAAO,SAAS,GAAG,OAAO;CAEhC,OAAO;AACT"}
1
+ {"version":3,"file":"validate-BC7LgJjI.js","names":[],"sources":["../src/validate.ts"],"sourcesContent":["import { entrySchemas, knownTypeSchema } from 'claude-code-jsonl-generator'\n\n/** 検出種別。 */\nexport type FindingKind =\n | 'no-type'\n | 'unknown-type'\n | 'schema-mismatch'\n | 'unknown-field'\n\n/** 1 件の検出。 */\nexport interface Finding {\n /** 対象 type (type 無しの場合は '<no-type>')。 */\n type: string\n kind: FindingKind\n /** unknown-field のときのフィールド名。 */\n field?: string\n message: string\n}\n\n/** 既知 type のスキーマが宣言しているトップレベルキー集合を取り出す。 */\nfunction knownKeysOf(type: string): Set<string> | undefined {\n const schema = (\n entrySchemas as Record<string, { shape?: Record<string, unknown> } | undefined>\n )[type]\n if (!schema?.shape) return undefined\n return new Set(Object.keys(schema.shape))\n}\n\n/**\n * 1 行 (パース済み JSON) を検証して findings を返す。\n *\n * @param obj - パース済みの生 JSON\n */\nexport function validateLine(obj: unknown): Finding[] {\n const findings: Finding[] = []\n if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {\n return [{ type: '<no-type>', kind: 'no-type', message: 'not a JSON object' }]\n }\n const record = obj as Record<string, unknown>\n const type = record.type\n if (typeof type !== 'string') {\n return [{ type: '<no-type>', kind: 'no-type', message: 'missing string \"type\"' }]\n }\n\n const schema = knownTypeSchema(type)\n if (schema === undefined) {\n return [{ type, kind: 'unknown-type', message: `unknown type \"${type}\"` }]\n }\n\n // スキーマ検証 (必須欠落・型不一致)\n const parsed = schema.safeParse(record)\n if (!parsed.success) {\n for (const issue of parsed.error.issues) {\n findings.push({\n type,\n kind: 'schema-mismatch',\n field: issue.path.join('.') || undefined,\n message: `${issue.path.join('.')}: ${issue.message}`,\n })\n }\n }\n\n // 未知フィールド検出 (スキーマが列挙するキー以外)\n const known = knownKeysOf(type)\n if (known) {\n for (const key of Object.keys(record)) {\n if (!known.has(key)) {\n findings.push({\n type,\n kind: 'unknown-field',\n field: key,\n message: `unknown field \"${key}\" on type \"${type}\"`,\n })\n }\n }\n }\n\n return findings\n}\n\n/**\n * findings を type ごとに集計する。\n *\n * @param findings - 全 findings\n */\nexport function aggregateReport(findings: Finding[]): Map<string, Finding[]> {\n const report = new Map<string, Finding[]>()\n for (const f of findings) {\n const bucket = report.get(f.type) ?? []\n bucket.push(f)\n report.set(f.type, bucket)\n }\n return report\n}\n\n/**\n * レポートに 1 件でも finding があれば true。\n *\n * @param report - 集計済みレポート\n */\nexport function hasFindings(report: Map<string, Finding[]>): boolean {\n for (const bucket of report.values()) {\n if (bucket.length > 0) return true\n }\n return false\n}\n"],"mappings":";;;AAoBA,SAAS,YAAY,MAAuC;CAC1D,MAAM,SACJ,aACA;CACF,IAAI,CAAC,QAAQ,OAAO,OAAO,KAAA;CAC3B,OAAO,IAAI,IAAI,OAAO,KAAK,OAAO,KAAK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C;CACnE,KAAK,MAAM,UAAU,OAAO,OAAO,GACjC,IAAI,OAAO,SAAS,GAAG,OAAO;CAEhC,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
1
  let claude_code_jsonl_generator = require("claude-code-jsonl-generator");
2
- //#region src/validate.ts
2
+ // src/validate.ts
3
3
  /** 既知 type のスキーマが宣言しているトップレベルキー集合を取り出す。 */
4
4
  function knownKeysOf(type) {
5
5
  const schema = claude_code_jsonl_generator.entrySchemas[type];
@@ -72,7 +72,6 @@ function hasFindings(report) {
72
72
  for (const bucket of report.values()) if (bucket.length > 0) return true;
73
73
  return false;
74
74
  }
75
- //#endregion
76
75
  Object.defineProperty(exports, "aggregateReport", {
77
76
  enumerable: true,
78
77
  get: function() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-jsonl-validator",
3
- "version": "0.1.3-beta.1",
3
+ "version": "0.1.3-beta.11",
4
4
  "description": "Regression-check real Claude Code JSONL corpora against known schemas",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -38,8 +38,8 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "zod": "4.4.3",
42
- "claude-code-jsonl-generator": "0.1.3-beta.1"
41
+ "claude-code-jsonl-generator": "0.1.3-beta.11",
42
+ "zod": "4.6.7"
43
43
  },
44
44
  "scripts": {
45
45
  "build": "tsdown",