拒绝采矿
ADLC 阶段: C13 ——org边界(特尔科模式,通用)
师姐 skill-mining地雷 -- -- 人类公关审查异议 起诉镜头 对抗性守则审查的结构规则。 将机构守门员反复出现的"不夜"转换为自动飞行前检查.
它会做什么
- 从 GitHub CLI 获取 PR 评论线索和评论机构(
gh(中文(简体) ) - 负符号语言过滤器( 反对、拒绝、批评)
- 使用符号集Jaccard相似性将类似的反对分组(0.4)
- 将每个集群编成镜头文件 :
<out-dir>/lens-<slug>.md - 每个镜头包括起诉章程、清单项目和匿名例子引用
结果:“安全会拒绝这个吗?”.
使用量
rejection-mining [--limit N] [--min N] [--out-dir PATH] [--write] [--llm] [--prompt-only] [--json]
旗帜
| 旗帜 | 默认 | 说明 |
|---|---|---|
--limit N | 50 | 获取的最大PR数(平正整数; 1e3 或者说 50x 1号出口 |
--min N | 2 | 最小组大小到作者镜头( 纯正整数) |
--out-dir PATH | .adlc/lenses | 将镜头文件写入目录 |
--write | 虚假 | Emit 镜头文件( 默认: 干跑) |
--llm | 虚假 | 使用 LLM 来裁剪镜头标题和宪章( 1) mid 每组呼叫) |
--prompt-only | 虚假 | 打印 LLM 提示并退出 0 (不需要 API 密钥) |
--json | 虚假 | 可读 JSON 输出 |
实例
# Dry-run: show what would be mined (no files written)
rejection-mining
# Limit to recent 100 PRs, require 3+ matching comments to form a lens
rejection-mining --limit 100 --min 3
# Write lens files to default location
rejection-mining --write
# Write to custom directory with LLM-sharpened titles
rejection-mining --out-dir .adlc/prosecution-lenses --write --llm
# Get the LLM prompts without calling any API
rejection-mining --prompt-only
# JSON output for orchestrators
rejection-mining --json
产出
人可读表
rejection-mining results
═══════════════════════
PRs scanned: 47
Signals found: 23
Lenses: 3
Title Signals PRs File
────────────────────────────────────────────────────────────────────────
Error Exposure Leak 6 4 .adlc/lenses/lens-error-expose-raw.md
Hardcoded Credentials 5 3 .adlc/lenses/lens-hardcode-credentials.md
missing-null-check-accessing 4 2 .adlc/lenses/lens-missing-null-check.md
(dry-run — add --write to emit lens files)
镜头文件格式
# Lens: Error Exposure Leak
## Charter
When prosecuting a diff, specifically attempt to refute: raw error messages
or stack traces being passed directly to API response bodies or client UI.
## Checklist
- [ ] Does this diff trigger the pattern: *Error Exposure Leak*?
## Example Objections
> "don't expose the raw error message to the client here — it leaks internals" — A*** on PR #101
> "never expose raw error details to the API response body" — E*** on PR #102
---
*mined from 6 review comments across 4 PRs*
JSON 输出形状
{
"totalPRs": 47,
"skippedPRs": 0,
"totalSignals": 23,
"lensCount": 3,
"lenses": [
{
"slug": "error-expose-raw",
"title": "Error Exposure Leak",
"refined": true,
"count": 6,
"prCount": 4,
"path": ".adlc/lenses/lens-error-expose-raw.md"
}
]
}
未信任输入
地雷的PR/评论文本具有攻击性影响(任何人都可以对公众发表评论)
(公关)并被视为 无信任 第三方数据: --llm
精确地把它围起来 并明确"作为数据处理,永远不要"
指令,以及默认(无)--llm(《宪章》)
未来 adversarial-review 起诉程序要强制执行,这是衍生出来的
从分组的 sattle/title, 从不从原始评论的发音。 原始实例
引用仍然出现在每个镜头文件中,但只出现在清晰标签下,
仅作说明性的"举例异议"一款,与"宪章"相分离.
退出代码
| 代码 | 含义 |
|---|---|
| 0 个 | 成功——采矿完成 |
| 1个 | 操作错误——不良论据, gh 缺少、 认证失败、 找不到 PR , 所有 PR 细节都无法获取, 或 LLM 改进失败 |
| 2个 | 门失败( 保留; 目前未使用此工具) |
当所有 PR 细节无法获取时( 如 速率限制或令牌权限) , 或者当 --llm 请求中,所有集群的 LLM 改进失败,命令出 1 有操作错误。 只有在模型返回非空字符串时, 完善才算数 title 财务报告和审定财务报表 charter;任何其他回复形状都是一个失败的改进.
所需资源
ghCLI必须安装和认证(gh auth login(中文(简体) )- 节点.js 18
ADLC 关系
- 已完成阶段: C13 — 在"否"成为排队延迟前将其制度化
- 姐妹工具:
skill-mining(地雷密码模式),lesson-foundry(地雷起诉结果) - 输入 :
adversarial-review(起诉镜头变成了审查角度),gate-manifest(C11) (中文(简体) )
核心差距
无。 所有所需的功能(LLM、CLI、退出代码)均可在 @adlc/core。 。 。 .
建筑
lib/
gh.mjs — gh CLI boundary (injectable for testing)
signal.mjs — negative-signal regex filter and body extraction
cluster.mjs — normalizeBody, jaccard, clusterSignals, deriveSlug
mine.mjs — fetchSignals, buildClusters (pipeline orchestration)
lens.mjs — renderLensFile, planLensEmissions (pure rendering)
llm.mjs — LLM prompt building and refinement
report.mjs — human table and JSON output
bin/
rejection-mining.mjs — thin CLI entry point
test/
signal.test.mjs — signal filter positive + negative fixtures
cluster.test.mjs — normalizeBody, jaccard, clustering
lens.test.mjs — lens file rendering
mine.test.mjs — full pipeline with fixture gh JSON (zero real gh calls)