MCPcopy Index your code
hub / github.com/codeaashu/claude-code / writeCronTasks

Function writeCronTasks

src/utils/cronTasks.ts:165–182  ·  view source on GitHub ↗
(
  tasks: CronTask[],
  dir?: string,
)

Source from the content-addressed store, hash-verified

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