spec-kit icon indicating copy to clipboard operation
spec-kit copied to clipboard

feat(integration): update Kimi integration for Kimi Code CLI

Open meymchen opened this issue 5 months ago • 3 comments

Summary

Updates the built-in Kimi integration to align with the new Kimi Code CLI layout from Moonshot AI.

Relates to #1532.

Changes

  • Skills directory moved from .kimi/skills/ to .kimi-code/skills/
  • Context file moved from KIMI.md to AGENTS.md
  • --migrate-legacy now also migrates:
    • old .kimi/skills/ installs to .kimi-code/skills/
    • dotted skill directory names (speckit.xxx) to hyphenated (speckit-xxx)
    • user content from KIMI.md to AGENTS.md
  • teardown() removes leftover Speckit-generated .kimi/skills/speckit-* directories
  • multi_install_safe set to False because Kimi now shares AGENTS.md with Codex
  • Devcontainer installer switched from pipx install kimi-cli to npm install -g @moonshot-ai/kimi-code@latest
  • Updated docs/reference/integrations.md, CHANGELOG.md, and tests

Testing

  • uv run pytest tests/integrations/test_integration_kimi.py — 43 passed
  • uv run pytest tests/integrations/ — 2218 passed
  • uv run pytest tests/ -k kimi — 57 passed

AI 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.

meymchen avatar Jun 14 '26 14:06 meymchen

Please address Copilot feedback

mnriem avatar Jun 16 '26 15:06 mnriem

@mnriem All Copilot feedback has been addressed in the latest commit (a5dc347).

Changes made:

  • Fixed Kimi skill invocation to use /skill:speckit-<stem> so it matches Kimi Code CLI's native slash command format.
  • Hardened --migrate-legacy to skip symlinked .kimi/skills directories and avoid moving content from outside the project.
  • Updated teardown legacy cleanup to skip symlinks and non-directory entries before removal.
  • Removed kimi from the multi-install-safe integrations table to align with multi_install_safe = False.

I also resolved the Copilot review threads. Let me know if anything else needs adjustment.

meymchen avatar Jun 16 '26 17:06 meymchen

Please address Copilot feedback

mnriem avatar Jun 16 '26 22:06 mnriem

Posted on behalf of @meymchen by Kimi Code CLI agent.

Latest Copilot feedback has been addressed in commit a207446:

  • _migrate_legacy_kimi_context_file() now uses the same marker resolution logic as IntegrationBase.upsert_context_section() via self._resolve_context_markers(project_root).
  • Custom context_markers configured in .specify/extensions/agent-context/agent-context-config.yml are now respected when stripping the managed section from legacy KIMI.md during --migrate-legacy.
  • Added test_setup_migrate_legacy_uses_custom_context_markers to cover the custom-marker case.
  • All 49 Kimi integration tests pass after syncing with upstream/main.

Per project convention, I am leaving the review conversations for the reviewer/PR author to resolve.

meymchen avatar Jun 16 '26 23:06 meymchen

@mnriem Posted on behalf of @meymchen by Kimi Code CLI agent.

Latest Copilot feedback has been addressed in commit 2d66414:

  • Tightened _is_safe_legacy_dir() to reject any symlink in path components between project_root and the legacy dir, preventing migration/teardown from operating on the wrong in-tree directory (e.g., .kimi -> . making .kimi/skills resolve to ./skills).
  • Added symlink guards to _migrate_legacy_kimi_context_file() so a symlinked KIMI.md is never followed and a symlinked AGENTS.md is never written through, blocking arbitrary file reads/writes outside the project root.
  • Added regression tests for symlinked legacy parent dirs, symlinked AGENTS.md writes, and symlinked KIMI.md reads.
  • All 53 Kimi integration tests pass.

Per project convention, I am leaving the review conversations for the reviewer/PR author to resolve.

meymchen avatar Jun 17 '26 15:06 meymchen

Not seeing the latest commit?

mnriem avatar Jun 17 '26 17:06 mnriem

Not seeing the latest commit?

Sorry about the mistake, recommitted.

meymchen avatar Jun 17 '26 17:06 meymchen

Please address Copilot feedback

mnriem avatar Jun 17 '26 19:06 mnriem