( sessionId: UUID, prNumber: number, prUrl: string, prRepository: string, fullPath?: string, )
| 2704 | * This stores the PR number, URL, and repository for tracking and navigation. |
| 2705 | */ |
| 2706 | export async function linkSessionToPR( |
| 2707 | sessionId: UUID, |
| 2708 | prNumber: number, |
| 2709 | prUrl: string, |
| 2710 | prRepository: string, |
| 2711 | fullPath?: string, |
| 2712 | ): Promise<void> { |
| 2713 | const resolvedPath = fullPath ?? getTranscriptPathForSession(sessionId) |
| 2714 | appendEntryToFile(resolvedPath, { |
| 2715 | type: 'pr-link', |
| 2716 | sessionId, |
| 2717 | prNumber, |
| 2718 | prUrl, |
| 2719 | prRepository, |
| 2720 | timestamp: new Date().toISOString(), |
| 2721 | }) |
| 2722 | // Cache for current session so reAppendSessionMetadata can re-write after compaction |
| 2723 | if (sessionId === getSessionId()) { |
| 2724 | const project = getProject() |
| 2725 | project.currentSessionPrNumber = prNumber |
| 2726 | project.currentSessionPrUrl = prUrl |
| 2727 | project.currentSessionPrRepository = prRepository |
| 2728 | } |
| 2729 | logEvent('tengu_session_linked_to_pr', { prNumber }) |
| 2730 | } |
| 2731 | |
| 2732 | export function getCurrentSessionTag(sessionId: UUID): string | undefined { |
| 2733 | // Only returns tag for current session (the only one we cache) |
no test coverage detected