Skip to content

Add declarations for more package ecosystems - #75

Open
andrew wants to merge 7 commits into
mainfrom
codex/more-source-declarations
Open

Add declarations for more package ecosystems#75
andrew wants to merge 7 commits into
mainfrom
codex/more-source-declarations

Conversation

@andrew

@andrew andrew commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Add source declarations for Cargo, Go, NuGet, Hex, and Gleam so callers can identify and compare requirements without parsing each manifest again.

Declarations now carry direct versus indirect status, preserve parser-supplied PURLs, and use stable source locations for aliases, target-specific dependencies, and repeated entries. Registry checks exclude local, Git, replaced, workspace, and other non-registry sources while leaving the existing dependency inventory intact. NuGet central package management through Directory.Packages.props is included.

Hex alias locations stay tied to the source atom. Cargo and NuGet retain their prior Dependencies behavior while exposing the extra declaration data.

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 PR expands the manifest parsing surface to emit Declarations for additional ecosystems (Cargo, RubyGems, Go, NuGet, Hex, Gleam) with stable per-source Locations, preserved parser-supplied PURLs, and a new Direct flag to distinguish explicit vs indirect requirements.

Changes:

  • Add Direct to Declaration and standardize stable location generation via core.NextLocation.
  • Extend multiple ecosystem parsers to populate Result.Declarations (including NuGet central package management via Directory.Packages.props).
  • Preserve parser-supplied declaration PURLs in the public Parse wrapper, and update tests/docs/testdata accordingly.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
testdata/nuget/Directory.Packages.props Adds NuGet central package management fixture.
README.md Documents new Direct field and expanded declaration support; adds NuGet file type.
manifests.go Preserves parser-supplied declaration PURLs via declarationPURL.
manifests_test.go Adds declaration PURL/directness test cases for new ecosystems and preservation behavior.
internal/pypi/pypi.go Uses core.NextLocation for stable declaration locations; marks declarations direct.
internal/nuget/nuget.go Adds declarations for NuGet manifests and adds Directory.Packages.props parser.
internal/nuget/nuget_test.go Adds/extends tests validating NuGet declarations and location stability.
internal/npm/npm.go Marks npm declarations as direct.
internal/maven/declarations.go Marks Maven declarations as direct.
internal/hex/hex.go Adds Hex declarations with alias/non-registry handling and stable locations.
internal/hex/hex_test.go Adds tests for Mix declarations and non-registry filtering.
internal/golang/golang.go Adds Go module declarations; skips replaced modules; introduces replace scanning.
internal/golang/golang_test.go Adds tests for Go declarations, including indirect/tool/replace behavior.
internal/gleam/gleam.go Adds Gleam declarations for runtime and dev dependencies.
internal/gleam/gleam_test.go Adds tests verifying Gleam declarations and directness.
internal/github_actions/github_actions.go Uses core.NextLocation and marks action declarations direct.
internal/gem/rubygems.go Adds Gemfile/gemspec declarations with registry/non-registry handling and stable locations.
internal/gem/gem_test.go Adds tests for Gemfile/gemspec declarations and block/context behavior.
internal/core/types.go Adds Direct to core.Declaration with documentation.
internal/core/helpers.go Introduces core.NextLocation helper for stable repeated-entry locations.
internal/cargo/cargo.go Adds Cargo declarations across tables/targets/workspace with registry filtering.
internal/cargo/cargo_test.go Adds tests validating Cargo declarations and ensuring Dependencies behavior is unchanged.

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

Comment thread internal/nuget/nuget.go Outdated
Comment thread internal/golang/golang.go
Comment thread internal/gem/rubygems.go Outdated
andrew added 4 commits August 19, 2026 17:55
Strip trailing comments before Gemfile block detection so a gem line
whose comment ends in the word 'do' is not treated as a block opener.
Add bitbucket to the Bundler non-registry source patterns and
organization to the Hex non-registry pattern so private packages do not
produce public-registry declarations. Extract the repeated location
suffix logic into core.NextLocation.
consumeContextLine treated any line ending in ' do' as a block opener,
so a gem line whose trailing comment lacked a leading space and ended
in the word 'do' was swallowed before collectGemLine could see it.
Bundler's gem call never takes a block, so bail out on gem-prefixed
lines before the catch-all. Add a regression case to
TestGemfileDeclarationBlockContexts.

Also drop the redundant equality clause from the replace-block check
in collectReplacedModules.
A nuspec <group> with no targetFramework is valid and previously
produced dependency-groups//<id> locations. Only append the framework
segment when it is non-empty, matching the Condition handling in the
csproj and central-packages parsers.

Extend the Gemfile comment strip to accept a tab before # so a block
opener written as 'group :test do<tab># ...' is still recognised.
@andrew
andrew force-pushed the codex/more-source-declarations branch from de179e1 to ddc3c1f Compare August 19, 2026 16:56
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.

2 participants