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

Function start

src/utils/cronScheduler.ts:463–498  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

461
462 return {
463 start() {
464 stopped = false
465 // Daemon path (dir explicitly given): don't touch bootstrap state —
466 // getScheduledTasksEnabled() would read a never-initialized flag. The
467 // daemon is asking to schedule; just enable.
468 if (dir !== undefined) {
469 logForDebugging(
470 `[ScheduledTasks] scheduler start() — dir=${dir}, hasTasks=${hasCronTasksSync(dir)}`,
471 )
472 void enable()
473 return
474 }
475 logForDebugging(
476 `[ScheduledTasks] scheduler start() — enabled=${getScheduledTasksEnabled()}, hasTasks=${hasCronTasksSync()}`,
477 )
478 // Auto-enable when scheduled_tasks.json has entries. CronCreateTool
479 // also sets this when a task is created mid-session.
480 if (
481 !getScheduledTasksEnabled() &&
482 (assistantMode || hasCronTasksSync())
483 ) {
484 setScheduledTasksEnabled(true)
485 }
486 if (getScheduledTasksEnabled()) {
487 void enable()
488 return
489 }
490 enablePoll = setInterval(
491 en => {
492 if (getScheduledTasksEnabled()) void en()
493 },
494 CHECK_INTERVAL_MS,
495 enable,
496 )
497 enablePoll.unref?.()
498 },
499 stop() {
500 stopped = true
501 if (enablePoll) {

Callers

nothing calls this directly

Calls 5

logForDebuggingFunction · 0.85
hasCronTasksSyncFunction · 0.85
enableFunction · 0.85
getScheduledTasksEnabledFunction · 0.85
setScheduledTasksEnabledFunction · 0.85

Tested by

no test coverage detected