MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / addDependency

Method addDependency

src/api/TaskNotesAPI.ts:2155–2173  ·  view source on GitHub ↗
(
		path: string,
		dependency: TaskDependency,
		context?: TaskNotesMutationContext
	)

Source from the content-addressed store, hash-verified

2153 }
2154
2155 private async addDependency(
2156 path: string,
2157 dependency: TaskDependency,
2158 context?: TaskNotesMutationContext
2159 ): Promise<TaskInfo> {
2160 const task = await this.requireTask(path);
2161 const dependencies = task.blockedBy ?? [];
2162 const existingIndex = dependencies.findIndex(
2163 (candidate) => candidate.uid === dependency.uid
2164 );
2165 const nextDependencies =
2166 existingIndex >= 0
2167 ? dependencies.map((candidate, index) =>
2168 index === existingIndex ? { ...dependency } : { ...candidate }
2169 )
2170 : [...dependencies.map((candidate) => ({ ...candidate })), { ...dependency }];
2171
2172 return this.updateTask(task.path, { blockedBy: nextDependencies }, context);
2173 }
2174
2175 private async removeDependency(
2176 path: string,

Callers 1

TaskNotesAPIClass · 0.95

Calls 2

requireTaskMethod · 0.95
updateTaskMethod · 0.95

Tested by

no test coverage detected