-
Notifications
You must be signed in to change notification settings - Fork 780
feat: add multilingual support for OpenSpec initialization (#299) #300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…I#299) Add comprehensive multilingual support to OpenSpec, allowing users to select their preferred language during initialization. All generated templates, configuration files, and instructions will be provided in the selected language. Closes Fission-AI#299 * feat: add language selection to openspec init command - Add language selection prompt in interactive mode before AI tool selection - Support option for non-interactive mode with validation - Display available languages with native names (English, 中文, Français, 日本語, العربية) - Default to English (en-US) if no selection is made - Store selected language in for consistency * feat: extend OpenSpecConfig interface with language field - Add field to OpenSpecConfig interface - Define SUPPORTED_LANGUAGES constant with language options - Support en-US (default), zh-CN, fr-FR, ja-JP, ar-SA - Create CONFIG_FILE_NAME constant for config.json * feat: create multilingual template system - Create i18n directory structure under src/core/templates/i18n/ - Implement language-specific templates for each supported language: - agents-root-stub.ts (root AGENTS.md stub) - agents-template.ts (full AGENTS.md template, 457 lines) - project-template.ts (project context template) - slash-command-templates.ts (proposal, apply, archive commands) - Update TemplateManager to support language parameter in all methods - Add fallback to English for unsupported languages * feat: update all configurators to support multilingual content - Update ToolConfigurator interface to accept language parameter - Modify all AI tool configurators (Claude, Cursor, Cline, etc.) to pass language to templates - Update SlashCommandConfigurator base class to support language - Ensure all generated configuration files use selected language * feat: update openspec update command to respect language settings - Read language configuration from openspec/config.json - Use stored language when regenerating templates - Maintain language consistency across update operations * test: add comprehensive tests for multilingual functionality - Add unit tests for language selection in non-interactive mode - Add integration tests verifying Chinese template generation - Add tests for French, Japanese, and Arabic template generation - Verify config.json creation and language persistence - Test language reading in extend mode * docs: update CLI help text with language option - Add option description to init command help - List supported language codes in help text - Update AGENTS.md template to include multilingual instructions
WalkthroughAdds multilingual support across OpenSpec: language selection in init (CLI flag and prompt), persisted openspec/config.json language, i18n core and localized templates for en-US/zh-CN/fr-FR/ja-JP/ar-SA, updates to TemplateManager/configurators/init/update flows, file-system JSON helpers, and tests. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI as CLI (src/cli/index.ts)
participant Init as InitCommand (src/core/init.ts)
participant FS as FileSystem (src/utils/file-system.ts)
participant Template as TemplateManager (src/core/templates/index.ts)
participant Tools as Configurators (src/core/configurators/*)
User->>CLI: openspec init [--language zh-CN]
CLI->>Init: new InitCommand({ language: 'zh-CN' })
rect rgba(223,243,255,0.6)
Note over Init: Resolve language (flag → config → prompt)
Init->>FS: readJsonFile(openspec/config.json)
Init->>Init: promptForLanguage() (if needed)
Init->>FS: writeJsonFile(openspec/config.json, { language: 'zh-CN' })
end
rect rgba(255,247,230,0.6)
Note over Init,Template: Generate localized templates
Init->>Template: getTemplates(context, 'zh-CN')
Template-->>Init: [project.md (zh-CN), AGENTS.md (zh-CN), ...]
Init->>Tools: configureAITools(..., 'zh-CN')
Tools->>Template: getClaudeTemplate('zh-CN') / getAgentsStandardTemplate('zh-CN')
Tools->>FS: write localized files
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Areas to prioritize:
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (1)
src/core/configurators/qoder.ts (1)
36-42: LGTM! Language parameter correctly integrated.The addition of the optional
languageparameter with a sensible default and proper pass-through toTemplateManager.getClaudeTemplate(language)enables multilingual support while maintaining backward compatibility.Consider updating the JSDoc comment (lines 25-35) to document the new
languageparameter:/** * Configure Qoder integration for a project * * Creates or updates QODER.md file with OpenSpec instructions. * Uses Claude-compatible template for instruction content. * Wrapped with OpenSpec markers for future updates. * * @param {string} projectPath - Absolute path to project root directory * @param {string} openspecDir - Path to openspec directory (unused but required by interface) + * @param {string} language - Language code for generated content (default: 'en-US') * @returns {Promise<void>} Resolves when configuration is complete */
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (37)
openspec/changes/add-multilingual-support/proposal.md(1 hunks)openspec/changes/add-multilingual-support/specs/cli-init/spec.md(1 hunks)openspec/changes/add-multilingual-support/tasks.md(1 hunks)openspec/specs/cli-init/spec.md(4 hunks)src/cli/index.ts(2 hunks)src/core/config.ts(1 hunks)src/core/configurators/agents.ts(1 hunks)src/core/configurators/base.ts(1 hunks)src/core/configurators/claude.ts(1 hunks)src/core/configurators/cline.ts(1 hunks)src/core/configurators/codebuddy.ts(1 hunks)src/core/configurators/costrict.ts(1 hunks)src/core/configurators/qoder.ts(1 hunks)src/core/configurators/qwen.ts(1 hunks)src/core/configurators/slash/base.ts(3 hunks)src/core/i18n/index.ts(1 hunks)src/core/init.ts(9 hunks)src/core/templates/i18n/ar-SA/agents-root-stub.ts(1 hunks)src/core/templates/i18n/ar-SA/agents-template.ts(1 hunks)src/core/templates/i18n/ar-SA/project-template.ts(1 hunks)src/core/templates/i18n/ar-SA/slash-command-templates.ts(1 hunks)src/core/templates/i18n/fr-FR/agents-root-stub.ts(1 hunks)src/core/templates/i18n/fr-FR/agents-template.ts(1 hunks)src/core/templates/i18n/fr-FR/project-template.ts(1 hunks)src/core/templates/i18n/fr-FR/slash-command-templates.ts(1 hunks)src/core/templates/i18n/ja-JP/agents-root-stub.ts(1 hunks)src/core/templates/i18n/ja-JP/agents-template.ts(1 hunks)src/core/templates/i18n/ja-JP/project-template.ts(1 hunks)src/core/templates/i18n/ja-JP/slash-command-templates.ts(1 hunks)src/core/templates/i18n/zh-CN/agents-root-stub.ts(1 hunks)src/core/templates/i18n/zh-CN/agents-template.ts(1 hunks)src/core/templates/i18n/zh-CN/project-template.ts(1 hunks)src/core/templates/i18n/zh-CN/slash-command-templates.ts(1 hunks)src/core/templates/index.ts(2 hunks)src/core/update.ts(4 hunks)src/utils/file-system.ts(1 hunks)test/core/init.test.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
openspec/changes/*/{proposal.md,tasks.md,design.md,specs/**/spec.md}
📄 CodeRabbit inference engine (openspec/AGENTS.md)
Scaffold each change with proposal.md, tasks.md, optional design.md, and delta spec files under openspec/changes//specs//spec.md
Files:
openspec/changes/add-multilingual-support/proposal.mdopenspec/changes/add-multilingual-support/tasks.mdopenspec/changes/add-multilingual-support/specs/cli-init/spec.md
openspec/changes/*/**
📄 CodeRabbit inference engine (openspec/AGENTS.md)
Choose a unique kebab-case, verb-led change-id (add-, update-, remove-, refactor-) for openspec/changes//
Files:
openspec/changes/add-multilingual-support/proposal.mdopenspec/changes/add-multilingual-support/tasks.mdopenspec/changes/add-multilingual-support/specs/cli-init/spec.md
openspec/changes/*/tasks.md
📄 CodeRabbit inference engine (openspec/AGENTS.md)
Track implementation steps in tasks.md and mark each completed item with '- [x]' once finished
Files:
openspec/changes/add-multilingual-support/tasks.md
openspec/{specs/**/spec.md,changes/*/specs/**/spec.md}
📄 CodeRabbit inference engine (openspec/AGENTS.md)
openspec/{specs/**/spec.md,changes/*/specs/**/spec.md}: Write requirements using SHALL/MUST for normative wording
Every requirement must include at least one scenario, formatted exactly with a '#### Scenario: ' header (no bullets or bold)
Under ADDED, introduce new capabilities as standalone requirements rather than altering existing ones
Files:
openspec/changes/add-multilingual-support/specs/cli-init/spec.mdopenspec/specs/cli-init/spec.md
openspec/changes/*/specs/**/spec.md
📄 CodeRabbit inference engine (openspec/AGENTS.md)
openspec/changes/*/specs/**/spec.md: Use ADDED, MODIFIED, REMOVED, or RENAMED sections when authoring deltas; place changed requirements under the correct operation header
For MODIFIED requirements, paste the full existing requirement block (header through scenarios) and ensure the header text matches exactly (whitespace-insensitive)
Use RENAMED when only the requirement name changes; if behavior changes too, use RENAMED plus MODIFIED referencing the new name
Files:
openspec/changes/add-multilingual-support/specs/cli-init/spec.md
openspec/specs/**/spec.md
📄 CodeRabbit inference engine (openspec/AGENTS.md)
Keep current, deployed specs in openspec/specs//spec.md (one focused capability per directory)
Files:
openspec/specs/cli-init/spec.md
🧠 Learnings (19)
📚 Learning: 2025-10-21T03:05:07.856Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-21T03:05:07.856Z
Learning: Use @/openspec/AGENTS.md to learn the project structure and guidelines
Applied to files:
src/core/templates/i18n/ja-JP/agents-template.tssrc/core/templates/i18n/ja-JP/agents-root-stub.tssrc/core/templates/i18n/zh-CN/agents-root-stub.tssrc/core/templates/i18n/zh-CN/agents-template.tssrc/core/templates/i18n/ar-SA/agents-root-stub.tssrc/core/templates/i18n/fr-FR/agents-root-stub.tssrc/core/templates/i18n/fr-FR/agents-template.tssrc/core/configurators/agents.tsopenspec/specs/cli-init/spec.mdsrc/core/update.ts
📚 Learning: 2025-10-21T03:05:07.856Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-21T03:05:07.856Z
Learning: Use @/openspec/AGENTS.md to learn spec format and conventions
Applied to files:
src/core/templates/i18n/ja-JP/agents-template.tssrc/core/templates/i18n/ja-JP/agents-root-stub.tssrc/core/templates/i18n/ar-SA/agents-template.tssrc/core/templates/i18n/zh-CN/agents-root-stub.tssrc/core/templates/i18n/zh-CN/agents-template.tssrc/core/templates/i18n/ar-SA/agents-root-stub.tssrc/core/templates/i18n/fr-FR/agents-root-stub.tssrc/core/templates/i18n/fr-FR/agents-template.tsopenspec/specs/cli-init/spec.mdsrc/core/update.ts
📚 Learning: 2025-10-21T03:05:07.856Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-21T03:05:07.856Z
Learning: Use @/openspec/AGENTS.md to learn how to create and apply change proposals
Applied to files:
src/core/templates/i18n/ja-JP/agents-template.tssrc/core/templates/i18n/ja-JP/agents-root-stub.tssrc/core/templates/i18n/zh-CN/agents-root-stub.tssrc/core/templates/i18n/zh-CN/agents-template.tssrc/core/templates/i18n/ar-SA/agents-root-stub.tssrc/core/templates/i18n/fr-FR/agents-root-stub.tssrc/core/templates/i18n/fr-FR/agents-template.tsopenspec/specs/cli-init/spec.mdsrc/core/update.ts
📚 Learning: 2025-10-21T03:05:07.856Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-21T03:05:07.856Z
Learning: Always open @/openspec/AGENTS.md when the request introduces new capabilities, breaking changes, architecture shifts, or major performance/security work
Applied to files:
src/core/templates/i18n/ja-JP/agents-template.tssrc/core/templates/i18n/ja-JP/agents-root-stub.tsopenspec/changes/add-multilingual-support/specs/cli-init/spec.mdsrc/core/templates/i18n/zh-CN/agents-root-stub.tssrc/core/templates/i18n/zh-CN/agents-template.tssrc/core/templates/i18n/ar-SA/agents-root-stub.tssrc/core/templates/i18n/fr-FR/agents-root-stub.tssrc/core/templates/i18n/fr-FR/agents-template.tsopenspec/specs/cli-init/spec.mdsrc/core/update.ts
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Applies to openspec/changes/*/{proposal.md,tasks.md,design.md,specs/**/spec.md} : Scaffold each change with proposal.md, tasks.md, optional design.md, and delta spec files under openspec/changes/<change-id>/specs/<capability>/spec.md
Applied to files:
src/core/templates/i18n/ja-JP/agents-template.tsopenspec/changes/add-multilingual-support/proposal.mdopenspec/changes/add-multilingual-support/tasks.mdsrc/core/templates/i18n/ar-SA/agents-template.tsopenspec/changes/add-multilingual-support/specs/cli-init/spec.mdsrc/core/templates/i18n/ja-JP/slash-command-templates.tssrc/core/templates/i18n/zh-CN/agents-template.tssrc/core/templates/i18n/fr-FR/slash-command-templates.tssrc/core/templates/i18n/zh-CN/slash-command-templates.tssrc/core/templates/i18n/fr-FR/agents-template.tssrc/core/templates/i18n/ar-SA/slash-command-templates.tsopenspec/specs/cli-init/spec.md
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Applies to openspec/project.md : Document project conventions in openspec/project.md and review it before starting work
Applied to files:
src/core/templates/i18n/ja-JP/agents-template.tssrc/core/templates/i18n/ar-SA/agents-template.tssrc/core/templates/i18n/zh-CN/agents-template.tssrc/core/templates/i18n/fr-FR/agents-template.tsopenspec/specs/cli-init/spec.md
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Applies to openspec/changes/archive/** : Archive completed changes under openspec/changes/archive/YYYY-MM-DD-<name>/ and run 'openspec validate --strict' post-archive; update specs/ if capabilities changed
Applied to files:
src/core/templates/i18n/ja-JP/agents-template.tssrc/core/templates/i18n/fr-FR/agents-template.ts
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Validate proposals and specs with 'openspec validate <item> --strict' and fix all issues before sharing
Applied to files:
src/core/templates/i18n/ja-JP/agents-template.ts
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Applies to openspec/{specs/**/spec.md,changes/*/specs/**/spec.md} : Under ADDED, introduce new capabilities as standalone requirements rather than altering existing ones
Applied to files:
openspec/changes/add-multilingual-support/proposal.mdopenspec/changes/add-multilingual-support/tasks.mdopenspec/changes/add-multilingual-support/specs/cli-init/spec.mdopenspec/specs/cli-init/spec.md
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Applies to openspec/changes/*/tasks.md : Track implementation steps in tasks.md and mark each completed item with '- [x]' once finished
Applied to files:
openspec/changes/add-multilingual-support/tasks.md
📚 Learning: 2025-10-21T03:05:07.856Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-21T03:05:07.856Z
Learning: Always open @/openspec/AGENTS.md when the request mentions planning or proposals (e.g., proposal, spec, change, plan)
Applied to files:
src/core/templates/i18n/ja-JP/agents-root-stub.tssrc/core/templates/i18n/zh-CN/agents-root-stub.tssrc/core/templates/i18n/zh-CN/agents-template.tssrc/core/templates/i18n/ar-SA/agents-root-stub.tssrc/core/templates/i18n/fr-FR/agents-root-stub.tsopenspec/specs/cli-init/spec.md
📚 Learning: 2025-10-21T03:05:07.856Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-21T03:05:07.856Z
Learning: Always open @/openspec/AGENTS.md when the request is ambiguous and the authoritative spec is needed before coding
Applied to files:
src/core/templates/i18n/ja-JP/agents-root-stub.tssrc/core/templates/i18n/ar-SA/agents-template.tssrc/core/templates/i18n/zh-CN/agents-root-stub.tssrc/core/templates/i18n/zh-CN/agents-template.tssrc/core/templates/i18n/ar-SA/agents-root-stub.tssrc/core/templates/i18n/fr-FR/agents-root-stub.tssrc/core/templates/i18n/fr-FR/agents-template.tsopenspec/specs/cli-init/spec.mdsrc/core/update.ts
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Applies to openspec/changes/*/specs/**/spec.md : Use ADDED, MODIFIED, REMOVED, or RENAMED sections when authoring deltas; place changed requirements under the correct operation header
Applied to files:
openspec/changes/add-multilingual-support/specs/cli-init/spec.mdopenspec/specs/cli-init/spec.md
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Applies to openspec/{specs/**/spec.md,changes/*/specs/**/spec.md} : Every requirement must include at least one scenario, formatted exactly with a '#### Scenario: <name>' header (no bullets or bold)
Applied to files:
openspec/changes/add-multilingual-support/specs/cli-init/spec.mdopenspec/specs/cli-init/spec.md
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Applies to openspec/changes/*/specs/**/spec.md : For MODIFIED requirements, paste the full existing requirement block (header through scenarios) and ensure the header text matches exactly (whitespace-insensitive)
Applied to files:
openspec/changes/add-multilingual-support/specs/cli-init/spec.md
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Applies to openspec/{specs/**/spec.md,changes/*/specs/**/spec.md} : Write requirements using SHALL/MUST for normative wording
Applied to files:
openspec/changes/add-multilingual-support/specs/cli-init/spec.mdopenspec/specs/cli-init/spec.md
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Applies to openspec/specs/**/spec.md : Keep current, deployed specs in openspec/specs/<capability>/spec.md (one focused capability per directory)
Applied to files:
openspec/specs/cli-init/spec.md
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Prefer modifying existing specs over creating duplicates; if multiple capabilities are affected, create one delta spec.md per capability
Applied to files:
openspec/specs/cli-init/spec.md
📚 Learning: 2025-10-22T06:05:06.615Z
Learnt from: CR
Repo: Fission-AI/OpenSpec PR: 0
File: openspec/AGENTS.md:0-0
Timestamp: 2025-10-22T06:05:06.615Z
Learning: Applies to openspec/specs/*/ : Name capabilities with clear, single-purpose verb-noun directories (e.g., user-auth, payment-capture) and split if the description needs 'AND'
Applied to files:
openspec/specs/cli-init/spec.md
🧬 Code graph analysis (30)
src/core/configurators/qwen.ts (1)
src/core/templates/index.ts (1)
TemplateManager(38-161)
src/core/templates/i18n/ja-JP/agents-template.ts (3)
src/core/templates/i18n/ar-SA/agents-template.ts (1)
agentsTemplate(1-457)src/core/templates/i18n/fr-FR/agents-template.ts (1)
agentsTemplate(1-457)src/core/templates/i18n/zh-CN/agents-template.ts (1)
agentsTemplate(1-457)
src/core/configurators/cline.ts (1)
src/core/templates/index.ts (1)
TemplateManager(38-161)
src/core/templates/i18n/fr-FR/project-template.ts (4)
src/core/templates/i18n/ar-SA/project-template.ts (1)
projectTemplate(3-33)src/core/templates/i18n/ja-JP/project-template.ts (1)
projectTemplate(3-33)src/core/templates/i18n/zh-CN/project-template.ts (1)
projectTemplate(3-33)src/core/templates/project-template.ts (2)
context(8-38)ProjectContext(1-6)
src/core/templates/i18n/ja-JP/agents-root-stub.ts (4)
src/core/templates/i18n/ar-SA/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/i18n/fr-FR/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/i18n/zh-CN/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)test/core/update.test.ts (6)
rootAgentsPath(1367-1390)codeBuddyPath(788-827)proposalPath(301-338)clinePath(251-287)proposalPath(111-150)costrictPath(944-983)
src/core/configurators/claude.ts (1)
src/core/templates/index.ts (1)
TemplateManager(38-161)
src/core/templates/i18n/ar-SA/agents-template.ts (1)
src/core/templates/i18n/fr-FR/agents-template.ts (1)
agentsTemplate(1-457)
src/core/config.ts (1)
test/core/update.test.ts (2)
configurators(1321-1338)codeBuddyApply(829-864)
src/core/templates/i18n/zh-CN/agents-root-stub.ts (3)
src/core/templates/i18n/ar-SA/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/i18n/fr-FR/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/i18n/ja-JP/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)
src/core/templates/i18n/ja-JP/slash-command-templates.ts (5)
src/core/templates/i18n/ar-SA/slash-command-templates.ts (2)
slashCommandBodies(50-54)getSlashCommandBody(56-58)src/core/templates/i18n/fr-FR/slash-command-templates.ts (2)
slashCommandBodies(50-54)getSlashCommandBody(56-58)src/core/templates/i18n/zh-CN/slash-command-templates.ts (2)
slashCommandBodies(50-54)getSlashCommandBody(56-58)src/core/templates/index.ts (2)
SlashCommandId(164-164)getSlashCommandBody(151-160)src/core/templates/slash-command-templates.ts (1)
getSlashCommandBody(56-58)
src/core/configurators/codebuddy.ts (1)
src/core/templates/index.ts (1)
TemplateManager(38-161)
src/core/templates/i18n/zh-CN/agents-template.ts (4)
src/core/templates/i18n/ar-SA/agents-template.ts (1)
agentsTemplate(1-457)src/core/templates/i18n/fr-FR/agents-template.ts (1)
agentsTemplate(1-457)src/core/templates/i18n/ja-JP/agents-template.ts (1)
agentsTemplate(1-457)test/core/update.test.ts (7)
rootAgentsPath(1367-1390)codeBuddyPath(788-827)proposalPath(301-338)clinePath(251-287)proposalPath(111-150)costrictPath(944-983)applyPath(152-191)
src/core/templates/i18n/ar-SA/agents-root-stub.ts (3)
src/core/templates/i18n/fr-FR/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/i18n/ja-JP/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/i18n/zh-CN/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)
src/core/templates/i18n/fr-FR/slash-command-templates.ts (2)
src/core/templates/i18n/ar-SA/slash-command-templates.ts (2)
slashCommandBodies(50-54)getSlashCommandBody(56-58)src/core/templates/index.ts (2)
SlashCommandId(164-164)getSlashCommandBody(151-160)
src/core/templates/i18n/fr-FR/agents-root-stub.ts (3)
src/core/templates/i18n/ar-SA/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/i18n/ja-JP/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/i18n/zh-CN/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)
src/core/configurators/qoder.ts (1)
src/core/templates/index.ts (1)
TemplateManager(38-161)
src/core/configurators/costrict.ts (1)
src/core/templates/index.ts (1)
TemplateManager(38-161)
src/core/templates/i18n/zh-CN/slash-command-templates.ts (4)
src/core/templates/i18n/ar-SA/slash-command-templates.ts (2)
slashCommandBodies(50-54)getSlashCommandBody(56-58)src/core/templates/i18n/fr-FR/slash-command-templates.ts (2)
slashCommandBodies(50-54)getSlashCommandBody(56-58)src/core/templates/i18n/ja-JP/slash-command-templates.ts (2)
slashCommandBodies(50-54)getSlashCommandBody(56-58)src/core/templates/index.ts (2)
SlashCommandId(164-164)getSlashCommandBody(151-160)
src/core/templates/i18n/fr-FR/agents-template.ts (4)
src/core/templates/i18n/ar-SA/agents-template.ts (1)
agentsTemplate(1-457)src/core/templates/i18n/ja-JP/agents-template.ts (1)
agentsTemplate(1-457)src/core/templates/i18n/zh-CN/agents-template.ts (1)
agentsTemplate(1-457)test/core/update.test.ts (3)
rootAgentsPath(1367-1390)proposalPath(111-150)proposalPath(301-338)
src/core/configurators/agents.ts (2)
src/core/templates/index.ts (1)
TemplateManager(38-161)test/core/update.test.ts (2)
configurators(1321-1338)codeBuddyPath(788-827)
src/core/templates/i18n/ar-SA/slash-command-templates.ts (3)
src/core/templates/i18n/fr-FR/slash-command-templates.ts (2)
slashCommandBodies(50-54)getSlashCommandBody(56-58)src/core/templates/index.ts (2)
SlashCommandId(164-164)getSlashCommandBody(151-160)src/core/templates/slash-command-templates.ts (1)
getSlashCommandBody(56-58)
src/core/i18n/index.ts (1)
src/core/config.ts (2)
DEFAULT_LANGUAGE(27-27)SUPPORTED_LANGUAGES(19-25)
test/core/init.test.ts (2)
src/core/init.ts (1)
InitCommand(381-1076)src/utils/file-system.ts (1)
fileExists(76-86)
src/core/templates/i18n/ja-JP/project-template.ts (4)
src/core/templates/i18n/ar-SA/project-template.ts (1)
projectTemplate(3-33)src/core/templates/i18n/fr-FR/project-template.ts (1)
projectTemplate(3-33)src/core/templates/i18n/zh-CN/project-template.ts (1)
projectTemplate(3-33)src/core/templates/project-template.ts (2)
context(8-38)ProjectContext(1-6)
src/core/templates/i18n/ar-SA/project-template.ts (5)
src/core/templates/i18n/fr-FR/project-template.ts (1)
projectTemplate(3-33)src/core/templates/i18n/ja-JP/project-template.ts (1)
projectTemplate(3-33)src/core/templates/i18n/zh-CN/project-template.ts (1)
projectTemplate(3-33)src/core/templates/index.ts (1)
ProjectContext(163-163)src/core/templates/project-template.ts (2)
context(8-38)ProjectContext(1-6)
src/core/templates/index.ts (9)
src/core/templates/project-template.ts (1)
ProjectContext(1-6)src/core/templates/i18n/ar-SA/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/i18n/fr-FR/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/i18n/ja-JP/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/i18n/zh-CN/agents-root-stub.ts (1)
agentsRootStubTemplate(1-16)src/core/templates/costrict-template.ts (1)
agentsRootStubTemplate(1-1)src/core/templates/cline-template.ts (1)
agentsRootStubTemplate(1-1)src/core/templates/claude-template.ts (1)
agentsRootStubTemplate(1-1)src/core/templates/slash-command-templates.ts (1)
SlashCommandId(1-1)
src/core/configurators/slash/base.ts (4)
src/core/templates/index.ts (2)
SlashCommandId(164-164)TemplateManager(38-161)src/core/templates/slash-command-templates.ts (1)
SlashCommandId(1-1)src/core/configurators/slash/opencode.ts (2)
OpenCodeSlashCommandConfigurator(41-86)updateExisting(59-66)src/core/configurators/slash/factory.ts (1)
FactorySlashCommandConfigurator(25-41)
src/core/templates/i18n/zh-CN/project-template.ts (4)
src/core/templates/i18n/ar-SA/project-template.ts (1)
projectTemplate(3-33)src/core/templates/i18n/fr-FR/project-template.ts (1)
projectTemplate(3-33)src/core/templates/i18n/ja-JP/project-template.ts (1)
projectTemplate(3-33)src/core/templates/project-template.ts (2)
context(8-38)ProjectContext(1-6)
src/core/update.ts (3)
src/core/config.ts (2)
CONFIG_FILE_NAME(29-29)DEFAULT_LANGUAGE(27-27)src/utils/file-system.ts (1)
FileSystemUtils(44-205)src/core/templates/index.ts (1)
TemplateManager(38-161)
src/core/init.ts (3)
src/core/config.ts (4)
DEFAULT_LANGUAGE(27-27)OpenSpecConfig(8-11)SUPPORTED_LANGUAGES(19-25)CONFIG_FILE_NAME(29-29)src/utils/file-system.ts (1)
FileSystemUtils(44-205)src/core/templates/index.ts (1)
TemplateManager(38-161)
🪛 markdownlint-cli2 (0.18.1)
openspec/changes/add-multilingual-support/specs/cli-init/spec.md
99-99: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🔇 Additional comments (28)
src/core/templates/i18n/zh-CN/agents-root-stub.ts (1)
1-17: LGTM! Chinese template is well-structured.The template follows the established pattern for multilingual support, with clear instructions for AI assistants. The structure is consistent with other language templates (fr-FR, ja-JP, ar-SA).
src/core/templates/i18n/fr-FR/agents-root-stub.ts (1)
1-17: LGTM! French template is well-structured.The template follows the established pattern for multilingual support, with clear instructions for AI assistants. The structure is consistent with other language templates.
src/core/configurators/codebuddy.ts (1)
12-14: LGTM! Language parameter correctly integrated.The addition of the optional
languageparameter with a sensible default and proper pass-through toTemplateManager.getClaudeTemplate(language)enables multilingual support while maintaining backward compatibility.src/core/configurators/costrict.ts (1)
12-14: LGTM! Language parameter correctly integrated.The addition of the optional
languageparameter with a sensible default and proper pass-through toTemplateManager.getCostrictTemplate(language)enables multilingual support while maintaining backward compatibility.src/core/templates/i18n/ja-JP/agents-root-stub.ts (1)
1-17: LGTM! Japanese template is well-structured.The template follows the established pattern for multilingual support, with clear instructions for AI assistants. The structure is consistent with other language templates.
src/cli/index.ts (1)
44-68: LGTM! Language option correctly integrated into CLI.The
--languageoption is properly defined with a clear description that lists supported languages. The option is correctly threaded through to theInitCommandconstructor, enabling users to specify their preferred language for generated content.src/core/configurators/cline.ts (1)
12-14: LGTM! Language parameter correctly integrated.The addition of the optional
languageparameter with a sensible default and proper pass-through toTemplateManager.getClineTemplate(language)enables multilingual support while maintaining backward compatibility.src/core/configurators/claude.ts (1)
12-15: Localized stub selection wired throughPassing the language into
TemplateManager.getClaudeTemplateensures the CLAUDE.md stub matches the project locale—nice and tidy.src/core/configurators/qwen.ts (1)
36-39: Language-aware agents templateGood call forwarding the chosen locale so the Qwen config renders the right root stub without extra plumbing.
src/core/configurators/base.ts (1)
5-5: Interface broadened sensiblyMaking
languageoptional at the interface level keeps legacy callers working while enabling localized configurators.openspec/changes/add-multilingual-support/tasks.md (1)
1-29: Checklist tracks deliveryAll shipped milestones are marked complete and the optional doc follow-up stays open—plan-to-actual is clear.
openspec/changes/add-multilingual-support/proposal.md (1)
1-28: Proposal captures scopeThe write-up cleanly enumerates why/what, including affected specs and modules, keeping the change set well-scoped.
src/core/configurators/agents.ts (1)
12-15: Agents standard respects localePropagating the language into the standard AGENTS configurator keeps root instructions consistent with init choices.
src/core/update.ts (1)
3-90: Update flow honors stored languageReading the persisted locale, regenerating AGENTS.md via
TemplateManager, and passing language into each configurator ties the update path into the multilingual story nicely.src/utils/file-system.ts (1)
188-204: JSON helpers integrate cleanlyAppreciate the consistent null-on-missing semantics and reuse of existing file utilities—this slots right into the config flow without surprises.
src/core/templates/i18n/ar-SA/agents-root-stub.ts (1)
1-16: Arabic stub mirrors the canonical guidanceThe translation keeps the structure and managed-block reminder intact, so the update flow will stay stable across locales.
src/core/templates/i18n/ja-JP/slash-command-templates.ts (1)
1-58: JP slash command bodies stay aligned with base semanticsGreat to see the guardrails/steps/references pattern preserved verbatim—this keeps downstream tooling behavior consistent in Japanese.
src/core/templates/i18n/ja-JP/project-template.ts (1)
1-33: Project template localization looks solidThe placeholders and interpolation logic match the baseline template, so we get parity while delivering native language context.
src/core/templates/i18n/ja-JP/agents-template.ts (1)
1-457: Comprehensive JP agents guideThis keeps all procedural details, CLI snippets, and formatting instructions synchronized with the source material while reading naturally in Japanese—nicely done.
src/core/templates/i18n/fr-FR/slash-command-templates.ts (1)
1-59: LGTM! French slash command templates are well-structured.The file follows the established pattern for localized slash command templates, with proper structure matching other language implementations (ar-SA, ja-JP, zh-CN). The exports align with the TemplateManager's language-aware routing.
src/core/templates/i18n/ar-SA/project-template.ts (1)
1-34: LGTM! Arabic project template follows the established pattern.The template properly mirrors the structure of other language-specific project templates (fr-FR, ja-JP, zh-CN), with correct interpolation of ProjectContext fields and localized fallback text. The Arabic (RTL) content is well-formatted.
src/core/templates/i18n/zh-CN/agents-template.ts (1)
1-458: LGTM! Comprehensive Chinese AGENTS.md template.The template provides a complete Chinese translation of the OpenSpec instructions while properly preserving:
- CLI command syntax (e.g.,
openspec list,openspec validate)- File paths and technical identifiers
- Markdown formatting and code block structure
The structure aligns with other language-specific agents templates (ar-SA, fr-FR, ja-JP), ensuring consistency across the multilingual template system.
src/core/templates/i18n/ar-SA/slash-command-templates.ts (1)
1-59: LGTM! Arabic slash command templates are correctly structured.The file follows the established pattern for localized slash command templates with proper RTL Arabic text. The structure matches fr-FR, ja-JP, and zh-CN implementations, ensuring consistent integration with TemplateManager's language-aware routing.
test/core/init.test.ts (1)
1251-1351: Excellent test coverage for multilingual support!The test suite comprehensively validates:
- Config file creation and language persistence (zh-CN test)
- Template content generation in all supported languages (zh-CN, fr-FR, ja-JP, ar-SA)
- Default language fallback to en-US
- Language preservation in extend mode
The tests properly verify both the configuration layer and the actual template rendering, ensuring end-to-end functionality of the multilingual feature.
src/core/config.ts (1)
8-30: Clean and well-structured language configuration additions.The changes properly extend the configuration layer with:
- Optional
languagefield on OpenSpecConfig for flexibility- Well-defined LanguageOption interface with code, name, and native name
- SUPPORTED_LANGUAGES constant providing a clear source of truth
- DEFAULT_LANGUAGE and CONFIG_FILE_NAME constants for consistency
The public API additions integrate seamlessly with the existing configuration structure and provide a solid foundation for the multilingual feature.
src/core/templates/i18n/zh-CN/slash-command-templates.ts (1)
1-59: LGTM! Chinese slash command templates are correctly implemented.The file follows the established pattern for localized slash command templates, with structure matching fr-FR, ja-JP, and ar-SA implementations. The exports properly integrate with TemplateManager's language-aware template routing (TemplateManager.getSlashCommandBody).
src/core/configurators/slash/base.ts (2)
25-50: Language parameter properly threaded through generateAll.The method correctly:
- Accepts an optional
languageparameter with 'en-US' default for backward compatibility- Passes the language to
getBody(target.id, language)for each slash command target- Maintains the existing file creation/update logic
51-64: Language parameter properly threaded through updateExisting.The method correctly:
- Accepts an optional
languageparameter with 'en-US' default- Passes the language to
getBody(target.id, language)when updating existing files
- Fix code block language tag in spec (markdownlint MD040) - Fix extend mode language selection to prompt user with stored language as default - Add tests for extend mode language change scenarios Addresses CodeRabbit feedback on PR Fission-AI#300
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/core/init.ts(11 hunks)test/core/init.test.ts(4 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
test/core/init.test.ts (2)
src/core/init.ts (1)
InitCommand(381-1086)src/utils/file-system.ts (1)
fileExists(76-86)
src/core/init.ts (5)
src/core/config.ts (4)
DEFAULT_LANGUAGE(27-27)OpenSpecConfig(8-11)SUPPORTED_LANGUAGES(19-25)CONFIG_FILE_NAME(29-29)src/utils/file-system.ts (1)
FileSystemUtils(44-205)src/core/templates/index.ts (1)
TemplateManager(38-161)src/core/configurators/registry.ts (1)
ToolRegistry(10-46)src/core/configurators/slash/registry.ts (1)
SlashCommandRegistry(19-69)
- Fix code block language tag in spec (markdownlint MD040)
- Fix extend mode language selection to prompt user with stored language as default
- Add tests for extend mode language change scenarios
Addresses CodeRabbit feedback on PR Fission-AI#300
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/core/init.ts(11 hunks)test/core/init.test.ts(4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- test/core/init.test.ts
🧰 Additional context used
🧬 Code graph analysis (1)
src/core/init.ts (3)
src/core/config.ts (4)
DEFAULT_LANGUAGE(27-27)OpenSpecConfig(8-11)SUPPORTED_LANGUAGES(19-25)CONFIG_FILE_NAME(29-29)src/utils/file-system.ts (1)
FileSystemUtils(44-205)src/core/templates/index.ts (1)
TemplateManager(38-161)
🔇 Additional comments (3)
src/core/init.ts (3)
509-530: Extend mode language prompt implemented correctly.This implementation successfully addresses the past review concern by allowing users to change their language preference in extend mode. The flow properly:
- Checks for non-interactive
--languageflag first- Reads existing language from config as the default
- Prompts interactively with that default, allowing users to change it
532-572: Language validation and prompting logic is robust.Both methods are well-implemented:
resolveLanguageArgprovides clear validation with helpful error messages listing available languagespromptForLanguageaccepts a default parameter as suggested in past reviews, enabling pre-selection of existing language in extend mode- Native language names in the prompt improve UX
574-589: Config file I/O properly typed with Partial.The type signatures correctly use
Partial<OpenSpecConfig>for persisted configs, addressing the previous review concern about type mismatches. The merge logic insaveConfigFileproperly preserves existing fields when updating language.
|
@TabishB PTAL😊 |
|
please merge this pr,really need multilingual support.... |
Add comprehensive multilingual support to OpenSpec, allowing users to select their preferred language during initialization. All generated templates, configuration files, and instructions will be provided in the selected language.
Closes #299
Summary by CodeRabbit
New Features
Behavior Changes
Tests