Files
xmwork/.claude/commands/audit-deps.md
T
gongzhiyong bc7f53790e feat: add team agent library (3 slash commands + 2 specialist agents)
Commands (.claude/commands/):
- /audit-deps [repo|all]    — CVE + outdated deps audit with risk ranking
- /add-ci <repo>            — add GitHub Actions CI matching repo's stack
- /review-pr <pr>           — deep PR review, comment-only (no auto-approve)

Specialist agents (.claude/agents/):
- casdoor-specialist        — Go/Beego expert, upstream fork safety
- lobechat-brand-guardian   — protect 242 locale de-branding on rebase

README.md: add '团队可以/应该写什么' section
 - categorizes 6 types of content for ai-ops
 - specifies PR flow, reviewer checklist, refresh mechanism

.gitignore: exclude .claude/settings.local.json and reports/
2026-04-23 23:36:24 +08:00

2.2 KiB
Raw Blame History

description, argument-hint
description argument-hint
审计 6 仓库的过时依赖和已知 CVE,生成风险排序报告
repo-name | all

你要为 $1 执行依赖审计(如果 $1 为空或 all,则审计全部 6 个仓库)。

仓库清单与技术栈

仓库 语言 依赖文件
chat-gw Python requirements*.txt / pyproject.toml
xiaoshou Python + Node requirements.txt + frontend/package.json
gongdan Node + Python ticket-system/backend/package.json + ticket-system/frontend/package.json + kb-chat-python/requirements.txt
casdoor-internal Go + Node go.mod + web/package.json
CloudCostbrank Python requirements.txt
lobechat-enterprise Node package.json (pnpm monorepo)

执行步骤

对每个目标仓库:

  1. 过时检查

    • Python: pip list --outdated --format=json 或 uv pip list --outdated
    • Node: npm outdated --json 或 pnpm outdated --format json
    • Go: go list -u -m -json all | jq 'select(.Update)'
  2. CVE 检查

    • Python: pip-audit --format json(没装就 uv pip install pip-audit 到 /tmp 虚拟环境)
    • Node: npm audit --json 或 pnpm audit --json
    • Go: govulncheck ./...(没装就 go install golang.org/x/vuln/cmd/govulncheck@latest)
  3. 聚合分析

    • 同一个包在多仓库出现 → 合并
    • 按严重度排序:CRITICAL > HIGH > MEDIUM > LOW > 无 CVE 但版本落后
    • 忽略"落后 1 个补丁版本"这类噪音

输出

生成 /workspace/ai-ops/reports/audit-$(date +%Y-%m-%d).md:

# 依赖审计报告 YYYY-MM-DD

## 汇总
- 扫描仓库:N 个
- 发现 CVE:X 个(高危 A / 中 B / 低 C)
- 过时依赖:Y 个

## 高危 CVE(必须立即处理)
| 仓库 | 包 | 当前 | 修复版本 | CVE | 说明 |
|---|---|---|---|---|---|

## 中低危 CVE
...

## 纯版本落后
按仓库分组,表格展示

限制

  • 只读取分析,禁止自动升级(升级走 /upgrade-deps 或手工 PR)
  • 遇到 --fix-missing / 拉包失败 → 记录到报告末尾"扫描失败项"段落,不中止流程
  • 跨仓库共现的包要在报告顶部专门列一节,标注"统一升级收益"