From 7bfd650eec3b5d99018e94fdd0010a81964a8f71 Mon Sep 17 00:00:00 2001 From: rUv Date: Wed, 6 May 2026 16:52:08 -0400 Subject: [PATCH] fix(init): make RuFlo attribution trailer opt-in (#1670) (#1815) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `ruflo init` was silently writing this block into every project's `.claude/settings.json`: "attribution": { "commit": "Co-Authored-By: RuFlo ", "pr": "πŸ€– Generated with [RuFlo](...)" } …which the assistant then dutifully appended to every git commit it created during a session. The reporter (#1670) flagged the consequences: - no consent β€” trailer is injected without prompting - misrepresents contribution β€” implies direct human authorship - pollutes contributor graphs β€” GitHub counts Co-Authored-By trailers when building the Contributors page, so `ruvnet` appeared as a contributor on repos they never touched - hard to undo β€” removing the trailer needs `git filter-branch` + force-push, disrupting anyone who cloned the repo Make it opt-in: - Add `attribution?: boolean` to `InitOptions` (default `false`). - `generateSettings` only emits `settings.attribution` when `options.attribution === true`. - Test updated to assert the new default (`toBeUndefined`) and a second test asserts opt-in still produces the block. Existing projects that already have the field in their settings.json keep working β€” this fix only changes what `ruflo init` *writes* on a fresh setup. Users who want the trailer can pass `--attribution` or add it to their settings manually. Closes #1670. --- .../cli/__tests__/commands-deep.test.ts | 12 +++++++++++- .../cli/src/init/settings-generator.ts | 16 +++++++++++----- v3/@claude-flow/cli/src/init/types.ts | 7 +++++++ 3 files changed, 29 insertions(+), 6 deletions(-) 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; } /**