Skip to content

fix(common): use product-specific commit attribution - #1185

Open
c8dhjp4tyv-bit wants to merge 4 commits into
CodebuffAI:mainfrom
c8dhjp4tyv-bit:recreate/1101-freebuff-commit-attribution
Open

fix(common): use product-specific commit attribution#1185
c8dhjp4tyv-bit wants to merge 4 commits into
CodebuffAI:mainfrom
c8dhjp4tyv-bit:recreate/1101-freebuff-commit-attribution

Conversation

@c8dhjp4tyv-bit

Copy link
Copy Markdown

Recreated on the rewritten main after #1101 was auto-closed during repository maintenance. This carries the same reviewed change set on the new history.

Summary

  • derive git commit attribution from the compile-time FREEBUFF_MODE flag
  • keep Codebuff's existing footer for standard builds
  • use Freebuff branding and domain for Freebuff binaries
  • add regression coverage for both product variants

Fixes #997

Validation

Prior validation before the history rewrite:

  • Freebuff build-flag attribution smoke check: passed
  • targeted common tool tests: 10 passed
  • common typecheck: passed
  • git diff --check: passed
  • Prettier check for changed files: passed
  • common full test command: 1,158 passed; 37 existing checkout/snapshot failures remain in unrelated web/agent sources and one existing Zod schema expectation
  • agent-runtime typecheck: existing missing agents-graveyard/researcher/researcher imports; no errors from changed files

@codebuff-team

Copy link
Copy Markdown
Contributor

Good, scoped fix: run-terminal-command.ts's commit-footer text was hardcoded to "Codebuff" even in Freebuff builds. This PR introduces getGitCommitGuidePrompt(isFreebuff) that derives the product name/domain from FREEBUFF_MODE, keeps the existing gitCommitGuidePrompt export for backward compatibility, and updates the native-tool-call example string to use the same attribution. Tests in run-terminal-command-branding.test.ts cover both the default (Codebuff) and Freebuff paths without needing to mutate process.env, which is the right approach for testability.

A couple of minor things worth tightening before porting:

  • buildCommitAttribution / commitProductName / commitProductDomain (lines ~150-153) recompute getCommitAttribution(isFreebuffBuild) a second time when getGitCommitGuidePrompt() already computed it internally for the default prompt. Not a bug, but redundant - could just call getCommitAttribution(isFreebuffBuild) once at module scope and reuse it in both places.
  • The CommitAttribution type hardcodes the literal domains/names as a union of two values, which works but will need updating if a third product/build variant is ever added - fine for now given the two-build reality.

Overall this is a clean, single-purpose fix with regression coverage, touches only common/, and should be straightforward to port by hand.

@codebuff-team codebuff-team added bot:triaged Classified by the community triage bot pr:port-candidate Worth porting into the private source tree labels Sep 1, 2026

Copy link
Copy Markdown
Author

Tightened the redundant attribution lookup. The default getGitCommitGuidePrompt() path now reuses the module-level build attribution; explicit boolean calls still compute the requested product so the testable API remains intact. Targeted branding tests: 2 passed, 0 failed; git diff --check passes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:triaged Classified by the community triage bot pr:port-candidate Worth porting into the private source tree

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generated By Codebuff when doing a pull request.

2 participants