Merge pull request #350 from tomohisa/fix/worktree-dir-plural

fix: use plural 'takt-worktrees' as default clone directory name
This commit is contained in:
nrs 2026-02-22 17:41:21 +09:00 committed by GitHub
commit 134b666480
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,7 +33,10 @@ export class CloneManager {
/**
* Resolve the base directory for clones from global config.
* Returns the configured worktree_dir (resolved to absolute), or ../
* Returns the configured worktree_dir (resolved to absolute), or
* the default 'takt-worktrees' (plural). Automatically migrates
* legacy 'takt-worktree' (singular) to 'takt-worktrees' if only
* the legacy directory exists.
*/
private static resolveCloneBaseDir(projectDir: string): string {
const worktreeDir = resolveConfigValue(projectDir, 'worktreeDir');
@ -42,7 +45,13 @@ export class CloneManager {
? worktreeDir
: path.resolve(projectDir, worktreeDir);
}
return path.join(projectDir, '..', 'takt-worktree');
const newDir = path.join(projectDir, '..', 'takt-worktrees');
const legacyDir = path.join(projectDir, '..', 'takt-worktree');
// Auto-migrate: rename legacy singular to plural
if (fs.existsSync(legacyDir) && !fs.existsSync(newDir)) {
fs.renameSync(legacyDir, newDir);
}
return newDir;
}
/** Resolve the clone path based on options and global config */