Skip to content

Bug: Package.swift dependencies using a range operator, name: first, or a registry id: are dropped #589

Closed

Description

@vibgrate-team

Context

parsePackageSwift in src/core-open/scanners/swift-scanner.ts only matches .package(url: "...", ... from|exact|upToNextMajor|revision|branch: "..."). These valid SwiftPM forms produce no row at all:

.package(url: "https://github.com/apple/swift-argument-parser", "1.2.0"..<"2.0.0"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", "1.10.0"..."1.17.0"),
.package(name: "Kingfisher", url: "https://github.com/onevcat/Kingfisher.git", from: "7.0.0"),
.package(id: "mona.LinkedList", from: "1.0.0"),

So the scan under-reports Swift dependencies, and they never reach vg sbom export.

What to do

  • Accept ..< and ... ranges (record the lower bound as the spec), the older name:-first argument order, and registry id: dependencies.
  • Keep local .package(path:) dependencies out (or handle them deliberately).
  • Add unit tests for each form.

Acceptance

  • Each example above yields one dependency row with a sensible currentSpec.
  • Existing from: / exact: / .upToNextMajor(from:) forms are unchanged.
  • Tests cover every form.

Activity

  1. added
    bug
    on Nov 4, 2026
  2. vibgrate-team commented on Nov 4, 2026

    @vibgrate-team
    ContributorAuthor

    Confirmed: parsePackageSwift in src/core-open/scanners/swift-scanner.ts only matches .package(url: ..., from|exact|upToNextMajor|revision|branch: ...), so range operators, name:-first calls and registry id: dependencies are dropped.

    Rather than one larger regex, it may be simpler to find each .package( call, take its argument text up to the matching ), and then pull url: or id:, an optional name:, and the version from a range ("a"..<"b" or "a"..."b", using the lower bound) or a labelled form. Local .package(path:) can be skipped explicitly. A test per form in the issue would cover it well.

  3. added a commit that references this issue on Nov 5, 2026
    12bf7a6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions