MCPcopy
hub / github.com/claude-code-best/claude-code / linkSessionToPR

Function linkSessionToPR

src/utils/sessionStorage.ts:2786–2810  ·  view source on GitHub ↗
(
  sessionId: UUID,
  prNumber: number,
  prUrl: string,
  prRepository: string,
  fullPath?: string,
)

Source from the content-addressed store, hash-verified

2784 * This stores the PR number, URL, and repository for tracking and navigation.
2785 */
2786export 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
2812export function getCurrentSessionTag(sessionId: UUID): string | undefined {
2813 // Only returns tag for current session (the only one we cache)

Callers 1

trackGitOperationsFunction · 0.85

Calls 5

appendEntryToFileFunction · 0.85
getSessionIdFunction · 0.85
getProjectFunction · 0.85
logEventFunction · 0.85

Tested by

no test coverage detected