flashrev-ai-enrich 1.0.0
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/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/README.md +334 -0
- package/bin/flashrev-ai-enrich.js +23 -0
- package/examples/company-profile.job.json +14 -0
- package/examples/leads.csv +4 -0
- package/examples/person-email-unlock.job.json +13 -0
- package/examples/sample-prospects-enriched.csv +8 -0
- package/examples/sample-prospects.csv +8 -0
- package/package.json +42 -0
- package/skills/flashrev-ai-enrich/SKILL.md +212 -0
- package/skills/flashrev-ai-enrich/agents/openai.yaml +3 -0
- package/skills/flashrev-ai-enrich/references/api_contract.md +165 -0
- package/src/args.js +118 -0
- package/src/billing.js +54 -0
- package/src/capabilities.js +2473 -0
- package/src/cli.js +435 -0
- package/src/config.js +114 -0
- package/src/csv.js +81 -0
- package/src/customer-api.js +101 -0
- package/src/estimate.js +64 -0
- package/src/flashrev-client.js +338 -0
- package/src/job.js +126 -0
- package/src/prompt-router.js +144 -0
- package/src/runner.js +269 -0
- package/src/table.js +41 -0
- package/src/tabular.js +17 -0
- package/src/utils.js +104 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `flashrev-ai-enrich` are documented here.
|
|
4
|
+
Format based on [Keep a Changelog](https://keepachangelog.com/), version follows [SemVer](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
## [1.0.0] - 2026-05-29
|
|
7
|
+
|
|
8
|
+
First public release.
|
|
9
|
+
|
|
10
|
+
### Highlights
|
|
11
|
+
|
|
12
|
+
- CSV-first enrichment workflow with dry-run estimate, 10-row sample preview, and full-batch run.
|
|
13
|
+
- 34 enrichment capabilities covering company / person / contact-unlock / verify / FlashAgent / scrape / LLM categories, kept in sync with the backend capability registry at runtime.
|
|
14
|
+
- Natural-language **prompt routing** (`--prompt "..."`) that selects a capability automatically via the FlashRev `run_llm` capability (1 routing token + per-row cost).
|
|
15
|
+
- Pay-on-success billing: rows that fail or come back empty are not charged; per-prompt routing is also free when the LLM call itself errors.
|
|
16
|
+
- Built-in `customer_api` capability for mixing third-party HTTP APIs into the same pipeline at zero token cost.
|
|
17
|
+
- AI-mode (`--ai-mode` or `FLASHREV_ENRICH_AI_MODE=1`) emits structured JSON for list commands and errors so upstream agents can parse outputs reliably.
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- Commands: `init`, `doctor [--no-api]`, `tokens [--json]`, `token-history [--from] [--to] [--limit] [--json]`, `schema [--json]`, `dry-run`, `run`.
|
|
22
|
+
- Per-row flags: `--source`, `--out`, `--capability`, `--prompt`, `--map`, `--output`, `--output-fields`, `--input`, `--job`, `--yes`, `--concurrency`, `--sample-size`, `--skip-balance-check`, `--config`.
|
|
23
|
+
- Global flag: `--ai-mode` / `FLASHREV_ENRICH_AI_MODE=1` — JSON list outputs + JSON error envelope.
|
|
24
|
+
- Inline single-row mode: `flashrev-ai-enrich run --capability X --input k=v --out out.csv`.
|
|
25
|
+
- Job file mode: `--job enrich.job.json` for repeatable presets.
|
|
26
|
+
- Routing decision block printed before estimation when `--prompt` is used (capability / inputMapping / outputMapping / reasoning / routing cost).
|
|
27
|
+
- Status semantics in the output CSV: `success`, `cached`, `no_data`, `failed`.
|
|
28
|
+
|
|
29
|
+
### Notes
|
|
30
|
+
|
|
31
|
+
- Auth is `X-API-Key` against the FlashRev open-API gateway (`https://open-ai-api.flashlabs.ai`). Get a key at https://info.flashlabs.ai/settings/privateApps.
|
|
32
|
+
- The CLI does not store the API key in any artifact. Prefer `FLASHREV_API_KEY` env var.
|
|
33
|
+
- Pre-existing bug fix while wiring prompt routing: `applyRemoteConfigs` no longer overwrites local capability rules / inputs / outputs with empty arrays returned by `/configs` for some capabilities — this restores rule-validation enforcement for explicit `--capability` runs.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Flashlabs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
# FlashRev AI Enrich
|
|
2
|
+
|
|
3
|
+
A CSV-first CLI for FlashRev Lists Enrichment. Authenticate with your FlashRev API key, estimate token usage via dry-run, preview a 10-row sample, then enrich the rest of the CSV and write a new output file.
|
|
4
|
+
|
|
5
|
+
Two ways to drive it:
|
|
6
|
+
|
|
7
|
+
- **`--capability <funcName>`** — pick a capability from `schema`; deterministic, zero routing cost. Preferred for agents and scripts.
|
|
8
|
+
- **`--prompt "<natural-language>"`** — describe the intent and let the FlashRev `run_llm` capability pick the funcName + column mappings. Costs 1 extra token. Convenient for ad-hoc human use.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g flashrev-ai-enrich
|
|
14
|
+
flashrev-ai-enrich --help
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or one-shot via `npx`:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx flashrev-ai-enrich --help
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
> Generate a private app API key at https://info.flashlabs.ai/settings/privateApps before running the commands below.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
export FLASHREV_API_KEY="your_flashrev_api_key"
|
|
29
|
+
|
|
30
|
+
# 1. Self-check
|
|
31
|
+
flashrev-ai-enrich doctor
|
|
32
|
+
|
|
33
|
+
# 2. Browse capabilities
|
|
34
|
+
flashrev-ai-enrich schema
|
|
35
|
+
|
|
36
|
+
# 3. Check balance
|
|
37
|
+
flashrev-ai-enrich tokens
|
|
38
|
+
|
|
39
|
+
# 4. Estimate cost without spending tokens
|
|
40
|
+
flashrev-ai-enrich dry-run \
|
|
41
|
+
--source examples/sample-prospects.csv \
|
|
42
|
+
--capability match_company_id \
|
|
43
|
+
--map company_linkedin=company_linkedin
|
|
44
|
+
|
|
45
|
+
# 5. Real enrichment (10-row sample preview first, then the rest)
|
|
46
|
+
flashrev-ai-enrich run \
|
|
47
|
+
--source examples/sample-prospects.csv \
|
|
48
|
+
--out enriched.csv \
|
|
49
|
+
--capability match_company_id \
|
|
50
|
+
--map company_linkedin=company_linkedin \
|
|
51
|
+
--output company_id=company_id \
|
|
52
|
+
--output company_name=company_name \
|
|
53
|
+
--yes
|
|
54
|
+
|
|
55
|
+
# 6. Audit spend
|
|
56
|
+
flashrev-ai-enrich token-history --from 2026-05-01
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## AI-mode (for agent invocation)
|
|
60
|
+
|
|
61
|
+
When `flashrev-ai-enrich` is called by an upstream agent (OpenClaw, Claude Code, etc.), turn on `--ai-mode` to get JSON for every list command and a structured JSON envelope for errors:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
flashrev-ai-enrich --ai-mode tokens
|
|
65
|
+
# {"remaining": 964013.01, "total": 1011000, ...}
|
|
66
|
+
|
|
67
|
+
flashrev-ai-enrich --ai-mode schema
|
|
68
|
+
# {"capabilities": [...]}
|
|
69
|
+
|
|
70
|
+
FLASHREV_ENRICH_AI_MODE=1 flashrev-ai-enrich run --source x.csv --out y.csv --capability bad_name --yes
|
|
71
|
+
# stderr: {"error":{"code":"UNKNOWN","message":"Unknown capability: bad_name. ..."}}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Equivalent to passing `--json` on every list command. `run` / `dry-run` keep their human-readable progress output.
|
|
75
|
+
|
|
76
|
+
## Authentication
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
export FLASHREV_API_KEY="your_flashrev_api_key"
|
|
80
|
+
flashrev-ai-enrich tokens
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
The CLI calls the FlashRev open API at `https://open-ai-api.flashlabs.ai` and sends the key in the `X-API-Key` request header (no `Bearer` prefix). API keys are read from `FLASHREV_API_KEY` by default and are never written to artifacts. If the balance is `0`, real enrichment is blocked and the user is asked to recharge.
|
|
84
|
+
|
|
85
|
+
Token usage history:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
flashrev-ai-enrich token-history --from 2026-05-01 --to 2026-05-27
|
|
89
|
+
flashrev-ai-enrich token-history --from 2026-05-01 --limit 20 --json
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Worked Example
|
|
93
|
+
|
|
94
|
+
Match seven LinkedIn company URLs to their FlashRev `company_id` and canonical name. The sample CSV and the enriched output are both committed under `examples/`.
|
|
95
|
+
|
|
96
|
+
**Input** — `examples/sample-prospects.csv`
|
|
97
|
+
|
|
98
|
+
```csv
|
|
99
|
+
company_linkedin
|
|
100
|
+
https://www.linkedin.com/company/microsoft
|
|
101
|
+
https://www.linkedin.com/company/google
|
|
102
|
+
https://www.linkedin.com/company/nvidia
|
|
103
|
+
https://www.linkedin.com/company/salesforce
|
|
104
|
+
https://www.linkedin.com/company/uber-com
|
|
105
|
+
https://www.linkedin.com/company/openai
|
|
106
|
+
https://www.linkedin.com/company/anthropicresearch
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Command**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
export FLASHREV_API_KEY="your_flashrev_api_key"
|
|
113
|
+
|
|
114
|
+
flashrev-ai-enrich run \
|
|
115
|
+
--source examples/sample-prospects.csv \
|
|
116
|
+
--out examples/sample-prospects-enriched.csv \
|
|
117
|
+
--capability match_company_id \
|
|
118
|
+
--map company_linkedin=company_linkedin \
|
|
119
|
+
--output company_id=company_id \
|
|
120
|
+
--output company_name=company_name \
|
|
121
|
+
--yes
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Flag breakdown:
|
|
125
|
+
|
|
126
|
+
- `--capability match_company_id` — capability `funcName`, taken from `flashrev-ai-enrich schema`
|
|
127
|
+
- `--map <api_field>=<csv_column>` — fills the capability input field from the named CSV column (rules: at least one full rule must be satisfied per row)
|
|
128
|
+
- `--output <csv_column>=<api_response_field>` — writes each named response field into a CSV column
|
|
129
|
+
- `--yes` — skip the post-sample interactive confirmation (required in CI / non-TTY)
|
|
130
|
+
|
|
131
|
+
**Output** — `examples/sample-prospects-enriched.csv`
|
|
132
|
+
|
|
133
|
+
```csv
|
|
134
|
+
company_linkedin,company_id,company_name,flashrev_enrich_status,flashrev_enrich_error
|
|
135
|
+
https://www.linkedin.com/company/microsoft,569b2d141f922c03fd911a9f550fe703,Microsoft,success,
|
|
136
|
+
https://www.linkedin.com/company/google,d0ae7d1e14de9efabb4f05d257310511,Google,success,
|
|
137
|
+
https://www.linkedin.com/company/nvidia,c79327dc1ff953ce986cd90bad2efd85,NVIDIA,success,
|
|
138
|
+
https://www.linkedin.com/company/salesforce,56aff5826708380c256230153a49b1c3,Salesforce,success,
|
|
139
|
+
https://www.linkedin.com/company/uber-com,de65de0b033837eb4ade9c1b899c6391,Uber,success,
|
|
140
|
+
https://www.linkedin.com/company/openai,276095f0b5dc46a45ebd9abd339d54c4,OpenAI,success,
|
|
141
|
+
https://www.linkedin.com/company/anthropicresearch,7da27afb4cde929d0cd457ff1646804a,Anthropic,success,
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
**Run summary**
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
Capability: Enrich Company -> Match Company ID
|
|
148
|
+
Rows: 7
|
|
149
|
+
Unit cost: 1 token(s) / Run
|
|
150
|
+
Estimated tokens: 7
|
|
151
|
+
|
|
152
|
+
Summary:
|
|
153
|
+
Completed: 7
|
|
154
|
+
Failed: 0
|
|
155
|
+
Cached: 0
|
|
156
|
+
Tokens used: 7 (estimated 7)
|
|
157
|
+
(balance 964091.01 → 964084.01)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Rows that come back empty are marked `flashrev_enrich_status=not_found` and **not** billed — FlashRev only charges for rows that produce real data.
|
|
161
|
+
|
|
162
|
+
### Inline single-row example
|
|
163
|
+
|
|
164
|
+
Skip the CSV entirely. Useful for spot-checks and shell scripts:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
flashrev-ai-enrich run \
|
|
168
|
+
--capability match_company_id \
|
|
169
|
+
--input company_linkedin=https://www.linkedin.com/company/openai \
|
|
170
|
+
--out /tmp/openai.csv \
|
|
171
|
+
--yes
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Verify Email example
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
flashrev-ai-enrich run \
|
|
178
|
+
--source emails.csv \
|
|
179
|
+
--out emails.verified.csv \
|
|
180
|
+
--capability verify_email \
|
|
181
|
+
--map email=email \
|
|
182
|
+
--output deliverable_email=deliverable_email \
|
|
183
|
+
--output email_type=email_type \
|
|
184
|
+
--output email_provider=email_provider \
|
|
185
|
+
--yes
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
A `deliverable_email=true / email_type=business / email_provider=Google Workspace` response confirms the address is deliverable and from a real corporate domain.
|
|
189
|
+
|
|
190
|
+
## Capabilities
|
|
191
|
+
|
|
192
|
+
The CLI embeds the FlashRev enrichment registry from `enrichment_config.json` and exposes 34 de-duplicated capabilities across:
|
|
193
|
+
|
|
194
|
+
- `Enrich Company`
|
|
195
|
+
- `Enrich Person`
|
|
196
|
+
- `FlashAgent`
|
|
197
|
+
|
|
198
|
+
Contact email and phone enrichment requests are handled by FlashRev backend services and billed as dedicated token actions:
|
|
199
|
+
|
|
200
|
+
- `enrich_email`
|
|
201
|
+
- `enrich_phone`
|
|
202
|
+
|
|
203
|
+
The CLI does not call external data services directly and does not expose backend routing to users.
|
|
204
|
+
|
|
205
|
+
## Data Enrichment Token Costs
|
|
206
|
+
|
|
207
|
+
Dry-run estimates use the FlashRev Data Enrichment token table unless a live quote endpoint is configured.
|
|
208
|
+
|
|
209
|
+
| Action | Cost | Unit |
|
|
210
|
+
|---|---:|---|
|
|
211
|
+
| Verify Phone Number | 1 | Run |
|
|
212
|
+
| Verify Email Address | 1 | Run |
|
|
213
|
+
| Enrich Prospect (General) | 1 | Run |
|
|
214
|
+
| Enrich Company (General) | 1 | Run |
|
|
215
|
+
| Enrich FlashAgent (General) | 1 | Run |
|
|
216
|
+
| Get Company CEO | 6 | Run |
|
|
217
|
+
| Get Company Executives | 6 | Run |
|
|
218
|
+
| Get Location | 3 | Run |
|
|
219
|
+
| Get Current Company Name | 8 | Run |
|
|
220
|
+
| Get Emails | 2 | Run |
|
|
221
|
+
| Get Job Title | 5 | Run |
|
|
222
|
+
| Get Phones | 8 | Run |
|
|
223
|
+
| Match Person Linkedin URL | 2 | Run |
|
|
224
|
+
| LinkedIn All Education Experiences | 3 | Run |
|
|
225
|
+
| LinkedIn All Work Experiences | 2 | Run |
|
|
226
|
+
| Deep Research | 3 | Run |
|
|
227
|
+
| LinkedIn Basic Info | 2 | Run |
|
|
228
|
+
| Google Search | 2 | Run |
|
|
229
|
+
| Custom API Request | 2 | Run |
|
|
230
|
+
| Enrich Company Profile (General) | 5 | Run |
|
|
231
|
+
| FlashRev Deep Research | 2 | Run |
|
|
232
|
+
|
|
233
|
+
Dynamic FlashAgent capabilities such as LLM and scrape/extract may use explicit output fields:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
flashrev-ai-enrich run \
|
|
237
|
+
--source leads.csv \
|
|
238
|
+
--out research.csv \
|
|
239
|
+
--capability run_llm \
|
|
240
|
+
--map prompt=prompt \
|
|
241
|
+
--output summary=summary \
|
|
242
|
+
--output confidence=confidence \
|
|
243
|
+
--yes
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Job Files
|
|
247
|
+
|
|
248
|
+
Job files mirror the SaaS Add Enrichment model:
|
|
249
|
+
|
|
250
|
+
```json
|
|
251
|
+
{
|
|
252
|
+
"capability": "get_company_profile",
|
|
253
|
+
"inputMapping": {
|
|
254
|
+
"company_name": "company",
|
|
255
|
+
"company_website": "website"
|
|
256
|
+
},
|
|
257
|
+
"outputs": {
|
|
258
|
+
"flashrev_company_id": "company_id",
|
|
259
|
+
"company_industry": "industry"
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
`inputMapping` maps FlashRev input fields to CSV columns. `outputs` maps output CSV column names to FlashRev response fields.
|
|
265
|
+
|
|
266
|
+
## Prompt Mode
|
|
267
|
+
|
|
268
|
+
Prompt mode lets a human describe the enrichment intent in plain language and let the CLI pick a capability automatically. Under the hood, the CLI sends the prompt + CSV column names + the live capability registry to FlashRev's `run_llm` capability and asks for a JSON routing decision (`funcName` / `inputMapping` / `outputMapping`). Routing costs **1 extra token** per invocation, on top of the per-row enrichment cost.
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
flashrev-ai-enrich run --source leads.csv --out leads.enriched.csv \
|
|
272
|
+
--prompt "fill missing business emails" --yes
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Output before the regular dry-run summary:
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
Routing prompt via run_llm (1 token)...
|
|
279
|
+
|
|
280
|
+
Routing decision:
|
|
281
|
+
capability: enrich_email
|
|
282
|
+
inputMapping: first_name=first_name, last_name=last_name, company_name=company
|
|
283
|
+
outputMapping: verified_business_email=verified_business_email
|
|
284
|
+
reasoning: User asked to fill business emails; enrich_email returns verified business emails.
|
|
285
|
+
routing cost: 1 token
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
You can override any inferred mapping with explicit `--map` / `--output` flags — those win over the LLM's choice. If `--capability` is also passed, `--prompt` is dropped with a stderr warning (explicit flag wins).
|
|
289
|
+
|
|
290
|
+
If the LLM fails to pick a capability (non-JSON answer, unknown `funcName`, or `run_llm` itself returns an error), the CLI exits non-zero with the LLM's `reasoning` shown, and the user retries with explicit `--capability`. No enrichment rows run.
|
|
291
|
+
|
|
292
|
+
Agents calling this CLI (OpenClaw, Claude Code, CrewAI, etc.) should usually skip `--prompt` and pass `--capability` directly — they already know which capability to use from `flashrev-ai-enrich schema`. `--prompt` is intended for ad-hoc human use.
|
|
293
|
+
|
|
294
|
+
## Dry Run
|
|
295
|
+
|
|
296
|
+
`dry-run` validates the CSV and job configuration, then estimates:
|
|
297
|
+
|
|
298
|
+
- row count
|
|
299
|
+
- estimated API calls
|
|
300
|
+
- estimated token usage
|
|
301
|
+
- estimate source
|
|
302
|
+
|
|
303
|
+
If FlashRev exposes a quote endpoint, configure it with `init --quote-path` or in config. Otherwise the CLI uses local default per-row estimates. Dry-run does not call the unified enrichment endpoint.
|
|
304
|
+
|
|
305
|
+
## API Contract Assumptions
|
|
306
|
+
|
|
307
|
+
The CLI calls a unified FlashRev enrichment endpoint. Backend developers should only need to configure endpoint paths and align the payload/response envelope. The default enrichment request shape is:
|
|
308
|
+
|
|
309
|
+
```json
|
|
310
|
+
{
|
|
311
|
+
"mode": "prompt",
|
|
312
|
+
"prompt": "fill missing emails",
|
|
313
|
+
"capability_id": "get_company_profile",
|
|
314
|
+
"input": {
|
|
315
|
+
"company_name": "Acme"
|
|
316
|
+
},
|
|
317
|
+
"requested_outputs": ["company_id", "industry"],
|
|
318
|
+
"row_index": 1,
|
|
319
|
+
"source": "flashrev-ai-enrich"
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
The response may return fields under `values`, `data.values`, `data`, `result`, `results`, `output`, or the response root. Once FlashRev provides the final OpenAPI/curl contract, backend developers should only need to update config endpoint paths or the adapter in `src/flashrev-client.js`.
|
|
324
|
+
|
|
325
|
+
## Quality Gates
|
|
326
|
+
|
|
327
|
+
- `flashrev-ai-enrich --help` is complete and copyable.
|
|
328
|
+
- `schema --json` exposes only user-facing capability metadata.
|
|
329
|
+
- `dry-run` never sends a real FlashRev enrichment request.
|
|
330
|
+
- `token-history` supports date filters for auditing token deductions.
|
|
331
|
+
- Real `run` blocks when FlashRev token balance is `0` and tells the user to recharge.
|
|
332
|
+
- `run` writes a new CSV and never overwrites the source unless the user explicitly points `--out` there.
|
|
333
|
+
- Row-level failures write `flashrev_enrich_status=failed` and `flashrev_enrich_error` without stopping the batch.
|
|
334
|
+
- `npm test` and `npm pack` pass before publish.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { main } from "../src/cli.js";
|
|
3
|
+
|
|
4
|
+
main(process.argv.slice(2)).catch((error) => {
|
|
5
|
+
const message = error && error.message ? error.message : String(error);
|
|
6
|
+
// ai-mode (set by main() based on --ai-mode flag or FLASHREV_ENRICH_AI_MODE=1) emits
|
|
7
|
+
// a structured JSON envelope to stderr so upstream agents can parse errors reliably.
|
|
8
|
+
if (process.env.__FLASHREV_AI_MODE === "1") {
|
|
9
|
+
const payload = {
|
|
10
|
+
error: {
|
|
11
|
+
code: error?.code || (error?.status ? `HTTP_${error.status}` : "UNKNOWN"),
|
|
12
|
+
message,
|
|
13
|
+
remediation: error?.hint || undefined
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
console.error(JSON.stringify(payload));
|
|
17
|
+
} else {
|
|
18
|
+
console.error(`Error: ${message}`);
|
|
19
|
+
if (error && error.hint) console.error(`Hint: ${error.hint}`);
|
|
20
|
+
if (process.env.FLASHREV_ENRICH_DEBUG && error.stack) console.error(error.stack);
|
|
21
|
+
}
|
|
22
|
+
process.exitCode = 1;
|
|
23
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"capability": "get_company_profile",
|
|
3
|
+
"inputMapping": {
|
|
4
|
+
"company_name": "company",
|
|
5
|
+
"company_website": "website",
|
|
6
|
+
"company_linkedin": "linkedin"
|
|
7
|
+
},
|
|
8
|
+
"outputs": {
|
|
9
|
+
"flashrev_company_id": "company_id",
|
|
10
|
+
"company_industry": "industry",
|
|
11
|
+
"company_employees": "employees",
|
|
12
|
+
"company_linkedin_url": "company_linkedin_url"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
email,first_name,last_name,company,website,linkedin
|
|
2
|
+
ada@example.com,Ada,Lovelace,Acme AI,https://acme.example,https://www.linkedin.com/company/acme
|
|
3
|
+
ben@example.com,Ben,Stone,Beacon Robotics,https://beacon.example,https://www.linkedin.com/company/beacon
|
|
4
|
+
casey@example.com,Casey,River,Northstar Data,https://northstar.example,https://www.linkedin.com/company/northstar
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"capability": "enrich_email",
|
|
3
|
+
"inputMapping": {
|
|
4
|
+
"email": "email",
|
|
5
|
+
"first_name": "first_name",
|
|
6
|
+
"last_name": "last_name",
|
|
7
|
+
"company_name": "company"
|
|
8
|
+
},
|
|
9
|
+
"outputs": {
|
|
10
|
+
"verified_business_email": "verified_business_email",
|
|
11
|
+
"all_verified_business_emails": "all_verified_business_emails"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
company_linkedin,company_id,company_name,flashrev_enrich_status,flashrev_enrich_error
|
|
2
|
+
https://www.linkedin.com/company/microsoft,569b2d141f922c03fd911a9f550fe703,Microsoft,success,
|
|
3
|
+
https://www.linkedin.com/company/google,d0ae7d1e14de9efabb4f05d257310511,Google,success,
|
|
4
|
+
https://www.linkedin.com/company/nvidia,c79327dc1ff953ce986cd90bad2efd85,NVIDIA,success,
|
|
5
|
+
https://www.linkedin.com/company/salesforce,56aff5826708380c256230153a49b1c3,Salesforce,success,
|
|
6
|
+
https://www.linkedin.com/company/uber-com,de65de0b033837eb4ade9c1b899c6391,Uber,success,
|
|
7
|
+
https://www.linkedin.com/company/openai,276095f0b5dc46a45ebd9abd339d54c4,OpenAI,success,
|
|
8
|
+
https://www.linkedin.com/company/anthropicresearch,7da27afb4cde929d0cd457ff1646804a,Anthropic,success,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
company_linkedin
|
|
2
|
+
https://www.linkedin.com/company/microsoft
|
|
3
|
+
https://www.linkedin.com/company/google
|
|
4
|
+
https://www.linkedin.com/company/nvidia
|
|
5
|
+
https://www.linkedin.com/company/salesforce
|
|
6
|
+
https://www.linkedin.com/company/uber-com
|
|
7
|
+
https://www.linkedin.com/company/openai
|
|
8
|
+
https://www.linkedin.com/company/anthropicresearch
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "flashrev-ai-enrich",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "FlashRev Lists Enrichment CLI for CSV-based company, person, and FlashAgent enrichment.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"flashrev-ai-enrich": "./bin/flashrev-ai-enrich.js",
|
|
8
|
+
"flashrev-enrich": "./bin/flashrev-ai-enrich.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin",
|
|
12
|
+
"src",
|
|
13
|
+
"examples",
|
|
14
|
+
"skills",
|
|
15
|
+
"README.md",
|
|
16
|
+
"CHANGELOG.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "node --test",
|
|
21
|
+
"pack:local": "npm pack",
|
|
22
|
+
"pack:npm": "mkdir -p dist && npm pack --pack-destination dist",
|
|
23
|
+
"pack:skill": "mkdir -p dist && tar -czf dist/flashrev-ai-enrich-skill-$npm_package_version.tgz -C skills flashrev-ai-enrich",
|
|
24
|
+
"pack:all": "npm run pack:npm && npm run pack:skill"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=20.0.0"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"flashrev",
|
|
31
|
+
"enrichment",
|
|
32
|
+
"sales",
|
|
33
|
+
"csv",
|
|
34
|
+
"cli",
|
|
35
|
+
"ai-agent"
|
|
36
|
+
],
|
|
37
|
+
"author": "Flashlabs",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
}
|
|
42
|
+
}
|