Skip to content

distill-project.mjs hardcodes ~/.npm-global/bin/ruflo — fails on Homebrew/other-prefix installs #99

Description

@Tigon32

What I observed

scripts/distill-project.mjs resolves ruflo via a hardcoded path with no fallback:

const RUFLO = process.env.RUFLO_BIN || path.join(HOME, '.npm-global/bin/ruflo');

On a machine where ruflo is installed globally via Homebrew (/opt/homebrew/bin/ruflo/opt/homebrew/lib/node_modules/ruflo/bin/ruflo.js, confirmed working: ruflo v3.34.0), ~/.npm-global/bin/ruflo does not exist, so the script dies immediately:

ruflo is not at ~/.npm-global/bin/ruflo — install it with `npm i -g ruflo@latest`

...even though ruflo is installed and on PATH. Had to work around it with RUFLO_BIN=/opt/homebrew/bin/ruflo node distill-project.mjs.

Why it matters

This is the same class of bug as #18 (stack-sync.mjs hardcoded prefix, fixed) — and health-repair.mjs already carries the correct fix for this exact problem, with its own comment explaining why:

/**
 * Find ruflo HONESTLY.
 *
 * This was hardcoded to `~/.npm-global/bin/ruflo` — Stuart's prefix, not everyone's. ...
 * Telling someone their tool is missing when it is on their PATH is the product lying...
 */
function resolveRuflo() {
  const preferred = path.join(HOME, '.npm-global/bin/ruflo');
  if (fs.existsSync(preferred)) return preferred;
  const which = spawnSync('sh', ['-lc', 'command -v ruflo'], { encoding: 'utf8', timeout: 10_000 });
  const found = String(which.stdout || '').trim().split('\n')[0];
  return found && fs.existsSync(found) ? found : null;
}

distill-project.mjs just never got this fix applied — it's a straight port of resolveRuflo() from health-repair.mjs.

Suggested fix

Replace distill-project.mjs's RUFLO const with health-repair.mjs's resolveRuflo() (or extract it to a shared helper — at least 10 scripts in this repo hardcode ~/.npm-global independently: agentdb-fleet-doctor.mjs, capability-registry.mjs, calibrate-router.mjs, learning-replay-execution.mjs, onboarding-console.mjs, etc. — a shared resolve-ruflo.mjs would prevent this exact regression from recurring script-by-script).

Environment

  • macOS, Node installed via Homebrew, ruflo installed globally via Homebrew (/opt/homebrew/bin/ruflo → v3.34.0)
  • ruvnet-brain v4.0.4 (marketplace checkout, commit 9de40a5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions