ludic remove <module> and ludic get --json (R9)

remove is the inverse of add: the require line leaves package.ludic; the lock keeps exactly what the
remaining requires still reach, read from the store's copy of each locked package.ludic (no
network), so a package another still requires stays locked and what only the removed one brought in
leaves with it; each leaving package loses the ludic_modules/ symlink add made, never the shared
store entry. Refused (exit 1) when package.ludic does not require the module; source still
importing a removed package is a warning. With no store copy to read, only the named module leaves.

get --json diffs the lock before and after in memory and prints {added, removed, changed,
unchanged} on stdout (an entry as the lock records it: name, version, hash, kind, provides; a change
as name, from, to, from_hash, to_hash), the resolver's lines on stderr. Cases added to test-pkg,
not run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-30 00:24:49 +03:00
parent 047bdf4189
commit 320ce42626
10 changed files with 341 additions and 10 deletions

View file

@ -25,6 +25,8 @@ program Ludic {
import "split.ludic"
import "project.ludic"
import "pkg.ludic"
import "pkg_lock.ludic"
import "pkg_remove.ludic"
import "assets.ludic"
import "packignore.ludic"
import "pack.ludic"
@ -59,7 +61,9 @@ program Ludic {
print("")
print("packages:")
print(" add <module>[@version] add a dependency, then resolve + fetch + link")
print(" get resolve every package.ludic dependency and write the lock")
print(" remove <module> drop a dependency: its require, what only it locked, its ludic_modules/ link")
print(" get [--json] resolve every package.ludic dependency and write the lock")
print(" (--json: what changed in the lock, as a JSON object on stdout)")
print(" update [module] bump a dependency (or all) to its latest published version")
print(" verify check every locked package against the store by content hash")
print(" vendor copy the resolved packages into ./vendor for offline builds")
@ -124,6 +128,7 @@ program Ludic {
if (cmd == "add") { return cmd_pkg_add() }
if (cmd == "get") { return cmd_pkg_get() }
if (cmd == "remove") { return cmd_pkg_remove() }
if (cmd == "update") { return cmd_pkg_update() }
if (cmd == "verify") { return cmd_pkg_verify() }
if (cmd == "vendor") { return cmd_pkg_vendor() }