devin-review 0.0.1-alpha.20260115.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/bin/entry.js +100 -0
- package/package.json +15 -0
package/bin/entry.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
//@ts-check
|
|
4
|
+
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
const { spawn } = require("node:child_process");
|
|
7
|
+
const fs = require("node:fs");
|
|
8
|
+
|
|
9
|
+
const EXE_BASENAME = "devin-review";
|
|
10
|
+
const WIN_EXE = `${EXE_BASENAME}.exe`;
|
|
11
|
+
|
|
12
|
+
function readLauncherPackageJson() {
|
|
13
|
+
// bin/entry.js -> package root is one level up
|
|
14
|
+
const pkgPath = path.join(__dirname, "..", "package.json");
|
|
15
|
+
return JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function selectPlatformPackageName(optionalDependencies) {
|
|
19
|
+
const platform = process.platform; // 'darwin' | 'linux' | 'win32'
|
|
20
|
+
const arch = process.arch; // 'x64' | 'arm64' | ...
|
|
21
|
+
|
|
22
|
+
const suffix = `${EXE_BASENAME}-${platform}-${arch}`;
|
|
23
|
+
|
|
24
|
+
const keys = Object.keys(optionalDependencies || {});
|
|
25
|
+
const match = keys.find((name) => name.endsWith(suffix));
|
|
26
|
+
|
|
27
|
+
return match || null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function resolveBinaryPath(platformPackageName) {
|
|
31
|
+
// Resolve the installed package location
|
|
32
|
+
const pkgJsonPath = require.resolve(`${platformPackageName}/package.json`);
|
|
33
|
+
const pkgDir = path.dirname(pkgJsonPath);
|
|
34
|
+
|
|
35
|
+
const binName = process.platform === "win32" ? WIN_EXE : EXE_BASENAME;
|
|
36
|
+
return path.join(pkgDir, "bin", binName);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function run() {
|
|
40
|
+
const launcherPkg = readLauncherPackageJson();
|
|
41
|
+
const platformPkg = selectPlatformPackageName(launcherPkg.optionalDependencies);
|
|
42
|
+
|
|
43
|
+
if (!platformPkg) {
|
|
44
|
+
console.error(
|
|
45
|
+
`${EXE_BASENAME}: unsupported platform or missing platform package for ${process.platform} ${process.arch}\n` +
|
|
46
|
+
`${EXE_BASENAME}: expected an optionalDependency ending with "${EXE_BASENAME}-${process.platform}-${process.arch}".\n` +
|
|
47
|
+
`${EXE_BASENAME}: (If you installed with --no-optional, reinstall without it.)`
|
|
48
|
+
);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
let binPath;
|
|
53
|
+
try {
|
|
54
|
+
binPath = resolveBinaryPath(platformPkg);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.error(`${EXE_BASENAME}: failed to resolve platform package "${platformPkg}".`);
|
|
57
|
+
console.error(`${EXE_BASENAME}: ${err && err.message ? err.message : String(err)}`);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (!fs.existsSync(binPath)) {
|
|
62
|
+
console.error(`${EXE_BASENAME}: resolved "${platformPkg}" but binary is missing at: ${binPath}`);
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const args = process.argv.slice(2);
|
|
67
|
+
|
|
68
|
+
const child = spawn(binPath, args, {
|
|
69
|
+
stdio: "inherit",
|
|
70
|
+
windowsHide: true
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Forward common signals to the child
|
|
74
|
+
for (const sig of ["SIGINT", "SIGTERM", "SIGHUP"]) {
|
|
75
|
+
process.on(sig, () => {
|
|
76
|
+
try { child.kill(sig); } catch {}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
child.on("exit", (code, signal) => {
|
|
81
|
+
if (signal) {
|
|
82
|
+
// Try to mirror the signal semantics in the parent
|
|
83
|
+
try {
|
|
84
|
+
process.kill(process.pid, signal);
|
|
85
|
+
} catch {
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
process.exit(code == null ? 1 : code);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
child.on("error", (err) => {
|
|
94
|
+
console.error(`${EXE_BASENAME}: failed to start binary at ${binPath}`);
|
|
95
|
+
console.error(`${EXE_BASENAME}: ${err && err.message ? err.message : String(err)}`);
|
|
96
|
+
process.exit(1);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
run();
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "devin-review",
|
|
3
|
+
"version": "0.0.1-alpha.20260115.2",
|
|
4
|
+
"bin": {
|
|
5
|
+
"devin-review": "bin/entry.js"
|
|
6
|
+
},
|
|
7
|
+
"optionalDependencies": {
|
|
8
|
+
"@cognitionai/devin-review-darwin-arm64": "0.0.1-alpha.20260115.2",
|
|
9
|
+
"@cognitionai/devin-review-darwin-x64": "0.0.1-alpha.20260115.2",
|
|
10
|
+
"@cognitionai/devin-review-linux-arm64": "0.0.1-alpha.20260115.2",
|
|
11
|
+
"@cognitionai/devin-review-linux-x64": "0.0.1-alpha.20260115.2",
|
|
12
|
+
"@cognitionai/devin-review-win32-arm64": "0.0.1-alpha.20260115.2",
|
|
13
|
+
"@cognitionai/devin-review-win32-x64": "0.0.1-alpha.20260115.2"
|
|
14
|
+
}
|
|
15
|
+
}
|