@dropfix/cli
v1.0.3
Published
Auto-instrument your app and build an event model with AI
Downloads
534
Readme
@dropfix/cli
One-shot CLI that scans your source code, identifies every interactive element (button, link, form, API call), and uploads a manifest to DropFix so AI can name your events automatically.
Why use this
The browser SDK auto-tracks events at runtime, but event names like clicked_button_a3f9 aren't useful. The CLI lets DropFix's AI read your source code to generate semantic names like invoice_sent, subscription_created, support_ticket_opened — without you writing any tracking code.
Quick start
# One-time scan (no install)
npx @dropfix/cli scan --key pk_live_YOUR_KEY
# Or install locally
npm install --save-dev @dropfix/cli
npx @dropfix/cli scan --key pk_live_YOUR_KEYThe CLI will:
- Auto-detect your framework (Next.js, Vite, Vue, Svelte, Angular)
- Walk your source files looking for interactive elements
- Inject
data-df-trackattributes inline (commits to your repo) - Upload the manifest to DropFix
- Wait ~30 seconds while your events are named
- Print a link to review the result at dropfix.in/app-model
Options
npx @dropfix/cli scan --key pk_live_xxx [options]
--key <pk_live_...> Your DropFix public key (required)
--dir <path> Directory to scan (default: ./src)
--dry-run Preview changes without writing files or uploading
--silent No console output (for CI)
--endpoint <url> Override the API endpoint (for self-hosted)When to re-run
- After adding new UI features
- When you add tracking for a new flow (e.g. a new settings page)
- The CLI is safe to re-run — identical scans are deduplicated automatically
What gets injected into your source
// Before
<button onClick={sendInvoice}>Send invoice</button>
// After (CLI run)
<button onClick={sendInvoice} data-df-track="invoice_sent">Send invoice</button>Inline edits make tracking deterministic in production — DropFix's runtime SDK reads the attribute directly.
Safety
--dry-runpreviews every change without writing- Skips
node_modules,.next,dist,build,.git - Only modifies files matching your framework's source pattern (e.g.
.tsxfor Next.js) - Idempotent — re-running on an already-tagged element is a no-op
License
MIT
