MCPcopy
hub / github.com/codeaashu/claude-code / getPRAttributionData

Function getPRAttributionData

src/utils/attribution.ts:185–211  ·  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

183 * Returns null if no attribution data is available.
184 */
185async function getPRAttributionData(
186 appState: AppState,
187): Promise<AttributionData | null> {
188 const attribution = appState.attribution
189
190 if (!attribution) {
191 return null
192 }
193
194 // Handle both Map and plain object (in case of serialization)
195 const fileStates = attribution.fileStates
196 const isMap = fileStates instanceof Map
197 const trackedFiles = isMap
198 ? Array.from(fileStates.keys())
199 : Object.keys(fileStates)
200
201 if (trackedFiles.length === 0) {
202 return null
203 }
204
205 try {
206 return await calculateCommitAttribution([attribution], trackedFiles)
207 } catch (error) {
208 logError(error as Error)
209 return null
210 }
211}
212
213const MEMORY_ACCESS_TOOL_NAMES = new Set([
214 FILE_READ_TOOL_NAME,

Callers 1

getEnhancedPRAttributionFunction · 0.85

Calls 3

keysMethod · 0.80
logErrorFunction · 0.70

Tested by

no test coverage detected