( sessionId: UUID, prNumber: number, prUrl: string, prRepository: string, fullPath?: string, )
| 2784 | * This stores the PR number, URL, and repository for tracking and navigation. |
| 2785 | */ |
| 2786 | export async function linkSessionToPR( |
| 2787 | sessionId: UUID, |
| 2788 | prNumber: number, |
| 2789 | prUrl: string, |
| 2790 | prRepository: string, |
| 2791 | fullPath?: string, |
| 2792 | ): Promise<void> { |
| 2793 | const resolvedPath = fullPath ?? getTranscriptPathForSession(sessionId) |
| 2794 | appendEntryToFile(resolvedPath, { |
| 2795 | type: 'pr-link', |
| 2796 | sessionId, |
| 2797 | prNumber, |
| 2798 | prUrl, |
| 2799 | prRepository, |
| 2800 | timestamp: new Date().toISOString(), |
| 2801 | }) |
| 2802 | // Cache for current session so reAppendSessionMetadata can re-write after compaction |
| 2803 | if (sessionId === getSessionId()) { |
| 2804 | const project = getProject() |
| 2805 | project.currentSessionPrNumber = prNumber |
| 2806 | project.currentSessionPrUrl = prUrl |
| 2807 | project.currentSessionPrRepository = prRepository |
| 2808 | } |
| 2809 | logEvent('tengu_session_linked_to_pr', { prNumber }) |
| 2810 | } |
| 2811 | |
| 2812 | export function getCurrentSessionTag(sessionId: UUID): string | undefined { |
| 2813 | // Only returns tag for current session (the only one we cache) |
no test coverage detected