UNPKG

@pimzino/spec-workflow-mcp

Version:

MCP server for spec-driven development workflow with real-time web dashboard

37 lines 1.27 kB
import { join } from 'path'; import { promises as fs } from 'fs'; import { ensureDirectoryExists } from './path-utils.js'; export class SessionManager { projectPath; sessionFilePath; constructor(projectPath) { this.projectPath = projectPath; this.sessionFilePath = join(projectPath, '.spec-workflow', 'session.json'); } async createSession(dashboardUrl) { const sessionData = { dashboardUrl, startedAt: new Date().toISOString(), pid: process.pid }; // Ensure .spec-workflow directory exists await ensureDirectoryExists(join(this.projectPath, '.spec-workflow')); // Write session.json await fs.writeFile(this.sessionFilePath, JSON.stringify(sessionData, null, 2), 'utf-8'); } async getSession() { try { const sessionContent = await fs.readFile(this.sessionFilePath, 'utf-8'); return JSON.parse(sessionContent); } catch (error) { // Session file doesn't exist or is invalid return null; } } async getDashboardUrl() { const session = await this.getSession(); return session?.dashboardUrl; } } //# sourceMappingURL=session-manager.js.map