@badgerclaw/connect 1.0.0 → 1.0.1
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/index.ts +24 -0
- package/package.json +5 -3
package/index.ts
CHANGED
|
@@ -16,6 +16,30 @@ const plugin = {
|
|
|
16
16
|
api.logger.warn?.(`badgerclaw: crypto runtime bootstrap failed: ${message}`);
|
|
17
17
|
});
|
|
18
18
|
api.registerChannel({ plugin: matrixPlugin });
|
|
19
|
+
|
|
20
|
+
api.registerCli(({ program }) => {
|
|
21
|
+
const cmd = program.command("badgerclaw").description("BadgerClaw bot management");
|
|
22
|
+
cmd
|
|
23
|
+
.command("connect <code>")
|
|
24
|
+
.description("Connect an OpenClaw instance to a BadgerClaw bot using a pairing code")
|
|
25
|
+
.action(async (code: string) => {
|
|
26
|
+
try {
|
|
27
|
+
const { redeemPairingCode } = await import("./src/connect.js");
|
|
28
|
+
const result = await redeemPairingCode(code);
|
|
29
|
+
console.log("\n✅ Connected to BadgerClaw bot!");
|
|
30
|
+
console.log(" Bot name: " + result.bot_name);
|
|
31
|
+
console.log(" Bot user: " + result.user_id);
|
|
32
|
+
console.log(" Homeserver: " + result.homeserver);
|
|
33
|
+
console.log("\nSave these credentials in your OpenClaw config:");
|
|
34
|
+
console.log(" channels.badgerclaw.accounts.default.userId = " + result.user_id);
|
|
35
|
+
console.log(" channels.badgerclaw.accounts.default.accessToken = " + result.access_token);
|
|
36
|
+
console.log(" channels.badgerclaw.accounts.default.homeserver = " + result.homeserver);
|
|
37
|
+
} catch (err: any) {
|
|
38
|
+
console.error("\n❌ Failed to connect: " + (err.message || err));
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}, { commands: ["badgerclaw"] });
|
|
19
43
|
},
|
|
20
44
|
};
|
|
21
45
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@badgerclaw/connect",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "BadgerClaw channel plugin for OpenClaw",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"dependencies": {
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"zod": "^4.3.6"
|
|
13
13
|
},
|
|
14
14
|
"openclaw": {
|
|
15
|
-
"extensions": [
|
|
15
|
+
"extensions": [
|
|
16
|
+
"./index.ts"
|
|
17
|
+
],
|
|
16
18
|
"channel": {
|
|
17
19
|
"id": "badgerclaw",
|
|
18
20
|
"label": "BadgerClaw",
|
|
@@ -29,4 +31,4 @@
|
|
|
29
31
|
"defaultChoice": "npm"
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
|
-
}
|
|
34
|
+
}
|