@delegance/cli 0.2.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/LICENSE +21 -0
- package/README.md +178 -0
- package/dist/bin/delegance.d.ts +1 -0
- package/dist/bin/delegance.js +4314 -0
- package/dist/index.d.ts +300 -0
- package/dist/index.js +4373 -0
- package/package.json +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Delegance Inc.
|
|
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,178 @@
|
|
|
1
|
+
# @delegance/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for the Delegance Brokerage platform: upload policies, read your coverage, check carrier appetite, and generate certificates from a terminal.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install globally
|
|
9
|
+
npm install -g @delegance/cli
|
|
10
|
+
delegance --version
|
|
11
|
+
|
|
12
|
+
# Or run without installing
|
|
13
|
+
npx @delegance/cli --help
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Requires Node 20.19 or newer. Older versions cannot load the CLI's ESM-only dependencies.
|
|
17
|
+
|
|
18
|
+
## Availability
|
|
19
|
+
|
|
20
|
+
- **Quoting is live for enrolled companies.** Delegance turns on API quoting account by account today.
|
|
21
|
+
- **Public access opens on 2026-10-06.** From that date any new account can run `delegance signup` and quote from the terminal.
|
|
22
|
+
- **Until your account has access,** the quote, bind, and pay commands return "not available over the API yet" and print the portal link.
|
|
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.
|
|
26
|
+
|
|
27
|
+
## Insurance from the terminal
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# See the whole flow on sample data first. Nothing leaves your machine.
|
|
31
|
+
delegance quote start --demo
|
|
32
|
+
|
|
33
|
+
# 1. Sign up. We email you a confirm link; the key lands in ~/.delegance/credentials.
|
|
34
|
+
delegance signup
|
|
35
|
+
|
|
36
|
+
# 2. Quote general liability and workers comp. Answer the carriers' questions.
|
|
37
|
+
delegance quote start --coverage gl,wc
|
|
38
|
+
|
|
39
|
+
# 3. Request a bind on the offer you want.
|
|
40
|
+
delegance bind <submission-id> <offer-id>
|
|
41
|
+
|
|
42
|
+
# 4. Pay once a broker has reviewed the bind.
|
|
43
|
+
delegance pay
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
What happens at each step:
|
|
47
|
+
|
|
48
|
+
- **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 and prices the coverage with the carriers that quote it instantly. A coverage no carrier can quote instantly goes to a broker instead of failing.
|
|
50
|
+
- **Binding** is a request. A licensed Delegance broker reviews it, and you get an email when payment is ready.
|
|
51
|
+
- **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
|
+
Scripted use: `quote start --answers answers.json --json` takes answers keyed by question id (run it once with `--json` and no answers to print the questions).
|
|
56
|
+
|
|
57
|
+
Already a customer? Skip signup and run `delegance auth login`: it opens the portal, you approve the terminal there, and the key lands in `~/.delegance/credentials`. You can also paste a key with `delegance auth login --key <key>`, or set `DELEGANCE_API_KEY`.
|
|
58
|
+
|
|
59
|
+
## Coverage you already have
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# 1. Authenticate. Approve this terminal in the portal when the browser opens.
|
|
63
|
+
delegance auth login
|
|
64
|
+
|
|
65
|
+
# 2. Check your account setup
|
|
66
|
+
delegance onboarding status
|
|
67
|
+
|
|
68
|
+
# 3. Upload policies and wait for extraction
|
|
69
|
+
delegance doc upload "./policies/*.pdf" --type policy --wait
|
|
70
|
+
|
|
71
|
+
# 4. Read what you have
|
|
72
|
+
delegance policy list
|
|
73
|
+
delegance policy expiring 60
|
|
74
|
+
|
|
75
|
+
# 5. Ask a question about your coverage
|
|
76
|
+
delegance ask "Does my GL policy cover products liability?"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Commands
|
|
80
|
+
|
|
81
|
+
| Command | What it does |
|
|
82
|
+
|---------|--------------|
|
|
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
|
+
| `signup` / `verify` | Create an account and collect an API key from the terminal |
|
|
91
|
+
| `quote` | Instant quotes: `quote start`, `quote status`; plus the legacy partner queue commands |
|
|
92
|
+
| `bind` | Request a bind on one offer (broker-reviewed) |
|
|
93
|
+
| `pay` | List payment requests and open a Stripe checkout link |
|
|
94
|
+
| `bond` | Surety bond quotes |
|
|
95
|
+
| `claim` | File and track claims |
|
|
96
|
+
| `appetite` | Match a business to the carriers that will write it |
|
|
97
|
+
| `lead` | Send a prospect business to Delegance |
|
|
98
|
+
| `knowledge` | Search notecards and read the facts extracted from a document |
|
|
99
|
+
| `onboarding` | Show setup status, send the verification email, wait for a state |
|
|
100
|
+
| `usage` | Billing-period usage, daily usage, rate limits |
|
|
101
|
+
| `keys` | List and create API keys, rotate by replacement |
|
|
102
|
+
| `config` | Local settings and profiles |
|
|
103
|
+
|
|
104
|
+
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
|
+
|
|
106
|
+
### Scopes
|
|
107
|
+
|
|
108
|
+
An API key carries scopes. `read` covers the read commands and `write` covers commands that change data. `appetite match` needs `appetite:read`, which neither `read` nor `write` includes:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
delegance keys create "appetite checks" --scopes read,appetite:read
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### What still needs the portal
|
|
115
|
+
|
|
116
|
+
- **Quote submission.** `delegance quote request` reports that submission is not available over the API and prints the portal link.
|
|
117
|
+
- **Revoking a key.** `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.
|
|
118
|
+
|
|
119
|
+
## Configuration
|
|
120
|
+
|
|
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. Keys from `signup` and `auth login` expire after 90 days without use; `delegance auth status` shows the date and `delegance auth refresh` extends it.
|
|
122
|
+
|
|
123
|
+
| Variable | Description |
|
|
124
|
+
|----------|-------------|
|
|
125
|
+
| `DELEGANCE_API_KEY` | API key. Takes precedence over the stored key |
|
|
126
|
+
| `DELEGANCE_BASE_URL` | API base URL (default: `https://portal.delegancebrokerage.com`) |
|
|
127
|
+
| `DEBUG` | Debug output |
|
|
128
|
+
| `VERBOSE` | Verbose output |
|
|
129
|
+
|
|
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
|
+
## Examples
|
|
135
|
+
|
|
136
|
+
### Bulk upload
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
delegance doc upload "./inbox/*.pdf" --wait --type policy
|
|
140
|
+
|
|
141
|
+
# Tag each file with your own id
|
|
142
|
+
for file in ./inbox/*.pdf; do
|
|
143
|
+
delegance doc upload "$file" --external-id "$(basename "$file" .pdf)"
|
|
144
|
+
done
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Appetite check
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
delegance appetite match --state CA --industry "commercial bakery" \
|
|
151
|
+
--coverage general_liability,workers_comp
|
|
152
|
+
```
|
|
153
|
+
|
|
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
|
+
## Developing in the monorepo
|
|
165
|
+
|
|
166
|
+
Inside the monorepo the CLI resolves the SDK from the sibling source (`"@delegance/sdk": "file:../sdk"`). Build the SDK first:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
cd sdk && npm ci && npm run build
|
|
170
|
+
cd ../cli && npm ci && npm run build && npm test
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`npm pack` and `npm publish` rewrite that dependency to `^<sdk version>` on their own (`scripts/sdk-dep.cjs`, run from the `prepack`, `postpack`, and `postpublish` hooks), so the tarball and the registry both carry a semver range.
|
|
174
|
+
|
|
175
|
+
## Support
|
|
176
|
+
|
|
177
|
+
- Docs: https://portal.delegancebrokerage.com/docs/cli
|
|
178
|
+
- Email: support@delegancebrokerage.com
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|