@vera-ai/cli 0.9.2 → 0.9.4
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 +3 -0
- package/bin/vera.js +51 -0
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -32,8 +32,11 @@ vera index . --onnx-jina-cuda
|
|
|
32
32
|
vera doctor
|
|
33
33
|
vera doctor --probe
|
|
34
34
|
vera repair
|
|
35
|
+
vera upgrade
|
|
35
36
|
```
|
|
36
37
|
|
|
38
|
+
`vera doctor --probe` runs a deeper read-only ONNX session check. `vera upgrade` shows the binary update plan and can apply it when the install method is known.
|
|
39
|
+
|
|
37
40
|
## What you get
|
|
38
41
|
|
|
39
42
|
- **60+ languages** via tree-sitter AST parsing
|
package/bin/vera.js
CHANGED
|
@@ -62,6 +62,37 @@ function defaultVeraHome() {
|
|
|
62
62
|
return process.env.VERA_HOME || path.join(os.homedir(), ".vera");
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
function installMetadataPath() {
|
|
66
|
+
return path.join(defaultVeraHome(), "install.json");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function currentInstallMethod() {
|
|
70
|
+
return process.versions.bun ? "bun" : "npm";
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function readInstallMetadata() {
|
|
74
|
+
try {
|
|
75
|
+
const raw = await fsp.readFile(installMetadataPath(), "utf8");
|
|
76
|
+
return JSON.parse(raw);
|
|
77
|
+
} catch {
|
|
78
|
+
return {};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async function writeInstallMetadata({ installMethod, version, binaryPath }) {
|
|
83
|
+
const metadataPath = installMetadataPath();
|
|
84
|
+
await fsp.mkdir(path.dirname(metadataPath), { recursive: true });
|
|
85
|
+
const current = await readInstallMetadata();
|
|
86
|
+
const next = {
|
|
87
|
+
install_method: installMethod ?? current.install_method ?? null,
|
|
88
|
+
version: version ?? current.version ?? null,
|
|
89
|
+
binary_path: binaryPath ?? current.binary_path ?? null,
|
|
90
|
+
};
|
|
91
|
+
const tmpPath = `${metadataPath}.tmp.${process.pid}`;
|
|
92
|
+
await fsp.writeFile(tmpPath, `${JSON.stringify(next, null, 2)}\n`, "utf8");
|
|
93
|
+
await fsp.rename(tmpPath, metadataPath);
|
|
94
|
+
}
|
|
95
|
+
|
|
65
96
|
function preferredBinDirs() {
|
|
66
97
|
const home = os.homedir();
|
|
67
98
|
if (process.env.VERA_USER_BIN_DIR) {
|
|
@@ -260,6 +291,11 @@ async function ensureBinaryInstalled() {
|
|
|
260
291
|
const binaryPath = path.join(installDir, binaryName());
|
|
261
292
|
if (fs.existsSync(binaryPath)) {
|
|
262
293
|
await createShim(binaryPath);
|
|
294
|
+
await writeInstallMetadata({
|
|
295
|
+
installMethod: currentInstallMethod(),
|
|
296
|
+
version,
|
|
297
|
+
binaryPath,
|
|
298
|
+
});
|
|
263
299
|
return { binaryPath, version };
|
|
264
300
|
}
|
|
265
301
|
|
|
@@ -289,6 +325,11 @@ async function ensureBinaryInstalled() {
|
|
|
289
325
|
console.error(`Added Vera to ${path.dirname(shimPath)}. Add that directory to PATH to run \`vera\` directly.`);
|
|
290
326
|
}
|
|
291
327
|
|
|
328
|
+
await writeInstallMetadata({
|
|
329
|
+
installMethod: currentInstallMethod(),
|
|
330
|
+
version,
|
|
331
|
+
binaryPath,
|
|
332
|
+
});
|
|
292
333
|
return { binaryPath, version };
|
|
293
334
|
} finally {
|
|
294
335
|
await fsp.rm(tempRoot, { recursive: true, force: true });
|
|
@@ -305,6 +346,16 @@ function runBinary(binaryPath, args) {
|
|
|
305
346
|
|
|
306
347
|
async function main() {
|
|
307
348
|
const { command, rest } = parseArgs(process.argv.slice(2));
|
|
349
|
+
|
|
350
|
+
if (command === "_record-install-method") {
|
|
351
|
+
await writeInstallMetadata({
|
|
352
|
+
installMethod: "npm",
|
|
353
|
+
version: packageVersion,
|
|
354
|
+
binaryPath: null,
|
|
355
|
+
});
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
|
|
308
359
|
const { binaryPath, version } = await ensureBinaryInstalled();
|
|
309
360
|
|
|
310
361
|
if (command === "install") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vera-ai/cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "Bootstrap installer and wrapper for the Vera CLI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/lemon07r/Vera#readme",
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
"url": "https://github.com/lemon07r/Vera/issues"
|
|
14
14
|
},
|
|
15
15
|
"bin": "./bin/vera.js",
|
|
16
|
+
"scripts": {
|
|
17
|
+
"postinstall": "node ./bin/vera.js _record-install-method"
|
|
18
|
+
},
|
|
16
19
|
"files": [
|
|
17
20
|
"bin/vera.js",
|
|
18
21
|
"README.md"
|