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

Function createTask

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

Source from the content-addressed store, hash-verified

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

Callers 1

callFunction · 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