@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.
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/src/commands.ts +5 -15
- package/src/cron-manager.ts +8 -17
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
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 {
|
package/src/cron-manager.ts
CHANGED
|
@@ -100,34 +100,25 @@ export async function ensureCronJob(options: CronManagerOptions): Promise<void>
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
// If
|
|
104
|
-
if (existingJobs.length >
|
|
105
|
-
logger.
|
|
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
|
-
//
|
|
108
|
-
for (
|
|
109
|
-
const jobId =
|
|
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
|
|
115
|
+
logger.info(`[skills-scanner] ✅ Removed job: ${jobId}`);
|
|
116
116
|
} catch (removeErr: any) {
|
|
117
|
-
logger.warn(`[skills-scanner] ⚠️ Failed to remove
|
|
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
|