Skip to content

fix: allow Windows startup without Git Bash#261

Closed
Fengzdadi wants to merge 1 commit into
MoonshotAI:mainfrom
Fengzdadi:codex/windows-git-bash-startup
Closed

fix: allow Windows startup without Git Bash#261
Fengzdadi wants to merge 1 commit into
MoonshotAI:mainfrom
Fengzdadi:codex/windows-git-bash-startup

Conversation

@Fengzdadi
Copy link
Copy Markdown
Contributor

Related Issue

Resolve #259

Problem

See linked issue. On Windows, environment detection failed fast with shell.git_bash_not_found when Git Bash was not installed, so Kimi Code CLI could not start even though only the Bash tool depends on Git Bash semantics.

What changed

  • Return shell availability metadata from KAOS environment detection instead of throwing when Windows bash.exe cannot be found.
  • Omit the built-in Bash tool when the runtime shell is unavailable, while keeping file, search, planning, and other tools available.
  • Render shell-unavailable profile metadata so the system prompt and profile vars describe the missing shell state.
  • Update the bilingual tool reference and add focused tests for Windows shell detection, tool registration, profile rendering, and resume with custom osEnv.

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.

Validation

  • env PATH=/opt/homebrew/opt/node@24/bin:$PATH node_modules/.bin/vitest run packages/kaos/test/environment.test.ts packages/agent-core/test/agent/config.test.ts packages/agent-core/test/profile/agent-profile-loader.test.ts
  • env PATH=/opt/homebrew/opt/node@24/bin:$PATH node_modules/.bin/tsc -p packages/kaos/tsconfig.json --noEmit --pretty false
  • env PATH=/opt/homebrew/opt/node@24/bin:$PATH node_modules/.bin/tsc -p packages/agent-core/tsconfig.json --noEmit --pretty false
  • git diff --check
  • env PATH=/opt/homebrew/opt/node@24/bin:$PATH corepack pnpm --dir docs run build

Note: node docs/scripts/sync-changelog.mjs could not run because docs/scripts/sync-changelog.mjs is not present on the current upstream branch.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 31, 2026

🦋 Changeset detected

Latest commit: 4241ee1

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

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

@Fengzdadi Fengzdadi marked this pull request as ready for review June 1, 2026 02:21
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 1, 2026

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

commit: 4241ee1

@Eric-Song-Nop
Copy link
Copy Markdown
Contributor

我怀疑在没有bash用的情况下仍然正常启动kimi code是否是合适的做法。

@Fengzdadi
Copy link
Copy Markdown
Contributor Author

我怀疑在没有bash用的情况下仍然正常启动kimi code是否是合适的做法。

赞成这个事情,因为我想的理想情况是,可以启动,某种程度上,聊天,修改文件等等功能都不受限。但是真正需要调用 bash 的时候,再给用户提示?
或者说是从一开始就解决这个问题?要求用户在 install/启动 的时候就检查 bash 的安装?

@liruifengv
Copy link
Copy Markdown
Collaborator

最初的设计如此,我先关闭这个 PR,可以在 issue 中讨论。

@liruifengv liruifengv closed this Jun 2, 2026
fancyboi999 added a commit to fancyboi999/kimi-code that referenced this pull request Jun 2, 2026
…tAI#291)

External CLI tools (ripgrep, fd, Git Bash on Windows) were each probed,
degraded, and described in a different corner of the codebase, with
inconsistent severity: ripgrep auto-downloads, fd degraded silently, and
a missing Windows Git Bash crashed the whole CLI at core construction
(MoonshotAI#259) even though only the Bash tool needs a shell.

- kaos: detectEnvironment returns shellAvailable / shellUnavailableReason
  metadata instead of throwing, so the CLI starts without Git Bash.
- agent-core: ToolManager omits the Bash tool when the shell is
  unavailable; the system prompt explains why. Removes the now-dead
  KaosShellNotFoundError, ErrorCodes.SHELL_GIT_BASH_NOT_FOUND, and the
  core-impl catch that translated them.
- node-sdk: expose KimiHarness.getEnvironment() over the RPC seam.
- app: a declarative system-dependency registry + pure check + report
  (apps/kimi-code/src/cli/system-deps). Startup warns when fd is missing
  outside a git repo or the shell is unavailable; /status reports the
  health of all three. fd absence is no longer silent.
- docs: declare the system dependencies (getting-started, tools).

Supersedes the piecemeal approaches in MoonshotAI#261 (git bash) and MoonshotAI#290 (fd).
fancyboi999 added a commit to fancyboi999/kimi-code that referenced this pull request Jun 2, 2026
…tAI#291)

External CLI tools (ripgrep, fd, Git Bash on Windows) were each probed,
degraded, and described in a different corner of the codebase, with
inconsistent severity: ripgrep auto-downloads, fd degraded silently, and
a missing Windows Git Bash crashed the whole CLI at core construction
(MoonshotAI#259) even though only the Bash tool needs a shell.

- kaos: detectEnvironment returns shellAvailable / shellUnavailableReason
  metadata instead of throwing, so the CLI starts without Git Bash.
- agent-core: ToolManager omits the Bash tool when the shell is
  unavailable; the system prompt explains why. Removes the now-dead
  KaosShellNotFoundError, ErrorCodes.SHELL_GIT_BASH_NOT_FOUND, and the
  core-impl catch that translated them.
- node-sdk: expose KimiHarness.getEnvironment() over the RPC seam.
- app: a declarative system-dependency registry + pure check + report
  (apps/kimi-code/src/cli/system-deps). Startup warns when fd is missing
  outside a git repo or the shell is unavailable; /status reports the
  health of all three. fd absence is no longer silent.
- docs: declare the system dependencies (getting-started, tools).

Supersedes the piecemeal approaches in MoonshotAI#261 (git bash) and MoonshotAI#290 (fd).
fancyboi999 added a commit to fancyboi999/kimi-code that referenced this pull request Jun 2, 2026
…tAI#291)

External CLI tools (ripgrep, fd, Git Bash on Windows) were each probed,
degraded, and described in a different corner of the codebase, with
inconsistent severity: ripgrep auto-downloads, fd degraded silently, and
a missing Windows Git Bash crashed the whole CLI at core construction
(MoonshotAI#259) even though only the Bash tool needs a shell.

- kaos: detectEnvironment returns shellAvailable / shellUnavailableReason
  metadata instead of throwing, so the CLI starts without Git Bash.
- agent-core: ToolManager omits the Bash tool when the shell is
  unavailable; the system prompt explains why. Removes the now-dead
  KaosShellNotFoundError, ErrorCodes.SHELL_GIT_BASH_NOT_FOUND, and the
  core-impl catch that translated them.
- node-sdk: expose KimiHarness.getEnvironment() over the RPC seam.
- app: a declarative system-dependency registry + pure check + report
  (apps/kimi-code/src/cli/system-deps). Startup warns when fd is missing
  outside a git repo or the shell is unavailable; /status reports the
  health of all three. fd absence is no longer silent.
- docs: declare the system dependencies (getting-started, tools).

Supersedes the piecemeal approaches in MoonshotAI#261 (git bash) and MoonshotAI#290 (fd).
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.

没有安装Git Bash时无法启动

3 participants