Skip to content

fix: detect Kimi Code CLI under ~/.kimi-code#274

Open
zephyr110 wants to merge 3 commits into
wxtsky:mainfrom
zephyr110:fix/kimi-code-cli-detect-path
Open

fix: detect Kimi Code CLI under ~/.kimi-code#274
zephyr110 wants to merge 3 commits into
wxtsky:mainfrom
zephyr110:fix/kimi-code-cli-detect-path

Conversation

@zephyr110

@zephyr110 zephyr110 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Detection: Kimi Code CLI now lives under ~/.kimi-code (old path was ~/.kimi). Settings → Hooks correctly detects current installs again; legacy ~/.kimi still works.
  • Hooks: Install / status / uninstall cover both old and new config.toml.
  • Sessions: Discover running kimi-code sessions via the new layout (session_index.jsonl + transcript), and keep the old kimi-cli path as fallback.
  • Chat text: Parse Kimi's content-part array prompt on UserPromptSubmit, and read kimi-code wire.jsonl (turn.prompt / content.part) so the notch shows dialogue (legacy TurnBegin format still works).
  • Compatibility: Treat kimi-code (and similar names) as the same source as kimi.

Note: After changing hooks config, restart the kimi session for hooks to take effect (official behavior; a long-lived session will not pick up new hooks).

Refs: Kimi Code CLI hooks, migration guide.

中文说明

  • 检测: Kimi Code CLI 数据目录已改为 ~/.kimi-code(旧版是 ~/.kimi)。Settings → Hooks 能正确识别新安装;旧路径仍兼容。
  • Hooks: 安装 / 查看状态 / 卸载会同时处理新旧两套 config.toml
  • 会话: 能发现正在运行的 kimi-code 会话(新目录结构),旧版 kimi-cli 仍按原逻辑发现。
  • 对话内容: 正确解析 kimi-code 的数组格式 prompt,以及新版 wire.jsonl,岛上能显示用户/助手消息。
  • 兼容: kimi-code 等名称统一当作 kimi

注意: 修改 hooks 配置后需要重开 kimi 会话才会生效(官方行为;长驻旧会话不会自动加载新 hooks)。

参考:Kimi Code CLI hooks迁移指南

Test Plan

  • ConfigInstallerTests (kimi home / install / uninstall) — 0 failures
  • KimiHookPayloadTests — content-part array prompt → chat text; plain string still works
  • KimiTranscriptTests — kimi-code wire + legacy TurnBegin
  • Local machine with ~/.kimi-code present and ~/.kimi absent: detection / preferred home → ~/.kimi-code
  • Manual: restart kimi after enabling hooks; send a prompt → mascot leaves idle and shows user text
  • Manual (legacy): machine with only ~/.kimi still detects / installs / discovers as before

Prefer the official kimi-code home over legacy ~/.kimi so Settings
hooks detection, install/uninstall, and session discovery work with
current Kimi Code CLI installs.
Allow index-based discovery without requiring sessions/ dirs, and load
recent messages from agents/main/wire.jsonl for kimi-code sessions.
Parse content-part array prompts on UserPromptSubmit, and read the
kimi-code wire protocol (turn.prompt / content.part) while keeping
legacy kimi-cli TurnBegin transcripts working.
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