takt/src/infra/task/schema.ts

40 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* Task YAML schema definition
*
* Zod schema for structured task files (.yaml/.yml)
*/
import { z } from 'zod/v4';
/**
* YAML task file schema
*
* Examples:
* task: "認証機能を追加する"
* worktree: true # 共有クローンで隔離実行
* branch: "feat/add-auth" # オプション(省略時は自動生成)
* piece: "default" # オプション省略時はcurrent piece
*
* worktree patterns (uses git clone --shared internally):
* - true: create shared clone in sibling dir or worktree_dir
* - "/path/to/dir": create at specified path
* - omitted: no isolation (run in cwd)
*
* branch patterns:
* - "feat/xxx": use specified branch name
* - omitted: auto-generate as takt/{timestamp}-{task-slug}
*/
export const TaskFileSchema = z.object({
task: z.string().min(1),
worktree: z.union([z.boolean(), z.string()]).optional(),
branch: z.string().optional(),
piece: z.string().optional(),
issue: z.number().int().positive().optional(),
start_movement: z.string().optional(),
retry_note: z.string().optional(),
/** Auto-create PR after worktree execution (default: prompt in interactive mode) */
auto_pr: z.boolean().optional(),
});
export type TaskFileData = z.infer<typeof TaskFileSchema>;