feat: add npm registry search engine adapter (#144)#190
feat: add npm registry search engine adapter (#144)#190josephkehan-prog wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds an npm registry search engine, maps registry packages into shared search results, registers it in the code vertical, and adds unit tests for requests, parsing, errors, and engine membership. ChangesNPM registry search integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant SearchCaller
participant NpmRegistryEngine
participant NpmRegistryAPI
SearchCaller->>NpmRegistryEngine: Submit code search query
NpmRegistryEngine->>NpmRegistryAPI: Request package results
NpmRegistryAPI-->>NpmRegistryEngine: Return registry JSON
NpmRegistryEngine-->>SearchCaller: Return mapped RawSearchResult[]
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/search/engines/npm-registry.ts`:
- Around line 66-68: Update the parsing loop around the objects array access so
malformed null or undefined entries are handled safely before reading package.
Use optional chaining on the array item while preserving the existing name
extraction and invalid-item skipping behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c965f29a-8050-492a-be5a-a5a8618deec3
📒 Files selected for processing (4)
src/search/core/verticals/code.tssrc/search/engines/npm-registry.tstests/unit/search/engines/npm-registry.test.tstests/unit/search/v1/verticals/code.test.ts
Closes #144
Adds
NpmRegistryEngineusing the npm registry public JSON search API (registry.npmjs.org/-/v1/search) — no scraping, no key.name@version→ title,links.npm→ url, description (truncated 200 chars) → snippet,date→ published_date; rank-based relevance_score matching other adapters (registry's rawscore.finalis unnormalized, deliberately unused)codevertical (weight 0.9, qualitymediumper the engine-quality registry default)hn-algolia.test.tsmocked-fetch pattern; updatedcode.test.tsengine-count assertions (same collateral as prior engine additions)Test plan
npx vitest run tests/unit/search/engines/npm-registry.test.ts tests/unit/search/v1/verticals/code.test.ts— 19/19npx tsc --noEmitcleanSummary by CodeRabbit
New Features
Bug Fixes
Tests