* fix: mark task as failed when PR creation fails
Previously, when PR creation failed (e.g. invalid base branch),
the task was still marked as 'completed' even though the PR was
not created. This fix ensures:
- postExecutionFlow returns prFailed/prError on failure
- executeAndCompleteTask marks the task as failed when PR fails
- selectAndExecuteTask runs postExecution before persisting result
The pipeline path (executePipeline) already handled this correctly
via EXIT_PR_CREATION_FAILED.
* fix: use detectDefaultBranch instead of getCurrentBranch for PR base
Previously, baseBranch for PR creation was set to HEAD's current branch
via getCurrentBranch(). When the user was on a feature branch like
'codex/pr-16-review', PRs were created with --base codex/pr-16-review,
which fails because it doesn't exist on the remote.
Now uses detectDefaultBranch() (via git symbolic-ref refs/remotes/origin/HEAD)
to always use the actual default branch (main/master) as the PR base.
Affected paths:
- resolveTask.ts (takt run)
- selectAndExecute.ts (interactive mode)
- pipeline/execute.ts (takt pipeline)
- Add orchestration function guidance to 'Keep Abstraction Levels Consistent'
section in coding policy (ja/en) — no #### nesting, integrated as paragraph
- Criterion: whether branch belongs at the function's abstraction level
- Concrete bad/good examples using pipeline pattern
- Add 1-line behavioral guideline to architecture-reviewer persona (ja/en)
- ja: 関数の責務より低い粒度の分岐が混入していたら見逃さない
- en: Do not overlook branches below a function's responsibility level
Pipeline mode previously ignored the --create-worktree option.
Now when --create-worktree yes is specified with --pipeline,
a worktree is created and the agent executes in the isolated directory.
- Add createWorktree field to PipelineExecutionOptions
- Pass createWorktreeOverride from routing to executePipeline
- Use confirmAndCreateWorktree when createWorktree is true
- Execute task in worktree directory (execCwd) instead of project cwd
Replace the always-on syncDefaultBranch with opt-in resolveBaseBranch:
- Add auto_fetch config (default: false) — only fetch when enabled
- Add base_branch config (project and global) — fallback to current branch
- Fetch-only mode: git fetch origin without modifying local branches
- Use fetched commit hash (origin/<base_branch>) to reset clone to latest
- No more git merge --ff-only or git fetch origin main:main
Config example:
# ~/.takt/config.yaml or .takt/config.yaml
auto_fetch: true
base_branch: develop
Addresses review feedback: opt-in behavior, no local branch changes,
configurable base branch with current-branch fallback.
The default clone base directory was 'takt-worktree' (singular), which is
inconsistent since multiple worktrees are created inside it.
Changed to 'takt-worktrees' (plural) while maintaining backward compatibility:
- If existing 'takt-worktree' directory exists, continue using it
- New installations will use 'takt-worktrees'
- Explicit worktree_dir config always takes priority