Skip to content

Expose repository scanner API - #32

Merged
andrew merged 3 commits into
mainfrom
scanner-api-v0-5
Aug 21, 2026
Merged

Expose repository scanner API#32
andrew merged 3 commits into
mainfrom
scanner-api-v0-5

Conversation

@andrew

@andrew andrew commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Moves repository scanning into the root Go package so other Go modules can use
the same traversal and report schema as the command. The command now delegates
to the exported API.

Adds opt-in IncludeLegalFiles support for retaining license and notice file
metadata and complete text decoded to UTF-8 without changing command defaults.

Closes #30
Closes #31

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

This pull request exposes the repository scanner through the root Go package, updates the CLI to use it, and adds opt-in legal-file reporting.

Changes:

  • Adds exported scanning options, reports, validation, and API.
  • Adds IncludeLegalFiles support with metadata.
  • Adds API tests and documentation.
  • Preserves existing CLI behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scan.go Exported scanner API and legal-file support
scan_test.go Migrated scanner tests
scan_api_test.go External API and legal-file tests
README.md Documents repository scanning API
corpus.go Updates package documentation
cmd/licenses/scan.go Delegates scanning to the root API
cmd/licenses/scan_test_helpers_test.go Retains CLI test helpers
cmd/licenses/licensee_comparison_test.go Uses exported legal-file classification
Suppressed comments (1)

scan.go:108

  • DefaultScanOptions leaves SkipDirs nil, so a caller customizing the returned defaults with the natural options.SkipDirs["generated"] = true operation will panic. Initialize this map here (as the CLI's parseSkippedDirectories does) so the exported defaults can be safely extended.
	return ScanOptions{
		MaxDepth:    defaultMaxDepth,
		MaxFiles:    defaultMaxFiles,
		MaxFileSize: defaultMaxFileSize,
		Workers:     defaultWorkerCount(),
	}

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@andrew
andrew merged commit 4854444 into main Aug 21, 2026
9 checks passed
@andrew
andrew deleted the scanner-api-v0-5 branch August 21, 2026 14:25
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.

Expose repository scanning through the Go package Optionally report unmatched license and notice files

2 participants