Legion CLI compiles to a single Bun binary for easy distribution.
# Run in development mode
bun run dev
# Run with parameters
bun run dev -- help
bun run dev -- run "implement feature"
# Build single binary
cd packages/opencode
bun run script/build.ts --single --skip-install
# Check binary size
du -h dist/*/*/bin/Legion
# From root (all packages)
bun turbo typecheck
# From packages/opencode/
bun run typecheck
# From packages/opencode/
bun test
# Single test
bun test ./test/tool/tool.test.ts
# From root
bun run lint
dist/
├── @legion/
│ └── cli/
│ └── bin/
│ └── Legion # Single Bun binary
└── ...
The build script (script/build.ts) handles:
# Full build
bun run script/build.ts
# Single binary
bun run script/build.ts --single
# Skip dependency install
bun run script/build.ts --skip-install
# Development build
bun run script/build.ts --dev
Some code is auto-generated:
# From root
./script/generate.ts
# From packages/opencode/
bun run script/generate-ecc.ts
bun run script/generate-ponytail.ts
# .github/workflows/build.yml
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- run: bun install
- run: bun turbo typecheck
- run: bun run script/build.ts --single
# 1. Update version
npm version patch|minor|major
# 2. Create changeset
bunx changeset add
# 3. Build
bun run script/build.ts --single
# 4. Publish
npm publish
windowsHide: true for subprocess calls# Clean build
rm -rf dist
rm -rf node_modules
bun install
bun run script/build.ts --single
# Check what's included
bun run script/build.ts --analyze
# Exclude debug info
bun run script/build.ts --production
# Reinstall
bun install
# Check dependencies
bun run script/check-dependencies.ts
bun run dev - Fast iteration