MoonshotAI / MoonshotAI/kimi-code
Detect-Target returns "win32-arm64 arm64" instead of `"win32-arm64" on ARM64 Windows
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
What version of Kimi Code is running?
None
Which open platform/subscription were you using?
None
Which model were you using?
None
What platform is your computer?
Windows ARM64
What issue are you seeing?
The Detect-Target function in [file/path] returns a malformed target string of win32-arm64 arm64 on ARM64 Windows machines, instead of the expected win32-arm64.
Root Cause
The switch statement matches architecture strings case-insensitively by default, and PowerShell's switch does not stop after the first match unless a break is explicitly added to each case:
$arch = switch ($rawArch) {
'X64' { 'x64' }
'X86' { 'x86' }
'Arm64' { 'arm64' }
'ARM64' { 'arm64' }
'AMD64' { 'x64' }
'IA64' { 'ia64' }
default { Die "unsupported architecture: $rawArch" }
}
On an ARM64 machine, $rawArch is the literal string "ARM64", which matches both the 'Arm64' and 'ARM64' cases (case-insensitive, no break). Both blocks execute, producing the array @('arm64', 'arm64') instead of a single string. When that array is interpolated in "win32-$arch", PowerShell joins the elements with a space (via $OFS), producing win32-arm64 arm64.
Fix
Remove the redundant duplicate case and add break to every case to prevent this class of bug in general:
$arch = switch ($rawArch) {
'X64' { 'x64'; break }
'X86' { 'x86'; break }
'ARM64' { 'arm64'; break }
'AMD64' { 'x64'; break }
'IA64' { 'ia64'; break }
default { Die "unsupported architecture: $rawArch" }
}
Environment
- OS: Windows on ARM64
- PowerShell version: [fill in, e.g. 7.4.x or 5.1]
Steps to Reproduce
- Run
Detect-Targeton a Windows ARM64 machine. - Observe the returned value is
win32-arm64 arm64instead ofwin32-arm64.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the PowerShell file containing the Detect-Target function and inspect its architecture switch. Reproduce the ARM64 case or run the relevant CLI checks, then verify that ARM64 produces exactly win32-arm64 and that other architectures still produce their expected targets.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100