reconcileRecipeCronJobs (cron.ts)

ClawRecipes · automation

Reconciles recipe cron jobs, syncs schedules with templates, cleans up orphans.

import path from "node:path";
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import type { RecipeFrontmatter } from "../lib/recipe-frontmatter";
import { cronKey, hashSpec, loadCronMappingState } from "../lib/cron-utils";
import { writeJsonFile } from "../lib/json-utils";
import { promptYesNo } from "../lib/prompt";
import { normalizeCronJobs } from "../lib/recipe-frontmatter";

export type CronInstallMode = "off" | "prompt" | "on";

function interpolateTemplate(input: string | undefined, vars: Record<string, string>): string | undefined {
  if (input == null) return undefined;
  let out = String(input);
  for (const [k, v] of Object.entries(vars)) {
    out = out.replaceAll(`{{${k}}}`, v);
  }
  return out;
}

function applyCronJobVars(
  scope: CronReconcileScope,
  j: { i

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key