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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
node_modules/
dist/
coverage/
.env.test
.env.test.local
*.js
*.d.ts
*.js.map
!src/**
!test/**
!vitest.config.ts
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Changelog

## 0.1.0 — 2026-04-20

Initial release.

### Tools (11)

Read-only (enabled by default):
- `leadbay_login` — authenticate with email + password
- `leadbay_list_lenses` — list saved search configs
- `leadbay_discover_leads` — AI-recommended leads
- `leadbay_get_lead_profile` — full lead profile with AI scores and web insights
- `leadbay_get_lead_activities` — lead activity feed
- `leadbay_get_taste_profile` — organization ICP + intent tags + qualification questions
- `leadbay_get_contacts` — contacts for a lead
- `leadbay_get_quota` — enrichment credit balance

Write (opt-in, `optional: true`):
- `leadbay_qualify_lead` — trigger AI qualification
- `leadbay_enrich_contacts` — enrich email/phone
- `leadbay_add_note` — add a note to a lead

### Tests

- Contract test: manifest ↔ code parity
- Unit tests: client error mapping, caching, tool branches
- Live smoke tests (opt-in via `LEADBAY_TEST_TOKEN`)
53 changes: 52 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
## Install

```bash
openclaw plugins install leadclaw
openclaw plugins install @leadbay/openclaw-leadclaw
```

## Setup
Expand All @@ -43,6 +43,8 @@ openclaw plugins install leadclaw
| `leadbay_list_lenses` | List available lenses (saved search configs) |
| `leadbay_discover_leads` | Get AI-recommended leads from your active lens |
| `leadbay_get_lead_profile` | Full lead profile with AI scores, qualification Q&A, and contacts |
| `leadbay_get_lead_activities` | Activity feed for a lead (notes, enrichments, status changes) |
| `leadbay_get_taste_profile` | Your ideal buyer profile, purchase-intent tags, and AI qualification questions |
| `leadbay_get_contacts` | Get contacts for a lead (with enriched emails/phones if available) |
| `leadbay_get_quota` | Check your enrichment credit balance |

Expand Down Expand Up @@ -88,3 +90,52 @@ leadbay_discover_leads → leadbay_qualify_lead (for unscored leads) → (wait ~

- Node.js 22+
- A [Leadbay account](https://wow.leadbay.ai/?register=true)

## Development

```bash
npm install # installs deps + vitest
npm test # runs contract + unit + sanity tests (no network, no secrets)
npm run test:coverage # coverage report via v8
npm run build # emits dist/
```

### Test tiers

- **Contract tests** (`test/contract.test.ts`) — assert that registered tools match `openclaw.plugin.json` exactly, schemas are valid, write tools are marked `optional: true`. This catches manifest drift at CI.
- **Unit tests** (`test/unit/**`) — error-code mapping, caching, tool branches. Use `mockHttp` from `test/harness.ts` to stub `node:https`. No network required.
- **Live smoke tests** (`test/smoke/**`) — opt-in. Set `LEADBAY_TEST_TOKEN` (and optionally `LEADBAY_TEST_BASE_URL`) and run:
```bash
LEADBAY_TEST_TOKEN=u.xxx npm run test:smoke
```
Without the env var, these tests cleanly skip. Use a **dedicated test tenant** with a **read-only token** — smoke only hits read endpoints (`/users/me`, `/lenses`, taste profile).

### CI recommendation

- Run `npm test` on every PR — no secrets needed.
- Run `npm run test:smoke` on main merges or nightly, with the `LEADBAY_TEST_TOKEN` secret.

## Publishing

Publication-ready checks:

```bash
npm run build # emits dist/
npm test # contract + unit must be green
npm publish --access public --dry-run # validate npm package
```

### ClawHub (primary)

```bash
clawhub package publish leadbay/leadclaw --dry-run
clawhub package publish leadbay/leadclaw
```

### npm (fallback)

```bash
npm publish --access public
```

The `prepublishOnly` script wires both `build` and `test` into every publish, so a broken diff never ships.
8 changes: 8 additions & 0 deletions openclaw.plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
"id": "leadclaw",
"name": "LeadClaw",
"description": "Leadbay lead discovery, qualification, and contact enrichment",
"version": "0.1.0",
"contracts": {
"tools": [
"leadbay_login",
"leadbay_list_lenses",
"leadbay_discover_leads",
"leadbay_get_lead_profile",
"leadbay_get_lead_activities",
"leadbay_get_taste_profile",
"leadbay_get_contacts",
"leadbay_get_quota",
"leadbay_qualify_lead",
Expand All @@ -25,6 +28,11 @@
"label": "API Base URL",
"help": "Override API URL (for staging/dev)",
"advanced": true
},
"token": {
"label": "API Token",
"help": "Pre-set bearer token to skip the login step",
"sensitive": true
}
},
"configSchema": {
Expand Down
Loading