UNPKG

ccgwz

Version:

Claude Code Git Worktree Zellij - CLI tool for parallel development with git worktrees and Claude Code in zellij panes

42 lines 1.61 kB
import inquirer from 'inquirer'; import { sanitizeBranchName, generateUniqueBranchName } from '../utils/validation.js'; export async function promptForBranches(paneCount, projectName, existingBranches = []) { const branches = []; const usedNames = [...existingBranches]; for (let i = 1; i <= paneCount; i++) { const { branchName } = await inquirer.prompt([ { type: 'input', name: 'branchName', message: `Enter branch name for pane ${i}:`, validate: (input) => { if (!input.trim()) { return 'Branch name cannot be empty'; } return true; }, }, ]); const sanitizedName = sanitizeBranchName(branchName); const uniqueName = generateUniqueBranchName(sanitizedName, usedNames); const worktreePath = `../${projectName}-${uniqueName}`; if (uniqueName !== sanitizedName) { console.log(`Branch name adjusted to avoid conflicts: ${uniqueName}`); } branches.push({ name: branchName, sanitizedName: uniqueName, worktreePath, }); usedNames.push(uniqueName); } return branches; } export function showPlannedWorktrees(branches) { console.log('\nPlanned worktrees:'); branches.forEach((branch, index) => { console.log(` ${index + 1}. ${branch.sanitizedName} -> ${branch.worktreePath}`); }); console.log(''); // 空行を追加 } //# sourceMappingURL=prompts.js.map