Files
ruflo/v3/plugins/code-intelligence/src
ReuvenandRuFlo e7a11f26f5 fix(plugin-code-intelligence@3.0.0-alpha.2): real impl for stub helpers
Closes #1554, #1553.

The 5 MCP tools (semantic-search, architecture-analyze, refactor-impact,
split-suggest, learn-patterns) all returned empty results because three
helpers in src/mcp-tools.ts were stubs. Replaced with dep-free real
implementations:

- getFilesInPath: recursive readdirSync walk with skip-list (node_modules,
  dist, .git, coverage, .next, .turbo, etc.), symlink-loop protection via
  realpathSync visited set, 100KB file-size cap, .min.* exclusion.

- performSemanticSearch: token-overlap cosine similarity over the first
  200 lines of each candidate file, with language and exclude-tests
  filters honored. Returns CodeSearchResult shape (filePath, lineNumber,
  snippet, matchType, score, context, language, explanation). Threshold
  0.05 to drop noise. Real ranked output instead of `return [].slice(0)`.

- getAllRelatedFiles: forward BFS with depth 3 over relative import
  specifiers (regex on `import … from '…'` and `require('…')`), resolving
  via .ts/.tsx/.js/.jsx/.mjs/.cjs and `index.*` under directories. Reverse
  scan over the common-ancestor root finds files that import any changed
  file. Returns a deduplicated absolute-path array.

Kept dep-free — no fast-glob, no @claude-flow/embeddings, no peer-dep
churn. The token-overlap score is intentionally simpler than embeddings
and is marked as such in the explanation field; upgrading to ONNX
embeddings via a feature-detected import is a follow-up.

Verification (live probe against this repo):
- semantic-search "authentication memory store" over v3/@claude-flow/cli/
  src/mcp-tools (TypeScript only, exclude tests, topK=5):
    totalMatches: 5
    top: memory-tools.ts (0.230), performance-tools.ts (0.213),
         daa-tools.ts (0.153)
- Build clean (tsc).
- Pre-existing test failures (34/123) are version-string mismatches
  unrelated to this change — confirmed by re-running tests against the
  stashed pre-fix baseline.

Published @claude-flow/plugin-code-intelligence@3.0.0-alpha.2
(alpha + latest tags).

Co-Authored-By: RuFlo <ruv@ruv.net>
2026-05-08 09:52:40 -04:00
..