clawcupid-agent 0.0.3 → 0.0.4
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/dist/cli.js +17 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7,8 +7,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
7
7
|
import { ZipFile } from 'yazl';
|
|
8
8
|
import extract from 'extract-zip';
|
|
9
9
|
function usage() {
|
|
10
|
-
console.log('Usage: clawcupid-agent <install|pack> [--out <path>]');
|
|
11
|
-
console.log('Note: After install, set CLAWCUPID_API=https://api.clawcupid.ai on your OpenClaw host.');
|
|
10
|
+
console.log('Usage: clawcupid-agent <install|pack> [--out <path>] [--api <url>]');
|
|
12
11
|
process.exit(1);
|
|
13
12
|
}
|
|
14
13
|
async function ensureOpenclaw() {
|
|
@@ -65,6 +64,7 @@ async function main() {
|
|
|
65
64
|
const cmd = args[0];
|
|
66
65
|
if (!cmd)
|
|
67
66
|
usage();
|
|
67
|
+
const apiBase = getFlag(args, '--api') ?? process.env.CLAWCUPID_API ?? 'https://api.clawcupid.ai';
|
|
68
68
|
if (cmd === 'pack') {
|
|
69
69
|
const out = getFlag(args, '--out') ?? path.join(process.cwd(), 'clawcupid-agent.skill');
|
|
70
70
|
await packSkill(out);
|
|
@@ -83,8 +83,22 @@ async function main() {
|
|
|
83
83
|
await extract(skillPath, { dir: dst });
|
|
84
84
|
// Restart gateway so skill discovery refreshes
|
|
85
85
|
await execa('openclaw', ['gateway', 'restart'], { stdio: 'inherit' });
|
|
86
|
+
// Create a link code on the server
|
|
87
|
+
const codeRes = await fetch(`${apiBase}/api/connect/code`, { method: 'POST' });
|
|
88
|
+
if (!codeRes.ok) {
|
|
89
|
+
throw new Error(`Failed to create code: ${codeRes.status} ${await codeRes.text()}`);
|
|
90
|
+
}
|
|
91
|
+
const { code } = (await codeRes.json());
|
|
92
|
+
// Run connect setup (enables hooks + registers gateway)
|
|
93
|
+
// Use npx so the user doesn't need global installs.
|
|
94
|
+
await execa('npx', ['clawcupid-connect', 'setup', '--code', code, '--api', apiBase], {
|
|
95
|
+
stdio: 'inherit',
|
|
96
|
+
});
|
|
86
97
|
console.log('Installed clawcupid-agent skill to:', path.join(dst, 'clawcupid-agent'));
|
|
87
|
-
console.log('
|
|
98
|
+
console.log('Server:', apiBase);
|
|
99
|
+
console.log('CODE:', code);
|
|
100
|
+
console.log('Next (Telegram DM to your OpenClaw bot):');
|
|
101
|
+
console.log(` clawcupid link ${code}`);
|
|
88
102
|
return;
|
|
89
103
|
}
|
|
90
104
|
usage();
|
package/package.json
CHANGED