feat: CDN registry generator for Go third-party packages#647
Open
shivasurya wants to merge 1 commit intoshiva/pr-06-golang-thirdpartyfrom
Open
feat: CDN registry generator for Go third-party packages#647shivasurya wants to merge 1 commit intoshiva/pr-06-golang-thirdpartyfrom
shivasurya wants to merge 1 commit intoshiva/pr-06-golang-thirdpartyfrom
Conversation
…CLI tool
Extends tools/internal/goextract with ExtractSinglePackage for single-directory
extraction, and adds a CLI tool that downloads modules via `go mod download -json`
and produces CDN-ready JSON files consumed by GoThirdPartyRegistryRemote (PR-06).
Changes:
- ExtractSinglePackage(packageDir, importPath): reuses go/ast pipeline to extract
exported symbols from a single directory; skips *_test.go files, gracefully
handles per-file parse errors (cgo, build-constrained syntax)
- generate_go_thirdparty_registry.go: CLI with --packages-file and --output-dir
flags; downloads modules, extracts metadata, writes {encoded}.json + manifest.json
with sha256 checksums; continues on per-package failures (skip + log)
- top1000.txt: Tier 1 list of ~30 security-relevant packages (web frameworks,
ORM/DB, HTTP clients, auth/crypto, logging, cloud SDKs)
- 9 tests for ExtractSinglePackage; 16 tests for CLI helpers (readPackageList,
encodeModulePath, downloadModule with injected cmdRunner, end-to-end pipeline)
- Module path encoding matches PR-06 convention: slashes → underscores
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
Code Pathfinder Security ScanNo security issues detected.
Powered by Code Pathfinder |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## shiva/pr-06-golang-thirdparty #647 +/- ##
==============================================================
Coverage 84.45% 84.45%
==============================================================
Files 163 163
Lines 23564 23594 +30
==============================================================
+ Hits 19900 19926 +26
- Misses 2918 2920 +2
- Partials 746 748 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.



Summary
ExtractSinglePackage(packageDir, importPath string) (*Package, error)totools/internal/goextract— reuses the existinggo/astextraction pipeline for a single directory (third-party module cache path fromgo mod download -json)tools/generate_go_thirdparty_registry.goCLI tool (build tag:cpf_generate_thirdparty_registry) that downloads modules, extracts exported APIs, writes per-package JSON +manifest.jsonwith sha256 checksums — produces CDN content consumed byGoThirdPartyRegistryRemotefrom PR-06tools/top1000.txtwith Tier 1 (~30 security-relevant packages): web frameworks, ORM/DB drivers, HTTP clients, auth/crypto, logging, cloud SDKsencodeModulePathTest plan
go test ./tools/internal/goextract/— all existing + 9 newExtractSinglePackagetests passgo test -tags cpf_generate_thirdparty_registry ./tools/— 16 CLI helper tests (readPackageList, encodeModulePath, downloadModule with injected runner, end-to-end pipeline)go test ./...— full suite cleangolangci-lint run ./tools/internal/goextract/— zero issuesgolangci-lint run --build-tags cpf_generate_thirdparty_registry ./tools/— zero issues"sha256:" + hexmatches PR-06 loader verification🤖 Generated with Claude Code