agenteval-cli 0.8.0 → 0.8.2
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 -0
- package/bin/agenteval +113 -4
- package/package.json +7 -6
- package/install.mjs +0 -69
package/README.md
CHANGED
|
@@ -5,6 +5,7 @@ Your CLAUDE.md is untested. So is your AGENTS.md, your copilot-instructions.md,
|
|
|
5
5
|
agenteval is a linter, benchmarker, and CI gate for AI coding instructions. It finds dead references, token bloat, contradictions, and stale instructions before your agent does.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/agenteval-cli)
|
|
8
|
+
[](https://www.npmjs.com/package/agenteval-cli)
|
|
8
9
|
[](https://github.com/lukasmetzler/agenteval/actions/workflows/ci.yml)
|
|
9
10
|
[](https://github.com/lukasmetzler/agenteval/blob/main/LICENSE)
|
|
10
11
|
|
package/bin/agenteval
CHANGED
|
@@ -1,4 +1,113 @@
|
|
|
1
|
-
#!/bin/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { execFileSync, execSync } = require("child_process");
|
|
4
|
+
const { existsSync, mkdirSync, chmodSync, renameSync, unlinkSync } = require("fs");
|
|
5
|
+
const { join } = require("path");
|
|
6
|
+
const https = require("https");
|
|
7
|
+
|
|
8
|
+
const REPO = "lukasmetzler/agenteval";
|
|
9
|
+
const CACHE_DIR = join(require("os").homedir(), ".agenteval", "bin");
|
|
10
|
+
const BIN_PATH = join(CACHE_DIR, "agenteval");
|
|
11
|
+
const VERSION_PATH = join(CACHE_DIR, ".version");
|
|
12
|
+
|
|
13
|
+
function getPlatformKey() {
|
|
14
|
+
const platform = process.platform;
|
|
15
|
+
const arch = process.arch;
|
|
16
|
+
if (platform === "darwin" && arch === "arm64") return "agenteval-darwin-arm64";
|
|
17
|
+
if (platform === "darwin" && arch === "x64") return "agenteval-darwin-x64";
|
|
18
|
+
if (platform === "linux" && arch === "x64") return "agenteval-linux-x64";
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function getPackageVersion() {
|
|
23
|
+
try {
|
|
24
|
+
return require("../package.json").version;
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function getCachedVersion() {
|
|
31
|
+
try {
|
|
32
|
+
return require("fs").readFileSync(VERSION_PATH, "utf8").trim();
|
|
33
|
+
} catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function download(url) {
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
https.get(url, (res) => {
|
|
41
|
+
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
42
|
+
return download(res.headers.location).then(resolve, reject);
|
|
43
|
+
}
|
|
44
|
+
if (res.statusCode !== 200) {
|
|
45
|
+
reject(new Error(`HTTP ${res.statusCode}`));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const chunks = [];
|
|
49
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
50
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
51
|
+
res.on("error", reject);
|
|
52
|
+
}).on("error", reject);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function ensureBinary() {
|
|
57
|
+
const pkgVersion = getPackageVersion();
|
|
58
|
+
const cachedVersion = getCachedVersion();
|
|
59
|
+
|
|
60
|
+
// Binary exists and matches current package version
|
|
61
|
+
if (existsSync(BIN_PATH) && cachedVersion === pkgVersion) {
|
|
62
|
+
return BIN_PATH;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const binary = getPlatformKey();
|
|
66
|
+
if (!binary) {
|
|
67
|
+
console.error(`agenteval: unsupported platform ${process.platform}-${process.arch}`);
|
|
68
|
+
console.error("Supported: linux-x64, darwin-arm64, darwin-x64");
|
|
69
|
+
console.error("Install manually: https://github.com/lukasmetzler/agenteval/releases");
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const version = pkgVersion ? `v${pkgVersion}` : "latest";
|
|
74
|
+
const url = `https://github.com/${REPO}/releases/download/${version}/${binary}`;
|
|
75
|
+
|
|
76
|
+
console.error(`Downloading agenteval ${version} (${binary})...`);
|
|
77
|
+
|
|
78
|
+
mkdirSync(CACHE_DIR, { recursive: true });
|
|
79
|
+
|
|
80
|
+
const tmpPath = `${BIN_PATH}.tmp.${Date.now()}`;
|
|
81
|
+
try {
|
|
82
|
+
const data = await download(url);
|
|
83
|
+
require("fs").writeFileSync(tmpPath, data);
|
|
84
|
+
chmodSync(tmpPath, 0o755);
|
|
85
|
+
|
|
86
|
+
// Atomic replace
|
|
87
|
+
if (existsSync(BIN_PATH)) {
|
|
88
|
+
try { unlinkSync(BIN_PATH); } catch {}
|
|
89
|
+
}
|
|
90
|
+
renameSync(tmpPath, BIN_PATH);
|
|
91
|
+
require("fs").writeFileSync(VERSION_PATH, pkgVersion || version);
|
|
92
|
+
|
|
93
|
+
console.error("Done.");
|
|
94
|
+
} catch (err) {
|
|
95
|
+
try { unlinkSync(tmpPath); } catch {}
|
|
96
|
+
console.error(`agenteval: download failed (${err.message})`);
|
|
97
|
+
console.error(`Install manually: https://github.com/${REPO}/releases`);
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return BIN_PATH;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
ensureBinary().then((binPath) => {
|
|
105
|
+
try {
|
|
106
|
+
const result = execFileSync(binPath, process.argv.slice(2), { stdio: "inherit" });
|
|
107
|
+
} catch (err) {
|
|
108
|
+
process.exit(err && typeof err === "object" && "status" in err ? err.status : 1);
|
|
109
|
+
}
|
|
110
|
+
}).catch((err) => {
|
|
111
|
+
console.error(`agenteval: ${err.message}`);
|
|
112
|
+
process.exit(1);
|
|
113
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agenteval-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Lint, benchmark, and CI gate for AI coding instructions",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"instructions",
|
|
13
13
|
"agents",
|
|
14
14
|
"lint",
|
|
15
|
-
"benchmark"
|
|
15
|
+
"benchmark",
|
|
16
|
+
"cursor",
|
|
17
|
+
"agenteval"
|
|
16
18
|
],
|
|
17
19
|
"repository": {
|
|
18
20
|
"type": "git",
|
|
@@ -24,15 +26,14 @@
|
|
|
24
26
|
"url": "https://github.com/lukasmetzler/agenteval/issues"
|
|
25
27
|
},
|
|
26
28
|
"license": "MIT",
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=18"
|
|
31
|
+
},
|
|
27
32
|
"bin": {
|
|
28
33
|
"agenteval": "bin/agenteval"
|
|
29
34
|
},
|
|
30
|
-
"scripts": {
|
|
31
|
-
"postinstall": "node install.mjs"
|
|
32
|
-
},
|
|
33
35
|
"files": [
|
|
34
36
|
"bin/",
|
|
35
|
-
"install.mjs",
|
|
36
37
|
"README.md"
|
|
37
38
|
]
|
|
38
39
|
}
|
package/install.mjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { chmodSync, createWriteStream, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
4
|
-
import https from "node:https";
|
|
5
|
-
import { dirname, join } from "node:path";
|
|
6
|
-
import { fileURLToPath } from "node:url";
|
|
7
|
-
|
|
8
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
const REPO = "lukasmetzler/agenteval";
|
|
10
|
-
const binDir = join(__dirname, "bin");
|
|
11
|
-
const binPath = join(binDir, "agenteval");
|
|
12
|
-
|
|
13
|
-
function detectBinary() {
|
|
14
|
-
const platform = process.platform === "darwin" ? "darwin" : "linux";
|
|
15
|
-
const arch = process.arch === "arm64" ? "arm64" : "x64";
|
|
16
|
-
|
|
17
|
-
if (platform === "linux" && arch !== "x64") {
|
|
18
|
-
throw new Error(`Unsupported platform: ${platform}-${arch}`);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return `agenteval-${platform}-${arch}`;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function download(url, dest) {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
https
|
|
27
|
-
.get(url, { headers: { "User-Agent": "agenteval-npm" } }, (res) => {
|
|
28
|
-
if (res.statusCode === 301 || res.statusCode === 302) {
|
|
29
|
-
return download(res.headers.location, dest).then(resolve, reject);
|
|
30
|
-
}
|
|
31
|
-
if (res.statusCode !== 200) {
|
|
32
|
-
reject(new Error(`Download failed: HTTP ${res.statusCode}`));
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const file = createWriteStream(dest);
|
|
36
|
-
res.pipe(file);
|
|
37
|
-
file.on("finish", () => {
|
|
38
|
-
file.close();
|
|
39
|
-
resolve();
|
|
40
|
-
});
|
|
41
|
-
file.on("error", reject);
|
|
42
|
-
})
|
|
43
|
-
.on("error", reject);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
async function main() {
|
|
48
|
-
const binary = detectBinary();
|
|
49
|
-
|
|
50
|
-
// Read version from package.json
|
|
51
|
-
const pkg = JSON.parse(readFileSync(join(__dirname, "package.json"), "utf8"));
|
|
52
|
-
const version = `v${pkg.version}`;
|
|
53
|
-
const url = `https://github.com/${REPO}/releases/download/${version}/${binary}`;
|
|
54
|
-
|
|
55
|
-
if (!existsSync(binDir)) {
|
|
56
|
-
mkdirSync(binDir, { recursive: true });
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
console.log(`Downloading agenteval ${version} (${binary})...`);
|
|
60
|
-
await download(url, binPath);
|
|
61
|
-
chmodSync(binPath, 0o755);
|
|
62
|
-
console.log("agenteval installed successfully.");
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
main().catch((err) => {
|
|
66
|
-
console.error(`Failed to install agenteval: ${err.message}`);
|
|
67
|
-
console.error("Install manually: https://github.com/lukasmetzler/agenteval/releases");
|
|
68
|
-
process.exit(1);
|
|
69
|
-
});
|