Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,7 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Format
run: pnpm format
- name: Test
run: pnpm test
- name: Build
run: pnpm build
1 change: 1 addition & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ jobs:
registry-url: 'https://registry.npmjs.org'
- run: pnpm install --frozen-lockfile
- run: pnpm format
- run: pnpm test
- run: pnpm build
- run: pnpm publish --provenance --access public --no-git-checks
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,29 @@ bitrefill search-products --query "Netflix"
cp .env.example .env
```

Node does not load `.env` files automatically. After editing `.env`, either export variables in your shell (`set -a && source .env && set +a` in bash/zsh) or pass `--api-key` on the command line.

## Usage

```bash
bitrefill [--api-key <key>] <command> [options]
bitrefill [--api-key <key>] [--json] <command> [options]
```

### Human-readable output (default)

Tool results are pretty-printed JSON on stdout. Status messages (OAuth prompts, etc.) also go to stdout.

### Machine-readable output (`--json`)

Pass `--json` anywhere before the subcommand so scripts and `jq` get a single JSON value per invocation on stdout:

- **stdout**: Only the tool result (JSON). Text payloads from the server may be JSON or [TOON](https://toonformat.dev/); the CLI decodes TOON to JSON when needed.
- **stderr**: Progress messages, errors, and client errors (JSON `{ "error": "..." }` for failures).

Example:

```bash
bitrefill --json search-products --query "Amazon" --per_page 1 | jq '.products[0].name'
```

### Examples
Expand All @@ -62,6 +81,18 @@ bitrefill --help
bitrefill logout
```

## Development

From the repository root (requires [pnpm](https://pnpm.io/)):

```bash
pnpm install
pnpm format # Prettier check
pnpm test # Vitest unit tests
pnpm build # Compile to dist/
pnpm dev -- --help # Run CLI via tsx without building
```

## Paying

**Flow:** `get-product-details` → pick `product_id` + `package_id` → `buy-products` with `--cart_items` and `--payment_method`.
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"build": "tsc",
"start": "node dist/index.js",
"dev": "tsx src/index.ts",
"format": "prettier --check ./src"
"format": "prettier --check ./src",
"test": "vitest run"
},
"repository": {
"type": "git",
Expand All @@ -22,13 +23,15 @@
"packageManager": "pnpm@10.27.0",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.27.1",
"@toon-format/toon": "^2.1.0",
"commander": "^14.0.3"
},
"devDependencies": {
"@types/node": "^25.3.0",
"prettier": "^3.8.1",
"tsx": "^4.21.0",
"typescript": "^5.8.3"
"typescript": "^5.8.3",
"vitest": "^3.2.4"
},
"keywords": [
"mcp",
Expand Down
Loading
Loading