{"_rev":"4-d0400a3a51bd8a1b392618c0a66a90ec","time":{"created":"2026-08-23T22:06:09.631Z","modified":"2026-08-23T22:06:10.163Z","1.0.0":"2026-08-23T21:27:36.836Z","1.0.1":"2026-08-23T21:42:02.804Z","1.0.2":"2026-08-23T22:06:09.950Z"},"_id":"@aalexis.dev/cfx","name":"@aalexis.dev/cfx","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.2":{"name":"@aalexis.dev/cfx","version":"1.0.2","description":"Ultra-lightweight multi-account Cloudflare Wrangler wrapper CLI with encrypted local storage","type":"module","main":"./bin/index.js","bin":{"cfx":"bin/index.js","cfpipe":"bin/index.js"},"engines":{"node":">=18.0.0"},"publishConfig":{"access":"public"},"keywords":["cloudflare","wrangler","cli","multi-account","cfx","cfpipe","security","encryption","pnpm"],"author":{"name":"Alexis"},"license":"MIT","devDependencies":{"@types/node":"^22.0.0","typescript":"^5.5.0"},"scripts":{"build":"tsc && node scripts/make-executable.js","dev":"tsc --watch","test":"tsc -p tsconfig.test.json && node dist-test/tests/test-flow.js && node scripts/cleanup-test.js"},"_id":"@aalexis.dev/cfx@1.0.2","_integrity":"sha512-FPOeY6k9RiKUbsET/qgmn3cXVftXKb+vuyxcRshGuaAww46XKZ2a0yIHP5FEGOdZxOHB3jCuNYLSqOXmJbcnnA==","_resolved":"/private/var/folders/vp/96pmh8252vz4tvmfphgzfz900000gn/T/eab815080dfb65ee4e9db95c5bf1f07e/aalexis.dev-cfx-1.0.2.tgz","_from":"file:aalexis.dev-cfx-1.0.2.tgz","_nodeVersion":"22.22.3","_npmVersion":"10.9.8","dist":{"integrity":"sha512-FPOeY6k9RiKUbsET/qgmn3cXVftXKb+vuyxcRshGuaAww46XKZ2a0yIHP5FEGOdZxOHB3jCuNYLSqOXmJbcnnA==","shasum":"f1f3fbc28b83664b9f3830f689efffc3197dab26","tarball":"https://registry.npmjs.org/@aalexis.dev/cfx/-/cfx-1.0.2.tgz","fileCount":10,"unpackedSize":32234,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC4WXIAJ2oxPMaZfJZQvdZNZjnS0wwRTkdTa0rpk4U67AIhANavwy4VkLg9fVVKtjWleqVaFFoxn9u9DpAG12MKreGU"}]},"_npmUser":{"name":"aalexis.dev","email":"aalexis.dev@gmail.com"},"directories":{},"maintainers":[{"name":"aalexis.dev","email":"aalexis.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cfx_1.0.2_1787522769805_0.8453225714763031"},"_hasShrinkwrap":false}},"maintainers":[{"name":"aalexis.dev","email":"aalexis.dev@gmail.com"}],"description":"Ultra-lightweight multi-account Cloudflare Wrangler wrapper CLI with encrypted local storage","keywords":["cloudflare","wrangler","cli","multi-account","cfx","cfpipe","security","encryption","pnpm"],"author":{"name":"Alexis"},"license":"MIT","readme":"# ⚡ cfx (`@aalexis.dev/cfx`)\n\n> **Ultra-lightweight, secure CLI wrapper for managing multiple Cloudflare accounts with Wrangler.**\n>\n> 🔒 Encrypted local storage with `AES-256-GCM` | ⚡ 0 runtime dependencies | 🌐 Cross-platform (Windows, macOS, Linux).\n\n---\n\n## 🚀 Features\n\n- **Multi-Account Switching:** Switch between Cloudflare accounts instantly using `--acc=<name>` or `-a <name>`.\n- **Batch Execution:** Run commands sequentially across all registered accounts with `--all`.\n- **Transparent Wrangler Proxy:** Forwards all arguments, flags, and real-time outputs (`stdio: inherit`) directly to the `wrangler` binary.\n- **Zero Runtime Dependencies:** Built exclusively on Node.js native modules (`node:crypto`, `node:child_process`, `node:readline`, `node:fs`, `node:os`).\n- **Cryptographic Security:** Credentials (`accountId` and `apiToken`) are encrypted locally with `AES-256-GCM` using a 256-bit master key with strict permissions (`0600` / `0700`).\n- **Cross-Platform:** Works seamlessly across Windows (CMD, PowerShell, Windows Terminal), macOS, and Linux.\n\n---\n\n## 🛠️ Global Installation (Recommended)\n\nInstall globally once to use the clean and short `cfx` command anywhere in your terminal:\n\n```bash\n# With pnpm\npnpm add -g @aalexis.dev/cfx\n\n# With npm\nnpm install -g @aalexis.dev/cfx\n```\n\nOnce installed globally, you can simply run:\n```bash\ncfx --add\ncfx --list\ncfx --acc=production deploy\n```\n\n---\n\n## 📦 Direct Execution (Without Installation)\n\nYou can also run `@aalexis.dev/cfx` directly using your preferred package manager:\n\n```bash\n# With pnpm dlx\npnpm dlx @aalexis.dev/cfx --add\npnpm dlx @aalexis.dev/cfx --list\npnpm dlx @aalexis.dev/cfx --acc=production deploy\n\n# With npx\nnpx @aalexis.dev/cfx --acc=staging tail\n```\n\n---\n\n## 📖 Command Reference\n\n### 1. Register an Account (`--add`)\nStarts an interactive prompt to enter the account identifier name, **Cloudflare Account ID**, and **Cloudflare API Token** (the token input is securely masked in the terminal):\n\n```bash\ncfx --add\n# or\ncfx add\n```\n\n### 2. List Registered Accounts (`--list`)\nDisplays a formatted list of all configured accounts:\n\n```bash\ncfx --list\n# or\ncfx list\n# or\ncfx ls\n```\n\n### 3. Remove an Account (`--remove`)\nDeletes an account from your local encrypted storage:\n\n```bash\ncfx --remove <name>\n# or\ncfx rm <name>\n```\n\n### 4. Run Wrangler on a Specific Account (`--acc` or `-a`)\nDecrypts credentials in memory, injects `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN`, and invokes `wrangler`:\n\n```bash\n# Deploy a Worker\ncfx --acc=production deploy\n\n# Stream real-time logs\ncfx -a staging tail\n\n# Inspect current authenticated user and permissions\ncfx --acc=client1 whoami\n\n# Generate Cloudflare Worker / D1 / KV types\ncfx --acc=prod types\n```\n\n### 5. Run Across All Accounts (`--all`)\nSequentially executes the specified command on every registered account and presents a summary table:\n\n```bash\ncfx --all deploy\ncfx --all whoami\n```\n\n---\n\n## 🔐 Security & Storage\n\n- **Storage Location:** `~/.cfx/accounts.json`\n- **Master Encryption Key:** `~/.cfx/.key` (generated locally with `crypto.randomBytes(32)` and protected with `0600` permissions on Unix systems).\n- **Algorithm:** `AES-256-GCM` with a unique 16-byte initialization vector (`iv`) and 16-byte authentication tag (`authTag`) per encrypted value.\n- Credentials are never transmitted over the network or stored in plain text.\n\n---\n\n## 💻 Local Development & Publishing\n\n### 1. Clone and Install Dev Dependencies\n```bash\ngit clone https://github.com/your-username/cfx.git\ncd cfx\npnpm install\n```\n\n### 2. Build the Project (TypeScript)\n```bash\npnpm build\n```\n\n### 3. Run Automated Tests\n```bash\npnpm test\n```\n\n### 4. Link Locally for Testing\n```bash\npnpm link --global\n```\nYou can now test the `cfx` command directly from any terminal window.\n\n### 5. Publish to the NPM Registry\n```bash\n# 1. Log in to your npm account (if not already authenticated)\npnpm login\n\n# 2. Publish package with public access\npnpm publish --access public\n```\n\n---\n\n## 📄 License\n\nMIT © 2026\n","readmeFilename":"README.md"}