From 6231249e2756d0900f80e53721b8ddf5875dc074 Mon Sep 17 00:00:00 2001 From: cl Date: Fri, 27 Feb 2026 18:16:24 +0800 Subject: [PATCH 1/3] [fix] kimi_cli failed to find CHANGELOG.md Pyinstaller packed binary will extract itself and then run. However, it does not extract the CHANGELOG.md at the first place, thus lead to instant failure on starting the program. This patch makes reading CHANGELOG.md file lazy, then the file will only be read once when running instead of starting. Signed-off-by: cl --- src/kimi_cli/ui/shell/slash.py | 4 ++-- src/kimi_cli/utils/changelog.py | 20 ++++++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/kimi_cli/ui/shell/slash.py b/src/kimi_cli/ui/shell/slash.py index b644a8997..75809983a 100644 --- a/src/kimi_cli/ui/shell/slash.py +++ b/src/kimi_cli/ui/shell/slash.py @@ -12,7 +12,7 @@ from kimi_cli.session import Session from kimi_cli.soul.kimisoul import KimiSoul from kimi_cli.ui.shell.console import console -from kimi_cli.utils.changelog import CHANGELOG +from kimi_cli.utils.changelog import get_changelog from kimi_cli.utils.datetime import format_relative_time from kimi_cli.utils.slashcmd import SlashCommand, SlashCommandRegistry @@ -366,7 +366,7 @@ def changelog(app: Shell, args: str): from kimi_cli.utils.rich.columns import BulletColumns renderables: list[RenderableType] = [] - for ver, entry in CHANGELOG.items(): + for ver, entry in get_changelog().items(): title = f"[bold]{ver}[/bold]" if entry.description: title += f": {entry.description}" diff --git a/src/kimi_cli/utils/changelog.py b/src/kimi_cli/utils/changelog.py index 053e7b1cb..d1d8d1670 100644 --- a/src/kimi_cli/utils/changelog.py +++ b/src/kimi_cli/utils/changelog.py @@ -39,7 +39,8 @@ def commit(): norm_entries = [ line.strip()[2:].strip() for line in bullet_lines if line.strip().startswith("- ") ] - result[current_ver] = ReleaseEntry(description=description, entries=norm_entries) + result[current_ver] = ReleaseEntry( + description=description, entries=norm_entries) for raw in lines: line = raw.rstrip() @@ -103,6 +104,17 @@ def format_release_notes(changelog: dict[str, ReleaseEntry], include_lib_changes return "\n".join(parts).strip() -CHANGELOG = parse_changelog( - (Path(__file__).parent.parent / "CHANGELOG.md").read_text(encoding="utf-8") -) +_cached_changelog: dict[str, ReleaseEntry] | None = None + + +def get_changelog() -> dict[str, ReleaseEntry]: + """Lazily load and parse the changelog on first access.""" + global _cached_changelog + if _cached_changelog is None: + path = Path(__file__).parent.parent / "CHANGELOG.md" + try: + _cached_changelog = parse_changelog( + path.read_text(encoding="utf-8")) + except FileNotFoundError: + _cached_changelog = {} + return _cached_changelog From 2dc10ff5002033c6c1f4f2cb07e79c9a6a052e04 Mon Sep 17 00:00:00 2001 From: cl Date: Fri, 27 Feb 2026 18:38:01 +0800 Subject: [PATCH 2/3] [chore] update documentations Signed-off-by: cl --- CHANGELOG.md | 18 +++++++++--------- docs/en/release-notes/changelog.md | 18 +++++++++--------- docs/zh/release-notes/changelog.md | 1 + 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43ec2780f..24329d331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ Only write entries that are worth mentioning to users. ## Unreleased +- Core: Fix `CHANGELOG.md` not found error in PyInstaller binary by deferring file read until first access, preventing startup failure when the bundled executable cannot locate the changelog file - Shell: Add `Ctrl-O` keyboard shortcut to open the current input in an external editor (`$VISUAL`/`$EDITOR`), with auto-detection fallback to VS Code, Vim, Vi, or Nano - Shell: Add `/editor` slash command to configure and switch the default external editor, with interactive selection and persistent config storage - Shell: Add `/new` slash command to create and switch to a new session without restarting Kimi Code CLI @@ -102,7 +103,7 @@ Only write entries that are worth mentioning to users. - Rust: Move the Rust implementation to `MoonshotAI/kimi-agent-rs` with independent releases; binary renamed to `kimi-agent` - Core: Preserve session id when reloading configuration so the session resumes correctly - Shell: Fix session replay showing messages that were cleared by `/clear` or `/reset` -- Web: Fix approval request states not updating when session is interrupted or cancelled +- Web: Fix approval-request states not updating when session is interrupted or cancelled - Web: Fix IME composition issue when selecting slash commands - Web: Fix UI not clearing messages after `/clear`, `/reset`, or `/compact` commands @@ -120,7 +121,7 @@ Only write entries that are worth mentioning to users. - Web: Fix authentication token persistence by switching from sessionStorage to localStorage with 24-hour expiry - Web: Add server-side pagination for session list with virtualized scrolling for better performance - Web: Improve session and work directories loading with smarter caching and invalidation -- Web: Fix WebSocket errors during history replay by checking connection state before sending +- Web: Fix WebSocket disconnect when creating new sessions - Web: Git diff status bar now shows untracked files (new files not yet added to git) - Web: Restrict sensitive APIs only in public mode; update origin enforcement logic @@ -170,7 +171,7 @@ Only write entries that are worth mentioning to users. - Shell: Add `/login` and `/logout` slash commands for login and logout - CLI: Add `kimi login` and `kimi logout` subcommands -- Core: Fix subagent approval request handling +- Core: Fix subagent approval-request handling ## 0.88 (2026-01-26) @@ -236,7 +237,7 @@ Only write entries that are worth mentioning to users. - Skills: Add project-level skills support, discovered from `.agents/skills/` (or `.kimi/skills/`, `.claude/skills/`) - Skills: Unified skills discovery with layered loading (builtin → user → project); user-level skills now prefer `~/.config/agents/skills/` - Shell: Support fuzzy matching for slash command autocomplete -- Shell: Enhanced approval request preview with shell command and diff content display, use `Ctrl-E` to expand full content +- Shell: Enhanced approval-request preview with shell command and diff content display, use `Ctrl-E` to expand full content - Wire: Add `ShellDisplayBlock` type for shell command display in approval requests - Shell: Reorder `/help` to show keyboard shortcuts before slash commands - Wire: Return proper JSON-RPC 2.0 error responses for invalid requests @@ -261,7 +262,7 @@ Only write entries that are worth mentioning to users. - Tool: Make `ReadFile` tool description reflect model capabilities for image/video support - Tool: Fix TypeScript files (`.ts`, `.tsx`, `.mts`, `.cts`) being misidentified as video files -- Shell: Allow slash commands (`/help`, `/exit`, `/version`, `/changelog`, `/feedback`) in shell mode +- Shell: Allow slash commands (`/help`, `/exit`, `/version`, `/changelog`, `/mcp`) in shell mode - Shell: Improve `/help` with fullscreen pager, showing slash commands, skills, and keyboard shortcuts - Shell: Improve `/changelog` and `/mcp` display with consistent bullet-style formatting - Shell: Show current model name in the bottom status bar @@ -346,7 +347,6 @@ Only write entries that are worth mentioning to users. - Lib: Add `KimiToolset.load_mcp_tools` method to load MCP tools - Lib: Move `MCPTool` from `kimi_cli.tools.mcp` to `kimi_cli.soul.toolset` - Lib: Add `InvalidToolError`, `MCPConfigError` and `MCPRuntimeError` -- Lib: Make the detailed Kimi Code CLI exception classes extend `ValueError` or `RuntimeError` - Lib: Allow passing validated `list[fastmcp.mcp_config.MCPConfig]` as `mcp_configs` for `KimiCLI.create` and `load_agent` - Lib: Fix exception raising for `KimiCLI.create`, `load_agent`, `KimiToolset.load_tools` and `KimiToolset.load_mcp_tools` - LLM: Add provider type `vertexai` to support Vertex AI @@ -437,7 +437,7 @@ Only write entries that are worth mentioning to users. ## 0.57 (2025-11-20) - LLM: Fix Google GenAI provider when thinking toggle is not on -- UI: Improve approval request wordings +- UI: Improve approval-request wordings - Tool: Remove `PatchFile` tool - Tool: Rename `Bash`/`CMD` tool to `Shell` tool - Tool: Move `Task` tool to `kimi_cli.tools.multiagent` module @@ -632,7 +632,7 @@ Only write entries that are worth mentioning to users. - Add `/debug` meta command to debug the context - Add auto context compaction -- Add approval request mechanism +- Add approval-request mechanism - Add `--yolo` option to automatically approve all actions - Render markdown content for better readability @@ -840,7 +840,7 @@ Only write entries that are worth mentioning to users. - Session history file can be specified via `_history_file` parameter when creating a new session -## 0.15.0 (2025-09-26) +## 0.15.0 (2025-09-29) - Improve tool robustness diff --git a/docs/en/release-notes/changelog.md b/docs/en/release-notes/changelog.md index f9189670c..2bcb6df93 100644 --- a/docs/en/release-notes/changelog.md +++ b/docs/en/release-notes/changelog.md @@ -4,6 +4,7 @@ This page documents the changes in each Kimi Code CLI release. ## Unreleased +- Core: Fix `CHANGELOG.md` not found error in PyInstaller binary by deferring file read until first access, preventing startup failure when the bundled executable cannot locate the changelog file - Shell: Add `Ctrl-O` keyboard shortcut to open the current input in an external editor (`$VISUAL`/`$EDITOR`), with auto-detection fallback to VS Code, Vim, Vi, or Nano - Shell: Add `/editor` slash command to configure and switch the default external editor, with interactive selection and persistent config storage - Shell: Add `/new` slash command to create and switch to a new session without restarting Kimi Code CLI @@ -95,7 +96,7 @@ This page documents the changes in each Kimi Code CLI release. - Rust: Move the Rust implementation to `MoonshotAI/kimi-agent-rs` with independent releases; binary renamed to `kimi-agent` - Core: Preserve session id when reloading configuration so the session resumes correctly - Shell: Fix session replay showing messages that were cleared by `/clear` or `/reset` -- Web: Fix approval request states not updating when session is interrupted or cancelled +- Web: Fix approval-request states not updating when session is interrupted or cancelled - Web: Fix IME composition issue when selecting slash commands - Web: Fix UI not clearing messages after `/clear`, `/reset`, or `/compact` commands @@ -113,7 +114,7 @@ This page documents the changes in each Kimi Code CLI release. - Web: Fix authentication token persistence by switching from sessionStorage to localStorage with 24-hour expiry - Web: Add server-side pagination for session list with virtualized scrolling for better performance - Web: Improve session and work directories loading with smarter caching and invalidation -- Web: Fix WebSocket errors during history replay by checking connection state before sending +- Web: Fix WebSocket disconnect when creating new sessions - Web: Git diff status bar now shows untracked files (new files not yet added to git) - Web: Restrict sensitive APIs only in public mode; update origin enforcement logic @@ -163,7 +164,7 @@ This page documents the changes in each Kimi Code CLI release. - Shell: Add `/login` and `/logout` slash commands for login and logout - CLI: Add `kimi login` and `kimi logout` subcommands -- Core: Fix subagent approval request handling +- Core: Fix subagent approval-request handling ## 0.88 (2026-01-26) @@ -229,7 +230,7 @@ This page documents the changes in each Kimi Code CLI release. - Skills: Add project-level skills support, discovered from `.agents/skills/` (or `.kimi/skills/`, `.claude/skills/`) - Skills: Unified skills discovery with layered loading (builtin → user → project); user-level skills now prefer `~/.config/agents/skills/` - Shell: Support fuzzy matching for slash command autocomplete -- Shell: Enhanced approval request preview with shell command and diff content display, use `Ctrl-E` to expand full content +- Shell: Enhanced approval-request preview with shell command and diff content display, use `Ctrl-E` to expand full content - Wire: Add `ShellDisplayBlock` type for shell command display in approval requests - Shell: Reorder `/help` to show keyboard shortcuts before slash commands - Wire: Return proper JSON-RPC 2.0 error responses for invalid requests @@ -254,7 +255,7 @@ This page documents the changes in each Kimi Code CLI release. - Tool: Make `ReadFile` tool description reflect model capabilities for image/video support - Tool: Fix TypeScript files (`.ts`, `.tsx`, `.mts`, `.cts`) being misidentified as video files -- Shell: Allow slash commands (`/help`, `/exit`, `/version`, `/changelog`, `/feedback`) in shell mode +- Shell: Allow slash commands (`/help`, `/exit`, `/version`, `/changelog`, `/mcp`) in shell mode - Shell: Improve `/help` with fullscreen pager, showing slash commands, skills, and keyboard shortcuts - Shell: Improve `/changelog` and `/mcp` display with consistent bullet-style formatting - Shell: Show current model name in the bottom status bar @@ -339,7 +340,6 @@ This page documents the changes in each Kimi Code CLI release. - Lib: Add `KimiToolset.load_mcp_tools` method to load MCP tools - Lib: Move `MCPTool` from `kimi_cli.tools.mcp` to `kimi_cli.soul.toolset` - Lib: Add `InvalidToolError`, `MCPConfigError` and `MCPRuntimeError` -- Lib: Make the detailed Kimi Code CLI exception classes extend `ValueError` or `RuntimeError` - Lib: Allow passing validated `list[fastmcp.mcp_config.MCPConfig]` as `mcp_configs` for `KimiCLI.create` and `load_agent` - Lib: Fix exception raising for `KimiCLI.create`, `load_agent`, `KimiToolset.load_tools` and `KimiToolset.load_mcp_tools` - LLM: Add provider type `vertexai` to support Vertex AI @@ -430,7 +430,7 @@ This page documents the changes in each Kimi Code CLI release. ## 0.57 (2025-11-20) - LLM: Fix Google GenAI provider when thinking toggle is not on -- UI: Improve approval request wordings +- UI: Improve approval-request wordings - Tool: Remove `PatchFile` tool - Tool: Rename `Bash`/`CMD` tool to `Shell` tool - Tool: Move `Task` tool to `kimi_cli.tools.multiagent` module @@ -581,7 +581,7 @@ This page documents the changes in each Kimi Code CLI release. - Add `/debug` meta command to debug the context - Add auto context compaction -- Add approval request mechanism +- Add approval-request mechanism - Add `--yolo` option to automatically approve all actions - Render markdown content for better readability @@ -723,7 +723,7 @@ This page documents the changes in each Kimi Code CLI release. - Session history file can be specified via `_history_file` parameter when creating a new session -## 0.15.0 (2025-09-26) +## 0.15.0 (2025-09-29) - Improve tool robustness diff --git a/docs/zh/release-notes/changelog.md b/docs/zh/release-notes/changelog.md index 36baff5be..24be44c45 100644 --- a/docs/zh/release-notes/changelog.md +++ b/docs/zh/release-notes/changelog.md @@ -4,6 +4,7 @@ ## 未发布 +- Core:修复 PyInstaller 打包的二进制文件中 `CHANGELOG.md` 找不到的错误,通过将文件读取延迟到首次访问时执行,防止打包的可执行文件因找不到 changelog 文件而导致启动失败 - Shell:新增 `Ctrl-O` 快捷键,在外部编辑器中编辑当前输入内容(`$VISUAL`/`$EDITOR`),支持自动检测 VS Code、Vim、Vi 或 Nano - Shell:新增 `/editor` 斜杠命令,可交互式配置和切换默认外部编辑器,设置持久保存到配置文件 - Shell:新增 `/new` 斜杠命令,无需重启 Kimi Code CLI 即可创建并切换到新会话 From a2003241d5a98dd6793906bbdee2f44a6e78a661 Mon Sep 17 00:00:00 2001 From: ClSlaid Date: Mon, 9 Mar 2026 14:40:31 +0800 Subject: [PATCH 3/3] Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: ClSlaid --- src/kimi_cli/utils/changelog.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/kimi_cli/utils/changelog.py b/src/kimi_cli/utils/changelog.py index d1d8d1670..2d3f0bfa0 100644 --- a/src/kimi_cli/utils/changelog.py +++ b/src/kimi_cli/utils/changelog.py @@ -39,8 +39,7 @@ def commit(): norm_entries = [ line.strip()[2:].strip() for line in bullet_lines if line.strip().startswith("- ") ] - result[current_ver] = ReleaseEntry( - description=description, entries=norm_entries) + result[current_ver] = ReleaseEntry(description=description, entries=norm_entries) for raw in lines: line = raw.rstrip()