Skip to content

Feat/npm plugin versions and tests - #433

Open
sreeramakhil wants to merge 6 commits into
agentrhq:mainfrom
sreeramakhil:feat/npm-plugin-versions-and-tests
Open

Feat/npm plugin versions and tests#433
sreeramakhil wants to merge 6 commits into
agentrhq:mainfrom
sreeramakhil:feat/npm-plugin-versions-and-tests

Conversation

@sreeramakhil

Copy link
Copy Markdown
Contributor

Description

Addresses all review feedback on the npm plugin changes and introduces a new premium out-of-the-box feature: Universal Package Search.

1. Refined npm versions command:

  • Consistent Signatures: Dropped the request parameter from npmFetch and versionsNpm in favor of using withFetch globally in tests (matching the other commands).
  • Prerelease Filtering: Pre-releases and custom build tags are filtered out by default. Added a --prereleases boolean flag (default false) to include them when requested.
  • Upgraded Tests: Test coverage updated to cover prerelease filtering and new global fetch mocking strategy.

2. Universal Package Search (omnisearch packages):

  • Ecosystems: Searches npm, crates.io (Rust), NuGet (.NET), RubyGems (Ruby), Packagist (PHP), and Maven Central (Java) in parallel.
  • Robustness: Utilizes Promise.allSettled to isolate failures. If one registry rate-limits or fails, others still return results.
  • Filters: Added support for --limit and --registries filters.
  • Schema: Normalizes to a unified row format: registry, name, version, description, url.
  • Tests: Full suite implemented in plugins/omnisearch/test/packages.test.js.

Related issue: None

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful
  • If I edited skill-src/, I ran make build and committed skills/

Adapter Notes

  • Updated generated or lean docs when command discoverability changed
  • Used positional args for the command's primary subject unless a named flag is clearly better
  • Normalized expected adapter failures to CliError subclasses instead of raw Error

Screenshots / Output

image image
$ npx vitest run plugins/npm/test/npm.test.js
 ✓  plugin  plugins/npm/test/npm.test.js (16 tests) 20ms
 Test Files  1 passed (1)
      Tests  16 passed (16)

$ npx vitest run plugins/omnisearch/test/
 ✓  plugin  plugins/omnisearch/test/research.test.js (1 test) 32ms
 ✓  plugin  plugins/omnisearch/test/packages.test.js (5 tests) 42ms
 Test Files  2 passed (2)
      Tests  6 passed (6)

- Add webcmd npm versions <name> command that lists all published
  versions of a package newest-first, with publishedAt, isLatest flag,
  and a direct npmjs.com URL per version. Mirrors the pypi releases cmd.

- Add optional 
equest parameter to
pmFetch in utils.js so commands
  can inject a fake fetch function in tests without patching globals
  (matches the pattern used in the pypi plugin).

- Add test/npm.test.js with 14 tests covering all four commands:
  package, versions, downloads, search. Includes happy paths, empty
  result / 404 handling, input validation, and a contract test asserting
  browser: false for every registered command.

- Expand README.md with a full command table (including the new versions
  command), argument descriptions, and copy-paste examples for all four
  commands.
Slicing publishedAt to 10 chars before sorting caused versions
published on the same calendar date to lose sub-day precision,
producing non-deterministic newest-first ordering.

Fix: sort on the raw full timestamp first, then format to date-only
inside .map(). Add a regression test with two versions sharing the
same date (08:00 and 14:00) to pin the correct ordering.
… entries

A version key can exist in body.time without a matching entry in
body.versions (e.g. yanked or unpublished releases). The previous code
returned bogus rows for those keys with an invalid URL and misleading
date.

Fix: cross-filter timeMap entries against body.versions so only keys
that exist in both are returned. Also guard that the timestamp is a
string before sorting.

Update the same-day regression fixture to include matching body.versions
entries and add a time-only ghost key (0.0.1-ghost) to assert it is
excluded from results.
- Drop the 
equest parameter from
pmFetch and �ersionsNpm. Instead, use withFetch in tests to stub the global etch.
- Filter out pre-release and build versions by default. Add a --prereleases boolean flag (default alse) to allow including them when requested.
- Update and expand tests in 	est/npm.test.js to cover the new pre-release filtering behavior and verify that the --prereleases flag works correctly.
…ages)

- Create plugins/omnisearch/packages.js to query npm, crates.io, NuGet, RubyGems, Packagist, and Maven Central in parallel using Promise.allSettled for failure isolation.
- Add support for --limit and --registries options to customize the search.
- Normalize search results to a unified schema: registry, name, version, description, and url.
- Create plugins/omnisearch/test/packages.test.js to cover all happy paths, filtering, limits, failure isolation, and browserless compliance.
- Re-compile the plugin command manifest to register the new command.
@github-actions

Copy link
Copy Markdown
Contributor

🟠 Maintainer review suggested — low confidence

The automated review could not reach a fully supported conclusion.

Limitations

  • The automated review returned an invalid structured result.

This review is advisory and does not block merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant