@boundless-oss/atlas
Version:
Atlas - MCP Server for comprehensive startup project management
69 lines (54 loc) • 1.83 kB
text/typescript
import { Server as SocketIOServer } from 'socket.io';
let io: SocketIOServer | null = null;
export function setSocketIOInstance(socketIO: SocketIOServer): void {
io = socketIO;
}
export function emitDatabaseChange(event: string, data: any): void {
if (!io) {
console.warn('Socket.IO instance not set, skipping event emission');
return;
}
io.emit(event, {
...data,
timestamp: new Date().toISOString()
});
console.error(`📡 Emitted database change event: ${event}`);
}
// Agile events
export function emitSprintCreated(sprint: any): void {
emitDatabaseChange('sprint_created', { sprint });
}
export function emitSprintUpdated(sprintId: string, updates: any): void {
emitDatabaseChange('sprint_updated', { sprintId, updates });
}
export function emitStoryCreated(story: any): void {
emitDatabaseChange('story_created', { story });
}
export function emitStoryUpdated(storyId: string, updates: any): void {
emitDatabaseChange('story_updated', { storyId, updates });
}
export function emitStoryMoved(storyId: string, fromStatus: string, toStatus: string): void {
emitDatabaseChange('story_moved', {
storyId,
fromColumn: fromStatus,
toColumn: toStatus
});
}
export function emitEpicCreated(epic: any): void {
emitDatabaseChange('epic_created', { epic });
}
export function emitEpicUpdated(epicId: string, updates: any): void {
emitDatabaseChange('epic_updated', { epicId, updates });
}
// Performance events
export function emitPerformanceUpdate(metrics: any): void {
emitDatabaseChange('performance_update', { metrics });
}
// Security events
export function emitSecurityUpdate(data: any): void {
emitDatabaseChange('security_update', data);
}
// Error events
export function emitErrorUpdate(data: any): void {
emitDatabaseChange('errors_update', data);
}