(parentTitle: string, existingTitles: string[])
| 768 | * Scans existing titles in the same project to pick the next available number. |
| 769 | */ |
| 770 | export function generateForkTitle(parentTitle: string, existingTitles: string[]): string { |
| 771 | // Strip any existing " (N)" suffix from the parent title to get the base |
| 772 | const base = parentTitle.replace(/ \(\d+\)$/, ""); |
| 773 | const prefix = `${base} (`; |
| 774 | // If parent title itself exists in the list (without suffix), start at (1) |
| 775 | // Otherwise continue from the highest found suffix |
| 776 | return `${base} (${findMaxSequentialNumber(existingTitles, prefix, ")") + 1})`; |
| 777 | } |
| 778 | |
| 779 | async function copyIfExists(sourcePath: string, destinationPath: string): Promise<void> { |
| 780 | try { |
no test coverage detected