reallink-cli 0.1.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # reallink-cli
2
2
 
3
- Rust-based CLI for Reallink authentication and API token workflows.
3
+ Rust-based CLI for Reallink authentication, token workflows, and workspace file CRUD.
4
4
 
5
5
  ## Install
6
6
 
@@ -8,18 +8,53 @@ Rust-based CLI for Reallink authentication and API token workflows.
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
14
16
  reallink login --base-url https://api.real-agent.link
17
+ reallink login --force # replace current saved session
15
18
  reallink whoami
16
19
  reallink logout
17
20
 
21
+ reallink project list --org-id org_xxx
22
+ reallink project create --org-id org_xxx --name "new project" --description "optional"
23
+ reallink project get --project-id prj_xxx
24
+ reallink project update --project-id prj_xxx --name "renamed project"
25
+ reallink project update --project-id prj_xxx --clear-description
26
+ reallink project delete --project-id prj_xxx
27
+
18
28
  reallink token list
19
29
  reallink token create --name "ci-token" --scope trace:read --scope trace:write
20
30
  reallink token revoke --token-id tok_xxx
31
+
32
+ reallink file list --project-id prj_xxx
33
+ reallink file get --asset-id ast_xxx
34
+ reallink file upload --project-id prj_xxx --source ./local/report.json --path reports/daily
35
+ reallink file mkdir --project-id prj_xxx --path reports/archive
36
+ reallink file move --asset-id ast_xxx --file-name reports/archive/report.json
37
+ reallink file remove --asset-id ast_xxx
38
+
39
+ reallink tool list
40
+ reallink tool register --manifest ./spec/tools/trace-placeholder.tool.jsonc
41
+ reallink tool enable --tool-id trace.placeholder --project-id prj_xxx
42
+ reallink tool enable --tool-id trace.placeholder --user-id usr_xxx
43
+ reallink tool run --tool-id trace.placeholder --project-id prj_xxx --input-file ./run-input.jsonc --idempotency-key run-001
44
+ reallink tool runs --project-id prj_xxx
45
+ reallink tool get-run --run-id trun_xxx
21
46
  ```
22
47
 
48
+ `tool register`, `tool enable/disable` metadata, and `tool run --input-file` accept JSONC.
49
+
50
+ ## Session Behavior
51
+
52
+ - Login stores a local session at:
53
+ - Windows: `%APPDATA%\\reallink\\session.json`
54
+ - Linux/macOS: `${XDG_CONFIG_HOME:-~/.config}/reallink/session.json`
55
+ - You only need to log in again when the saved session is invalid/expired or you explicitly run `reallink logout`.
56
+ - `reallink logout` revokes the current server session (`/auth/logout`) and clears the local session file.
57
+
23
58
  ## Requirements
24
59
 
25
60
  - Rust toolchain (`cargo`) must be installed.
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 cargoArgs = ["run", "--quiet", "--manifest-path", manifestPath, "--", ...process.argv.slice(2)];
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
- const result = spawnSync("cargo", cargoArgs, {
10
- stdio: "inherit",
11
- shell: process.platform === "win32"
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 cargo: ${result.error.message}`);
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.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
@@ -76,6 +76,15 @@ version = "2.11.0"
76
76
  source = "registry+https://github.com/rust-lang/crates.io-index"
77
77
  checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af"
78
78
 
79
+ [[package]]
80
+ name = "block-buffer"
81
+ version = "0.10.4"
82
+ source = "registry+https://github.com/rust-lang/crates.io-index"
83
+ checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"
84
+ dependencies = [
85
+ "generic-array",
86
+ ]
87
+
79
88
  [[package]]
80
89
  name = "bumpalo"
81
90
  version = "3.20.2"
@@ -188,6 +197,35 @@ version = "0.8.7"
188
197
  source = "registry+https://github.com/rust-lang/crates.io-index"
189
198
  checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"
190
199
 
200
+ [[package]]
201
+ name = "cpufeatures"
202
+ version = "0.2.17"
203
+ source = "registry+https://github.com/rust-lang/crates.io-index"
204
+ checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"
205
+ dependencies = [
206
+ "libc",
207
+ ]
208
+
209
+ [[package]]
210
+ name = "crypto-common"
211
+ version = "0.1.7"
212
+ source = "registry+https://github.com/rust-lang/crates.io-index"
213
+ checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"
214
+ dependencies = [
215
+ "generic-array",
216
+ "typenum",
217
+ ]
218
+
219
+ [[package]]
220
+ name = "digest"
221
+ version = "0.10.7"
222
+ source = "registry+https://github.com/rust-lang/crates.io-index"
223
+ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
224
+ dependencies = [
225
+ "block-buffer",
226
+ "crypto-common",
227
+ ]
228
+
191
229
  [[package]]
192
230
  name = "dirs"
193
231
  version = "5.0.1"
@@ -268,6 +306,16 @@ dependencies = [
268
306
  "slab",
269
307
  ]
270
308
 
309
+ [[package]]
310
+ name = "generic-array"
311
+ version = "0.14.7"
312
+ source = "registry+https://github.com/rust-lang/crates.io-index"
313
+ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"
314
+ dependencies = [
315
+ "typenum",
316
+ "version_check",
317
+ ]
318
+
271
319
  [[package]]
272
320
  name = "getrandom"
273
321
  version = "0.2.17"
@@ -563,6 +611,17 @@ dependencies = [
563
611
  "wasm-bindgen",
564
612
  ]
565
613
 
614
+ [[package]]
615
+ name = "json5"
616
+ version = "0.4.1"
617
+ source = "registry+https://github.com/rust-lang/crates.io-index"
618
+ checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1"
619
+ dependencies = [
620
+ "pest",
621
+ "pest_derive",
622
+ "serde",
623
+ ]
624
+
566
625
  [[package]]
567
626
  name = "libc"
568
627
  version = "0.2.182"
@@ -668,6 +727,49 @@ version = "2.3.2"
668
727
  source = "registry+https://github.com/rust-lang/crates.io-index"
669
728
  checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
670
729
 
730
+ [[package]]
731
+ name = "pest"
732
+ version = "2.8.6"
733
+ source = "registry+https://github.com/rust-lang/crates.io-index"
734
+ checksum = "e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662"
735
+ dependencies = [
736
+ "memchr",
737
+ "ucd-trie",
738
+ ]
739
+
740
+ [[package]]
741
+ name = "pest_derive"
742
+ version = "2.8.6"
743
+ source = "registry+https://github.com/rust-lang/crates.io-index"
744
+ checksum = "11f486f1ea21e6c10ed15d5a7c77165d0ee443402f0780849d1768e7d9d6fe77"
745
+ dependencies = [
746
+ "pest",
747
+ "pest_generator",
748
+ ]
749
+
750
+ [[package]]
751
+ name = "pest_generator"
752
+ version = "2.8.6"
753
+ source = "registry+https://github.com/rust-lang/crates.io-index"
754
+ checksum = "8040c4647b13b210a963c1ed407c1ff4fdfa01c31d6d2a098218702e6664f94f"
755
+ dependencies = [
756
+ "pest",
757
+ "pest_meta",
758
+ "proc-macro2",
759
+ "quote",
760
+ "syn",
761
+ ]
762
+
763
+ [[package]]
764
+ name = "pest_meta"
765
+ version = "2.8.6"
766
+ source = "registry+https://github.com/rust-lang/crates.io-index"
767
+ checksum = "89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220"
768
+ dependencies = [
769
+ "pest",
770
+ "sha2",
771
+ ]
772
+
671
773
  [[package]]
672
774
  name = "pin-project-lite"
673
775
  version = "0.2.17"
@@ -808,11 +910,12 @@ dependencies = [
808
910
 
809
911
  [[package]]
810
912
  name = "reallink-cli"
811
- version = "0.1.1"
913
+ version = "0.1.6"
812
914
  dependencies = [
813
915
  "anyhow",
814
916
  "clap",
815
917
  "dirs",
918
+ "json5",
816
919
  "reqwest",
817
920
  "serde",
818
921
  "serde_json",
@@ -1000,6 +1103,17 @@ dependencies = [
1000
1103
  "serde",
1001
1104
  ]
1002
1105
 
1106
+ [[package]]
1107
+ name = "sha2"
1108
+ version = "0.10.9"
1109
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1110
+ checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"
1111
+ dependencies = [
1112
+ "cfg-if",
1113
+ "cpufeatures",
1114
+ "digest",
1115
+ ]
1116
+
1003
1117
  [[package]]
1004
1118
  name = "shlex"
1005
1119
  version = "1.3.0"
@@ -1248,6 +1362,18 @@ version = "0.2.5"
1248
1362
  source = "registry+https://github.com/rust-lang/crates.io-index"
1249
1363
  checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
1250
1364
 
1365
+ [[package]]
1366
+ name = "typenum"
1367
+ version = "1.19.0"
1368
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1369
+ checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
1370
+
1371
+ [[package]]
1372
+ name = "ucd-trie"
1373
+ version = "0.1.7"
1374
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1375
+ checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"
1376
+
1251
1377
  [[package]]
1252
1378
  name = "unicode-ident"
1253
1379
  version = "1.0.24"
@@ -1284,6 +1410,12 @@ version = "0.2.2"
1284
1410
  source = "registry+https://github.com/rust-lang/crates.io-index"
1285
1411
  checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
1286
1412
 
1413
+ [[package]]
1414
+ name = "version_check"
1415
+ version = "0.9.5"
1416
+ source = "registry+https://github.com/rust-lang/crates.io-index"
1417
+ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
1418
+
1287
1419
  [[package]]
1288
1420
  name = "walkdir"
1289
1421
  version = "2.5.0"
package/rust/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "reallink-cli"
3
- version = "0.1.1"
3
+ version = "0.1.6"
4
4
  edition = "2021"
5
5
  description = "CLI for Reallink auth and token workflows"
6
6
  license = "MIT"
@@ -12,5 +12,6 @@ dirs = "5.0"
12
12
  reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
13
13
  serde = { version = "1.0", features = ["derive"] }
14
14
  serde_json = "1.0"
15
+ json5 = "0.4"
15
16
  tokio = { version = "1.42", features = ["macros", "rt-multi-thread", "time"] }
16
17
  webbrowser = "1.0"