@@ -65,20 +65,34 @@ export const terminalCommandOutputSchema = z.union([
6565 } ) ,
6666] )
6767
68+ // FREEBUFF_MODE is injected for Freebuff builds and read once when this module
69+ // is initialized. Tests pass an explicit product flag to the prompt builder so
70+ // they do not depend on mutating process.env after import.
6871const isFreebuffBuild = process . env . FREEBUFF_MODE === 'true'
6972
73+ type CommitAttribution = {
74+ productName : 'Freebuff' | 'Codebuff'
75+ productDomain : 'freebuff.com' | 'codebuff.com'
76+ }
77+
78+ function getCommitAttribution ( isFreebuff : boolean ) : CommitAttribution {
79+ return isFreebuff
80+ ? { productName : 'Freebuff' , productDomain : 'freebuff.com' }
81+ : { productName : 'Codebuff' , productDomain : 'codebuff.com' }
82+ }
83+
84+ const buildCommitAttribution = getCommitAttribution ( isFreebuffBuild )
85+
7086/**
7187 * Build commit guidance for the product that owns the current binary.
7288 *
73- * FREEBUFF_MODE is a compile-time flag for the Freebuff CLI build. Keeping the
74- * default in this shared prompt preserves Codebuff's existing attribution
75- * while Freebuff binaries no longer ask models to claim Codebuff commits.
89+ * Keeping Codebuff as the default preserves existing attribution while
90+ * Freebuff binaries no longer ask models to claim Codebuff commits.
7691 */
7792export const getGitCommitGuidePrompt = (
7893 isFreebuff = isFreebuffBuild ,
7994) : string => {
80- const productName = isFreebuff ? 'Freebuff' : 'Codebuff'
81- const productDomain = isFreebuff ? 'freebuff.com' : 'codebuff.com'
95+ const { productName, productDomain } = getCommitAttribution ( isFreebuff )
8296
8397 return `
8498### Using git to commit changes
@@ -133,8 +147,10 @@ When the user requests a new git commit, please follow these steps closely:
133147}
134148
135149export const gitCommitGuidePrompt = getGitCommitGuidePrompt ( )
136- const commitProductName = isFreebuffBuild ? 'Freebuff' : 'Codebuff'
137- const commitProductDomain = isFreebuffBuild ? 'freebuff.com' : 'codebuff.com'
150+ const {
151+ productName : commitProductName ,
152+ productDomain : commitProductDomain ,
153+ } = buildCommitAttribution
138154
139155const toolName = 'run_terminal_command'
140156const endsAgentStep = true
0 commit comments