Skip to content

fix: provide ripgrep for packaged runtimes#379

Open
7Sageer wants to merge 1 commit into
MoonshotAI:mainfrom
7Sageer:fix-ripgrep-runtime-path
Open

fix: provide ripgrep for packaged runtimes#379
7Sageer wants to merge 1 commit into
MoonshotAI:mainfrom
7Sageer:fix-ripgrep-runtime-path

Conversation

@7Sageer
Copy link
Copy Markdown
Collaborator

@7Sageer 7Sageer commented Jun 3, 2026

Related Issue

No linked issue; this fixes a packaging/runtime failure where search tools cannot find rg in offline or minimal environments.

Problem

Grep depends on ripgrep. When a packaged runtime has no rg on PATH and cannot download the bootstrap archive, the search tool fails before it can inspect files.

What changed

  • Added KIMI_CODE_RG_PATH as a deterministic ripgrep override and validate it before falling back to PATH, cache, or download.
  • Wrapped the Nix CLI binary so packaged runtimes point KIMI_CODE_RG_PATH at Nix's ripgrep binary, and added ripgrep to the dev shell.
  • Added locator tests for env precedence and invalid env configuration.

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.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 3, 2026

🦋 Changeset detected

Latest commit: 8cb9a5a

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

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/agent-core Patch
@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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 3, 2026

pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@8cb9a5a
npx https://pkg.pr.new/@moonshot-ai/kimi-code@8cb9a5a

commit: 8cb9a5a

Copy link
Copy Markdown

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

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: 5e41e2ca12

ℹ️ 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".

Comment thread flake.nix
"$out/libexec/kimi-code/kimi"

makeWrapper "$out/libexec/kimi-code/kimi" "$out/bin/kimi" \
--set-default KIMI_CODE_RG_PATH "${pkgs.ripgrep}/bin/rg"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid forcing local rg path for SSH workspaces

When the Nix-packaged CLI is used with an SSHKaos workspace, Grep resolves KIMI_CODE_RG_PATH locally and then passes that absolute path into kaos.exec; SSHKaos turns those args into a command executed on the remote host. This wrapper now sets the variable to the client-side Nix store path, so remotes that have rg on their own PATH but not the exact same /nix/store/.../bin/rg will run a nonexistent command and all Grep searches fail instead of using the remote binary.

Useful? React with 👍 / 👎.

@7Sageer 7Sageer force-pushed the fix-ripgrep-runtime-path branch from 5e41e2c to d6b52ad Compare June 3, 2026 11:32
@7Sageer 7Sageer force-pushed the fix-ripgrep-runtime-path branch from d6b52ad to 8cb9a5a Compare June 3, 2026 11:55
@Eric-Song-Nop
Copy link
Copy Markdown
Contributor

是否可以把fd也打包进去?如 #266 (comment) @ 文件选择器实际上硬性依赖 fd,但是现在fd没有得到和rigprep一样的待遇。

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.

2 participants