consulti 0.1.0 → 0.2.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 +6 -1
- package/dist/commands.js +2 -2
- package/dist/flags.js +6 -2
- package/dist/generated/endpoints.json +93 -0
- package/dist/manifest.js +5 -3
- package/dist/param.js +1 -0
- package/dist/skill.js +4 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -66,6 +66,10 @@ Every command is named after an endpoint id. Path parameters are positional, oth
|
|
|
66
66
|
| `lists-get` | `lists` | Get your saved lists (free) |
|
|
67
67
|
| `lists-create` | | Create a list (free) |
|
|
68
68
|
| `lists-add-leads <id>` | | Add leads to a list |
|
|
69
|
+
| `placement-tests-create` | | Create an inbox placement test (1 lead credit, Pro plan or higher) |
|
|
70
|
+
| `placement-tests-sent <id>` | | Start checking a draft placement test (free) |
|
|
71
|
+
| `placement-tests-get <id>` | | Get a placement test (free) |
|
|
72
|
+
| `placement-tests-list` | | List your placement tests (free) |
|
|
69
73
|
|
|
70
74
|
Also: `consulti login`, `consulti logout`, `consulti whoami`, `consulti skill`, `--version` and `--help`. Run `consulti <command> --help` for the flags of one command.
|
|
71
75
|
|
|
@@ -73,6 +77,7 @@ Flags:
|
|
|
73
77
|
|
|
74
78
|
- List flags take repeated values or a comma-separated list: `--titles CEO,CTO` or `--titles CEO --titles CTO`.
|
|
75
79
|
- Boolean flags are `--flag` and `--no-flag`.
|
|
80
|
+
- On `placement-tests-create` the email body flag is `--email-body`, because `--body` already means the full JSON request body.
|
|
76
81
|
- camelCase and snake_case parameters become kebab-case flags (`businessIds` is `--business-ids`, `linkedin_url` is `--linkedin-url`).
|
|
77
82
|
- `--body <json|@file|->` sends a full JSON body on POST commands. Explicit flags override keys in the body. GET commands (`credits`, `meta`, `lists`) take no `--body`.
|
|
78
83
|
- Use `--body` for a list value that itself contains a comma. Empty list values are an error (exit 2), numbers must be plain decimals, and an empty, `.` or `..` path argument is exit 2.
|
|
@@ -101,7 +106,7 @@ Errors go to stderr as one JSON object:
|
|
|
101
106
|
|
|
102
107
|
## Billing
|
|
103
108
|
|
|
104
|
-
The CLI never retries. A retried search or verification is billed again. If a request ends with exit code 6 (timeout or dropped connection), it may still have been charged: run `consulti credits` before you try again. Any other 5xx on a billable command (for example a JSON 500 `refund_unconfirmed`) is exit 1 with the same advice. Searches wait up to 130 seconds, everything else
|
|
109
|
+
The CLI never retries. A retried search or verification is billed again. If a request ends with exit code 6 (timeout or dropped connection), it may still have been charged: run `consulti credits` before you try again. Any other 5xx on a billable command (for example a JSON 500 `refund_unconfirmed`) is exit 1 with the same advice. Searches wait up to 130 seconds, everything else 310.
|
|
105
110
|
|
|
106
111
|
## For coding agents
|
|
107
112
|
|
package/dist/commands.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Option } from "commander";
|
|
|
3
3
|
import { call } from "./client.js";
|
|
4
4
|
import { requireKey } from "./config.js";
|
|
5
5
|
import { usageError } from "./errors.js";
|
|
6
|
-
import { attributeFor,
|
|
6
|
+
import { attributeFor, optionsFor, paramFlag } from "./flags.js";
|
|
7
7
|
import { ALIASES, JSONL_IDS, timeoutFor } from "./manifest.js";
|
|
8
8
|
import { printJson, printJsonl } from "./output.js";
|
|
9
9
|
async function readBody(ctx, spec) {
|
|
@@ -49,7 +49,7 @@ async function run(ctx, ep, positional, cmd) {
|
|
|
49
49
|
}
|
|
50
50
|
for (const p of ep.params) {
|
|
51
51
|
if (p.required && payload[p.name] === undefined) {
|
|
52
|
-
throw usageError(`Missing required flag --${
|
|
52
|
+
throw usageError(`Missing required flag --${paramFlag(p)} (${p.name}).`, "missing_required");
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
const key = ep.noAuth ? undefined : requireKey(ctx).key;
|
package/dist/flags.js
CHANGED
|
@@ -6,6 +6,10 @@ export function flagName(name) {
|
|
|
6
6
|
.replace(/([a-z0-9])([A-Z])/g, "$1-$2")
|
|
7
7
|
.toLowerCase();
|
|
8
8
|
}
|
|
9
|
+
/** The flag name for a param: its override when the manifest sets one, otherwise derived from the wire name. */
|
|
10
|
+
export function paramFlag(p) {
|
|
11
|
+
return p.flag ?? flagName(p.name);
|
|
12
|
+
}
|
|
9
13
|
function toNumber(value) {
|
|
10
14
|
const trimmed = value.trim();
|
|
11
15
|
const n = Number(trimmed);
|
|
@@ -32,7 +36,7 @@ function describe(p) {
|
|
|
32
36
|
}
|
|
33
37
|
/** Commander options for one param. Booleans get `--flag` and `--no-flag`. */
|
|
34
38
|
export function optionsFor(p) {
|
|
35
|
-
const flag = `--${
|
|
39
|
+
const flag = `--${paramFlag(p)}`;
|
|
36
40
|
const desc = describe(p);
|
|
37
41
|
switch (p.type) {
|
|
38
42
|
case "string":
|
|
@@ -44,7 +48,7 @@ export function optionsFor(p) {
|
|
|
44
48
|
case "number[]":
|
|
45
49
|
return [new Option(`${flag} <numbers>`, desc).argParser(collect(toNumber))];
|
|
46
50
|
case "boolean":
|
|
47
|
-
return [new Option(flag, desc), new Option(`--no-${
|
|
51
|
+
return [new Option(flag, desc), new Option(`--no-${paramFlag(p)}`, `Same as ${flag} false.`)];
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
54
|
/** The attribute commander stores a param's value under. */
|
|
@@ -232,6 +232,99 @@
|
|
|
232
232
|
}
|
|
233
233
|
]
|
|
234
234
|
},
|
|
235
|
+
{
|
|
236
|
+
"id": "placement-tests-create",
|
|
237
|
+
"method": "POST",
|
|
238
|
+
"path": "/placement-tests",
|
|
239
|
+
"title": "Create an inbox placement test",
|
|
240
|
+
"description": "Create an inbox placement test. Checking starts when the test is created, so there is no second call to make: send one email from the mailbox you want to test to every seed address within 15 minutes, with the test code anywhere in the subject or the body, then poll GET /placement-tests/{id}. Results usually arrive within about 2 minutes of sending. A test can complete before expires_at, 2 minutes after the last arrival, with the seeds still missing reported as not found. Until expires_at, such a seed is corrected if the email reaches it, and the score is rebuilt. Results are final at expires_at. If the test could not be started, the response says status \"draft\" with a next_step: call POST /placement-tests/{id}/sent after sending. If that draft already has a sent_at, its window runs from sent_at and closes at expires_at. At most 3 of your tests can be checking at once; another create is a 429 with code too_many_open_tests and a Retry-After header, is not charged, and is safe to retry.",
|
|
241
|
+
"tier": "pro+",
|
|
242
|
+
"credits": "1 lead credit per test, charged when the test is created. Refunded if creation fails. Not refunded for poor placement results. A retried request creates, and charges for, a new test. An `Idempotency-Key` header is accepted but has no effect at present, so de-duplicate on your side rather than relying on replay.",
|
|
243
|
+
"noAuth": false,
|
|
244
|
+
"billable": true,
|
|
245
|
+
"inMcp": true,
|
|
246
|
+
"pathParams": [],
|
|
247
|
+
"params": [
|
|
248
|
+
{
|
|
249
|
+
"name": "name",
|
|
250
|
+
"type": "string",
|
|
251
|
+
"required": false,
|
|
252
|
+
"desc": "Optional label for the test (max 120 characters). Defaults to the subject."
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
"name": "subject",
|
|
256
|
+
"type": "string",
|
|
257
|
+
"required": false,
|
|
258
|
+
"desc": "Optional subject of the email you will send (max 998 characters). Used for the content check when no seed returns a body."
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"name": "body",
|
|
262
|
+
"type": "string",
|
|
263
|
+
"required": false,
|
|
264
|
+
"desc": "Optional body of the email you will send (max 100,000 characters), for the same purpose.",
|
|
265
|
+
"flag": "email-body"
|
|
266
|
+
}
|
|
267
|
+
]
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"id": "placement-tests-sent",
|
|
271
|
+
"method": "POST",
|
|
272
|
+
"path": "/placement-tests/{id}/sent",
|
|
273
|
+
"title": "Start checking a draft placement test",
|
|
274
|
+
"description": "Optional. A test created through the API is already checking, and calling this on a checking test changes nothing: it returns the current status and sent_at, so it can never extend the window. Call it when the create response said status \"draft\", once the email has gone out; checking then starts. A completed test is a 409 with code already_finished; create a new test to check again. A failed test is re-checked for free, but only while fewer than 3 of your tests are checking; otherwise it is the same 429 too_many_open_tests as a create, with Retry-After, and the test stays failed. A test whose creation failed and was refunded is a 409 with code not_charged and cannot be started. Another account's test, or an id that does not exist, is a 404.",
|
|
275
|
+
"tier": "pro+",
|
|
276
|
+
"credits": "Free. The test was charged when it was created.",
|
|
277
|
+
"noAuth": false,
|
|
278
|
+
"billable": false,
|
|
279
|
+
"inMcp": true,
|
|
280
|
+
"pathParams": [
|
|
281
|
+
"id"
|
|
282
|
+
],
|
|
283
|
+
"params": []
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"id": "placement-tests-get",
|
|
287
|
+
"method": "GET",
|
|
288
|
+
"path": "/placement-tests/{id}",
|
|
289
|
+
"title": "Get a placement test",
|
|
290
|
+
"description": "Status, per-seed placement, a summary of where the email landed, and the 0 to 10 score and full report once built. Each seed shows where the email landed (inbox, spam, promotions and other tabs, not_found), delivery times, and the SPF, DKIM and DMARC verdicts that seed recorded. report_status is pending while the report is being built, ready once it is stored, and unavailable when it could not be built. Another account's test, or an id that does not exist, is a 404.",
|
|
291
|
+
"tier": "pro+",
|
|
292
|
+
"credits": "Free.",
|
|
293
|
+
"noAuth": false,
|
|
294
|
+
"billable": false,
|
|
295
|
+
"inMcp": true,
|
|
296
|
+
"pathParams": [
|
|
297
|
+
"id"
|
|
298
|
+
],
|
|
299
|
+
"params": []
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"id": "placement-tests-list",
|
|
303
|
+
"method": "GET",
|
|
304
|
+
"path": "/placement-tests",
|
|
305
|
+
"title": "List placement tests",
|
|
306
|
+
"description": "Your placement tests, newest first. Only tests your account created are listed.",
|
|
307
|
+
"tier": "pro+",
|
|
308
|
+
"credits": "Free.",
|
|
309
|
+
"noAuth": false,
|
|
310
|
+
"billable": false,
|
|
311
|
+
"inMcp": true,
|
|
312
|
+
"pathParams": [],
|
|
313
|
+
"params": [
|
|
314
|
+
{
|
|
315
|
+
"name": "page",
|
|
316
|
+
"type": "number",
|
|
317
|
+
"required": false,
|
|
318
|
+
"desc": "Page number, from 1 (default 1)."
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"name": "size",
|
|
322
|
+
"type": "number",
|
|
323
|
+
"required": false,
|
|
324
|
+
"desc": "Tests per page, 1 to 100 (default 25)."
|
|
325
|
+
}
|
|
326
|
+
]
|
|
327
|
+
},
|
|
235
328
|
{
|
|
236
329
|
"id": "instagram-search",
|
|
237
330
|
"method": "POST",
|
package/dist/manifest.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
// Root tests import this module, and CI's root test shards do not install cli/ dependencies:
|
|
2
|
+
// keep its runtime imports to node built-ins (param.js holds only types).
|
|
1
3
|
import { readFileSync } from "node:fs";
|
|
2
4
|
/** Same relative location from src/ (tests) and dist/ (published): the build script copies the JSON. */
|
|
3
5
|
export function loadManifest() {
|
|
@@ -10,8 +12,8 @@ export const ALIASES = {
|
|
|
10
12
|
meta: "meta-filter",
|
|
11
13
|
};
|
|
12
14
|
export const JSONL_IDS = ["leads-search", "instagram-search"];
|
|
13
|
-
export const SEARCH_TIMEOUT_MS = 130_000;
|
|
14
|
-
export const DEFAULT_TIMEOUT_MS =
|
|
15
|
+
export const SEARCH_TIMEOUT_MS = 130_000; // leads-search maxDuration is 120 s
|
|
16
|
+
export const DEFAULT_TIMEOUT_MS = 310_000; // routes that export no maxDuration run under Vercel's 300 s default
|
|
15
17
|
export function timeoutFor(id) {
|
|
16
|
-
return
|
|
18
|
+
return id === "leads-search" ? SEARCH_TIMEOUT_MS : DEFAULT_TIMEOUT_MS;
|
|
17
19
|
}
|
package/dist/param.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/skill.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { SETTINGS_URL } from "./context.js";
|
|
2
2
|
import { EXIT_TABLE } from "./exit-codes.js";
|
|
3
|
-
import {
|
|
3
|
+
import { paramFlag } from "./flags.js";
|
|
4
4
|
import { ALIASES } from "./manifest.js";
|
|
5
5
|
export function buildSkill(endpoints) {
|
|
6
6
|
const commands = endpoints.map((ep) => {
|
|
7
7
|
const alias = Object.entries(ALIASES).find(([, target]) => target === ep.id)?.[0];
|
|
8
8
|
const positional = ep.pathParams.map((n) => ` <${n}>`).join("");
|
|
9
|
-
const required = ep.params.filter((p) => p.required).map((p) => ` --${
|
|
9
|
+
const required = ep.params.filter((p) => p.required).map((p) => ` --${paramFlag(p)} <${p.type}>`).join("");
|
|
10
10
|
const aka = alias ? ` Alias: \`${alias}\`.` : "";
|
|
11
11
|
return `- \`consulti ${ep.id}${positional}${required}\` ${ep.title}.${aka} ${ep.billable ? "Billed." : "Free."}`;
|
|
12
12
|
});
|
|
@@ -24,8 +24,8 @@ description: Use the consulti command line to verify emails, search and enrich B
|
|
|
24
24
|
|
|
25
25
|
## Auth
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
Ask the user to run \`consulti login\` themselves and paste the key at its hidden prompt. It is saved to a file only they can read. Keys are created at ${SETTINGS_URL}.
|
|
28
|
+
Never put a key in a command, unless the user's own prompt hands you the key; then pipe it to \`consulti login\` on stdin, never as an argument. Use \`CONSULTI_API_KEY\` only in CI and on servers.
|
|
29
29
|
|
|
30
30
|
## Commands
|
|
31
31
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "consulti",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Command-line client for the Consulti.ai API: email verification, B2B lead search and enrichment, Instagram search, lists and credits. JSON output and stable exit codes for scripts and AI agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|