@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/dist/index.d.ts
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import Conf from 'conf';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Authentication commands for the Delegance CLI
|
|
6
|
+
*
|
|
7
|
+
* auth login browser login: approve this terminal in the portal (default)
|
|
8
|
+
* auth login --key K store a key created in the portal
|
|
9
|
+
* auth login --paste prompt for a key instead of opening the browser
|
|
10
|
+
* auth status the stored key, where it lives, and when it expires
|
|
11
|
+
* auth refresh extend a CLI key to 90 days from now
|
|
12
|
+
* auth logout / whoami
|
|
13
|
+
*
|
|
14
|
+
* Keys live only in ~/.delegance/credentials (0600); config.json keeps a
|
|
15
|
+
* masked hint (spec 2026-09-24-cli-auth-hardening).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
declare function createAuthCommand(): Command;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Company commands for the Delegance CLI
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
declare function createCompanyCommand(): Command;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Document commands for the Delegance CLI
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
declare function createDocumentCommand(): Command;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Chat commands for the Delegance CLI
|
|
34
|
+
*
|
|
35
|
+
* Interact with the Orin insurance assistant.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
declare function createChatCommand(): Command;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Quote commands for the Delegance CLI
|
|
42
|
+
*
|
|
43
|
+
* Request and manage insurance quotes.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
declare function createQuoteCommand(): Command;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Policy commands for the Delegance CLI
|
|
50
|
+
*
|
|
51
|
+
* Manage insurance policies.
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
declare function createPolicyCommand(): Command;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* COI commands for the Delegance CLI
|
|
58
|
+
*
|
|
59
|
+
* Generate and manage Certificates of Insurance.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
declare function createCOICommand(): Command;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* SOV commands for the Delegance CLI
|
|
66
|
+
*
|
|
67
|
+
* Manage Schedules of Values for commercial property insurance.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
declare function createSOVCommand(): Command;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Appetite commands for the Delegance CLI
|
|
74
|
+
*
|
|
75
|
+
* Which carriers will write a risk. Needs an API key with the
|
|
76
|
+
* `appetite:read` scope; `read` and `write` do not include it.
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
declare function createAppetiteCommand(): Command;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Lead commands for the Delegance CLI
|
|
83
|
+
*
|
|
84
|
+
* Send a prospect business to Delegance. Needs the `write` scope.
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
declare function createLeadCommand(): Command;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Knowledge commands for the Delegance CLI
|
|
91
|
+
*
|
|
92
|
+
* Search the company's notecards and document chunks, list notecards, and
|
|
93
|
+
* read the structured facts extracted from one document.
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
declare function createKnowledgeCommand(): Command;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Onboarding commands for the Delegance CLI
|
|
100
|
+
*
|
|
101
|
+
* Read the account's setup checklist and onboarding state, send the email
|
|
102
|
+
* verification challenge, and wait for a target state.
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
declare function createOnboardingCommand(): Command;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Usage commands for the Delegance CLI
|
|
109
|
+
*
|
|
110
|
+
* Billing-period summary, daily metered usage, and rate-limit headroom.
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
declare function createUsageCommand(): Command;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* API key commands for the Delegance CLI
|
|
117
|
+
*
|
|
118
|
+
* create and list work with an API key that carries `admin` (create) or
|
|
119
|
+
* `read` (list). Revoking needs a portal session today, and the server has
|
|
120
|
+
* no rotate route, so `rotate` creates a replacement key with the same
|
|
121
|
+
* scopes and tells you where to revoke the old one.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
declare function createKeysCommand(): Command;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Config commands for the Delegance CLI
|
|
128
|
+
*
|
|
129
|
+
* Manage CLI configuration and profiles.
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
declare function createConfigCommand(): Command;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Builds the `delegance` command tree. The bin entry parses argv against it;
|
|
136
|
+
* tests inspect it without running any command.
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
declare function createProgram(): Command;
|
|
140
|
+
|
|
141
|
+
/** Kept equal to package.json "version"; a unit test fails on drift. */
|
|
142
|
+
declare const CLI_VERSION = "0.2.0";
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Configuration management for the Delegance CLI
|
|
146
|
+
*
|
|
147
|
+
* Two files:
|
|
148
|
+
* - the conf store (config.json, mode 0600): base URL, default company,
|
|
149
|
+
* output format, and a MASKED hint of the key. Never the key itself.
|
|
150
|
+
* - ~/.delegance/credentials (mode 0600, directory 0700): the API key, and
|
|
151
|
+
* nothing else.
|
|
152
|
+
*
|
|
153
|
+
* CLI versions before 0.2.0 also wrote the full key into config.json at the
|
|
154
|
+
* default mode. migrateLegacyConfigKey() moves such a key into the
|
|
155
|
+
* credentials file on the next run (spec 2026-09-24-cli-auth-hardening D1).
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
interface CLIConfig {
|
|
159
|
+
/** Legacy only: older CLIs wrote the full key here. Read by the migration, never written. */
|
|
160
|
+
apiKey?: string;
|
|
161
|
+
/** Masked key for display: prefix plus the last 4 characters. */
|
|
162
|
+
apiKeyHint?: string;
|
|
163
|
+
/** Last known expiry of the stored key (ISO), from login, refresh, or status. */
|
|
164
|
+
apiKeyExpiresAt?: string;
|
|
165
|
+
baseUrl?: string;
|
|
166
|
+
defaultCompanyId?: string;
|
|
167
|
+
outputFormat?: 'table' | 'json' | 'yaml';
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get the config store instance
|
|
171
|
+
*/
|
|
172
|
+
declare function getConfig(): Conf<CLIConfig>;
|
|
173
|
+
/**
|
|
174
|
+
* Set a configuration value
|
|
175
|
+
*/
|
|
176
|
+
declare function setConfig<K extends keyof CLIConfig>(key: K, value: CLIConfig[K]): void;
|
|
177
|
+
/**
|
|
178
|
+
* Get all configuration values
|
|
179
|
+
*/
|
|
180
|
+
declare function getAllConfig(): CLIConfig;
|
|
181
|
+
/**
|
|
182
|
+
* Clear all configuration
|
|
183
|
+
*/
|
|
184
|
+
declare function clearConfig(): void;
|
|
185
|
+
/**
|
|
186
|
+
* Get the config file path
|
|
187
|
+
*/
|
|
188
|
+
declare function getConfigPath(): string;
|
|
189
|
+
/**
|
|
190
|
+
* Store the API key: the key goes ONLY to ~/.delegance/credentials (0600);
|
|
191
|
+
* config.json keeps a masked hint and the expiry when known.
|
|
192
|
+
*/
|
|
193
|
+
declare function storeApiKey(apiKey: string, meta?: {
|
|
194
|
+
expiresAt?: string | null;
|
|
195
|
+
}): void;
|
|
196
|
+
/**
|
|
197
|
+
* Get stored API key
|
|
198
|
+
*/
|
|
199
|
+
declare function getApiKey(): string | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* Check if user is authenticated
|
|
202
|
+
*/
|
|
203
|
+
declare function isAuthenticated(): boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Clear stored credentials
|
|
206
|
+
*/
|
|
207
|
+
declare function clearCredentials(): void;
|
|
208
|
+
/**
|
|
209
|
+
* Get base URL for API calls
|
|
210
|
+
*/
|
|
211
|
+
declare function getBaseUrl(): string;
|
|
212
|
+
/**
|
|
213
|
+
* Mask an API key for display
|
|
214
|
+
*/
|
|
215
|
+
declare function maskApiKey(apiKey: string): string;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Output utilities for the Delegance CLI
|
|
219
|
+
*/
|
|
220
|
+
type OutputFormat = 'table' | 'json' | 'yaml';
|
|
221
|
+
/**
|
|
222
|
+
* Print a success message
|
|
223
|
+
*/
|
|
224
|
+
declare function success(message: string): void;
|
|
225
|
+
/**
|
|
226
|
+
* Print an error message
|
|
227
|
+
*/
|
|
228
|
+
declare function error(message: string, details?: string): void;
|
|
229
|
+
/**
|
|
230
|
+
* Print a warning message
|
|
231
|
+
*/
|
|
232
|
+
declare function warn(message: string): void;
|
|
233
|
+
/**
|
|
234
|
+
* Print an info message
|
|
235
|
+
*/
|
|
236
|
+
declare function info(message: string): void;
|
|
237
|
+
/**
|
|
238
|
+
* Print a debug message (only in verbose mode)
|
|
239
|
+
*/
|
|
240
|
+
declare function debug(message: string): void;
|
|
241
|
+
/**
|
|
242
|
+
* Print a header
|
|
243
|
+
*/
|
|
244
|
+
declare function header(text: string): void;
|
|
245
|
+
/**
|
|
246
|
+
* Print key-value pairs
|
|
247
|
+
* Supports both object format and key/value arguments
|
|
248
|
+
*/
|
|
249
|
+
declare function keyValue(keyOrData: string | Record<string, unknown>, value?: unknown): void;
|
|
250
|
+
/**
|
|
251
|
+
* Print a table
|
|
252
|
+
*/
|
|
253
|
+
declare function table(headers: string[], rows: (string | number | null | undefined)[][], options?: {
|
|
254
|
+
compact?: boolean;
|
|
255
|
+
}): void;
|
|
256
|
+
/**
|
|
257
|
+
* Print data as JSON
|
|
258
|
+
*/
|
|
259
|
+
declare function json(data: unknown): void;
|
|
260
|
+
/**
|
|
261
|
+
* Print data based on format
|
|
262
|
+
*/
|
|
263
|
+
declare function output(data: unknown, format?: OutputFormat): void;
|
|
264
|
+
/**
|
|
265
|
+
* Format a date for display
|
|
266
|
+
*/
|
|
267
|
+
declare function formatDate(dateStr: string | Date | undefined): string;
|
|
268
|
+
/**
|
|
269
|
+
* Format file size for display
|
|
270
|
+
*/
|
|
271
|
+
declare function formatFileSize(bytes: number | undefined): string;
|
|
272
|
+
/**
|
|
273
|
+
* Format document status with color
|
|
274
|
+
*/
|
|
275
|
+
declare function formatStatus(status: string): string;
|
|
276
|
+
/**
|
|
277
|
+
* Format currency for display
|
|
278
|
+
*/
|
|
279
|
+
declare function formatCurrency(amount: number | undefined | null): string;
|
|
280
|
+
|
|
281
|
+
type output$1_OutputFormat = OutputFormat;
|
|
282
|
+
declare const output$1_debug: typeof debug;
|
|
283
|
+
declare const output$1_error: typeof error;
|
|
284
|
+
declare const output$1_formatCurrency: typeof formatCurrency;
|
|
285
|
+
declare const output$1_formatDate: typeof formatDate;
|
|
286
|
+
declare const output$1_formatFileSize: typeof formatFileSize;
|
|
287
|
+
declare const output$1_formatStatus: typeof formatStatus;
|
|
288
|
+
declare const output$1_header: typeof header;
|
|
289
|
+
declare const output$1_info: typeof info;
|
|
290
|
+
declare const output$1_json: typeof json;
|
|
291
|
+
declare const output$1_keyValue: typeof keyValue;
|
|
292
|
+
declare const output$1_output: typeof output;
|
|
293
|
+
declare const output$1_success: typeof success;
|
|
294
|
+
declare const output$1_table: typeof table;
|
|
295
|
+
declare const output$1_warn: typeof warn;
|
|
296
|
+
declare namespace output$1 {
|
|
297
|
+
export { type output$1_OutputFormat as OutputFormat, output$1_debug as debug, output$1_error as error, output$1_formatCurrency as formatCurrency, output$1_formatDate as formatDate, output$1_formatFileSize as formatFileSize, output$1_formatStatus as formatStatus, output$1_header as header, output$1_info as info, output$1_json as json, output$1_keyValue as keyValue, output$1_output as output, output$1_success as success, output$1_table as table, output$1_warn as warn };
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
export { CLI_VERSION, clearConfig, clearCredentials, createAppetiteCommand, createAuthCommand, createCOICommand, createChatCommand, createCompanyCommand, createConfigCommand, createDocumentCommand, createKeysCommand, createKnowledgeCommand, createLeadCommand, createOnboardingCommand, createPolicyCommand, createProgram, createQuoteCommand, createSOVCommand, createUsageCommand, getAllConfig, getApiKey, getBaseUrl, getConfig, getConfigPath, isAuthenticated, maskApiKey, output$1 as output, setConfig, storeApiKey };
|