CodeBridge CLI
A powerful local server that enables LLM-driven code automation with intelligent build detection, git operations, and script execution capabilities.
π New Features
β¨ Smart Build Detection
Automatically detects your project type and uses the appropriate build command:
- Rust (Cargo.toml) β
cargo check - Node.js (package.json) β
npm run build - Python (requirements.txt) β
python -m py_compile - Documentation (mostly .md files) β No build needed
- Unknown β No build attempted
No more "could not find Cargo.toml" errors on documentation projects!
π§ Git Repository Initialization
New GitInit action allows the LLM to initialize git repositories on-demand. No more manual setup required.
π― Script Execution (Experimental)
Execute custom scripts in multiple languages for complex automation:
- Deno: TypeScript/JavaScript with secure defaults
- Python: General-purpose scripting
- Bash: Shell automation
- Rust: Compiled scripts (coming soon)
Security Features:
- Sandboxed execution (filesystem restricted to project)
- Timeout enforcement (30s default)
- No network access by default
- Resource limits
π¦ Installation
Prerequisites
- Rust 1.70+ (for building)
- Git 2.0+ (for git operations)
- Deno 1.30+ (optional, for script execution)
- Python 3.8+ (optional, for script execution)
Build from Source
Run
π§ Configuration
CLI Options
| Flag | Default | Description |
|---|---|---|
--port |
3000 |
HTTP server port |
--workspace |
../codebridge-workspace |
Root directory for projects |
--build-command |
auto |
Build command (use auto for detection, none to disable) |
--allowed-commands |
npm,cargo,python |
Comma-separated list of allowed shell commands |
--enable-script-execution |
false |
Enable LLM script execution |
--script-languages |
deno,python |
Allowed script languages |
--script-timeout |
30 |
Script execution timeout (seconds) |
Examples
Rust-only environment:
Documentation project:
Full automation mode (with script execution):
π‘ API Reference
Endpoints
POST /execute
Execute a series of actions and optionally run a build.
Request:
Response:
π¬ Action Types
File Operations
readFile
writeFile
deleteFile
createDirectory
listDirectory
Git Operations
gitInit π
Initialize a git repository.
gitStatus
gitAdd
gitCommit
gitPush
gitDiff
Script Execution π
runScript
Execute custom scripts in supported languages.
Deno Example (TypeScript):
Python Example:
Bash Example:
Response:
π Security
Filesystem Isolation
All file operations are restricted to the project directory. Path traversal attempts (../../../etc/passwd) are blocked.
Script Sandboxing
Scripts executed via runScript:
- Cannot access files outside the project directory
- Cannot make network requests (unless
--enable-networkflag is set) - Have a timeout (default 30 seconds)
- Run with limited privileges (no sudo/root)
Git Operations
Git push requires SSH key authentication configured on the host system.
π§ͺ Testing
Run Tests
Manual Testing
Test 1: Smart Build Detection
# Create a docs-only project
# Send execute request (should skip build)
# Expected: buildOutput should be null
Test 2: Git Initialization
# Expected: success with "Git repository initialized"
Test 3: Script Execution
# Expected: success with stdout containing "Hello from Python!"
π Troubleshooting
Issue: "Not a git repository" error
Solution: Use the GitInit action before other git operations.
Issue: "could not find Cargo.toml" on docs project
Solution: Set --build-command none or use auto (default). The system should automatically detect documentation projects and skip builds.
Issue: Script execution timeout
Solutions:
- Optimize your script to run faster
- Increase timeout:
--script-timeout 60 - Break script into smaller chunks
Issue: Script cannot access files
Check:
- File paths are relative to project root
- File exists in the project directory
- No path traversal (
../) attempts
π Logging
Set log level via environment variable:
RUST_LOG=codebridge_cli=debug
Log levels: error, warn, info, debug, trace
Log output includes:
- Request IDs for tracking
- Action execution details
- Build command detection
- Script execution logs
- Error details with context
πΊοΈ Roadmap
Phase 1 (Current)
- Smart build detection
- Git initialization action
- Script execution (Deno, Python, Bash)
Phase 2 (Next)
- Rust script support
- Docker sandboxing
- Script library with pre-approved scripts
- User approval UI for script execution
Phase 3 (Future)
- Heartbeat mechanism for multi-task coordination
- Dependency installation actions
- Network access controls
- Resource monitoring and limits
π€ Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new features
- Submit a pull request
Development Setup
π License
MIT License - see LICENSE file for details
π Acknowledgments
Built with:
π Support
For issues and questions:
- GitHub Issues: [link]
- Documentation: [link]
- Discord: [link]