mcpField
A
autoship

autoship

github.com/vercel-labs开发161706 次安装6 周前更新
代码仓库

关于 autoship

autoship 是用于自动化管理仓库软件发布的命令行技能。它借助 AI 分析更改并起草 changeset 描述,随后协调拉取请求、版本更新和 npm 发布。

主要功能

  1. 01配置和列出仓库
  2. 02分析提交与差异
  3. 03使用 AI 建议发布类型
  4. 04生成 changeset 描述
  5. 05创建并合并发布拉取请求
  6. 06触发 npm 发布

适用场景

  1. 01执行交互式发布
  2. 02在 CI 中自动发布补丁版本
  3. 03版本 PR 合并后发布 npm 包

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/vercel-labs/autoship --skill autoship

安装后在 Claude Code 中输入/autoship确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
ci-integration.md
commands.md
configuration.md
templates/
automated-release.sh
setup-repo.sh

详细介绍

使用 autoship 自动发布

核心工作流

每次发布都遵循以下模式:

  1. 配置:autoship add <name>(一次性设置)
  2. 发布:autoship <name>(交互式)或 autoship <name> -t patch -y(自动化)

该工具会处理完整的发布周期:

  • 克隆仓库
  • 分析变更并建议发布类型(patch/minor/major)
  • 生成由 AI 提供支持的变更集描述
  • 创建并合并变更集 PR
  • 等待并合并 Version Packages PR
  • 触发 npm 发布

要求

使用 autoship 前,请确保:

# GitHub CLI must be authenticated
gh auth login

# API key for AI features
export AI_GATEWAY_API_KEY="your-key"

核心命令

# One-time setup: add a repository
autoship add myproject
# Prompts for: owner, repo name, base branch

# List configured repositories
autoship list

# Interactive release (prompts for type and message)
autoship myproject

# Automated release (no prompts)
autoship myproject -t patch -y
autoship myproject -t minor -y
autoship myproject -t major -y

# Release with custom message (skips AI generation)
autoship myproject -t patch -m "Fixed login bug" -y

命令选项

autoship [repo]                    # Interactive repo selection if omitted
  -t, --type <type>                # Release type: patch, minor, major
  -m, --message <message>          # Custom changeset description
  -y, --yes                        # Skip all confirmations
  -h, --help                       # Show help

常见模式

完全自动化的补丁版本发布
autoship myproject -t patch -y
AI 辅助的交互式发布
autoship myproject
# 1. AI analyzes commits since last release
# 2. AI suggests release type (patch/minor/major)
# 3. You confirm or change the type
# 4. AI generates changeset description
# 5. You review and approve
# 6. Tool handles PR creation and merging
使用自定义消息发布
autoship myproject -t minor -m "Added new authentication providers" -y
CI/CD 集成
# In GitHub Actions or CI pipeline
export AI_GATEWAY_API_KEY="${{ secrets.AI_GATEWAY_API_KEY }}"
npx autoship myproject -t patch -y

autoship 的工作流程(10 个步骤)

  1. 克隆 - 从基准分支克隆仓库
  2. 分析 - 查找最新版本标签,分析提交和差异
  3. 建议 - AI 根据变更建议发布类型
  4. 生成 - AI 生成变更集描述
  5. 创建分支 - 创建包含变更集文件的发布分支
  6. PR - 为变更集创建拉取请求
  7. 等待 - 等待 CI 检查通过
  8. 合并 - 合并变更集 PR
  9. Version PR - 等待 changesets 操作创建 Version Packages PR
  10. 发布 - 合并 Version Packages PR 以触发 npm 发布

输出格式

autoship 会提供清晰的分步输出:

[1/10] Cloning repository from main...
  > Repository cloned
  > Package: my-package @ 1.2.3

[2/10] Creating release branch...
  > Branch created: release/patch-1706123456789

[3/10] Generating changeset...
  > Changeset created: fluffy-pants-dance.md

...

Release Complete!
The patch release has been published.

配置

配置存储在 ~/.autoship/config.json 中:

{
  "repos": {
    "myproject": {
      "owner": "vercel-labs",
      "repo": "myproject",
      "baseBranch": "main",
      "cloneUrl": "https://github.com/vercel-labs/myproject.git"
    }
  }
}

深入文档

参考资料使用时机
references/commands.md包含所有选项的完整命令参考
references/configuration.md配置文件格式和仓库设置
references/ci-integration.mdGitHub Actions 和 CI/CD 设置

可直接使用的模板

模板描述
templates/automated-release.sh完全自动化的发布脚本
templates/setup-repo.sh非交互式仓库设置
./templates/automated-release.sh myproject patch
./templates/setup-repo.sh myproject vercel-labs myproject main

故障排除

“未配置仓库”

运行 autoship add <name>,先配置一个仓库。

“未找到仓库”

运行 autoship list 查看可用仓库。名称区分大小写。

CI 检查失败

该工具会显示哪些检查失败。在目标仓库中修复问题,然后重试。

AI 生成失败

如果 AI 失败,autoship 会回退到手动输入。请确保已设置 AI_GATEWAY_API_KEY。

评论

支持 Markdown