MCPcopy Create free account
hub / github.com/codeaashu/claude-code / stateToSnapshotMessage

Function stateToSnapshotMessage

src/utils/commitAttribution.ts:872–894  ·  view source on GitHub ↗
(
  state: AttributionState,
  messageId: UUID,
)

Source from the content-addressed store, hash-verified

870 * Convert attribution state to snapshot message for persistence.
871 */
872export function stateToSnapshotMessage(
873 state: AttributionState,
874 messageId: UUID,
875): AttributionSnapshotMessage {
876 const fileStates: Record<string, FileAttributionState> = {}
877
878 for (const [path, fileState] of state.fileStates) {
879 fileStates[path] = fileState
880 }
881
882 return {
883 type: 'attribution-snapshot',
884 messageId,
885 surface: state.surface,
886 fileStates,
887 promptCount: state.promptCount,
888 promptCountAtLastCommit: state.promptCountAtLastCommit,
889 permissionPromptCount: state.permissionPromptCount,
890 permissionPromptCountAtLastCommit: state.permissionPromptCountAtLastCommit,
891 escapeCount: state.escapeCount,
892 escapeCountAtLastCommit: state.escapeCountAtLastCommit,
893 }
894}
895
896/**
897 * Restore attribution state from snapshot messages.

Callers 1

incrementPromptCountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected