{"_id":"@absmartly/ai-cli-bridge","name":"@absmartly/ai-cli-bridge","dist-tags":{"latest":"1.3.0"},"versions":{"1.3.0":{"name":"@absmartly/ai-cli-bridge","version":"1.3.0","description":"HTTP bridge server for ABsmartly Extension to communicate with AI CLIs","main":"index.js","bin":{"ai-cli-bridge":"index.js","get-chunk":"bin/get-chunk.js"},"scripts":{"start":"nodemon --watch index.js --watch package.json --exitcrash index.js","test":"jest","test:providers":"RUN_PROVIDER_TESTS=1 jest --runInBand"},"keywords":["claude","absmartly","ab-testing","bridge"],"author":{"name":"ABsmartly"},"license":"MIT","dependencies":{"@acemir/cssom":"^0.9.31","cors":"^2.8.5","dotenv":"^16.3.1","express":"^4.18.2","jsdom":"^25.0.0"},"devDependencies":{"jest":"^30.2.0","nodemon":"^3.0.1","supertest":"^7.2.2"},"engines":{"node":">=16.0.0"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/absmartly/ai-cli-bridge.git"},"bugs":{"url":"https://github.com/absmartly/ai-cli-bridge/issues"},"homepage":"https://github.com/absmartly/ai-cli-bridge#readme","_id":"@absmartly/ai-cli-bridge@1.3.0","gitHead":"4606bdb5efbfc4fc91f8b9a6aba33d3e6529999d","_nodeVersion":"22.15.0","_npmVersion":"11.3.0","dist":{"integrity":"sha512-Kt5WhWXL4XgE7tdobfMK4sD1KnZrS3B6HWRpI+007PIOWj03WiKKPaez13STLSsbFo8t3oH5px5BvLQ4y/DeWw==","shasum":"a299c1845002c5c5b9c5082c5c00a16aada66f44","tarball":"https://registry.npmjs.org/@absmartly/ai-cli-bridge/-/ai-cli-bridge-1.3.0.tgz","fileCount":6,"unpackedSize":77391,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQC8OIsPpvLpTH4ZeSaLpuM9vKfv61C3m+y2kPNCAg0RygIhAJsbELPkL1z8eP7kWRcTcn3oPSC2ea1pga6ZeNpZT4S1"}]},"_npmUser":{"name":"joalves","email":"jonas@absmartly.com"},"directories":{},"maintainers":[{"name":"marcioapm","email":"marcioapm@gmail.com"},{"name":"joalves","email":"jonas@absmartly.com"},{"name":"caltheabtester","email":"cal@absmartly.com"},{"name":"marcioabs","email":"marcio@absmartly.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-cli-bridge_1.3.0_1771865202693_0.1397537368974997"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-23T16:46:42.583Z","1.3.0":"2026-02-23T16:46:42.838Z","modified":"2026-02-23T16:46:43.101Z"},"maintainers":[{"name":"marcioapm","email":"marcioapm@gmail.com"},{"name":"joalves","email":"jonas@absmartly.com"},{"name":"caltheabtester","email":"cal@absmartly.com"},{"name":"marcioabs","email":"marcio@absmartly.com"}],"description":"HTTP bridge server for ABsmartly Extension to communicate with AI CLIs","homepage":"https://github.com/absmartly/ai-cli-bridge#readme","keywords":["claude","absmartly","ab-testing","bridge"],"repository":{"type":"git","url":"git+https://github.com/absmartly/ai-cli-bridge.git"},"author":{"name":"ABsmartly"},"bugs":{"url":"https://github.com/absmartly/ai-cli-bridge/issues"},"license":"MIT","readme":"# @absmartly/ai-cli-bridge\n\nHTTP bridge server that enables the ABsmartly Browser Extension to communicate with AI CLIs (Claude Code, Codex) for AI-powered A/B testing features.\n\n## Prerequisites\n\n- Node.js 16+\n- Claude Code CLI authenticated: `npx @anthropic-ai/claude-code login`\n- Codex CLI authenticated (if using Codex): `codex login`\n\n## Quick Start\n\n```bash\nnpx @absmartly/ai-cli-bridge\n```\n\nThe server will start on `http://localhost:3000` by default.\n\n## Usage\n\n### 1. Login to your CLI (one-time setup)\n\n```bash\nnpx @anthropic-ai/claude-code login\n```\n\nFollow the prompts to authenticate with your Claude subscription.\n\n### 2. Start the bridge server (Claude default)\n\n```bash\nnpx @absmartly/ai-cli-bridge\n```\n\n### 3. Configure ABsmartly Extension\n\nIn the extension settings:\n1. Select \"Claude Subscription\" as your AI provider\n2. The extension will automatically connect to `http://localhost:3000`\n\n### Use Codex CLI\n\n```bash\nnpx @absmartly/ai-cli-bridge --codex\n```\n\n```bash\nnpx @absmartly/ai-cli-bridge --provider=codex\n```\n\nThe Codex provider uses `codex exec` under the hood and enforces the same JSON schema as Claude.\n\n### Custom Port\n\n```bash\nPORT=3001 npx @absmartly/ai-cli-bridge\n```\n\n## API Endpoints\n\n- `GET /health` - Health check and auth status\n- `GET /auth/status` - Provider authentication status\n- `POST /conversations` - Create new conversation\n- `POST /conversations/:id/messages` - Send message to provider CLI\n- `GET /conversations/:id/stream` - Stream provider responses (SSE)\n- `POST /conversations/:id/approve` - Approve tool use\n- `POST /conversations/:id/deny` - Deny tool use\n\n### Provider Selection\n\nSet a default provider via environment variable:\n\n```bash\nAI_CLI_PROVIDER=codex\n```\n\nOr pass a provider at startup:\n\n```bash\nnpx @absmartly/ai-cli-bridge --codex\n```\n\n```bash\nnpx @absmartly/ai-cli-bridge --provider=codex\n```\n\n```bash\nnpx @absmartly/ai-cli-bridge --provider codex\n```\n\nOr pass a provider per conversation:\n\n```json\n{ \"provider\": \"codex\" }\n```\n\n## How It Works\n\n1. **Authentication Check**: Reads credentials for the selected provider (Claude or Codex)\n2. **CLI Spawn**: Spawns the selected provider CLI (Claude Code or Codex)\n3. **HTTP Bridge**: Provides REST API for the browser extension to communicate\n4. **Message Forwarding**: Routes messages between the extension and the CLI\n5. **Server-Sent Events**: Streams responses back to the extension in real-time\n\n## Troubleshooting\n\n### \"Claude CLI not logged in\"\n\nRun: `npx @anthropic-ai/claude-code login`\n\n### \"Codex CLI not logged in\"\n\nRun: `codex login`\n\n### \"Port already in use\"\n\nEither:\n- Kill the existing process: `pkill -f ai-cli-bridge`\n- Or use a different port: `PORT=3001 npx @absmartly/ai-cli-bridge`\n\n### Extension can't connect\n\n- Ensure the bridge is running: `http://localhost:3000/health` should return JSON\n- Check the port matches in extension settings\n- Restart the extension\n\n## Notes\n\n- Codex runs a single `codex exec` per message (no persistent session yet).\n- Image inputs are supported for Claude and Codex (Codex uses `codex exec --image`).\n\n## Testing\n\nFilter mocked tests by provider:\n\n```bash\nTEST_PROVIDER=codex npm test\n```\n\nRun real provider tests:\n\n```bash\nRUN_PROVIDER_TESTS=1 TEST_PROVIDER=codex npm run test:providers\n```\n\nRun vision test (Codex only):\n\n```bash\nRUN_PROVIDER_TESTS=1 RUN_VISION_TESTS=1 TEST_PROVIDER=codex npm run test:providers\n```\n\n```bash\nRUN_PROVIDER_TESTS=1 RUN_VISION_TESTS=1 TEST_PROVIDER=claude npm run test:providers\n```\n\nSet a model for tests:\n\n```bash\nRUN_PROVIDER_TESTS=1 RUN_VISION_TESTS=1 TEST_PROVIDER=claude TEST_MODEL=opus npm run test:providers\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-8661a9d91d37a79e2c62b58667c32f0e"}