MCPcopy
hub / github.com/claude-code-best/claude-code / createTask

Function createTask

src/utils/tasks.ts:284–308  ·  view source on GitHub ↗
(
  taskListId: string,
  taskData: Omit<Task, 'id'>,
)

Source from the content-addressed store, hash-verified

282 * create tasks concurrently.
283 */
284export async function createTask(
285 taskListId: string,
286 taskData: Omit<Task, 'id'>,
287): Promise<string> {
288 const lockPath = await ensureTaskListLockFile(taskListId)
289
290 let release: (() => Promise<void>) | undefined
291 try {
292 // Acquire exclusive lock on the task list
293 release = await lockfile.lock(lockPath, LOCK_OPTIONS)
294
295 // Read highest ID from disk while holding the lock
296 const highestId = await findHighestTaskId(taskListId)
297 const id = String(highestId + 1)
298 const task: Task = { id, ...taskData }
299 const path = getTaskPath(taskListId, id)
300 await writeFile(path, jsonStringify(task, null, 2))
301 notifyTasksUpdated()
302 return id
303 } finally {
304 if (release) {
305 await release()
306 }
307 }
308}
309
310export async function getTask(
311 taskListId: string,

Callers 3

tasks.test.tsFile · 0.90
callFunction · 0.85
taskCreateHandlerFunction · 0.85

Calls 6

ensureTaskListLockFileFunction · 0.85
findHighestTaskIdFunction · 0.85
getTaskPathFunction · 0.85
jsonStringifyFunction · 0.85
notifyTasksUpdatedFunction · 0.85
releaseFunction · 0.50

Tested by

no test coverage detected