Files
ruflo/v3/@claude-flow
ReuvenandRuFlo aeeeff72f5 fix(cli): extract suppression to side-effect module imported FIRST
3.6.18 smoke test caught that the [AgentDB Patch] warning still leaked
through the ruflo wrapper — even after iteration #11's "move to
src/index.ts" attempt. Root cause: ES module imports hoist above any
top-level code in the same module, so the inline suppression block
ran AFTER `import { commands } from './commands/index.js'`, by which
point agentic-flow had already been loaded transitively and emitted
its warning.

Fix: extracted the patch into `src/log-filters.ts` as a side-effect
module and imported it as the FIRST import statement in src/index.ts:

  import './log-filters.js';     // ← evaluated first in import graph
  import { readFileSync } from 'fs';
  import { commands } from './commands/index.js';
  ...

ES module evaluation order is the source order of imports, so
log-filters.js runs its side effect (patches console.warn/log) before
any sibling import can transitively load agentic-flow.

bin/cli.js and bin/mcp-server.js keep their inline suppression as
defense-in-depth (covers cases where the bin file's own crypto/etc.
imports run before src/index.js loads).

Verified via ruflo wrapper:
  $ node ruflo/bin/ruflo.js --version
  ruflo v3.6.18    # no warning prefix anymore

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-03 17:34:22 -04:00
..