Skip to content

Add package Name and Version to ParseResult#41

Merged
andrew merged 2 commits into
mainfrom
self-name
Jul 1, 2026
Merged

Add package Name and Version to ParseResult#41
andrew merged 2 commits into
mainfrom
self-name

Conversation

@andrew

@andrew andrew commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

ParseResult now carries the package's own Name and Version when the manifest format declares one, alongside the existing Dependencies.

The internal Parser.Parse return type changes from []Dependency to *Result{Name, Version, Dependencies}; the first commit is that mechanical rewrite across all parsers so the second commit's per-format extraction is readable on its own.

Coverage: go.mod, Cargo.toml, package.json/bower.json/deno.json, composer.json, pubspec.yaml, shard.yml, gleam.toml, Project.toml, dub.json, haxelib.json, vcpkg.json, META.json/META.yml, DESCRIPTION, *.cabal, elm.json, environment.yml, *.gemspec, *.podspec, mix.exs, pyproject.toml/setup.py, Package.swift, conanfile.py, project.clj, pom.xml/ivy.xml/build.sbt, .nuspec/.csproj, MODULE.bazel, lakefile.lean/lakefile.toml, *.rockspec, *.nimble, APKBUILD, PKGBUILD, *.spec.

Not populated (format has no self-name field, or the name lives in a sibling file this parser doesn't see): Gemfile, requirements.txt, build.gradle, rebar.config, Dockerfile, Cartfile, .tool-versions, pre-commit config, GitHub Actions workflows, and all lockfiles.

The immediate consumer is git-pkgs/downstream, which needs to read the local package name from whatever manifest is present without a per-ecosystem switch.

andrew added 2 commits July 1, 2026 13:43
Parsers now return *core.Result{Name, Version, Dependencies} instead
of []Dependency, and ParseResult gains Name and Version fields. No
parser fills them yet; this commit is the mechanical signature change
across all internal parsers and their tests so the per-format
name-extraction changes that follow are readable on their own.
Fills the new Result.Name and Result.Version fields for every
manifest format that declares its own package identity: structured
formats read the field from the existing unmarshal struct, code and
DSL formats use a targeted regex, and filename-derived formats
(csproj, nimble) fall back to the basename stem.

TestParseName in manifests_test.go covers 41 fixtures across 35
formats and asserts Gemfile, requirements.txt, and lockfiles stay
empty.
@andrew andrew merged commit bb360a3 into main Jul 1, 2026
5 checks passed
@andrew andrew deleted the self-name branch July 1, 2026 13:44
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.

1 participant