@vera-ai/cli 0.9.2 → 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/README.md +3 -0
- package/bin/vera.js +50 -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,36 @@ 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
|
+
await fsp.writeFile(`${metadataPath}.tmp`, `${JSON.stringify(next, null, 2)}\n`, "utf8");
|
|
92
|
+
await fsp.rename(`${metadataPath}.tmp`, metadataPath);
|
|
93
|
+
}
|
|
94
|
+
|
|
65
95
|
function preferredBinDirs() {
|
|
66
96
|
const home = os.homedir();
|
|
67
97
|
if (process.env.VERA_USER_BIN_DIR) {
|
|
@@ -260,6 +290,11 @@ async function ensureBinaryInstalled() {
|
|
|
260
290
|
const binaryPath = path.join(installDir, binaryName());
|
|
261
291
|
if (fs.existsSync(binaryPath)) {
|
|
262
292
|
await createShim(binaryPath);
|
|
293
|
+
await writeInstallMetadata({
|
|
294
|
+
installMethod: currentInstallMethod(),
|
|
295
|
+
version,
|
|
296
|
+
binaryPath,
|
|
297
|
+
});
|
|
263
298
|
return { binaryPath, version };
|
|
264
299
|
}
|
|
265
300
|
|
|
@@ -289,6 +324,11 @@ async function ensureBinaryInstalled() {
|
|
|
289
324
|
console.error(`Added Vera to ${path.dirname(shimPath)}. Add that directory to PATH to run \`vera\` directly.`);
|
|
290
325
|
}
|
|
291
326
|
|
|
327
|
+
await writeInstallMetadata({
|
|
328
|
+
installMethod: currentInstallMethod(),
|
|
329
|
+
version,
|
|
330
|
+
binaryPath,
|
|
331
|
+
});
|
|
292
332
|
return { binaryPath, version };
|
|
293
333
|
} finally {
|
|
294
334
|
await fsp.rm(tempRoot, { recursive: true, force: true });
|
|
@@ -305,6 +345,16 @@ function runBinary(binaryPath, args) {
|
|
|
305
345
|
|
|
306
346
|
async function main() {
|
|
307
347
|
const { command, rest } = parseArgs(process.argv.slice(2));
|
|
348
|
+
|
|
349
|
+
if (command === "_record-install-method") {
|
|
350
|
+
await writeInstallMetadata({
|
|
351
|
+
installMethod: "npm",
|
|
352
|
+
version: packageVersion,
|
|
353
|
+
binaryPath: null,
|
|
354
|
+
});
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
|
|
308
358
|
const { binaryPath, version } = await ensureBinaryInstalled();
|
|
309
359
|
|
|
310
360
|
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.3",
|
|
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"
|