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

Function getAttributionTexts

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

Source from the content-addressed store, hash-verified

50 * - Remote mode: returns session URL for attribution
51 */
52export function getAttributionTexts(): AttributionTexts {
53 if (process.env.USER_TYPE === 'ant' && isUndercover()) {
54 return { commit: '', pr: '' }
55 }
56
57 if (getClientType() === 'remote') {
58 const remoteSessionId = process.env.CLAUDE_CODE_REMOTE_SESSION_ID
59 if (remoteSessionId) {
60 const ingressUrl = process.env.SESSION_INGRESS_URL
61 // Skip for local dev - URLs won't persist
62 if (!isRemoteSessionLocal(remoteSessionId, ingressUrl)) {
63 const sessionUrl = getRemoteSessionUrl(remoteSessionId, ingressUrl)
64 return { commit: sessionUrl, pr: sessionUrl }
65 }
66 }
67 return { commit: '', pr: '' }
68 }
69
70 // @[MODEL LAUNCH]: Update the hardcoded fallback model name below (guards against codename leaks).
71 // For internal repos, use the real model name. For external repos,
72 // fall back to "Claude Opus 4.6" for unrecognized models to avoid leaking codenames.
73 const model = getMainLoopModel()
74 const isKnownPublicModel = getPublicModelDisplayName(model) !== null
75 const modelName =
76 isInternalModelRepoCached() || isKnownPublicModel
77 ? getPublicModelName(model)
78 : 'Claude Opus 4.6'
79 const defaultAttribution = `🤖 Generated with [Claude Code](${PRODUCT_URL})`
80 const defaultCommit = `Co-Authored-By: ${modelName} <noreply@anthropic.com>`
81
82 const settings = getInitialSettings()
83
84 // New attribution setting takes precedence over deprecated includeCoAuthoredBy
85 if (settings.attribution) {
86 return {
87 commit: settings.attribution.commit ?? defaultCommit,
88 pr: settings.attribution.pr ?? defaultAttribution,
89 }
90 }
91
92 // Backward compatibility: deprecated includeCoAuthoredBy setting
93 if (settings.includeCoAuthoredBy === false) {
94 return { commit: '', pr: '' }
95 }
96
97 return { commit: defaultCommit, pr: defaultAttribution }
98}
99
100/**
101 * Check if a message content string is terminal output rather than a user prompt.

Callers 3

getPromptContentFunction · 0.85
getPromptContentFunction · 0.85

Calls 9

isUndercoverFunction · 0.85
getClientTypeFunction · 0.85
isRemoteSessionLocalFunction · 0.85
getRemoteSessionUrlFunction · 0.85
getMainLoopModelFunction · 0.85
getPublicModelNameFunction · 0.85
getInitialSettingsFunction · 0.85

Tested by

no test coverage detected