# home-assistant-autopilot 中文文档

规范地址：https://npmcn.com/package/home-assistant-autopilot/

版本：2\.0\.0
npm 元数据更新时间：2026-11-03T18:29:25.406Z
中文译文更新时间：2026-11-03T20:58:05.095Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/home-assistant-autopilot
原文对照：https://npmcn.com/package/home-assistant-autopilot/?lang=original
项目主页：https://github.com/roquerodrigo/home-assistant-autopilot#readme
源码仓库：https://github.com/roquerodrigo/home-assistant-autopilot

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：101 kB，30 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- Node.js 要求：\>=24
- 运行依赖：4 个
- 首次发布：2026-11-03T17:41:29.699Z
- 最新版本发布：2026-11-03T18:29:25.092Z
- 已发布版本数：5（近 12 个月 5 个）

## 中文简介

验证家庭助理集成，卡片，主题和模板的市场，并附加每个发布资产。

## 安装

```sh
npm install home-assistant-autopilot
```

也可以使用：`pnpm add home-assistant-autopilot`、`yarn add home-assistant-autopilot`、`bun add home-assistant-autopilot`

## README

# 家庭助理自动驾驶仪

[![Marketplace](https://img.shields.io/badge/Marketplace-Home%20Assistant%20Autopilot-2088ff?logo=githubactions&logoColor=white&style=for-the-badge)](https://github.com/marketplace/actions/home-assistant-autopilot) [![Release](https://img.shields.io/github/v/release/roquerodrigo/home-assistant-autopilot?style=for-the-badge)](https://github.com/roquerodrigo/home-assistant-autopilot/releases/latest) [![npm](https://img.shields.io/npm/v/home-assistant-autopilot?logo=npm&style=for-the-badge)](https://www.npmjs.com/package/home-assistant-autopilot) [![Sponsor](https://img.shields.io/badge/Sponsor-%E2%9D%A4-db61a2?logo=githubsponsors&logoColor=white&style=for-the-badge)](https://github.com/sponsors/roquerodrigo)

的集成、仪表板卡、主题和模板 [家居助理市场](https://contributors.home-assistant.io/marketplace/), 将Marketplace安装的内容附加到每个版本。

它从存储库本身读取存储库是什么： `hacs.json`, 集成在 `custom_components/`，仪表板模块，主题或 模板。不需要配置任何内容。

## 用法

列表中列出了该操作 [GitHub市场](https://github.com/marketplace/actions/home-assistant-autopilot)。

### 验证

向CI中添加一个作业，该作业将检出存储库并运行操作：

```yaml
name: CI

on:
  push:
    branches: [main]
  pull_request:

permissions: {}

jobs:
  validate:
    name: Home Assistant Marketplace
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v7
        with:
          persist-credentials: false
      - uses: roquerodrigo/home-assistant-autopilot@v2
```

作业摘要列出了每项检查，并在文件中标注了每个问题 属于。

### 发布

发布发布后，附加其资产。与 [释放自动驾驶仪](https://github.com/marketplace/actions/release-autopilot) 是1 在同一工作中进行更多步骤，没有结账；

```yaml
jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
    steps:
      - id: release
        uses: roquerodrigo/release-autopilot@v1
        with:
          token: ${{ secrets.RELEASE_TOKEN }}
          anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}

      - if: steps.release.outputs.released == 'true'
        uses: roquerodrigo/home-assistant-autopilot@v2
        with:
          command: publish
          tag: ${{ steps.release.outputs.tag }}
```

任何发布工具的工作方式都是一样的：传递已发布版本的标签。

`@v2` 跟在每2后面。X版本，一个突破性的改变只伴随着一个新的major 的版本。 `@latest` 跟踪每个版本，包括损坏的版本。呆在一起 版本，使用a的标记 [释放](https://github.com/roquerodrigo/home-assistant-autopilot/releases)，例如 `@v2.0.0`，或其提交。

| 输入 | 意义 |
| --- | --- |
| `command` | `validate`，默认值，或 `publish` |
| `tag` | 为 `publish`，已发布版本的标签 |
| `token` | 默认为 `GITHUB_TOKEN`。 `publish` 需要内容写访问 |
| `repository` | 默认为工作流的存储库 |

| 输出 | 意义 |
| --- | --- |
| `category` | `integration`， `dashboard`， `theme` 或 `template` |
| `domain` | 积分的定义域，如果它是1 |
| `asset` | 资产的名称 `publish` 如有，请附呈 |
| `asset-url` | 它的下载URL，如果有的话 |

## 检查什么

| 检查 | 失败的是什么？ |
| --- | --- |
| 布局 | 否 `hacs.json`、多个集成或主题、一个模块或模板 `hacs.json` 缺少的名称、格式错误或不在其目录中的域、没有版本的清单 |
| `hacs.json` | 否 `name`， `zip_release` 除了积分，或者没有 `filename` 结束在 `.zip` |
| 版本 | `manifest.json`， `pyproject.toml` 和 `package.json` 声明不同的版本 |
| 下载大小 | 大于100mib或50000个文件，或大于5mib的模板 |
| Hassfest | Home Assistant清单验证器报告的任何内容，用于集成 |
| 目录 | 任何目录检查的市场报告：品牌，主题，描述，存档和其他 |

键的 `hacs.json` “市场”不再是这样写的 `hacs`，据报为 警告。私有存储库不能进入Marketplace，所以目录检查是 跳过了这里，总结也是这么说的。

hassest和目录检查运行在由digest固定的Docker映像中 存储库保持最新。他们是 `linux/amd64` 因此该作业需要Linux操作系统 跑步者，比如 `ubuntu-latest`。

检查本身在 [市场参考](https://contributors.home-assistant.io/marketplace/reference/validation/)。

## 出版的内容

Marketplace安装一个已发布的版本，而对于集成，它会拒绝一个 其清单声明了另一个版本。 `publish` 因此当一个版本失败时 在附加任何内容之前，在标签处声明的内容与标签不同。

| 存储库 | 资产 |
| --- | --- |
| 集成 | 与 `zip_release` 在 `hacs.json`， zip以 `filename` 持有 `custom_components/<domain>/` 从根本上说 |
| 指示板 | 模块，就像它在标签上一样 |
| 主题、模板 | 什么也没有：市场会从存储库中安装它们 |

zip保存在标记处跟踪的文件，通过GitHub API读取，在一个固定的 顺序和固定的时间戳，所以相同的标记总是给出相同的字节。一个资产 相同名称的文件被替换，因此可以重复运行。

释放的 `download_count` 变成安装计数器：如果没有资产 通过API进行的市场下载并不会被计算在内。

```json
{ "name": "My integration", "zip_release": true, "filename": "my_integration.zip" }
```

## GitHub行动之外

相同的检查可以在任何终端上运行 [npm包](https://www.npmjs.com/package/home-assistant-autopilot)，在Node 24或 稍后，使用Docker进行检查和目录检查：

```sh
GITHUB_TOKEN=... npx home-assistant-autopilot validate --repository owner/name
GITHUB_TOKEN=... npx home-assistant-autopilot publish --repository owner/name --tag v1.2.0
```

`validate` 打印报告，并在检查失败时以1退出。目录检查 阅读GitHub上的存储库 `--ref`默认情况下，提交已签出，所以推它 第一。 `publish` 将结果打印为JSON：

```json
{"asset":"my_integration.zip","assetUrl":"https://github.com/owner/name/releases/download/v1.2.0/my_integration.zip","category":"integration","domain":"my_integration"}
```

| 选项 | 意义 |
| --- | --- |
| `--repository <owner/name>` | GitHub上的存储库。默认为 `GITHUB_REPOSITORY` |
| `--directory <path>` | `validate`结帐。默认为当前目录 |
| `--ref <commit>` | `validate`：目录检查读取的提交 |
| `--tag <tag>` | `publish`：发布的标签 |

令牌来自 `GITHUB_TOKEN`,或 `GH_TOKEN`． 该包还导出这两种内容 命令库：

```ts
import { HomeAssistantAutopilot } from 'home-assistant-autopilot'

const autopilot = new HomeAssistantAutopilot({ repository: 'owner/name', token: process.env.GITHUB_TOKEN! })
const { report } = await autopilot.validate()
const { asset } = await autopilot.publish('v1.2.0')
```

一个 `reporter` 与 `group`， `info` 和 `warning` 接收进度，否则 转到控制台。

## 支持

这个项目是建立和维护在个人时间。如果对你有用，考虑一下 [赞助工作](https://github.com/sponsors/roquerodrigo) 它让开发、测试和发布持续进行。

## 常见问题

### home-assistant-autopilot 是什么？

验证家庭助理集成，卡片，主题和模板的市场，并附加每个发布资产。

### 如何安装 home-assistant-autopilot？

在项目目录运行 npm install home-assistant-autopilot，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 home-assistant-autopilot，可以用 npx home-assistant-autopilot 直接运行。

### home-assistant-autopilot 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### home-assistant-autopilot 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### home-assistant-autopilot 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=24。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### home-assistant-autopilot 可以商用吗？

home-assistant-autopilot 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### home-assistant-autopilot 还在维护吗？

最新版本 2\.0\.0 发布于 2026/11/04（1 天前）；至今共发布 5 个版本，其中过去 12 个月发布了 5 个；首次发布于 2026/11/04。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

