sigildocs

(sigil deps semver)

(sigil deps semver) - Semantic Versioning

Parses semver version strings and resolves version range constraints against lists of available versions (from git tags).

Range syntax (Cargo-style for pre-1.0): "^0.9.0" → >=0.9.0, <0.10.0 (caret = minor-compatible) "^1.2.3" → >=1.2.3, <2.0.0 (caret = major-compatible for >=1.0) "~0.9.0" → >=0.9.0, <0.9.1 (tilde = patch only) "~1.2.3" → >=1.2.3, <1.3.0 (tilde = minor-compatible for >=1.0) "0.9.0" → =0.9.0 (exact match) "*" → any version

Exports

parse-semverprocedure

Parse a semver string into a list of three integers. Returns (major minor patch) or #f if invalid. Handles optional "v" prefix: "v1.2.3" → (1 2 3)

Parse a version range string into a range record. Returns (min-version . max-version) where both are semver lists, or 'any for wildcard, or #f if invalid. min is inclusive, max is exclusive.

Check if a version satisfies a range.

tag->versionprocedure

Strip "v" prefix from a tag to get a version string.

version->tagprocedure

Add "v" prefix to a version string.

Resolve a version range against a list of git tags. Returns the tag string for the highest matching version, or #f if no match found.

Find the highest semver version from a list of git tags. Returns the tag string for the highest version, or #f if none valid.

Bump a version range string to target a new version. Preserves the range operator (^, ~, or exact). Examples: (bump-version-range "^0.8.0" "0.9.1") → "^0.9.1" (bump-version-range "~1.2.0" "1.3.5") → "~1.3.5" (bump-version-range "0.8.0" "0.9.1") → "0.9.1" (bump-version-range "" "0.9.1") → ""

Check if two version ranges can be satisfied by a single version. Returns #t if compatible, #f if conflicting.

Check if two resolved versions for the same package conflict. Returns #f if they're the same, or a conflict description string.