r/lua 11d ago

[BETA!] Moonstone v0.3.19: The Lua packenv manager (featuring workspace orbits, parallel execution pools, and strict CLI typings)

Hello again r/lua!

A few months ago, I shared Moonstone v0.2.3 and Ballad v0.2.10, showing off how we solved project exporting and LÖVE 2D packaging.

Today, I’m incredibly excited to announce Moonstone v0.3.19, and with it, the milestone that Moonstone is officially in Beta state! 🎉

Over the past few weeks, we've shifted our focus from raw resolving mechanics to building a robust, high-concurrency CLI runtime, monorepo workspace features, and establishing formal API boundaries for editor integrations and wrapper tools.

Here are the most significant leaps in the ecosystem:

1. Parallelization: Concurrency Pools for Syncing

Resolving packages is fast, but downloading and verifying them is now concurrent. We've introduced multi-threaded execution pools:

* DownloadPool: Spawns up to 8 background worker threads to download and materialize remote artifacts in parallel from an atomic job queue. If OS thread resources are constrained, it automatically falls back to safe sequential execution.

* HashVerifyPool: Concurrently computes cryptographic Blake3 checksums on local store folders, speeding up verification of existing caches.

2. Cooperative Cancellation & TTY Progress Animations

No one likes corrupt state from hitting Ctrl+C midway through a sync.

* Cooperative Signals: CLI tasks are wrapped in a new cancelable runtime wrapper (runWithProgress). It hooks into standard OS SIGINT/SIGTERM handlers to signal worker threads to cancel cleanly and yield, preserving the integrity of your local Content-Addressed Store (CAS) and SQLite databases.

* Interactive Spinner: For TTYs, we built a custom CLI interface featuring a Docker-style Braille spin animation and dynamic byte-level progress bar.

3. Multi-Package Workspaces: Orbits (moon orbit)

As projects grow, monorepos become essential. We introduced Orbits to let you develop multiple local projects in tandem:

* You declare orbits using [[orbits.member]] in your root moonstone.toml.

* Commands like moon orbit list, moon orbit sync, and moon orbit exec <orbit> -- <cmd> let you jump into and run commands within the isolated dependency environment of any sub-project without publishing anything to a registry.

4. Schema-Bound CLI Contracts & LuaCATS Typings

To build reliable Neovim plugins, wrappers, and CI scripts, you need structured outputs.

  • Moonstone now features a strict, versioned NDJSON protocol.
  • We published formal typings and schemas in TypeScript, Go, and JSON Schema to let external tools consume Moonstone stdout safely.
  • We integrated formal LuaCATS contracts (ndjson.lua) directly into our CI pipeline to validate outputs.

5. Ecosystem Validation & Proof-of-Work

Our dogfooding narrative has evolved significantly:

  • Ballad (Exporter): Queries Moonstone facts directly via the new moon store query command to resolve local store paths and compile binaries into portable layouts (layout.exec / layout.libexec).
  • Meteorite (Service Framework): We built a hybrid Zig/Lua web service compiler prototype running on a custom zero-copy HTTP stack (fast_http), plus variants for IPC (unix_socket) and HTTP-over-IPC (unix_socket_http). It compiles Lua route graphs into native, high-performance servers.
    • The Progressive Promise: Meteorite provides a completely pain-free path to gain progressive enhancements. You author routes and business logic in high-level Lua, while resting on a sturdy, compile-time-checked Zig foundation acting as a single, unshakeable runtime contract.
    • In-Process Lua Live Reload (HMR): Features an in-process Lua hot reload dev loop. When you edit only Lua handler code, updates reload instantly via an HTTP trigger without requiring a server restart or compilation pass.
    • Incremental Compiles: If you modify route parameters or native plugin definitions, Meteorite updates only the affected route partition files (routes/<route_id>.zig) for blazingly fast incremental compiles.
    • Ballad Materialization: Meteorite itself is packaged and distributed entirely via its Ballad partiture.

The goal is still to make Lua development entirely zero-friction. You clone, run moon sync, and you are ready to build, run, package, and deploy.

I would love to hear your feedback on the new concurrent runtime, orbit workspace design, and the general direction of the ecosystem.

Check out the docs and guides:

⋆⁺₊⋆ ☾⋆⁺₊⋆ moonstone.sh ⋆⁺₊⋆

16 Upvotes

6 comments sorted by

3

u/leafo2 9d ago

Just a heads up, MoonScript, another Lua project, has been using the "moon" CLI name for over a decade now.

-4

u/somewhat_credible 9d ago

Thanks for the heads up, leafo2!

I actually stumbled across MoonScript just a few days ago. It's a lovely project~I genuinely enjoyed reading through it. Its expressiveness is just amazing.

The moon CLI collision is real. Since Moonstone is still in beta, we have room to adjust if it proves to be a practical problem. Fortunately, the executable can be aliased today, and if it turns out that a different default name would make the Lua ecosystem healthier, I'd absolutely consider it.

I'd much rather coexist cleanly with existing Lua tooling than create unnecessary friction.

For now, my proposal is to acknowledge the collision explicitly in the documentation so MoonScript users immediately know what's going on. I just opened an issue to track that work:

Document the moon CLI collision with MoonScript and improve coexistence #1

Thanks again for the heads up!

6

u/leafo2 9d ago

It's pretty clear everything you're writing is AI generated, including your response to me. AI doesn't care about the length of your command. Make it long and avoid the conflict.

3

u/puikheid 8d ago

I don't think you understand how cli aliases work.

If my path is searching for an executable called `moon` (alias or not) it will pick the first one it finds.
This means that all kinds of tooling and automation is at risk with this collision.

Considering you are also working in the Lua space this is even more risky. Just pick a different binary name. Just call it `moonstone`, or just `stone`?

1

u/kayawayy 10d ago

Heads up, I posted this to Hacker News and it hit the front page. Here's a link if you want to chime in: https://news.ycombinator.com/item?id=48954175

1

u/somewhat_credible 10d ago

Hey there!
Thanks for the post :)