@zenovate/op-cli
v0.1.4
Published
CLI for OP devices: compile Python to PikaPython bytecode, serial/BLE upload, OP>1 shell and OP>2 REPL
Readme
@zenovate/op-cli
CLI for OP devices: compile Python to PikaPython bytecode (.py.o), upload over serial or BLE, with OP>1 JSON command mode and OP>2 Python REPL.
- Platforms: macOS (arm64 / x64), Windows x64
- npm: @zenovate/op-cli
Install
npm install -g @zenovate/op-cliProject-local:
npm install -D @zenovate/op-cli
npx op-cli --helpCommands
| Task | Command |
|------|---------|
| Version | op-cli --version |
| Compile .py | op-cli compile hello.py |
| Upload file | op-cli upload hello.py.o /py -p COM3 -b 9600 |
| Compile + upload + run | op-cli deploy hello.py /py -p COM3 -b 9600 |
| JSON / params (OP>1) | op-cli shell -p COM3 -b 9600 |
| Python REPL (OP>2) | op-cli python -p COM3 -b 9600 |
| BLE scan | op-cli ble-scan |
| Raw monitor | op-cli monitor -p COM3 |
op-cli pythonsends OP>2 automatically — you do not typeOP>2manually.
deploy — compile, upload, and run
deploy compiles a .py file, uploads the .py.o to the device, then runs it with {"PythonFileRun":"<filename>"} (filename only, e.g. hello.py.o). Use upload instead if you only want to transfer a file without running it.
Flow: compile → connect → upload → PythonFileRun → (optional) raw monitor until Ctrl+C.
# Serial: compile, upload, run, then exit after JSON response
op-cli deploy examples/hello.py /py -p COM3 -b 9600
# BLE: run then stay in monitor (ASCII, default)
op-cli deploy examples/hello.py /py --ble AA:BB:CC:DD:EE:FF --monitor
# Monitor with hex + timestamp
op-cli deploy examples/hello.py /py -p COM3 --monitor --hex --timestamp| Flag | Default | Description |
|------|---------|-------------|
| -o / --output | temp dir | Local .py.o output path |
| --remote-name | compiled name | Filename on device (used for PythonFileRun) |
| --monitor | off | After run succeeds, print raw device output until Ctrl+C |
| --run-timeout | 30 | Seconds to wait for PythonFileRun JSON response |
| --hex | off | Hex display during --monitor |
| --timestamp | off | Timestamp prefix during --monitor |
| -p / --ble | — | Serial port or BLE address (one required) |
| -b / -c | 115200 | Serial baud or full config, e.g. 9600,N,8,1 |
| --packet-size | 100 | Upload chunk size (bytes) |
| --skip-command-mode | off | Skip OP>1 before upload |
Examples
Serial (Windows)
op-cli deploy examples/hello.py /py -p COM3 -b 9600
op-cli deploy examples/hello.py /py -p COM3 -b 9600 --monitor
op-cli shell -p COM3 -b 9600
op-cli python -p COM3 -b 9600
op-cli monitor -p COM3Serial config string (-c, same as 9600,N,8,1)
op-cli shell -p COM5 -c "9600,N,8,1"BLE
op-cli ble-scan
op-cli deploy examples/hello.py /py --ble <address>
op-cli deploy examples/hello.py /py --ble <address> --monitor --hex
op-cli python --ble <address>
op-cli monitor --ble <address>Help
op-cli --help
op-cli <command> --help
op-cli deploy --help