3.4 KiB
TrapOS
A small in-game operating system for ComputerCraft / CC:Tweaked, built around a single-threaded event loop and a routed networking layer.
Installation
Install ccpm first. This is the only step that needs wget with a URL:
wget run https://raw.githubusercontent.com/guillaumearm/cc-libs/master/install-ccpm.lua
Then sync the default registry (guillaumearm/cc-libs) and install TrapOS:
ccpm update
ccpm install trapos
Install individual packages instead if you want to cherry-pick:
> ccpm install tos-net
> ccpm install tos-ui
Install ccpm from the beta branch (one-time opt-in, asks for confirmation):
wget run https://raw.githubusercontent.com/guillaumearm/cc-libs/next/install-ccpm.lua --beta
Once ccpm is installed from beta, the default registry tracks next; ccpm update and ccpm upgrade keep using that branch.
After install, every boot shows a colored MOTD with the installed version and branch (lime for stable, orange + [BETA] for beta).
Packages
TrapOS is split into packages, each described by a packages/<name>/ccpm.json:
tos-core: the package manager (ccpm), event loop,upgrade,events.tos-test: the test framework (libtest) and suite runner (runtest).tos-boot: the startup MOTD and autostart server launcher.tos-net: routed modem networking (net,router,ping,ping-server).tos-ui: the terminal UI toolkit (libtui,tuidemo).trapos: full TrapOS meta-package (tos-boot,tos-net,tos-ui, andtos-testduring beta).
The trapos meta-package is the user-facing full install. Package descriptors list
files and autostart servers; installed state is tracked under /trapos.
ccpm
ccpm is the TrapOS package manager. install-ccpm.lua installs it by installing
the required tos-core package and configures the default registry
(guillaumearm/cc-libs).
ccpm install <package> ccpm reinstall <package> ccpm uninstall <package>
ccpm update ccpm upgrade
ccpm ls ccpm available [term] ccpm search [term]
ccpm info <package>
ccpm registry ls ccpm registry add <name> [--branch <b>] [--type github|http]
ccpm registry rm <name>
ccpm update fetches registry package indexes into /trapos/ccpm.cache.json.
ccpm available lists cached packages and marks installed packages as up-to-date or
updatable. ccpm upgrade upgrades installed packages based on that cache.
Registries default to GitHub (owner/repo); http/https base URLs are also
supported. State lives in /trapos/ccpm.json (registries),
/trapos/ccpm.lock.json (installed packages), and /trapos/ccpm.cache.json
(available packages). See ADR-0010.
APIs
/apis/eventloop: a simple event loop API./apis/net: an API to simplify sending and receiving routed messages, based on theeventlooplibrary.
Servers
Servers listed in manifest.autostart are launched at boot by startup/servers.lua.
/servers/ping-server: allows a machine to respond to apingcommand.
Programs
router: routes messages. You need to set up a router to use allapis/net-based programs and libraries.ping: pings machines usingapis/net.events: emits and logs computer events.upgrade: alias forccpm upgrade.
Development
See DEVELOPMENT.md for development setup and workflow.