claude-code-jsonl-validator 0.1.4-beta.26 → 0.1.4-beta.29
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/README.md +1 -1
- package/dist/cli.cjs +8 -7
- package/dist/cli.js +8 -7
- package/dist/cli.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ npm install --save-dev claude-code-jsonl-validator
|
|
|
21
21
|
npx claude-code-jsonl-validator /path/to/jsonl-corpus
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Reads
|
|
24
|
+
Reads `.jsonl` files under the given directory recursively and validates each line. Symlinks are skipped.
|
|
25
25
|
Lines with a JSON syntax error are ignored, because they are the parser's concern.
|
|
26
26
|
Running it without a directory prints a usage message and exits with code 2.
|
|
27
27
|
|
package/dist/cli.cjs
CHANGED
|
@@ -22,22 +22,23 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
}) : target, mod));
|
|
23
23
|
const require_validate = require("./validate-ssJkhCcu.cjs");
|
|
24
24
|
let node_fs = require("node:fs");
|
|
25
|
-
let node_fs_promises = require("node:fs/promises");
|
|
26
25
|
let node_readline = require("node:readline");
|
|
26
|
+
let node_fs_promises = require("node:fs/promises");
|
|
27
27
|
let node_path = require("node:path");
|
|
28
28
|
node_path = __toESM(node_path, 1);
|
|
29
|
-
// src/
|
|
29
|
+
// src/collect-jsonl.ts
|
|
30
30
|
/** Recursively collects `.jsonl` files. */
|
|
31
31
|
async function collectJsonl(dir) {
|
|
32
32
|
const out = [];
|
|
33
|
-
const entries = await (0, node_fs_promises.readdir)(dir);
|
|
33
|
+
const entries = await (0, node_fs_promises.readdir)(dir, { withFileTypes: true });
|
|
34
34
|
for (const entry of entries) {
|
|
35
|
-
const full = node_path.default.join(dir, entry);
|
|
36
|
-
if (
|
|
37
|
-
else if (entry.endsWith(".jsonl")) out.push(full);
|
|
35
|
+
const full = node_path.default.join(dir, entry.name);
|
|
36
|
+
if (entry.isDirectory()) out.push(...await collectJsonl(full));
|
|
37
|
+
else if (entry.isFile() && entry.name.endsWith(".jsonl")) out.push(full);
|
|
38
38
|
}
|
|
39
39
|
return out;
|
|
40
40
|
}
|
|
41
|
+
// src/cli.ts
|
|
41
42
|
async function main() {
|
|
42
43
|
const corpus = process.argv[2];
|
|
43
44
|
if (!corpus) {
|
|
@@ -49,7 +50,7 @@ async function main() {
|
|
|
49
50
|
for (const file of files) {
|
|
50
51
|
const rl = (0, node_readline.createInterface)({
|
|
51
52
|
input: (0, node_fs.createReadStream)(file, { encoding: "utf8" }),
|
|
52
|
-
crlfDelay:
|
|
53
|
+
crlfDelay: 1e400
|
|
53
54
|
});
|
|
54
55
|
for await (const raw of rl) {
|
|
55
56
|
if (raw.trim() === "") continue;
|
package/dist/cli.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as hasFindings, r as validateLine, t as aggregateReport } from "./validate-B4LNzB8k.js";
|
|
3
3
|
import { createReadStream } from "node:fs";
|
|
4
|
-
import { readdir, stat } from "node:fs/promises";
|
|
5
4
|
import { createInterface } from "node:readline";
|
|
5
|
+
import { readdir } from "node:fs/promises";
|
|
6
6
|
import path from "node:path";
|
|
7
|
-
// src/
|
|
7
|
+
// src/collect-jsonl.ts
|
|
8
8
|
/** Recursively collects `.jsonl` files. */
|
|
9
9
|
async function collectJsonl(dir) {
|
|
10
10
|
const out = [];
|
|
11
|
-
const entries = await readdir(dir);
|
|
11
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
12
12
|
for (const entry of entries) {
|
|
13
|
-
const full = path.join(dir, entry);
|
|
14
|
-
if (
|
|
15
|
-
else if (entry.endsWith(".jsonl")) out.push(full);
|
|
13
|
+
const full = path.join(dir, entry.name);
|
|
14
|
+
if (entry.isDirectory()) out.push(...await collectJsonl(full));
|
|
15
|
+
else if (entry.isFile() && entry.name.endsWith(".jsonl")) out.push(full);
|
|
16
16
|
}
|
|
17
17
|
return out;
|
|
18
18
|
}
|
|
19
|
+
// src/cli.ts
|
|
19
20
|
async function main() {
|
|
20
21
|
const corpus = process.argv[2];
|
|
21
22
|
if (!corpus) {
|
|
@@ -27,7 +28,7 @@ async function main() {
|
|
|
27
28
|
for (const file of files) {
|
|
28
29
|
const rl = createInterface({
|
|
29
30
|
input: createReadStream(file, { encoding: "utf8" }),
|
|
30
|
-
crlfDelay:
|
|
31
|
+
crlfDelay: 1e400
|
|
31
32
|
});
|
|
32
33
|
for await (const raw of rl) {
|
|
33
34
|
if (raw.trim() === "") continue;
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"cli.js","names":[],"sources":["../src/collect-jsonl.ts","../src/cli.ts"],"sourcesContent":["import { readdir } from 'node:fs/promises'\nimport path from 'node:path'\n\n/** Recursively collects `.jsonl` files. */\nexport async function collectJsonl(dir: string): Promise<string[]> {\n const out: string[] = []\n const entries = await readdir(dir, { withFileTypes: true })\n for (const entry of entries) {\n const full = path.join(dir, entry.name)\n if (entry.isDirectory()) out.push(...(await collectJsonl(full)))\n else if (entry.isFile() && entry.name.endsWith('.jsonl')) out.push(full)\n }\n return out\n}\n","#!/usr/bin/env node\nimport { createReadStream } from 'node:fs'\nimport { createInterface } from 'node:readline'\nimport { collectJsonl } from './collect-jsonl'\nimport { validateLine, aggregateReport, hasFindings, type Finding } from './validate'\n\nasync function main(): Promise<void> {\n const corpus = process.argv[2]\n if (!corpus) {\n console.error('Usage: claude-code-jsonl-validator <corpus-dir>')\n process.exit(2)\n }\n\n const findings: Finding[] = []\n const files = await collectJsonl(corpus)\n for (const file of files) {\n const rl = createInterface({\n input: createReadStream(file, { encoding: 'utf8' }),\n crlfDelay: Infinity,\n })\n for await (const raw of rl) {\n if (raw.trim() === '') continue\n let obj: unknown\n try {\n obj = JSON.parse(raw)\n } catch {\n continue // Syntax errors are the parser's concern; ignore them here\n }\n findings.push(...validateLine(obj))\n }\n }\n\n const report = aggregateReport(findings)\n const sortedReport = [...report].toSorted(([a], [b]) => a.localeCompare(b))\n for (const [type, bucket] of sortedReport) {\n console.log(`\\n[${type}] ${bucket.length} finding(s)`)\n const byKind = new Map<string, number>()\n for (const f of bucket) byKind.set(f.kind, (byKind.get(f.kind) ?? 0) + 1)\n for (const [kind, n] of byKind) console.log(` ${kind}: ${n}`)\n // Show a few representative messages\n for (const f of bucket.slice(0, 5)) console.log(` - ${f.message}`)\n }\n\n if (hasFindings(report)) {\n console.error('\\nRegression detected. See findings above.')\n process.exit(1)\n }\n console.log('\\nNo regressions. All lines match known schemas.')\n}\n\nmain().catch((error: unknown) => {\n console.error(error)\n process.exit(1)\n})\n"],"mappings":";;;;;;;;AAIA,eAAsB,aAAa,KAAgC;CACjE,MAAM,MAAgB,CAAC;CACvB,MAAM,UAAU,MAAM,QAAQ,KAAK,EAAE,eAAe,KAAK,CAAC;CAC1D,KAAK,MAAM,SAAS,SAAS;EAC3B,MAAM,OAAO,KAAK,KAAK,KAAK,MAAM,IAAI;EACtC,IAAI,MAAM,YAAY,GAAG,IAAI,KAAK,GAAI,MAAM,aAAa,IAAI,CAAE;OAC1D,IAAI,MAAM,OAAO,KAAK,MAAM,KAAK,SAAS,QAAQ,GAAG,IAAI,KAAK,IAAI;CACzE;CACA,OAAO;AACT;;ACPA,eAAe,OAAsB;CACnC,MAAM,SAAS,QAAQ,KAAK;CAC5B,IAAI,CAAC,QAAQ;EACX,QAAQ,MAAM,iDAAiD;EAC/D,QAAQ,KAAK,CAAC;CAChB;CAEA,MAAM,WAAsB,CAAC;CAC7B,MAAM,QAAQ,MAAM,aAAa,MAAM;CACvC,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,KAAK,gBAAgB;GACzB,OAAO,iBAAiB,MAAM,EAAE,UAAU,OAAO,CAAC;GAClD,WAAW;EACb,CAAC;EACD,WAAW,MAAM,OAAO,IAAI;GAC1B,IAAI,IAAI,KAAK,MAAM,IAAI;GACvB,IAAI;GACJ,IAAI;IACF,MAAM,KAAK,MAAM,GAAG;GACtB,QAAQ;IACN;GACF;GACA,SAAS,KAAK,GAAG,aAAa,GAAG,CAAC;EACpC;CACF;CAEA,MAAM,SAAS,gBAAgB,QAAQ;CACvC,MAAM,eAAe,CAAC,GAAG,MAAM,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;CAC1E,KAAK,MAAM,CAAC,MAAM,WAAW,cAAc;EACzC,QAAQ,IAAI,MAAM,KAAK,IAAI,OAAO,OAAO,YAAY;EACrD,MAAM,yBAAS,IAAI,IAAoB;EACvC,KAAK,MAAM,KAAK,QAAQ,OAAO,IAAI,EAAE,OAAO,OAAO,IAAI,EAAE,IAAI,KAAK,KAAK,CAAC;EACxE,KAAK,MAAM,CAAC,MAAM,MAAM,QAAQ,QAAQ,IAAI,KAAK,KAAK,IAAI,GAAG;EAE7D,KAAK,MAAM,KAAK,OAAO,MAAM,GAAG,CAAC,GAAG,QAAQ,IAAI,SAAS,EAAE,SAAS;CACtE;CAEA,IAAI,YAAY,MAAM,GAAG;EACvB,QAAQ,MAAM,4CAA4C;EAC1D,QAAQ,KAAK,CAAC;CAChB;CACA,QAAQ,IAAI,kDAAkD;AAChE;AAEA,KAAK,CAAC,CAAC,OAAO,UAAmB;CAC/B,QAAQ,MAAM,KAAK;CACnB,QAAQ,KAAK,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-code-jsonl-validator",
|
|
3
|
-
"version": "0.1.4-beta.
|
|
3
|
+
"version": "0.1.4-beta.29",
|
|
4
4
|
"description": "Regression-check real Claude Code JSONL corpora against known schemas",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"claude-code-jsonl-generator": "0.1.4-beta.
|
|
41
|
+
"claude-code-jsonl-generator": "0.1.4-beta.29",
|
|
42
42
|
"zod": "4.6.7"
|
|
43
43
|
},
|
|
44
44
|
"scripts": {
|