MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / findAvailableTask

Function findAvailableTask

src/hooks/useTaskListWatcher.ts:197–208  ·  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

195 * - Not blocked by any unresolved tasks
196 */
197function findAvailableTask(tasks: Task[]): Task | undefined {
198 const unresolvedTaskIds = new Set(
199 tasks.filter(t => t.status !== 'completed').map(t => t.id),
200 )
201
202 return tasks.find(task => {
203 if (task.status !== 'pending') return false
204 if (task.owner) return false
205 // Check all blockers are completed
206 return task.blockedBy.every(id => !unresolvedTaskIds.has(id))
207 })
208}
209
210/**
211 * 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