MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / writeCronTasks

Function writeCronTasks

source code/utils/cronTasks.ts:167–184  ·  view source on GitHub ↗
(
  tasks: CronTask[],
  dir?: string,
)

Source from the content-addressed store, hash-verified

165 * the file watcher sees a change event on last-task-removed.
166 */
167export async function writeCronTasks(
168 tasks: CronTask[],
169 dir?: string,
170): Promise<void> {
171 const root = dir ?? getProjectRoot()
172 await mkdir(join(root, '.claude'), { recursive: true })
173 // Strip the runtime-only `durable` flag — everything on disk is durable
174 // by definition, and keeping the flag out means readCronTasks() naturally
175 // yields durable: undefined without having to set it explicitly.
176 const body: CronFile = {
177 tasks: tasks.map(({ durable: _durable, ...rest }) => rest),
178 }
179 await writeFile(
180 getCronFilePath(root),
181 jsonStringify(body, null, 2) + '\n',
182 'utf-8',
183 )
184}
185
186/**
187 * Append a task. Returns the generated id. Caller is responsible for having

Callers 3

addCronTaskFunction · 0.85
removeCronTasksFunction · 0.85
markCronTasksFiredFunction · 0.85

Calls 4

getProjectRootFunction · 0.85
mkdirFunction · 0.85
getCronFilePathFunction · 0.85
jsonStringifyFunction · 0.85

Tested by

no test coverage detected