Bridge CLI
Command-line interface for the BridgeRust framework - write Rust once, deploy to Python and Node.js.
Website: bridgerust.dev
Installation
Or from the workspace root:
Commands
bridge init <name>
Initialize a new BridgeRust project with the proper structure.
This creates:
Cargo.tomlwith proper dependenciessrc/lib.rswith example functionsbridgerust.tomlconfiguration filepython/pyproject.tomlfor Python packagingnodejs/package.jsonfor Node.js packagingREADME.mdwith usage instructions
bridge integrate [--example]
Integrate BridgeRust into an existing Rust project.
# Integrate into current project
# Integrate and add example code
# Skip prompts
This command:
- Updates
Cargo.tomlwith BridgeRust dependencies and features - Creates
bridgerust.tomlconfiguration file - Creates
python/andnodejs/directories - Generates
python/pyproject.tomlandnodejs/package.json - Optionally adds example code to
src/lib.rs
Note: This command reads your existing Cargo.toml to get project name, version, and description. It won't overwrite existing files unless you confirm.
bridge build [--target <target>] [--release]
Build Python and/or Node.js bindings.
# Build for all targets (in parallel)
# Build only Python
# Build only Node.js
# Build in release mode
Note:
- When building all targets (
--all), Python and Node.js builds run in parallel for faster builds. - Build caching is enabled for debug builds (not
--release). The CLI checks source file timestamps and skips rebuilds when nothing has changed.
bridge test [--target <target>]
Run tests for Rust, Python, and/or Node.js.
# Test all targets
# Test only Python
# Test only Node.js
# Test only Rust
Note:
- Python tests use
pytest(must be installed:pip install pytest) - Node.js tests use
npm testif available, otherwise runs test files directly withnode - Rust tests use
cargo test - The command automatically finds test files in common locations
bridge publish [--target <target>] [--dry-run]
Publish packages to PyPI and/or npm.
# Publish to all registries
# Dry run (test without publishing)
# Publish only Python
# Publish only Node.js
Note:
- The command runs pre-publish validation checks before publishing
- Requires
maturinfor Python publishing (install with:pip install maturin) - Requires
npmfor Node.js publishing - Uses real-time output so you can see publish progress
- In dry-run mode, packages are validated but not uploaded
bridge workflows [--output <dir>]
Generate CI/CD workflow files for GitHub Actions.
# Generate workflows in default location (.github/workflows)
# Generate workflows in custom location
This command generates:
- CI workflow (
ci.yml): Runs on every push and PR- Rust tests (format, clippy, unit tests)
- Python tests (Python 3.10, 3.11, 3.12)
- Node.js tests (Node.js 20, 22)
- Release workflow (
release.yml): Runs on version tags- Builds all targets in release mode
- Publishes to PyPI and npm (requires secrets)
Note:
- After generating, add
PYPI_API_TOKENandNPM_TOKENsecrets to your GitHub repository - Optionally create a
publishenvironment for manual approval before publishing
bridge check [--verbose]
Validate project structure, configuration, and code without building.
# Check project
# Check with verbose output
This command verifies:
- Project structure (Cargo.toml, src/lib.rs, etc.)
- Configuration files (bridgerust.toml)
- Dependencies and features in Cargo.toml
- Source code for bridgerust usage (counts exports, checks for common issues)
- Python and Node.js setup
- Code compilation (cargo check)
Note:
- Use
--verboseto see detailed information about configuration and source code analysis - The command counts
#[export]and#[error]macro usage - In verbose mode, shows real-time compilation output
bridge clean [--target <target>] [--cache]
Clean build artifacts and optionally the build cache.
# Clean all build artifacts
# Clean specific target
# Clean build cache
# Clean everything including cache
This command removes:
- Python wheels and dist directories
- Node.js native modules and type definitions
- Build cache (if
--cacheis specified)
Note: For Rust build artifacts, use cargo clean for more control.
bridge watch [--target <target>] [--test]
Watch for file changes and automatically rebuild (and optionally test) when files are modified.
# Watch all targets
# Watch only Python
# Watch and run tests after each build
# Watch Node.js with tests
Features:
- Automatically watches
src/directory for.rsfile changes - Watches
Cargo.toml,pyproject.toml, andpackage.jsonfor config changes - Debounces file changes (500ms) to avoid excessive rebuilds
- Uses
maturin developfor Python (faster development builds) - Shows real-time build output
- Press Ctrl+C to stop watching
Note:
- This command is ideal for active development
- Python builds use
maturin developwhich installs the package in development mode - Node.js builds use
npm run build(make sure your package.json has a build script)
Configuration
BridgeRust uses a bridgerust.toml file for project configuration:
[]
= "my-project"
= "0.1.0"
= "My awesome project"
= ["Your Name"]
[]
= "my_project"
[]
= "@bridgerust/my-project"
Examples
See the examples directory for complete examples of BridgeRust projects.