@alibaba-group/open-code-review 1.1.10 → 1.1.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/README.md +10 -0
- package/README.zh-CN.md +10 -0
- package/bin/ocr.js +2 -1
- package/package.json +1 -1
- package/scripts/install.js +31 -14
- package/scripts/update.js +30 -5
package/README.md
CHANGED
|
@@ -89,6 +89,12 @@ chmod +x ocr && sudo mv ocr /usr/local/bin/ocr
|
|
|
89
89
|
# Linux (ARM64)
|
|
90
90
|
curl -Lo ocr https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-linux-arm64
|
|
91
91
|
chmod +x ocr && sudo mv ocr /usr/local/bin/ocr
|
|
92
|
+
|
|
93
|
+
# Windows (x86_64) — move ocr.exe to a directory in your PATH
|
|
94
|
+
curl -Lo ocr.exe https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-windows-amd64.exe
|
|
95
|
+
|
|
96
|
+
# Windows (ARM64) — move ocr.exe to a directory in your PATH
|
|
97
|
+
curl -Lo ocr.exe https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-windows-arm64.exe
|
|
92
98
|
```
|
|
93
99
|
|
|
94
100
|
**From Source**
|
|
@@ -347,6 +353,10 @@ Set `telemetry.content_logging` to include LLM prompts and responses in exported
|
|
|
347
353
|
|
|
348
354
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup, coding guidelines, and how to submit pull requests.
|
|
349
355
|
|
|
356
|
+
## Star History
|
|
357
|
+
|
|
358
|
+
[](https://star-history.com/#alibaba/open-code-review&Date)
|
|
359
|
+
|
|
350
360
|
## License
|
|
351
361
|
|
|
352
362
|
[Apache-2.0](LICENSE) — Copyright 2026 Alibaba
|
package/README.zh-CN.md
CHANGED
|
@@ -89,6 +89,12 @@ chmod +x ocr && sudo mv ocr /usr/local/bin/ocr
|
|
|
89
89
|
# Linux (ARM64)
|
|
90
90
|
curl -Lo ocr https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-linux-arm64
|
|
91
91
|
chmod +x ocr && sudo mv ocr /usr/local/bin/ocr
|
|
92
|
+
|
|
93
|
+
# Windows (x86_64) — 将 ocr.exe 移动到 PATH 目录中
|
|
94
|
+
curl -Lo ocr.exe https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-windows-amd64.exe
|
|
95
|
+
|
|
96
|
+
# Windows (ARM64) — 将 ocr.exe 移动到 PATH 目录中
|
|
97
|
+
curl -Lo ocr.exe https://github.com/alibaba/open-code-review/releases/latest/download/opencodereview-windows-arm64.exe
|
|
92
98
|
```
|
|
93
99
|
|
|
94
100
|
**从源码构建**
|
|
@@ -347,6 +353,10 @@ ocr config set telemetry.otlp_endpoint localhost:4317
|
|
|
347
353
|
|
|
348
354
|
参见 [CONTRIBUTING.zh-CN.md](CONTRIBUTING.zh-CN.md) 了解开发环境搭建、编码规范以及如何提交 Pull Request。
|
|
349
355
|
|
|
356
|
+
## Star History
|
|
357
|
+
|
|
358
|
+
[](https://star-history.com/#alibaba/open-code-review&Date)
|
|
359
|
+
|
|
350
360
|
## 许可证
|
|
351
361
|
|
|
352
362
|
[Apache-2.0](LICENSE) — Copyright 2026 Alibaba
|
package/bin/ocr.js
CHANGED
|
@@ -6,7 +6,8 @@ const path = require("path");
|
|
|
6
6
|
const fs = require("fs");
|
|
7
7
|
const os = require("os");
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const IS_WINDOWS = process.platform === "win32";
|
|
10
|
+
const binaryPath = path.join(__dirname, IS_WINDOWS ? "opencodereview.exe" : "opencodereview");
|
|
10
11
|
|
|
11
12
|
if (!process.env.OCR_NO_UPDATE) {
|
|
12
13
|
const stateDir = path.join(os.homedir(), ".opencodereview");
|
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -6,7 +6,8 @@ const path = require("path");
|
|
|
6
6
|
const https = require("https");
|
|
7
7
|
const crypto = require("crypto");
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const IS_WINDOWS = process.platform === "win32";
|
|
10
|
+
const BINARY_NAME = IS_WINDOWS ? "opencodereview.exe" : "opencodereview";
|
|
10
11
|
|
|
11
12
|
const packageRoot = path.join(__dirname, "..");
|
|
12
13
|
const binDir = path.join(packageRoot, "bin");
|
|
@@ -25,7 +26,7 @@ function error(msg) {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
function detectPlatform() {
|
|
28
|
-
|
|
29
|
+
let os = process.platform;
|
|
29
30
|
let arch = process.arch;
|
|
30
31
|
|
|
31
32
|
switch (arch) {
|
|
@@ -41,10 +42,17 @@ function detectPlatform() {
|
|
|
41
42
|
);
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
switch (os) {
|
|
46
|
+
case "linux":
|
|
47
|
+
case "darwin":
|
|
48
|
+
break;
|
|
49
|
+
case "win32":
|
|
50
|
+
os = "windows";
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
throw new Error(
|
|
54
|
+
`Unsupported operating system: ${os}. Supported: linux, darwin, win32`
|
|
55
|
+
);
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
return { os, arch };
|
|
@@ -157,21 +165,28 @@ async function main() {
|
|
|
157
165
|
fs.mkdirSync(binDir, { recursive: true });
|
|
158
166
|
}
|
|
159
167
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
168
|
+
if (!IS_WINDOWS) {
|
|
169
|
+
const jsWrapper = path.join(binDir, "ocr.js");
|
|
170
|
+
if (fs.existsSync(jsWrapper)) {
|
|
171
|
+
try {
|
|
172
|
+
fs.chmodSync(jsWrapper, 0o755);
|
|
173
|
+
} catch (e) {
|
|
174
|
+
warn(`Could not make ocr.js executable: ${e.message}`);
|
|
175
|
+
}
|
|
166
176
|
}
|
|
167
177
|
}
|
|
168
178
|
|
|
169
179
|
const vars = { version, os, arch };
|
|
170
|
-
|
|
180
|
+
let downloadUrl = buildUrl(config.urlPattern, vars);
|
|
181
|
+
if (IS_WINDOWS) {
|
|
182
|
+
downloadUrl += ".exe";
|
|
183
|
+
}
|
|
171
184
|
info(`Downloading ${downloadUrl} ...`);
|
|
172
185
|
|
|
173
186
|
await downloadBinary(downloadUrl, binaryDest);
|
|
174
|
-
|
|
187
|
+
if (!IS_WINDOWS) {
|
|
188
|
+
fs.chmodSync(binaryDest, 0o755);
|
|
189
|
+
}
|
|
175
190
|
|
|
176
191
|
if (config.checksumPattern) {
|
|
177
192
|
try {
|
|
@@ -225,6 +240,8 @@ if (require.main === module) {
|
|
|
225
240
|
});
|
|
226
241
|
} else {
|
|
227
242
|
module.exports = {
|
|
243
|
+
IS_WINDOWS,
|
|
244
|
+
BINARY_NAME,
|
|
228
245
|
detectPlatform,
|
|
229
246
|
loadPackageJson,
|
|
230
247
|
buildUrl,
|
package/scripts/update.js
CHANGED
|
@@ -9,6 +9,8 @@ const https = require("https");
|
|
|
9
9
|
const { spawnSync } = require("child_process");
|
|
10
10
|
|
|
11
11
|
const {
|
|
12
|
+
IS_WINDOWS,
|
|
13
|
+
BINARY_NAME,
|
|
12
14
|
detectPlatform,
|
|
13
15
|
loadPackageJson,
|
|
14
16
|
buildUrl,
|
|
@@ -16,10 +18,9 @@ const {
|
|
|
16
18
|
downloadBinary,
|
|
17
19
|
computeChecksum,
|
|
18
20
|
} = require("./install.js");
|
|
19
|
-
|
|
20
21
|
const packageRoot = path.join(__dirname, "..");
|
|
21
22
|
const binDir = path.join(packageRoot, "bin");
|
|
22
|
-
const binaryPath = path.join(binDir,
|
|
23
|
+
const binaryPath = path.join(binDir, BINARY_NAME);
|
|
23
24
|
const stateDir = path.join(os.homedir(), ".opencodereview");
|
|
24
25
|
const tsFile = path.join(stateDir, "last-update-check");
|
|
25
26
|
const lockFile = path.join(stateDir, "update.lock");
|
|
@@ -160,11 +161,16 @@ async function main() {
|
|
|
160
161
|
const config = pkg.ocrConfig;
|
|
161
162
|
|
|
162
163
|
const vars = { version: latestVersion, os: platform, arch };
|
|
163
|
-
|
|
164
|
+
let downloadUrl = buildUrl(config.urlPattern, vars);
|
|
165
|
+
if (IS_WINDOWS) {
|
|
166
|
+
downloadUrl += ".exe";
|
|
167
|
+
}
|
|
164
168
|
|
|
165
169
|
const tempPath = path.join(binDir, `.opencodereview.tmp.${process.pid}`);
|
|
166
170
|
await downloadBinary(downloadUrl, tempPath);
|
|
167
|
-
|
|
171
|
+
if (!IS_WINDOWS) {
|
|
172
|
+
fs.chmodSync(tempPath, 0o755);
|
|
173
|
+
}
|
|
168
174
|
|
|
169
175
|
if (config.checksumPattern) {
|
|
170
176
|
try {
|
|
@@ -190,7 +196,26 @@ async function main() {
|
|
|
190
196
|
}
|
|
191
197
|
}
|
|
192
198
|
|
|
193
|
-
|
|
199
|
+
if (IS_WINDOWS) {
|
|
200
|
+
const oldPath = binaryPath + ".old";
|
|
201
|
+
try { fs.unlinkSync(oldPath); } catch (_) {}
|
|
202
|
+
try {
|
|
203
|
+
fs.renameSync(binaryPath, oldPath);
|
|
204
|
+
} catch (e) {
|
|
205
|
+
if (fs.existsSync(binaryPath)) {
|
|
206
|
+
throw e;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
try {
|
|
210
|
+
fs.renameSync(tempPath, binaryPath);
|
|
211
|
+
} catch (e) {
|
|
212
|
+
try { fs.renameSync(oldPath, binaryPath); } catch (_) {}
|
|
213
|
+
throw e;
|
|
214
|
+
}
|
|
215
|
+
try { fs.unlinkSync(oldPath); } catch (_) {}
|
|
216
|
+
} else {
|
|
217
|
+
fs.renameSync(tempPath, binaryPath);
|
|
218
|
+
}
|
|
194
219
|
} catch (_) {
|
|
195
220
|
cleanupTemp();
|
|
196
221
|
} finally {
|