-
Notifications
You must be signed in to change notification settings - Fork 614
feat: add npm registry caching and optimization system #697
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
feat: add npm registry caching and optimization system #697
Conversation
WalkthroughThis update introduces comprehensive NPM registry management capabilities across the application's main and renderer processes. It adds methods and UI for configuring, caching, and validating NPM registry sources, enables custom and auto-detected registries, and localizes all related UI and messages in multiple languages. No existing logic is removed or altered. Changes
Sequence Diagram(s)sequenceDiagram
participant UI as MCP Settings UI
participant Store as Pinia MCP Store
participant Presenter as MCP Presenter
participant Config as ConfigPresenter/McpConfHelper
participant ServerMgr as ServerManager
UI->>Store: getNpmRegistryStatus()
Store->>Presenter: getNpmRegistryStatus()
Presenter->>Config: getEffectiveNpmRegistry(), getNpmRegistryCache(), etc.
Config-->>Presenter: Registry info
Presenter-->>Store: Registry status
Store-->>UI: Registry status
UI->>Store: setCustomNpmRegistry(url)
Store->>Presenter: setCustomNpmRegistry(url)
Presenter->>Config: setCustomNpmRegistry(url)
Presenter->>ServerMgr: loadRegistryFromCache()
Presenter-->>Store: (done)
Store-->>UI: (done)
UI->>Store: refreshNpmRegistry()
Store->>Presenter: refreshNpmRegistry()
Presenter->>ServerMgr: refreshNpmRegistry()
ServerMgr->>Config: setNpmRegistryCache()
ServerMgr-->>Presenter: new registry
Presenter-->>Store: new registry
Store-->>UI: new registry
Estimated code review effort🎯 4 (Complex) | ⏱️ ~40 minutes Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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: 13
🔭 Outside diff range comments (1)
src/main/presenter/mcpPresenter/serverManager.ts (1)
77-78: Add error handling for proxy URL parsing.The URL constructor can throw if
proxyUrlis malformed. Consider wrapping in try-catch to handle invalid proxy URLs gracefully.Apply this diff to add error handling:
- const proxyOptions = proxyUrl - ? { proxy: { host: new URL(proxyUrl).hostname, port: parseInt(new URL(proxyUrl).port) } } - : {} + let proxyOptions = {} + if (proxyUrl) { + try { + const url = new URL(proxyUrl) + proxyOptions = { proxy: { host: url.hostname, port: parseInt(url.port) } } + } catch (error) { + console.error('[NPM Registry] Invalid proxy URL:', proxyUrl, error) + // Continue without proxy + } + }
♻️ Duplicate comments (2)
src/renderer/src/i18n/fr-FR/settings.json (1)
580-620: Same observation as in zh-HK locale.
See earlier comment – ensure every locale is updated and factor common strings intocommon.json.src/renderer/src/i18n/en-US/settings.json (1)
586-627: Ditto – propagate keys & de-duplicate.Matches the zh-HK & fr-FR additions; apply the same verification & refactor guidance.
🧹 Nitpick comments (3)
src/main/presenter/configPresenter/mcpConfHelper.ts (1)
497-504: Make cache duration configurable.The 24-hour cache duration is hard-coded. Consider making it configurable for different environments or user preferences.
+ private static readonly DEFAULT_CACHE_DURATION = 24 * 60 * 60 * 1000 // 24 hours + private cacheDuration: number = McpConfHelper.DEFAULT_CACHE_DURATION + isNpmRegistryCacheValid(): boolean { const cache = this.getNpmRegistryCache() if (!cache) return false const now = Date.now() const cacheAge = now - cache.lastChecked - const CACHE_DURATION = 24 * 60 * 60 * 1000 // 24小时 - return cacheAge < CACHE_DURATION + return cacheAge < this.cacheDuration }src/main/presenter/mcpPresenter/index.ts (2)
184-192: Consider timeout cleanup for resource management.The implementation is good with proper error handling and logging. However, consider storing the timeout reference to allow cleanup if the class instance is destroyed before the timeout executes.
+private backgroundUpdateTimeout?: NodeJS.Timeout + private scheduleBackgroundRegistryUpdate(): void { - setTimeout(async () => { + this.backgroundUpdateTimeout = setTimeout(async () => { try { await this.serverManager.updateNpmRegistryInBackground() } catch (error) { console.error('[MCP] Background registry update failed:', error) } }, 5000) }Then add cleanup in a destroy/cleanup method if one exists.
1141-1167: Good implementation with minor logic improvements needed.The method provides comprehensive registry status information with proper type safety and optional chaining.
Consider improving the cache detection logic and handling edge cases:
async getNpmRegistryStatus(): Promise<{ currentRegistry: string | null isFromCache: boolean lastChecked?: number autoDetectEnabled: boolean customRegistry?: string }> { const cache = this.configPresenter.getNpmRegistryCache?.() const autoDetectEnabled = this.configPresenter.getAutoDetectNpmRegistry?.() ?? true const customRegistry = this.configPresenter.getCustomNpmRegistry?.() const currentRegistry = this.serverManager.getNpmRegistry() let isFromCache = false - if (customRegistry && currentRegistry === customRegistry) { + if (customRegistry && customRegistry.trim() && currentRegistry === customRegistry) { isFromCache = false - } else if (cache && this.configPresenter.isNpmRegistryCacheValid?.()) { + } else if (cache && this.configPresenter.isNpmRegistryCacheValid?.() && currentRegistry === cache.registry) { isFromCache = currentRegistry === cache.registry } return { currentRegistry, isFromCache, lastChecked: cache?.lastChecked, autoDetectEnabled, customRegistry } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (25)
src/main/presenter/configPresenter/index.ts(1 hunks)src/main/presenter/configPresenter/mcpConfHelper.ts(3 hunks)src/main/presenter/mcpPresenter/index.ts(4 hunks)src/main/presenter/mcpPresenter/serverManager.ts(2 hunks)src/renderer/src/components/settings/McpSettings.vue(2 hunks)src/renderer/src/i18n/en-US/common.json(1 hunks)src/renderer/src/i18n/en-US/settings.json(1 hunks)src/renderer/src/i18n/fa-IR/common.json(1 hunks)src/renderer/src/i18n/fa-IR/settings.json(1 hunks)src/renderer/src/i18n/fr-FR/common.json(1 hunks)src/renderer/src/i18n/fr-FR/settings.json(1 hunks)src/renderer/src/i18n/ja-JP/common.json(1 hunks)src/renderer/src/i18n/ja-JP/settings.json(1 hunks)src/renderer/src/i18n/ko-KR/common.json(1 hunks)src/renderer/src/i18n/ko-KR/settings.json(1 hunks)src/renderer/src/i18n/ru-RU/common.json(1 hunks)src/renderer/src/i18n/ru-RU/settings.json(1 hunks)src/renderer/src/i18n/zh-CN/common.json(1 hunks)src/renderer/src/i18n/zh-CN/settings.json(1 hunks)src/renderer/src/i18n/zh-HK/common.json(1 hunks)src/renderer/src/i18n/zh-HK/settings.json(1 hunks)src/renderer/src/i18n/zh-TW/common.json(1 hunks)src/renderer/src/i18n/zh-TW/settings.json(1 hunks)src/renderer/src/stores/mcp.ts(3 hunks)src/shared/presenter.d.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (21)
src/renderer/src/**/*
📄 CodeRabbit Inference Engine (.cursor/rules/i18n.mdc)
src/renderer/src/**/*: All user-facing strings must use i18n keys (avoid hardcoded user-visible text in code)
Use the 'vue-i18n' framework for all internationalization in the renderer
Ensure all user-visible text in the renderer uses the translation system
Files:
src/renderer/src/i18n/ko-KR/common.jsonsrc/renderer/src/i18n/fr-FR/common.jsonsrc/renderer/src/i18n/zh-TW/common.jsonsrc/renderer/src/i18n/zh-HK/common.jsonsrc/renderer/src/i18n/en-US/common.jsonsrc/renderer/src/i18n/fa-IR/common.jsonsrc/renderer/src/i18n/ru-RU/common.jsonsrc/renderer/src/i18n/zh-CN/common.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ja-JP/common.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.jsonsrc/renderer/src/stores/mcp.tssrc/renderer/src/components/settings/McpSettings.vue
**/*.{ts,tsx,js,jsx,vue}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Use English for logs and comments
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/mcpPresenter/index.tssrc/shared/presenter.d.tssrc/renderer/src/components/settings/McpSettings.vuesrc/main/presenter/configPresenter/mcpConfHelper.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (CLAUDE.md)
Strict type checking enabled for TypeScript
**/*.{ts,tsx}: 始终使用 try-catch 处理可能的错误
提供有意义的错误信息
记录详细的错误日志
优雅降级处理
日志应包含时间戳、日志级别、错误代码、错误描述、堆栈跟踪(如适用)、相关上下文信息
日志级别应包括 ERROR、WARN、INFO、DEBUG
不要吞掉错误
提供用户友好的错误信息
实现错误重试机制
避免记录敏感信息
使用结构化日志
设置适当的日志级别
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/mcpPresenter/index.tssrc/shared/presenter.d.tssrc/main/presenter/configPresenter/mcpConfHelper.ts
src/main/**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
Main to Renderer: Use EventBus to broadcast events via mainWindow.webContents.send()
Use Electron's built-in APIs for file system and native dialogs
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/configPresenter/mcpConfHelper.ts
src/main/presenter/**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
One presenter per functional domain
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/configPresenter/mcpConfHelper.ts
src/main/presenter/configPresenter/**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
Centralize configuration in configPresenter/
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/configPresenter/mcpConfHelper.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development-setup.mdc)
**/*.{js,jsx,ts,tsx}: 使用 OxLint 进行代码检查
Log和注释使用英文书写
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/mcpPresenter/index.tssrc/shared/presenter.d.tssrc/main/presenter/configPresenter/mcpConfHelper.ts
src/{main,renderer}/**/*.ts
📄 CodeRabbit Inference Engine (.cursor/rules/electron-best-practices.mdc)
src/{main,renderer}/**/*.ts: Use context isolation for improved security
Implement proper inter-process communication (IPC) patterns
Optimize application startup time with lazy loading
Implement proper error handling and logging for debugging
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/configPresenter/mcpConfHelper.ts
src/main/**/*.{ts,js,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
主进程代码放在
src/main
Files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/configPresenter/mcpConfHelper.ts
src/renderer/src/**/*.{ts,tsx,vue}
📄 CodeRabbit Inference Engine (CLAUDE.md)
src/renderer/src/**/*.{ts,tsx,vue}: Use Pinia for frontend state management
Renderer to Main: Use usePresenter.ts composable for direct presenter method calls
Files:
src/renderer/src/stores/mcp.tssrc/renderer/src/components/settings/McpSettings.vue
src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/pinia-best-practices.mdc)
src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx}: Use modules to organize related state and actions
Implement proper state persistence for maintaining data across sessions
Use getters for computed state properties
Utilize actions for side effects and asynchronous operations
Keep the store focused on global state, not component-specific data
Files:
src/renderer/src/stores/mcp.ts
src/renderer/**/*.{vue,ts,js,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
渲染进程代码放在
src/renderer
Files:
src/renderer/src/stores/mcp.tssrc/renderer/src/components/settings/McpSettings.vue
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-best-practices.mdc)
src/renderer/src/**/*.{vue,ts,tsx,js,jsx}: Use the Composition API for better code organization and reusability
Implement proper state management with Pinia
Utilize Vue Router for navigation and route management
Leverage Vue's built-in reactivity system for efficient data handling
Files:
src/renderer/src/stores/mcp.tssrc/renderer/src/components/settings/McpSettings.vue
src/renderer/**/*.{ts,tsx,vue}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,tsx,vue}: Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError).
Use TypeScript for all code; prefer types over interfaces.
Avoid enums; use const objects instead.
Use arrow functions for methods and computed properties.
Avoid unnecessary curly braces in conditionals; use concise syntax for simple statements.
Files:
src/renderer/src/stores/mcp.tssrc/renderer/src/components/settings/McpSettings.vue
src/renderer/**/*.{vue,ts}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)
Implement lazy loading for routes and components.
Files:
src/renderer/src/stores/mcp.tssrc/renderer/src/components/settings/McpSettings.vue
src/renderer/**/*.{ts,vue}
📄 CodeRabbit Inference Engine (.cursor/rules/vue-shadcn.mdc)
src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching.
Implement SEO best practices using Nuxt's useHead and useSeoMeta.
Files:
src/renderer/src/stores/mcp.tssrc/renderer/src/components/settings/McpSettings.vue
src/main/presenter/mcpPresenter/index.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
Register new MCP tool in mcpPresenter/index.ts
Files:
src/main/presenter/mcpPresenter/index.ts
src/shared/**/*.ts
📄 CodeRabbit Inference Engine (CLAUDE.md)
Shared types in src/shared/
Files:
src/shared/presenter.d.ts
src/shared/*.d.ts
📄 CodeRabbit Inference Engine (.cursor/rules/electron-best-practices.mdc)
The shared/*.d.ts files are used to define the types of objects exposed by the main process to the renderer process
Files:
src/shared/presenter.d.ts
src/shared/**/*.{ts,tsx,d.ts}
📄 CodeRabbit Inference Engine (.cursor/rules/project-structure.mdc)
共享类型定义放在
shared目录
Files:
src/shared/presenter.d.ts
src/renderer/src/**/*.vue
📄 CodeRabbit Inference Engine (CLAUDE.md)
src/renderer/src/**/*.vue: Use Composition API for all Vue 3 components
Use Tailwind CSS with scoped styles for styling
Organize components by feature in src/renderer/src/
Follow existing component patterns in src/renderer/src/ when creating new UI components
Use Composition API with proper TypeScript typing for new UI components
Implement responsive design with Tailwind CSS for new UI components
Add proper error handling and loading states for new UI componentsUse scoped styles to prevent CSS conflicts between components
Files:
src/renderer/src/components/settings/McpSettings.vue
🧠 Learnings (36)
📓 Common learnings
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-07-21T01:45:40.036Z
Learning: pnpm >= 9
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-07-21T01:45:40.036Z
Learning: 使用 pnpm 包管理
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-07-21T01:45:40.036Z
Learning: Node.js >= 22
📚 Learning: applies to src/renderer/src/i18n/*.json : when adding new translations, add shared keys to 'common.j...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : When adding new translations, add shared keys to 'common.json' and language-specific keys to the respective language file; keep all language files' keys consistent
Applied to files:
src/renderer/src/i18n/ko-KR/common.jsonsrc/renderer/src/i18n/fr-FR/common.jsonsrc/renderer/src/i18n/zh-TW/common.jsonsrc/renderer/src/i18n/zh-HK/common.jsonsrc/renderer/src/i18n/en-US/common.jsonsrc/renderer/src/i18n/fa-IR/common.jsonsrc/renderer/src/i18n/ru-RU/common.jsonsrc/renderer/src/i18n/zh-CN/common.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ja-JP/common.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/common.json : shared translation keys must be placed in 'src/render...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/common.json : Shared translation keys must be placed in 'src/renderer/src/i18n/common.json'
Applied to files:
src/renderer/src/i18n/ko-KR/common.jsonsrc/renderer/src/i18n/fr-FR/common.jsonsrc/renderer/src/i18n/zh-TW/common.jsonsrc/renderer/src/i18n/zh-HK/common.jsonsrc/renderer/src/i18n/en-US/common.jsonsrc/renderer/src/i18n/fa-IR/common.jsonsrc/renderer/src/i18n/ru-RU/common.jsonsrc/renderer/src/i18n/zh-CN/common.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ja-JP/common.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/*.json : regularly check for unused translation keys in i18n files...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : Regularly check for unused translation keys in i18n files
Applied to files:
src/renderer/src/i18n/ko-KR/common.jsonsrc/renderer/src/i18n/fr-FR/common.jsonsrc/renderer/src/i18n/zh-TW/common.jsonsrc/renderer/src/i18n/zh-HK/common.jsonsrc/renderer/src/i18n/en-US/common.jsonsrc/renderer/src/i18n/fa-IR/common.jsonsrc/renderer/src/i18n/ru-RU/common.jsonsrc/renderer/src/i18n/zh-CN/common.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ja-JP/common.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/*.json : maintain consistent structure across all translation files...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : Maintain consistent structure across all translation files
Applied to files:
src/renderer/src/i18n/ko-KR/common.jsonsrc/renderer/src/i18n/fr-FR/common.jsonsrc/renderer/src/i18n/zh-TW/common.jsonsrc/renderer/src/i18n/zh-HK/common.jsonsrc/renderer/src/i18n/en-US/common.jsonsrc/renderer/src/i18n/fa-IR/common.jsonsrc/renderer/src/i18n/ru-RU/common.jsonsrc/renderer/src/i18n/zh-CN/common.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ja-JP/common.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/*.json : translation key naming must use dot-separated hierarchy, l...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : Translation key naming must use dot-separated hierarchy, lowercase letters, and meaningful descriptive names (e.g., 'common.button.submit')
Applied to files:
src/renderer/src/i18n/ko-KR/common.jsonsrc/renderer/src/i18n/fr-FR/common.jsonsrc/renderer/src/i18n/zh-TW/common.jsonsrc/renderer/src/i18n/zh-HK/common.jsonsrc/renderer/src/i18n/en-US/common.jsonsrc/renderer/src/i18n/fa-IR/common.jsonsrc/renderer/src/i18n/ru-RU/common.jsonsrc/renderer/src/i18n/zh-CN/common.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ja-JP/common.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/*.json : each language must have a separate json file in 'src/rende...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : Each language must have a separate JSON file in 'src/renderer/src/i18n/'
Applied to files:
src/renderer/src/i18n/ko-KR/common.jsonsrc/renderer/src/i18n/fr-FR/common.jsonsrc/renderer/src/i18n/zh-TW/common.jsonsrc/renderer/src/i18n/zh-HK/common.jsonsrc/renderer/src/i18n/en-US/common.jsonsrc/renderer/src/i18n/fa-IR/common.jsonsrc/renderer/src/i18n/ru-RU/common.jsonsrc/renderer/src/i18n/zh-CN/common.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ja-JP/common.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/i18n/*.json : language files must be located in 'src/renderer/src/i18n/'...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/i18n/*.json : Language files must be located in 'src/renderer/src/i18n/' directory
Applied to files:
src/renderer/src/i18n/ko-KR/common.jsonsrc/renderer/src/i18n/fr-FR/common.jsonsrc/renderer/src/i18n/zh-TW/common.jsonsrc/renderer/src/i18n/zh-HK/common.jsonsrc/renderer/src/i18n/en-US/common.jsonsrc/renderer/src/i18n/ru-RU/common.jsonsrc/renderer/src/i18n/zh-CN/common.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ja-JP/common.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/**/* : all user-facing strings must use i18n keys (avoid hardcoded user-...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/**/* : All user-facing strings must use i18n keys (avoid hardcoded user-visible text in code)
Applied to files:
src/renderer/src/i18n/ko-KR/common.jsonsrc/renderer/src/i18n/fr-FR/common.jsonsrc/renderer/src/i18n/zh-TW/common.jsonsrc/renderer/src/i18n/zh-HK/common.jsonsrc/renderer/src/i18n/en-US/common.jsonsrc/renderer/src/i18n/ru-RU/common.jsonsrc/renderer/src/i18n/zh-CN/common.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ja-JP/settings.jsonsrc/renderer/src/i18n/ja-JP/common.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/fa-IR/settings.jsonsrc/renderer/src/i18n/ko-KR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/**/* : use the 'vue-i18n' framework for all internationalization in the ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/**/* : Use the 'vue-i18n' framework for all internationalization in the renderer
Applied to files:
src/renderer/src/i18n/fr-FR/common.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/renderer/src/**/* : ensure all user-visible text in the renderer uses the translation...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/i18n.mdc:0-0
Timestamp: 2025-07-21T01:46:30.354Z
Learning: Applies to src/renderer/src/**/* : Ensure all user-visible text in the renderer uses the translation system
Applied to files:
src/renderer/src/i18n/fr-FR/common.jsonsrc/renderer/src/i18n/zh-TW/common.jsonsrc/renderer/src/i18n/en-US/common.jsonsrc/renderer/src/i18n/zh-CN/common.jsonsrc/renderer/src/i18n/zh-TW/settings.jsonsrc/renderer/src/i18n/ja-JP/common.jsonsrc/renderer/src/i18n/en-US/settings.jsonsrc/renderer/src/i18n/ru-RU/settings.json
📚 Learning: applies to **/*.{ts,tsx,js,jsx,vue} : use english for logs and comments...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to **/*.{ts,tsx,js,jsx,vue} : Use English for logs and comments
Applied to files:
src/renderer/src/i18n/en-US/common.jsonsrc/renderer/src/i18n/zh-HK/settings.jsonsrc/renderer/src/i18n/fr-FR/settings.jsonsrc/renderer/src/i18n/zh-CN/settings.json
📚 Learning: applies to src/main/presenter/configpresenter/**/*.ts : centralize configuration in configpresenter/...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/configPresenter/**/*.ts : Centralize configuration in configPresenter/
Applied to files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/main/presenter/mcpPresenter/index.tssrc/shared/presenter.d.tssrc/main/presenter/configPresenter/mcpConfHelper.ts
📚 Learning: applies to src/main/presenter/mcppresenter/index.ts : register new mcp tool in mcppresenter/index.ts...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/mcpPresenter/index.ts : Register new MCP tool in mcpPresenter/index.ts
Applied to files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/mcpPresenter/index.tssrc/shared/presenter.d.tssrc/renderer/src/components/settings/McpSettings.vuesrc/main/presenter/configPresenter/mcpConfHelper.ts
📚 Learning: applies to src/main/presenter/mcppresenter/inmemoryservers/*.ts : implement new mcp tool in src/main...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/mcpPresenter/inMemoryServers/*.ts : Implement new MCP tool in src/main/presenter/mcpPresenter/inMemoryServers/ when adding a new MCP tool
Applied to files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/mcpPresenter/index.tssrc/shared/presenter.d.tssrc/renderer/src/components/settings/McpSettings.vuesrc/main/presenter/configPresenter/mcpConfHelper.ts
📚 Learning: applies to src/main/presenter/configpresenter/providers.ts : add provider configuration in configpre...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/configPresenter/providers.ts : Add provider configuration in configPresenter/providers.ts when adding a new LLM provider
Applied to files:
src/main/presenter/configPresenter/index.tssrc/shared/presenter.d.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/index.ts : `src/main/presenter/llmproviderpresent...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : `src/main/presenter/llmProviderPresenter/index.ts` should manage the overall Agent loop, conversation history, tool execution via `McpPresenter`, and frontend communication via `eventBus`.
Applied to files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/mcpPresenter/index.tssrc/shared/presenter.d.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/providers/*.ts : provider files should implement ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Provider files should implement helper methods such as `formatMessages`, `convertToProviderTools`, `parseFunctionCalls`, and `prepareFunctionCallPrompt` as needed for provider-specific logic.
Applied to files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/index.tssrc/shared/presenter.d.ts
📚 Learning: applies to src/renderer/src/**/*.{ts,tsx,vue} : renderer to main: use usepresenter.ts composable for...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/renderer/src/**/*.{ts,tsx,vue} : Renderer to Main: Use usePresenter.ts composable for direct presenter method calls
Applied to files:
src/main/presenter/configPresenter/index.tssrc/shared/presenter.d.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/providers/*.ts : when a provider supports native ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : When a provider supports native function calling, MCP tools must be converted to the provider's format (e.g., using `convertToProviderTools`) and included in the API request.
Applied to files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/serverManager.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/mcpPresenter/index.tssrc/main/presenter/configPresenter/mcpConfHelper.ts
📚 Learning: applies to src/renderer/src/composables/usepresenter.ts : the ipc in the renderer process is impleme...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:45:54.229Z
Learning: Applies to src/renderer/src/composables/usePresenter.ts : The IPC in the renderer process is implemented in usePresenter.ts, allowing direct calls to the presenter-related interfaces exposed by the main process
Applied to files:
src/main/presenter/configPresenter/index.tssrc/main/presenter/mcpPresenter/index.tssrc/shared/presenter.d.ts
📚 Learning: applies to src/main/presenter/**/*.ts : one presenter per functional domain...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/main/presenter/**/*.ts : One presenter per functional domain
Applied to files:
src/main/presenter/configPresenter/index.tssrc/shared/presenter.d.ts
📚 Learning: in the meeting server implementation (src/main/presenter/mcppresenter/inmemoryservers/meetingserver....
Learnt from: neoragex2002
PR: ThinkInAIXYZ/deepchat#550
File: src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts:250-252
Timestamp: 2025-06-21T15:48:29.950Z
Learning: In the meeting server implementation (src/main/presenter/mcpPresenter/inMemoryServers/meetingServer.ts), when multiple tabs have the same title, the user prefers to let the code silently select the first match without adding warnings or additional ambiguity handling.
Applied to files:
src/main/presenter/mcpPresenter/serverManager.tssrc/main/presenter/mcpPresenter/index.ts
📚 Learning: 使用 pnpm 包管理...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-07-21T01:45:40.036Z
Learning: 使用 pnpm 包管理
Applied to files:
src/main/presenter/mcpPresenter/serverManager.tssrc/renderer/src/stores/mcp.tssrc/main/presenter/mcpPresenter/index.tssrc/shared/presenter.d.tssrc/renderer/src/components/settings/McpSettings.vuesrc/main/presenter/configPresenter/mcpConfHelper.ts
📚 Learning: applies to src/renderer/stores/**/*.ts : use pinia for state management....
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/stores/**/*.ts : Use Pinia for state management.
Applied to files:
src/renderer/src/stores/mcp.ts
📚 Learning: applies to src/renderer/src/**/*.{ts,tsx,vue} : use pinia for frontend state management...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/renderer/src/**/*.{ts,tsx,vue} : Use Pinia for frontend state management
Applied to files:
src/renderer/src/stores/mcp.ts
📚 Learning: applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : utilize actions for side effects and a...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/pinia-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:03.479Z
Learning: Applies to src/renderer/src/stores/**/*.{vue,ts,tsx,js,jsx} : Utilize actions for side effects and asynchronous operations
Applied to files:
src/renderer/src/stores/mcp.ts
📚 Learning: applies to src/main/presenter/llmproviderpresenter/providers/*.ts : each file in `src/main/presenter...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-07-21T01:46:52.880Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Each file in `src/main/presenter/llmProviderPresenter/providers/*.ts` should handle interaction with a specific LLM API, including request/response formatting, tool definition conversion, native/non-native tool call management, and standardizing output streams to a common event format.
Applied to files:
src/shared/presenter.d.ts
📚 Learning: applies to src/renderer/**/*.{vue,ts,js,tsx,jsx} : 渲染进程代码放在 `src/renderer`...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-07-21T01:47:11.608Z
Learning: Applies to src/renderer/**/*.{vue,ts,js,tsx,jsx} : 渲染进程代码放在 `src/renderer`
Applied to files:
src/shared/presenter.d.ts
📚 Learning: applies to src/renderer/**/*.{vue} : use <script setup> syntax for concise component definitions....
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Use <script setup> syntax for concise component definitions.
Applied to files:
src/renderer/src/components/settings/McpSettings.vue
📚 Learning: applies to src/renderer/src/**/*.vue : add proper error handling and loading states for new ui compo...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/renderer/src/**/*.vue : Add proper error handling and loading states for new UI components
Applied to files:
src/renderer/src/components/settings/McpSettings.vue
📚 Learning: applies to src/renderer/**/*.{vue} : leverage ref, reactive, and computed for reactive state managem...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Leverage ref, reactive, and computed for reactive state management.
Applied to files:
src/renderer/src/components/settings/McpSettings.vue
📚 Learning: applies to src/renderer/src/**/*.vue : use composition api with proper typescript typing for new ui ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-21T01:45:33.790Z
Learning: Applies to src/renderer/src/**/*.vue : Use Composition API with proper TypeScript typing for new UI components
Applied to files:
src/renderer/src/components/settings/McpSettings.vue
📚 Learning: applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : use the composition api for better code organ...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-07-21T01:47:28.817Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Use the Composition API for better code organization and reusability
Applied to files:
src/renderer/src/components/settings/McpSettings.vue
📚 Learning: applies to src/renderer/**/*.{vue} : use shadcn vue, radix vue, and tailwind for components and styl...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-07-23T00:45:57.322Z
Learning: Applies to src/renderer/**/*.{vue} : Use Shadcn Vue, Radix Vue, and Tailwind for components and styling.
Applied to files:
src/renderer/src/components/settings/McpSettings.vue
📚 Learning: pnpm >= 9...
Learnt from: CR
PR: ThinkInAIXYZ/deepchat#0
File: .cursor/rules/development-setup.mdc:0-0
Timestamp: 2025-07-21T01:45:40.036Z
Learning: pnpm >= 9
Applied to files:
src/main/presenter/configPresenter/mcpConfHelper.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-check (x64)
🔇 Additional comments (20)
src/renderer/src/i18n/ko-KR/common.json (1)
73-75: All locales’ common.json files include “save” and “clear”
Confirmed that eachsrc/renderer/src/i18n/**/common.json(en-US, ja-JP, ko-KR, etc.) contains both keys and the translations are in place. Translations look consistent across all languages—approving these changes.src/renderer/src/i18n/zh-HK/common.json (1)
73-75: HK-Chinese additions accepted – keep files in sync
"save": "儲存"and"clear": "清除"are correct Traditional-HK translations and follow existing naming conventions.
Just ensure the key set matches other locales (see verification script in previous comment).src/renderer/src/i18n/ru-RU/common.json (1)
73-75: RU translations OK – mind key alignment
"save": "Сохранить"/"clear": "Очистить"look accurate and casing is consistent.
No further issues spotted.src/renderer/src/i18n/zh-TW/common.json (1)
74-75: TW-Chinese strings added correctlyNew keys conform to style of existing entries.
Nothing else to flag besides the global consistency check already requested.src/renderer/src/i18n/zh-CN/common.json (1)
73-75: Simplified-Chinese entries approvedTranslations are appropriate; placement after
"delete"matches other locale files.src/renderer/src/i18n/fr-FR/common.json (1)
73-75: New keys look good – please confirm cross-language consistency
saveandclearfollow the existing flat key style and translation reads well.
Just make sure every other language file now contains the same two keys so runtime doesn’t fall back to English.src/renderer/src/i18n/en-US/common.json (1)
73-75: Keys added successfully; verify they exist in all localesNothing to change here, but the new
save/clearkeys must be present in everycommon.jsonto keep the key sets aligned.src/renderer/src/i18n/fa-IR/common.json (1)
73-75: Persian translations added – looks correctSpelling is fine. Please double-check that RTL rendering in the UI is still correct once the new buttons surface.
src/renderer/src/i18n/ja-JP/common.json (1)
73-75: Japanese strings OK – keep key set in sync
保存/クリアare the right choices. Same reminder to keep all languages aligned.src/renderer/src/i18n/zh-TW/settings.json (1)
580-620: npmRegistry localization parity verified
Allmcp.npmRegistrykeys added inzh-TW/settings.jsonare present in every other language’ssettings.json. No missing keys found—localization files remain in sync.src/renderer/src/i18n/zh-CN/settings.json (1)
586-586: 结构一致性提醒
totalServers键此前缺失,本次补充👍。请确认其它语言(尤其 en-US 等未出现在 PR 的文件)也已添加同名键,保持结构对齐。src/renderer/src/i18n/fa-IR/settings.json (1)
586-627: Comprehensive NPM Registry translations added successfully.The Persian translations for the new NPM Registry management features are well-structured and comprehensive. They follow the established i18n patterns with proper dot-separated hierarchy naming and cover all UI elements, status messages, error handling, and user feedback scenarios.
src/renderer/src/stores/mcp.ts (2)
529-567: Well-implemented NPM Registry management methods.The new async methods follow established patterns in the store with proper error handling, type safety checks, and consistent naming conventions. The defensive programming approach of checking method availability before calling is commendable.
614-619: NPM Registry methods properly exposed in store API.The new methods are correctly included in the store's return object under the appropriate "NPM Registry 管理方法" section, maintaining the organized structure of the store interface.
src/main/presenter/configPresenter/index.ts (1)
1117-1161: Excellent delegation pattern implementation for NPM Registry management.The new NPM Registry methods follow the established architectural pattern of delegating to specialized helper classes. The methods are well-named, properly typed, and maintain consistent abstraction levels throughout the ConfigPresenter class.
src/shared/presenter.d.ts (2)
448-458: LGTM!The NPM Registry methods are correctly added as optional to maintain backward compatibility with existing implementations.
1104-1116: LGTM!The async NPM Registry methods in IMCPPresenter are well-structured with appropriate return types and maintain consistency with the pattern established by other presenter methods.
src/main/presenter/mcpPresenter/index.ts (3)
120-127: LGTM with minor naming consideration.The changes to prefer cached data during initialization are good for performance. The log message updates are appropriate for the new context.
Consider whether
testNpmRegistrySpeed(true)clearly conveys "prefer cache" - the method name suggests speed testing but it's being used for initialization with caching preference.
175-175: LGTM!Good placement of the background registry update scheduling after initialization is complete.
1169-1171: LGTM!Simple and appropriate delegation to the server manager.
| private normalizeNpmRegistryUrl(registry: string): string { | ||
| let normalized = registry.trim() | ||
| if (!normalized.endsWith('/')) { | ||
| normalized += '/' | ||
| } | ||
| return normalized | ||
| } |
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.
Add URL validation in normalization method.
The URL normalization should validate that the input is a valid HTTP/HTTPS URL before normalizing.
private normalizeNpmRegistryUrl(registry: string): string {
let normalized = registry.trim()
+ // Validate URL format
+ if (!normalized.startsWith('http://') && !normalized.startsWith('https://')) {
+ throw new Error('Registry URL must start with http:// or https://')
+ }
+ try {
+ new URL(normalized) // Validate URL structure
+ } catch {
+ throw new Error('Invalid registry URL format')
+ }
if (!normalized.endsWith('/')) {
normalized += '/'
}
return normalized
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| private normalizeNpmRegistryUrl(registry: string): string { | |
| let normalized = registry.trim() | |
| if (!normalized.endsWith('/')) { | |
| normalized += '/' | |
| } | |
| return normalized | |
| } | |
| private normalizeNpmRegistryUrl(registry: string): string { | |
| let normalized = registry.trim() | |
| // Validate URL format | |
| if (!normalized.startsWith('http://') && !normalized.startsWith('https://')) { | |
| throw new Error('Registry URL must start with http:// or https://') | |
| } | |
| try { | |
| new URL(normalized) // Validate URL structure | |
| } catch { | |
| throw new Error('Invalid registry URL format') | |
| } | |
| if (!normalized.endsWith('/')) { | |
| normalized += '/' | |
| } | |
| return normalized | |
| } |
🤖 Prompt for AI Agents
In src/main/presenter/configPresenter/mcpConfHelper.ts around lines 532 to 538,
the normalizeNpmRegistryUrl method currently normalizes the URL by trimming and
appending a trailing slash but does not validate if the input is a valid HTTP or
HTTPS URL. Update this method to first check if the input string is a valid URL
starting with http:// or https://, and if not, handle the invalid input
appropriately (e.g., throw an error or return a default value). Then proceed
with the existing normalization logic.
| async setCustomNpmRegistry(registry: string | undefined): Promise<void> { | ||
| this.configPresenter.setCustomNpmRegistry?.(registry) | ||
| if (registry) { | ||
| console.log(`[MCP] Setting custom NPM registry: ${registry}`) | ||
| } else { | ||
| console.log('[MCP] Clearing custom NPM registry') | ||
| } | ||
| this.serverManager.loadRegistryFromCache() | ||
| } |
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.
🛠️ Refactor suggestion
Add input validation and error handling.
The implementation is good but could benefit from validation and error handling.
async setCustomNpmRegistry(registry: string | undefined): Promise<void> {
+ try {
+ // Validate registry URL format if provided
+ if (registry && registry.trim()) {
+ const trimmed = registry.trim()
+ if (!trimmed.startsWith('http://') && !trimmed.startsWith('https://')) {
+ throw new Error('Registry URL must start with http:// or https://')
+ }
+ registry = trimmed
+ }
+
this.configPresenter.setCustomNpmRegistry?.(registry)
if (registry) {
console.log(`[MCP] Setting custom NPM registry: ${registry}`)
} else {
console.log('[MCP] Clearing custom NPM registry')
}
this.serverManager.loadRegistryFromCache()
+ } catch (error) {
+ console.error('[MCP] Failed to set custom NPM registry:', error)
+ throw error
+ }
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| async setCustomNpmRegistry(registry: string | undefined): Promise<void> { | |
| this.configPresenter.setCustomNpmRegistry?.(registry) | |
| if (registry) { | |
| console.log(`[MCP] Setting custom NPM registry: ${registry}`) | |
| } else { | |
| console.log('[MCP] Clearing custom NPM registry') | |
| } | |
| this.serverManager.loadRegistryFromCache() | |
| } | |
| async setCustomNpmRegistry(registry: string | undefined): Promise<void> { | |
| try { | |
| // Validate registry URL format if provided | |
| if (registry && registry.trim()) { | |
| const trimmed = registry.trim() | |
| if (!trimmed.startsWith('http://') && !trimmed.startsWith('https://')) { | |
| throw new Error('Registry URL must start with http:// or https://') | |
| } | |
| registry = trimmed | |
| } | |
| this.configPresenter.setCustomNpmRegistry?.(registry) | |
| if (registry) { | |
| console.log(`[MCP] Setting custom NPM registry: ${registry}`) | |
| } else { | |
| console.log('[MCP] Clearing custom NPM registry') | |
| } | |
| this.serverManager.loadRegistryFromCache() | |
| } catch (error) { | |
| console.error('[MCP] Failed to set custom NPM registry:', error) | |
| throw error | |
| } | |
| } |
🤖 Prompt for AI Agents
In src/main/presenter/mcpPresenter/index.ts around lines 1173 to 1181, add input
validation to check if the registry string is a valid URL or matches expected
patterns before proceeding. Also, wrap the logic inside a try-catch block to
handle any potential errors from setCustomNpmRegistry or loadRegistryFromCache
calls, logging or handling errors appropriately to prevent unhandled exceptions.
| async setAutoDetectNpmRegistry(enabled: boolean): Promise<void> { | ||
| this.configPresenter.setAutoDetectNpmRegistry?.(enabled) | ||
| if (enabled) { | ||
| this.serverManager.loadRegistryFromCache() | ||
| } | ||
| } |
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.
🛠️ Refactor suggestion
Add error handling for consistency.
The logic is sound but should include error handling consistent with other methods.
async setAutoDetectNpmRegistry(enabled: boolean): Promise<void> {
+ try {
this.configPresenter.setAutoDetectNpmRegistry?.(enabled)
if (enabled) {
this.serverManager.loadRegistryFromCache()
}
+ } catch (error) {
+ console.error('[MCP] Failed to set auto-detect NPM registry:', error)
+ throw error
+ }
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| async setAutoDetectNpmRegistry(enabled: boolean): Promise<void> { | |
| this.configPresenter.setAutoDetectNpmRegistry?.(enabled) | |
| if (enabled) { | |
| this.serverManager.loadRegistryFromCache() | |
| } | |
| } | |
| async setAutoDetectNpmRegistry(enabled: boolean): Promise<void> { | |
| try { | |
| this.configPresenter.setAutoDetectNpmRegistry?.(enabled) | |
| if (enabled) { | |
| this.serverManager.loadRegistryFromCache() | |
| } | |
| } catch (error) { | |
| console.error('[MCP] Failed to set auto-detect NPM registry:', error) | |
| throw error | |
| } | |
| } |
🤖 Prompt for AI Agents
In src/main/presenter/mcpPresenter/index.ts around lines 1183 to 1188, the
method setAutoDetectNpmRegistry lacks error handling unlike other methods. Wrap
the existing logic in a try-catch block, call
this.configPresenter.setAutoDetectNpmRegistry with the enabled parameter inside
the try, and also call this.serverManager.loadRegistryFromCache if enabled. In
the catch block, log or handle the error appropriately to maintain consistency
with error handling in similar methods.
| async clearNpmRegistryCache(): Promise<void> { | ||
| this.configPresenter.clearNpmRegistryCache?.() | ||
| console.log('[MCP] NPM Registry cache cleared') | ||
| } |
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.
🛠️ Refactor suggestion
Add error handling for robustness.
Simple implementation but should include error handling.
async clearNpmRegistryCache(): Promise<void> {
+ try {
this.configPresenter.clearNpmRegistryCache?.()
console.log('[MCP] NPM Registry cache cleared')
+ } catch (error) {
+ console.error('[MCP] Failed to clear NPM registry cache:', error)
+ throw error
+ }
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| async clearNpmRegistryCache(): Promise<void> { | |
| this.configPresenter.clearNpmRegistryCache?.() | |
| console.log('[MCP] NPM Registry cache cleared') | |
| } | |
| async clearNpmRegistryCache(): Promise<void> { | |
| try { | |
| this.configPresenter.clearNpmRegistryCache?.() | |
| console.log('[MCP] NPM Registry cache cleared') | |
| } catch (error) { | |
| console.error('[MCP] Failed to clear NPM registry cache:', error) | |
| throw error | |
| } | |
| } |
🤖 Prompt for AI Agents
In src/main/presenter/mcpPresenter/index.ts around lines 1190 to 1193, the
clearNpmRegistryCache method calls clearNpmRegistryCache on configPresenter
without error handling. Wrap the call in a try-catch block to catch any
potential errors, log or handle the error appropriately, and ensure the method
remains robust and does not fail silently.
| async updateNpmRegistryInBackground(): Promise<void> { | ||
| try { | ||
| // 检查是否需要更新 | ||
| if (this.configPresenter.isNpmRegistryCacheValid?.()) { | ||
| console.log('[NPM Registry] Cache is still valid, skipping background update') | ||
| return | ||
| } | ||
| console.log('[NPM Registry] Starting background registry update') | ||
| await this.testNpmRegistrySpeed(false) | ||
| console.log('[NPM Registry] Background registry update completed') | ||
| } catch (error) { | ||
| console.error('[NPM Registry] Background update failed:', error) | ||
| } | ||
| } |
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.
🛠️ Refactor suggestion
Consider adding lifecycle management for background updates.
The background update method could potentially be called multiple times without proper cleanup. Consider implementing a mechanism to cancel pending updates when the ServerManager is destroyed.
Would you like me to implement a proper lifecycle management system with cancellation support for background updates?
🤖 Prompt for AI Agents
In src/main/presenter/mcpPresenter/serverManager.ts around lines 153 to 166, the
updateNpmRegistryInBackground method lacks lifecycle management, which may cause
multiple overlapping background updates without cleanup. To fix this, implement
a cancellation mechanism such as using an AbortController or a similar token to
track and cancel ongoing updates when the ServerManager instance is destroyed or
when a new update starts. Ensure that the method checks for cancellation before
proceeding and that any resources are properly cleaned up to prevent memory
leaks or redundant operations.
| "minutesAgo": "{minutes}分前", | ||
| "hoursAgo": "{hours}時間前", | ||
| "daysAgo": "{days}日前", | ||
| "refreshSuccess": "NPMソースの更新が成功しました", |
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.
🛠️ Refactor suggestion
同一訳語が重複しています – 共通ファイルへ集約を
justNow, minutesAgo, hoursAgo, daysAgo は既に rateLimit ブロックで定義済みです。mcp.npmRegistry で再定義すると重複となり、ガイドライン「共有キーは common.json」に反します。上記 RU 版と同様に共通キーを参照してください。
Also applies to: 681-684
🤖 Prompt for AI Agents
In src/renderer/src/i18n/ja-JP/settings.json around lines 595 to 598 and also
lines 681 to 684, the keys justNow, minutesAgo, hoursAgo, and daysAgo are
redefined although they already exist in the rateLimit block, causing
duplication. Remove these duplicate definitions from the mcp.npmRegistry section
and instead reference the common keys from the shared common.json file to comply
with the guideline that shared keys must be centralized.
| "minutesAgo": "{minutes}분 전", | ||
| "hoursAgo": "{hours}시간 전", | ||
| "daysAgo": "{days}일 전", | ||
| "refreshSuccess": "NPM 소스 새로고침 성공", |
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.
🛠️ Refactor suggestion
공통 “시간 전” 문자열 중복 정의
rateLimit 섹션에 이미 존재하는 justNow 등 4개 키가 mcp.npmRegistry 에서 다시 선언되었습니다.
중복을 제거하고 common.json(또는 rateLimit 경로) 의 키를 참조하도록 수정해 주세요.
Also applies to: 681-684
🤖 Prompt for AI Agents
In src/renderer/src/i18n/ko-KR/settings.json around lines 595 to 598 and also
lines 681 to 684, the time-related strings like "minutesAgo", "hoursAgo",
"daysAgo", and "refreshSuccess" are redundantly defined in the mcp.npmRegistry
section while they already exist in the rateLimit section. Remove these
duplicate keys from mcp.npmRegistry and update the code to reference the
existing keys from the common.json or rateLimit path instead, ensuring no
repeated definitions remain.
| "minutesAgo": "{minutes} минут назад", | ||
| "hoursAgo": "{hours} часов назад", | ||
| "daysAgo": "{days} дней назад", | ||
| "refreshSuccess": "Обновление источника NPM успешно", |
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.
💡 Verification agent
🧩 Analysis chain
Duplicate “time-ago” strings – move to common.json
Keys justNow, minutesAgo, hoursAgo, daysAgo already exist in the global rateLimit section (lines 681-684).
Replicating them under mcp.npmRegistry violates the shared-keys-in-common rule and bloats every locale file.
- "justNow": "Только что",
- "minutesAgo": "{minutes} минут назад",
- "hoursAgo": "{hours} часов назад",
- "daysAgo": "{days} дней назад",
+ "justNow": "@:rateLimit.justNow",
+ "minutesAgo": "@:rateLimit.minutesAgo",
+ "hoursAgo": "@:rateLimit.hoursAgo",
+ "daysAgo": "@:rateLimit.daysAgo",Move / alias these four keys to src/renderer/src/i18n/common.json (or reference the existing rateLimit ones as above) and delete the duplicates from every locale.
Please confirm no other sections re-declare the same keys.
Also applies to: 681-684
🏁 Script executed:
#!/bin/bash
set -e
echo "1. Locating 'common.json' file:"
fd common.json src/renderer/src/i18n
echo -e "\n2. Showing the top of 'common.json' (first 200 lines):"
sed -n '1,200p' src/renderer/src/i18n/common.json
echo -e "\n3. Finding all 'rateLimit' occurrences in i18n directory:"
rg -n '"rateLimit"' src/renderer/src/i18n
echo -e "\n4. Context around 'rateLimit' in ru-RU/settings.json (lines 660–740):"
sed -n '660,740p' src/renderer/src/i18n/ru-RU/settings.json
echo -e "\n5. Occurrences of time-ago keys across all locale files:"
rg -n '"justNow"|"minutesAgo"|"hoursAgo"|"daysAgo"' src/renderer/src/i18nLength of output: 744
🏁 Script executed:
#!/bin/bash
set -e
echo "1. Checking ru-RU/common.json for time-ago keys under rateLimit section"
rg -n '"justNow"|"minutesAgo"|"hoursAgo"|"daysAgo"' -C2 src/renderer/src/i18n/ru-RU/common.json || true
echo -e "\n2. Checking ru-RU/settings.json for duplicate keys"
rg -n '"justNow"|"minutesAgo"|"hoursAgo"|"daysAgo"' -C2 src/renderer/src/i18n/ru-RU/settings.json || true
echo -e "\n3. Verifying rateLimit section in all locales' common.json files"
rg -n '"rateLimit"' -C2 src/renderer/src/i18n/*/common.json || trueLength of output: 1769
🏁 Script executed:
#!/bin/bash
set -e
echo "1. Context around 'rateLimit' section in ru-RU/settings.json (lines 670–700):"
sed -n '670,700p' src/renderer/src/i18n/ru-RU/settings.json
echo -e "\n2. Time-ago keys in settings.json across all locales:"
rg -n '"justNow"|"minutesAgo"|"hoursAgo"|"daysAgo"' src/renderer/src/i18n/*/settings.json || true
echo -e "\n3. Time-ago keys in common.json across all locales:"
rg -n '"justNow"|"minutesAgo"|"hoursAgo"|"daysAgo"' src/renderer/src/i18n/*/common.json || trueLength of output: 6528
Consolidate all “time-ago” strings into each locale’s common.json and alias in settings.json
Move the shared time-ago keys—justNow, secondsAgo, minutesAgo, hoursAgo, daysAgo—out of both the mcp.npmRegistry and rateLimit sections in settings.json into a new "timeAgo" group in each locale’s common.json, then reference them via alias.
• In src/renderer/src/i18n/*/common.json, add:
{
…
"timeAgo": {
"justNow": "…",
"secondsAgo": "…",
"minutesAgo": "…",
"hoursAgo": "…",
"daysAgo": "…"
}
}• In src/renderer/src/i18n/*/settings.json, under mcp.npmRegistry replace:
- "justNow": "…",
- "minutesAgo": "…",
- "hoursAgo": "…",
- "daysAgo": "…",
+ "justNow": "@:common.timeAgo.justNow",
+ "minutesAgo": "@:common.timeAgo.minutesAgo",
+ "hoursAgo": "@:common.timeAgo.hoursAgo",
+ "daysAgo": "@:common.timeAgo.daysAgo",• In settings.json under rateLimit replace its overlapping keys:
- "justNow": "…",
- "secondsAgo": "…",
- "minutesAgo": "…",
+ "justNow": "@:common.timeAgo.justNow",
+ "secondsAgo": "@:common.timeAgo.secondsAgo",
+ "minutesAgo": "@:common.timeAgo.minutesAgo",Retain any rate-limit-specific labels (e.g. "immediately", "secondsLater") in place.
Apply this change consistently across all locale folders.
🤖 Prompt for AI Agents
In src/renderer/src/i18n/ru-RU/settings.json around lines 595 to 598, the
time-ago strings like "minutesAgo", "hoursAgo", and "daysAgo" should be moved
out of the mcp.npmRegistry and rateLimit sections and consolidated into a new
"timeAgo" group inside each locale's common.json file. Then, in settings.json,
replace the original keys with aliases referencing the new common.json "timeAgo"
group. Ensure to keep any rate-limit-specific keys intact and apply this
restructuring consistently across all locale folders.
| "justNow": "刚刚", | ||
| "minutesAgo": "{minutes}分钟前", | ||
| "hoursAgo": "{hours}小时前", | ||
| "daysAgo": "{days}天前", |
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.
🛠️ Refactor suggestion
重复的“时间间隔”翻译应抽取为公共键
justNow/…Ago 四个键已在 rateLimit 中出现,再次添加到 mcp.npmRegistry 违反了「公共键放到 common.json」规范。
请改为引用公共键或直接使用 @:rateLimit.justNow 等语法,并在所有语言文件中同步调整。
Also applies to: 681-684
🤖 Prompt for AI Agents
In src/renderer/src/i18n/zh-CN/settings.json around lines 601 to 604 and also
lines 681 to 684, the time interval translation keys justNow, minutesAgo,
hoursAgo, and daysAgo are duplicated and should be extracted as common keys.
Replace these keys with references to the existing common keys in rateLimit
using the syntax @:rateLimit.justNow and similarly for the others. Make sure to
apply the same changes consistently across all language files to maintain
synchronization.
| "npmRegistry": { | ||
| "title": "NPM源配置", | ||
| "currentSource": "當前源", | ||
| "cached": "緩存", | ||
| "lastChecked": "上次檢測", | ||
| "refresh": "刷新", | ||
| "advanced": "高級", | ||
| "advancedSettings": "高級設置", | ||
| "advancedSettingsDesc": "配置NPM源的高級選項,包括自動檢測和自定義源設置", | ||
| "autoDetect": "自動檢測最優源", | ||
| "autoDetectDesc": "啟動時自動檢測並使用最快的NPM源", | ||
| "customSource": "自定義源", | ||
| "customSourcePlaceholder": "輸入自定義NPM源地址", | ||
| "currentCustom": "當前自定義源", | ||
| "justNow": "剛剛", | ||
| "minutesAgo": "{minutes}分鐘前", | ||
| "hoursAgo": "{hours}小時前", | ||
| "daysAgo": "{days}天前", | ||
| "refreshSuccess": "NPM源刷新成功", | ||
| "refreshSuccessDesc": "已重新檢測並更新最優NPM源", | ||
| "refreshFailed": "NPM源刷新失敗", | ||
| "autoDetectUpdated": "自動檢測設置已更新", | ||
| "autoDetectEnabled": "已啟用自動檢測最優NPM源", | ||
| "autoDetectDisabled": "已禁用自動檢測,將使用默認源", | ||
| "updateFailed": "設置更新失敗", | ||
| "customSourceSet": "自定義源已設置", | ||
| "customSourceSetDesc": "已設置自定義NPM源:{registry}", | ||
| "customSourceCleared": "自定義源已清除", | ||
| "customSourceClearedDesc": "已清除自定義NPM源,將使用自動檢測", | ||
| "invalidUrl": "無效的URL", | ||
| "invalidUrlDesc": "請輸入有效的HTTP或HTTPS地址", | ||
| "testing": "正在測試NPM源", | ||
| "testingDesc": "正在測試源 {registry} 的連通性...", | ||
| "testFailed": "NPM源測試失敗", | ||
| "testFailedDesc": "無法連接到 {registry},錯誤:{error}。請檢查URL是否正確或網絡連接。", | ||
| "redetectingOptimal": "正在重新檢測最優NPM源...", | ||
| "redetectComplete": "重新檢測完成", | ||
| "redetectCompleteDesc": "已檢測並設置當前最優的NPM源", | ||
| "redetectFailed": "重新檢測失敗", | ||
| "redetectFailedDesc": "無法重新檢測最優源,將使用默認配置" | ||
| }, |
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.
💡 Verification agent
🧩 Analysis chain
Verify global coverage & consider moving generic labels to common.json.
The new mcp.npmRegistry.* subtree looks internally consistent, but please double-check two things:
- All other locale files (
zh-CN,ja-JP,ko-KR,ru-RU, etc.) now need the exact same key structure, otherwise the UI will silently fall back to English. - Several literals such as
refresh,advanced,invalidUrl,testingare generic verbs/statuses already repeated in multiple namespaces. Per our i18n guideline, shared user-visible strings should live incommon.jsonand be referenced from each section to cut duplication and keep translations in sync.
To spot missing locales quickly, run:
🏁 Script executed:
#!/bin/bash
# List language packs missing the new npmRegistry.title key
fd -e json src/renderer/src/i18n | while read -r f; do
if ! jq -e '.mcp.npmRegistry.title' "$f" >/dev/null 2>&1; then
echo "❌ Missing in: $f"
fi
doneLength of output: 436
🏁 Script executed:
#!/usr/bin/env bash
# List language packs missing the new mcp.npmRegistry.title key
# (corrected fd invocation to search under the i18n directory)
fd -e json . src/renderer/src/i18n | while IFS= read -r f; do
if ! jq -e '.mcp.npmRegistry.title' "$f" >/dev/null 2>&1; then
echo "❌ Missing in: $f"
fi
doneLength of output: 32986
Add mcp.npmRegistry to all locales & extract shared labels
The new NPM registry subtree currently only lives in zh-HK/settings.json. A quick coverage check shows it’s missing in every other pack (en-US, fa-IR, fr-FR, ja-JP, ko-KR, ru-RU, zh-CN, zh-TW).
Please address the following:
- Populate
mcp.npmRegistry(lines 580–620) in eachsrc/renderer/src/i18n/<locale>/settings.jsonso all locales have the same key hierarchy. - Extract generic strings (e.g.
refresh,advanced,invalidUrl,testing, etc.) intosrc/renderer/src/i18n/common.jsonand reference them from each namespace to keep translations in sync.
You can reuse the coverage script to verify completeness:
fd -e json . src/renderer/src/i18n | while read -r f; do
jq -e '.mcp.npmRegistry.title' "$f" >/dev/null 2>&1 || echo "❌ Missing in: $f"
done🤖 Prompt for AI Agents
In src/renderer/src/i18n/zh-HK/settings.json lines 580 to 620, the
mcp.npmRegistry subtree is defined only for zh-HK locale. To fix this, add the
entire mcp.npmRegistry key hierarchy with corresponding translations to all
other locale settings.json files under
src/renderer/src/i18n/<locale>/settings.json to ensure coverage. Additionally,
extract common generic strings like "refresh", "advanced", "invalidUrl",
"testing", etc., into src/renderer/src/i18n/common.json and update each locale's
mcp.npmRegistry to reference these shared strings to maintain consistency and
reduce duplication.
* fix: prevent tooltip from overlapping HTML preview in ArtifactDialog (#683) * fix: unwatch is not a function error in knowledge settings components (#684) * fix: resolve message editing and markdown rendering issues (#685) * docs: update Electron-Vite link format to full URL (#687) * fix: built-in knowledge settings not loaded when first entering (#688) * fix: enhance lifecycle management by adding unmounted hook and MCP state watcher * fix: improve knowledge destruction confirmation and enhance unwatch handling in settings * fix: resolve database lock issue in data reset functionality (#689) * feat: implement provider-based request rate limit (#686) * feat: implement provider-based request rate limit * feat: add input validation with confirmation dialog * refactor: merge RateLimitPresenter into LLMProviderPresenter * Optimize/builtin knowledge interaction (#690) * feat: improve builtInKnowledge file icon style * feat: add builtInKnowledge resume icon tooltip * feat: format code * Update src/renderer/src/i18n/fa-IR/settings.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update src/renderer/src/i18n/ja-JP/settings.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update src/renderer/src/i18n/fr-FR/settings.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update settings.json * Update src/renderer/src/i18n/fr-FR/settings.json Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: Fix French and Korean translations for pause and delete file confirmation messages --------- Co-authored-by: sqsyli <sqsyli@qq.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: fixed dirty data problems (#691) fixed the old session tool error caused by fixed the problem that the tool list was not reset when creating a new session * feat: add mentions support in deeplink (#692) * feat: add mentions support in chat input and store * style: format imports and clean up code for better readability * fix: improve mentions handling in handleStart method * fix: prompt attach files (#695) * fix: update file icon handling and improve file upload process * fix: remove redundant FileItem interface definition in PromptSetting.vue * fix: implement confirmation dialog for prompt deletion in PromptSetting.vue * fix: streamline file upload process by removing redundant file content reading logic * feat: add npm registry caching and optimization system (#697) * fix: resolve input focus loss issue after sending messages (#694) * fix: resolve deeplink message not displaying when triggered from settings page (#699) * fix: update current tools assignment to include tool names when MCP tools are not enabled (#698) * feat: add support for new models (#700) * chore: update ollama model settings * chore: add support for gpt-oss * chore: bump to 0.2.9 * fix: refine #698 (#701) * fix: update current tools assignment to include tool names when MCP tools are not enabled * fix: update enabled MCP tools assignment to include tool names on session switch * feat: add Claude Opus 4.1 support and fix anthropic model list dialog (#702) --------- Co-authored-by: yyhhyyyyyy <yyhhyyyyyy8@gmail.com> Co-authored-by: cycleccc <2991205548@qq.com> Co-authored-by: hllshiro <40970081+hllshiro@users.noreply.github.com> Co-authored-by: sqsyli <sqsyli@qq.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
add npm registry caching and optimization system


Summary by CodeRabbit
New Features
Localization
Bug Fixes