Skip to content

feat(policy): enforce English-only normative artifacts across templat… - #4

Closed
lwyBZss8924d wants to merge 1 commit into
mainfrom
002-language-policy
Closed

lwyBZss8924d wants to merge 1 commit into
mainfrom
002-language-policy

Conversation

@lwyBZss8924d

@lwyBZss8924d lwyBZss8924d commented Sep 10, 2025 •

Copy link
Copy Markdown
Owner

…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.

Summary by CodeRabbit

  • 文档

    • 新增“语言政策”:规范性产物须使用英文;在多处指南与模板中加入相应提示与校验清单。
    • 扩充开发文档:测试与验证流程、代码质量规范、运行方式、开发脚本、目录结构与SDD校验要求。
    • 将受众描述更新为“Warp Agents”。
  • Chores

    • 持续集成新增语言政策检查,并将其纳入验证依赖。
    • 代码评审与自动评论流程增加语言合规性审阅要点。

…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.
@coderabbitai

coderabbitai Bot commented Sep 10, 2025 •

Copy link
Copy Markdown

Walkthrough

在仓库中引入“英语为唯一规范语言”的策略:新增CI语言检查脚本与作业,并将其作为SDD验证的前置依赖;多处工作流与文档、模板中加入相应语言策略说明;不涉及对导出/公共代码接口的更改。

Changes

Cohort / File(s) Summary
CI Workflows
.github/workflows/claude-code-review.yml, .github/workflows/claude.yml, .github/workflows/sdd-ci.yml
为Claude相关工作流提示中补充“英语为规范语言”的审查/注释项;在sdd-ci.yml中新建language-policy作业运行语言检查脚本,并将sdd-validate设置为依赖该作业。
Language Policy Script
scripts/sdd/check_language.sh
新增Bash脚本:遍历规范性目录与文件,检测CJK/西里尔等非英文字符;发现则列出违规文件并以非零码退出;支持着色输出与GNU grep首个问题行展示。
Core Docs
CLAUDE.md, WARP.md, memory/constitution.md
增补“语言策略(规范性产物仅限英语)”章节/段落;扩展CLAUDE.md的测试与验证、代码质量、运行与开发流程、目录结构、SDD校验要求等内容。
Dev Docs
dev-docs/cli/CLAUDE.md, dev-docs/sdd/CLAUDE.md
在CLI与SDD文档中新增语言策略章节;未更改运行时行为。
Templates
templates/agent-file-template.md, templates/commands/plan.md, templates/commands/specify.md, templates/commands/tasks.md, templates/plan-template.md, templates/spec-template.md, templates/tasks-template.md
在各模板中加入英语-only规范:新增提示/要点/检查项,确保规范性文档(spec/plan/tasks/PRD/issues等)以英语撰写。

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于规范性目录与特定文件清单
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed 标题简洁地概括了本次更改的核心内容,即在模板、AI 代理和 CI 环境中强制执行英文规范性文档策略,与 PR 的主要目标高度一致。
Description Check ✅ Passed 该描述列出了与更改集相关的主要更新(包括内存宪法原则、SDD 模板、AI 命令模板、文档文件、CI 脚本和工作流提示),与实际更改内容紧密对应。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 002-language-policy

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
     fi

Also 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 || true
templates/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-10
WARP.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

📥 Commits

Reviewing files that changed from the base of the PR and between ae39a1f and cb1e8bb.

📒 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.md
  • dev-docs/sdd/CLAUDE.md
  • WARP.md
  • 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: 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.md
  • dev-docs/sdd/CLAUDE.md
  • CLAUDE.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.md
  • CLAUDE.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.md
  • templates/commands/plan.md
  • templates/plan-template.md
  • CLAUDE.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.md
  • 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/specs/** : Store feature specifications and implementation plans under specs/ following SDD structure

Applied to files:

  • templates/commands/plan.md
  • templates/plan-template.md
  • 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/.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 目录且具有可执行权限,无需修改。

Comment thread CLAUDE.md
Comment on lines +15 to +38
### 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
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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.py
    • run_semantic_checks.sh
    • lint_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.

Comment on lines +17 to +21
# 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ 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
         fi

Also applies to: 37-51

@github-actions

Copy link
Copy Markdown

🤖 AI Code Review - comprehensive

PR #4

Review Summary

⚠️ Issues Found

  • ⚠️ No specification files updated - verify if needed
  • ⚠️ No test files - ensure TDD compliance

💡 Suggestions

  • ✓ Documentation updated
  • Security scan placeholder - implement with actual scanning

SDD Compliance Checklist

  • Specification updated (if feature change)
  • Tests written before implementation (TDD)
  • Task references in commit messages
  • Documentation updated
  • No [NEEDS CLARIFICATION] markers
  • Agent context files updated (if needed)

Next Steps

  1. Address any issues identified above
  2. Ensure all checklist items are complete
  3. Request human review when ready

This review was performed automatically. For detailed analysis, run a comprehensive Claude Code review.

@lwyBZss8924d

Copy link
Copy Markdown
Owner Author

Closing this PR due to CI workflow validation issues. When a PR modifies workflow files like .github/workflows/claude-code-review.yml, GitHub Actions security prevents the modified workflow from running in the PR itself.

To resolve this, I've split the changes into two separate PRs:

  1. PR feat(policy): enforce English-only normative artifacts in templates and docs #5 (002-language-policy-core) - Contains all core language policy changes WITHOUT workflow modifications
  2. A follow-up PR will be created after feat(policy): enforce English-only normative artifacts in templates and docs #5 is merged to add the CI workflow integration

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.

lwyBZss8924d added a commit that referenced this pull request Sep 10, 2025
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant