[EXPERIMENTAL] Virtual POSIX layer for MoonBit - in-memory filesystem, process emulation, and git-backed versioning for WASM
Dependencies
WARNING: This library is highly experimental. APIs will change without notice. Do not use in production.
┌─────────────────────────────────────────────┐
│ Your App / AI Agent │
├─────────────────────────────────────────────┤
│ @gitfs - Git-versioned virtual FS │
│ @fs - Pluggable filesystem backend │
│ @posix - fd, env, cwd emulation │
│ @proc - Cooperative process scheduler │
│ @net - Virtual network / HTTP │
│ @wasm - WASM module execution │
│ @capability - Permission control │
├─────────────────────────────────────────────┤
│ MemFs (in-memory) │
└─────────────────────────────────────────────┘moon add mizchi/moonixcd ~/ghq/github.com/mizchi/moonix
just install
moonix run dist/your.component.wasm --invoke 'run()'// Create a git-versioned in-memory filesystem
let gfs = @gitfs.GitBackedFs::new(author="user <user@example.com>")
// Write files — just like a normal filesystem
gfs.write_file("/src/main.mbt", b"fn main { println(\"hello\") }")
// Snapshot creates a git commit internally
let snap = gfs.snapshot("initial commit")
// Modify and snapshot again
gfs.write_file("/src/main.mbt", b"fn main { println(\"world\") }")
let snap2 = gfs.snapshot("update message")
// Rollback to any previous snapshot
gfs.rollback(snap)
// Branch and switch
gfs.branch("feature")
gfs.switch("feature")| Package | Description |
|---|---|
| @fs | FileSystemBackend trait + MemFs (in-memory inode-based filesystem) |
| @gitfs | GitBackedFs — git-versioned filesystem using mizchi/bit |
| @bitfs_adapter | Adapter: bit's x/fs → moonix FileSystemBackend |
| @posix | POSIX emulation (file descriptors, env, cwd) |
| @proc | Cooperative process scheduler, signals, semaphores |
| @net | Virtual socket layer, HTTP parsing |
| @wasm | WASM module execution with capability control |
| @capability | Capability-based permission system |
| @sh | Shell parser and AST |
[EXPERIMENTAL] Virtual POSIX layer for MoonBit - in-memory filesystem, process emulation, and git-backed versioning for WASM
Dependencies