Skip to content

Commit a80f57d

Browse files
jnMetaCodeclaude
andcommitted
fix(lint): 推荐章节中英文按 OR 匹配,warning 数 649→51
PR #61 重写 lint-agents.sh 时把章节列表改成 6 个独立项分别检查 ("身份" "核心使命" "关键规则" "Identity" "Core Mission" "Critical Rules"), 导致中文 agent 即使有 ## 身份/核心使命/关键规则,仍会触发"缺少 Identity/ Core Mission/Critical Rules"等英文章节告警,单文件多产生 3 条无效 WARN。 恢复成 3 个 OR-pattern:中英文任一匹配即视为存在。warning 数从 649 降到 51, 剩下的全是真实需要补章节的 agent,信号噪声比恢复。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent e5b0c77 commit a80f57d

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

scripts/lint-agents.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ AGENT_DIRS=(
3333
)
3434

3535
REQUIRED_FRONTMATTER=("name" "description" "color" "emoji")
36-
RECOMMENDED_SECTIONS=("身份" "核心使命" "关键规则" "Identity" "Core Mission" "Critical Rules")
36+
# 中英文任一即可——本仓库以中文为主,英文版用于上游同步
37+
RECOMMENDED_SECTION_PATTERNS=(
38+
"身份|记忆|Identity"
39+
"核心使命|Core Mission"
40+
"关键规则|Critical Rules"
41+
)
3742

3843
errors=0
3944
warnings=0
@@ -99,9 +104,9 @@ lint_file() {
99104
local body
100105
body=$(awk 'BEGIN{n=0} /^---$/{n++; next} n>=2{print}' "$file")
101106

102-
for section in "${RECOMMENDED_SECTIONS[@]}"; do
103-
if ! echo "$body" | grep -qi "$section"; then
104-
echo "WARN $file: 缺少推荐章节 '${section}'"
107+
for pattern in "${RECOMMENDED_SECTION_PATTERNS[@]}"; do
108+
if ! echo "$body" | grep -qiE "$pattern"; then
109+
echo "WARN $file: 缺少推荐章节 (匹配: ${pattern})"
105110
warnings=$((warnings + 1))
106111
fi
107112
done

0 commit comments

Comments
 (0)