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