MCPcopy
hub / github.com/callumalpass/tasknotes / completeTask

Method completeTask

src/api/TaskNotesAPI.ts:1960–1985  ·  view source on GitHub ↗
(
		path: string,
		options?: CompleteTaskOptions,
		context?: TaskNotesMutationContext
	)

Source from the content-addressed store, hash-verified

1958 }
1959
1960 async completeTask(
1961 path: string,
1962 options?: CompleteTaskOptions,
1963 context?: TaskNotesMutationContext
1964 ): Promise<TaskInfo> {
1965 const task = await this.requireTask(path);
1966 const targetStatus =
1967 options?.status ?? this.plugin.statusManager.getCompletedStatuses()[0] ?? "done";
1968
1969 if (!this.plugin.statusManager.isCompletedStatus(targetStatus)) {
1970 throw new TaskNotesApiError(
1971 "invalid_status",
1972 `Status "${targetStatus}" is not configured as a completed status`,
1973 { status: 400, details: { status: targetStatus } }
1974 );
1975 }
1976
1977 if (!options?.status && this.plugin.statusManager.isCompletedStatus(task.status)) {
1978 return copyTaskInfo(task);
1979 }
1980
1981 const updatedTask = await this.withMutationContext([task.path], context, () =>
1982 this.plugin.taskService.updateProperty(task, "status", targetStatus)
1983 );
1984 return copyTaskInfo(updatedTask);
1985 }
1986
1987 async rescheduleTask(
1988 path: string,

Callers 1

TaskNotesAPIClass · 0.95

Calls 6

requireTaskMethod · 0.95
withMutationContextMethod · 0.95
copyTaskInfoFunction · 0.85
updatePropertyMethod · 0.80
getCompletedStatusesMethod · 0.65
isCompletedStatusMethod · 0.65

Tested by

no test coverage detected