MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / getPRAttributionData

Function getPRAttributionData

src/utils/attribution.ts:173–199  ·  view source on GitHub ↗

* Get full attribution data from the provided AppState's attribution state. * Uses ALL tracked files from the attribution state (not just staged files) * because for PR attribution, files may not be staged yet. * Returns null if no attribution data is available.

(
  appState: AppState,
)

Source from the content-addressed store, hash-verified

171 * Returns null if no attribution data is available.
172 */
173async function getPRAttributionData(
174 appState: AppState,
175): Promise<AttributionData | null> {
176 const attribution = appState.attribution
177
178 if (!attribution) {
179 return null
180 }
181
182 // Handle both Map and plain object (in case of serialization)
183 const fileStates = attribution.fileStates
184 const isMap = fileStates instanceof Map
185 const trackedFiles = isMap
186 ? Array.from(fileStates.keys())
187 : Object.keys(fileStates)
188
189 if (trackedFiles.length === 0) {
190 return null
191 }
192
193 try {
194 return await calculateCommitAttribution([attribution], trackedFiles)
195 } catch (error) {
196 logError(error as Error)
197 return null
198 }
199}
200
201const MEMORY_ACCESS_TOOL_NAMES = new Set([
202 FILE_READ_TOOL_NAME,

Callers 1

getEnhancedPRAttributionFunction · 0.85

Calls 3

logErrorFunction · 0.70
keysMethod · 0.65

Tested by

no test coverage detected