Skip to content

Conversation

@zerob13
Copy link
Collaborator

@zerob13 zerob13 commented Nov 28, 2025

Summary by CodeRabbit

  • New Features

    • Added support for launching the app via deeplinks to automatically configure services.
    • Service configuration deeplinks now work both at startup and during runtime.
    • App automatically navigates to relevant settings when service configuration is initiated.
  • Refactor

    • Enhanced startup initialization and window management for deeplink handling.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Walkthrough

This PR adds startup deeplink handling to the application by detecting deeplinks (deepchat://) during cold start and subsequent app instances, persisting MCP installation configurations to localStorage, and enabling renderers to consume these configurations during initialization. The changes span the main process, presenter layer, and renderer components.

Changes

Cohort / File(s) Summary
Startup deeplink parsing & event handling
src/main/index.ts
Introduces startupDeepLink state, parses command-line arguments and environment variables for deepchat:// URLs, registers open-url and second-instance event listeners to capture deeplinks, and persists final startup deeplink to process.env.STARTUP_DEEPLINK.
Deeplink presenter enhancement
src/main/presenter/deeplinkPresenter/index.ts
Adds checkStartupDeepLink for cold-start extraction, extends processDeepLink to defer MCP install processing until MCP is ready, introduces handleMcpInstall to persist MCP config to localStorage (Settings window if running, shell window if cold start), and adds helper methods (saveMcpConfigToShellWindow, waitForFirstShellWindow) with structured logging.
Renderer startup flow & MCP integration
src/renderer/settings/App.vue, src/renderer/shell/App.vue
Both components now initialize MCP store, register deeplink listeners, read pending-mcp-install from localStorage on mount, enable MCP if disabled, cache config, and navigate to MCP settings page; onMounted becomes async with proper cleanup.
Navigation logic centralization
src/renderer/src/lib/storeInitializer.ts
Introduces navigateToMcpSettings helper to consolidate MCP settings navigation with route availability checks and guard against unnecessary navigation when already on target route.
Public API expansion
src/shared/types/presenters/legacy.presenters.d.ts
Adds createSettingsWindow(): Promise<number | null> method to IWindowPresenter interface.

Sequence Diagram(s)

sequenceDiagram
    participant Main as Main Process
    participant Presenter as DeeplinkPresenter
    participant WM as Window Manager
    participant LS as localStorage
    participant Settings as Settings Renderer
    participant Shell as Shell Renderer

    rect rgb(200, 220, 250)
    Note over Main,Shell: Cold Start with MCP Deeplink
    Main->>Main: Parse deeplink from env/args
    Main->>Presenter: checkStartupDeepLink()
    Presenter->>LS: Save pending-mcp-install
    Presenter->>Presenter: Build MCP config
    Presenter->>WM: waitForFirstShellWindow()
    WM-->>Presenter: Shell window ready
    Presenter->>LS: saveMcpConfigToShellWindow()
    Shell->>Shell: onMounted: read pending-mcp-install
    Shell->>LS: Get MCP config from localStorage
    Shell->>Shell: Enable MCP, cache config
    Shell->>Shell: Navigate to settings-mcp
    end

    rect rgb(220, 250, 200)
    Note over Main,Settings: Running App with MCP Deeplink
    Main->>Presenter: handleDeepLink (MCP install)
    Presenter->>Presenter: Detect hasWindows = true
    Presenter->>WM: createSettingsWindow()
    WM-->>Presenter: Settings window created
    Presenter->>LS: saveMcpConfigToSettingsWindow()
    Settings->>Settings: onMounted: read pending-mcp-install
    Settings->>LS: Get MCP config from localStorage
    Settings->>Settings: Enable MCP, cache config
    Settings->>Settings: Navigate to settings-mcp
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Window readiness and timing logic: The waitForFirstShellWindow and window creation flows require careful verification of timeout handling and race conditions.
  • localStorage persistence patterns: Ensure pending-mcp-install is correctly written/read across processes with proper JSON serialization and cleanup.
  • Async/await ordering in renderers: Both App.vue files now have async onMounted hooks; verify that store initialization and router readiness checks occur in correct order.
  • Navigation guards in storeInitializer: The navigateToMcpSettings helper has multiple route existence checks; confirm all fallback paths are correctly handled.
  • Public API expansion: Verify that createSettingsWindow is properly implemented and integrated with the deeplink flow.

Possibly related PRs

Poem

🐰 A deeplink arrives at the startup gate,
Config persists ere windows awake,
Shell and Settings both read the scroll,
localStorage holds the MCP goal,
Cold start or running—both paths entwine,
Navigation flows, perfectly fine!

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The PR title 'fix: deeplink one click' is vague and does not clearly convey the specific changes made. While it references 'deeplink', the phrase 'one click' lacks specificity about what the fix addresses. Revise the title to be more descriptive, such as 'fix: handle startup deeplinks and MCP config persistence' or similar, to clearly indicate the main objectives of the changes.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/deeplink-one-click

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (7)
src/main/index.ts (1)

30-32: Simplify the redundant regex pattern.

The condition is overly complex. arg.startsWith('deepchat://') will match the same cases as arg.includes('deepchat://') for a valid deeplink. The arg.match(/^deepchat:/) is also redundant when startsWith is used.

 const deepLinkArg = process.argv.find((arg) => {
-  return arg.startsWith('deepchat://') || arg.includes('deepchat://') || arg.match(/^deepchat:/)
+  return arg.startsWith('deepchat://')
 })
src/main/presenter/deeplinkPresenter/index.ts (1)

468-494: Consider adding an early return if no valid MCP servers were parsed.

If all server configurations fail validation, completeMcpConfig.mcpServers will be empty but the code still creates windows and stores the empty config to localStorage. This could lead to confusing user experience.

        completeMcpConfig.mcpServers[serverName] = finalConfig
      }

+     // Check if any valid servers were processed
+     if (Object.keys(completeMcpConfig.mcpServers).length === 0) {
+       console.warn('No valid MCP servers found in deeplink configuration')
+       return
+     }
+
      if (hasWindows) {
src/renderer/shell/App.vue (1)

47-56: Consider using the centralized navigateToMcpSettings helper.

This navigation logic duplicates the logic in useMcpInstallDeeplinkHandler from storeInitializer.ts. Consider extracting and reusing the navigation helper to maintain consistency and reduce duplication.

Alternatively, export navigateToMcpSettings from storeInitializer.ts and use it here:

import { navigateToMcpSettings } from '@/lib/storeInitializer'

// Then in onMounted:
await navigateToMcpSettings(router)
src/renderer/src/lib/storeInitializer.ts (2)

57-65: Redundant route check after navigation to settings.

At line 61, router.hasRoute('settings-mcp') is checked again, but if hasSettingsMcpRoute was false at line 42, it will still be false here since route definitions don't change at runtime. This check will never pass.

     if (hasSettingsRootRoute) {
       if (currentRoute.name !== 'settings') {
         await router.push({ name: 'settings' })
       }
-      if (router.hasRoute('settings-mcp')) {
-        await router.push({ name: 'settings-mcp' })
-      }
+      // settings-mcp route doesn't exist (checked above), just stay on settings
       return
     }

38-73: Consider exporting navigateToMcpSettings for reuse.

This helper centralizes MCP settings navigation logic. Since similar navigation is needed in shell/App.vue, consider exporting this function (with router as a parameter) to avoid duplication.

-  const navigateToMcpSettings = async () => {
+  const navigateToMcpSettings = async (router: ReturnType<typeof useRouter>) => {
     await router.isReady()
     // ... rest of implementation
   }

+// Export for use in other components
+export { navigateToMcpSettings }
src/renderer/settings/App.vue (2)

123-151: Consider consolidating the two onMounted hooks for clarity.

The file now has two separate onMounted hooks (lines 123-151 and 262-319). While valid in Vue 3 Composition API, consolidating them into a single hook would improve readability and make the initialization flow easier to follow.

Also applies to: 262-319


299-299: Avoid double stringification.

The config is parsed from localStorage at line 286, then re-stringified here. You could pass the original pendingMcpInstall string directly to avoid the redundant parse-stringify cycle.

-      mcpStore.setMcpInstallCache(JSON.stringify(mcpConfig))
+      mcpStore.setMcpInstallCache(pendingMcpInstall)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 14e6bd3 and 792d37c.

📒 Files selected for processing (6)
  • src/main/index.ts (1 hunks)
  • src/main/presenter/deeplinkPresenter/index.ts (7 hunks)
  • src/renderer/settings/App.vue (5 hunks)
  • src/renderer/shell/App.vue (1 hunks)
  • src/renderer/src/lib/storeInitializer.ts (2 hunks)
  • src/shared/types/presenters/legacy.presenters.d.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (27)
**/*.{ts,tsx,js,jsx,vue}

📄 CodeRabbit inference engine (CLAUDE.md)

Use English for logs and comments (Chinese text exists in legacy code, but new code should use English)

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
  • src/main/index.ts
  • src/renderer/shell/App.vue
  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/settings/App.vue
  • src/renderer/src/lib/storeInitializer.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

Enable and maintain strict TypeScript type checking for all files

**/*.{ts,tsx}: Always use try-catch to handle possible errors in TypeScript code
Provide meaningful error messages when catching errors
Log detailed error logs including error details, context, and stack traces
Distinguish and handle different error types (UserError, NetworkError, SystemError, BusinessError) with appropriate handlers in TypeScript
Use structured logging with logger.error(), logger.warn(), logger.info(), logger.debug() methods from logging utilities
Do not suppress errors (avoid empty catch blocks or silently ignoring errors)
Provide user-friendly error messages for user-facing errors in TypeScript components
Implement error retry mechanisms for transient failures in TypeScript
Avoid logging sensitive information (passwords, tokens, PII) in logs

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
  • src/main/index.ts
  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/src/lib/storeInitializer.ts
**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Do not include AI co-authoring information (e.g., 'Co-Authored-By: Claude') in git commits

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
  • src/main/index.ts
  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/src/lib/storeInitializer.ts
**/*.{js,ts,jsx,tsx,mjs,cjs}

📄 CodeRabbit inference engine (.cursor/rules/development-setup.mdc)

Write logs and comments in English

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
  • src/main/index.ts
  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/src/lib/storeInitializer.ts
src/shared/**/*.d.ts

📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)

Define type definitions in shared/*.d.ts files for objects exposed by the main process to the renderer process

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
src/**/*

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

New features should be developed in the src directory

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
  • src/main/index.ts
  • src/renderer/shell/App.vue
  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/settings/App.vue
  • src/renderer/src/lib/storeInitializer.ts
src/shared/**/*.{js,ts}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

Shared type definitions and utilities between main and renderer processes should be placed in src/shared

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
src/shared/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Shared types and utilities should be placed in src/shared/

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
src/**/*.{ts,tsx,vue,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Prettier with single quotes, no semicolons, and 100 character width

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
  • src/main/index.ts
  • src/renderer/shell/App.vue
  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/settings/App.vue
  • src/renderer/src/lib/storeInitializer.ts
src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use OxLint for linting JavaScript and TypeScript files

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
  • src/main/index.ts
  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/src/lib/storeInitializer.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.{ts,tsx}: Use camelCase for variable and function names in TypeScript files
Use PascalCase for type and class names in TypeScript
Use SCREAMING_SNAKE_CASE for constant names

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
  • src/main/index.ts
  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/src/lib/storeInitializer.ts
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Use EventBus for inter-process communication events

Files:

  • src/shared/types/presenters/legacy.presenters.d.ts
  • src/main/index.ts
  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/src/lib/storeInitializer.ts
src/main/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Use EventBus from src/main/eventbus.ts for main-to-renderer communication, broadcasting events via mainWindow.webContents.send()

src/main/**/*.ts: Use EventBus pattern for inter-process communication within the main process to decouple modules
Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations

src/main/**/*.ts: Electron main process code belongs in src/main/ with presenters in presenter/ (Window/Tab/Thread/Mcp/Config/LLMProvider) and eventbus.ts for app events
Use the Presenter pattern in the main process for UI coordination

Files:

  • src/main/index.ts
  • src/main/presenter/deeplinkPresenter/index.ts
src/main/**/*.{js,ts}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

Main process code for Electron should be placed in src/main

Files:

  • src/main/index.ts
  • src/main/presenter/deeplinkPresenter/index.ts
**/*.vue

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.vue: Use Vue 3 Composition API for all components instead of Options API
Use Tailwind CSS with scoped styles for component styling

Files:

  • src/renderer/shell/App.vue
  • src/renderer/settings/App.vue
src/renderer/**/*.vue

📄 CodeRabbit inference engine (CLAUDE.md)

src/renderer/**/*.vue: All user-facing strings must use i18n keys via vue-i18n for internationalization
Ensure proper error handling and loading states in all UI components
Implement responsive design using Tailwind CSS utilities for all UI components

src/renderer/**/*.vue: Use composition API and declarative programming patterns; avoid options API
Structure files: exported component, composables, helpers, static content, types
Use PascalCase for component names (e.g., AuthWizard.vue)
Use Vue 3 with TypeScript, leveraging defineComponent and PropType
Use template syntax for declarative rendering
Use Shadcn Vue, Radix Vue, and Tailwind for components and styling
Implement responsive design with Tailwind CSS; use a mobile-first approach
Use Suspense for asynchronous components
Use <script setup> syntax for concise component definitions
Prefer 'lucide:' icon family as the primary choice for Iconify icons
Import Icon component from '@iconify/vue' and use with lucide icons following pattern '{collection}:{icon-name}'

Files:

  • src/renderer/shell/App.vue
  • src/renderer/settings/App.vue
src/renderer/**/*.{vue,js,ts}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

Renderer process code should be placed in src/renderer (Vue 3 application)

Files:

  • src/renderer/shell/App.vue
  • src/renderer/settings/App.vue
  • src/renderer/src/lib/storeInitializer.ts
src/renderer/**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,tsx,vue}: Write concise, technical TypeScript code with accurate examples
Use descriptive variable names with auxiliary verbs (e.g., isLoading, hasError)
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

Vue 3 app code in src/renderer/src should be organized into components/, stores/, views/, i18n/, lib/ directories with shell UI in src/renderer/shell/

Files:

  • src/renderer/shell/App.vue
  • src/renderer/settings/App.vue
  • src/renderer/src/lib/storeInitializer.ts
src/renderer/**

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

Use lowercase with dashes for directories (e.g., components/auth-wizard)

Files:

  • src/renderer/shell/App.vue
  • src/renderer/settings/App.vue
  • src/renderer/src/lib/storeInitializer.ts
src/renderer/**/*.{ts,vue}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

src/renderer/**/*.{ts,vue}: Use useFetch and useAsyncData for data fetching
Leverage ref, reactive, and computed for reactive state management
Use provide/inject for dependency injection when appropriate
Use Iconify/Vue for icon implementation

Files:

  • src/renderer/shell/App.vue
  • src/renderer/settings/App.vue
  • src/renderer/src/lib/storeInitializer.ts
src/main/presenter/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Organize core business logic into dedicated Presenter classes, with one presenter per functional domain

Files:

  • src/main/presenter/deeplinkPresenter/index.ts
{src/main/presenter/**/*.ts,src/renderer/**/*.ts}

📄 CodeRabbit inference engine (.cursor/rules/electron-best-practices.mdc)

Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs

Files:

  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/src/lib/storeInitializer.ts
src/renderer/**/*.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Use the usePresenter.ts composable for renderer-to-main IPC communication to call presenter methods directly

Files:

  • src/renderer/src/lib/storeInitializer.ts
src/renderer/src/**/*.{vue,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/i18n.mdc)

src/renderer/src/**/*.{vue,ts,tsx}: All user-facing strings must use i18n keys with vue-i18n framework in the renderer
Import and use useI18n() composable with the t() function to access translations in Vue components and TypeScript files
Use the dynamic locale.value property to switch languages at runtime
Avoid hardcoding user-facing text and ensure all user-visible text uses the i18n translation system

Files:

  • src/renderer/src/lib/storeInitializer.ts
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 in Vue.js applications
Implement proper state management with Pinia in Vue.js applications
Utilize Vue Router for navigation and route management in Vue.js applications
Leverage Vue's built-in reactivity system for efficient data handling

Files:

  • src/renderer/src/lib/storeInitializer.ts
src/renderer/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/vue-shadcn.mdc)

Use TypeScript for all code; prefer types over interfaces

Files:

  • src/renderer/src/lib/storeInitializer.ts
src/renderer/src/**/*.{ts,tsx,vue}

📄 CodeRabbit inference engine (AGENTS.md)

src/renderer/src/**/*.{ts,tsx,vue}: Use TypeScript with Vue 3 Composition API for the renderer application
All user-facing strings must use vue-i18n keys in src/renderer/src/i18n

Files:

  • src/renderer/src/lib/storeInitializer.ts
🧠 Learnings (24)
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/main/**/*.ts : Use the Presenter pattern in the main process for UI coordination

Applied to files:

  • src/shared/types/presenters/legacy.presenters.d.ts
  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/renderer/**/*.ts : Use the `usePresenter.ts` composable for renderer-to-main IPC communication to call presenter methods directly

Applied to files:

  • src/shared/types/presenters/legacy.presenters.d.ts
  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: 2025-08-28T12:01:03.917Z
Learnt from: hllshiro
Repo: ThinkInAIXYZ/deepchat PR: 803
File: src/main/presenter/trayPresenter.ts:0-0
Timestamp: 2025-08-28T12:01:03.917Z
Learning: In the DeepChat application, calling app.quit() directly will automatically trigger the LifecycleManager's shutdown handling through Electron's before-quit event interception, so explicit calls to LifecycleManager.requestShutdown() are not needed when simply quitting the application.

Applied to files:

  • src/main/index.ts
📚 Learning: 2025-11-25T05:27:45.545Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:45.545Z
Learning: Applies to src/renderer/src/**/*.{vue,ts,tsx,js,jsx} : Utilize Vue Router for navigation and route management in Vue.js applications

Applied to files:

  • src/renderer/shell/App.vue
  • src/renderer/src/lib/storeInitializer.ts
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/renderer/**/*.vue : Ensure proper error handling and loading states in all UI components

Applied to files:

  • src/renderer/shell/App.vue
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/renderer/**/*.{ts,tsx,vue} : Vue 3 app code in `src/renderer/src` should be organized into `components/`, `stores/`, `views/`, `i18n/`, `lib/` directories with shell UI in `src/renderer/shell/`

Applied to files:

  • src/renderer/shell/App.vue
📚 Learning: 2025-11-25T05:27:49.615Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-router-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:49.615Z
Learning: Applies to src/renderer/src/router/**/*.{ts,tsx,js,jsx} : Implement proper navigation guards for authentication and authorization in Vue Router

Applied to files:

  • src/renderer/shell/App.vue
  • src/renderer/src/lib/storeInitializer.ts
📚 Learning: 2025-11-25T05:28:04.454Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.454Z
Learning: Applies to src/renderer/(pages|components)/**/*.vue : Implement lazy loading for routes and components

Applied to files:

  • src/renderer/shell/App.vue
📚 Learning: 2025-11-25T05:28:04.454Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.454Z
Learning: Applies to src/renderer/**/*.vue : Use PascalCase for component names (e.g., AuthWizard.vue)

Applied to files:

  • src/renderer/shell/App.vue
📚 Learning: 2025-11-25T05:27:49.615Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-router-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:49.615Z
Learning: Applies to src/renderer/src/router/**/*.{ts,tsx,js,jsx} : Implement route-level code splitting for better performance in Vue Router

Applied to files:

  • src/renderer/shell/App.vue
📚 Learning: 2025-11-25T05:27:49.615Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-router-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:49.615Z
Learning: Applies to src/renderer/src/router/**/*.{ts,tsx,js,jsx} : Use dynamic routing for handling variable route segments in Vue Router

Applied to files:

  • src/renderer/shell/App.vue
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Use Pinia for frontend state management and Vue Router for SPA routing

Applied to files:

  • src/renderer/shell/App.vue
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/main/presenter/mcpPresenter/**/*.ts : Register new MCP tools in `mcpPresenter/index.ts` after implementing them in `inMemoryServers/`

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/settings/App.vue
  • src/renderer/src/lib/storeInitializer.ts
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to {src/main/presenter/**/*.ts,src/renderer/**/*.ts} : Implement proper inter-process communication (IPC) patterns using Electron's ipcRenderer and ipcMain APIs

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: 2025-11-25T05:28:20.513Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T05:28:20.513Z
Learning: Applies to src/main/**/*.ts : Electron main process code belongs in `src/main/` with presenters in `presenter/` (Window/Tab/Thread/Mcp/Config/LLMProvider) and `eventbus.ts` for app events

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: 2025-11-25T05:27:12.209Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-11-25T05:27:12.209Z
Learning: Implement separation of concerns where `src/main/presenter/llmProviderPresenter/index.ts` manages the Agent loop and conversation history, while Provider files handle LLM API interactions, Provider-specific request/response formatting, tool definition conversion, and native vs non-native tool call mechanisms

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: 2025-11-25T05:27:12.209Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/llm-agent-loop.mdc:0-0
Timestamp: 2025-11-25T05:27:12.209Z
Learning: Applies to src/main/presenter/llmProviderPresenter/index.ts : In `src/main/presenter/llmProviderPresenter/index.ts`, listen for standardized events yielded by `coreStream` and handle them accordingly: buffer text content (`currentContent`), handle `tool_call_start/chunk/end` events by collecting tool details and calling `presenter.mcpPresenter.callTool`, send frontend events via `eventBus` with tool call status, format tool results for the next LLM call, and set `needContinueConversation = true`

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/main/presenter/llmProviderPresenter/providers/*.ts : Convert MCP tools to provider-specific formats and normalize streaming responses to standard events in each provider implementation

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
  • src/renderer/settings/App.vue
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Applies to src/main/**/*.ts : Use Electron's built-in APIs for file system and native dialogs instead of Node.js or custom implementations

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: 2025-11-25T05:26:11.312Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T05:26:11.312Z
Learning: Applies to src/main/**/*.ts : Use EventBus from `src/main/eventbus.ts` for main-to-renderer communication, broadcasting events via `mainWindow.webContents.send()`

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: 2025-11-25T05:27:26.656Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-11-25T05:27:26.656Z
Learning: Applies to src/main/**/*.{js,ts} : Main process code for Electron should be placed in `src/main`

Applied to files:

  • src/main/presenter/deeplinkPresenter/index.ts
📚 Learning: 2025-11-25T05:28:04.454Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-shadcn.mdc:0-0
Timestamp: 2025-11-25T05:28:04.454Z
Learning: Applies to src/renderer/**/stores/*.ts : Use Pinia for state management

Applied to files:

  • src/renderer/settings/App.vue
📚 Learning: 2025-11-25T05:26:24.867Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/electron-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:26:24.867Z
Learning: Implement proper error handling and logging for debugging in Electron applications

Applied to files:

  • src/renderer/settings/App.vue
📚 Learning: 2025-11-25T05:27:49.615Z
Learnt from: CR
Repo: ThinkInAIXYZ/deepchat PR: 0
File: .cursor/rules/vue-router-best-practices.mdc:0-0
Timestamp: 2025-11-25T05:27:49.615Z
Learning: Applies to src/renderer/src/router/**/*.{vue,ts,tsx,js,jsx} : Use named routes for easier navigation and maintenance in Vue Router

Applied to files:

  • src/renderer/src/lib/storeInitializer.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 (8)
src/shared/types/presenters/legacy.presenters.d.ts (1)

192-192: LGTM!

The new createSettingsWindow method signature is consistent with the existing window creation patterns in the interface (e.g., createShellWindow also returns Promise<number | null>).

src/main/index.ts (1)

23-77: Approve the defensive deeplink capture logic.

The multiple capture points (command line, environment variables, open-url, and second-instance events) with immediate process.env.STARTUP_DEEPLINK assignment provide robust cold-start deeplink handling across platforms. The redundancy is acceptable as defensive coding for race conditions.

src/main/presenter/deeplinkPresenter/index.ts (1)

149-180: Approve startup deeplink detection with redundant fallbacks.

The checkStartupDeepLink method appropriately checks both the environment variable (set by main process) and command line arguments as a fallback. The cleanup of process.env.STARTUP_DEEPLINK (line 161) prevents duplicate processing.

src/renderer/shell/App.vue (1)

22-65: Good error handling implementation.

The try-catch block properly handles errors, clears corrupted localStorage data, and logs meaningful error messages. The immediate removal of pending-mcp-install after reading (line 29) prevents reprocessing on subsequent mounts.

src/renderer/settings/App.vue (4)

76-77: LGTM!

Imports for MCP store and deeplink handler follow existing patterns and use appropriate path aliases.


94-97: Early listener registration is acceptable for IPC race prevention.

Calling setupMcpDeeplink() synchronously at module scope (before onMounted) is unconventional but justified to catch IPC events that may arrive before the component is fully mounted. Ensure the handler's internals are safe to execute before Vue's reactivity is fully initialized for this component.


325-333: LGTM!

Proper cleanup of the MCP deeplink handler in onBeforeUnmount matches the setup pattern and prevents memory leaks.


302-310: Based on my verification, I can now provide the rewritten review comment:

The current implementation correctly triggers MCP installation via store reactivity, not route navigation.

When setMcpInstallCache() is called before router.replace(), the watch in McpServers.vue (with immediate: true) detects the store change and opens the dialog. Whether already on settings-mcp or navigating to it, the cache change triggers the watch callback. The router.replace() call serves to refresh the route state, not to initiate the dialog—this is already handled by the store mechanism. No modification needed.

@zerob13 zerob13 merged commit ebb5a98 into dev Nov 28, 2025
2 checks passed
@zerob13 zerob13 deleted the bugfix/deeplink-one-click branch December 13, 2025 06:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants