fix(init): make RuFlo attribution trailer opt-in (#1670) (#1815)

`ruflo init` was silently writing this block into every project's
`.claude/settings.json`:

  "attribution": {
    "commit": "Co-Authored-By: RuFlo <ruv@ruv.net>",
    "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.
This commit is contained in:
rUv authored and GitHub committed 2026-05-06 16:52:08 -04:00
1 parent d469721710
commit 7bfd650eec
3 files changed
+29 -6

No files matched your search

@@ -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<string, unknown>;
expect(settings.attribution).toBeUndefined();
});
it('should include attribution when opted in', () => {
const settings = generateSettings({ ...DEFAULT_INIT_OPTIONS, attribution: true }) as Record<string, unknown>;
expect(settings.attribution).toBeDefined();
const attribution = settings.attribution as Record<string, string>;
expect(attribution.commit).toContain('Co-Authored-By:');
expect(attribution.pr).toContain('Generated with');
});
it('should include env with agent teams enabled', () => {
@@ -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 <ruv@ruv.net>',
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 <ruv@ruv.net>',
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
+7
View File
@@ -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;
}
/**