mirage
strukto-ai
The World's First Unified Virtual Filesystem For AI Agents
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:AlloyPlane/gitguard
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
中英双语 · Bilingual | MIT License Inspired by the L1/L2/L3 layered security idea popularized by AI coding assistants (e.g. Qoder).
gitguard 让本机所有 git 仓库在提交/推送前自动做安全扫描,并支持 LLM 深度安全审查。 gitguard adds an automatic security scan before every git commit / push on your machine, plus optional LLM-powered deep security review (L2/L3).
| EN | 中文 |
|---|---|
L1 rule scan (automatic) — pre-commit / pre-push hooks scan staged/all files against security-patterns.yaml (14 rules: API keys, AWS, private keys, SQL-injection, eval, …) and block risky commits/pushes |
L1 规则扫描(自动) — pre-commit / pre-push 钩子按 security-patterns.yaml(14 条规则:密钥/AWS/私钥/SQL注入/eval…)扫描暂存区/全库,命中拦截 |
L2/L3 LLM review (manual) — review reviews diff / commit range / whole repo with any OpenAI-compatible model, outputting severity + fix advice |
L2/L3 LLM 审查(手动) — review 用任意 OpenAI 兼容模型审查 diff / 提交范围 / 全仓库,输出严重级别+修复建议 |
Global — core.hooksPath protects every repo on the machine |
全局生效 — core.hooksPath 使本机所有仓库自动防护 |
| Zero dependency — pure Python stdlib, cross-platform | 零依赖 — 纯 Python 标准库,跨平台 |
| Interactive model choice — 1) current model from your config, 2) custom (address / key / model) | 交互选模型 — ① 用你当前正在用的模型 ② 自定义(地址/Key/模型三要素) |
git clone https://github.com/AlloyPlane/gitguard.git
cd gitguard
python gitguard.py install # installs global hooks (core.hooksPath → ~/.gitguard)
Or install as a command / 或安装为命令:
pip install . # provides the `gitguard` command
gitguard install
Run review and choose a model mode / 运行 review 时选择模型模式:
gitguard security review mode:
[1] Use your current model (deepseek-v4-pro) ← 用你正在用的模型,回车即用
[2] Custom model (address / API key / model) ← 自定义,填三要素
gitguard scan # scan all tracked files (also run by pre-push hook)
gitguard scan --staged # scan staged files (also run by pre-commit hook)
gitguard review --diff # L2: review uncommitted changes (LLM)
gitguard review --commits A..B # L3: review a commit range
gitguard review --all # L3: review whole repo (sampled)
gitguard config # save custom model settings (address/key/model)
gitguard status # show hook & rule status
gitguard uninstall # remove global hooks
Priority / 优先级: CLI args > env (DEEPSEEK_API_KEY / OPENAI_API_KEY) > ~/.gitguard/config.json > ~/.kic-ai/config.json (your current model).
install copies pre-commit / pre-push hooks to ~/.gitguard and sets the global
core.hooksPath. Hooks call gitguard scan; rule hits block the commit/push.
安装时把 pre-commit / pre-push 钩子装到 ~/.gitguard 并设置全局 core.hooksPath,
钩子调用 gitguard scan,命中规则即阻止提交/推送。
security-patterns.yaml (edit to add your own; take effect immediately). 规则可自行增改,改完即生效。PRs welcome. This project's own commits/pushes are protected by gitguard itself (dogfooding). 欢迎 PR,本项目自己的提交也受 gitguard 保护(自举)。
MIT — see LICENSE.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: git、git-hooks、secret-scanning、security、security-review。