@delegance/cli 0.2.1 → 0.3.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/README.md +169 -64
- package/dist/bin/delegance.js +702 -217
- package/dist/index.d.ts +17 -3
- package/dist/index.js +701 -214
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -1,78 +1,164 @@
|
|
|
1
1
|
# @delegance/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Get commercial insurance quotes from your terminal. Quote, bind, and pay; read your policies; generate certificates; quote bonds; file claims. Works from AI coding agents too.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx -y @delegance/cli quote start --demo
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
The demo runs on sample data. It sends nothing to Delegance or to any carrier.
|
|
4
10
|
|
|
5
11
|
## Install
|
|
6
12
|
|
|
7
13
|
```bash
|
|
8
|
-
#
|
|
14
|
+
# Run without installing
|
|
15
|
+
npx -y @delegance/cli --help
|
|
16
|
+
|
|
17
|
+
# Or install globally
|
|
9
18
|
npm install -g @delegance/cli
|
|
10
19
|
delegance --version
|
|
11
|
-
|
|
12
|
-
# Or run without installing
|
|
13
|
-
npx @delegance/cli --help
|
|
14
20
|
```
|
|
15
21
|
|
|
22
|
+
Every `delegance` below is `npx -y @delegance/cli` if you did not install globally. The `-y` skips npx's "Ok to proceed?" prompt, which would hang a script or an agent.
|
|
23
|
+
|
|
16
24
|
Requires Node 20.19 or newer. Older versions cannot load the CLI's ESM-only dependencies.
|
|
17
25
|
|
|
18
26
|
## Availability
|
|
19
27
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
- **A licensed Delegance broker reviews every bind.** A bind request never charges your card and never binds coverage by itself.
|
|
24
|
-
|
|
25
|
-
Try the flow first with `delegance quote start --demo`. It runs on sample data and sends nothing to Delegance or to any carrier.
|
|
28
|
+
- Quoting is open to every account. Run `delegance signup` and quote the same day.
|
|
29
|
+
- Bind, pay, bonds, and claims are live from the terminal.
|
|
30
|
+
- A licensed Delegance broker approves every bind before coverage starts. A bind request never charges your card.
|
|
26
31
|
|
|
27
|
-
##
|
|
32
|
+
## Get a quote
|
|
28
33
|
|
|
29
34
|
```bash
|
|
30
|
-
# See the whole flow on sample data first. Nothing leaves your machine.
|
|
31
|
-
delegance quote start --demo
|
|
32
|
-
|
|
33
35
|
# 1. Sign up. We email you a confirm link; the key lands in ~/.delegance/credentials.
|
|
34
36
|
delegance signup
|
|
35
37
|
|
|
36
38
|
# 2. Quote general liability and workers comp. Answer the carriers' questions.
|
|
37
39
|
delegance quote start --coverage gl,wc
|
|
38
40
|
|
|
39
|
-
# 3. Request a bind on the offer you want.
|
|
41
|
+
# 3. Request a bind on the offer you want. A broker approves it.
|
|
40
42
|
delegance bind <submission-id> <offer-id>
|
|
41
43
|
|
|
42
|
-
# 4. Pay once
|
|
44
|
+
# 4. Pay once the broker approves the bind.
|
|
43
45
|
delegance pay
|
|
44
46
|
```
|
|
45
47
|
|
|
46
48
|
What happens at each step:
|
|
47
49
|
|
|
48
50
|
- **Signup** creates your company, emails a confirm link, and waits for the click. It then stores a new API key in `~/.delegance/credentials` (mode 600). If you stop it with Ctrl-C, `delegance verify` resumes.
|
|
49
|
-
- **Quoting** asks the carriers' underwriting questions in the terminal
|
|
50
|
-
- **
|
|
51
|
+
- **Quoting** asks the carriers' underwriting questions in the terminal. Answers we already know from your account are filled in for you to confirm. Yes/no questions come as one checklist: space to select, Enter to continue.
|
|
52
|
+
- **No instant carrier?** The CLI asks the few application questions a broker needs and hands the request to a Delegance broker, who places it with a market that quotes by hand. Ctrl-C stops the questions and sends what you answered.
|
|
53
|
+
- **Binding** files a request. A Delegance broker approves it, and you get an email when payment is ready.
|
|
51
54
|
- **Paying** opens a Stripe checkout link.
|
|
52
|
-
- **Bonds** (`delegance bond quote`) price in the terminal; you buy the bond on the surety's own page.
|
|
53
|
-
- **Claims** (`delegance claim file`) need you to accept the claims disclaimer once in the portal.
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
Coverages for `--coverage`: `gl`, `wc`, `bop`, `cyber`, `pl` (E&O), `auto`, `property`, `umbrella`.
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
### What a quote looks like
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
```
|
|
61
|
+
Coverage starts Nov 1, 2026
|
|
62
|
+
Best price per coverage:
|
|
63
|
+
General Liability Carrier A $612/yr
|
|
64
|
+
Workers' Comp Carrier C $1,184/yr
|
|
65
|
+
|
|
66
|
+
Carrier Coverage Premium/yr Limits Deductible Status Offer
|
|
67
|
+
───────── ───────────────── ────────── ─────────────────────────────────── ────────── ──────── ──────
|
|
68
|
+
Carrier A General Liability $612 $1M per occurrence / $2M aggregate $500 Quoted demo-1
|
|
69
|
+
Carrier B General Liability $748 $1M per occurrence / $2M aggregate $1,000 Quoted demo-2
|
|
70
|
+
Carrier C Workers' Comp $1,184 Statutory / $1M employers liability None Quoted demo-3
|
|
71
|
+
Carrier D Workers' Comp - - - Declined demo-4
|
|
72
|
+
|
|
73
|
+
3 of 4 carriers priced.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
That table is the `--demo` sample. A real quote names the carriers. The best price is per coverage: a GL premium is never compared with a WC one. A real quote prints one bind command per coverage. `-` means the carrier did not send that field.
|
|
77
|
+
|
|
78
|
+
## Sign in on an existing account
|
|
60
79
|
|
|
61
80
|
```bash
|
|
62
|
-
# 1. Authenticate. Approve this terminal in the portal when the browser opens.
|
|
63
81
|
delegance auth login
|
|
82
|
+
```
|
|
64
83
|
|
|
65
|
-
|
|
66
|
-
delegance onboarding status
|
|
84
|
+
It opens the portal, you approve the terminal there, and the key lands in `~/.delegance/credentials`. Other ways in:
|
|
67
85
|
|
|
68
|
-
|
|
69
|
-
delegance
|
|
86
|
+
- `delegance auth login --no-browser` prints the approval link instead of opening a browser.
|
|
87
|
+
- `delegance auth login --key <key>` stores a key you created in the portal.
|
|
88
|
+
- `DELEGANCE_API_KEY=<key>` overrides the stored key for one shell.
|
|
89
|
+
|
|
90
|
+
Keys from `signup` and `auth login` expire after 90 days without use. `delegance auth status` shows the date; `delegance auth refresh` extends it.
|
|
91
|
+
|
|
92
|
+
## Use it from an AI agent
|
|
93
|
+
|
|
94
|
+
Claude Code, Codex, Gemini CLI, or any coding agent can run the CLI. Open the agent in a folder with your insurance documents and ask it to get you a quote with `npx -y @delegance/cli`.
|
|
95
|
+
|
|
96
|
+
How the CLI behaves without a terminal:
|
|
97
|
+
|
|
98
|
+
- It never waits on a prompt. With no TTY and no `--answers` file, `quote start` exits 1 with "No terminal to ask the questions in."
|
|
99
|
+
- `--json` without `--answers` prints the session and its questions as JSON, then stops: `{ "submissionId", "sessionVersion", "questions": [...] }`.
|
|
100
|
+
- `signup` without a TTY needs every field as a flag: `--email --business --first --last --industry --size --street --city --state --zip`.
|
|
101
|
+
- `auth login` prints the approval link; a person approves it in the browser.
|
|
102
|
+
- Exit code `0` means success; `1` means an error. Errors print the server trace id.
|
|
103
|
+
- In `--json` mode stdout stays parseable. Progress and hints go to stderr.
|
|
104
|
+
|
|
105
|
+
The scripted quote flow:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# 1. Start the session and save the questions
|
|
109
|
+
npx -y @delegance/cli quote start --coverage gl --json > session.json
|
|
110
|
+
|
|
111
|
+
# 2. Write answers.json (keys are question ids), then file it
|
|
112
|
+
npx -y @delegance/cli quote submit "$(jq -r .submissionId session.json)" \
|
|
113
|
+
--session-version "$(jq -r .sessionVersion session.json)" \
|
|
114
|
+
--answers answers.json --idempotency-key "gl-$(date +%Y%m%d)" --json
|
|
115
|
+
|
|
116
|
+
# 3. Read premiums later
|
|
117
|
+
npx -y @delegance/cli quote status <submission-id> --wait --json
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Or do it in one call when you already know the question ids: `quote start --coverage gl --answers answers.json --json`.
|
|
121
|
+
|
|
122
|
+
`answers.json` format:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"annual_revenue": 850000,
|
|
127
|
+
"employees": 6,
|
|
128
|
+
"delivery": "no",
|
|
129
|
+
"claims_5y": "0"
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
- Keys are question `id`s from the session.
|
|
134
|
+
- `yes_no` takes `"yes"` or `"no"`. `number`, `currency`, `percentage` take a number. `select` takes one option `value`. Other types take text.
|
|
135
|
+
- A question you leave out uses its `prefill` (data from your own account). A `suggested` value is a guess and counts only if you send it.
|
|
136
|
+
- `showIf` hides a follow-up until its parent answer matches. A hidden question is never required; `requiredIfShown` makes it required while visible.
|
|
137
|
+
- `quote start --answers` checks every answer first and lists every problem at once, with the valid question ids.
|
|
138
|
+
- Reuse the same `--idempotency-key` on a retry of `quote submit`, so a lost response never files twice.
|
|
139
|
+
|
|
140
|
+
When the submit result is `no_carriers`, hand it to a broker:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npx -y @delegance/cli quote handoff <submission-id> --answers acord-answers.json --json
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Without `--answers` (and no TTY) the request goes to the broker as is, and the broker emails for what is missing.
|
|
147
|
+
|
|
148
|
+
If something fails, report it with the context attached (command name, exit code, trace id, versions; never the arguments):
|
|
70
149
|
|
|
71
|
-
|
|
150
|
+
```bash
|
|
151
|
+
npx -y @delegance/cli feedback "quote submit hung on the delivery question" --include-last
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Coverage you already have
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
delegance onboarding status
|
|
158
|
+
delegance doc upload "./policies/*.pdf" --type policy --wait
|
|
72
159
|
delegance policy list
|
|
73
160
|
delegance policy expiring 60
|
|
74
|
-
|
|
75
|
-
# 5. Ask a question about your coverage
|
|
161
|
+
delegance coi generate --interactive
|
|
76
162
|
delegance ask "Does my GL policy cover products liability?"
|
|
77
163
|
```
|
|
78
164
|
|
|
@@ -80,45 +166,78 @@ delegance ask "Does my GL policy cover products liability?"
|
|
|
80
166
|
|
|
81
167
|
| Command | What it does |
|
|
82
168
|
|---------|--------------|
|
|
83
|
-
| `auth` | Log in with an API key, check status, log out |
|
|
84
|
-
| `company` | List, create, and pick the default company |
|
|
85
|
-
| `doc` | Upload documents, check extraction, reprocess, archive |
|
|
86
|
-
| `ask` / `chat` | Ask the Orin assistant about your coverage |
|
|
87
|
-
| `policy` | List policies, show one policy, list what expires soon |
|
|
88
|
-
| `coi` | Generate and list certificates of insurance |
|
|
89
|
-
| `sov` | Upload and track schedules of values |
|
|
90
169
|
| `signup` / `verify` | Create an account and collect an API key from the terminal |
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
170
|
+
| `auth` | Log in (browser approval or key), status, whoami, refresh, log out |
|
|
171
|
+
| `quote` | Instant quotes: `quote start`, `quote submit`, `quote status`, `quote handoff` |
|
|
172
|
+
| `bind` | Request a bind on one offer; a broker approves it |
|
|
93
173
|
| `pay` | List payment requests and open a Stripe checkout link |
|
|
94
|
-
| `
|
|
174
|
+
| `billing` | What you owe and what you paid |
|
|
175
|
+
| `bond` | Surety bond quotes; you buy on the surety's own page |
|
|
95
176
|
| `claim` | File and track claims |
|
|
177
|
+
| `policy` | List policies, show one policy, list what expires soon |
|
|
178
|
+
| `coi` | Generate and list certificates of insurance |
|
|
179
|
+
| `doc` | Upload documents, check extraction, reprocess, archive |
|
|
180
|
+
| `sov` | Upload and track schedules of values |
|
|
181
|
+
| `ask` / `chat` | Ask the Orin assistant about your coverage |
|
|
182
|
+
| `knowledge` | Search notecards and read the facts extracted from a document |
|
|
96
183
|
| `appetite` | Match a business to the carriers that will write it |
|
|
97
184
|
| `lead` | Send a prospect business to Delegance |
|
|
98
|
-
| `knowledge` | Search notecards and read the facts extracted from a document |
|
|
99
185
|
| `onboarding` | Show setup status, send the verification email, wait for a state |
|
|
186
|
+
| `company` | Show your company and set the default |
|
|
187
|
+
| `feedback` / `bug` | Report a bug, an idea, or a question |
|
|
100
188
|
| `usage` | Billing-period usage, daily usage, rate limits |
|
|
101
189
|
| `keys` | List and create API keys, rotate by replacement |
|
|
102
190
|
| `config` | Local settings and profiles |
|
|
103
191
|
|
|
104
192
|
Every command and flag, generated from the CLI itself: [portal.delegancebrokerage.com/docs/cli/commands](https://portal.delegancebrokerage.com/docs/cli/commands). Run `delegance <command> --help` for the same list offline.
|
|
105
193
|
|
|
106
|
-
|
|
194
|
+
`quote request`, `quote list`, `quote get`, `quote wait`, and `quote cancel` belong to the legacy partner queue. Submission there is not live; use `quote start`.
|
|
107
195
|
|
|
108
|
-
|
|
196
|
+
### Bonds and claims
|
|
109
197
|
|
|
110
198
|
```bash
|
|
111
|
-
delegance
|
|
199
|
+
delegance bond quote --state TX --bond "notary"
|
|
200
|
+
delegance bond answer <session-id> --answers bond-answers.json
|
|
201
|
+
delegance bond status <session-id>
|
|
202
|
+
|
|
203
|
+
delegance claim file --description-file what-happened.txt --date 2026-10-01
|
|
204
|
+
delegance claim list
|
|
112
205
|
```
|
|
113
206
|
|
|
114
|
-
|
|
207
|
+
Filing a claim needs a key with the `claims:write` scope. Keys from `signup` and `auth login` carry it for owners and admins. The first time, accept the claims disclaimer in the portal; nobody can accept it for you.
|
|
208
|
+
|
|
209
|
+
### Carrier checkout (fast bind)
|
|
210
|
+
|
|
211
|
+
`delegance bind` also takes `--attest`, `--step-up <id>`, and `--code <code>` for fast bind: you confirm the application answers, and we email a 6-digit code. Fast bind into the carrier's own checkout is not open yet. Until it is, every bind goes to a broker for approval.
|
|
212
|
+
|
|
213
|
+
## API keys
|
|
214
|
+
|
|
215
|
+
- A key belongs to one company. Every command acts on that company. Naming another company's id fails with 403 `company_mismatch`.
|
|
216
|
+
- A new key expires in 90 days unless you pick another expiry with `--expires-in-days`.
|
|
217
|
+
- A key with `write`, `admin`, or `claims:write` must expire within 365 days. `--expires-in-days never` works only for a read-only key.
|
|
218
|
+
- `claims:write` can be created only while signed in to the portal.
|
|
219
|
+
- Delegance staff accounts cannot create client keys.
|
|
220
|
+
- `appetite match` needs `appetite:read`, which neither `read` nor `write` includes.
|
|
221
|
+
- `delegance keys revoke` needs a signed-in portal session. `delegance keys rotate` creates the replacement key and tells you where to revoke the old one.
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
delegance keys create "appetite checks" --scopes read,appetite:read --expires-in-days 90
|
|
225
|
+
```
|
|
115
226
|
|
|
116
|
-
|
|
117
|
-
|
|
227
|
+
## Limits
|
|
228
|
+
|
|
229
|
+
| Limit | What you see |
|
|
230
|
+
|-------|--------------|
|
|
231
|
+
| Quote starts per key per day | 429 `quote_limit_reached` |
|
|
232
|
+
| Per-key daily AI budget | 429 `api_key_budget_exhausted` |
|
|
233
|
+
| Delegance-wide daily API AI budget | 429 `api_budget_exhausted` (try again in an hour) |
|
|
234
|
+
| Requests per minute | 429; `delegance usage limits` shows where you stand |
|
|
235
|
+
|
|
236
|
+
The CLI does not retry a 429. Wait and run the command again.
|
|
118
237
|
|
|
119
238
|
## Configuration
|
|
120
239
|
|
|
121
|
-
The API key lives only in `~/.delegance/credentials` (mode 600). Other settings live in `~/.config/delegance-nodejs/config.json` (mode 600), which holds a masked hint of the key and never the key itself.
|
|
240
|
+
The API key lives only in `~/.delegance/credentials` (mode 600). Other settings live in `~/.config/delegance-nodejs/config.json` (mode 600), which holds a masked hint of the key and never the key itself.
|
|
122
241
|
|
|
123
242
|
| Variable | Description |
|
|
124
243
|
|----------|-------------|
|
|
@@ -127,10 +246,6 @@ The API key lives only in `~/.delegance/credentials` (mode 600). Other settings
|
|
|
127
246
|
| `DEBUG` | Debug output |
|
|
128
247
|
| `VERBOSE` | Verbose output |
|
|
129
248
|
|
|
130
|
-
## Output and exit codes
|
|
131
|
-
|
|
132
|
-
Most commands take `--json` for machine-readable output. Exit code `0` means success and `1` means an error. Errors print the server trace id, which support can look up.
|
|
133
|
-
|
|
134
249
|
## Examples
|
|
135
250
|
|
|
136
251
|
### Bulk upload
|
|
@@ -151,16 +266,6 @@ delegance appetite match --state CA --industry "commercial bakery" \
|
|
|
151
266
|
--coverage general_liability,workers_comp
|
|
152
267
|
```
|
|
153
268
|
|
|
154
|
-
### Scripting
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
#!/bin/bash
|
|
158
|
-
for file in "$@"; do
|
|
159
|
-
result=$(delegance doc upload "$file" --wait --json)
|
|
160
|
-
echo "$(echo "$result" | jq -r '.[0].docId'): $(echo "$result" | jq -r '.[0].status')"
|
|
161
|
-
done
|
|
162
|
-
```
|
|
163
|
-
|
|
164
269
|
## Developing in the monorepo
|
|
165
270
|
|
|
166
271
|
Inside the monorepo the CLI resolves the SDK from the sibling source (`"@delegance/sdk": "file:../sdk"`). Build the SDK first:
|