Skip to content

Add archive-backed license text to licenses output - #328

Merged
andrew merged 5 commits into
mainfrom
issue-294-license-text
Sep 4, 2026
Merged

andrew merged 5 commits into
mainfrom
issue-294-license-text

Conversation

@andrew

@andrew andrew commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Adds --license-text to JSON output from git 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|all controls which resolved dependencies are reported and scanned. direct remains the default. Cached archives support --offline; historical --commit and --branch scans do not require installed package trees or package-manager commands.

--license-text requires 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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 include license_text, notice_text, and declared license records in output.
  • Implement installed-dependency source resolution via package-manager CapPath support and scan results application to LicenseInfo.
  • 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.

Comment thread cmd/licenses.go Resolved
Comment thread cmd/licenses.go Resolved
Comment thread cmd/licenses_internal_test.go Resolved
@andrew
andrew marked this pull request as ready for review August 21, 2026 16:19
@andrew andrew changed the title Add installed license text to licenses output Add archive-backed license text to licenses output Aug 21, 2026
@andrew
andrew requested a lite review from Copilot August 21, 2026 18:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Comment thread internal/artifactcache/store.go Resolved
Comment thread cmd/license_artifacts.go Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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

Comment thread docs/license-text.md Resolved
Comment thread internal/artifactcache/store.go Resolved
--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.
@andrew
andrew force-pushed the issue-294-license-text branch from 041469d to 0289bb0 Compare September 4, 2026 13:20
Replaces the pseudo-version pin at an orphaned pre-squash commit with the
tagged release that includes WithMaxBytes.
@andrew
andrew merged commit b77557b into main Sep 4, 2026
7 checks passed
@andrew
andrew deleted the issue-294-license-text branch September 4, 2026 13:31
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.

licenses: option to emit full license text per dependency (--license-text)

2 participants