@hginsights/hgi 0.1.0 → 0.2.0-rc.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 +51 -2
- package/dist/bin.js +1385 -202
- package/docs/exit-codes.md +55 -8
- package/docs/output-formats.md +38 -0
- package/docs/releasing.md +4 -1
- package/docs/security.md +14 -2
- package/npm-shrinkwrap.json +870 -314
- package/package.json +2 -2
- package/skills/hgi/SKILL.md +106 -3
package/README.md
CHANGED
|
@@ -4,8 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
It is a thin client: it signs you in through your browser, then lists and runs the tools the server offers you. It never hard-codes the tool list.
|
|
6
6
|
|
|
7
|
-
> **Status:** pre-release. The repository is private until the open-source release is approved.
|
|
8
|
-
|
|
9
7
|
## Install
|
|
10
8
|
|
|
11
9
|
macOS and Linux only. Windows is not supported (`npm` refuses the install). Pick one route:
|
|
@@ -30,8 +28,24 @@ npm view @hginsights/hgi dist.attestations # provenance attestation for the p
|
|
|
30
28
|
|
|
31
29
|
Each release also attaches a CycloneDX SBOM. See [SECURITY.md](SECURITY.md) and [docs/releasing.md](docs/releasing.md).
|
|
32
30
|
|
|
31
|
+
### Upgrading
|
|
32
|
+
|
|
33
|
+
`hgi` has no self-update command. Upgrade it the way you installed it:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
brew update && brew upgrade hginsights/tap/hgi # Homebrew: refresh the tap first, or brew won't see the new version
|
|
37
|
+
npm install -g @hginsights/hgi@latest # npm: keep the -g, a plain `npm i` installs into the current directory
|
|
38
|
+
# tarball: download the new release and replace the `hgi` on your PATH
|
|
39
|
+
hgi --version
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If `hgi --version` still shows the old version, `which -a hgi` lists every copy on your PATH and the first one wins. Keep a single install: run `brew uninstall hgi` or `npm uninstall -g @hginsights/hgi` to remove the one you don't use.
|
|
43
|
+
|
|
44
|
+
`hgi skill install` copies the agent skill, so the copy doesn't change when you upgrade. Run `hgi skill install --force` afterwards to pick up the new version's skill.
|
|
45
|
+
|
|
33
46
|
### Troubleshooting
|
|
34
47
|
|
|
48
|
+
- **`hgi auth login` ends on a `403 Forbidden` page.** Open a private window (or clear your browser's cookies for phoenix.hginsights.com, or for the host in your `HGI_BASE_URL`), sign in at https://phoenix.hginsights.com (or your `HGI_BASE_URL`) first, then open the URL `hgi auth login` printed in that same window. Sign-in still finishes in the terminal. If `hgi` already timed out, run `hgi auth login` again and open the new URL in that window.
|
|
35
49
|
- The binary and the npm install both honor `NODE_OPTIONS`. If your shell exports `--require` or `--import` hooks (for example a tracer), `hgi` can fail to start: run `env -u NODE_OPTIONS hgi ...`.
|
|
36
50
|
|
|
37
51
|
## Quick start
|
|
@@ -60,7 +74,10 @@ hgi auth login --no-browser # prints a URL; open it anywhere, then past
|
|
|
60
74
|
| `hgi auth logout [--force]` | revoke the session on the server and delete the local credentials |
|
|
61
75
|
| `hgi tools list [--refresh] [--json]` | the tools the server offers you, with `call`/`run`, required fields, schemas and the MCP version |
|
|
62
76
|
| `hgi call <tool> --input '<json>'` | run a read-only tool |
|
|
77
|
+
| `hgi call <tool> --ids @file` | run a read-only batch tool over a list of HG ids or domains, one row per line |
|
|
63
78
|
| `hgi run <tool> --input '<json>'` | run a state-changing tool |
|
|
79
|
+
| `hgi usage [--since <when>] [--by tool\|label\|day\|call]` | what `hgi` spent on this machine, from the local credit ledger (no sign-in needed) |
|
|
80
|
+
| `hgi budget status` / `hgi budget reset` | what this run has spent against `hgi call --max-credits`, and starting the count over (local only) |
|
|
64
81
|
| `hgi skill install` | copy the agent skill to `~/.claude/skills/hgi` |
|
|
65
82
|
|
|
66
83
|
Options for `call`, `run` and `tools list`:
|
|
@@ -71,11 +88,29 @@ Options for `call`, `run` and `tools list`:
|
|
|
71
88
|
- `--out <file>`: write the complete result to a new file.
|
|
72
89
|
- `--meta`: print `{result, credit_cost, mcp_version}`.
|
|
73
90
|
- `--timeout <seconds>`: per-request timeout (default 120).
|
|
91
|
+
- `--label <label>` (`call` and `run`): tag the call in the credit ledger, for example by pipeline stage. 1 to 64 characters from `A-Z a-z 0-9 . _ : / -`.
|
|
92
|
+
|
|
93
|
+
Options for `call` only (batching):
|
|
94
|
+
|
|
95
|
+
- `--ids @file` / `--ids -`: one HG id or domain per line, from a file or stdin. Blank lines and `#` lines are skipped. A line with a dot is a domain, anything else an HG id.
|
|
96
|
+
- `--ids-column <name>`: with `--ids`, read the file as CSV with a header row and take the ids from that column.
|
|
97
|
+
- `--batch-size <n>`: send fewer ids per call than the tool's limit (its schema's `maxItems`, or 25).
|
|
74
98
|
|
|
75
99
|
Global: `--base-url`, `--debug` (tokens are always masked), `--json-errors`.
|
|
76
100
|
|
|
77
101
|
The credit cost of each call is printed on stderr after it runs (`credit_cost: 3`). There is no price before the call.
|
|
78
102
|
|
|
103
|
+
Each call that gets a result back from the server (a success or a tool error) is also recorded in a local credit ledger, and `hgi usage` sums it. A call whose outcome is unknown (the connection failed after it was sent) has no result and is not recorded.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
hgi call company_enrich --input '{"domain":"acme.com"}' --label enrich
|
|
107
|
+
hgi usage --since 7d # credits and calls by tool, this machine only
|
|
108
|
+
hgi usage --by label --since today
|
|
109
|
+
hgi usage --by call -f csv # one row per call, for a spreadsheet
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`hgi usage` shows what `hgi` spent on this machine, not your organization's bill. Calls that cost `0` (a server-side cache hit or a free tool) are counted apart from calls whose cost the server did not report. See [output formats](docs/output-formats.md#hgi-usage) and [security](docs/security.md#the-credit-ledger).
|
|
113
|
+
|
|
79
114
|
## Using it from an AI coding agent
|
|
80
115
|
|
|
81
116
|
This repository ships a Claude Code skill: [`skills/hgi/SKILL.md`](skills/hgi/SKILL.md), also reachable at `.claude/skills/hgi/` inside this repo. To use it from any project:
|
|
@@ -106,6 +141,17 @@ hgi call company_enrich --input '{"domain":"acme.com"}' --select name,employees
|
|
|
106
141
|
hgi call search_companies --input '{"query":"saas"}' -f csv --out saas.csv
|
|
107
142
|
```
|
|
108
143
|
|
|
144
|
+
### Looking up a whole list
|
|
145
|
+
|
|
146
|
+
`--ids` splits a list into batches the tool accepts, sends them one at a time, and prints one JSONL row per input line, in your file's order, as soon as each batch returns:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
hgi call company_spend --ids @hg_ids.txt --input '{"category_names":["CRM"]}' > spend.jsonl
|
|
150
|
+
hgi call company_spend --ids @accounts.csv --ids-column hg_id --input '{"category_names":["CRM"]}'
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Each row is `{"input": "<your line>", "result": {...}}` or `{"input": "<your line>", "error": {"code": "not_found", "message": "..."}}`, so joining back to your spreadsheet works even when the server drops leading zeros from ids or you wrote `https://www.Example.com/about`. Duplicate lines are sent once and get their row repeated. Running the same file again sends identical batches. The rest of `--input` is sent with every batch. A failed batch marks its rows with the error, the run continues, and the exit code is 3. Out of credits, an expired sign-in or an unreachable server stops the run at once, with the rows so far kept (see [exit codes](docs/exit-codes.md#partial-output-from---ids)). The total credit cost is printed once at the end.
|
|
154
|
+
|
|
109
155
|
## Configuration
|
|
110
156
|
|
|
111
157
|
| Variable | Meaning |
|
|
@@ -117,6 +163,9 @@ hgi call search_companies --input '{"query":"saas"}' -f csv --out saas.csv
|
|
|
117
163
|
| `NODE_EXTRA_CA_CERTS` | extra CA bundle for corporate TLS inspection |
|
|
118
164
|
| `XDG_CONFIG_HOME`, `XDG_CACHE_HOME` | move `~/.config/hgi` and `~/.cache/hgi` |
|
|
119
165
|
| `HGI_CONFIG_DIR`, `HGI_CACHE_DIR` | explicit directories (must not be inside a git working tree) |
|
|
166
|
+
| `HGI_LEDGER` | credit ledger path (default `<config dir>/ledger.jsonl`; must not be inside a git working tree), or `off` to keep no history |
|
|
167
|
+
| `HGI_MAX_CREDITS` | run cap for `hgi call`, same as `--max-credits` (the flag wins). See [Run cap](docs/exit-codes.md#run-cap) |
|
|
168
|
+
| `HGI_BUDGET_ID` | the run a capped `hgi call` counts against (default: the parent process id); when set, also recorded with each call in the credit ledger, to group the calls of one run |
|
|
120
169
|
|
|
121
170
|
`hgi` sends the User-Agent `hgi/<version>` and has no telemetry: it talks only to the server you configure, and sends nothing to HG Insights or anyone else about how you use it.
|
|
122
171
|
|