feat(pkg): package manager — fetch + MVS resolve + namespace registration (#63)
All checks were successful
bootstrap / cfree-fixpoint (push) Successful in 17s
ci / build-and-test (push) Successful in 1m33s
commit-lint / conventional-commits (push) Successful in 2s
docs / build-and-deploy (push) Successful in 25s

Implements the v1 direction decided in the RFC as a set of `x` subcommands
plus a small, contained compiler change.

  * URL-as-identity, no registry — a dependency is named by its git import
    path and a `git tag vX.Y.Z` publishes a version.
  * Minimum Version Selection — a `require` is a minimum; the resolver picks
    the greatest required minimum per module, then the reachable closure at
    those versions. Deterministic, no SAT solver (tools/x/pkg.ludic).
  * Content-addressed global store + per-project links — packages live once in
    ~/.ludic/store keyed by a content hash; each project links them under
    ludic_modules/. package.ludic (manifest) + package.lock.ludic (lock).
  * Namespace registration for source packages via a module-root import
    fallback in the compiler: do_import resolves a non-local, non-absolute
    import under $LUDIC_MODULES (default ludic_modules/), so a fetched
    package's Ludic compiles into the consumer the way the built-in stdlib
    does. Collisions and missing prebuilt targets are hard errors.

Commands: x add / x get / x update / x verify / x vendor. New hermetic suite
`x test-pkg` (stands up throwaway git repos, offline) is gated inside `x test`.

Existing programs compile byte-for-byte identically (the import fallback only
fires when the local path is absent); the C-free bootstrap fixpoint holds and
the seed is regenerated. Full suite: 87 passed, package suite: 12 passed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-01 07:08:12 +03:00
parent 237e13c95e
commit 2c44bae496
10 changed files with 17409 additions and 16387 deletions

View file

@ -23,6 +23,8 @@ program X {
import "docgen_gen.ludic"
import "docgen_check.ludic"
import "release.ludic"
import "pkg.ludic"
import "pkg_test.ludic"
function usage() -> void {
print("x — the Ludic task runner (run from the repository root)")
@ -35,8 +37,16 @@ program X {
print(" x tools [--install] [--test] build the editor toolchain (ludic-fmt, ludic-lsp)")
print(" x clean remove build/ (incl. build/out.ppm) and stray artifacts (keeps bin/)")
print("")
print("packages (issue #63 — MVS resolution, content-addressed store, ludic_modules/ links):")
print(" x add <module>[@version] add a dependency to package.ludic, then resolve + fetch + link")
print(" x get resolve every package.ludic dependency, link them, write the lock")
print(" x update [module] bump a dep (or all) to its latest published version, then relock")
print(" x verify check every locked package against the store by content hash")
print(" x vendor copy the resolved packages into ./vendor for offline builds")
print("")
print("test:")
print(" x test the full regression suite")
print(" x test-pkg the package-manager suite (hermetic git repos, offline)")
print(" x test --coverage per-file line coverage over the test specs")
print(" x selfhost-test the self-hosting suite (correctness + bootstrap fixpoints)")
print(" x test-tools the editor-toolchain suite")
@ -106,6 +116,12 @@ program X {
if (arg_count() < 5) { err("usage: x game-build <ludicc> <game.ludic> <out>\n"); exit(1) }
exit(cmd_game_build(arg(2), arg(3), arg(4)))
}
if (cmd == "add") { exit(cmd_pkg_add()) }
if (cmd == "get") { exit(cmd_pkg_get()) }
if (cmd == "update") { exit(cmd_pkg_update()) }
if (cmd == "verify") { exit(cmd_pkg_verify()) }
if (cmd == "vendor") { exit(cmd_pkg_vendor()) }
if (cmd == "test-pkg") { exit(cmd_test_pkg()) }
if (cmd == "version") or (cmd == "--version") or (cmd == "-v") { exit(cmd_version()) }
if (cmd == "release") { exit(cmd_release()) }
if (cmd == "help") or (cmd == "--help") or (cmd == "-h") { usage(); exit(0) }