Skip to content

feat(desktop): add Kimi Code VS Code extension support#375

Merged
MocA-Love merged 9 commits intomainfrom
feat/kimi-code-support-clean
Apr 23, 2026
Merged

feat(desktop): add Kimi Code VS Code extension support#375
MocA-Love merged 9 commits intomainfrom
feat/kimi-code-support-clean

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

@MocA-Love MocA-Love commented Apr 21, 2026

Summary

Kimi Code (moonshot-ai.kimi-code) VS Code 拡張を Superset Desktop で利用できるようにする。

拡張登録・UI

  • KNOWN_EXTENSIONS / SUPPORTED_EXTENSIONSmoonshot-ai.kimi-code / kimi.webview を追加
  • RightSidebarTab.Kimi を追加し、サイドバーと VscodeExtensionButtons に Kimi タブを表示
  • Settings 検索キーワードに kimi を追加
  • アイコン割り当て: Codex → SiOpenai、Kimi → LuSparkles に整理

VS Code Shim の補強

  • ExtensionContextstorageUri / globalStorageUri / logUri を追加
  • workspace.fs.readDirectory を実装(シンボリックリンクの種別判定含む)
  • workspace.findFiles の glob マッチングを自前実装に刷新(brace expansion {a,b}、character class [...]** 再帰対応)
  • workspace.createFileSystemWatcherfs.watch ベースの実際の監視に更新(exclude glob によるディレクトリスキップ付き)
  • TextEditor.edit() を実装(インメモリ上で行挿入 → 同期書き戻し)
  • TextDocument / TextEditorisDirty / isUntitled を追加
  • workspace.openTextDocument が非 file scheme URI を textDocumentContentProvider 経由で解決するよう修正
  • window.showQuickPickQuickPickItemKind.Separator (kind: -1) をフィルタするよう対応
  • vscode.diff コマンドで非 file scheme の左辺 URI を content provider で解決して baseline content を renderer に渡すよう変更
  • vscode.open で file scheme の場合に fireOpenFile を呼ぶよう修正
  • vscode.openFolder / kimi.webview.focus を no-op でハンドル

Inline Baseline Diff パイプライン

  • fireOpenDiff / IPC / tRPC subscription に leftContent フィールドを追加
  • useVscodeDiffSync → tabs store → FileViewerPaneuseFileContent まで inlineOriginalContent を伝播
  • inlineOriginalContentKey でドキュメント同一性を管理し、Git 由来でない差分も diff viewer で表示可能に

テスト・リファクタリング

  • Glob ユーティリティ(globToRegExp, expandBracePatterns, matchesAnyGlob 等)を glob-utils.ts に切り出し、23 件のユニットテストを追加
  • showQuickPick のマジックナンバー -1QUICK_PICK_ITEM_KIND_SEPARATOR 定数に置き換え

Validation

  • glob-utils.test.ts: 23 tests pass
  • git diff --check clean

Notes

Summary by CodeRabbit

リリースノート

  • New Features

    • 新たに Kimi Code 拡張機能に対応し、サイドバーから統合されました
    • Diff ビューで左側コンテンツの送信に対応
    • テキストエディタの編集機能と URI ベースのストレージプロパティを追加
    • ファイル検索およびディレクトリ監視の機能を強化
  • Tests

    • グロブユーティリティ機能の包括的なテストスイートを追加
  • Refactor

    • ファイル監視とワークスペース検索ロジックをグロブパターンマッチングに移行

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 21, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Kimi Code 拡張機能のサポートを追加し、VS Code の diff 表示で leftContent オプションを追加。glob パターン用のユーティリティモジュール、URI プロパティ、テキストドキュメント解決機能を vscode-shim に実装。左側ペイン内容をインラインで提供する diff ビューアー機能を整備。

Changes

Cohort / File(s) Summary
VS Code 拡張機能ホワイトリスト
apps/desktop/src/lib/trpc/routers/vscode-extensions/index.ts, apps/desktop/src/main/extension-host-worker/index.ts
Kimi Code(moonshot-ai.kimi-code)をホワイトリストに追加。拡張機能 ID リストと Marketplace URL、webview viewType を含む。
diff-open IPC メッセージ拡張
apps/desktop/src/main/lib/vscode-shim/ipc-types.ts, apps/desktop/src/main/extension-host-worker/index.ts
open-diff メッセージに optional な leftContent フィールドを追加して、左側のテキストをインラインで転送できるように拡張。
Glob ユーティリティモジュール
apps/desktop/src/main/lib/vscode-shim/api/glob-utils.ts, apps/desktop/src/main/lib/vscode-shim/api/glob-utils.test.ts
パターン正規化、glob→正規表現変換、ブレース展開、ディレクトリ走査の可能性判定などを提供する新しいユーティリティ群。161 行のテストを含む。
VS Code Shim コマンド・API 拡張
apps/desktop/src/main/lib/vscode-shim/api/commands.ts, apps/desktop/src/main/lib/vscode-shim/api/window.ts, apps/desktop/src/main/lib/vscode-shim/api/extension-context.ts
fireOpenFile、URI 正規化、非ファイルスキーム左ベースライン解決、storageUri/globalStorageUri/logUri プロパティを追加。
Workspace ファイル操作強化
apps/desktop/src/main/lib/vscode-shim/api/workspace.ts
resolveTextDocumentContentsetActiveWorkspaceTextDocument、glob ベースのファイル検索・監視、readDirectory メソッドを実装。
VS Code API 列挙型追加
apps/desktop/src/main/lib/vscode-shim/vscode-api.ts
QuickPickItemKind 列挙型(DefaultSeparator)を追加して VS Code API シムに登録。
設定・UI: Kimi Code 統合
apps/desktop/src/renderer/routes/_authenticated/settings/utils/settings-search/settings-search.ts, apps/desktop/src/renderer/routes/_authenticated/settings/vscode-extensions/components/VscodeExtensionsSettings/VscodeExtensionsSettings.tsx, apps/desktop/src/renderer/screens/main/components/VscodeExtensionButtons/VscodeExtensionButtons.tsx
設定検索で Kimi キーワード追加、拡張機能アイコンマッピングを更新(OpenAI アイコン、Kimi アイコン)、サイドバーボタンを追加。
右サイドバー Kimi タブ
apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/index.tsx, apps/desktop/src/renderer/stores/sidebar-state.ts
RightSidebarTab.Kimi 列挙型メンバー追加、デフォルトタブ順序に組み込み、サイドバー UI で条件付きレンダリング。
インラインオリジナルコンテンツ伝播
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/FileViewerPane.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/FileViewerPane/hooks/useFileContent/useFileContent.ts, apps/desktop/src/renderer/screens/main/components/WorkspaceView/hooks/useVscodeDiffSync.ts
inlineOriginalContentinlineOriginalContentKey をビューアコンポーネント・フック経由で伝播、Git フェッチをバイパス。
エディタ状態・タブ管理
apps/desktop/src/renderer/stores/editor-state/editorCoordinator.ts, apps/desktop/src/renderer/stores/editor-state/types.ts, apps/desktop/src/renderer/stores/tabs/store.ts, apps/desktop/src/renderer/stores/tabs/types.ts, apps/desktop/src/renderer/stores/tabs/utils.ts, apps/desktop/src/shared/tabs-types.ts
inlineOriginalContentinlineOriginalContentKey をペイン状態・ドキュメント ID・タブマッチング・オプション型に追加して一貫性確保。

Sequence Diagram(s)

sequenceDiagram
    participant Ext as VS Code Extension<br/>(Kimi Code)
    participant Worker as Extension Host<br/>Worker
    participant Main as Main Process<br/>vscode-shim
    participant Renderer as Renderer<br/>(File Viewer)
    participant FS as File System

    Ext->>Worker: executeCommand('vscode.diff',<br/>leftUri, rightUri, leftContent)
    Worker->>Main: IPC: open-diff<br/>(leftUri, rightUri,<br/>leftContent)
    Main->>Main: Resolve leftUri to<br/>file content or use<br/>leftContent if provided
    alt leftContent provided
        Main->>Main: Use inline leftContent
    else Non-file scheme
        Main->>FS: Fetch content from<br/>provider/resolver
        FS-->>Main: content
    end
    Main->>Renderer: fireOpenDiff with<br/>inlineOriginalContent
    Renderer->>Renderer: Store inlineOriginalContent<br/>& inlineOriginalContentKey
    Renderer->>Renderer: Skip Git original fetch
    Renderer->>Renderer: Use inline content<br/>as diff baseline
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 Kimi Code ちゃん、おいでよ
左のコンテンツ、スッと渡して
diff はスムーズ、フローもスッキリ
Glob でファイル探索、サクサクと
拡張たちの夢、一つ増えた ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed PR タイトルは Kimi Code VS Code 拡張のサポート追加という主要な変更を明確かつ簡潔に説明しており、すべての変更内容と整合しています。
Description check ✅ Passed PR の説明は詳細で構造化されており、テンプレートの主要セクションをカバーしていますが、テンプレートの形式に完全には従っていません。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/kimi-code-support-clean

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.

@MocA-Love
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4722b7f032

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/lib/vscode-shim/api/workspace.ts Outdated
Comment thread apps/desktop/src/main/lib/vscode-shim/api/workspace.ts Outdated
@MocA-Love
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ca63fec841

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/lib/vscode-shim/api/workspace.ts
Comment thread apps/desktop/src/main/lib/vscode-shim/api/commands.ts Outdated
@MocA-Love
Copy link
Copy Markdown
Owner Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9f8abf40da

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/lib/vscode-shim/api/workspace.ts Outdated
Comment thread apps/desktop/src/main/lib/vscode-shim/api/workspace.ts Outdated
MocA-Love and others added 2 commits April 22, 2026 02:49
- Extract 250-line glob utility (globToRegExp, expandBracePatterns,
  matchesAnyGlob, etc.) from workspace.ts into glob-utils.ts so it can
  be tested independently
- Add 23 unit tests for glob matching, brace expansion, and directory
  prefix optimization
- Replace magic number `-1` in showQuickPick separator filter with a
  named constant `QUICK_PICK_ITEM_KIND_SEPARATOR`

Committed-by: GLM-5 via Crush <crush@charm.land>
@MocA-Love MocA-Love marked this pull request as ready for review April 23, 2026 04:44
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 61f51326e9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/lib/vscode-shim/api/glob-utils.ts Outdated
The extraction to glob-utils.ts accidentally replaced `path.sep` with
a literal `"/"`, making the function a no-op on Windows where
backslashes would never be converted. Add a platform-aware test.

Committed-by: GLM-5 via Crush <crush@charm.land>
Committed-by: GLM-5 via Crush <crush@charm.land>
Capture `workspaceFolderPath` as `rootPath` const before entering the
closure so TypeScript narrows the type to `string`.

Committed-by: GLM-5 via Crush <crush@charm.land>
@MocA-Love MocA-Love merged commit 017b3d0 into main Apr 23, 2026
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant