Merge pull request 'fix(onboarding): enforce canonical skill context' (#9) from fix/onboarding-canonical-skill into master
All checks were successful
Push & PR Check / check (push) Successful in 55s

Reviewed-on: #9
This commit is contained in:
lanrtop 2026-09-21 21:16:27 +08:00
commit f4dc2de53c
2 changed files with 21 additions and 3 deletions

View File

@ -5,7 +5,7 @@ description: 读取炼境项目健康状态,并使用炼境 MCP 的项目管
# 炼境项目技能
开始项目工作时,先读取根 `AGENTS.md` 与 `.claude/liangjing.json` 取得 `project_id`。
开始项目工作时,先读取根 `AGENTS.md` 与 `.lian-jing/context.json` 取得 `project_id`。`.claude/liangjing.json` 仅为旧项目的 Claude 兼容投影,不能作为长期身份来源。
如果当前客户端已发现 `lian-jing` MCP:

View File

@ -547,10 +547,15 @@ fn check_codex_mcp(content: Option<&str>) -> (bool, String) {
fn check_skill(content: Option<&str>) -> (bool, String) {
match content {
Some(content) if content.contains("name: lian-jing") => (true, "炼境项目技能已分发".into()),
Some(content)
if content.contains("name: lian-jing")
&& content.contains(".lian-jing/context.json") =>
{
(true, "炼境项目技能已分发,并使用 canonical context".into())
}
_ => (
false,
"缺少 .agents/skills/lian-jing/SKILL.md——重跑接入包".into(),
"缺少炼境项目技能,或其未使用 .lian-jing/context.json——重跑接入包升级".into(),
),
}
}
@ -1099,6 +1104,19 @@ mod tests {
);
}
#[test]
fn skill_check_requires_canonical_context() {
let legacy = "---\nname: lian-jing\n---\n读取 .claude/liangjing.json";
assert!(
!check_skill(Some(legacy)).0,
"旧 Claude 身份来源不能被误报为已接入"
);
assert!(
check_skill(Some(TMPL_LIANJING_SKILL)).0,
"当前接入包 skill 必须使用 canonical context"
);
}
/// 回归:空路径登记曾把接入包写进炼境进程 cwd(src-tauri/,2026-07-15 批量实调实锤)。
#[test]
fn apply_rejects_empty_or_missing_path() {