Expose repository scanner API - #32
Merged
Merged
Conversation
There was a problem hiding this comment.
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
IncludeLegalFilessupport 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
DefaultScanOptionsleavesSkipDirsnil, so a caller customizing the returned defaults with the naturaloptions.SkipDirs["generated"] = trueoperation will panic. Initialize this map here (as the CLI'sparseSkippedDirectoriesdoes) 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
IncludeLegalFilessupport for retaining license and notice filemetadata and complete text decoded to UTF-8 without changing command defaults.
Closes #30
Closes #31