complior 0.9.0 → 0.9.3
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/bin/run.js +19 -3
- package/package.json +5 -2
- package/scripts/postinstall.js +7 -23
package/bin/run.js
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Launcher for Complior
|
|
2
|
+
// Launcher for Complior CLI binary installed via npm
|
|
3
3
|
import { execFileSync } from "node:child_process";
|
|
4
4
|
import { join, dirname } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
7
|
+
import { createRequire } from "node:module";
|
|
7
8
|
|
|
8
9
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
10
|
const binaryName = process.platform === "win32" ? "complior.exe" : "complior";
|
|
10
11
|
const binaryPath = join(__dirname, binaryName);
|
|
11
12
|
|
|
12
13
|
if (!existsSync(binaryPath)) {
|
|
13
|
-
console.error("Complior binary not found. Run: npm rebuild
|
|
14
|
+
console.error("Complior binary not found. Run: npm rebuild complior");
|
|
14
15
|
process.exit(1);
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
// Resolve @complior/engine location so the Rust binary can find & start it
|
|
19
|
+
const require = createRequire(import.meta.url);
|
|
20
|
+
let engineDir;
|
|
17
21
|
try {
|
|
18
|
-
|
|
22
|
+
const enginePkg = require.resolve("@complior/engine/package.json");
|
|
23
|
+
engineDir = dirname(enginePkg);
|
|
24
|
+
} catch {
|
|
25
|
+
// Engine not found — binary will show its own error
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const env = { ...process.env };
|
|
29
|
+
if (engineDir) {
|
|
30
|
+
env.COMPLIOR_ENGINE_DIR = engineDir;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
execFileSync(binaryPath, process.argv.slice(2), { stdio: "inherit", env });
|
|
19
35
|
} catch (err) {
|
|
20
36
|
process.exit(err.status ?? 1);
|
|
21
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "complior",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI Act Compliance Scanner & Fixer — EU AI Act compliance for your AI systems. CLI, TUI dashboard, and background daemon.",
|
|
6
6
|
"license": "AGPL-3.0-only",
|
|
@@ -47,7 +47,10 @@
|
|
|
47
47
|
"bin/",
|
|
48
48
|
"scripts/"
|
|
49
49
|
],
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@complior/engine": "0.9.3"
|
|
52
|
+
},
|
|
50
53
|
"engines": {
|
|
51
|
-
"node": ">=
|
|
54
|
+
"node": ">=22"
|
|
52
55
|
}
|
|
53
56
|
}
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// Downloads the platform-specific Complior binary after npm install
|
|
3
|
-
import { createWriteStream, chmodSync, existsSync, mkdirSync } from "node:fs";
|
|
3
|
+
import { createWriteStream, chmodSync, existsSync, mkdirSync, readFileSync } from "node:fs";
|
|
4
4
|
import { join, dirname } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { get } from "node:https";
|
|
7
|
-
import { execSync } from "node:child_process";
|
|
8
7
|
|
|
9
8
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
9
|
const BIN_DIR = join(__dirname, "..", "bin");
|
|
11
10
|
const REPO = "complior/complior";
|
|
12
11
|
|
|
12
|
+
function getPackageVersion() {
|
|
13
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf8"));
|
|
14
|
+
return `v${pkg.version}`;
|
|
15
|
+
}
|
|
16
|
+
|
|
13
17
|
function getPlatformArtifact() {
|
|
14
18
|
const platform = process.platform;
|
|
15
19
|
const arch = process.arch;
|
|
@@ -32,26 +36,6 @@ function getPlatformArtifact() {
|
|
|
32
36
|
return artifact;
|
|
33
37
|
}
|
|
34
38
|
|
|
35
|
-
function getLatestVersion() {
|
|
36
|
-
return new Promise((resolve, reject) => {
|
|
37
|
-
get(
|
|
38
|
-
`https://api.github.com/repos/${REPO}/releases/latest`,
|
|
39
|
-
{ headers: { "User-Agent": "ai-comply-npm" } },
|
|
40
|
-
(res) => {
|
|
41
|
-
let data = "";
|
|
42
|
-
res.on("data", (chunk) => (data += chunk));
|
|
43
|
-
res.on("end", () => {
|
|
44
|
-
try {
|
|
45
|
-
resolve(JSON.parse(data).tag_name);
|
|
46
|
-
} catch {
|
|
47
|
-
reject(new Error("Failed to parse GitHub release info"));
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
).on("error", reject);
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
|
|
55
39
|
function download(url, dest) {
|
|
56
40
|
return new Promise((resolve, reject) => {
|
|
57
41
|
get(url, { headers: { "User-Agent": "ai-comply-npm" } }, (res) => {
|
|
@@ -85,7 +69,7 @@ async function main() {
|
|
|
85
69
|
console.log(`Downloading Complior binary for ${process.platform}-${process.arch}...`);
|
|
86
70
|
|
|
87
71
|
try {
|
|
88
|
-
const version =
|
|
72
|
+
const version = getPackageVersion();
|
|
89
73
|
const url = `https://github.com/${REPO}/releases/download/${version}/${artifact}`;
|
|
90
74
|
|
|
91
75
|
if (!existsSync(BIN_DIR)) {
|