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

Function getAttributionTexts

src/utils/attribution.ts:47–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45 * - Remote mode: returns session URL for attribution
46 */
47export function getAttributionTexts(): AttributionTexts {
48 if (process.env.USER_TYPE === 'ant' && isUndercover()) {
49 return { commit: '', pr: '' }
50 }
51
52 if (getClientType() === 'remote') {
53 const remoteSessionId = process.env.CLAUDE_CODE_REMOTE_SESSION_ID
54 if (remoteSessionId) {
55 const ingressUrl = process.env.SESSION_INGRESS_URL
56 // Skip for local dev - URLs won't persist
57 if (!isRemoteSessionLocal(remoteSessionId, ingressUrl)) {
58 const sessionUrl = getRemoteSessionUrl(remoteSessionId, ingressUrl)
59 return { commit: sessionUrl, pr: sessionUrl }
60 }
61 }
62 return { commit: '', pr: '' }
63 }
64
65 const modelName = getRealModelName()
66 const email = getAttributionEmail(modelName)
67 const defaultAttribution = `🤖 Generated with [Claude Code Best](${PRODUCT_URL})`
68 const defaultCommit = `Co-Authored-By: ${modelName} <${email}>`
69
70 const settings = getInitialSettings()
71
72 // New attribution setting takes precedence over deprecated includeCoAuthoredBy
73 if (settings.attribution) {
74 return {
75 commit: settings.attribution.commit ?? defaultCommit,
76 pr: settings.attribution.pr ?? defaultAttribution,
77 }
78 }
79
80 // Backward compatibility: deprecated includeCoAuthoredBy setting
81 if (settings.includeCoAuthoredBy === false) {
82 return { commit: '', pr: '' }
83 }
84
85 return { commit: defaultCommit, pr: defaultAttribution }
86}
87
88/**
89 * Check if a message content string is terminal output rather than a user prompt.

Callers 3

getPromptContentFunction · 0.85
getPromptContentFunction · 0.85

Calls 7

isUndercoverFunction · 0.85
getClientTypeFunction · 0.85
isRemoteSessionLocalFunction · 0.85
getRemoteSessionUrlFunction · 0.85
getRealModelNameFunction · 0.85
getAttributionEmailFunction · 0.85
getInitialSettingsFunction · 0.50

Tested by

no test coverage detected