MCPcopy Create free account
hub / github.com/Noumena-Network/code / createFallbackTitle

Function createFallbackTitle

src/components/Feedback.tsx:478–502  ·  view source on GitHub ↗
(description: string)

Source from the content-addressed store, hash-verified

476 }
477}
478function createFallbackTitle(description: string): string {
479 // Create a safe fallback title based on the bug description
480
481 // Try to extract a meaningful title from the first line
482 const firstLine = description.split('\n')[0] || '';
483
484 // If the first line is very short, use it directly
485 if (firstLine.length <= 60 && firstLine.length > 5) {
486 return firstLine;
487 }
488
489 // For longer descriptions, create a truncated version
490 // Truncate at word boundaries when possible
491 let truncated = firstLine.slice(0, 60);
492 if (firstLine.length > 60) {
493 // Find the last space before the 60 char limit
494 const lastSpace = truncated.lastIndexOf(' ');
495 if (lastSpace > 30) {
496 // Only trim at word if we're not cutting too much
497 truncated = truncated.slice(0, lastSpace);
498 }
499 truncated += '...';
500 }
501 return truncated.length < 10 ? 'Bug Report' : truncated;
502}
503
504// Helper function to sanitize and log errors without exposing API keys
505function sanitizeAndLogError(err: unknown): void {

Callers 1

generateTitleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected