/**
* Agent Synch MCP Server - Shared Utilities
*/
/**
* Sanitize a string for use as a filename or folder name.
* Replaces non-alphanumeric characters (except hyphen and underscore) with underscore.
*/
export function sanitizeId(id: string): string {
return id.replace(/[^a-zA-Z0-9-_]/g, '_');
}
/**
* Generate a unique ID with prefix, timestamp, and random suffix.
* @param prefix - ID prefix (e.g., 'bug', 'evt')
* @returns Unique ID string in format: prefix_timestamp_random
*/
export function generateId(prefix: string): string {
return `${prefix}_${Date.now()}_${Math.random().toString(36).substring(2, 7)}`;
}