MCPcopy Create free account
hub / github.com/Noumena-Network/code / getPRAttributionData

Function getPRAttributionData

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

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

Callers 1

getEnhancedPRAttributionFunction · 0.85

Calls 3

keysMethod · 0.80
logErrorFunction · 0.70

Tested by

no test coverage detected