{"_id":"@dungpv100101/claudex","_rev":"2-b8e885d25b9d5c0a5cde7098bce871f9","name":"@dungpv100101/claudex","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@dungpv100101/claudex","version":"1.0.0","keywords":["claude","anthropic","profile","claude-code"],"license":"MIT","_id":"@dungpv100101/claudex@1.0.0","maintainers":[{"name":"dungpv100101","email":"dungpv100101@gmail.com"}],"bin":{"claudex":"bin/claudex.js"},"dist":{"shasum":"d127095dbb262cf2f1c1293e166f195b70d2d062","tarball":"https://registry.npmjs.org/@dungpv100101/claudex/-/claudex-1.0.0.tgz","fileCount":3,"integrity":"sha512-5oYo2SEQha2v+TzDQfEK1FLc66ian1O7uNNaHXBnQXOTMWAEBshdZbvoYNn7sHKXBmaPfK9DoRRp6s+H9zSUbw==","signatures":[{"sig":"MEYCIQCKLd0icO7iHzQA3KLlRd8hD2X32ac3x9kYRA2cybEMiAIhAK7+vuXIXA2pMR4yO25bQ2RH6hq2CBaPYrJYBFnpCKwT","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10682},"engines":{"node":">=14.0.0"},"_npmUser":{"name":"dungpv100101","email":"dungpv100101@gmail.com"},"_npmVersion":"10.5.0","description":"Profile switcher wrapper for Claude Code (claude CLI)","directories":{},"_nodeVersion":"20.12.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/claudex_1.0.0_1778145806706_0.10076953372050723","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@dungpv100101/claudex","version":"1.0.1","description":"Profile switcher wrapper for Claude Code (claude CLI)","license":"MIT","engines":{"node":">=14.0.0"},"bin":{"claudex":"bin/claudex.js"},"keywords":["claude","anthropic","profile","claude-code"],"_id":"@dungpv100101/claudex@1.0.1","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-uFm8qBBt3sAulLlOboxWNg/NFNZHU1B1jmz7fse/+xUJcGdBdIKP9GcD+E2HR2OKNS0aSADJ0eZE01gBbvyFzA==","shasum":"12ec16c0c60b954b5d78d8b0d0cc8742360088a2","tarball":"https://registry.npmjs.org/@dungpv100101/claudex/-/claudex-1.0.1.tgz","fileCount":3,"unpackedSize":10696,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDfSErMv/mfmFXDAsOjvK2U8/pVqgvr9EPVNlMDrPa9NgIhAKsyNQCWWpc840oY47DoHPkkbO92YTFN5oaJYvhJjiYe"}]},"_npmUser":{"name":"dungpv100101","email":"dungpv100101@gmail.com"},"directories":{},"maintainers":[{"name":"dungpv100101","email":"dungpv100101@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/claudex_1.0.1_1778148994417_0.9657024986823102"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T09:23:26.535Z","modified":"2026-05-07T10:16:34.662Z","1.0.0":"2026-05-07T09:23:26.826Z","1.0.1":"2026-05-07T10:16:34.565Z"},"license":"MIT","keywords":["claude","anthropic","profile","claude-code"],"description":"Profile switcher wrapper for Claude Code (claude CLI)","maintainers":[{"name":"dungpv100101","email":"dungpv100101@gmail.com"}],"readme":"# claudex\n\nProfile switcher wrapper for [Claude Code](https://github.com/anthropics/claude-code) (`claude` CLI).\n\nSwitch between subscription and API-key profiles without touching environment variables manually.\n\n---\n\n## Prerequisites\n\n- Node.js 14+\n- Claude Code installed: `npm install -g @anthropic-ai/claude-code`\n\n---\n\n## Installation\n\n```sh\nnpm install -g @dungpv100101/claudex\n```\n\nVerify:\n\n```sh\nclaudex --cx-help\n```\n\n---\n\n## Configuration\n\nCreate `~/.claudex/profiles.conf`:\n\n```ini\n# The [default] section sets the fallback profile name.\n[default]\nprofile = sub\n\n# Subscription profile — unsets ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL\n# so claude uses your logged-in account.\n[sub]\ntype = subscription\n\n# API key profile — sets ANTHROPIC_API_KEY before spawning claude.\n[api1]\ntype = api\nANTHROPIC_API_KEY = sk-ant-...\n\n# API key profile with a custom base URL (e.g. a proxy).\n[api2]\ntype = api\nANTHROPIC_API_KEY = sk-ant-...\nANTHROPIC_BASE_URL = https://proxy.example.com/\n```\n\nAny `UPPERCASE` key in a profile section is exported as an environment variable (beyond the built-in `ANTHROPIC_*` keys).\n\n---\n\n## Usage\n\n```sh\n# Launch claude with the current default profile\nclaudex\n\n# Use a specific profile for this run only\nclaudex --cx-profile api1\n\n# Set a new persistent default profile\nclaudex --cx-use api2\n\n# List all profiles (active profile marked with *)\nclaudex --cx-list\n\n# Show the current default profile name\nclaudex --cx-current\n\n# Show help\nclaudex --cx-help\n\n# All other flags/args are forwarded verbatim to claude\nclaudex --cx-profile api1 -- --model claude-opus-4-7 -p \"explain monads\"\n\n# Combine: set new default and immediately launch claude\nclaudex --cx-use api1 --model claude-sonnet-4-6\n```\n\nThe `--` separator stops claudex flag parsing — everything after it is forwarded to `claude` as-is.\n\n---\n\n## Profile Types\n\n| Type | Behavior |\n|---|---|\n| `subscription` | Removes `ANTHROPIC_API_KEY` and `ANTHROPIC_BASE_URL` from env before spawning `claude` |\n| `api` | Sets `ANTHROPIC_API_KEY` (and `ANTHROPIC_BASE_URL` if present) in env before spawning `claude` |\n\nIf `type` is omitted, the profile is treated as `api` with a warning.\n\n---\n\n## Default Profile Resolution\n\nclaudex resolves the active profile in this order:\n\n1. `--cx-profile <name>` flag (per-run override)\n2. `~/.claudex/.current_profile` file (set by `--cx-use`)\n3. `profile =` key in the `[default]` section of `profiles.conf`\n4. Hard fallback: `sub`\n\n---\n\n## How It Works\n\n1. Reads `~/.claudex/profiles.conf` (INI format, no external deps)\n2. Resolves the active profile\n3. Builds a modified copy of the current environment based on profile type\n4. Spawns `claude` via `spawnSync` with inherited stdio and the modified env\n5. Exits with the same exit code as `claude`\n\n---\n\n## Troubleshooting\n\n**`'claude' command not found`**\nInstall Claude Code: `npm install -g @anthropic-ai/claude-code`\n\n**`profile 'X' not found`**\nCheck your profile name with `claudex --cx-list` and verify `~/.claudex/profiles.conf`.\n\n**Config file missing**\nclaudex runs with the unmodified environment. Create `~/.claudex/profiles.conf` to enable profile switching.\n\n**Windows: claudex not recognized after install**\nEnsure npm's global bin directory is on your `PATH`. Run `npm config get prefix` and add `<prefix>` to `PATH`.\n\n---\n\n## License\n\nMIT\n","readmeFilename":"README.md"}