MCPcopy Create free account
hub / github.com/WJX20/claude-code / linkSessionToPR

Function linkSessionToPR

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

Source from the content-addressed store, hash-verified

2704 * This stores the PR number, URL, and repository for tracking and navigation.
2705 */
2706export 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
2732export function getCurrentSessionTag(sessionId: UUID): string | undefined {
2733 // 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