LeeHueeng/aigate-ai-git-workflow-guard-cli

GitHub: LeeHueeng/aigate-ai-git-workflow-guard-cli

AIGate 是一款零配置的 pre-push 安全 CLI,用于在推送前拦截 AI 生成的高风险 Git 变更、检测潜在密钥并评估 PR 就绪度。

Stars: 2 | Forks: 0

# AIGate 在 push 之前阻止有风险的 AI 生成的 Git 更改。 [![CI](https://static.pigsec.cn/wp-content/uploads/repos/cas/ad/ad5834178f7599af9fdda11629d49cae07f2997beec49821b2920eff5bfd50e7.svg)](https://github.com/LeeHueeng/aigate-ai-git-workflow-guard-cli/actions/workflows/ci.yml) [![OpenSSF Scorecard](https://static.pigsec.cn/wp-content/uploads/repos/cas/f3/f3a65d47b9bca0d58f5096d2122d67f03dcf1853eb5aeb80be08786490206dd6.svg)](https://github.com/LeeHueeng/aigate-ai-git-workflow-guard-cli/actions/workflows/scorecard.yml) [![npm version](https://img.shields.io/npm/v/aigate-cli.svg)](https://www.npmjs.com/package/aigate-cli) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) ## 语言 - README:[English](README.md) | [한국어](README.ko.md) | [日本語](README.ja.md) | [中文](README.zh.md) - 运维指南:[English](docs/operations.en.md) | [한국어](docs/operations.ko.md) | [日本語](docs/operations.ja.md) | [中文](docs/operations.zh.md) - HTML 概述: AIGate 是一款用于 AI 辅助编程的零配置 pre-push 安全 CLI。它会在更改到达您的远程分支或 pull request 审查之前,检查已更改的文件、潜在的 secrets、仓库就绪度、PR 风险以及分支策略。 ![AIGate 终端演示](https://static.pigsec.cn/wp-content/uploads/repos/cas/90/900f5b4d823ca0103e2ad8b5ece4f246ab973e004653d301c9f5dbe83e6cb9b9.svg) ![AIGate 演示](https://static.pigsec.cn/wp-content/uploads/repos/cas/7c/7cb48642cf6a4d3623404e021845564c528abb1f21175d1941f180bdbc457011.gif) ## 适用场景 - 您的 AI 编程助手更改文件的速度超出了您的审查能力。 - 您希望通过一条命令来了解 `git push` 之前的就绪状态。 - 您维护着一个开源 package,并且需要 PR、发布和仓库健康度信号。 - 您希望拥有能在本地和 CI 中运行的 Markdown、HTML、JSON 和 SARIF 输出。 - 您希望 Codex、Gemini 和 Claude Code 遵循与人类相同的分支和验证工作流。 ## 60 秒快速开始 免安装运行: ``` npx -y aigate-cli check npx -y aigate-cli start --route default --dry-run npx -y aigate-cli start --route quickstart --dry-run npx -y aigate-cli doctor npx -y aigate-cli test npx -y aigate-cli ai report npx -y aigate-cli demo npx -y aigate-cli pr-check npx -y aigate-cli evaluate-project ``` 或全局安装: ``` npm install -g aigate-cli aigate start aigate start --route default --ask-steps aigate start --route default --steps init,repo-files aigate start --route oss --dry-run aigate reset --dry-run aigate clean aigate uninstall aigate check aigate test aigate ai report aigate aitest aigate git-ready aigate install-hook --pre-push aigate pr-check ``` 从源码尝试: ``` git clone https://github.com/LeeHueeng/aigate-ai-git-workflow-guard-cli.git cd aigate-ai-git-workflow-guard-cli npm install npm test node src/cli.mjs check ``` ## 您将获得什么 ``` AIGate git-ready: READY Branch: feature/my-work Changed files: 4 Secret findings: 0 Project score: 92/100 Blockers: none Warnings: none Recommendation: Run AIGate test, commit focused changes, push the branch, and open a pull request. ``` 当 AI 编程助手操作迅速,且您需要在 `git push` 或创建 PR 之前设置一个可重复的本地关卡时,AIGate 非常有用。 ## 场景手册 | 情况 | 流程 | 命令 | | --- | --- | --- | | 新仓库采用 | 逐步创建默认的 AIGate 文件,然后安装 pre-push 守卫。 | `aigate start --route default --ask-steps` -> `aigate doctor` -> `aigate install-hook --pre-push` | | AI 更改了大量文件 | 检查更改的路径,运行测试,并将失败转换为专注的 AI 修复 prompt。 | `aigate check` -> `aigate test` -> `aigate aitest --provider codex` | | PR 快准备好了 | 通过关卡,通过 AIGate 进行 push,并生成审查者上下文。 | `aigate git-ready` -> `aigate push -u origin feature/my-work` -> `aigate pr-check` | | 私有 GitLab monorepo | 锁定 profile,运行带有 turbo 感知回退的 workspace 测试,并将 GitHub/npm package 关卡排除在应用评分之外。 | `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` | | 发布周 | 验证 npm 和 tag 就绪状态,运行 CI,并记录趋势。 | `aigate release-check --npm` -> `npm run ci` -> `aigate trends record` | ## 当前可用功能 | 功能 | 命令 | | --- | --- | | 本地 Git 就绪度检查 | `aigate check` | | 引导式设置路由 | `aigate start` | | 带有是/否步骤选择的默认设置 | `aigate start --route default --ask-steps` | | 确定性设置步骤选择 | `aigate start --route default --steps init,repo-files` | | 重置 AIGate config 和设置 | `aigate reset` | | 删除生成的本地报告和状态 | `aigate clean --force` | | 移除 AIGate config、本地状态和拥有的 hook | `aigate uninstall --force` | | 开源入门 README、issue 模板和贡献文件 | `aigate start --route oss` | | 项目测试运行器 | `aigate test` | | Turbo 感知回退以及 pnpm、yarn、bun 和 workspace 测试检测 | `aigate test` | | AI 修复 prompt 和可选的 agent 运行 | `aigate aitest` | | 包含问题、优势、方向和交接 prompt 的 AI 项目健康报告 | `aigate ai report` | | 首次运行诊断 | `aigate doctor` | | 引导式 CLI 演示 | `aigate demo` | | Pre-push 安全关卡 | `aigate git-ready` | | Pre-push hook 安装器 | `aigate install-hook --pre-push` | | 受保护的 push 包装器 | `aigate push -u origin ` | | Pull request 就绪度报告 | `aigate pr-check` | | GitHub PR 摘要评论 | `aigate github comment --pr ` | | GitHub Checks 摘要 payload | `aigate github check --format json` | | GitHub PR 模板和 CODEOWNERS 设置 | `aigate github setup` | | Markdown、HTML、JSON、SARIF 报告 | `aigate report --format ` | | 已更改文件的 secret 扫描 | `aigate report --format sarif` | | 仓库健康度评分 | `aigate evaluate-project` | | 深度项目报告 | `aigate evaluate-project --deep --report` | | 合规性控制报告 | `aigate compliance-report` | | 本地 HTML 健康度仪表板 | `aigate dashboard` | | 项目健康度趋势历史 | `aigate trends record` | | 针对私有应用、GitLab 和 pnpm 的自动及锁定 profile | `aigate setup --hosting gitlab` | | 分支策略 policy pack | `aigate branch-strategy --apply` | | 分支策略建议比较 | `aigate branch-strategy --compare` | | 发布就绪度检查 | `aigate release-check --npm` | | Slack BLOCK 通知 | `aigate git-ready --notify-channel slack` | | Discord 和 Teams webhook payload | `aigate notify test --channel discord` | | Codex、Gemini 和 Claude Code 指令 | `aigate integrate all` | ## 为什么不直接使用 Husky、Lefthook、pre-commit 或 Gitleaks? | 工具 | 主要工作 | AIGate 的不同之处 | | --- | --- | --- | | Husky | 为 JavaScript 项目设置 Git hook | AIGate 是一个可运行的就绪度关卡,而不仅仅是 hook 连接。 | | Lefthook | 快速的多语言 hook 运行器 | AIGate 专注于 PR 就绪度、仓库健康度和分支策略。 | | pre-commit | Hook 框架和 hook 生态系统 | AIGate 是零配置的,且专注于 Git/PR 工作流。 | | Gitleaks | 深度 secret 扫描 | AIGate 包含轻量级的已更改文件检查和 SARIF 输出,可以与 Gitleaks 互补。 | 阅读完整的[工具对比](docs/comparison.md),了解与 Husky、Lefthook、pre-commit 和 Gitleaks 的推荐组合。 ## 典型工作流 ``` git switch -c feature/my-work aigate ai report aigate start --route default --ask-steps aigate start --route oss --dry-run aigate start --route ai --provider all aigate reset --dry-run aigate clean aigate doctor aigate install-hook --pre-push aigate test aigate aitest aigate git-ready git add git commit -m "feat: my focused change" aigate push -u origin feature/my-work aigate pr-check --output .aigate/reports/pr.md aigate pr --title "feat: my focused change" aigate github comment --pr aigate github check --output .aigate/reports/github-check.md aigate trends record aigate github setup --owner @your-org/team --dry-run ``` 当出现阻碍项时发送 Slack 通知: ``` AIGATE_SLACK_WEBHOOK_URL="https://hooks.slack.com/services/..." \ aigate git-ready --notify-channel slack ``` ## GitHub Actions 将 AIGate 作为可重用的公共 GitHub Action 使用: ``` name: AIGate on: pull_request: jobs: aigate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: LeeHueeng/aigate-ai-git-workflow-guard-cli@v0.1.6 with: command: git-ready language: en ``` 使用当前的发布 tag 以获得稳定的运行,或者仅在您有意需要未发布的行为时才使用 `@main`。完整的输入项记录在 [GitHub Action](docs/github-action.md) 中。相同的 action 元数据被镜像到 `.github/actions/aigate` 以进行本地工作流测试。 Action 发布状态: - 当前稳定 tag:`v0.1.6` - Action 使用:可通过 `LeeHueeng/aigate-ai-git-workflow-guard-cli@v0.1.6` 使用 - 市场发布:手动在 GitHub 发布屏幕步骤中操作 - Action 名称:`AIGate AI Git Workflow Guard CLI` - 主要类别:`Code quality` - 次要类别:`Security` - 发布标题:`AIGate AI Git Workflow Guard CLI v0.1.6` ## AI Agent 集成 为 Codex、Gemini 和 Claude Code 生成仓库指令: ``` aigate integrate all aigate ai report aigate ai report --apply --provider codex aigate aitest --provider codex aigate aitest --apply --provider codex ``` 这将创建 `AGENTS.md`、`GEMINI.md`、`CLAUDE.md` 和 `.aigate/integrations/*`,以便 AI 助手遵循与人类贡献者相同的分支、验证和受保护的 push 工作流。`aigate aitest` 会写入 `.aigate/reports/ai-test.md`;`--apply` 是一个显式开关,允许 AIGate 调用 Codex、Claude、Gemini 或自定义的 `--agent-command`。 `aigate ai report` 结合了当前的 Git 状态、仓库基础评分、 发布就绪度、分支策略和 AI 交接指导。默认情况下它不编辑 文件。仅当您希望 AIGate 使用生成的项目简报运行选定的 AI CLI 时,才添加 `--apply --provider codex|claude|gemini`。 当运行 `--apply` 时,AIGate 会在终端中显示 prompt 路径、provider、agent 命令和 实时的 agent 输出,然后在报告中捕获 stdout/stderr。 ## 输出语言 AIGate 支持英语、韩语、日语和中文的 CLI 输出: ``` aigate setup --language en aigate setup --language ko aigate setup --language ja aigate setup --language zh ``` ## 公开安装渠道 目前可使用以下公开安装路径: ``` npm install -g aigate-cli brew install LeeHueeng/tap/aigate-cli docker run --rm -v "$PWD:/repo" -w /repo ghcr.io/leehueeng/aigate-cli:0.1.6 check ``` ## 规划中,尚未发布 这些仍在路线图上: - 独立二进制文件 - 托管仪表板 - 更深度的 Linear 和 Jira 工作流自动化 ## 文档 - [使用指南](docs/usage.md) - [分发指南](docs/distribution.md) - [工具对比](docs/comparison.md) - [通知指南](docs/notifications.md) - [AI 集成](docs/ai-integrations.md) - [基础 Node 项目示例](docs/examples/basic-node-project.md) - [JSON 输出示例](docs/examples/json-output.md) - [Windows 冒烟测试说明](docs/examples/windows-smoke-test.md) - [分支策略](docs/branch-strategy.md) - [发布流程](docs/release-process.md) - [热修复流程](docs/hotfix-process.md) - [Git 上传工作流](docs/git-upload-workflow.md) - [路线图](docs/roadmap.md) - [多语言文档索引](docs/README.md) - [更新日志](CHANGELOG.md) - [English 运维指南](docs/operations.en.md) - [한국어 운영 문서](docs/operations.ko.md) - [日本語運用ドキュメント](docs/operations.ja.md) - [中文运维说明](docs/operations.zh.md) - 本地可视化 HTML 指南:[ko](docs/aigate-overview.ko.html), [en](docs/aigate-overview.en.html), [ja](docs/aigate-overview.ja.html), [zh](docs/aigate-overview.zh.html) ## 许可证 MIT
标签:AI辅助编程, Git钩子, MITM代理, SOC Prime, 代码审查, 开发工具, 暗色界面, 自定义脚本, 请求拦截