feat(cli): expand tilde in KIMI_CODE_HOME - #2544
Conversation
🦋 Changeset detectedLatest commit: eade0e3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eade0e38a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const envDir = process.env[KIMI_CODE_HOME_ENV]; | ||
| if (envDir) { | ||
| return envDir; | ||
| return expandHomeDir(envDir); |
There was a problem hiding this comment.
Move tilde expansion into the shared home resolver
When KIMI_CODE_HOME is a literal tilde path such as ~ or ~/.kimi-code-test (for example from a quoted env var, .env, launch config, or service manager), this expands only the CLI-owned paths. The main startup path still calls resolveKimiHome() from the SDK/agent-core for the harness and telemetry bootstrap, and that resolver continues to return process.env.KIMI_CODE_HOME unchanged, so the TUI config/cache/server token now go under the expanded home while config, sessions, logs, auth, and engine state go under the unexpanded ~... directory. That splits one configured home into two different data roots; the expansion needs to happen in the shared resolver used by the harness as well, not only here.
Useful? React with 👍 / 👎.
Related Issue
Resolve #2543
Problem
See linked issue.
What changed
~inKIMI_CODE_HOMEto the current home directory~/...and~\...values under the current home directory~other/...unchanged@moonshot-ai/kimi-codeThe implementation is intentionally limited to the current user and does not attempt platform-specific account lookup.
Checklist