@rethinkingstudio/clawpilot 1.0.1 → 1.0.2
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 +1 -1
- package/src/commands/pair.ts +10 -1
- package/src/index.ts +5 -1
package/package.json
CHANGED
package/src/commands/pair.ts
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import { hostname } from "os";
|
|
2
|
+
import { execSync } from "child_process";
|
|
3
|
+
|
|
4
|
+
function getDisplayName(): string {
|
|
5
|
+
try {
|
|
6
|
+
return execSync("scutil --get ComputerName", { encoding: "utf8" }).trim();
|
|
7
|
+
} catch {
|
|
8
|
+
return hostname();
|
|
9
|
+
}
|
|
10
|
+
}
|
|
2
11
|
import { configExists, readConfig, writeConfig } from "../config/config.js";
|
|
3
12
|
import { installCommand, isInstalled } from "./install.js";
|
|
4
13
|
import qrcodeTerminal from "qrcode-terminal";
|
|
@@ -43,7 +52,7 @@ export async function pairCommand(opts: PairOptions): Promise<void> {
|
|
|
43
52
|
|
|
44
53
|
writeConfig({ ...config, relayServerUrl, displayName });
|
|
45
54
|
} else {
|
|
46
|
-
displayName = opts.name ??
|
|
55
|
+
displayName = opts.name ?? getDisplayName();
|
|
47
56
|
console.log("Registering with relay server…");
|
|
48
57
|
|
|
49
58
|
const res = await fetch(`${httpBase}/api/relay/register`, {
|
package/src/index.ts
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
+
import { createRequire } from "module";
|
|
3
4
|
import { pairCommand } from "./commands/pair.js";
|
|
4
5
|
import { runCommand } from "./commands/run.js";
|
|
5
6
|
import { installCommand, uninstallCommand, stopCommand } from "./commands/install.js";
|
|
6
7
|
import { statusCommand } from "./commands/status.js";
|
|
7
8
|
|
|
9
|
+
const require = createRequire(import.meta.url);
|
|
10
|
+
const { version } = require("../../package.json");
|
|
11
|
+
|
|
8
12
|
const program = new Command();
|
|
9
13
|
|
|
10
14
|
program
|
|
11
15
|
.name("clawpilot")
|
|
12
16
|
.description("ClawPilot relay client — connects Mac mini to the cloud relay server")
|
|
13
|
-
.version(
|
|
17
|
+
.version(version);
|
|
14
18
|
|
|
15
19
|
program
|
|
16
20
|
.command("pair")
|