mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-09-14 14:01:28 +08:00
c8258cc07c
`compact.mjs` only worked when the caller ran from a cwd where `@claude-flow/integration` resolved — which on a pnpm-workspace marketplace install means `cwd=v3/@claude-flow/integration/` specifically (pnpm doesn't hoist into `v3/node_modules/`). The skill's documented `cd v3 && node ...` path failed with `Cannot find module @claude-flow/integration/token-optimizer`. The script also imported agentic-flow indirectly, which binds `process.env.HEALTH_PORT || 8080` at module-load time and EADDRINUSE'd on any host with something else already on 8080. Fix: 1. Resolution chain (#1930 step 5) — try in order: - createRequire(cwd) — works for npm-style hoisted installs - createRequire(script-dir) — works when run from inside the plugin - absolute path walk from `import.meta.url` up to 6 levels looking for `v3/@claude-flow/integration/dist/token-optimizer.js` — works on the marketplace layout regardless of cwd 2. HEALTH_PORT (#1930 step 4) — set to `0` by default (OS picks a free port) before the dynamic import runs. Users can still override. 3. dist/-missing (#1930 step 1) — when the resolver finds a path that doesn't exist on disk, surface a clear error pointing at the build command (`cd v3/@claude-flow/integration && pnpm run build`) instead of the generic MODULE_NOT_FOUND. Steps 2 (agentic-flow not in workspace deps) and 3 (sharp prebuild missing) are install-environment issues outside the script's reach. The graceful-fallback path already reports `agenticFlowAvailable: false` when the bridge can't load, which covers those cases truthfully. Resolves #1930 (script-level — the deeper packaging fix to ship a built `@claude-flow/integration/dist` in marketplace bundles is separate). Co-authored-by: Reuven <cohen@ruv-mac-mini.local>
5.9 KiB
Executable File
5.9 KiB
Executable File