feat(profile): 建立技术能力契约与校验器

This commit is contained in:
zhiye.sun
2026-09-03 17:11:47 +08:00
parent f7ea0dcd86
commit 381308e04a
9 changed files with 286 additions and 0 deletions
@@ -0,0 +1,20 @@
# Profile 解析规则
## 模块选择
- 将目标路径和模块根转换为项目相对规范路径。
- 选择路径前缀最长的模块根。
- 同一目标命中多个同长度模块时返回 `ambiguous`。
- 跨模块任务分别解析,不合并为仓库级单一 Profile。
## 候选选择
1. 项目已确认 `preferredProfiles` 时,先检查对应提供方是否被发现。
2. 没有偏好时按语言、框架、版本和构建证据筛选。
3. 优先版本范围更窄、探测证据更具体的候选。
4. 仍有多个候选时按较高 `priority` 选择。
5. 排序后仍不能唯一确定时返回 `ambiguous`。
6. 没有版本匹配时,只允许加载 `*` 的版本中性 Profile。
项目事实和清单冲突时保留项目事实,返回 `incompatible`,不能建议自动升级项目依赖。