aicq-chat-plugin 2.5.2 → 2.5.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/cli.js +61 -4
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/postinstall.js +8 -0
package/cli.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* aicq-plugin Same as above
|
|
8
8
|
* aicq-plugin start Start the plugin server
|
|
9
9
|
* aicq-plugin install Install plugin to OpenClaw only
|
|
10
|
+
* aicq-plugin uninstall Remove plugin from OpenClaw
|
|
10
11
|
* aicq-plugin status Check plugin status
|
|
11
12
|
* aicq-plugin --port <port> Specify port (default 6109)
|
|
12
13
|
* aicq-plugin --help Show help
|
|
@@ -122,6 +123,7 @@ function findOpenClawWorkspace() {
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
// Try to find workspace from clawhub or common locations
|
|
126
|
+
// Prefer directories that already have a skills/ directory
|
|
125
127
|
const home = os.homedir();
|
|
126
128
|
const candidates = [
|
|
127
129
|
// Current working directory (most common for clawhub)
|
|
@@ -132,7 +134,7 @@ function findOpenClawWorkspace() {
|
|
|
132
134
|
path.join(home, '.openclaw'),
|
|
133
135
|
];
|
|
134
136
|
|
|
135
|
-
// Check if any candidate has a skills/ directory
|
|
137
|
+
// Check if any candidate has a skills/ directory (existing)
|
|
136
138
|
for (const dir of candidates) {
|
|
137
139
|
const skillsDir = path.join(dir, 'skills');
|
|
138
140
|
if (fs.existsSync(skillsDir)) {
|
|
@@ -150,6 +152,14 @@ function findOpenClawWorkspace() {
|
|
|
150
152
|
current = path.dirname(current);
|
|
151
153
|
}
|
|
152
154
|
|
|
155
|
+
// If no existing skills/ found, fall back to the OpenClaw directory itself.
|
|
156
|
+
// This handles the case where ~/.openclaw/ exists but has no skills/ yet.
|
|
157
|
+
// We'll auto-create skills/ inside it during installation.
|
|
158
|
+
const openclawDir = findOpenClawDir();
|
|
159
|
+
if (openclawDir) {
|
|
160
|
+
return openclawDir;
|
|
161
|
+
}
|
|
162
|
+
|
|
153
163
|
return null;
|
|
154
164
|
}
|
|
155
165
|
|
|
@@ -334,6 +344,45 @@ function installToOpenClaw() {
|
|
|
334
344
|
return true;
|
|
335
345
|
}
|
|
336
346
|
|
|
347
|
+
// ── Uninstall from OpenClaw ─────────────────────────────────────────
|
|
348
|
+
function uninstallFromOpenClaw() {
|
|
349
|
+
const PLUGIN_ID = 'aicq-chat';
|
|
350
|
+
let removed = false;
|
|
351
|
+
|
|
352
|
+
// Remove from skills/ directory
|
|
353
|
+
const workspace = findOpenClawWorkspace();
|
|
354
|
+
if (workspace) {
|
|
355
|
+
const skillDir = path.join(workspace, 'skills', PLUGIN_ID);
|
|
356
|
+
if (fs.existsSync(skillDir)) {
|
|
357
|
+
console.log(`[AICQ] Removing skill from ${skillDir}...`);
|
|
358
|
+
fs.rmSync(skillDir, { recursive: true, force: true });
|
|
359
|
+
console.log('[AICQ] Skill removed.');
|
|
360
|
+
removed = true;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Remove from plugins/ directory
|
|
365
|
+
const openclawDir = findOpenClawDir();
|
|
366
|
+
if (openclawDir) {
|
|
367
|
+
const pluginDir = path.join(openclawDir, 'plugins', PLUGIN_ID);
|
|
368
|
+
if (fs.existsSync(pluginDir)) {
|
|
369
|
+
console.log(`[AICQ] Removing plugin from ${pluginDir}...`);
|
|
370
|
+
fs.rmSync(pluginDir, { recursive: true, force: true });
|
|
371
|
+
console.log('[AICQ] Plugin removed.');
|
|
372
|
+
removed = true;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
if (!removed) {
|
|
377
|
+
console.log('[AICQ] AICQ plugin not found in any OpenClaw directory.');
|
|
378
|
+
console.log('[AICQ] Nothing to uninstall.');
|
|
379
|
+
} else {
|
|
380
|
+
console.log('[AICQ] Restart OpenClaw to complete the uninstall.');
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
return removed;
|
|
384
|
+
}
|
|
385
|
+
|
|
337
386
|
// ── Help ────────────────────────────────────────────────────────────
|
|
338
387
|
if (command === '--help' || command === '-h') {
|
|
339
388
|
console.log(`
|
|
@@ -344,9 +393,10 @@ Usage:
|
|
|
344
393
|
aicq-plugin [command] [options]
|
|
345
394
|
|
|
346
395
|
Commands:
|
|
347
|
-
start
|
|
348
|
-
install
|
|
349
|
-
|
|
396
|
+
start Install to OpenClaw (if needed) and start plugin server (default)
|
|
397
|
+
install Install plugin to OpenClaw only (don't start server)
|
|
398
|
+
uninstall Remove plugin from OpenClaw (skills/ and plugins/)
|
|
399
|
+
status Check if the plugin is running
|
|
350
400
|
|
|
351
401
|
Options:
|
|
352
402
|
--port, -p <port> Plugin server port (default: 6109)
|
|
@@ -364,6 +414,7 @@ Examples:
|
|
|
364
414
|
npx aicq-chat-plugin # Install + start
|
|
365
415
|
aicq-plugin # Start on default port
|
|
366
416
|
aicq-plugin install # Install to OpenClaw only
|
|
417
|
+
aicq-plugin uninstall # Remove from OpenClaw
|
|
367
418
|
aicq-plugin --port 8080 # Start on port 8080
|
|
368
419
|
aicq-plugin -s http://localhost # Connect to local server
|
|
369
420
|
`);
|
|
@@ -407,6 +458,12 @@ if (command === 'install') {
|
|
|
407
458
|
process.exit(0);
|
|
408
459
|
}
|
|
409
460
|
|
|
461
|
+
// ── Uninstall ───────────────────────────────────────────────────────
|
|
462
|
+
if (command === 'uninstall' || command === 'remove') {
|
|
463
|
+
uninstallFromOpenClaw();
|
|
464
|
+
process.exit(0);
|
|
465
|
+
}
|
|
466
|
+
|
|
410
467
|
// ── Start (default) — auto-install then run ─────────────────────────
|
|
411
468
|
installToOpenClaw();
|
|
412
469
|
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -125,6 +125,14 @@ function findOpenClawWorkspace() {
|
|
|
125
125
|
current = path.dirname(current);
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
// If no existing skills/ found, fall back to the OpenClaw directory itself.
|
|
129
|
+
// This handles the case where ~/.openclaw/ exists but has no skills/ yet.
|
|
130
|
+
// We'll auto-create skills/ inside it during installation.
|
|
131
|
+
const openclawDir = findOpenClawDir();
|
|
132
|
+
if (openclawDir) {
|
|
133
|
+
return openclawDir;
|
|
134
|
+
}
|
|
135
|
+
|
|
128
136
|
return null;
|
|
129
137
|
}
|
|
130
138
|
|