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; }