Common Unix command-line utilities implemented in MoonBit for policy-controlled execution.
This repository is one MoonBit module, mooxCLI/cmd. Every command is an
executable package directly below the repository root, so a package is selected
as mooxCLI/cmd/<command>.
The source tree contains 48 executable command packages:
- 20 commands migrated from the fixed upstream
moonbit-jq/cmdsnapshot. - 12 read-only commands in Batch 1.
- Eight filesystem mutation commands in Batch 2.
- Eight restricted commands in Batch 3:
env,xargs,timeout,sh,make,curl,wget, andchmod.
The first 20-command release is mooxCLI/cmd@0.1.0. The expansion batches are
implemented and tested in this repository; they are not represented as a new
published release by this change.
chown and kill are intentionally absent. Their required owner-mutation and
arbitrary-process-signalling primitives are outside the current package scope.
cmd/
|-- moon.mod # name = "mooxCLI/cmd"
|-- cat/
| |-- moon.pkg # executable package mooxCLI/cmd/cat
| |-- main.mbt
| `-- README.md
|-- internal/
| |-- fsops/ # private filesystem helpers
| |-- netops/ # private network helpers
| `-- shell/ # private shell parsing helpers
|-- tests/
| |-- cram/ # command behavior tests
| `-- policy/ # policy behavior tests
`-- docs/
There is one root moon.mod; command directories do not contain independent
modules. Generated pkg.generated.mbti files are committed and regenerated by
moon info.
Commands use MoonBit implementations and policy-visible runtime APIs. They do
not invoke a same-named command to implement their behavior. The sh and
make packages parse and execute bounded language subsets in MoonBit; they may
start individual commands only through the process API, never a complete script
through another interpreter.
The default target is Wasm, and packages that declare native+wasm are checked
on both targets. Commands with process, network, or permission-mutation access
are kept in the restricted Batch 3 set until their policy behavior is
explicitly tested.
The jq and jqlog entry points depend on the external
bobzhang/moonjq@0.1.1 module. This dependency does not change the public
package coordinates, which remain mooxCLI/cmd/jq and mooxCLI/cmd/jqlog.
The validation suite covers formatting, generated interfaces, all supported MoonBit targets, command-line behavior, and policy-controlled resource access:
moon update
moon check --target all --deny-warn
moon info
moon fmt
moon test --target all
moon cram test tests/cram TUTORIAL.md
sh tests/policy/check-wasm-policy.sh
sh tests/policy/check-third-batch-policy.shWhen adding a command, include its executable moon.pkg, implementation,
README, generated interface, Cram cases, target declaration, and policy
admission status. Cover normal and invalid arguments, stdin, missing paths,
binary or large input where applicable, and denied side effects for operations
that mutate external resources.
The module coordinate is mooxCLI/cmd, and all executable packages share one
module version. The initial mooxCLI/cmd@0.1.0 release is published. A later
release must pass the complete validation suite and explicitly document the
commands included in that release.
Licensed under the Apache License, Version 2.0.