@viraatdas/rudder 2.10.17 → 2.10.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viraatdas/rudder",
3
- "version": "2.10.17",
3
+ "version": "2.10.19",
4
4
  "description": "A Claude Code-style terminal app for running coding agents with worktree-isolated runs.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://rudder.viraat.dev",
@@ -20,7 +20,7 @@
20
20
  "check": "tsc -p tsconfig.json --noEmit",
21
21
  "test": "tsc -p tsconfig.json && npm run chmod-cli && node --test tests/*.test.mjs",
22
22
  "test:worker-scroll": "cargo test --manifest-path native/Cargo.toml top_origin_scroll_region_history_scrolls_like_terminal_scrollback && cargo test --manifest-path native/Cargo.toml worker_wheel && cargo test --manifest-path native/Cargo.toml wheel_scroll && cargo test --manifest-path native/Cargo.toml worker_page && cargo test --manifest-path native/Cargo.toml codex_alternate_screen_page_key",
23
- "copy-native": "node -e \"const fs=require('fs');const path=require('path');const sources=[path.join('target','release','rudder-native'),path.join('native','target','release','rudder-native')];const src=sources.find((candidate)=>fs.existsSync(candidate));const dest=path.join('dist','native','rudder-native');if(src){fs.mkdirSync(path.dirname(dest),{recursive:true});fs.copyFileSync(src,dest);fs.chmodSync(dest,0o755);}else if(fs.existsSync(dest)){fs.unlinkSync(dest);}\"",
23
+ "copy-native": "node scripts/copy-native.mjs",
24
24
  "chmod-cli": "node -e \"require('fs').chmodSync('dist/index.js',0o755)\"",
25
25
  "prepack": "npm run build",
26
26
  "postinstall": "node scripts/postinstall.mjs",
@@ -29,6 +29,7 @@
29
29
  "files": [
30
30
  "dist/",
31
31
  "assets/",
32
+ "scripts/copy-native.mjs",
32
33
  "scripts/postinstall.mjs",
33
34
  "README.md",
34
35
  "package.json"
@@ -0,0 +1,89 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+
5
+ const nativeBinaryBase = "rudder-native";
6
+ const nativeBinaryName = process.platform === "win32" ? `${nativeBinaryBase}.exe` : nativeBinaryBase;
7
+ const platformKey = `${process.platform}-${process.arch}`;
8
+ const distNativeDir = path.join("dist", "native");
9
+
10
+ function copyExecutable(src, dest) {
11
+ fs.mkdirSync(path.dirname(dest), { recursive: true });
12
+ fs.copyFileSync(src, dest);
13
+ if (process.platform !== "win32") {
14
+ fs.chmodSync(dest, 0o755);
15
+ }
16
+ }
17
+
18
+ function copyCurrentBuild() {
19
+ const sources = [
20
+ path.join("target", "release", nativeBinaryName),
21
+ path.join("native", "target", "release", nativeBinaryName),
22
+ ];
23
+ const src = sources.find((candidate) => fs.existsSync(candidate));
24
+ if (!src) {
25
+ return false;
26
+ }
27
+ copyExecutable(src, path.join(distNativeDir, platformKey, nativeBinaryName));
28
+ return true;
29
+ }
30
+
31
+ function copyPrebuiltArtifacts() {
32
+ const root = process.env.RUDDER_NATIVE_PREBUILTS;
33
+ if (!root || !fs.existsSync(root)) {
34
+ return 0;
35
+ }
36
+ let copied = 0;
37
+ for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
38
+ if (!entry.isDirectory()) {
39
+ continue;
40
+ }
41
+ const key = entry.name.replace(/^rudder-native-/, "");
42
+ const dir = path.join(root, entry.name);
43
+ const candidates = [
44
+ path.join(dir, "rudder-native"),
45
+ path.join(dir, "rudder-native.exe"),
46
+ path.join(dir, key, "rudder-native"),
47
+ path.join(dir, key, "rudder-native.exe"),
48
+ path.join(dir, "native-dist", key, "rudder-native"),
49
+ path.join(dir, "native-dist", key, "rudder-native.exe"),
50
+ ];
51
+ const src = candidates.find((candidate) => fs.existsSync(candidate)) ?? findNestedNativeBinary(dir);
52
+ if (!src) {
53
+ continue;
54
+ }
55
+ const name = src.endsWith(".exe") ? "rudder-native.exe" : "rudder-native";
56
+ copyExecutable(src, path.join(distNativeDir, key, name));
57
+ copied += 1;
58
+ }
59
+ return copied;
60
+ }
61
+
62
+ function findNestedNativeBinary(dir) {
63
+ const pending = [{ dir, depth: 0 }];
64
+ while (pending.length > 0) {
65
+ const current = pending.pop();
66
+ if (!current || current.depth > 4) {
67
+ continue;
68
+ }
69
+ for (const entry of fs.readdirSync(current.dir, { withFileTypes: true })) {
70
+ const full = path.join(current.dir, entry.name);
71
+ if (entry.isFile() && (entry.name === "rudder-native" || entry.name === "rudder-native.exe")) {
72
+ return full;
73
+ }
74
+ if (entry.isDirectory()) {
75
+ pending.push({ dir: full, depth: current.depth + 1 });
76
+ }
77
+ }
78
+ }
79
+ return undefined;
80
+ }
81
+
82
+ function removeLegacyFlatBinary() {
83
+ fs.rmSync(path.join(distNativeDir, "rudder-native"), { force: true });
84
+ fs.rmSync(path.join(distNativeDir, "rudder-native.exe"), { force: true });
85
+ }
86
+
87
+ copyCurrentBuild();
88
+ copyPrebuiltArtifacts();
89
+ removeLegacyFlatBinary();
Binary file