Skip to content

feat(cli): expand tilde in KIMI_CODE_HOME - #2544

Open
tagadearpit wants to merge 3 commits into
MoonshotAI:mainfrom
tagadearpit:feat/expand-kimi-code-home-tilde
Open

feat(cli): expand tilde in KIMI_CODE_HOME#2544
tagadearpit wants to merge 3 commits into
MoonshotAI:mainfrom
tagadearpit:feat/expand-kimi-code-home-tilde

Conversation

@tagadearpit

@tagadearpit tagadearpit commented Aug 2, 2026

Copy link
Copy Markdown

Related Issue

Resolve #2543

Problem

See linked issue.

What changed

  • expand a standalone ~ in KIMI_CODE_HOME to the current home directory
  • expand ~/... and ~\... values under the current home directory
  • leave named-user forms such as ~other/... unchanged
  • add focused unit coverage for expansion and compatibility behavior
  • add a patch changeset for @moonshot-ai/kimi-code

The implementation is intentionally limited to the current user and does not attempt platform-specific account lookup.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Added a changeset.
  • Documentation update pending maintainer direction; the behavior is covered in the issue and changeset.

@changeset-bot

changeset-bot Bot commented Aug 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eade0e3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

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.

feat(cli): expand a leading tilde in KIMI_CODE_HOME

1 participant