@invinite-org/invinite-data-cli 4.1.0 → 6.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/README.md +66 -33
- package/claude-plugin/.claude-plugin/plugin.json +1 -1
- package/claude-plugin/agents/invinite-data.md +1 -1
- package/claude-plugin/skills/invinite-data-cli/SKILL.md +21 -15
- package/dist/bin/invd.js +3 -0
- package/dist/bin/invd.js.map +1 -1
- package/dist/src/cli.js +2 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/client/api-client.d.ts +1 -1
- package/dist/src/client/download.d.ts +1 -1
- package/dist/src/client/download.js +7 -12
- package/dist/src/client/download.js.map +1 -1
- package/dist/src/commands/agent-setup.js +7 -5
- package/dist/src/commands/agent-setup.js.map +1 -1
- package/dist/src/commands/api.d.ts +1 -1
- package/dist/src/commands/api.js +12 -7
- package/dist/src/commands/api.js.map +1 -1
- package/dist/src/commands/auth.d.ts +1 -1
- package/dist/src/commands/auth.js +21 -17
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/config.d.ts +3 -2
- package/dist/src/commands/config.js +9 -8
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/plugin.d.ts +8 -1
- package/dist/src/commands/plugin.js +27 -15
- package/dist/src/commands/plugin.js.map +1 -1
- package/dist/src/config/auth.js +1 -1
- package/dist/src/config/auth.js.map +1 -1
- package/dist/src/config/config-manager.d.ts +16 -4
- package/dist/src/config/config-manager.js +54 -21
- package/dist/src/config/config-manager.js.map +1 -1
- package/dist/src/generated/cli-manifest.json +88 -88
- package/dist/src/hand-written-commands.d.ts +1 -1
- package/dist/src/hand-written-commands.js +1 -1
- package/dist/src/hand-written-commands.js.map +1 -1
- package/dist/src/shared/errors.d.ts +18 -9
- package/dist/src/shared/errors.js +72 -25
- package/dist/src/shared/errors.js.map +1 -1
- package/dist/src/shared/signals.d.ts +25 -0
- package/dist/src/shared/signals.js +51 -0
- package/dist/src/shared/signals.js.map +1 -0
- package/dist/src/shared/spinner.d.ts +2 -0
- package/dist/src/shared/spinner.js +12 -1
- package/dist/src/shared/spinner.js.map +1 -1
- package/dist/src/spec-commands.js +13 -5
- package/dist/src/spec-commands.js.map +1 -1
- package/dist/src/spec-manifest.d.ts +18 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,10 @@ invd holdings AAPL
|
|
|
13
13
|
invd search filings "supply chain risk" --company AAPL
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
Version
|
|
16
|
+
Version 6.0 keeps the 5.0 commands and follows the conventions shared with the Web CLI `inv`: one exit-code table
|
|
17
|
+
(not found 3, partial 7, interrupted 130 / 143), a three-line error with the API's remedy, and the config file in
|
|
18
|
+
`~/.config/invinite/invd.toml`. Coming from 5.x, read [Upgrading from 5.x](#upgrading-from-5x); from 4.x,
|
|
19
|
+
[Upgrading from 4.x](#upgrading-from-4x); from 3.x, [Upgrading from 3.x](#upgrading-from-3x).
|
|
17
20
|
|
|
18
21
|
## Installation
|
|
19
22
|
|
|
@@ -55,10 +58,10 @@ The active key is resolved in this order:
|
|
|
55
58
|
2. `INVINITE_DATA_API_KEY` (the 3.x name, still read)
|
|
56
59
|
3. `./.env` in the current directory (either name)
|
|
57
60
|
4. the OS keychain (via the optional `keytar` package)
|
|
58
|
-
5. `api_key` in the global `
|
|
61
|
+
5. `api_key` in the global `invd.toml`
|
|
59
62
|
|
|
60
63
|
```bash
|
|
61
|
-
curl -H "Authorization: Bearer $(invd auth token)" https://api.data.invinite.com/
|
|
64
|
+
curl -H "Authorization: Bearer $(invd auth token)" https://api.data.invinite.com/v1/me
|
|
62
65
|
```
|
|
63
66
|
|
|
64
67
|
## The command grammar
|
|
@@ -110,7 +113,7 @@ invd events transcript <event_id>
|
|
|
110
113
|
and `invd events AAPL` lists Apple's calls.
|
|
111
114
|
|
|
112
115
|
**Events by fiscal period.** Every command that takes an `event_id` also takes a company and a fiscal period in its
|
|
113
|
-
place; invd resolves the event through `GET /
|
|
116
|
+
place; invd resolves the event through `GET /v1/events` and says so on stderr:
|
|
114
117
|
|
|
115
118
|
```bash
|
|
116
119
|
invd events transcript NVDA 2026Q3
|
|
@@ -261,7 +264,8 @@ invd webhooks delete <id>
|
|
|
261
264
|
|
|
262
265
|
## Output
|
|
263
266
|
|
|
264
|
-
Data goes to stdout; progress, cost lines and coverage notes go to stderr, so a pipe only ever sees
|
|
267
|
+
Data goes to stdout; progress, cost lines, confirmations and coverage notes go to stderr, so a pipe only ever sees
|
|
268
|
+
data.
|
|
265
269
|
|
|
266
270
|
| Flag | Effect |
|
|
267
271
|
|---|---|
|
|
@@ -295,7 +299,8 @@ invd holdings AAPL --all --output csv > aapl-holders.csv
|
|
|
295
299
|
invd filings AAPL --cursor eyJ2IjoyfQ
|
|
296
300
|
```
|
|
297
301
|
|
|
298
|
-
An
|
|
302
|
+
An `--all` cut short by a failure after some rows exits 7 and prints the `--cursor` to resume from; Ctrl-C prints the
|
|
303
|
+
same resume line and exits 130.
|
|
299
304
|
|
|
300
305
|
### Credits
|
|
301
306
|
|
|
@@ -327,12 +332,12 @@ invd investor-documents get <document_id> --save report.pdf
|
|
|
327
332
|
The escape hatch for anything the command tree lacks:
|
|
328
333
|
|
|
329
334
|
```bash
|
|
330
|
-
invd api /
|
|
331
|
-
invd api GET /
|
|
332
|
-
invd api GET /
|
|
333
|
-
invd api POST /
|
|
334
|
-
invd api DELETE /
|
|
335
|
-
invd api GET /
|
|
335
|
+
invd api /v1/companies/AAPL
|
|
336
|
+
invd api GET /v1/filings?company=AAPL --paginate --jq '.data[].accession'
|
|
337
|
+
invd api GET /v1/holdings -F company=AAPL -F limit=100
|
|
338
|
+
invd api POST /v1/webhooks --input webhook.json
|
|
339
|
+
invd api DELETE /v1/webhooks/<id> --yes
|
|
340
|
+
invd api GET /v1/me -H 'Accept: application/json' --dry-run
|
|
336
341
|
```
|
|
337
342
|
|
|
338
343
|
`-F key=value` is typed (numbers, `true` / `false`, `null`, `@file`), `-f key=value` always a string; both are query
|
|
@@ -358,11 +363,14 @@ invd config path
|
|
|
358
363
|
| `pager` | `INVD_PAGER` | pager for long terminal output |
|
|
359
364
|
| `api_key` | `INVD_API_KEY` | the key (global file only; prefer `invd auth login`) |
|
|
360
365
|
|
|
361
|
-
The global file is `$XDG_CONFIG_HOME/invd
|
|
362
|
-
|
|
366
|
+
The global file is `$XDG_CONFIG_HOME/invinite/invd.toml` (`~/.config/invinite/invd.toml`; `%APPDATA%\invinite` on
|
|
367
|
+
Windows; `INVD_CONFIG_DIR` replaces the directory). The directory is shared with the Web CLI `inv` (`config.json`); invd
|
|
368
|
+
touches only `invd.toml` there, and keys are never shared. `--local` writes `./.invd.toml` for this project.
|
|
369
|
+
Precedence: flags > environment > `./.invd.toml` > `invd.toml`. A project file
|
|
363
370
|
never holds `api_key`, and its `base_url` may only name a loopback host (`localhost`, `127.0.0.1`, `[::1]`): a cloned
|
|
364
|
-
repository cannot send your key elsewhere. `invd api` likewise refuses an absolute URL on another host.
|
|
365
|
-
|
|
371
|
+
repository cannot send your key elsewhere. `invd api` likewise refuses an absolute URL on another host. The settings of
|
|
372
|
+
an older install (`~/.config/invd/config.toml` of 4.x / 5.x, else the 3.x file) are carried into `invd.toml` once,
|
|
373
|
+
with one line on stderr; the old file is left in place.
|
|
366
374
|
|
|
367
375
|
## AI agents
|
|
368
376
|
|
|
@@ -418,23 +426,54 @@ invd completion bash > ~/.local/share/bash-completion/completions/invd
|
|
|
418
426
|
invd completion fish > ~/.config/fish/completions/invd.fish
|
|
419
427
|
```
|
|
420
428
|
|
|
421
|
-
Completion covers commands, flags, and the `/
|
|
429
|
+
Completion covers commands, flags, and the `/v1` paths after `invd api`.
|
|
422
430
|
|
|
423
|
-
##
|
|
431
|
+
## Errors and exit codes
|
|
432
|
+
|
|
433
|
+
An error prints at most three lines on stderr: what failed (with the problem `code`), what to do (an `invd` command
|
|
434
|
+
where invd knows one, else the API's `remedy`), and the request id with the docs link. No HTTP status number. Under
|
|
435
|
+
`--json` the whole problem body follows as one JSON line on stderr.
|
|
436
|
+
|
|
437
|
+
```
|
|
438
|
+
$ invd filings AAPL --limit 500
|
|
439
|
+
✗ limit: must be <= 200. (invalid_parameter)
|
|
440
|
+
Pass a limit of at most 200, or walk the pages with next_cursor.
|
|
441
|
+
req_01JC… · https://data.invinite.com/docs/errors#invalid_parameter
|
|
442
|
+
$ echo $?
|
|
443
|
+
2
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
The exit codes are the same in `invd` and the Web CLI `inv`:
|
|
424
447
|
|
|
425
448
|
| Code | Meaning |
|
|
426
449
|
|---|---|
|
|
427
450
|
| 0 | ok |
|
|
428
|
-
| 1 |
|
|
429
|
-
| 2 | usage: a bad flag or argument,
|
|
430
|
-
| 3 |
|
|
431
|
-
| 4 | auth required: no key, 401, forbidden |
|
|
451
|
+
| 1 | refused or failed (any other problem `code`, a network error) |
|
|
452
|
+
| 2 | usage: a bad flag or argument, the API's `invalid_parameter` / `unknown_parameter` / `cursor_mismatch`, or an answer is needed under `--no-input` |
|
|
453
|
+
| 3 | not found: `not_found`, `not_covered`, a 404 |
|
|
454
|
+
| 4 | auth required: no key, 401, `unauthorized` / `forbidden` |
|
|
432
455
|
| 5 | integrity: a download's checksum or size does not match |
|
|
433
456
|
| 6 | credits exhausted or plan required: 402, `plan_required`, `insufficient_credits` |
|
|
457
|
+
| 7 | partial: an `--all` cut short by a failure (resume with the printed `--cursor`) or a short download |
|
|
458
|
+
| 130 / 143 | interrupted (Ctrl-C / SIGTERM); an `--all` walk prints its resume cursor first |
|
|
459
|
+
|
|
460
|
+
## Upgrading from 5.x
|
|
461
|
+
|
|
462
|
+
6.0 keeps every 5.x command, flag and output. Breaking: exit codes (partial 3 → 7, not found 1 → 3, Ctrl-C 130
|
|
463
|
+
everywhere); the error print (three lines, no HTTP status); the config file moves from `~/.config/invd/config.toml` to
|
|
464
|
+
`~/.config/invinite/invd.toml` (carried over once on first run); confirmations of `invd auth`, `invd config set` /
|
|
465
|
+
`unset`, `invd plugin` and `invd agent-setup` go to stderr, and `plugin install` / `uninstall` and `agent-setup` take
|
|
466
|
+
`--no-input`.
|
|
467
|
+
|
|
468
|
+
## Upgrading from 4.x
|
|
469
|
+
|
|
470
|
+
5.0 keeps every 4.x command, flag, output and exit code; only the request paths moved from `/v2/...` to `/v1/...`
|
|
471
|
+
(the API's 2026-11-11 cut-over; `/v2/*` answers 404 since, so 4.x no longer works). `invd api` paths are `/v1/...`
|
|
472
|
+
now. Upgrade = install 5.0.
|
|
434
473
|
|
|
435
474
|
## Upgrading from 3.x
|
|
436
475
|
|
|
437
|
-
4.0
|
|
476
|
+
4.0 replaced the old v1 command tree with the noun-verb grammar (5.0 keeps it). No 3.x spelling is kept as an alias.
|
|
438
477
|
|
|
439
478
|
| 3.x | 4.0 |
|
|
440
479
|
|---|---|
|
|
@@ -451,21 +490,15 @@ Completion covers commands, flags, and the `/v2` paths after `invd api`.
|
|
|
451
490
|
| `sec filings\|filing\|document\|sections\|search` | `invd filings list\|get`, `invd documents get\|sections`, `invd search filings` |
|
|
452
491
|
| `ownership …` | `invd holdings list\|changes` |
|
|
453
492
|
| `usage` | `invd me usage` |
|
|
454
|
-
| `ws listen` (WebSocket stream) | no CLI command in 4.0; use the API's `/
|
|
493
|
+
| `ws listen` (WebSocket stream) | no CLI command in 4.0; use the API's `/v1/stream` |
|
|
455
494
|
| `-i, --identifier AAPL` | the positional company: `invd filings AAPL` |
|
|
456
495
|
| `--offset <n>` | `--cursor <next_cursor>` |
|
|
457
496
|
| `INVINITE_DATA_API_KEY` | still read; `INVD_API_KEY` takes precedence |
|
|
458
497
|
|
|
459
|
-
###
|
|
460
|
-
|
|
461
|
-
invd 3.x is the CLI of the v1 API and stays installable:
|
|
462
|
-
|
|
463
|
-
```bash
|
|
464
|
-
npm install -g @invinite-org/invinite-data-cli@3
|
|
465
|
-
```
|
|
498
|
+
### Older majors
|
|
466
499
|
|
|
467
|
-
|
|
468
|
-
|
|
500
|
+
invd 3.x (the old v1 API) and 4.x (the `/v2` paths) call routes that were deleted on 2026-11-11; neither works
|
|
501
|
+
against the live API any more. Install 6.x.
|
|
469
502
|
|
|
470
503
|
## Development
|
|
471
504
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "invinite-financial-data",
|
|
3
3
|
"description": "Fetch and analyze financial data using the Invinite Data API — company fundamentals, financial statements, SEC filings, earnings calls (transcripts, guidance, Q&A, live calls), company news, institutional ownership, insider trades, and more.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Invinite"
|
|
7
7
|
},
|
|
@@ -44,7 +44,7 @@ the `invd` CLI (version 4, the v2 API) and return it in a clean, structured form
|
|
|
44
44
|
- Exit 4 = no or invalid key: report it and tell the caller to run `invd auth login` (or set `INVD_API_KEY`).
|
|
45
45
|
Exit 6 = credits exhausted or plan required: report the plan or credit message as given.
|
|
46
46
|
- Never pass `--save` unless the caller asked for a file.
|
|
47
|
-
- When the command tree lacks an operation, `invd api GET /
|
|
47
|
+
- When the command tree lacks an operation, `invd api GET /v1/<path>` reaches it (it prints JSON).
|
|
48
48
|
|
|
49
49
|
## MCP equivalents
|
|
50
50
|
|
|
@@ -39,7 +39,7 @@ serves the earlier roster; use whatever tools it lists, or the CLI.
|
|
|
39
39
|
| News items, text, announcements, news search | `get_news` | `invd news list\|get\|text\|announcements`, `invd search news` |
|
|
40
40
|
| Account and usage | `get_account` | `invd me show\|usage` |
|
|
41
41
|
| Webhooks | `manage_webhooks` | `invd webhooks …` |
|
|
42
|
-
| Any other operation | `search_endpoints` + `call_api` | `invd api GET /
|
|
42
|
+
| Any other operation | `search_endpoints` + `call_api` | `invd api GET /v1/…` |
|
|
43
43
|
|
|
44
44
|
MCP resources `invinite://catalog/metrics`, `invinite://catalog/sections`, `invinite://catalog/event-types`,
|
|
45
45
|
`invinite://catalog/forms` and `invinite://catalog/document-kinds` are the catalogs (`invd catalog metrics`, `invd catalog sections`, `invd catalog event-types`, `invd catalog forms`,
|
|
@@ -60,7 +60,8 @@ Claude Code or Codex in one step.
|
|
|
60
60
|
### CLI
|
|
61
61
|
|
|
62
62
|
Install with `npm install -g @invinite-org/invinite-data-cli`, then run `invd auth login`. The key is resolved in this
|
|
63
|
-
order: `INVD_API_KEY` > `INVINITE_DATA_API_KEY` > `./.env` (either name) > OS keychain > `api_key` in
|
|
63
|
+
order: `INVD_API_KEY` > `INVINITE_DATA_API_KEY` > `./.env` (either name) > OS keychain > `api_key` in
|
|
64
|
+
`~/.config/invinite/invd.toml`.
|
|
64
65
|
`invd auth status` shows which key is active and whose account it is (free).
|
|
65
66
|
|
|
66
67
|
An auth failure exits 4: reconnect the MCP connector, or tell the user to run `invd auth login` (or set
|
|
@@ -74,10 +75,10 @@ An auth failure exits 4: reconnect the MCP connector, or tell the user to run `i
|
|
|
74
75
|
`invd financials AAPL MSFT`), the member id on member commands (`invd companies get AAPL`,
|
|
75
76
|
`invd filings get 0000320193-26-000026`, `invd events transcript <event_id>`).
|
|
76
77
|
- Every command that takes an `event_id` also takes a company plus a fiscal period: `invd events transcript NVDA 2026Q3`
|
|
77
|
-
resolves the event through `GET /
|
|
78
|
+
resolves the event through `GET /v1/events` (one extra credit; the resolution is noted on stderr).
|
|
78
79
|
- Flags are the API parameters with dashes (`fiscal_year` → `--fiscal-year`, `filed_at[gte]` → `--filed-at-gte`).
|
|
79
80
|
`invd <group> <action> --help` lists them with the API's descriptions, the credit cost and plan, and the row fields.
|
|
80
|
-
- `invd api` calls any path the tree lacks: `invd api GET /
|
|
81
|
+
- `invd api` calls any path the tree lacks: `invd api GET /v1/filings?company=AAPL --paginate --jq '.data[].accession'`.
|
|
81
82
|
|
|
82
83
|
## Output, pagination and cost
|
|
83
84
|
|
|
@@ -101,9 +102,14 @@ incomplete instead of "nothing found".
|
|
|
101
102
|
Before a large pull (`--all`, many companies, `search filings` at 100 credits a page) check what is left with
|
|
102
103
|
`invd me usage --json` (free) and estimate with `--dry-run`. If the pull would not fit, say so before starting it.
|
|
103
104
|
|
|
104
|
-
Exit codes: 0 ok, 1
|
|
105
|
-
|
|
106
|
-
exhausted or plan required (`plan_required`, `insufficient_credits`)
|
|
105
|
+
Exit codes: 0 ok, 1 refused or failed, 2 usage (incl. `invalid_parameter`, `unknown_parameter`, `cursor_mismatch`, or
|
|
106
|
+
a needed answer under `--no-input`), 3 not found (`not_found`, `not_covered`), 4 auth required, 5 download integrity,
|
|
107
|
+
6 credits exhausted or plan required (`plan_required`, `insufficient_credits`), 7 partial (an `--all` cut by a failure:
|
|
108
|
+
resume with the printed `--cursor`), 130 / 143 interrupted.
|
|
109
|
+
|
|
110
|
+
An error is at most three stderr lines: `✗ <detail> (<code>)`, then what to do (an `invd` command, else the API's
|
|
111
|
+
`remedy`), then the request id and docs link. Follow the remedy line; with `--json` the problem body (`code`, `param`,
|
|
112
|
+
`remedy`, `request_id`) follows as one JSON line on stderr.
|
|
107
113
|
|
|
108
114
|
## Working with the data
|
|
109
115
|
|
|
@@ -251,10 +257,10 @@ invd agent-setup --all --global --dry-run # print what would be written
|
|
|
251
257
|
|
|
252
258
|
<!-- invd:hand:api -->
|
|
253
259
|
```bash
|
|
254
|
-
invd api /
|
|
255
|
-
invd api GET /
|
|
256
|
-
invd api GET /
|
|
257
|
-
invd api POST /
|
|
260
|
+
invd api /v1/companies/AAPL
|
|
261
|
+
invd api GET /v1/filings?company=AAPL --paginate --jq '.data[].accession'
|
|
262
|
+
invd api GET /v1/holdings -F company=AAPL -F limit=100 --dry-run
|
|
263
|
+
invd api POST /v1/webhooks --input webhook.json
|
|
258
264
|
```
|
|
259
265
|
<!-- /invd:hand:api -->
|
|
260
266
|
|
|
@@ -499,7 +505,7 @@ invd investor-documents list AAPL --json
|
|
|
499
505
|
|
|
500
506
|
### ipos
|
|
501
507
|
|
|
502
|
-
|
|
508
|
+
Offerings from registration to listing
|
|
503
509
|
|
|
504
510
|
```bash
|
|
505
511
|
# Get an offering (optional: --fields)
|
|
@@ -520,7 +526,7 @@ invd market holidays --json
|
|
|
520
526
|
|
|
521
527
|
### me
|
|
522
528
|
|
|
523
|
-
|
|
529
|
+
The caller's account and usage (0 credits)
|
|
524
530
|
|
|
525
531
|
```bash
|
|
526
532
|
# Who am I
|
|
@@ -550,7 +556,7 @@ invd metrics ratios AAPL -p annual --json
|
|
|
550
556
|
|
|
551
557
|
### news
|
|
552
558
|
|
|
553
|
-
News
|
|
559
|
+
News items, full text, search and announcements
|
|
554
560
|
|
|
555
561
|
```bash
|
|
556
562
|
# List announcements (optional: --topic, --item, --announced-at-gte, --announced-at-gt, --announced-at-lte, --announced-at-lt, --effective-from-gte, --effective-to-lte, --sort, --fields, --limit, --cursor, --all)
|
|
@@ -623,7 +629,7 @@ invd segments list-detailed AAPL -p annual --json
|
|
|
623
629
|
|
|
624
630
|
### webhooks
|
|
625
631
|
|
|
626
|
-
Outbound
|
|
632
|
+
Outbound event deliveries
|
|
627
633
|
|
|
628
634
|
```bash
|
|
629
635
|
# Create a webhook (optional: --idempotency-key, --url, --events, --ciks, --keywords, --body, --body-file)
|
package/dist/bin/invd.js
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
import { CommanderError } from 'commander';
|
|
3
3
|
import { createProgram } from '../src/cli.js';
|
|
4
4
|
import { exitCodeOfCommanderError } from '../src/shared/errors.js';
|
|
5
|
+
import { installSignalExit } from '../src/shared/signals.js';
|
|
6
|
+
// Ctrl-C / SIGTERM exit 130 / 143 in every command, after the cleanups a command registered (onInterrupt).
|
|
7
|
+
installSignalExit();
|
|
5
8
|
try {
|
|
6
9
|
await createProgram().parseAsync();
|
|
7
10
|
}
|
package/dist/bin/invd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invd.js","sourceRoot":"","sources":["../../bin/invd.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"invd.js","sourceRoot":"","sources":["../../bin/invd.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,2GAA2G;AAC3G,iBAAiB,EAAE,CAAC;AACpB,IAAI,CAAC;IACH,MAAM,aAAa,EAAE,CAAC,UAAU,EAAE,CAAC;AACrC,CAAC;AAAC,OAAO,KAAK,EAAE,CAAC;IACf,8GAA8G;IAC9G,IAAI,KAAK,YAAY,cAAc;QAAE,OAAO,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC;IACnF,MAAM,KAAK,CAAC;AACd,CAAC"}
|
package/dist/src/cli.js
CHANGED
|
@@ -59,13 +59,13 @@ function topHelp() {
|
|
|
59
59
|
'',
|
|
60
60
|
].join('\n');
|
|
61
61
|
}
|
|
62
|
-
const EXIT_HELP = '\nExit codes: 0 ok · 1
|
|
62
|
+
const EXIT_HELP = '\nExit codes: 0 ok · 1 refused / failed · 2 usage · 3 not found · 4 auth required · 5 integrity · 6 credits / plan · 7 partial · 130 / 143 interrupted\n';
|
|
63
63
|
export function createProgram() {
|
|
64
64
|
const program = new Command();
|
|
65
65
|
applyColorEnv();
|
|
66
66
|
program
|
|
67
67
|
.name('invd')
|
|
68
|
-
.description('CLI for the Invinite financial data API (
|
|
68
|
+
.description('CLI for the Invinite financial data API (v1)')
|
|
69
69
|
.version(packageVersion(), '-V, --version')
|
|
70
70
|
// Root options only before the subcommand: an operation's own `--version` (a transcript version) is its own.
|
|
71
71
|
.enablePositionalOptions()
|
package/dist/src/cli.js.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,IAAI,GAAG,CAAC,YAAY,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1H,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;IAE9C,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type QueryValue = string | string[] | undefined;
|
|
2
2
|
export type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
3
3
|
export interface RequestOptions {
|
|
4
|
-
/** A path under the base URL (`/
|
|
4
|
+
/** A path under the base URL (`/v1/filings`); a query string on it is kept. */
|
|
5
5
|
path: string;
|
|
6
6
|
method?: HttpMethod;
|
|
7
7
|
/** An array value is sent as a repeated parameter (`a=1&a=2`); `undefined` / `''` are dropped. */
|
|
@@ -32,7 +32,7 @@ export interface VerifiedFile {
|
|
|
32
32
|
export declare function fileSha256(path: string): Promise<string>;
|
|
33
33
|
/**
|
|
34
34
|
* Streams `open(signal)`'s body to `file` through `writeViaPart`, verifying what is known before the rename: the
|
|
35
|
-
* media type, the size (short = `PartialDownloadError`, exit
|
|
35
|
+
* media type, the size (short = `PartialDownloadError`, exit 7; a broken stream too) and the SHA-256 (else
|
|
36
36
|
* `IntegrityError`, exit 5) — a failed check saves nothing. Resume rule for immutable files: an existing target whose
|
|
37
37
|
* SHA-256 equals `expected.sha256` is complete (`skipped`, no request); any other existing target needs `force`.
|
|
38
38
|
* `open` is the request: keyless `fetch` of a permanent public URL, or `apiDownload` for a key-authorized stream.
|
|
@@ -6,6 +6,7 @@ import { Readable } from 'node:stream';
|
|
|
6
6
|
import { Transform } from 'node:stream';
|
|
7
7
|
import { pipeline } from 'node:stream/promises';
|
|
8
8
|
import { IntegrityError, PartialDownloadError } from '../shared/errors.js';
|
|
9
|
+
import { onInterrupt } from '../shared/signals.js';
|
|
9
10
|
import { createSpinner } from '../shared/spinner.js';
|
|
10
11
|
async function exists(path) {
|
|
11
12
|
try {
|
|
@@ -25,24 +26,19 @@ async function prepareTarget(file, opts) {
|
|
|
25
26
|
await mkdir(dirname(path), { recursive: true });
|
|
26
27
|
return path;
|
|
27
28
|
}
|
|
28
|
-
/** Exit codes of the signals that abort a write (128 + signal number, as a shell reports them). */
|
|
29
|
-
const ABORT_SIGNALS = { SIGINT: 130, SIGTERM: 143 };
|
|
30
29
|
/**
|
|
31
30
|
* Runs `write(part, signal)` against `<path>.part` and renames it onto `path` on success, so a
|
|
32
31
|
* failed write never leaves a partial file or clobbers an existing one. While it runs, SIGINT /
|
|
33
|
-
* SIGTERM (Ctrl-C) abort `signal
|
|
34
|
-
*
|
|
32
|
+
* SIGTERM (Ctrl-C) abort `signal` and remove the `.part` file synchronously before the shared
|
|
33
|
+
* interrupt exit (130 / 143, `src/shared/signals.ts`).
|
|
35
34
|
*/
|
|
36
35
|
async function writeViaPart(path, write) {
|
|
37
36
|
const part = `${path}.part`;
|
|
38
37
|
const controller = new AbortController();
|
|
39
|
-
const
|
|
38
|
+
const unregister = onInterrupt(() => {
|
|
40
39
|
controller.abort();
|
|
41
40
|
rmSync(part, { force: true });
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
for (const signal of Object.keys(ABORT_SIGNALS))
|
|
45
|
-
process.once(signal, onSignal);
|
|
41
|
+
});
|
|
46
42
|
try {
|
|
47
43
|
await write(part, controller.signal);
|
|
48
44
|
await rename(part, path);
|
|
@@ -52,8 +48,7 @@ async function writeViaPart(path, write) {
|
|
|
52
48
|
throw error;
|
|
53
49
|
}
|
|
54
50
|
finally {
|
|
55
|
-
|
|
56
|
-
process.off(signal, onSignal);
|
|
51
|
+
unregister();
|
|
57
52
|
}
|
|
58
53
|
}
|
|
59
54
|
/**
|
|
@@ -89,7 +84,7 @@ export async function fileSha256(path) {
|
|
|
89
84
|
const mediaType = (value) => (value ?? '').split(';')[0].trim().toLowerCase();
|
|
90
85
|
/**
|
|
91
86
|
* Streams `open(signal)`'s body to `file` through `writeViaPart`, verifying what is known before the rename: the
|
|
92
|
-
* media type, the size (short = `PartialDownloadError`, exit
|
|
87
|
+
* media type, the size (short = `PartialDownloadError`, exit 7; a broken stream too) and the SHA-256 (else
|
|
93
88
|
* `IntegrityError`, exit 5) — a failed check saves nothing. Resume rule for immutable files: an existing target whose
|
|
94
89
|
* SHA-256 equals `expected.sha256` is complete (`skipped`, no request); any other existing target needs `force`.
|
|
95
90
|
* `open` is the request: keyless `fetch` of a permanent public URL, or `apiDownload` for a key-authorized stream.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.js","sourceRoot":"","sources":["../../../src/client/download.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAOrD,KAAK,UAAU,MAAM,CAAC,IAAY;IAChC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;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;IAClB,YAAY,EAAE,KAAK;IACnB,WAAW,EAAE,KAAK;IAClB,YAAY,EAAE,KAAK;CACpB,CAAC;AAEF,oFAAoF;AACpF,MAAM,UAAU,YAAY,CAAC,WAAsC;IACjE,MAAM,IAAI,GAAG,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;AACnC,CAAC"}
|
|
@@ -76,6 +76,7 @@ export function registerAgentSetupCommand(program) {
|
|
|
76
76
|
.option('-g, --global', 'User-wide (home directory)')
|
|
77
77
|
.option('-l, --local', 'This project (current directory)')
|
|
78
78
|
.option('--dry-run', 'Print what would be written; write nothing')
|
|
79
|
+
.option('--no-input', 'Never prompt (a missing agent or scope fails with exit 2 instead)')
|
|
79
80
|
.addHelpText('before', 'Examples:\n $ invd agent-setup --claude --local\n $ invd agent-setup --all --global --dry-run\n')
|
|
80
81
|
.action(withErrorHandling(async (opts) => {
|
|
81
82
|
let runtimes = opts.all ? [...AGENT_RUNTIMES] : AGENT_RUNTIMES.filter(runtime => opts[runtime]);
|
|
@@ -83,9 +84,10 @@ export function registerAgentSetupCommand(program) {
|
|
|
83
84
|
runtimes = null;
|
|
84
85
|
let scope = resolveScope(opts);
|
|
85
86
|
if (!runtimes || !scope) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
const answers = await promptInteractive(runtimes, scope, {
|
|
88
|
+
input: opts.input,
|
|
89
|
+
answers: 'the agent (--claude, --codex or --all) and the scope (--global or --local)',
|
|
90
|
+
});
|
|
89
91
|
runtimes = answers.runtimes;
|
|
90
92
|
scope = answers.scope;
|
|
91
93
|
}
|
|
@@ -102,9 +104,9 @@ export function registerAgentSetupCommand(program) {
|
|
|
102
104
|
if (skillRoot && !dryRun)
|
|
103
105
|
config.install(sourceDir, skillRoot);
|
|
104
106
|
const verb = dryRun ? 'would write' : 'wrote';
|
|
105
|
-
console.
|
|
107
|
+
console.error(chalk.green(` ✓ ${config.label}`) + chalk.dim(` — ${verb} MCP ${connector.name} → ${mcp}${skillRoot ? `; skill → ${skillRoot}` : ''}`));
|
|
106
108
|
}
|
|
107
|
-
console.
|
|
109
|
+
console.error(dryRun
|
|
108
110
|
? chalk.bold('\nDry run: nothing was written.')
|
|
109
111
|
: chalk.bold(`\nDone. Restart the agent; it asks you to sign in to ${connector.url} the first time it uses a tool.`));
|
|
110
112
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-setup.js","sourceRoot":"","sources":["../../../src/commands/agent-setup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,QAAQ,EAAE,YAAY,EAAgB,MAAM,aAAa,CAAC;AAEpG,iFAAiF;AACjF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAuC,CAAC;AAQxF,2GAA2G;AAC3G,MAAM,UAAU,gBAAgB,CAAC,SAAS,GAAG,YAAY,EAAE;IACzD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,CAAsD,CAAC;IACxI,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC;IACrD,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG;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AM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,aAAa,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;QACzJ,CAAC;QACD,OAAO,CAAC,KAAK,CAAC,MAAM;YAClB,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,iCAAiC,CAAC;YAC/C,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,wDAAwD,SAAS,CAAC,GAAG,iCAAiC,CAAC,CAAC,CAAC;IAC1H,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
|
@@ -20,7 +20,7 @@ interface ApiOpts {
|
|
|
20
20
|
export declare function apiRequestFrom(first: string, second: string | undefined, opts: ApiOpts): Promise<RequestOptions>;
|
|
21
21
|
/**
|
|
22
22
|
* `invd api`: any operation of the spec, raw. `--paginate` follows `next_cursor` / `Link rel="next"` and prints
|
|
23
|
-
* every page (each through `--jq`), so `invd api /
|
|
23
|
+
* every page (each through `--jq`), so `invd api /v1/filings?company=AAPL --paginate --jq '.data[].accession'`
|
|
24
24
|
* streams accessions.
|
|
25
25
|
*/
|
|
26
26
|
export declare function registerApiCommand(program: Command): void;
|
package/dist/src/commands/api.js
CHANGED
|
@@ -7,6 +7,7 @@ import { runJq } from '../output/jq.js';
|
|
|
7
7
|
import { emit } from '../output/render.js';
|
|
8
8
|
import { PartialResultError, UsageError, withErrorHandling } from '../shared/errors.js';
|
|
9
9
|
import { confirmOrRefuse, readStdin } from '../shared/prompt.js';
|
|
10
|
+
import { resumeOnInterrupt } from '../shared/signals.js';
|
|
10
11
|
import { setJsonMode } from '../shared/spinner.js';
|
|
11
12
|
const METHODS = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
|
|
12
13
|
/** `-F key=value`: `true` / `false` / `null` and numbers typed, `@file` read from a file, anything else a string. */
|
|
@@ -39,7 +40,7 @@ export function apiPathOf(rawPath, baseUrl = getBaseUrl()) {
|
|
|
39
40
|
throw new UsageError(`${rawPath} is not a URL or an API path`);
|
|
40
41
|
}
|
|
41
42
|
if (target.origin !== base.origin) {
|
|
42
|
-
throw new UsageError(`invd api only calls ${base.origin} (the request carries your API key); refusing ${target.origin}. Pass a path such as /
|
|
43
|
+
throw new UsageError(`invd api only calls ${base.origin} (the request carries your API key); refusing ${target.origin}. Pass a path such as /v1/companies/AAPL`);
|
|
43
44
|
}
|
|
44
45
|
const prefix = base.pathname.replace(/\/+$/, '');
|
|
45
46
|
const path = prefix && target.pathname.startsWith(`${prefix}/`) ? target.pathname.slice(prefix.length) : target.pathname;
|
|
@@ -60,7 +61,7 @@ export async function apiRequestFrom(first, second, opts) {
|
|
|
60
61
|
if (!METHODS.includes(method))
|
|
61
62
|
throw new UsageError(`${first} is not an HTTP method (${METHODS.join(', ')})`);
|
|
62
63
|
if (!rawPath)
|
|
63
|
-
throw new UsageError('invd api needs a path, e.g. invd api /
|
|
64
|
+
throw new UsageError('invd api needs a path, e.g. invd api /v1/companies/AAPL');
|
|
64
65
|
const url = new URL(apiPathOf(rawPath), 'http://placeholder');
|
|
65
66
|
const query = {};
|
|
66
67
|
url.searchParams.forEach((value, key) => { (query[key] ??= []).push(value); });
|
|
@@ -111,7 +112,7 @@ function print(body, jq) {
|
|
|
111
112
|
}
|
|
112
113
|
/**
|
|
113
114
|
* `invd api`: any operation of the spec, raw. `--paginate` follows `next_cursor` / `Link rel="next"` and prints
|
|
114
|
-
* every page (each through `--jq`), so `invd api /
|
|
115
|
+
* every page (each through `--jq`), so `invd api /v1/filings?company=AAPL --paginate --jq '.data[].accession'`
|
|
115
116
|
* streams accessions.
|
|
116
117
|
*/
|
|
117
118
|
export function registerApiCommand(program) {
|
|
@@ -119,7 +120,7 @@ export function registerApiCommand(program) {
|
|
|
119
120
|
.command('api')
|
|
120
121
|
.description('Call any API path directly (the escape hatch for anything the command tree lacks)')
|
|
121
122
|
.argument('<method-or-path>', 'GET (default), POST, PATCH, DELETE … or the path')
|
|
122
|
-
.argument('[path]', 'The path when a method is given, e.g. /
|
|
123
|
+
.argument('[path]', 'The path when a method is given, e.g. /v1/filings?company=AAPL')
|
|
123
124
|
.option('-F, --field <key=value>', 'A parameter (query on GET / DELETE, JSON body field otherwise); typed: numbers, true / false, null, @file', collect, [])
|
|
124
125
|
.option('-f, --raw-field <key=value>', 'Like -F, always a string', collect, [])
|
|
125
126
|
.option('-H, --header <name:value>', 'An extra request header', collect, [])
|
|
@@ -132,11 +133,11 @@ export function registerApiCommand(program) {
|
|
|
132
133
|
.option('--show-cost', 'Print the credits this command cost to stderr')
|
|
133
134
|
.addHelpText('before', [
|
|
134
135
|
'Examples:',
|
|
135
|
-
' $ invd api /
|
|
136
|
-
" $ invd api GET /
|
|
136
|
+
' $ invd api /v1/companies/AAPL',
|
|
137
|
+
" $ invd api GET /v1/filings?company=AAPL --paginate --jq '.data[].accession'",
|
|
137
138
|
'',
|
|
138
139
|
].join('\n'))
|
|
139
|
-
.addHelpText('after', '\nPaths: invd completion <shell> completes every /
|
|
140
|
+
.addHelpText('after', '\nPaths: invd completion <shell> completes every /v1 path of the spec after `invd api`.\n')
|
|
140
141
|
.action(withErrorHandling(async (first, second, _raw, command) => {
|
|
141
142
|
const opts = command.opts();
|
|
142
143
|
// commander keeps --input <file> and --no-input in one attribute: a string is the file, false the switch.
|
|
@@ -160,6 +161,7 @@ export function registerApiCommand(program) {
|
|
|
160
161
|
}
|
|
161
162
|
let written = 0;
|
|
162
163
|
let cursor;
|
|
164
|
+
const unregister = resumeOnInterrupt(() => ({ written, cursor }));
|
|
163
165
|
try {
|
|
164
166
|
for await (const page of walkPages(request, first_)) {
|
|
165
167
|
print(page.body, opts.jq);
|
|
@@ -172,6 +174,9 @@ export function registerApiCommand(program) {
|
|
|
172
174
|
throw new PartialResultError(error, written, cursor);
|
|
173
175
|
throw error;
|
|
174
176
|
}
|
|
177
|
+
finally {
|
|
178
|
+
unregister();
|
|
179
|
+
}
|
|
175
180
|
}));
|
|
176
181
|
}
|
|
177
182
|
function collect(value, previous) {
|