fix(sdlc): 目录层 essential 基础规范优先排序——project-directory-spec 等 essential 技能排最前,不被 60 个截断

This commit is contained in:
ymq 2026-08-21 18:41:15 +08:00
parent 71d30e6d45
commit 6b4acaff13

View File

@ -1026,7 +1026,8 @@ async def _build_role_skills_block(sor, project_id, role, org_id=""):
if not merged:
return ""
skills = sorted(merged.values(),
key=lambda s: -SCOPE_PRIORITY.get(getattr(s, 'scope', ''), 0))
key=lambda s: (-int(getattr(s, 'essential', False)),
-SCOPE_PRIORITY.get(getattr(s, 'scope', ''), 0)))
lines = ["## 可用技能(目录,按需用 load_skill 加载全文;优先级 角色>项目>产线>组织>通用)"]
for s in skills[:60]:
tag = SCOPE_TAG.get(getattr(s, 'scope', ''), getattr(s, 'scope', ''))