@0x1labs/vyer 0.1.0
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 +26 -0
- package/bin/vyer.js +20 -0
- package/install.js +94 -0
- package/package.json +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# @0x1labs/vyer (npm)
|
|
2
|
+
|
|
3
|
+
Thin installer for **[Vyer](https://github.com/chirayuoli/vyer)** — the warm code-context
|
|
4
|
+
engine for AI coding agents (an MCP server).
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npx @0x1labs/vyer serve --root . # run it (downloads the right prebuilt binary on first use)
|
|
8
|
+
npm install -g @0x1labs/vyer # or install globally
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Wire it into your agent host (Claude Code / Cursor / Windsurf):
|
|
12
|
+
|
|
13
|
+
```jsonc
|
|
14
|
+
{ "mcpServers": { "vyer": { "command": "npx", "args": ["-y", "@0x1labs/vyer", "serve", "--root", "."] } } }
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
On install, `install.js` downloads the `vyer` binary matching your platform and this
|
|
18
|
+
package's version from the project's GitHub Releases. If no prebuilt binary fits your
|
|
19
|
+
platform, install from source instead:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
cargo install --git https://github.com/chirayuoli/vyer vyer-server
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This package's version tracks the Vyer release it installs (npm `x.y.z` → git tag `vx.y.z`).
|
|
26
|
+
License: MIT OR Apache-2.0.
|
package/bin/vyer.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
// Thin launcher: exec the real `vyer` binary downloaded by install.js, forwarding
|
|
4
|
+
// argv and stdio (MCP speaks over stdio, so `inherit` is essential) and the exit code.
|
|
5
|
+
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const { spawnSync } = require("child_process");
|
|
8
|
+
|
|
9
|
+
const binName = process.platform === "win32" ? "vyer.exe" : "vyer";
|
|
10
|
+
const bin = path.join(__dirname, binName);
|
|
11
|
+
|
|
12
|
+
const res = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
|
|
13
|
+
if (res.error) {
|
|
14
|
+
console.error(
|
|
15
|
+
`[vyer] failed to launch the binary (${res.error.message}). ` +
|
|
16
|
+
"Try reinstalling, or build from source: cargo install --git https://github.com/chirayuoli/vyer vyer-server"
|
|
17
|
+
);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
process.exit(res.status === null ? 1 : res.status);
|
package/install.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
// postinstall: download the prebuilt `vyer` binary that matches this package's
|
|
4
|
+
// version and the host platform from GitHub Releases, into ./bin. The bin/vyer.js
|
|
5
|
+
// shim then execs it. If anything fails, we point the user at the from-source path
|
|
6
|
+
// instead of leaving a broken install.
|
|
7
|
+
|
|
8
|
+
const fs = require("fs");
|
|
9
|
+
const path = require("path");
|
|
10
|
+
const https = require("https");
|
|
11
|
+
const { execFileSync } = require("child_process");
|
|
12
|
+
|
|
13
|
+
const REPO = "chirayuoli/vyer";
|
|
14
|
+
const VERSION = require("./package.json").version;
|
|
15
|
+
|
|
16
|
+
// node platform+arch -> Rust target triple (must match release.yml's matrix)
|
|
17
|
+
const TARGETS = {
|
|
18
|
+
"darwin arm64": "aarch64-apple-darwin",
|
|
19
|
+
"darwin x64": "x86_64-apple-darwin",
|
|
20
|
+
"linux x64": "x86_64-unknown-linux-gnu",
|
|
21
|
+
"linux arm64": "aarch64-unknown-linux-gnu",
|
|
22
|
+
"win32 x64": "x86_64-pc-windows-msvc",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function bail(msg) {
|
|
26
|
+
console.error(`\n[vyer] ${msg}`);
|
|
27
|
+
console.error(
|
|
28
|
+
"[vyer] Install from source instead:\n" +
|
|
29
|
+
" cargo install --git https://github.com/chirayuoli/vyer vyer-server\n"
|
|
30
|
+
);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const key = `${process.platform} ${process.arch}`;
|
|
35
|
+
const target = TARGETS[key];
|
|
36
|
+
if (!target) bail(`no prebuilt binary for ${key}.`);
|
|
37
|
+
|
|
38
|
+
const isWin = process.platform === "win32";
|
|
39
|
+
const ext = isWin ? "zip" : "tar.gz";
|
|
40
|
+
const asset = `vyer-v${VERSION}-${target}.${ext}`;
|
|
41
|
+
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${asset}`;
|
|
42
|
+
const binDir = path.join(__dirname, "bin");
|
|
43
|
+
const binName = isWin ? "vyer.exe" : "vyer";
|
|
44
|
+
|
|
45
|
+
function download(u, dest, cb, redirects) {
|
|
46
|
+
redirects = redirects || 0;
|
|
47
|
+
if (redirects > 10) return cb(new Error("too many redirects"));
|
|
48
|
+
https
|
|
49
|
+
.get(u, { headers: { "User-Agent": "vyer-installer" } }, (res) => {
|
|
50
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
51
|
+
res.resume();
|
|
52
|
+
return download(res.headers.location, dest, cb, redirects + 1);
|
|
53
|
+
}
|
|
54
|
+
if (res.statusCode !== 200) {
|
|
55
|
+
res.resume();
|
|
56
|
+
return cb(new Error(`HTTP ${res.statusCode} for ${u}`));
|
|
57
|
+
}
|
|
58
|
+
const file = fs.createWriteStream(dest);
|
|
59
|
+
res.pipe(file);
|
|
60
|
+
file.on("finish", () => file.close(() => cb(null)));
|
|
61
|
+
file.on("error", cb);
|
|
62
|
+
})
|
|
63
|
+
.on("error", cb);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
67
|
+
const archivePath = path.join(binDir, asset);
|
|
68
|
+
console.log(`[vyer] downloading ${asset} ...`);
|
|
69
|
+
|
|
70
|
+
download(url, archivePath, (err) => {
|
|
71
|
+
if (err) bail(`download failed: ${err.message}`);
|
|
72
|
+
try {
|
|
73
|
+
if (isWin) {
|
|
74
|
+
execFileSync(
|
|
75
|
+
"powershell",
|
|
76
|
+
[
|
|
77
|
+
"-NoProfile",
|
|
78
|
+
"-Command",
|
|
79
|
+
`Expand-Archive -Force -Path "${archivePath}" -DestinationPath "${binDir}"`,
|
|
80
|
+
],
|
|
81
|
+
{ stdio: "inherit" }
|
|
82
|
+
);
|
|
83
|
+
} else {
|
|
84
|
+
execFileSync("tar", ["-xzf", archivePath, "-C", binDir], { stdio: "inherit" });
|
|
85
|
+
}
|
|
86
|
+
fs.unlinkSync(archivePath);
|
|
87
|
+
const binPath = path.join(binDir, binName);
|
|
88
|
+
if (!fs.existsSync(binPath)) bail(`${binName} missing after extraction.`);
|
|
89
|
+
if (!isWin) fs.chmodSync(binPath, 0o755);
|
|
90
|
+
console.log(`[vyer] installed ${binName} (v${VERSION})`);
|
|
91
|
+
} catch (e) {
|
|
92
|
+
bail(`extraction failed: ${e.message}`);
|
|
93
|
+
}
|
|
94
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@0x1labs/vyer",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"publishConfig": { "access": "public" },
|
|
5
|
+
"description": "Vyer — the warm code-context engine for AI coding agents (MCP server).",
|
|
6
|
+
"keywords": ["mcp", "ai", "agent", "code-search", "code-context", "llm", "claude", "cursor"],
|
|
7
|
+
"homepage": "https://github.com/chirayuoli/vyer",
|
|
8
|
+
"repository": { "type": "git", "url": "github:chirayuoli/vyer" },
|
|
9
|
+
"license": "(MIT OR Apache-2.0)",
|
|
10
|
+
"bin": { "vyer": "bin/vyer.js" },
|
|
11
|
+
"scripts": { "postinstall": "node install.js" },
|
|
12
|
+
"files": ["bin/vyer.js", "install.js"],
|
|
13
|
+
"engines": { "node": ">=16" },
|
|
14
|
+
"os": ["darwin", "linux", "win32"],
|
|
15
|
+
"cpu": ["x64", "arm64"]
|
|
16
|
+
}
|