import { Result } from 'neverthrow'; import { WorkPlan } from '../../term/plan/work_plan.js'; import { PrTaskStatus } from '../../term/task/status.js'; /** * 語彙「タスク集約」 * domain type: aggregate * * Task単体に対するすべての変更操作を管理する集約 * - refinement: タスクのリファインメント * - progress: タスクの進捗更新 */ type RefineTaskCommand = { planId: string; taskId: string; updates: { title?: string; description?: string; acceptanceCriteria?: Array<{ scenario: string; given: string[]; when: string[]; then: string[]; }>; definitionOfReady?: string[]; dependencies?: string[]; }; }; type TaskRefinedEvent = { type: 'TaskRefined'; planId: string; taskId: string; previousStatus: PrTaskStatus; updates: RefineTaskCommand['updates']; refinedAt: Date; }; type RefinementError = { type: 'TaskNotFound'; taskId: string; } | { type: 'ValidationError'; message: string; }; type UpdateProgressCommand = { planId: string; taskId: string; criteriaUpdates: Array<{ id: string; completed: boolean; }>; }; type ProgressUpdatedEvent = { type: 'ProgressUpdated'; planId: string; taskId: string; previousStatus: PrTaskStatus; newStatus: PrTaskStatus; progress: { completed: number; total: number; percentage: number; }; updatedAt: Date; }; type ProgressUpdateError = { type: 'TaskNotFound'; taskId: string; } | { type: 'InvalidStatus'; message: string; } | { type: 'CriteriaNotFound'; message: string; } | { type: 'NotAssigned'; message: string; }; type RefineTaskInPlan = (plan: WorkPlan, command: RefineTaskCommand) => Result<{ event: TaskRefinedEvent; updatedPlan: WorkPlan; }, RefinementError>; type UpdateProgressInPlan = (plan: WorkPlan, command: UpdateProgressCommand) => Result<{ event: ProgressUpdatedEvent; updatedPlan: WorkPlan; }, ProgressUpdateError>; declare const RefinementError: { readonly taskNotFound: (taskId: string) => RefinementError; readonly validationError: (message: string) => RefinementError; readonly toString: (error: RefinementError) => string; }; declare const ProgressUpdateError: { readonly taskNotFound: (taskId: string) => ProgressUpdateError; readonly invalidStatus: (message: string) => ProgressUpdateError; readonly criteriaNotFound: (message: string) => ProgressUpdateError; readonly notAssigned: (message: string) => ProgressUpdateError; readonly toString: (error: ProgressUpdateError) => string; }; /** * @aggregate TaskAggregate: Task単体に対するすべての変更操作を管理 * @command refineTask: タスクをリファインメントする * @command updateProgress: タスクの進捗を更新する * @utility toRefinementErrorMessage: リファインメントエラーをユーザー向けメッセージに変換 * @utility toProgressErrorMessage: 進捗更新エラーをユーザー向けメッセージに変換 */ export declare const TaskAggregate: { readonly refineTask: RefineTaskInPlan; readonly updateProgress: UpdateProgressInPlan; readonly toRefinementErrorMessage: (error: RefinementError) => string; readonly toProgressErrorMessage: (error: ProgressUpdateError) => string; }; export type { RefineTaskCommand, TaskRefinedEvent, RefinementError, UpdateProgressCommand, ProgressUpdatedEvent, ProgressUpdateError }; //# sourceMappingURL=aggregate.d.ts.map