From 87cc2f323cb61dc83c1de13231d56587fb00ca95 Mon Sep 17 00:00:00 2001 From: Reuven Date: Sun, 3 May 2026 20:03:15 -0400 Subject: [PATCH] fix(verify): resolve plugin paths from source-tree when running locally MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When `ruflo verify` runs from a checked-out repo (maintainer's working copy), packages like `@claude-flow/plugin-agent-federation` live at `v3/@claude-flow/plugin-*/dist/...` rather than under `node_modules/@claude-flow/plugin-*/`. The previous resolution path only knew about node_modules layouts, so the plugin's witness entry reported `missing` for source-tree runs (cosmetic — installed copies still resolved correctly). Added a third resolution lane: walk up from the script's location looking for the literal repo-relative path itself. End users still hit the node_modules paths first; maintainers now get clean 27/27 pass instead of 26/27 + 1 missing. Verified: `node bin/cli.js verify --manifest verification.md.json` from the repo root reports pass: 27 / drift: 0 / regressed: 0 / missing: 0. Co-Authored-By: RuFlo --- v3/@claude-flow/cli/src/commands/verify.ts | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/v3/@claude-flow/cli/src/commands/verify.ts b/v3/@claude-flow/cli/src/commands/verify.ts index b55dc976d5..d3c3c798f1 100644 --- a/v3/@claude-flow/cli/src/commands/verify.ts +++ b/v3/@claude-flow/cli/src/commands/verify.ts @@ -85,12 +85,13 @@ function repoPathToInstalledPath(repoPath: string): string | null { if (match) { const pkg = match[1]; const rest = match[2]; - // Try several anchors: cwd/node_modules, the dirname of this script's package const candidates: string[] = []; + // 1. cwd/node_modules// (typical end-user install) candidates.push(join(process.cwd(), 'node_modules', pkg, rest)); + // 2. Walk up from this script looking for node_modules// + // Covers cases where verify runs from inside a nested module. try { const __filename = fileURLToPath(import.meta.url); - // Walk up looking for node_modules let dir = dirname(__filename); for (let i = 0; i < 10; i++) { candidates.push(join(dir, 'node_modules', pkg, rest)); @@ -99,6 +100,22 @@ function repoPathToInstalledPath(repoPath: string): string | null { dir = parent; } } catch { /* ignore */ } + // 3. Source-tree resolution: when verify runs against a checked-out + // repo (the developer's working copy), packages live at + // `/v3//` rather than under node_modules. + // Walk up looking for the literal repo-relative path so the verify + // command works for maintainers running it from the repo itself. + try { + const __filename = fileURLToPath(import.meta.url); + let dir = dirname(__filename); + for (let i = 0; i < 10; i++) { + candidates.push(join(dir, repoPath)); + const parent = dirname(dir); + if (parent === dir) break; + dir = parent; + } + } catch { /* ignore */ } + candidates.push(join(process.cwd(), repoPath)); for (const c of candidates) { if (existsSync(c)) return c; }