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

Function initTaskOutputAsSymlink

src/utils/task/diskOutput.ts:427–451  ·  view source on GitHub ↗
(
  taskId: string,
  targetPath: string,
)

Source from the content-addressed store, hash-verified

425 * Tries to create the symlink first; if a file already exists, removes it and retries.
426 */
427export function initTaskOutputAsSymlink(
428 taskId: string,
429 targetPath: string,
430): Promise<string> {
431 return track(
432 (async () => {
433 try {
434 await ensureOutputDir()
435 const outputPath = getTaskOutputPath(taskId)
436
437 try {
438 await symlink(targetPath, outputPath)
439 } catch {
440 await unlink(outputPath)
441 await symlink(targetPath, outputPath)
442 }
443
444 return outputPath
445 } catch (error) {
446 logError(error)
447 return initTaskOutput(taskId)
448 }
449 })(),
450 )
451}
452

Callers 4

clearConversationFunction · 0.85
registerMainSessionTaskFunction · 0.85
registerAsyncAgentFunction · 0.85
registerAgentForegroundFunction · 0.85

Calls 6

trackFunction · 0.85
ensureOutputDirFunction · 0.85
getTaskOutputPathFunction · 0.85
unlinkFunction · 0.85
initTaskOutputFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected