AIGate 是一个 CLI,用于检查本地变更、secret 风险、项目基础分、PR 就绪状态和发布就绪状态。
概览
目前已经完成的内容
包已经以 aigate-cli 发布到 npm,并且可以通过 GitHub tag 和 npm Trusted Publishing 自动发布。
它还可以生成 Codex、Gemini、Claude Code 集成文件,让 AI assistant 遵循同一套仓库规则。
npm
安装与快速开始
也可以不全局安装,直接通过 npx 运行。
npm install -g aigate-cli
aigate --version
aigate check
npx aigate-cli check
流程
整体运行流程
AIGate 将本地开发、PR、CI、发布和 npm 分发串成同一套质量门禁。
流程
按场景使用示例
AIGate 不是所有时刻都运行同一个命令的工具,而是根据仓库状态和风险等级选择短流程的工具。
场景
首次接入仓库
流程
选择默认设置路径,然后逐步补齐文档、AI 指令和 hook。
命令示例
aigate start --route default --ask-steps
aigate doctor
aigate install-hook --pre-push
场景
AI agent 修改了很多文件后
流程
先检查变更文件和 secret 风险,再把失败测试转成 AI 修复提示。
命令示例
aigate check
aigate test
aigate aitest
场景
创建 PR 前
流程
通过本地 gate,用受保护 wrapper push,并生成给评审者看的上下文。
命令示例
aigate git-ready
aigate push -u origin feature/my-work
aigate pr-check
场景
private GitLab monorepo
流程
固定 profile,检测 turbo runner 后自动回退到 workspace tests,并把 GitHub/npm 包检查排除在 app 评分外。
命令示例
aigate setup --hosting gitlab --ci-provider gitlab --project-type app --package-manager pnpm
aigate test
aigate evaluate-project
场景
开源发布准备
流程
创建公开贡献文件,并检查仓库基础分。
命令示例
aigate start --route oss --owner @team
aigate evaluate-project --deep --report
aigate github setup --dry-run
场景
发布前后
流程
检查 tag/npm 就绪状态,运行 CI,并在发布后记录健康趋势。
命令示例
aigate release-check --npm
npm run ci
aigate trends record
场景
清理或移除本地 AIGate 状态
流程
先预览删除目标,确认无误后才使用 --force 执行。
命令示例
aigate clean
aigate clean --force
aigate uninstall --force
发布
发布自动化图表
首次公开发布后,版本更新和 tag push 就是主要发布触发器。
命令
命令地图
设置
首次运行
保护门禁
维护
报告
发布
命令
全部命令与使用时机
| 命令 | 用途 | 使用场景 |
|---|---|---|
npm install -g aigate-cli |
全局安装 CLI。 | 首次开发环境设置 |
npx aigate-cli check |
无需安装即可检查仓库。 | 快速体验或 CI 前检查 |
aigate start |
用方向键或 --route 运行引导式项目设置路由。 | 在项目中启用 AIGate 时 |
aigate start --route default --ask-steps |
逐步询问是否运行推荐设置步骤。 | 首次设置时想只选择必要步骤 |
aigate start --route default --steps init,repo-files |
只运行指定的设置步骤 ID,其余跳过。 | 可重复 onboarding 或文档化设置 |
aigate start --route oss --owner @team |
创建 README、贡献文档、issue 模板、PR 模板和 CODEOWNERS。 | 打开公开贡献路径时 |
aigate start --route ai --provider all |
创建 AIGate 配置和 Codex/Gemini/Claude 指令文件。 | 一次性对齐 AI assistant 规则时 |
aigate init |
创建基础配置和报告目录。 | 在新项目中启用 AIGate |
aigate reset |
重新写入 AIGate 配置、settings 和报告占位文件。 | 把本地设置恢复到初始状态 |
aigate clean --force |
删除生成的 AIGate 报告和本地状态。 | 清空报告和 generated state |
aigate uninstall --force |
移除 AIGate 配置、.aigate 目录和 AIGate 自有 hook。 | 从项目中移除 AIGate |
aigate setup --language <en|ko|ja|zh> |
保存 CLI 输出语言。 | 统一团队输出语言 |
aigate setup --hosting gitlab --ci-provider gitlab |
保存 GitLab 项目配置。 | 不适合 GitHub 假设的内部 GitLab app |
aigate settings |
显示当前 AIGate 设置。 | 配置核对 |
aigate doctor |
诊断首次运行环境、Git hook 和项目基础状态。 | 首次运行或检查仓库状态 |
aigate demo |
不改动文件,展示 AIGate 使用流程。 | 试用 CLI 或向团队说明 |
aigate install-hook --pre-push |
安装 pre-push hook,在 git push 前运行 git-ready。 | 在本地阻止有风险的 push |
aigate check |
汇总变更文件、实际 secret finding 和敏感文件移除状态。 | 轻量提交前检查 |
aigate test |
运行 Git readiness,并检测 root script、turbo task、pnpm workspace 或 workspace package tests。没有 turbo runner 时会自动回退到 workspace script。 | 提交前确认真实测试结果 |
aigate ai report |
汇总当前问题、做得好的部分、方向和 AI 交接提示。 | 让 AI 改进项目之前 |
aigate ai report --apply --provider codex |
把 AI 项目简报交给 AI CLI,实时显示 agent 输出,并在报告中保留 stdout/stderr。 | 明确允许 AI 自动化时 |
aigate aitest |
根据失败测试写入 AI 修复提示。 | 把失败交给 AI agent 处理时 |
aigate aitest --apply --provider codex |
调用 AI CLI,并显示执行日志、退出码、stdout 和 stderr。 | 明确允许 AI 自动修复时 |
aigate git-ready |
运行测试、secret scan 和项目分数门禁。 | 提交或 push 前 |
aigate push -u origin <branch> |
门禁通过后转发到 git push。 | 推送分支时 |
aigate pr-check |
生成 PR 就绪报告。 | 编写 PR 描述前 |
aigate pr --title "..." |
通过 GitHub CLI 创建 PR。 | 分支 push 后 |
aigate github comment --pr <number> |
向 PR 发布 AIGate 摘要评论。 | 给评审者留下门禁结果 |
aigate github check --format json |
生成 GitHub Checks/Actions summary payload。 | 在 CI 中显示 AIGate 状态 |
aigate github setup --owner @team |
设置 PR 模板和 CODEOWNERS。 | 整理公开贡献路径 |
aigate trends record |
记录项目状态快照。 | 跟踪发布前后的状态趋势 |
aigate trends show |
汇总已记录的状态趋势。 | 团队评审或每周检查 |
aigate report --format markdown |
输出本地工作流报告。 | 状态共享 |
aigate report --format sarif |
以 SARIF 输出 secret finding。 | 安全工具集成 |
aigate evaluate-project |
计算仓库基础分。 | 开源发布准备检查 |
aigate evaluate-project --deep --report |
生成包含 Git signal 的详细报告。 | 发布或周期复盘 |
aigate verify-enforcement --apply |
通过 GitHub/GitLab API 验证服务器端 AIGate 必需检查,并写入已验证证据。 | 确认 CI 是否真的会阻止 merge 时 |
aigate compliance-report |
生成合规控制报告。 | 审计和运维准备共享 |
aigate dashboard |
写入本地 HTML 健康仪表盘。 | 开始 self-hosted reporting |
aigate branch-strategy |
按团队和发布节奏推荐分支策略。 | 设计分支政策 |
aigate branch-strategy --compare |
按分数、优势、风险和迁移步骤比较多个分支策略提案。 | 选择适合团队的分支模型时 |
aigate branch-strategy --apply |
生成分支政策、release、hotfix、PR、CODEOWNERS 和政策包草案。 | 创建政策文件时 |
aigate integrate all |
生成 Codex、Gemini、Claude Code 集成文件。 | 让 AI assistant 保持一致规则 |
aigate release-check |
检查包、workflow 和 tag 准备状态。 | 创建发布 tag 前 |
aigate release-check --npm |
检测仓库配置,检查 npm registry/GitHub/GitLab/package manager 状态,并排除不适用于 app 的 npm/package version gate。 | 自动发布前后 |
aigate audit-report |
汇总治理和政策状态。 | 运维审计和公开准备 |
aigate notify send --channel terminal |
输出本地通知事件。 | 检查门禁阻塞事件 |
aigate git-ready --notify-channel slack |
BLOCK 时发送 Slack webhook 通知。 | 敏感信息或高风险变更阻塞门禁时 |
aigate notify test --channel slack |
测试 Slack、Discord、Teams、email、Linear、Jira payload。 | 验证团队频道集成 |
Git
分支与交付流程
main 是受保护的稳定分支。工作在 codex/*、feature/*、fix/*、docs/*、chore/* 分支上完成,并通过 PR 合并。release/* 和 hotfix/* 用于发布稳定和紧急修复。
npm install -g aigate-cli
aigate setup --language zh
aigate ai report
aigate start --route default --ask-steps
aigate start --route oss --dry-run
aigate reset --dry-run
aigate clean
aigate start --route ai --provider all
git switch -c feature/my-change
aigate doctor
aigate install-hook --pre-push
aigate test
aigate aitest
aigate git-ready
git add <files>
git commit -m "feat: short summary"
aigate push -u origin feature/my-change
aigate pr-check --output .aigate/reports/pr.md
aigate pr --title "feat: short summary"
aigate github comment --pr <number>
aigate github check --output .aigate/reports/github-check.md
aigate trends record
aigate branch-strategy --compare
aigate github setup --owner @your-org/team --dry-run
aigate release-check --npm
功能
当前已实现功能
功能