(dir?: string)
| 144 | * cronScheduler.start() to decide whether to auto-enable. One file read. |
| 145 | */ |
| 146 | export 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 |
no test coverage detected