# @happyvertical/github-actions 中文文档

规范地址：https://npmcn.com/package/%40happyvertical/github-actions/

版本：0\.113\.1
npm 元数据更新时间：2026-11-17T00:01:37.797Z
中文译文更新时间：2026-11-17T14:15:06.424Z
软件包许可：MIT

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

原始 npm 页面：https://www.npmjs.com/package/%40happyvertical/github-actions
原文对照：https://npmcn.com/package/%40happyvertical/github-actions/?lang=original
项目主页：https://github.com/happyvertical/sdk/tree/main/packages/github-actions#readme
源码仓库：https://github.com/happyvertical/sdk

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

- 包体积（解压后）：193 kB，64 个文件
- 模块格式：ES Module
- TypeScript 类型：包内自带
- 运行依赖：2 个
- 首次发布：2026-06-23T08:14:16.392Z
- 最新版本发布：2026-11-17T00:01:37.476Z
- 近 30 天下载量：5543（2026-10-17 至 2026-11-15，npm 官方下载统计）
- 已发布版本数：132（近 12 个月 132 个）

## 中文简介

可重复使用的 GitHub 动作工具,用于发行分解、公关验证和工作流程自动化

## 安装

```sh
npm install @happyvertical/github-actions
```

也可以使用：`pnpm add @happyvertical/github-actions`、`yarn add @happyvertical/github-actions`、`bun add @happyvertical/github-actions`

## README

# @happyvertical/github-动作

GitHub Actions为CI/CD自动化服务。 提供AI动力的发行分解(标签,重复检测,项目板管理),执行规划并附有"就绪验证定义",以及标准化的标签管理. 用途 `@happyvertical/repos` 财务报告和审定财务报表 `@happyvertical/projects` 用于 GitHub API 交互.

## 安装

```bash
npm install @happyvertical/github-actions
```

同伴依赖性 : `@happyvertical/repos`, (中文(简体) ), `@happyvertical/projects`。 。 。 .

## CLI 使用量

该软件包提供了两个CLI命令:

### 曲线

在 GitHub 动作工作流程中运行 AI 驱动的发行分解 :

```bash
# Required env vars: GITHUB_TOKEN, GITHUB_REPOSITORY, ISSUE_NUMBER, ISSUE_TITLE, ISSUE_AUTHOR
# Optional: ISSUE_BODY, CONFIG (path to config file or JSON string)
npx @happyvertical/github-actions triage
```

### 标签

对寄存器应用标准化标签(类型、优先级、大小、状态、代理) :

```bash
github-actions labels --owner happyvertical --repo sdk --dry-run
github-actions labels --owner happyvertical --repo sdk --include-area --area core --area api
```

## 配置

创建一个 `.github/triage-config.json`数字 :

```json
{
  "repoDescription": "TypeScript monorepo for AI agent development",
  "packagePattern": "@happyvertical/*",
  "packageExamples": ["@happyvertical/ai", "@happyvertical/sql"],
  "projectEnabled": true,
  "projectId": "PVT_kwDOB9Y8ns4A8-TY",
  "statusFieldId": "PVTSSF_lADOB9Y8ns4A8-TYzgw0GaY",
  "statusOptions": {
    "To Do": "c0c9ab27",
    "In Progress": "ce670088",
    "Review & Testing": "ee1f96bd"
  }
}
```

| 外地 | 类型 | 需求 | 说明 |
| --- | --- | --- | --- |
| `repoDescription` | 字符串 | 对 | AI背景简介 |
| `packagePattern` | 字符串 | 没有 | Monorepo软件包模式(例如, `@happyvertical/*`(中文(简体) ) |
| `packageExamples` | 字符串 \[\] | 没有 | AI 指导的示例包名 |
| `projectEnabled` | 布尔 | 没有 | 启用 GitHub 项目 V2 集成 |
| `projectId` | 字符串 | 如果项目 | 工程 V2 ID |
| `statusFieldId` | 字符串 | 如果项目 | 状态字段标识 |
| `statusOptions` | 对象 | 如果项目 | 选项 ID 映射的状态名称 |

## 程序化 API

### 问题 Trage

```typescript
import { triageIssue } from '@happyvertical/github-actions';

const result = await triageIssue({
  token: process.env.GITHUB_TOKEN!,
  owner: 'happyvertical',
  repo: 'sdk',
  issueNumber: 123,
  issueTitle: 'Add Redis cache support',
  issueBody: 'We need distributed caching...',
  issueAuthor: 'username',
  config: {
    repoDescription: 'TypeScript monorepo for AI agent development',
    packagePattern: '@happyvertical/*',
    projectEnabled: false,
  },
});
```

Triage用AI(GitHub Models API)来分析这个问题,应用类型/优先级/大小标签,搜索复制品,张贴有条理的评论,并可选择更新项目板.

### 规划

```typescript
import { startPlanning, completePlanning } from '@happyvertical/github-actions';

// Generate an AI implementation plan and post it as a comment
const planResult = await startPlanning(context);

// Validate Definition of Ready and move to Ready status
const completeResult = await completePlanning(context);
```

### 标签管理

```typescript
import {
  getAllStandardLabels,
  getLabelsByCategory,
  migrateLabel,
} from '@happyvertical/github-actions';

const allLabels = getAllStandardLabels(); // type, priority, size, status, agent
const bugLabels = getLabelsByCategory('type');
const newName = migrateLabel('enhancement'); // → 'type: feature'
```

### 共用水电费

```typescript
import {
  createRepository,
  createProject,
  getAICompletion,
  parseAIJson,
} from '@happyvertical/github-actions';

// Adapter factories for @happyvertical/repos and @happyvertical/projects
const repo = await createRepository(token, 'happyvertical', 'sdk');
const project = await createProject(token, projectId, statusFieldId, statusOptions);

// AI completion with auto-provider selection (GitHub Models → OpenAI → Anthropic)
const response = await getAICompletion([
  { role: 'system', content: 'You are a helpful assistant.' },
  { role: 'user', content: 'Analyze this issue...' },
]);
```

## 建筑

-   **`triage/`** ——问题分解:AI分析,标签,重复检测,项目板更新
-   **`planning/`** 实施规划:AI计划生成,即期验证的定义
-   **`shared/`** ——AI客户端(GitHub Models,OpenAI,Anthropic),GitHub API帮助器,标签定义,项目公用事业,适配器工厂
-   **`cli.ts`** ——CLI入站点`triage`, (中文(简体) ), `labels` 命令)

## 许可证

麻省理工学院

## 常见问题

### @happyvertical/github-actions 是什么？

可重复使用的 GitHub 动作工具,用于发行分解、公关验证和工作流程自动化

### 如何安装 @happyvertical/github-actions？

在项目目录运行 npm install @happyvertical/github-actions，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 github-actions、have-github-actions-context，可以用 npx github-actions 直接运行。

### @happyvertical/github-actions 支持 TypeScript 吗？

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

### @happyvertical/github-actions 支持 ESM 还是 CommonJS？

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

### @happyvertical/github-actions 可以商用吗？

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

### @happyvertical/github-actions 的下载量有多少？

根据 npm 官方下载统计，@happyvertical/github-actions 在 2026/10/17 – 2026/11/15 这 30 天内被下载 5,543 次，日均约 185 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @happyvertical/github-actions 还在维护吗？

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

