Build with current MoonBit toolchain

Migrate to moon.mod/moon.pkg, update suberror and Json construction
syntax, import @json, annotate FFI params #borrow, and clear all
deprecation warnings. Builds cleanly, tests pass, and the CLI was
smoke-tested against a local registry:2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hhm28fFg1zAegJABvu
This commit is contained in:
Claude committed 2026-11-27 01:33:28 +00:00
1 parent efeaa326c8
commit 5a91e87d64
11 files changed
+236 -131

No files matched your search

+5 -4
View File
@@ -35,7 +35,7 @@ fn cmd_init(registry : String, plain_http : Bool) -> Unit raise OrbitError {
)
write_text_atomic(
root + "/config.json",
config_to_text(Config::{ registry, plain_http }),
config_to_text(Config::{ registry, plain_http, }),
)
println("orbit root: \{root}")
println("registry: \{registry}")
@@ -44,7 +44,7 @@ fn cmd_init(registry : String, plain_http : Bool) -> Unit raise OrbitError {
}
///|
fn need(pos : Array[String], n : Int, what : String) -> Unit raise OrbitError {
fn need(pos : Array[String], n : Int32, what : String) -> Unit raise OrbitError {
if pos.length() < n {
raise OrbitError("usage: orbit \{what}")
}
@@ -75,7 +75,7 @@ fn dispatch(args : Array[String]) -> Unit raise OrbitError {
"env" => println("export PATH=\"\{orbit_root()}/bin:$PATH\"")
"publish" => {
need(pos, 1, "publish <dir>")
publish(load_ctx(), pos[0], not(flags.contains("--no-latest")))
publish(load_ctx(), pos[0], !(flags.contains("--no-latest")))
}
"install" | "add" => cmd_install(load_ctx(), pos)
"remove" | "rm" => cmd_remove(load_ctx(), pos, flags.contains("--force"))
@@ -93,7 +93,8 @@ fn dispatch(args : Array[String]) -> Unit raise OrbitError {
need(pos, 1, "versions <name>")
cmd_versions(load_ctx(), pos[0])
}
"search" => cmd_search(load_ctx(), if pos.length() > 0 { pos[0] } else { "" })
"search" =>
cmd_search(load_ctx(), if pos.length() > 0 { pos[0] } else { "" })
"gc" => cmd_gc(load_ctx())
_ => raise OrbitError("unknown command '\{cmd}' (try `orbit help`)")
}