MCPcopy
hub / github.com/coder/mux / generateForkTitle

Function generateForkTitle

src/node/services/workspaceService.ts:770–777  ·  view source on GitHub ↗
(parentTitle: string, existingTitles: string[])

Source from the content-addressed store, hash-verified

768 * Scans existing titles in the same project to pick the next available number.
769 */
770export 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
779async function copyIfExists(sourcePath: string, destinationPath: string): Promise<void> {
780 try {

Callers 2

forkMethod · 0.85

Calls 1

findMaxSequentialNumberFunction · 0.85

Tested by

no test coverage detected