claude-code-win32

raw JSON →
0.1.1 verified Fri May 01 auth: no javascript

Claude Code plugin for Windows that transparently transpiles Bash commands to PowerShell equivalents. v0.1.1 (March 2025) — hooks manifest fix. Fast-path passes POSIX-safe commands (git, npm, grep) straight to Git Bash; rewrites Unix idioms (xdg-open, pbcopy, uname, df, free) to PowerShell; denies impossible commands (sudo, apt, chmod) with Windows-native hints. MSYS path translation (/c/… → C:/…), PS 5.1 vs PS 7 awareness, internal error safety. TypeScript types included. Requires Node >=20. Active development, GitHub-only.

error ERROR [Bash tool]: Duplicate hooks file detected
cause v0.1.0 plugin.json included a hooks field alongside the auto-loaded hooks/hooks.json.
fix
Update to v0.1.1 which removes the redundant hooks field.
error ERR_REQUIRE_ESM: require() of ES Module /path/to/node_modules/claude-code-win32/index.js from /path/to/app.js not supported.
cause Package is ESM-only; CommonJS require() is not supported.
fix
Use dynamic import(): async () => { const mod = await import('claude-code-win32'); }
error Error: Cannot find module 'claude-code-win32/paths'
cause Subpath exports may not be resolved if the package is symlinked or in a monorepo with older Node versions.
fix
Ensure Node >=20. Use the main export instead: import { transpile } from 'claude-code-win32'.
breaking v0.1.0 shipped a redundant hooks field in plugin.json causing 'Duplicate hooks file detected' error on /reload-plugins.
fix Update to v0.1.1 via /plugin update claude-code-win32@claude-code-win32 and /reload-plugins.
gotcha Package is ESM-only. require() will throw an error.
fix Use import() or dynamic import. If using CommonJS, set "type": "module" or use .mjs extension.
gotcha The plugin auto-detects PowerShell version and caches it for 24h under ~/.claude/plugins/claude-code-win32.state.json. If you install PS 7 after detection, the cached PS 5.1 may cause denial of &&/||.
fix Delete ~/.claude/plugins/claude-code-win32.state.json or wait 24h for auto-refresh.
gotcha MSYS path translation is boundary-aware but may incorrectly translate paths in edge cases like /c/ in the middle of a word (e.g., 'mac/classic').
fix Use absolute Windows paths (C:/...) or quote paths that should not be translated. Check segment classification output.
deprecated The subpath exports are not documented in README as stable API; they may change in minor versions without notice.
fix Only rely on the main 'transpile' export for stability. For subpath exports, pin exact version in package.json.
gotcha chmod commands are denied instead of translated. On Windows, file permissions are managed via icacls, not chmod.
fix Use icacls or Set-Acl in PowerShell. The denial hint will suggest the equivalent.
npm install claude-code-win32
yarn add claude-code-win32
pnpm add claude-code-win32

Shows how to import and use the transpile function to convert a Bash command with && chaining to PowerShell.

// Install plugin in Claude Code REPL
// /plugin marketplace add hmennen90/claude-code-win32
// /plugin install claude-code-win32@claude-code-win32
// /reload-plugins

// Or install from npm and use programmatically
import { transpile } from 'claude-code-win32';

// Example: transpile a Bash command string for Windows
const bashCmd = `xdg-open "https://example.com" && echo done`;
const result = transpile(bashCmd, { preferPowerShell: true });

/*
result.type: "rewrite" | "deny" | "passthrough"
result.command: the transformed PowerShell command (if rewrite)
result.hint: denial hint (if deny)
result.segments: per-command classification results
*/

console.log(result);
// => {
//   type: 'rewrite',
//   command: 'Start-Process "https://example.com"; if ($?) { Write-Output "done" }',
//   segments: [
//     { command: 'xdg-open "https://example.com"', classification: 'rewrite', replacement: 'Start-Process "https://example.com"' },
//     { command: 'echo done', classification: 'passthrough' }
//   ]
// }