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

Function findAvailableTask

source code/hooks/useTaskListWatcher.ts:199–210  ·  view source on GitHub ↗

* Find an available task that can be worked on: * - Status is 'pending' * - No owner assigned * - Not blocked by any unresolved tasks

(tasks: Task[])

Source from the content-addressed store, hash-verified

197 * - Not blocked by any unresolved tasks
198 */
199function findAvailableTask(tasks: Task[]): Task | undefined {
200 const unresolvedTaskIds = new Set(
201 tasks.filter(t => t.status !== 'completed').map(t => t.id),
202 )
203
204 return tasks.find(task => {
205 if (task.status !== 'pending') return false
206 if (task.owner) return false
207 // Check all blockers are completed
208 return task.blockedBy.every(id => !unresolvedTaskIds.has(id))
209 })
210}
211
212/**
213 * Format a task as a prompt for Claude to work on.

Callers 1

useTaskListWatcherFunction · 0.70

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected