@karmaniverous/jeeves-watcher-openclaw 0.5.5 → 0.5.6
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 +52 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -199,10 +199,62 @@ function uninstall() {
|
|
|
199
199
|
writeJson(configPath, config);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
|
+
// Clean up TOOLS.md watcher section
|
|
203
|
+
cleanupToolsMd(home, configPath);
|
|
202
204
|
console.log();
|
|
203
205
|
console.log('✅ Plugin uninstalled successfully.');
|
|
204
206
|
console.log(' Restart the OpenClaw gateway to complete removal.');
|
|
205
207
|
}
|
|
208
|
+
/** Resolve the workspace directory from OpenClaw config. */
|
|
209
|
+
function resolveWorkspaceDir(home, configPath) {
|
|
210
|
+
const config = readJson(configPath);
|
|
211
|
+
if (!config)
|
|
212
|
+
return null;
|
|
213
|
+
// Check agents.defaults.workspace
|
|
214
|
+
const agents = config.agents;
|
|
215
|
+
const defaults = agents?.defaults;
|
|
216
|
+
const workspace = defaults?.workspace;
|
|
217
|
+
if (workspace) {
|
|
218
|
+
return resolve(workspace.replace(/^~/, homedir()));
|
|
219
|
+
}
|
|
220
|
+
// Default workspace location
|
|
221
|
+
return join(home, 'workspace');
|
|
222
|
+
}
|
|
223
|
+
/** Remove the ## Watcher section from TOOLS.md on uninstall. */
|
|
224
|
+
function cleanupToolsMd(home, configPath) {
|
|
225
|
+
const workspaceDir = resolveWorkspaceDir(home, configPath);
|
|
226
|
+
if (!workspaceDir)
|
|
227
|
+
return;
|
|
228
|
+
const toolsPath = join(workspaceDir, 'TOOLS.md');
|
|
229
|
+
if (!existsSync(toolsPath))
|
|
230
|
+
return;
|
|
231
|
+
let content = readFileSync(toolsPath, 'utf8');
|
|
232
|
+
// Remove ## Watcher section (from ## Watcher to next ## or # or EOF)
|
|
233
|
+
const watcherRe = /^## Watcher\n[\s\S]*?(?=\n## |\n# |$(?![\s\S]))/m;
|
|
234
|
+
if (!watcherRe.test(content))
|
|
235
|
+
return;
|
|
236
|
+
content = content.replace(watcherRe, '').replace(/\n{3,}/g, '\n\n');
|
|
237
|
+
// If # Jeeves Platform Tools has no remaining ## sections, remove it too
|
|
238
|
+
const platformH1 = '# Jeeves Platform Tools';
|
|
239
|
+
if (content.includes(platformH1)) {
|
|
240
|
+
const h1Idx = content.indexOf(platformH1);
|
|
241
|
+
const afterH1 = content.slice(h1Idx + platformH1.length);
|
|
242
|
+
// Check if there's a ## before the next # or EOF
|
|
243
|
+
const nextH2Match = afterH1.match(/^## /m);
|
|
244
|
+
const nextH1Match = afterH1.match(/^# /m);
|
|
245
|
+
const h2Pos = nextH2Match ? afterH1.indexOf(nextH2Match[0]) : Infinity;
|
|
246
|
+
const h1Pos = nextH1Match ? afterH1.indexOf(nextH1Match[0]) : Infinity;
|
|
247
|
+
if (h2Pos >= h1Pos) {
|
|
248
|
+
// No child ## sections remain — remove the empty H1
|
|
249
|
+
content =
|
|
250
|
+
content.slice(0, h1Idx) + content.slice(h1Idx + platformH1.length);
|
|
251
|
+
content = content.replace(/^\n{2,}/, '').replace(/\n{3,}/g, '\n\n');
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
content = content.trim() + '\n';
|
|
255
|
+
writeFileSync(toolsPath, content);
|
|
256
|
+
console.log('\u2713 Cleaned up TOOLS.md (removed Watcher section)');
|
|
257
|
+
}
|
|
206
258
|
// Main
|
|
207
259
|
const command = process.argv[2];
|
|
208
260
|
switch (command) {
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "jeeves-watcher-openclaw",
|
|
3
3
|
"name": "Jeeves Watcher",
|
|
4
4
|
"description": "Semantic search, metadata enrichment, and instance administration for a jeeves-watcher deployment.",
|
|
5
|
-
"version": "0.5.
|
|
5
|
+
"version": "0.5.6",
|
|
6
6
|
"skills": [
|
|
7
7
|
"dist/skills/jeeves-watcher"
|
|
8
8
|
],
|
package/package.json
CHANGED