Repository navigation
feat(policy): enforce English-only normative artifacts across templat… - #4
lwyBZss8924d wants to merge 1 commit into
Conversation
…es, agents, and CI - Add Language Policy as Principle VI in memory/constitution.md - Update all SDD templates with language requirements and checklists - Add language policy directives to AI command templates - Update all CLAUDE.md and WARP.md files with language policy section - Create scripts/sdd/check_language.sh for CI enforcement - Add language-policy job to sdd-ci.yml workflow - Update Claude workflow prompts with language compliance reminder This ensures all specifications, plans, tasks, and documentation committed to the repository are written in English for global accessibility and consistency across all AI agents and contributors.
Walkthrough在仓库中引入“英语为唯一规范语言”的策略:新增CI语言检查脚本与作业,并将其作为SDD验证的前置依赖;多处工作流与文档、模板中加入相应语言策略说明;不涉及对导出/公共代码接口的更改。 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant GH as GitHub Actions
participant LP as language-policy Job
participant SH as check_language.sh
participant V as sdd-validate Job
Dev->>GH: Push / PR
GH->>LP: Trigger job (ubuntu-latest)
LP->>LP: Checkout repo
LP->>SH: Run scripts/sdd/check_language.sh
alt Non-English found
SH-->>LP: Exit 1 (violations listed)
LP-->>GH: Job failed
GH-->>V: Blocked (needs: language-policy)
else All English
SH-->>LP: Exit 0 (pass)
LP-->>GH: Job succeeded
GH->>V: Run sdd-validate (proceeds)
end
note over SH,LP: 检查.md/.txt/.rst于规范性目录与特定文件清单
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks (3 passed)✅ Passed checks (3 passed)
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (20)
scripts/sdd/check_language.sh (3)
7-12: 移除未使用的颜色常量以消除 ShellCheck 警告。
当前 YELLOW 未被使用(SC2034)。建议删除。- YELLOW='\033[1;33m' NC='\033[0m' # No Color
33-35: 可移除二进制文件判断,或改为更稳健的扩展名白名单。
已限定 find 仅扫描 .md/.txt/.rst,file 检测显得多余;若保留,建议使用 grep -E 明确交替。- if file "$file" | grep -q "binary\|image\|data"; then + if file "$file" | grep -Eq "binary|image|data"; then return 0 fiAlso applies to: 61-65
38-45: 提升跨平台兼容性:为 grep -P 提供回退方案。
macOS/BSD 环境可能不支持 -P。建议在脚本顶部探测 PCRE 支持,回退到 perl:# 片段示例(可在 check_file 内使用) if grep -P '' </dev/null >/dev/null 2>&1; then detector="grep -qP \"$NON_EN_PATTERN\"" else detector="perl -ne 'exit(1) if /$NON_EN_PATTERN/u' || exit 0" fi # 然后用 eval "$detector" 处理 awk 输出.github/workflows/sdd-ci.yml (1)
11-22: 添加最小权限并移除临时 chmod
- 在
.github/workflows/sdd-ci.yml中language-policy作业下添加:permissions: contents: read- 删除
run步骤中的chmod +x scripts/sdd/check_language.sh || truetemplates/commands/plan.md (1)
12-13: 统一措辞与交叉引用(微调)建议将“in English only (all normative artifacts must be English)”统一为“English-only(所有规范性工件必须为英文)”,并添加到项目宪章的交叉引用,便于读者定位规则来源。
可选改动:
-**Language Policy**: Produce the implementation plan in English only (all normative artifacts must be English). +**Language Policy**: Produce the implementation plan in English-only (all normative artifacts must be English). See /memory/constitution.md Principle VI.templates/commands/specify.md (1)
12-13: 措辞一致性与溯源链接与其它模板保持“English-only”连字符写法,并指向宪章条款(Principle VI)以增强一致性与可追溯性。
-**Language Policy**: Generate the specification in English only (all normative artifacts must be English). +**Language Policy**: Generate the specification in English-only (all normative artifacts must be English). See /memory/constitution.md Principle VI.dev-docs/sdd/CLAUDE.md (5)
5-8: 明确范围与例外(规范性/非规范性)建议在此段落补充“允许的例外”示例(如专有名词、代码标识符、引用原文、链接、文件名),并指向CI语言检查脚本,帮助Claude在提交前自检。
## Language Policy -All normative specification and task artifacts (PRDs, specifications, implementation plans, issues, task plans) committed to the repository MUST be written in English. Conversational discussions may occur in other languages, but do not commit non-English content to these artifacts. +All normative specification and task artifacts (PRDs, specifications, implementation plans, issues, task plans) committed to the repository MUST be written in English. Conversational discussions may occur in other languages, but do not commit non-English content to these artifacts. + +Allowed exceptions within normative files: proper nouns, code identifiers, quoted text, URLs, and filenames. See Principle VI in /memory/constitution.md and the CI checker scripts/sdd/check_language.sh.
40-50: 与包管理策略保持一致(uv/pip 指南统一)本文档上方使用了“uv/uvx”,此处建议给出 dev 依赖的统一安装方式(uv 或 pipx),并避免混用导致的环境差异。
-# Install development dependencies -pip install -e ".[dev]" +# Install development dependencies (choose ONE approach) +# Using uv (recommended) +uv pip install -e ".[dev]" +# or using pipx for tools-only installs: +# pipx install black && pipx install ruff
128-147: 目录树建议包含 memory/(反映本PR新增宪章位置)当前目录树未展示 memory/ 目录,但本PR中新增了 /memory/constitution.md 的原则条目。建议在示意树中补充,避免读者困惑。
├── dev-docs/ # Development documentation │ ├── sdd/ # SDD methodology docs (constitution.md, lifecycle.md) ... ├── tests/ # Test suite └── .github/workflows/ # CI/CD pipelines +├── memory/ # Project constitution and knowledge base +│ └── constitution.md # Core principles (see Principle VI: Language Policy)
148-155: 提交信息格式在仓库内不一致(需统一)此处为“type(scope): description [TASK-XXX]”,而 WARP.md/其它文档示例使用“type: message [TASK-ID]”。建议统一一种格式并在校验脚本体现,否则贡献者会混淆。
-- Commit messages must follow format: `type(scope): description [TASK-XXX]` +- Commit messages must follow format: `type(scope): description [TASK-XXX]` +# Alternative (if preferred across docs): +# - Commit messages must follow format: `type: description [TASK-XXX]`
160-165: 微调措辞与聚合说明(可选)“Python 3.11+ required”“ignore-agent-tools”等提示可合并为“环境前置条件/可选开关”小节,提升可读性;非功能性,按需调整。
templates/agent-file-template.md (1)
5-8: 补充例外与引用宪章(提升可执行度)在语言策略段落中加入例外示例(专有名词、代码标识符、URL、引用原文),并指向 /memory/constitution.md Principle VI 与 CI 脚本,避免误删合法内容。
-All normative specification and task artifacts (PRDs, specifications, implementation plans, issues, task plans) committed to the repository MUST be written in English. You may converse with developers in other languages, but do not commit non-English content to these artifacts. +All normative specification and task artifacts (PRDs, specifications, implementation plans, issues, task plans) committed to the repository MUST be written in English. You may converse with developers in other languages, but do not commit non-English content to these artifacts. Allowed exceptions: proper nouns, code identifiers, URLs, and quoted text. See /memory/constitution.md Principle VI and scripts/sdd/check_language.sh.templates/commands/tasks.md (1)
12-13: 文案一致性(连字符与溯源)与其它模板保持“English-only”写法,并附上宪章引用,统一读者心智模型。
-**Language Policy**: Generate tasks.md in English only (all normative artifacts must be English). +**Language Policy**: Generate tasks.md in English-only (all normative artifacts must be English). See /memory/constitution.md Principle VI.memory/constitution.md (1)
31-33: 增强 VI. Language Policy 段落:
- 在 memory/constitution.md 中补充
• 目录/文件范围:specs/、templates/、dev-docs/、memory/、CLAUDE.md、AGENTS.md、WARP.md
• 允许例外:专有名词、代码标识符、URL、引用原文
• 执行方式:新增 GitHub Actions 作业 “language-policy”,在 .github/workflows 中调用 scripts/sdd/check_language.sh 于 SDD 验证前(已确认脚本中包含上述范围与文件)
**更新页尾元数据:**将 Last Amended 日期改为 2025-09-10WARP.md (1)
3-8: 补充 Language Policy 段落中的宪章链接
在 WARP.md 中的 “Language Policy (English-only Normative Artifacts)” 段落下新增:See [Constitution Principle VI](/memory/constitution.md#principle-vi).CI 已在 scripts/sdd/check_language.sh 的 NORMATIVE_FILES 中包含 WARP.md,无需额外调整。
CLAUDE.md (5)
5-8: 语言策略段完善例外与溯源与其它文件一致,补充允许的例外并附宪章/CI脚本引用,避免误判专有名词/代码标识符。
## Language Policy -All normative specification and task artifacts (PRDs, specifications, implementation plans, issues, task plans) committed to the repository MUST be written in English. Conversational discussions in PRs/issues may occur in other languages, but do not commit non-English content to these artifacts. +All normative specification and task artifacts (PRDs, specifications, implementation plans, issues, task plans) committed to the repository MUST be written in English. Conversational discussions in PRs/issues may occur in other languages, but do not commit non-English content to these artifacts. Allowed exceptions: proper nouns, code identifiers, URLs, and quoted text. See /memory/constitution.md Principle VI and scripts/sdd/check_language.sh.
40-50: 工具安装方式统一到 uv(建议)与文档其它部分保持一致,优先推荐 uv;pip/pipx 可作为备选。
-# Format Python code -black src/ tests/ scripts/sdd/*.py --line-length 100 +# Format Python code +uvx black src/ tests/ scripts/sdd/*.py --line-length 100 -# Lint Python code -ruff check src/ tests/ scripts/sdd/*.py +# Lint Python code +uvx ruff check src/ tests/ scripts/sdd/*.py -# Install development dependencies -pip install -e ".[dev]" +# Install development dependencies +uv pip install -e ".[dev]"
128-147: 目录树补充 memory/ 目录(与本PR一致)建议与 dev-docs/sdd/CLAUDE.md 的建议一致,加入 memory/ 节点。
├── tests/ # Test suite └── .github/workflows/ # CI/CD pipelines +├── memory/ # Constitution & long-term memory +│ └── constitution.md
148-155: 提交信息格式一致性与 WARP.md/其它处存在“type: ... [TASK-ID]”vs“type(scope): ... [TASK-XXX]”不一致,建议统一并在校验器中强制。
-- Commit messages must follow format: `type(scope): description [TASK-XXX]` +- Commit messages must follow format: `type(scope): description [TASK-XXX]` +# If aligning to simpler format across docs: +# - Commit messages must follow format: `type: description [TASK-XXX]`
160-165: 合并零散注意事项为“环境前置条件”小节(可选)可读性优化,非功能性。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
.github/workflows/claude-code-review.yml(1 hunks).github/workflows/claude.yml(1 hunks).github/workflows/sdd-ci.yml(1 hunks)CLAUDE.md(2 hunks)WARP.md(1 hunks)dev-docs/cli/CLAUDE.md(1 hunks)dev-docs/sdd/CLAUDE.md(1 hunks)memory/constitution.md(1 hunks)scripts/sdd/check_language.sh(1 hunks)templates/agent-file-template.md(1 hunks)templates/commands/plan.md(1 hunks)templates/commands/specify.md(1 hunks)templates/commands/tasks.md(1 hunks)templates/plan-template.md(1 hunks)templates/spec-template.md(2 hunks)templates/tasks-template.md(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
scripts/**/*.sh
📄 CodeRabbit inference engine (CLAUDE.md)
scripts/**/*.sh: Bash scripts must start with the shebang: #!/usr/bin/env bash
Bash scripts must enable strict error handling with set -e
Shell scripts in scripts/ should be executable
Files:
scripts/sdd/check_language.sh
🧠 Learnings (13)
📚 Learning: 2025-09-09T05:33:02.201Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: dev-docs/cli/AGENTS.md:0-0
Timestamp: 2025-09-09T05:33:02.201Z
Learning: Use a multi-agent workflow for Specify CLI development with Claude Code (implementation/testing), Warp Agent (CLI testing/debugging), and Codex CLI (optimization/security) as defined in AGENTS.md
Applied to files:
dev-docs/cli/CLAUDE.mddev-docs/sdd/CLAUDE.mdWARP.mdCLAUDE.md
📚 Learning: 2025-09-09T05:32:43.271Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: dev-docs/sdd/CLAUDE.md:0-0
Timestamp: 2025-09-09T05:32:43.271Z
Learning: Claude Code acts as primary AI developer for Spec-Driven Development (SDD) workflows, handling specs, plans, tasks, TDD implementation, and lifecycle compliance
Applied to files:
dev-docs/cli/CLAUDE.mddev-docs/sdd/CLAUDE.mdCLAUDE.md
📚 Learning: 2025-09-09T05:31:49.299Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: dev-docs/cli/CLAUDE.md:0-0
Timestamp: 2025-09-09T05:31:49.299Z
Learning: Applies to dev-docs/cli/src/specify_cli/__init__.py : Main CLI implementation is in src/specify_cli/__init__.py
Applied to files:
dev-docs/cli/CLAUDE.md
📚 Learning: 2025-09-09T05:32:43.272Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: dev-docs/sdd/CLAUDE.md:0-0
Timestamp: 2025-09-09T05:32:43.272Z
Learning: Follow SDD phase rules: Specification (what, clarify, edge cases, acceptance), Planning (minimal viable, rationale, contracts, test strategy), Implementation (tests first, implement to pass, commit with [TASK-###], update docs), Validation (run validations, ensure CI passes, address feedback, verify traceability)
Applied to files:
dev-docs/sdd/CLAUDE.mdCLAUDE.md
📚 Learning: 2025-09-09T05:44:05.977Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-09T05:44:05.977Z
Learning: Applies to specs/[0-9][0-9][0-9]-*/plan.md : Each feature directory must include plan.md for technical implementation details
Applied to files:
templates/agent-file-template.mdtemplates/commands/plan.mdtemplates/plan-template.mdCLAUDE.md
📚 Learning: 2025-09-09T05:33:44.960Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: dev-docs/sdd/AGENTS.md:0-0
Timestamp: 2025-09-09T05:33:44.960Z
Learning: Applies to dev-docs/sdd/specs/*/spec.md : Place each feature specification at specs/<feature>/spec.md (e.g., specs/001-feature/spec.md)
Applied to files:
templates/commands/specify.md
📚 Learning: 2025-09-09T05:33:02.201Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: dev-docs/cli/AGENTS.md:0-0
Timestamp: 2025-09-09T05:33:02.201Z
Learning: Warp Agent performs CLI UX testing and debugging, including command execution and error reproduction
Applied to files:
WARP.md
📚 Learning: 2025-09-09T05:33:02.201Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: dev-docs/cli/AGENTS.md:0-0
Timestamp: 2025-09-09T05:33:02.201Z
Learning: Maintain agent access permissions: Claude Code (read/write src/, tests/, templates/), Warp Agent (execute CLI, read-only code), Codex CLI (read-only analysis)
Applied to files:
WARP.md
📚 Learning: 2025-09-09T05:44:05.977Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-09T05:44:05.977Z
Learning: Applies to specs/[0-9][0-9][0-9]-*/tasks.md : Each feature directory must include tasks.md for numbered, trackable work items
Applied to files:
templates/commands/tasks.mdCLAUDE.md
📚 Learning: 2025-09-09T05:32:43.271Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: dev-docs/sdd/CLAUDE.md:0-0
Timestamp: 2025-09-09T05:32:43.271Z
Learning: Applies to dev-docs/sdd/specs/** : Store feature specifications and implementation plans under specs/ following SDD structure
Applied to files:
templates/commands/plan.mdtemplates/plan-template.mdCLAUDE.md
📚 Learning: 2025-09-09T05:32:43.271Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: dev-docs/sdd/CLAUDE.md:0-0
Timestamp: 2025-09-09T05:32:43.271Z
Learning: Applies to dev-docs/sdd/.github/workflows/** : Modifications to CI/CD under .github/workflows/ require confirmation
Applied to files:
.github/workflows/sdd-ci.yml
📚 Learning: 2025-09-09T05:44:05.977Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: CLAUDE.md:0-0
Timestamp: 2025-09-09T05:44:05.977Z
Learning: Applies to specs/[0-9][0-9][0-9]-*/spec.md : Each feature directory must include spec.md for user stories and requirements
Applied to files:
CLAUDE.md
📚 Learning: 2025-09-09T05:32:43.271Z
Learnt from: CR
PR: lwyBZss8924d/spec-kit-ai-sdd#0
File: dev-docs/sdd/CLAUDE.md:0-0
Timestamp: 2025-09-09T05:32:43.271Z
Learning: Applies to dev-docs/sdd/scripts/sdd/** : Put SDD validation and automation scripts under scripts/sdd/
Applied to files:
CLAUDE.md
🧬 Code graph analysis (3)
templates/agent-file-template.md (1)
scripts/update-agent-context.sh (1)
update_agent_file(36-187)
scripts/sdd/check_language.sh (1)
scripts/sdd/run_semantic_checks.sh (4)
check_agent_contexts(95-124)main(186-210)check_spec_implementation(30-57)check_doc_references(60-92)
CLAUDE.md (1)
tests/test_sdd_validation.py (3)
TestSpecificationValidation(60-90)test_spec_structure(74-90)TestSDDStructure(13-57)
🪛 GitHub Check: CodeQL
.github/workflows/sdd-ci.yml
[warning] 12-23: Workflow does not contain permissions
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {{contents: read}}
🪛 YAMLlint (1.37.1)
.github/workflows/sdd-ci.yml
[error] 17-17: trailing spaces
(trailing-spaces)
🪛 Shellcheck (0.10.0)
scripts/sdd/check_language.sh
[warning] 10-10: YELLOW appears unused. Verify use (or export if used externally).
(SC2034)
🔇 Additional comments (10)
dev-docs/cli/CLAUDE.md (1)
5-8: 新增语言策略段落对齐本次PR目标,措辞清晰可执行,赞。scripts/sdd/check_language.sh (1)
1-6: 脚本头与严格模式已按规范启用,赞。
符合仓库“scripts/**/*.sh”规范要求(shebang + set -euo)。templates/plan-template.md (1)
78-80: 在“Constitution Check”下新增语言策略检查项很好地将政策前移为门禁项,赞。.github/workflows/claude-code-review.yml (1)
46-46: 在审查要点中加入“语言策略合规”非常必要,赞。.github/workflows/claude.yml (1)
45-45: 仅新增注释提醒语言策略,无行为变更,LGTM。templates/tasks-template.md (1)
122-122: 校验清单加入“任务描述需英文”与CI脚本一致,LGTM。templates/spec-template.md (2)
34-35: “Quick Guidelines”增加英语要求,与全局策略一致,LGTM。
92-92: 验收清单加入英语要求,便于自动化校验对齐,LGTM。.github/workflows/sdd-ci.yml (1)
26-26: 将 sdd-validate 依赖 language-policy 顺序正确,能够前置失败门禁。dev-docs/sdd/CLAUDE.md (1)
15-38: 验证通过
脚本validate_structure.py、run_semantic_checks.sh和lint_docs.sh均已存在于scripts/sdd目录且具有可执行权限,无需修改。
| ### Testing and Validation | ||
| ```bash | ||
| # No build step required - Python project with direct execution | ||
| # Run all tests | ||
| python -m pytest tests/ -v | ||
|
|
||
| # Run specific test files | ||
| python -m pytest tests/test_sdd_validation.py -v | ||
| python -m pytest tests/test_specify_cli.py -v | ||
|
|
||
| # Validate SDD structure | ||
| python scripts/sdd/validate_structure.py | ||
|
|
||
| # Run semantic checks on SDD documents | ||
| ./scripts/sdd/run_semantic_checks.sh | ||
|
|
||
| # Lint documentation (requires markdownlint) | ||
| ./scripts/sdd/lint_docs.sh | ||
|
|
||
| # Test the CLI functionality | ||
| python -m specify_cli check | ||
|
|
||
| # Verify Python syntax | ||
| python -m py_compile src/specify_cli/__init__.py | ||
| ``` |
There was a problem hiding this comment.
💡 Verification agent
❓ Verification inconclusive
脚本路径有效性与执行权限校验
请确认示例命令中的脚本路径存在且具备可执行权限;若使用 uv 生态,建议在此处指出“需要先安装 dev 依赖”。
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# 校验存在性/可执行
fd -a 'scripts/sdd/validate_structure.py' .
fd -a 'scripts/sdd/run_semantic_checks.sh' . | xargs -I{} test -x {}
fd -a 'scripts/sdd/lint_docs.sh' . | xargs -I{} test -x {}Length of output: 0
确认脚本路径及执行权限
- 将示例命令中的脚本路径更新为实际目录
dev-docs/sdd/scripts/sdd/,并确保以下文件均存在且具备可执行权限:validate_structure.pyrun_semantic_checks.shlint_docs.sh
- (可选)在文档中提示使用 UV 生态时需先安装开发依赖(如
npm install或pip install -r requirements-dev.txt)。
🤖 Prompt for AI Agents
In CLAUDE.md around lines 15 to 38, the example script paths point to scripts/
but the actual directory is dev-docs/sdd/scripts/sdd/; update the documented
commands to use
dev-docs/sdd/scripts/sdd/{validate_structure.py,run_semantic_checks.sh,lint_docs.sh},
and note that those files must exist and be executable (chmod +x) in the repo;
also add an optional brief note advising users to install development
dependencies (e.g., npm install or pip install -r requirements-dev.txt) before
running the scripts.
| # Check for CJK characters (Chinese, Japanese, Korean) and Cyrillic | ||
| # These are common non-English character ranges | ||
| CJK_PATTERN='[\x{4E00}-\x{9FFF}\x{3040}-\x{30FF}\x{AC00}-\x{D7AF}\x{0400}-\x{04FF}]' | ||
|
|
||
| FOUND_VIOLATIONS=0 |
There was a problem hiding this comment.
🛠️ Refactor suggestion
扩大非英语字符检测范围并真正排除代码块,减少漏报/误报。
- 现有模式仅覆盖 CJK 与西里尔,未覆盖常见拉丁扩展(é/ñ/ü 等)与希腊/希伯来/阿拉伯/天城文等,可能漏检非英语内容。
- 注释称“排除代码块”,但实现未排除 fenced code(
...),易误报。
-# Check for CJK characters (Chinese, Japanese, Korean) and Cyrillic
-# These are common non-English character ranges
-CJK_PATTERN='[\x{4E00}-\x{9FFF}\x{3040}-\x{30FF}\x{AC00}-\x{D7AF}\x{0400}-\x{04FF}]'
+# Non-English detector(避免误伤 Emoji):覆盖拉丁扩展/希腊/希伯来/阿拉伯/天城文/CJK/韩文假名/谚文
+# 允许 ASCII 与常见 Emoji;如需更严格可再讨论
+NON_EN_PATTERN='[\x{00C0}-\x{024F}\x{1E00}-\x{1EFF}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0900}-\x{097F}\x{3040}-\x{30FF}\x{4E00}-\x{9FFF}\x{AC00}-\x{D7AF}]'
@@
- # Check for non-English characters (excluding code blocks)
- if grep -qP "$CJK_PATTERN" "$file" 2>/dev/null; then
+ # Check for non-English characters(实际排除 fenced code blocks)
+ if awk 'BEGIN{in=0} /^```/{in=!in; next} !in {print}' "$file" | grep -qP "$NON_EN_PATTERN" 2>/dev/null; then
echo -e "${RED}✗${NC} Non-English characters found in: $file"
FOUND_VIOLATIONS=1
VIOLATION_FILES="$VIOLATION_FILES\n - $file"
@@
- if command -v grep &> /dev/null && grep --version | grep -q GNU; then
- FIRST_LINE=$(grep -nP "$CJK_PATTERN" "$file" 2>/dev/null | head -1 | cut -d: -f1)
+ if command -v grep &> /dev/null && grep --version | grep -q GNU; then
+ FIRST_LINE=$(grep -nP "$NON_EN_PATTERN" "$file" 2>/dev/null | head -1 | cut -d: -f1)
if [ -n "$FIRST_LINE" ]; then
echo " First occurrence at line $FIRST_LINE"
fi
fiAlso applies to: 37-51
🤖 AI Code Review - comprehensivePR #4 Review Summary
|
|
Closing this PR due to CI workflow validation issues. When a PR modifies workflow files like To resolve this, I've split the changes into two separate PRs:
This is a standard approach for handling workflow file changes. The core functionality will be merged first, then the CI integration can be added safely. |
Addresses CodeQL security warnings about missing workflow permissions. Following the principle of least privilege, all jobs now explicitly declare 'contents: read' permission only. Security improvements: - Added global default permissions at workflow level - Each job explicitly declares minimal required permissions - Prevents unintended write access via GITHUB_TOKEN - Complies with GitHub Actions security best practices Fixes 6 CodeQL alerts: #1, #2, #3, #4, #6, #7
…es, agents, and CI
This ensures all specifications, plans, tasks, and documentation committed to the repository are written in English for global accessibility and consistency across all AI agents and contributors.
Summary by CodeRabbit
文档
Chores