Repository navigation
Add archive-backed license text to licenses output - #328
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for emitting full installed license/notice text in git pkgs licenses JSON output via a new --license-text flag, using local scanning of installed direct dependencies to enrich the existing license metadata output.
Changes:
- Add
--license-text(JSON-only) to scan installed direct dependencies and includelicense_text,notice_text, and declared license records in output. - Implement installed-dependency source resolution via package-manager
CapPathsupport and scan results application toLicenseInfo. - Update docs and add/extend internal tests for new flag behavior and JSON output fields.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new --license-text --format json usage. |
| go.mod | Adds/bumps modules to support installed-license scanning (git-pkgs/licenses, newer managers/manifests, etc.). |
| go.sum | Records updated dependency checksums for the new/updated modules. |
| cmd/licenses.go | Implements the --license-text flag, installed dependency resolution, scanning, and JSON struct enrichment fields. |
| cmd/licenses_internal_test.go | Adds tests for flag validation, scanning behavior, and JSON output including attribution fields. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
1656867 to
96c0098
Compare
706cb27 to
9e37289
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new docs describe --dependencies indirect as lockfile-only, but the implementation includes resolved Go/Maven manifest dependencies too, and one new cache-corruption error message lacks actionable context.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 11/12 changed files
- Comments generated: 2
- Review effort level: Lite
--license-text downloads and scans package archives via git-pkgs/artifacts, git-pkgs/archives and git-pkgs/licenses, adding license_text, notice_text and declared records to JSON output. --dependencies direct|indirect|all selects which resolved dependencies are reported and scanned. Archives are cached under the user cache dir with SHA-256 verification, trimmed to 4 GiB at command start, and extraction is capped at 512 MiB of decompressed bytes. Scans run four at a time. Closes #294
Path-source purls (Bundler PATH, npm file:) have no downloadable artifact; skip them. Return the triggering error rather than a cancelled victim's context.Canceled. Remove empty package cache dirs on discard; drop redundant purl from load errors.
…gets Ecosystems without a git-pkgs/registries backend (github-actions etc) are skipped silently. Unresolved targets in supported ecosystems produce a per-manifest stderr warning instead of aborting the run.
Addresses review feedback: the corrupt-cache error now identifies which entry is affected, and the --dependencies docs cover Go/Maven manifests that pin exact versions.
041469d to
0289bb0
Compare
Replaces the pseudo-version pin at an orphaned pre-squash commit with the tagged release that includes WithMaxBytes.
Adds
--license-textto JSON output fromgit pkgs licenses. It downloads and verifies selected package archives, scans legal files and manifests, and emits decoded license text, notice text, declared license metadata, and scanned SPDX expressions.--dependencies direct|indirect|allcontrols which resolved dependencies are reported and scanned.directremains the default. Cached archives support--offline; historical--commitand--branchscans do not require installed package trees or package-manager commands.--license-textrequires JSON output, a resolved version, and a supported registry artifact. It cannot be combined with--drift. Registry authentication is not configured by this command.Depends on git-pkgs/artifacts#1 and git-pkgs/registries#75. Archive opening uses git-pkgs/archives and its git-pkgs/magic format detection.
Closes #294