DevEcoCli: Unified CLI for HarmonyOS Development with AI Integration
This guide introduces DevEcoCli, a unified command-line tool that wraps DevEco Studio's toolchain (ohpm, hvigor, hdc, emulator, hilog) for HarmonyOS app development, covering installation, core commands (create, build, run, emulator, docs, skills), and integration with AI coding agents like Claude Code and Cursor for natural-language-driven workflows.
Introduction
DevEcoCli is a unified command-line entry for HarmonyOS application development. It encapsulates the DevEco Studio toolchain—including ohpm (package manager), hvigor (build system), hdc (device connector), emulator, hilog (logging), and the MCP (Model Context Protocol) syntax-checking service—into a single CLI. This design makes DevEco Studio capabilities easily callable from AI coding agents.
What Is DevEcoCli?
DevEcoCli provides a command-line interface that bundles the core tools used in DevEco Studio. Key bundled tools: ohpm – Open Harmony Package Manager (like npm for ArkTS/ArkUI libraries) hvigor – Build toolchain (similar to Gradle) hdc – HarmonyOS Device Connector (like Android's adb) emulator – Local HarmonyOS device simulator hilog – System log viewer MCP – Model Context Protocol service for AI-assisted syntax checking
The CLI is purpose-built for the AI era of HarmonyOS development, enabling natural-language interaction via integrated AI agents.
Environment Requirements
Operating system: macOS or Windows (Linux and HarmonyOS PC are not supported )
Node.js >= 18 (version 22+ recommended) – download from https://nodejs.org/en
DevEco Studio >= 6.1.0 – download from https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/ide-tools-overview
On macOS, DevEco Studio must be installed in ~/Applications or
/ApplicationsInstallation
Run the following command to install the latest version: npm install -g @deveco/deveco-cli@latest Verify installation:
devecocli -vCore Commands Walkthrough
Project Scaffolding
Create a new HarmonyOS project (default API 23): devecocli create --app-name MyApp Full options:
devecocli create --app-name <name> --project-path <path> --bundle-name <bundle> --api-level <level> --app-name(required): application name --project-path (optional): default
./<appname> --bundle-name(optional): default com.example.<appname> (lowercased) --api-level (optional): min 17, max from installed HarmonyOS SDK
Emulator Management
List available emulator images: devecocli emulator list Start a specific emulator (e.g., "Pura 90"): devecocli emulator start "Pura 90" Other subcommands: stop, create, delete, image list, image download, image remove, license view, license accept.
Build and Run
Build the project (produces .hap/.hsp/.har/.app): devecocli build --build-mode release Clean build artifacts: devecocli build clean Build, install, and launch on a device/emulator: devecocli run --device 127.0.0.1:5555 Key parameters: --module, --device, --product, --build-mode, --ability, --uninstall, --skip-build.
Device Management
List connected devices: devecocli device list View device details:
devecocli device view -t <name|serial>Log Debugging
Fetch device logs (hilog) with filtering: devecocli log --level E Parameters: --device, --crash, --level, --bundle-name, --keyword, --tail, --from, --to, --follow.
Local Documentation Search
Search offline HarmonyOS docs (primarily for AI consumption): devecocli docs search Button Read full document by ID: devecocli docs read <documentId>; list catalogs: devecocli docs catalog.
Skill Discovery and Installation
List skills from the 格物市场 (Matrix OpenHarmony Skill Square): devecocli skills list --long Find skills by keyword: devecocli skills find <keyword>; add to an agent: devecocli skills add --skill <name> --agent cursor.
AI Agent Integration
DevEcoCli ships with built-in support for popular AI coding agents: trae-cn, opencode, cursor, codebuddy, qoder, claude-code, codex. Integration is done via the init command:
# Install deveco-cli skill for opencode (user-level)
devecocli init --agent opencode
# Install for multiple agents
devecocli init --agent opencode,cursor,atomcode
# Install into a specific project directory
devecocli init --agent cursor --project ./MyApp
# Configure MCP syntax-checking service for an agent
devecocli init --mcp --agent opencode --project ./MyApp
# Overwrite existing configuration
devecocli init --agent cursor --forceAfter integration, the agent can invoke DevEcoCli via a slash command (e.g., /deveco-cli xxxxx in Claude Code), allowing natural-language requests like "create a new HarmonyOS project" or "search Button documentation" without memorizing CLI syntax.
Command Reference Summary
The article provides a comprehensive table mapping functional categories to top-level commands, subcommands, purposes, key parameters, and examples. Major categories include:
Project scaffolding : create Build & package : build, build clean, run Device management : device list, device view Emulator : emulator list, start, stop, create, delete, image list, image download, image remove, license view, license accept Log debugging : log Documentation : docs search, docs read, docs catalog AI integration : init, skills list, skills find, skills add, skills remove, serve mcp Self-management :
updateConclusion
DevEcoCli transforms HarmonyOS development from a GUI-heavy "click-click-click" workflow into a "one-sentence" CLI-driven process. When combined with AI coding agents, it significantly boosts developer productivity by eliminating command memorization and enabling natural-language orchestration of project creation, building, testing, documentation lookup, and skill reuse.
References
Node.js official site: https://nodejs.org/en
DevEco Studio overview: https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/ide-tools-overview
Matrix OpenHarmony Skill Square: https://matrix.openharmony.cn/#/skillSquare
@deveco/deveco-cli on npm: https://www.npmjs.com/package/@deveco/deveco-cli
HarmonyOS 7 new features: https://developer.huawei.com/consumer/cn/features/
HarmonyOS AI development tools (DevEco Code & DevEco CLI): https://developer.huawei.com/consumer/cn/forum/topic/0202216647056043902
Community resources collection: https://developer.huawei.com/consumer/cn/forum/topic/0201215860119833282
Related live video: https://ost.51cto.com/activity/877
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
51CTO HarmonyOS Developer Community
The HarmonyOS Developer Community is a learning-oriented community for developers to learn, communicate, ask questions, and share.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
