diff --git a/v3/@claude-flow/cli/__tests__/commands-deep.test.ts b/v3/@claude-flow/cli/__tests__/commands-deep.test.ts index b50cf6b194..215e88f478 100644 --- a/v3/@claude-flow/cli/__tests__/commands-deep.test.ts +++ b/v3/@claude-flow/cli/__tests__/commands-deep.test.ts @@ -1487,9 +1487,19 @@ describe('Init System', () => { expect(perms.deny).toBeDefined(); }); - it('should include attribution', () => { + it('should NOT include attribution by default (opt-in per #1670)', () => { + // #1670 — attribution (Co-Authored-By trailer) is now opt-in to avoid + // silently injecting a third-party co-author into user commits. const settings = generateSettings(DEFAULT_INIT_OPTIONS) as Record; + expect(settings.attribution).toBeUndefined(); + }); + + it('should include attribution when opted in', () => { + const settings = generateSettings({ ...DEFAULT_INIT_OPTIONS, attribution: true }) as Record; expect(settings.attribution).toBeDefined(); + const attribution = settings.attribution as Record; + expect(attribution.commit).toContain('Co-Authored-By:'); + expect(attribution.pr).toContain('Generated with'); }); it('should include env with agent teams enabled', () => { diff --git a/v3/@claude-flow/cli/src/init/settings-generator.ts b/v3/@claude-flow/cli/src/init/settings-generator.ts index 9fb7edc188..3babb7d093 100644 --- a/v3/@claude-flow/cli/src/init/settings-generator.ts +++ b/v3/@claude-flow/cli/src/init/settings-generator.ts @@ -41,11 +41,17 @@ export function generateSettings(options: InitOptions): object { ], }; - // Add RuFlo attribution for git commits and PRs - settings.attribution = { - commit: 'Co-Authored-By: RuFlo ', - pr: '🤖 Generated with [RuFlo](https://github.com/ruvnet/ruflo)', - }; + // #1670 — RuFlo attribution (Co-Authored-By trailer + PR footer) is now + // OPT-IN. Default behavior no longer injects a third-party Co-Authored-By + // line into the user's commits — that pattern silently inflated GitHub + // contributor graphs and was hard to undo without rewriting history. Pass + // `--attribution` (or `attribution: true` in InitOptions) to enable. + if (options.attribution === true) { + settings.attribution = { + commit: 'Co-Authored-By: RuFlo ', + pr: '🤖 Generated with [RuFlo](https://github.com/ruvnet/ruflo)', + }; + } // Note: Claude Code expects 'model' to be a string, not an object // Model preferences are stored in claudeFlow settings instead diff --git a/v3/@claude-flow/cli/src/init/types.ts b/v3/@claude-flow/cli/src/init/types.ts index 32e4dbdb03..8da2a0c35f 100644 --- a/v3/@claude-flow/cli/src/init/types.ts +++ b/v3/@claude-flow/cli/src/init/types.ts @@ -316,6 +316,13 @@ export interface InitOptions { * Set true via --no-global to keep the global Claude rules file pristine (#1744). */ skipGlobalClaudeMd?: boolean; + /** + * #1670 — opt in to writing the `attribution` block in `.claude/settings.json` + * (Co-Authored-By trailer + PR footer). Defaults to false: most users do not + * want a third-party Co-Authored-By line silently added to their commits and + * GitHub contributor graph. Pass `--attribution` to opt in. + */ + attribution?: boolean; } /**