Registry / llm-agents / claude-code-win32

claude-code-win32

JSON →
library0.1.1jsnpmunverified

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.

npm install claude-code-win32
INSTALL
IMPORT
SIG · CLAUDE-CODE-WIN32
C
claude-code-win32
llm-agentsjavascriptv0.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

transpile
✓ import { transpile } from 'claude-code-win32'
✗ const transpile = require('claude-code-win32')
ESM-only; package does not expose CommonJS. Use dynamic import() if needed in CJS context.
transpile (default import)
✓ import transpile from 'claude-code-win32/transpiler'
✗ import transpile from 'claude-code-win32'
Default export is not available from main entry. Use named import or import from /transpiler subpath.
processCommand
✓ import { processCommand } from 'claude-code-win32/chain'
✗ import { processCommand } from 'claude-code-win32'
Subpath export 'chain' provides low-level chain parsing and command processing functions.
translatePath
✓ import { translatePath } from 'claude-code-win32/paths'
✗ import { translatePath } from 'claude-code-win32'
Path translation utilities are in 'claude-code-win32/paths' subpath export.
builtin classifyCommand
✓ import { classifyCommand } from 'claude-code-win32/classifier'
✗ import { classifyCommand } from 'claude-code-win32'
The classifier (passthrough/rewrite/deny) is in its own subpath export.
claude-code-win32-hook binary
✓ npx claude-code-win32-hook
✗ npx claude-code-win32
The standalone hook binary is 'claude-code-win32-hook', not the package name. Requires node >=20.

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' } // ] // }
Debug
Known issues
breakingv0.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.
affects: 0.1.0
gotchaPackage is ESM-only. require() will throw an error.
fix
Use import() or dynamic import. If using CommonJS, set "type": "module" or use .mjs extension.
affects: >=0.1.0
gotchaThe 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.
affects: >=0.1.0
gotchaMSYS 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.
affects: >=0.1.0
deprecatedThe 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.
affects: >=0.1.0
gotchachmod 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.
affects: >=0.1.0
Errors
Common errors & fixes
ERROR [Bash tool]: Duplicate hooks file detected
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.
ERR_REQUIRE_ESM: require() of ES Module /path/to/node_modules/claude-code-win32/index.js from /path/to/app.js not supported.
Package is ESM-only; CommonJS require() is not supported.
fix
Use dynamic import(): async () => { const mod = await import('claude-code-win32'); }
Error: Cannot find module 'claude-code-win32/paths'
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'.
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
claude-code-win32 — npm install claude-code-win32 · libregistry