feat(integration): update Kimi integration for Kimi Code CLI#2979
feat(integration): update Kimi integration for Kimi Code CLI#2979meymchen wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the built-in kimi integration to match Moonshot AI’s newer Kimi Code CLI project layout, including new install locations, legacy migration behavior, and devcontainer installation instructions.
Changes:
- Move Kimi skills install path from
.kimi/skills/to.kimi-code/skills/and switch the context file fromKIMI.mdtoAGENTS.md. - Expand
--migrate-legacyto migrate old skill installs and migrate user-authored content fromKIMI.md→AGENTS.md. - Update docs, changelog, devcontainer installer, and tests to reflect the new Kimi Code CLI integration behavior.
Show a summary per file
| File | Description |
|---|---|
src/specify_cli/integrations/kimi/__init__.py |
Updates Kimi integration paths, adds migration + legacy cleanup logic, and changes multi-install safety. |
tests/integrations/test_integration_kimi.py |
Updates Kimi integration expectations and adds tests for legacy skills dir + context migration and teardown cleanup. |
tests/integrations/test_integration_subcommand.py |
Adjusts integration switch test expectations for Kimi’s new skills directory. |
tests/test_presets.py |
Updates preset-related tests to use the new Kimi skills directory location. |
tests/test_extensions.py |
Updates parametrized “skill agents” test cases to use .kimi-code/skills. |
tests/test_agent_config_consistency.py |
Ensures runtime and registrar configs match the new .kimi-code/ folder layout. |
docs/reference/integrations.md |
Documents new Kimi paths and expanded --migrate-legacy behavior. |
CHANGELOG.md |
Adds a changelog entry describing the Kimi Code CLI integration update. |
.devcontainer/post-create.sh |
Switches Kimi installation from pipx install kimi-cli to npm install -g @moonshot-ai/kimi-code@latest. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 9/9 changed files
- Comments generated: 4
|
Please address Copilot feedback |
Update the Kimi integration to target the new Kimi Code CLI (MoonshotAI/kimi-code) layout: - Change skills directory from .kimi/skills/ to .kimi-code/skills/ - Change context file from KIMI.md to AGENTS.md - Extend --migrate-legacy to move old .kimi/skills/ installs and migrate KIMI.md user content to AGENTS.md - Clean up leftover legacy .kimi/skills/ directories on teardown - Update devcontainer installer to @moonshot-ai/kimi-code - Update docs and tests Relates to github#1532
- Override build_command_invocation to emit /skill:speckit-<stem> so dispatched commands match Kimi Code CLI's native slash syntax. - Skip symlinked .kimi/skills directories during legacy migration and teardown to avoid operating on files outside the project. - Remove kimi from the multi-install-safe integrations table. - Add tests for command invocation and symlink safety.
65d3f30 to
a5dc347
Compare
|
@mnriem All Copilot feedback has been addressed in the latest commit ( Changes made:
I also resolved the Copilot review threads. Let me know if anything else needs adjustment. |
|
Please address Copilot feedback |
…-cli-compatibility
…tion Use IntegrationBase._resolve_context_markers() when migrating legacy KIMI.md content so that projects with customized context_markers in .specify/extensions/agent-context/agent-context-config.yml have the managed section stripped with the correct markers instead of the hard-coded defaults. Adds a test verifying custom markers are respected during --migrate-legacy.
|
Posted on behalf of @meymchen by Kimi Code CLI agent. Latest Copilot feedback has been addressed in commit
Per project convention, I am leaving the review conversations for the reviewer/PR author to resolve. |
| def _is_safe_legacy_dir(path: Path, project_root: Path) -> bool: | ||
| """Return ``True`` when *path* is a real directory safely inside *project_root*. | ||
|
|
||
| Legacy migration and cleanup ``shutil.move()`` and ``shutil.rmtree()`` | ||
| directories, so a symlinked ``.kimi``/``.kimi/skills`` (or one reached | ||
| through a symlinked parent) must never be followed: doing so could | ||
| relocate or delete content living outside the project tree. We reject | ||
| the path when it is itself a symlink, when it is not a directory, or | ||
| when resolving every symlink lands outside *project_root*. | ||
| """ | ||
| if path.is_symlink() or not path.is_dir(): | ||
| return False | ||
| try: | ||
| resolved = path.resolve() | ||
| root = project_root.resolve() | ||
| except OSError: | ||
| return False | ||
| return resolved == root or root in resolved.parents |
| target_path = project_root / "AGENTS.md" | ||
| if target_path.is_file(): | ||
| existing = target_path.read_text(encoding="utf-8-sig") | ||
| existing = existing.replace("\r\n", "\n").replace("\r", "\n") | ||
| if not existing.endswith("\n"): | ||
| existing += "\n" | ||
| new_content = existing + "\n" + user_content + "\n" | ||
| else: | ||
| new_content = user_content + "\n" | ||
|
|
||
| target_path.parent.mkdir(parents=True, exist_ok=True) | ||
| target_path.write_bytes(new_content.encode("utf-8")) |
Summary
Updates the built-in Kimi integration to align with the new Kimi Code CLI layout from Moonshot AI.
Relates to #1532.
Changes
.kimi/skills/to.kimi-code/skills/KIMI.mdtoAGENTS.md--migrate-legacynow also migrates:.kimi/skills/installs to.kimi-code/skills/speckit.xxx) to hyphenated (speckit-xxx)KIMI.mdtoAGENTS.mdteardown()removes leftover Speckit-generated.kimi/skills/speckit-*directoriesmulti_install_safeset toFalsebecause Kimi now sharesAGENTS.mdwith Codexpipx install kimi-clitonpm install -g @moonshot-ai/kimi-code@latestdocs/reference/integrations.md,CHANGELOG.md, and testsTesting
uv run pytest tests/integrations/test_integration_kimi.py— 43 passeduv run pytest tests/integrations/— 2218 passeduv run pytest tests/ -k kimi— 57 passedAI Assistance Disclosure
This change was developed with AI assistance for codebase exploration, implementation planning, and test generation. The final design decisions, code review, and verification were done by a human contributor.