13. Sharing code
Because a hash identifies code completely, sharing a codebase means sending only the hashes the other side lacks, and running code remotely means sending its missing closure.
13.1 Remotes
ucm remote add <name> <url|dir> [--token t] [--fingerprint sha256] adds a ucm serve URL or another codebase
directory. ucm remote lists them; ucm remote rm <name> removes one.
13.2 Push and pull
- Sync is by hash: only components the other side lacks are sent.
ucm pull [remote] [branch]mirrors into<remote>/<branch>(e.g.origin/main). It fast-forwards your branch if you haven't changed it, and merges otherwise.ucm push [remote] [--as branch] [--force]sends definitions plus this branch's names. It refuses if the remote moved since your last sync, unless--force.- Pushing to a server running
ucm startdeploys (production).
13.3 Serving a codebase
ucm serve [--port 7737] [--host 127.0.0.1] [--token t] [--no-run] [--tls [--tls-cert f --tls-key f]] [--insecure] serves the codebase over HTTP(S).
- A token is required. Clients with it can push, pull and, unless
--no-run, run code. --tlsuses--tls-cert/--tls-key, or a self-signed certificate it creates, and prints the certificate's fingerprint. Clients pin it withucm remote add … --fingerprint, and the token is only written after the pin checks out.- Serving beyond localhost without TLS is refused unless
--insecure.
13.4 Running remotely
ucm run <name> [args] --on <remote|url|dir> sends the definition's missing closure, runs it there, and
streams stdout/stderr back.
13.5 Sync never trusts the sender
Received definitions are checked before anything is stored:
- each component must arrive complete;
- every reference must resolve;
- rendering, typechecking (under each definition's recorded check profile) and hashing locally must reproduce the claimed hashes.
Dependencies and signatures are recomputed locally. Nothing received is executed during checking, and npm
installs use --ignore-scripts. Tampered source sent under an existing hash is rejected; sync.test.ts checks
this.
built from 5890e54f