superduck-cli 0.2.5 → 0.2.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/bin/superduck.js +26 -0
- package/package.json +5 -5
package/bin/superduck.js
CHANGED
|
@@ -8,6 +8,31 @@ const { platform, arch } = process;
|
|
|
8
8
|
const exeName = platform === "win32" ? "superduck.exe" : "superduck";
|
|
9
9
|
const pkg = `superduck-${platform}-${arch}`;
|
|
10
10
|
|
|
11
|
+
function randomHex(bytes) {
|
|
12
|
+
try {
|
|
13
|
+
return require("crypto").randomBytes(bytes).toString("hex");
|
|
14
|
+
} catch {
|
|
15
|
+
return `${Date.now()}${Math.random()}`.replace(/\D/g, "");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function ensureAnalyticsId() {
|
|
20
|
+
if (platform === "win32") return;
|
|
21
|
+
const home = process.env.HOME;
|
|
22
|
+
if (!home) return;
|
|
23
|
+
|
|
24
|
+
const dir = path.join(home, ".superduck");
|
|
25
|
+
const file = path.join(dir, "analytics-id");
|
|
26
|
+
try {
|
|
27
|
+
const existing = fs.existsSync(file) ? fs.readFileSync(file, "utf8").trim() : "";
|
|
28
|
+
if (existing.startsWith("sdid-")) return;
|
|
29
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o755 });
|
|
30
|
+
fs.writeFileSync(file, `sdid-${randomHex(16)}\n`, { mode: 0o600 });
|
|
31
|
+
} catch {
|
|
32
|
+
// Analytics identity is best-effort; install must never fail because of it.
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
11
36
|
let binPath;
|
|
12
37
|
try {
|
|
13
38
|
binPath = require.resolve(`${pkg}/bin/${exeName}`);
|
|
@@ -23,6 +48,7 @@ if (!binPath) {
|
|
|
23
48
|
}
|
|
24
49
|
|
|
25
50
|
if (process.argv[2] === "--postinstall") {
|
|
51
|
+
ensureAnalyticsId();
|
|
26
52
|
try {
|
|
27
53
|
if (platform !== "win32") fs.chmodSync(binPath, 0o755);
|
|
28
54
|
} catch (e) {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superduck-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Your browser's session, callable as a tool. CLI bridge from Claude Code/Codex/etc to your active Chrome tab.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superduck": "bin/superduck.js"
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"postinstall": "node bin/superduck.js --postinstall || true"
|
|
15
15
|
},
|
|
16
16
|
"optionalDependencies": {
|
|
17
|
-
"superduck-darwin-arm64": "0.2.
|
|
18
|
-
"superduck-darwin-x64": "0.2.
|
|
19
|
-
"superduck-linux-arm64": "0.2.
|
|
20
|
-
"superduck-linux-x64": "0.2.
|
|
17
|
+
"superduck-darwin-arm64": "0.2.6",
|
|
18
|
+
"superduck-darwin-x64": "0.2.6",
|
|
19
|
+
"superduck-linux-arm64": "0.2.6",
|
|
20
|
+
"superduck-linux-x64": "0.2.6"
|
|
21
21
|
},
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=16"
|