reallink-cli 0.1.5 → 0.1.6
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 +2 -0
- package/bin/reallink.cjs +41 -6
- package/package.json +3 -1
- package/rust/Cargo.lock +1 -1
- package/rust/Cargo.toml +1 -1
- package/scripts/postinstall.cjs +37 -0
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ Rust-based CLI for Reallink authentication, token workflows, and workspace file
|
|
|
8
8
|
npm install -g reallink-cli
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
`npm install` performs a one-time Rust release build during postinstall. After that, `reallink` runs the compiled binary directly (no per-command cargo compile step).
|
|
12
|
+
|
|
11
13
|
## Commands
|
|
12
14
|
|
|
13
15
|
```bash
|
package/bin/reallink.cjs
CHANGED
|
@@ -1,18 +1,53 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const { spawnSync } = require("node:child_process");
|
|
3
|
+
const fs = require("node:fs");
|
|
3
4
|
const path = require("node:path");
|
|
4
5
|
|
|
5
6
|
const packageRoot = path.resolve(__dirname, "..");
|
|
6
7
|
const manifestPath = path.join(packageRoot, "rust", "Cargo.toml");
|
|
7
|
-
const
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
const binaryName = process.platform === "win32" ? "reallink-cli.exe" : "reallink-cli";
|
|
10
|
+
const releaseBinaryPath = path.join(packageRoot, "rust", "target", "release", binaryName);
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
function runBinary(binaryPath) {
|
|
13
|
+
return spawnSync(binaryPath, args, {
|
|
14
|
+
stdio: "inherit",
|
|
15
|
+
shell: false
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function ensureBinary() {
|
|
20
|
+
if (fs.existsSync(releaseBinaryPath)) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const build = spawnSync(
|
|
25
|
+
"cargo",
|
|
26
|
+
["build", "--release", "--manifest-path", manifestPath],
|
|
27
|
+
{
|
|
28
|
+
stdio: "inherit",
|
|
29
|
+
shell: process.platform === "win32"
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
if (build.error) {
|
|
34
|
+
console.error(
|
|
35
|
+
`Failed to build reallink CLI with cargo: ${build.error.message}\n` +
|
|
36
|
+
"Install Rust (cargo) or reinstall using the one-line installer from real-agent.link."
|
|
37
|
+
);
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return build.status === 0 && fs.existsSync(releaseBinaryPath);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!ensureBinary()) {
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
13
47
|
|
|
48
|
+
const result = runBinary(releaseBinaryPath);
|
|
14
49
|
if (result.error) {
|
|
15
|
-
console.error(`Failed to run
|
|
50
|
+
console.error(`Failed to run reallink binary: ${result.error.message}`);
|
|
16
51
|
process.exit(1);
|
|
17
52
|
}
|
|
18
53
|
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reallink-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Rust-based CLI for Reallink auth and API operations",
|
|
5
5
|
"bin": {
|
|
6
6
|
"reallink": "bin/reallink.cjs"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"bin/reallink.cjs",
|
|
10
|
+
"scripts/postinstall.cjs",
|
|
10
11
|
"rust/Cargo.toml",
|
|
11
12
|
"rust/Cargo.lock",
|
|
12
13
|
"rust/src",
|
|
13
14
|
"README.md"
|
|
14
15
|
],
|
|
15
16
|
"scripts": {
|
|
17
|
+
"postinstall": "node ./scripts/postinstall.cjs",
|
|
16
18
|
"build": "cargo build --manifest-path ./rust/Cargo.toml --release",
|
|
17
19
|
"dev": "node ./bin/reallink.cjs --help",
|
|
18
20
|
"pack:local": "npm pack --json"
|
package/rust/Cargo.lock
CHANGED
package/rust/Cargo.toml
CHANGED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require("node:child_process");
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("node:path");
|
|
5
|
+
|
|
6
|
+
const packageRoot = path.resolve(__dirname, "..");
|
|
7
|
+
const manifestPath = path.join(packageRoot, "rust", "Cargo.toml");
|
|
8
|
+
const binaryName = process.platform === "win32" ? "reallink-cli.exe" : "reallink-cli";
|
|
9
|
+
const releaseBinaryPath = path.join(packageRoot, "rust", "target", "release", binaryName);
|
|
10
|
+
|
|
11
|
+
if (process.env.REALLINK_SKIP_BUILD === "1") {
|
|
12
|
+
process.exit(0);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (fs.existsSync(releaseBinaryPath)) {
|
|
16
|
+
process.exit(0);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const build = spawnSync(
|
|
20
|
+
"cargo",
|
|
21
|
+
["build", "--release", "--manifest-path", manifestPath],
|
|
22
|
+
{
|
|
23
|
+
stdio: "inherit",
|
|
24
|
+
shell: process.platform === "win32"
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
if (build.error) {
|
|
29
|
+
console.error(
|
|
30
|
+
`reallink-cli postinstall failed: ${build.error.message}\n` +
|
|
31
|
+
"Rust toolchain is required for npm installation. " +
|
|
32
|
+
"Install Rust (https://rustup.rs) or use the hosted installer at https://real-agent.link/install.sh."
|
|
33
|
+
);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
process.exit(build.status ?? 1);
|