pdlc-relatelisted
Install: claude install-skill kanfu-panda/pdlc-skills
# Feature 关系链管理
<!-- @include templates/prompts/iron-law.md -->
管理 PDLC feature 之间的关系链。维护反向索引 `docs/.pdlc-state/_relations.json` 和全局图 `docs/.pdlc-state/_graph.md`。
<!-- @include templates/prompts/relations.md -->
## 段一:执行子命令
从 `$ARGUMENTS` 解析子命令:
### `set <fid> <type> <target-fid> [target-fid...]`
为 feature `<fid>` 添加 `<type>` 关系,指向一或多个目标。
1. 读 `docs/.pdlc-state/<fid>.json`;**若无 `relations` 块**(旧状态文件 / Phase 1 关系块可选),先初始化六类空块(`extends`/`depends_on`/`supersedes`/`resolves`/`conflicts_with`/`relates_to`),再在 `relations.<type>` 数组追加目标(去重)
2. 若 `<type>` 是对称类型(conflicts_with / relates_to)→ 同时在每个目标的 `<fid>.json` 镜像写入
3. 写回后调用本命令 `rebuild` 流程刷新 `_relations.json` + `_graph.md`
### `query <fid>`
显示 `<fid>` 的全部关系(出边 + 从 `_relations.json` 读入边)。
### `impact <fid>` ⭐ 杀手锏
分析改动 `<fid>` 的影响半径。读 `_relations.json`:
- 🔴 **直接影响**(depth 1 入边):直接 extends / depends_on 本 feature 的,必须协调
- 🟡 **间接影响**(depth ≥2 传递入边):通过中间 feature 传递依赖的,应 review
- 🟢 **历史**(指向 terminal-state feature 的边 / resolves 的缺陷):仅审计
输出树状结构 + 建议(先 review 哪些 PRD / 是否该新建 supersedes feature 而非就地改)。
### `orphans`
列出 `_relations.json` 中 inbound + outbound 均为空的 feature(可能是孤立 / 死代码候选)。
### `rebuild`
扫描所有 `docs/.pdlc-state/<id>.json` 的 `relations` 块 + 文档追溯头的 `关系:` 行,重建:
- `_relations.json`:nodes(id→name/stage/terminal)+ edges(flat 有向列表)+ index(每节点预计算 inbound/outbound)
- `_graph.md`:mermaid 图,边样式按类型区分(supersedes 虚线 / conflicts_with 粗线 / 其余实线),顶部加 `<!-- AUTO-GENERATED by /pdlc-relate · do not edit by hand -->`
### `validate`
按 `re