gitlink-cli/examples/workflows/pr-quality-gatekeeper/docs/quickstart.md

49 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 最短复现路径3 步)
## 1. 安装与认证
```bash
npm install -g @gitlink-ai/cli # ≥0.2.0label 命令与 gitlink-gatekeeper Skill 已内置)
gitlink-cli auth login # 或 export GITLINK_TOKEN=<私人令牌>
gitlink-cli auth status # 确认已登录
```
## 2. 对任意真实 PR 出评分卡dry-run零写入
在本目录(`examples/workflows/pr-quality-gatekeeper/`)下:
```bash
python3 scripts/gatekeeper_workflow.py \
--owner Gitlink --repo gitlink-cli --pr <PR号> \
--policy ../../../skills/gitlink-gatekeeper/examples/gatekeeper.yaml \
--owner-rules owner-rules.example.yaml \
--output-dir outputs
```
产物:`outputs/<owner>_<repo>_pr<id>_scorecard.md`(评分卡)+ `_summary.json`(结构化摘要)。
退出码:`0` = PASS/COMMENT`2` = REQUEST_CHANGES可直接当 CI 门禁用),`1` = 运行错误。
不带 `--policy` 也能跑(脚本内置同值默认策略);想看含扣分的评分卡,加 `--findings findings.example.json`
## 3. 可选进阶
- **真实回写**(评论 + 裁决标签 + tracking issue`--apply`。请先在自有 fork 演练;自动裁决只用建议性 `common` 评论,绝不替人 approve/reject绝不自动合并。
- **全仓体检**(只读批扫全部 open PR出治理报告
```bash
python3 scripts/gatekeeper_sweep.py \
--owner Gitlink --repo gitlink-cli \
--policy ../../../skills/gitlink-gatekeeper/examples/gatekeeper.yaml \
--owner-rules owner-rules.example.yaml \
--output-dir sweep-out --date-label $(date +%F)
```
- **CI 接入**:见 [`../ci-example/`](../ci-example/)Gitea ActionsPR 触发自动门禁)。
- **改门禁松紧**:复制一份 `gatekeeper.yaml``weights/hard_gates/thresholds`,字段说明见 [Skill REFERENCE](../../../../skills/gitlink-gatekeeper/REFERENCE.md)。
## 验证自己改动没破坏确定性
```bash
python3 tests/test_scoring.py # 同输入 → 同分 → 同裁决 的回归护栏
```