takt/src/task/schema.ts
2026-01-27 20:07:47 +09:00

35 lines
1.0 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 # .takt/worktrees/{timestamp}-{task-slug}/ に作成
* branch: "feat/add-auth" # オプション(省略時は自動生成)
* workflow: "default" # オプション省略時はcurrent workflow
*
* worktree patterns:
* - true: create at .takt/worktrees/{timestamp}-{task-slug}/
* - "/path/to/dir": create at specified path
* - omitted: no worktree (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(),
workflow: z.string().optional(),
});
export type TaskFileData = z.infer<typeof TaskFileSchema>;