Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计提醒

harmonyos-build-deployHarmonyos 构建部署

Agent Skill

用于辅助云资源、部署、容器、基础设施和运维自动化任务。它适合让 Agent 检查配置、整理部署步骤、分析资源状态、生成排障思路或辅助云服务接入。使用时需要明确目标环境、账号权限、区域和资源组,区分本地测试与生产操作;涉及删除资源、重启服务、修改网络或权限配置时,应先确认影响范围。

总安装

2,620

周安装

106

GitHub Stars

6

下载量

823
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:harmonyos-build-deploy(Harmonyos 构建部署)
来源仓库:https://github.com/fadinglight9291117/arkts_skills
仓库路径:skills/harmonyos-build-deploy
安装命令:
npx skills add https://github.com/fadinglight9291117/arkts_skills --skill harmonyos-build-deploy
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/fadinglight9291117/arkts_skills --skill harmonyos-build-deploy

简介

用于辅助 HarmonyOS 应用的构建和部署流程。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中检查配置、整理部署步骤或分析资源状态。
  • 通过 GitHub 安装,需明确目标环境、账号权限和资源组。
  • 区分本地测试与生产操作,涉及删除资源或修改网络配置时应先确认影响范围。
  • 不能将工具输出直接当作最终结论,需人工复核部署脚本和环境变量。

SKILL.md

HarmonyOS Build & Deploy

Complete workflow for building, cleaning, packaging, and installing HarmonyOS applications.

First Step: Confirm Operation with User

IMPORTANT: Before executing any build or deploy operation, confirm which specific operation(s) the user wants to perform. Ask the user to choose from:

OperationDescription
Clean build artifactsRemove previous build cache and outputs
Install dependenciesUse ohpm to install project dependencies
Build projectUse hvigorw to build HAP/APP packages
Install to deviceUse hdc to install the app on a device
Full pipelineClean → install deps → build → deploy to device

Why confirm first:

  • Different scenarios require different operations (e.g., incremental build vs clean build)
  • Avoid unnecessary time-consuming operations
  • Give user control over the workflow
  • Prevent accidental device installation

After user responds:

  • Execute only the selected operations
  • Report progress and results clearly

Quick Reference

# Build complete app (incremental)
hvigorw assembleApp --mode project -p product=default -p buildMode=release --no-daemon

# Install to device (Git Bash compatible)
# If you use Git Bash on Windows, disable MSYS path conversion for hdc commands.
export MSYS_NO_PATHCONV=1

INSTALL_DIR="//data/local/tmp/install_$(date +%s)"
hdc -t <UDID> shell "mkdir -p $INSTALL_DIR"
# Push files one-by-one to explicit remote file paths (most reliable on Git Bash)
for f in outputs/*.hap outputs/*.hsp; do
    [ -f "$f" ] && hdc -t <UDID> file send "$f" "$INSTALL_DIR/$(basename "$f")"
done

# Install (reinstall) HSPs first, then the HAP
for f in outputs/*.hsp outputs/*.hap; do
    [ -f "$f" ] && hdc -t <UDID> shell "bm install -p $INSTALL_DIR/$(basename \"$f\") -r"
done

hdc -t <UDID> shell "rm -rf $INSTALL_DIR"

Note: Build output path is outputs/.

Workflows

IMPORTANT: Build, clean, and deploy operations are long-running (build ~30s, file transfer ~20s). Always delegate these workflows to a subagent to avoid timeout. This also provides better error handling and clearer progress reporting to the user.

Clean Build & Deploy

Delegate to subagent with the following steps:

  1. Clean: hvigorw clean --no-daemon
  2. Install dependencies: ohpm install --all
  3. Build: hvigorw assembleApp --mode project -p product=default -p buildMode=release --no-daemon
  4. Deploy to device (see Push and Install below)
  5. Launch: hdc -t <UDID> shell "aa start -a EntryAbility -b <bundleName>"
  6. Report success/failure with details

Deploy Only (No Rebuild)

Delegate to subagent with the following steps:

  1. Read AppScope/app.json5 to get bundleName
  2. Check outputs/ for existing build outputs. If empty or missing, collect signed HAP/HSP from each module's build directory ({srcPath}/build/default/outputs/default/*-signed.*) into outputs/. See module-discovery.md for details.
  3. Deploy to device (see Push and Install below)
  4. Launch: hdc -t <UDID> shell "aa start -a EntryAbility -b <bundleName>"
  5. Report success/failure with details

Clean App Cache/Data

Delegate to subagent:

  1. Clean cache: hdc -t <UDID> shell "bm clean -n <bundleName> -c"
  2. Clean data: hdc -t <UDID> shell "bm clean -n <bundleName> -d"
  3. Report success/failure

Build Commands (hvigorw)

Incremental Build (Default)

Use incremental build for normal development - only changed modules are rebuilt:

# Build complete app (incremental)
hvigorw assembleApp --mode project -p product=default -p buildMode=release --no-daemon

Single Module Build

Build only a specific module for faster iteration:

# Build single HAP module
hvigorw assembleHap -p module=entry@default --mode module -p buildMode=release --no-daemon

# Build single HSP module
hvigorw assembleHsp -p module=my_feature@default --mode module -p buildMode=release --no-daemon

# Build single HAR module
hvigorw assembleHar -p module=library@default --mode module -p buildMode=release --no-daemon

# Build multiple modules at once
hvigorw assembleHsp -p module=module1@default,module2@default --mode module -p buildMode=release --no-daemon

Module name format: {moduleName}@{targetName}

  • moduleName: Directory name of the module (e.g., entry, my_feature)
  • targetName: Target defined in module's build-profile.json5 (usually default)

When to use single module build:

  • Developing/debugging a specific module
  • Faster build times during iteration
  • Testing changes in isolated module

Note: After single module build, you still need to run assembleApp to package the complete application for installation.

Clean Build (When Needed)

Only perform clean build when:

  • First time building the project
  • Encountering unexplained build errors
  • After modifying build-profile.json5 or SDK version
  • Dependency resolution issues
# Clean build artifacts
hvigorw clean --no-daemon

# Deep clean (for dependency issues)
ohpm clean && ohpm cache clean
ohpm install --all
hvigorw --sync -p product=default -p buildMode=release --no-daemon
hvigorw assembleApp --mode project -p product=default -p buildMode=release --no-daemon

Install Dependencies (ohpm)

# Install all dependencies (after clean or first clone)
ohpm install --all

# With custom registry
ohpm install --all --registry "https://repo.harmonyos.com/ohpm/"

Sync Project

Only needed after modifying build-profile.json5 or oh-package.json5:

hvigorw --sync -p product=default -p buildMode=release --no-daemon

Build Parameters

ParameterDescription
-p product={name}Target product defined in build-profile.json5
`-p buildMode={debug\release}`Build mode
-p module={name}@{target}Target module with --mode module
--mode projectBuild all modules in project
--mode moduleBuild specific module only
--no-daemonDisable daemon (recommended for CI)
--analyze=advancedEnable build analysis

Build Outputs

Build output path: outputs/

outputs/
├── entry-default-signed.hap
└── *.hsp

Module Types

TypeExtensionDescription
HAP.hapHarmony Ability Package - Application entry module
HSP.hspHarmony Shared Package - Dynamic shared library
HAR.harHarmony Archive - Static library (compiled into HAP)
APP.appComplete application bundle (all HAP + HSP)

Finding Modules

Modules are defined in build-profile.json5 at the project root. The module type is determined by the type field in {module}/src/main/module.json5:

type valueModule TypeBuild Command
"entry" / "feature"HAPassembleHap
"shared"HSPassembleHsp
"har"HARassembleHar

Module build outputs: {srcPath}/build/default/outputs/default/

For detailed module discovery, build output structure, and handling unwanted modules, see references/module-discovery.md.

Device Installation (hdc)

hdc (HarmonyOS Device Connector) is the CLI tool for device communication, similar to Android's adb.

Check Device

hdc list targets              # List connected devices (returns UDID)
hdc -t <UDID> shell "whoami"  # Test connection

Push and Install

# Create temp directory on device (Git Bash compatible)
# If you use Git Bash on Windows, disable MSYS path conversion for hdc commands.
export MSYS_NO_PATHCONV=1

INSTALL_DIR="//data/local/tmp/install_$(date +%s)"
hdc -t <UDID> shell "mkdir -p $INSTALL_DIR"

# Push files one-by-one to explicit remote file paths (most reliable on Git Bash)
for f in outputs/*.hap outputs/*.hsp; do
    [ -f "$f" ] && hdc -t <UDID> file send "$f" "$INSTALL_DIR/$(basename "$f")"
done

# Install (reinstall) HSPs first, then the HAP
for f in outputs/*.hsp outputs/*.hap; do
    [ -f "$f" ] && hdc -t <UDID> shell "bm install -p $INSTALL_DIR/$(basename \"$f\") -r"
done

# Clean up temp directory
hdc -t <UDID> shell "rm -rf $INSTALL_DIR"

Verify and Launch

# Check installation
hdc -t <UDID> shell "bm dump -n <bundleName>"

# Launch app (default ability)
hdc -t <UDID> shell "aa start -a EntryAbility -b <bundleName>"

Uninstall

hdc -t <UDID> shell "bm uninstall -n <bundleName>"

hdc Command Reference

CommandDescription
hdc list targetsList connected devices
hdc -t <UDID> shell "<cmd>"Execute shell command on device
hdc -t <UDID> file send <local> <remote>Push file/directory to device
hdc -t <UDID> file recv <remote> <local>Pull file/directory from device
hdc killKill hdc server
hdc startStart hdc server
hdc versionShow hdc version

Bundle Manager (bm)

Run via hdc -t <UDID> shell "bm...":

CommandDescription
bm install -p <path>Install from directory (all HAP/HSP)
bm install -p <file.hap>Install single HAP file
bm install -r -p <path>Reinstall (replace existing, keep data)
bm uninstall -n <bundleName>Uninstall application
bm dump -n <bundleName>Show package info
bm dump -aList all installed packages
bm clean -n <bundleName> -cClean application cache
bm clean -n <bundleName> -dClean application data

Ability Assistant (aa)

Run via hdc -t <UDID> shell "aa...":

CommandDescription
aa start -a <ability> -b <bundle>Start specific ability
aa force-stop <bundleName>Force stop application

Troubleshooting

ErrorCauseSolution
version code not sameHSP in output not in build-profile.json5Remove unwanted HSP files before install (see module-discovery.md)
install parse profile prop check errorSignature/profile mismatchCheck signing config in build-profile.json5; verify bundleName matches app.json5; check certificate not expired
install failed due to older sdk versionDevice SDK < app's compatibleSdkVersionUpdate device or lower compatibleSdkVersion
Device not foundConnection issueCheck USB; enable Developer Options (tap build number 7x) and USB debugging; hdc kill && hdc start; try different USB port/cable
signature verification failedInvalid or expired certificateRegenerate certificate in DevEco Studio; check validity period; ensure correct signing config for build type

Key Configuration Files

FileDescription
AppScope/app.json5App metadata (bundleName, versionCode, versionName)
build-profile.json5Modules list, products, signing configs
{module}/src/main/module.json5Module config (abilities, permissions)
{module}/oh-package.json5Module dependencies

Reference Files

Related Skills

  • arkts-development: ArkTS/ArkUI development patterns, state management, component lifecycle, and API usage. Use alongside this skill when developing HarmonyOS application code.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37.93%
按下载量换算312

Claude

31.23%
按下载量换算257

Cursor

16.44%
按下载量换算135

Gemini CLI

9.06%
按下载量换算75

安全审计

Gen Agent Trust Hub

通过

Socket

可疑

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/fadinglight9291117/arkts_skills --skill harmonyos-build-deploy 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills