Skip to content

dependabit / plugins/plugin-context7/src / Context7Checker

Class: Context7Checker

Defined in: packages/plugins/plugin-context7/src/checker.ts:131

Monitors library documentation changes via the Context7 API, with a fallback to direct URL content hashing when the API is unavailable.

Remarks

The checker first tries https://api.context7.io/v1/libraries/:id. On 404 or 503 it silently falls back to fetching the documentation URL directly and hashing the full response body.

Version severity is determined via semver.diff — major semver bumps are classified as breaking, minor as major, patch/pre-release as minor. Non-semver versions (e.g. unknown) default to minor.

Use When

Tracking libraries whose documentation is indexed by Context7 (e.g., React, Next.js, Prisma).

Avoid When

Monitoring libraries without a Context7 entry — the fallback URL hash is very sensitive to dynamic page content. Prefer a specific HTTP checker with normalised content in that case.

Pitfalls

  • Fallback URL hash instability: when the API is unavailable and the checker falls back to direct URL hashing, any dynamic content on the documentation page (e.g., timestamps, ads, CDN-injected nonces) will produce false positive changes.
  • Zod schema mismatches: if Context7 changes its API response shape, Context7ResponseSchema.parse will throw a ZodError and the checker silently falls back to URL hashing without logging the schema error.
  • lastUpdated change without version bump: some Context7 libraries update their lastUpdated field without bumping the version number. This produces a changes: ['lastUpdated'] result with severity: 'minor'.

Constructors

Constructor

ts
new Context7Checker(): Context7Checker;

Returns

Context7Checker

Methods

compare()

ts
compare(prev, curr): Promise<Context7ChangeDetection>;

Defined in: packages/plugins/plugin-context7/src/checker.ts:266

Compare two Context7 snapshots to detect changes

Parameters

ParameterType
prevContext7Snapshot
currContext7Snapshot

Returns

Promise<Context7ChangeDetection>


fetch()

ts
fetch(config): Promise<Context7Snapshot>;

Defined in: packages/plugins/plugin-context7/src/checker.ts:159

Fetch library information from Context7 API

Parameters

ParameterType
configContext7Config

Returns

Promise<Context7Snapshot>

Released under the MIT License.