- Make your edits
- Run
moon checkto lint - Run
moon testto verify tests pass - If behavior changed intentionally:
moon test --updateto update snapshots - Run
moon infoto update.mbtiinterface files - Check git diff on
.mbtifiles to verify expected changes - Run
moon fmtto format - If the web interface is affected, rebuild the shared JS artifacts
See Monorepo & Submodules for the full guide on the git submodule setup, daily workflows, and common pitfalls.
Before patching around a design problem locally, check Paying Technical Debt.
The short version:
- fix missing CRDT/parser APIs in the owning submodule,
- keep only one active editor architecture,
- centralize shared logic once,
- isolate any unavoidable workaround in a single helper with a comment naming the missing upstream API.
Before starting medium or large work, decide the canonical tracking surface:
- use Task Tracking for the repo's tracking rules,
- create a plan in
docs/plans/from TEMPLATE.md when the task is non-trivial, - keep
docs/TODO.mdas the short active backlog index.
The parser lives in loom/examples/lambda/. The framework is in loom/loom/. When modifying:
- Check error recovery behavior with malformed input
- Test incremental parsing with loom's test suites
- Benchmark performance with
cd loom/examples/lambda && moon bench --release
The CRDT implementation is split across two modules:
Core CRDT library (event-graph-walker/):
Causal graph (graph ops, eg-walker traversal, version vectors), operation log,
FugueMax sequence CRDT, branch system with merge, and document model.
See event-graph-walker/README.md for the full package map.
Application layer (crdt module):
editor/sync_editor*.mbt- Active editor facade and parser/sync/undo orchestrationeditor/text_diff.mbt- Text diffing utilitieslib/text-change/- Shared leaf contiguous text-change module
The shared lib/text-change/ module is monorepo-local for now. Standalone
packaging for submodules that consume it is a follow-up after the API shape
stops moving.
When adding features, consult:
# From the examples/web/ directory
cd examples/web
npm install
npm run dev # Start development server (http://localhost:5173)
npm run build # Build for production (multi-page: index.html + json.html)
npm run preview # Preview production buildTwo editor pages are available:
- Lambda editor:
http://localhost:5173/— lambda calculus with AST visualization - JSON editor:
http://localhost:5173/json.html— structural JSON editing with tree view
After making changes to MoonBit code that affects the web interface:
# From the repo root
make build-jsOnly create commits when requested by the user. When asked to commit:
- Run
git statusandgit diffto see changes - Review changes and draft commit message
- Add relevant files to staging area
- Create commit with message ending in:
Co-Authored-By: Claude <model> <noreply@anthropic.com> - Run
git statusafter commit to verify
Important:
- Never use
git commit --amendunless user explicitly requests it - Never push unless explicitly requested
- Never use
-iflag (interactive mode not supported)
When creating a pull request:
- Run
git statusandgit diffto understand changes - Check branch divergence from main with
git log - Draft PR summary based on all commits (not just latest)
- Push to remote with
-uflag if needed - Create PR using
gh pr createwith HEREDOC format - Return PR URL
moon build # Build all
moon build --target js # JavaScript build
moon test # Test crdt module
cd event-graph-walker && moon test # Test CRDT library
moon test --update # Update test snapshots
moon coverage analyze > uncovered.log # Coveragemoon fmt # Format code
moon check # Lint code
moon info # Update .mbti interfaces
moon info && moon fmt # Recommended before commit# Always use --release for accurate measurements
moon bench --release
cd event-graph-walker && moon bench --release
# Specific packages
cd loom/examples/lambda && moon bench --release
cd event-graph-walker
moon bench --package causal_graph --release
moon bench --package branch --releaseSee benchmarks documentation for details.