@pwddd/skills-scanner 1.0.0-beta.6 → 1.0.0-beta.8

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.
@@ -2,7 +2,7 @@
2
2
  "id": "skills-scanner",
3
3
  "name": "Skills Scanner",
4
4
  "description": "Security scanner for OpenClaw Skills to detect potential threats",
5
- "version": "1.0.0-beta.6",
5
+ "version": "1.0.0-beta.8",
6
6
  "author": "pwddd",
7
7
  "skills": ["./skills"],
8
8
  "uiHints": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pwddd/skills-scanner",
3
- "version": "1.0.0-beta.6",
3
+ "version": "1.0.0-beta.8",
4
4
  "description": "OpenClaw Skills security scanner plugin - detect malicious code, data exfiltration, and prompt injection",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
package/src/commands.ts CHANGED
@@ -232,22 +232,12 @@ export function createCommandHandlers(
232
232
  ].join("\n"),
233
233
  };
234
234
  } else if (action === "unregister" || action === "remove") {
235
+ await cleanupCronJob({
236
+ logger,
237
+ config: apiConfig,
238
+ });
235
239
  return {
236
- text: [
237
- "✅ *删除定时任务*",
238
- "",
239
- "定时任务会在插件卸载时自动清理。",
240
- "",
241
- "如需手动删除,请使用 CLI 命令:",
242
- "",
243
- "```bash",
244
- "# 1. 查找任务 ID",
245
- "openclaw cron list | grep skills-scanner",
246
- "",
247
- "# 2. 删除任务",
248
- "openclaw cron remove skills-scanner:weekly-report",
249
- "```",
250
- ].join("\n"),
240
+ text: "✅ 定时任务删除完成,请运行 `openclaw cron list` 查看结果",
251
241
  };
252
242
  } else if (action === "trigger" || action === "run") {
253
243
  return {
@@ -100,34 +100,25 @@ export async function ensureCronJob(options: CronManagerOptions): Promise<void>
100
100
  }
101
101
  }
102
102
 
103
- // If multiple jobs exist with the same name, remove duplicates
104
- if (existingJobs.length > 1) {
105
- logger.warn(`[skills-scanner] ⚠️ Found ${existingJobs.length} duplicate jobs, cleaning up...`);
103
+ // If any jobs exist, remove ALL of them and create a fresh one
104
+ if (existingJobs.length > 0) {
105
+ logger.info(`[skills-scanner] Found ${existingJobs.length} existing job(s), cleaning up...`);
106
106
 
107
- // Keep the first one, remove the rest
108
- for (let i = 1; i < existingJobs.length; i++) {
109
- const jobId = existingJobs[i].id;
107
+ // Remove all existing jobs
108
+ for (const job of existingJobs) {
109
+ const jobId = job.id;
110
110
  try {
111
111
  execSync(`${openclawCmd} cron remove ${jobId}`, {
112
112
  encoding: "utf-8",
113
113
  timeout: 5000,
114
114
  });
115
- logger.info(`[skills-scanner] ✅ Removed duplicate job: ${jobId}`);
115
+ logger.info(`[skills-scanner] ✅ Removed job: ${jobId}`);
116
116
  } catch (removeErr: any) {
117
- logger.warn(`[skills-scanner] ⚠️ Failed to remove duplicate job ${jobId}: ${removeErr.message}`);
117
+ logger.warn(`[skills-scanner] ⚠️ Failed to remove job ${jobId}: ${removeErr.message}`);
118
118
  }
119
119
  }
120
120
  }
121
121
 
122
- // Check if we have an existing job (after cleanup)
123
- const existingJob = existingJobs.length > 0 ? existingJobs[0] : null;
124
-
125
- if (existingJob) {
126
- const jobId = existingJob.id;
127
- logger.info(`[skills-scanner] ✅ Job already exists: ${jobId}`);
128
- return;
129
- }
130
-
131
122
  logger.info("[skills-scanner] 📝 Creating cron job via CLI...");
132
123
 
133
124
  // Create cron job with --announce and --channel last