@marginfront/sdk 0.0.1 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -305,6 +305,91 @@ console.log(`Total Requests: ${stats.requestCount}`);
305
305
  console.log(`Success Rate: ${(stats.successRate * 100).toFixed(2)}%`);
306
306
  ```
307
307
 
308
+
309
+ ## CLI (Testing Tool)
310
+
311
+ The SDK ships with a lightweight CLI (`mf`) for testing your integration without writing code.
312
+
313
+ > **Note:** The CLI is a testing tool only. It has no effect on the SDK when used as a library in your application.
314
+
315
+ ### Install globally
316
+
317
+ ```bash
318
+ npm install -g @marginfront/sdk
319
+ ```
320
+
321
+ Then run commands from anywhere:
322
+
323
+ ```bash
324
+ mf verify
325
+ mf track-event --customer-id customer-1 --agent-id <uuid> --signal CALL_MINUTES --quantity 10
326
+ ```
327
+
328
+ ### Commands
329
+
330
+ #### `mf verify`
331
+
332
+ Verifies your API key and returns organization details.
333
+
334
+ ```bash
335
+ mf verify [options]
336
+
337
+ Options:
338
+ --api-key <key> API key (mf_sk_* or mf_pk_*)
339
+ --base-url <url> API base URL (default: https://api.revmax.ai/v1)
340
+ --debug Enable debug output
341
+ ```
342
+
343
+ #### `mf track-event`
344
+
345
+ Sends a single usage event to the API.
346
+
347
+ ```bash
348
+ mf track-event [options]
349
+
350
+ Options:
351
+ --api-key <key> API key (mf_sk_*)
352
+ --base-url <url> API base URL (default: https://api.revmax.ai/v1)
353
+ --customer-id <id> Customer external ID
354
+ --agent-id <id> Agent UUID
355
+ --signal <name> Signal name (e.g. CALL_MINUTES)
356
+ --quantity <number> Quantity to record (default: 1)
357
+ --metadata <json> Optional metadata as a JSON string
358
+ --debug Enable debug output
359
+ ```
360
+
361
+ ### Default values via `.env.marginfront.cli`
362
+
363
+ To avoid repeating flags, create a `.env.marginfront.cli` file in the directory where you run the CLI. Any value set here is used as a default and can be overridden by passing the flag directly.
364
+
365
+ ```env
366
+ # ⚠️ FOR TESTING ONLY
367
+ # This file is NOT used when the SDK is imported as a library.
368
+ # It only applies when running the mf CLI.
369
+
370
+ MF_API_KEY=mf_sk_your_key_here
371
+ MF_BASE_URL=http://localhost:4000/v1
372
+ MF_AGENT_ID=your-agent-uuid
373
+ MF_CUSTOMER_ID=customer-1
374
+ MF_SIGNAL=CALL_MINUTES
375
+ MF_QUANTITY=10
376
+ MF_DEBUG=false
377
+ ```
378
+
379
+ **Priority:** CLI flags > `.env.marginfront.cli` > built-in defaults
380
+
381
+ | CLI Flag | `.env` Key |
382
+ |-----------------|-------------------|
383
+ | `--api-key` | `MF_API_KEY` |
384
+ | `--base-url` | `MF_BASE_URL` |
385
+ | `--customer-id` | `MF_CUSTOMER_ID` |
386
+ | `--agent-id` | `MF_AGENT_ID` |
387
+ | `--signal` | `MF_SIGNAL` |
388
+ | `--quantity` | `MF_QUANTITY` |
389
+ | `--debug` | `MF_DEBUG` |
390
+
391
+ Add `.env.marginfront.cli` to your `.gitignore` to avoid committing test credentials.
392
+
308
393
  ## License
309
394
 
310
395
  MIT License. See [LICENSE](./LICENSE) for details.