- Remove task CRUD/epic/search/relation/version tools (moved to Jira) - Add migration scripts: migrate-tasks-to-jira, jira-admin, prepare-all-projects - Add consolidate-projects.ts for merging duplicate Jira projects - Add validate-migration.ts for post-migration integrity checks - Add jira_issue_key columns migration (030) - Consolidate 11 duplicate projects (LIT→LITE, CARD→CS, etc.) - Delete 92 placeholder issues, 11 empty source projects - Remove SG project completely - 2,798 tasks migrated across 46 Jira projects Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
764 B
TypeScript
27 lines
764 B
TypeScript
/**
|
|
* Shared utility: get current session ID from environment or cache file.
|
|
* Extracted from crud.ts during task-mcp → session-mcp fork (CF-762).
|
|
*/
|
|
|
|
import * as fs from 'fs';
|
|
import * as path from 'path';
|
|
import * as os from 'os';
|
|
|
|
export function getSessionId(): string {
|
|
if (process.env.CLAUDE_SESSION_ID) {
|
|
return process.env.CLAUDE_SESSION_ID;
|
|
}
|
|
|
|
const cacheFile = path.join(os.homedir(), '.cache', 'session-memory', 'current_session');
|
|
try {
|
|
const sessionId = fs.readFileSync(cacheFile, 'utf-8').trim();
|
|
if (sessionId) return sessionId;
|
|
} catch {
|
|
// File doesn't exist or can't be read
|
|
}
|
|
|
|
const now = new Date();
|
|
const timestamp = now.toISOString().replace(/[-:T]/g, '').slice(0, 15);
|
|
return `session_${timestamp}`;
|
|
}
|