@devicesdk/cli
v0.1.0
Published
CLI tool for developing and deploying DeviceSDK IoT applications.
Downloads
119
Readme
@devicesdk/cli — DeviceSDK CLI
Build, run, deploy, and flash DeviceSDK IoT projects from the command line.
Install
npm install -g @devicesdk/cli
# or with pnpm
pnpm add -g @devicesdk/cliOr run on-demand: npx @devicesdk/cli --help
Quick start
devicesdk login
devicesdk init # creates devicesdk.ts
devicesdk build # outputs to .devicesdk/build
devicesdk dev # local simulator (workerd)
devicesdk deploy # build + upload
devicesdk flash <deviceId> # Pico BOOTSEL flashProject config (devicesdk.ts)
import { defineConfig } from '@devicesdk/cli';
export default defineConfig({
projectId: 'my-project',
devices: {
'pico-1': {
main: './src/device.ts',
name: 'My Pico',
description: 'Demo device',
wifi: { ssid: 'MyWiFi', password: 'secret' },
},
},
});- Prefer
main;entrypointis supported for backward compatibility. - Use
--configorDEVICESDK_CONFIGto point to a custom config path.
Key commands
login/logout/whoami— authenticate via device code flow (tokens in~/.devicesdk/credentials.json).init— scaffold a config.build— esbuild (ESM, es2022, unbundled) into.devicesdk/build.dev— builds and runs the local simulator; picks a dynamic port if 8181 is busy.deploy— builds and uploads scripts; creates the project if missing.flash— downloads firmware and copies to a Raspberry Pi Pico in BOOTSEL mode; looks for volumesRPI-RP2orRP2350. Firmware is saved to<project>/.devicesdk/firmware/<deviceId>.uf2before flashing (default timeout 2 minutes).
Run devicesdk --help or devicesdk <command> --help for full options.
Troubleshooting
- Config not found: pass
-c/--configor setDEVICESDK_CONFIG. - Flashing: ensure BOOTSEL volume is
RPI-RP2orRP2350; confirm UF2 contents if nothing changes on reboot. - Build errors: verify the
mainpath and TypeScript output (non-bundled esbuild).
