Check a dependency list against a license policy
check_license_complianceGiven a list of packages (name + optional exact version or semver range — e.g. straight from a package.json "dependencies" object) and an optional allow/deny license policy, resolves each package's declared SPDX license and reports a compliance verdict per package. Classifies every license into one of permissive/weak-copyleft/copyleft/network-copyleft/proprietary/public-domain/unknown, and understands simple SPDX expressions: "(MIT OR GPL-3.0)" is compliant if EITHER side is permitted (a consumer may legally pick the clean alternative), "MIT AND Apache-2.0" requires both sides to pass, and "X WITH exception" is judged on X. A mixed/nested expression like "(MIT OR ISC) AND Apache-2.0" is reported as needsReview rather than guessed at. policy.deny entries always win over policy.allow (so a name can appear in both without a silent contradiction); with policy.allow set, anything not matching it is a violation (unproven is treated as non-compliant); with neither given, the default policy flags only copyleft/network-copyleft/proprietary (e.g. GPL/AGPL/UNLICENSED) — weak-copyleft (LGPL/MPL/EPL) and unrecognized license strings are surfaced but not auto-flagged. Policy entries accept an exact SPDX id, a family prefix ("GPL" catches GPL-2.0/GPL-3.0-only/etc.), or a category name. This reads only the registry-declared license field — it does not fetch or parse LICENSE file contents from the source repository.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| policy | No | Omit entirely to use the default policy: only copyleft/network-copyleft/proprietary are violations. | |
| packages | Yes | 1-100 packages to check. version accepts an exact version or a semver range like "^4.17.21"; omitted = latest. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| policy | Yes | ||
| results | Yes | ||
| summary | Yes | ||
| totalPackages | Yes | ||
| compliantCount | Yes | ||
| violationCount | Yes | ||
| unresolvedCount | Yes | ||
| needsReviewCount | Yes |