Files
pikasTech-HWLAB/internal/tasktree/contracts.ts
T

73 lines
2.2 KiB
TypeScript

export type TaskStatus = "pending" | "in_progress" | "completed" | "blocked";
export type TaskKind = "task" | "subtask";
export type TaskGroup = {
id: string;
name: string;
description: string;
createdAt: string;
updatedAt: string;
};
export type TaskItem = {
id: string;
groupId: string;
parentId: string | null;
kind: TaskKind;
title: string;
description: string;
status: TaskStatus;
startAt: string | null;
dueAt: string | null;
sortOrder: number;
createdAt: string;
updatedAt: string;
};
export type Milestone = {
id: string;
groupId: string;
taskId: string | null;
title: string;
occursAt: string;
createdAt: string;
};
export type ExecutionReport = {
id: string;
taskId: string;
title: string;
body: string;
status: string;
createdAt: string;
};
export type Timeline = {
group: TaskGroup;
tasks: TaskItem[];
milestones: Milestone[];
reports: ExecutionReport[];
};
export type TaskTreeCommand =
| { operation: "health" }
| { operation: "group.list" }
| { operation: "group.get"; groupId: string }
| { operation: "group.create"; name: string; description?: string }
| { operation: "group.delete"; groupId: string }
| { operation: "task.create"; groupId: string; title: string; description?: string; startAt?: string; dueAt?: string; parentId?: string }
| { operation: "task.update"; taskId: string; title?: string; description?: string; status?: TaskStatus; startAt?: string | null; dueAt?: string | null }
| { operation: "task.delete"; taskId: string }
| { operation: "milestone.create"; groupId: string; title: string; occursAt: string; taskId?: string }
| { operation: "report.create"; taskId: string; title: string; body: string; status?: string }
| { operation: "mdtodo.import"; sourcePath: string; markdown: string; reports: Array<{ href: string; sourcePath: string; body: string }>; groupName?: string; dryRun?: boolean }
| { operation: "timeline.get"; groupId: string }
| { operation: "workflow.start"; taskId: string };
export type TaskTreeResult = {
ok: boolean;
operation: TaskTreeCommand["operation"];
data?: unknown;
error?: { code: string; message: string; detail?: unknown };
};