MCPcopy
hub / github.com/codeaashu/claude-code / hasCronTasksSync

Function hasCronTasksSync

src/utils/cronTasks.ts:146–158  ·  view source on GitHub ↗
(dir?: string)

Source from the content-addressed store, hash-verified

144 * cronScheduler.start() to decide whether to auto-enable. One file read.
145 */
146export function hasCronTasksSync(dir?: string): boolean {
147 let raw: string
148 try {
149 // eslint-disable-next-line custom-rules/no-sync-fs -- called once from cronScheduler.start()
150 raw = readFileSync(getCronFilePath(dir), 'utf-8')
151 } catch {
152 return false
153 }
154 const parsed = safeParseJSON(raw, false)
155 if (!parsed || typeof parsed !== 'object') return false
156 const tasks = (parsed as Partial<CronFile>).tasks
157 return Array.isArray(tasks) && tasks.length > 0
158}
159
160/**
161 * Overwrite .claude/scheduled_tasks.json with the given tasks. Creates .claude/ if

Callers 1

startFunction · 0.85

Calls 2

readFileSyncFunction · 0.90
getCronFilePathFunction · 0.85

Tested by

no test coverage detected