MoonDepSolve is a MoonBit library and native CLI for semantic versions, deterministic dependency resolution, lock output, dependency graphs, conflict reports, and exact upgrade planning.
- GitLink: https://gitlink.org.cn/python123/moondepsolve
- GitHub: https://github.com/python123-ops/moondepsolve
- Product site source:
site/index.html - Module:
python123-ops/moondepsolve - Maintainer identity:
python123 <python123@users.noreply.gitlink.org.cn>
MoonBit ecosystem tools need a small, reviewable dependency core: parse versions, match version ranges, choose compatible package versions, explain conflicts, and write stable lock output. MoonDepSolve keeps that boundary narrow so it can be reused by package managers, build tools, dependency audits, and release automation.
The maintained module is now python123-ops/moondepsolve, matching the current Mooncakes account. The earlier python123/moondepsolve@0.3.1 package remains available under its original owner; it cannot be updated using the current account. Version 0.4.0 carries the maintenance fixes from 0.3.2 into the new namespace.
moon add python123-ops/moondepsolve@0.4.0Replace the old module path in your package imports:
import {
"python123-ops/moondepsolve",
}The package alias remains @moondepsolve, so API calls keep the same names. Existing users should remove the old python123/moondepsolve dependency after replacing its imports. The earlier GitHub releases and competition documents retain their original namespace as historical records.
- Updated for MoonBit
0.10.19+97801ee1b(2026-10-30) andmoonbitlang/async@0.22.7. - Made the existing equality methods explicit to keep strict compiler checks passing.
- Fixed numeric overflow, leading zeroes, malformed prerelease identifiers, large numeric prerelease ordering, and exact requirements containing
xin prerelease names. - Added range-bound overflow checks and regression tests. All four stable backends pass: 35 tests each on Wasm, Wasm GC, and JavaScript, and 39 on native.
- Added a cross-platform CLI check for four byte-for-byte outputs and three failure cases; CI runs on Linux and Windows with a pinned toolchain.
- Reduced the Mooncakes archive to source, tests, examples, metadata, and license notices through
.moonignore.
HighestCompatiblechooses the highest compatible package set through the existing resolver.MinimalChangesearches bounded candidate states, first minimizing changed packages and then preferring higher versions for deterministic ties.UpgradePlanreports stable add, remove, upgrade, and downgrade changes with the targetResolution.- The native CLI reads registry and lock files, then emits lock output, a text dependency graph, or Graphviz DOT.
- Four example-driven CLI checks compare real file outputs byte for byte.
v0.3 is additive. Existing v0.1/v0.2 APIs for version parsing, requirement matching, resolution, lock output, dependency graphs, and conflict reports remain available.
Use MoonBit 0.10.19+97801ee1b or a compatible newer toolchain. The pinned version is tested in CI; older toolchains may not understand the updated async dependency's package configuration.
Default backend:
python scripts/check_contributor_identity.py --ref HEAD
moon info
moon fmt --check
moon check --deny-warn
moon test --target all --deny-warn
moon run cmd/main --deny-warnNative CLI path, on a machine with a C compiler:
moon check --target native --deny-warn
moon test --target native --deny-warn
python scripts/check_cli.pyConflictReport.package_name replaces the earlier package field so OSC2026 quality gates can run with --deny-warn and no reserved-keyword suppression. Formatted reports still print package: ... for stable CLI output.
Versions use major.minor.patch with an optional -prerelease. Core components range from 0 to 2147483647 and reject leading zeroes. Prerelease identifiers follow the SemVer identifier and precedence rules; numeric prerelease identifiers can exceed the core component limit. Build metadata (+build) is not supported by the current Version type.
Requirements support exact versions, ^major.minor.patch, ~major.minor.patch, space-separated comparators, and patch wildcards such as 1.2.x, 1.2.X, or 1.2.*. A generated upper bound must fit the core component range. Matching applies the comparators directly, including to prereleases; it does not add npm-style prerelease exclusion. OR expressions, hyphen ranges, and bare * are not supported.
Registry rows use name version | dependency:requirement:
app 1.1.0 | core:^1.1.0, logging:1.0.x
core 1.2.0
logging 1.0.0
Resolve and print a lock:
moon run cmd/cli --target native -- \
resolve \
--registry examples/registry.txt \
--root 'app:^1.0.0' \
--format lockPlan from an existing lock:
moon run cmd/cli --target native -- \
plan \
--registry examples/registry.txt \
--lock examples/current.lock \
--root 'app:^1.0.0' \
--strategy minimal \
--max-states 100000Expected minimal-change output starts with:
strategy: minimal-change
changes: 0
target lock:
# MoonDepSolve lock
app 1.0.0
core 1.0.0
logging 1.0.0
Use --strategy highest to generate a highest-compatible upgrade plan. --max-states must be positive; if the bound is exhausted, MoonDepSolve returns SearchLimitExceeded instead of pretending it found an optimum.
| Capability | Public API |
|---|---|
| Versions | parse_version, format_version, compare_version |
| Requirements | parse_req, matches |
| Resolution | resolve |
| Registry and lock | parse_registry, format_lock, parse_lock |
| Base errors | format_error |
| Dependency graph | build_dependency_graph, format_graph_text, format_graph_dot |
| Conflict report | build_conflict_report, format_conflict_report |
| Upgrade planning | default_upgrade_options, plan_upgrade, format_upgrade_plan, format_upgrade_error |
Exact signatures are tracked in pkg.generated.mbti.
- This maintenance release is maintained on GitHub. GitLink retains the earlier competition history.
- CI runs contributor identity checks, interface drift checks, formatting, diagnostics, all stable backend tests, native file CLI regressions, and package validation on Linux and Windows.
- The OSC2026 materials are in
docs/competition, including the one-page proposal PDF, demo script, release notes, and acceptance checklist. - License and dependency notices are in LICENSE and THIRD_PARTY_NOTICES.md.
Mooncakes package and API documentation: python123-ops/moondepsolve@0.4.0. Publication status and downloadable archives are tracked in the GitHub release.
MoonDepSolve is released under the Apache License 2.0.