Skip to content

Conversation

@Balancor
Copy link

@Balancor Balancor commented Nov 9, 2025

增加中文支持

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Chinese localization support for project initialization and documentation generation.
    • New --language flag for CLI commands to select between English and Chinese templates.
  • Documentation

    • Comprehensive design and proposal documentation for Chinese localization strategy.
    • Updated specifications with Chinese interaction guidelines and workflow requirements.

@Balancor Balancor requested a review from TabishB as a code owner November 9, 2025 03:07
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 9, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request adds comprehensive Chinese localization support to OpenSpec, introducing language-aware templates, CLI options, and workflow requirements. The implementation threads a language parameter ('en' | 'zh') through the CLI, initialization command, and template manager, enabling dynamic selection of Chinese or English templates during project setup.

Changes

Cohort / File(s) Summary
Design & Proposal Documentation
openspec/changes/add-chinese-localization/design.md, proposal.md
Introduces bilingual strategy for OpenSpec with separate Chinese templates, enforces Chinese in AI interactions, specifies goals, risks with mitigations, and migration plan
Specification Updates
openspec/changes/add-chinese-localization/specs/openspec-conventions/spec.md, specs/docs-agent-instructions/spec.md
Enforces Simplified Chinese in interactions, workflow improvements (serial proposal processing, explicit authorization), technical plan prerequisites before implementation, and Chinese template support in CLI
Task List
openspec/changes/add-chinese-localization/tasks.md
Detailed checklist covering template creation, management, AI interaction conventions, CLI updates, testing, and documentation across six areas
CLI & Initialization
src/cli/index.ts, src/core/init.ts
Adds --language <language> option to init command; wires language parameter through InitCommand constructor and stores as private field; localizes all user-facing prompts and messages
Chinese Template Files
src/core/templates/agents-chinese-template.ts, agents-root-stub-chinese.ts, project-chinese-template.ts
New exports: agentsChineseTemplate (constant), agentsRootStubChineseTemplate (constant), and projectChineseTemplate(context) function returning Chinese Markdown templates
Template Manager
src/core/templates/index.ts
Extends getTemplates(context, language = 'en') and getAgentsStandardTemplate(language = 'en') signatures to accept language parameter; conditionally selects Chinese or English templates
Configuration
package.json, tsconfig.json
Bumps @types/node from ^24.2.0 to ^24.10.0; expands lib to include "DOM"; adds "types": ["node"] compiler option

Sequence Diagram

sequenceDiagram
    participant CLI as CLI (index.ts)
    participant Init as InitCommand
    participant TplMgr as TemplateManager
    participant TplFiles as Template Files

    CLI->>CLI: Parse --language en|zh option
    CLI->>Init: InitCommand({language: 'zh'})
    Init->>Init: Store language = 'zh'
    
    Init->>Init: Localize prompts (Chinese/English)
    Init->>TplMgr: getTemplates(context, 'zh')
    TplMgr->>TplMgr: Check language == 'zh'
    TplMgr->>TplFiles: Select agents-chinese-template
    TplMgr->>TplFiles: Select project-chinese-template
    TplFiles-->>TplMgr: Return Chinese templates
    TplMgr-->>Init: Return language-specific templates
    Init->>Init: Write Chinese templates to project
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • TemplateManager signature changes — Both getTemplates() and getAgentsStandardTemplate() methods add an optional language parameter; verify conditional logic correctly selects Chinese variants and defaults to English
  • Language parameter threading — Trace language flow from CLI option → InitCommand constructor → TemplateManager calls; ensure no missed handoff points
  • Chinese template content — Validate that projectChineseTemplate(), agentsChineseTemplate, and agentsRootStubChineseTemplate are linguistically and structurally correct and align with their English counterparts
  • Localization completeness — Confirm all user-facing messages in InitCommand are localized; check that messages match across Chinese and English variants

Possibly related PRs

  • feat: add CoStrict AI assistant support  #240 — Modifies TemplateManager and template exports in src/core/templates/index.ts, adding language-aware template selection and new template accessors that overlap with this PR's template system changes

Suggested reviewers

  • TabishB

🐰✨ Hop along, dear friends, to lands afar,
Where templates bloom in Chinese char,
From CLI to core, a language flow,
English and Mandarin—watch them grow!
Localization magic, serial and true, 🌍

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d32e50f and adbecd8.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (13)
  • openspec/changes/add-chinese-localization/design.md (1 hunks)
  • openspec/changes/add-chinese-localization/proposal.md (1 hunks)
  • openspec/changes/add-chinese-localization/specs/docs-agent-instructions/spec.md (1 hunks)
  • openspec/changes/add-chinese-localization/specs/openspec-conventions/spec.md (1 hunks)
  • openspec/changes/add-chinese-localization/tasks.md (1 hunks)
  • package.json (1 hunks)
  • src/cli/index.ts (2 hunks)
  • src/core/init.ts (3 hunks)
  • src/core/templates/agents-chinese-template.ts (1 hunks)
  • src/core/templates/agents-root-stub-chinese.ts (1 hunks)
  • src/core/templates/index.ts (3 hunks)
  • src/core/templates/project-chinese-template.ts (1 hunks)
  • tsconfig.json (2 hunks)

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.

@Balancor Balancor closed this Nov 9, 2025
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