Skip to content

Migrate from Kimi CLI to Kimi Code#60

Merged
kenryu42 merged 4 commits into
mainfrom
kimi-code
Jun 14, 2026
Merged

Migrate from Kimi CLI to Kimi Code#60
kenryu42 merged 4 commits into
mainfrom
kimi-code

Conversation

@kenryu42

@kenryu42 kenryu42 commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Changes

1. Tool name: ShellBash

Kimi Code's shell execution tool is named Bash, not Shell. The hook matcher and all related constants/tests now target the correct tool name.

  • src/bin/hook/constants.tsKIMI_CODE_TOOL_NAME"Bash"
  • src/bin/hook/install/kimi-code.ts — hook block & inline hook templates updated
  • Tests updated: hook-helpers.ts, hook-adapter-direct.test.ts, kimi-code-hook.test.ts, hook-install.test.ts

2. Config path: .kimi.kimi-code

Kimi Code stores its config under ~/.kimi-code/, not ~/.kimi/.

  • src/bin/hook/install/kimi-code.tsgetKimiConfigPath fallback dir updated
  • src/bin/doctor/hooks.ts_getKimiConfigPath fallback dir updated
  • Tests updated: hook-install.test.ts, hooks.test.ts

3. Env var: KIMI_SHARE_DIRKIMI_CODE_HOME

The environment variable override for the config directory is KIMI_CODE_HOME.

  • src/bin/hook/install/kimi-code.ts — env var reference updated
  • src/bin/doctor/hooks.ts — env var reference updated
  • Tests updated: hook-install.test.ts, hooks.test.ts

4. Docs

  • README.md — added a note about the optional /cc-safety-net skill for Kimi Code

Summary by CodeRabbit

  • Documentation

    • Installation guide now includes an optional step to install the /cc-safety-net skill, enabling users to define and enforce custom safety rules.
  • Configuration Updates

    • Kimi Code configuration directory location changed from .kimi to .kimi-code, with KIMI_CODE_HOME environment variable now taking precedence for path resolution.
    • Tool reference identifier updated from "Shell" to "Bash".

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Renames the Kimi Code hook tool matcher from Shell to Bash, changes the config directory from .kimi to .kimi-code, and switches the governing environment variable from KIMI_SHARE_DIR to KIMI_CODE_HOME. All tests, fixtures, and test descriptions are updated to match. The README gains one optional installation step.

Changes

Kimi Code hook and config path alignment

Layer / File(s) Summary
Tool name and config path source changes
src/bin/hook/constants.ts, src/bin/hook/install/kimi-code.ts, src/bin/doctor/hooks.ts
KIMI_CODE_TOOL_NAME changed from 'Shell' to 'Bash'; TOML hook block template updated to matcher = "Bash"; getKimiConfigPath in both install and doctor modules switched from KIMI_SHARE_DIR/.kimi to KIMI_CODE_HOME/.kimi-code.
Test updates for Bash tool and .kimi-code path
tests/bin/hooks/hook-helpers.ts, tests/bin/hooks/hook-install.test.ts, tests/bin/hooks/kimi-code-hook.test.ts, tests/bin/hooks/hook-adapter-direct.test.ts, tests/bin/doctor/hooks.test.ts
All test fixtures, helper payloads, assertions, descriptions, and env var references updated to reflect 'Bash', ~/.kimi-code/config.toml, and KIMI_CODE_HOME.
README installation guide
README.md
Added optional step to install the /cc-safety-net skill via npx skill add for custom rules configuration.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐇 A shell by another name hops just as fast,
The .kimi-code burrow dug deep to last,
KIMI_CODE_HOME now points the way,
Bash replaces Shell without delay.
With tests all green and README bright,
This bunny's config feels just right! 🌿

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ⚠️ Warning The title 'Migrate from Kimi CLI to Kimi Code' is misleading; the PR actually fixes integration issues with existing Kimi Code support, not a migration from CLI to Code. Revise the title to accurately reflect the purpose, such as 'Fix Kimi Code configuration paths, tool name, and environment variables' or 'Correct Kimi Code integration issues'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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 kimi-code

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.

@codecov

codecov Bot commented Jun 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.42%. Comparing base (e303bb2) to head (261fe1e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #60   +/-   ##
=======================================
  Coverage   97.42%   97.42%           
=======================================
  Files          94       94           
  Lines       10327    10327           
=======================================
  Hits        10061    10061           
  Misses        266      266           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@greptile-apps

greptile-apps Bot commented Jun 14, 2026

Copy link
Copy Markdown

Greptile Summary

This PR corrects three incorrect Kimi Code integration details that were previously using wrong values. All changes are straightforward find-and-replace corrections applied consistently across source, compiled output, and tests.

  • Tool name: \"Shell\"\"Bash\" in the hook matcher, constants, and test helpers.
  • Config directory: ~/.kimi~/.kimi-code in both the installer and the doctor detection path.
  • Env var override: KIMI_SHARE_DIRKIMI_CODE_HOME in both the installer and the doctor, with test names and assertions updated to match.

Confidence Score: 5/5

All three corrections are applied uniformly across source, compiled output, and tests — no partial updates or stale references remain.

The changes are narrow, factual corrections to three string constants used only in the Kimi Code integration path. Source files, the bundled dist artifact, and every related test are updated in lockstep, leaving no inconsistency between them.

No files require special attention.

Important Files Changed

Filename Overview
src/bin/hook/constants.ts Single-line change: KIMI_CODE_TOOL_NAME corrected from "Shell" to "Bash".
src/bin/hook/install/kimi-code.ts Hook block matcher and inline hook updated to "Bash"; config path env var and default directory corrected to KIMI_CODE_HOME / .kimi-code.
src/bin/doctor/hooks.ts _getKimiConfigPath updated to use KIMI_CODE_HOME env var and .kimi-code default directory; mirrors the installer change.
dist/bin/cc-safety-net.js Compiled output updated consistently with all three source corrections (tool name, config path, env var).
tests/bin/hooks/hook-install.test.ts Config path, env var, and hook matcher strings updated in install tests; KIMI_CODE_HOME env honored test renamed accordingly.
tests/bin/doctor/hooks.test.ts Test paths updated to .kimi-code and env var updated to KIMI_CODE_HOME; all assertions align with source changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Kimi Code fires PreToolUse hook] --> B{tool_name == 'Bash'?}
    B -- Yes --> C[cc-safety-net evaluates command]
    B -- No --> D[Hook exits silently — no-op]
    C --> E{Command blocked?}
    E -- Yes --> F[Deny with reason]
    E -- No --> G[Allow]

    H[hook install --kimi-code] --> I{KIMI_CODE_HOME set?}
    I -- Yes --> J[Write to $KIMI_CODE_HOME/config.toml]
    I -- No --> K[Write to ~/.kimi-code/config.toml]
    J --> L[Append matcher = Bash hook block]
    K --> L
Loading

Reviews (1): Last reviewed commit: "test(kimi-code): align hook install test..." | Re-trigger Greptile

@kenryu42 kenryu42 changed the title Kimi code Migrate from Kimi CLI to Kimi code Jun 14, 2026
@kenryu42 kenryu42 changed the title Migrate from Kimi CLI to Kimi code Migrate from Kimi CLI to Kimi Code Jun 14, 2026
@kenryu42 kenryu42 merged commit b82142f into main Jun 14, 2026
8 checks passed
@kenryu42 kenryu42 deleted the kimi-code branch June 14, 2026 16:03
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