@hginsights/hgi 0.0.0 → 0.1.0-rc.2
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 +139 -2
- package/dist/bin.js +2461 -0
- package/docs/compatibility.md +48 -0
- package/docs/exit-codes.md +49 -0
- package/docs/oss-approval.md +35 -0
- package/docs/output-formats.md +56 -0
- package/docs/releasing.md +100 -0
- package/docs/security.md +52 -0
- package/npm-shrinkwrap.json +4701 -0
- package/package.json +58 -4
- package/skills/hgi/SKILL.md +67 -0
package/package.json
CHANGED
|
@@ -1,8 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hginsights/hgi",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-rc.2",
|
|
4
|
+
"description": "Command-line client for the HG Insights MCP server, built for AI coding agents and GTM engineers.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"hgi": "dist/bin.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"skills",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE",
|
|
15
|
+
"docs",
|
|
16
|
+
"npm-shrinkwrap.json"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.19.0"
|
|
20
|
+
},
|
|
21
|
+
"os": [
|
|
22
|
+
"darwin",
|
|
23
|
+
"linux"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "node scripts/gen-skill-md.mjs && tsup",
|
|
27
|
+
"dev": "tsup --watch",
|
|
28
|
+
"typecheck": "tsc --noEmit",
|
|
29
|
+
"lint": "eslint .",
|
|
30
|
+
"test": "vitest run",
|
|
31
|
+
"test:unit": "vitest run test/unit",
|
|
32
|
+
"test:e2e": "npm run build && vitest run test/e2e",
|
|
33
|
+
"check": "npm run typecheck && npm run lint && npm test",
|
|
34
|
+
"smoke:install": "bash scripts/smoke-install.sh",
|
|
35
|
+
"prepack": "npm run build",
|
|
36
|
+
"gen:skill": "node scripts/gen-skill-md.mjs"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/HGInsights/hgi-cli.git"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@modelcontextprotocol/sdk": "^1.31.0",
|
|
44
|
+
"ajv": "^8.17.1",
|
|
45
|
+
"ajv-formats": "^3.0.1",
|
|
46
|
+
"commander": "^15.0.0",
|
|
47
|
+
"proper-lockfile": "^4.1.2",
|
|
48
|
+
"undici": "^8.11.2",
|
|
49
|
+
"yaml": "^2.9.1"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@eslint/js": "^9.0.0",
|
|
53
|
+
"@types/node": "^22.0.0",
|
|
54
|
+
"@types/proper-lockfile": "^4.1.4",
|
|
55
|
+
"eslint": "^9.0.0",
|
|
56
|
+
"postject": "1.0.0-alpha.6",
|
|
57
|
+
"tsup": "^8.5.1",
|
|
58
|
+
"typescript": "^5.6.0",
|
|
59
|
+
"typescript-eslint": "^8.0.0",
|
|
60
|
+
"vitest": "^3.0.0"
|
|
61
|
+
}
|
|
8
62
|
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hgi
|
|
3
|
+
description: Look up company, contact, technology, intent and spend data from the HG Insights MCP server with the `hgi` command-line client. Use when the user asks about a company's tech stack, firmographics, intent signals, contacts, or wants to run an HG Insights agent, and `hgi` is installed.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# hgi: the HG Insights command-line client
|
|
7
|
+
|
|
8
|
+
`hgi` is a thin client for the HG Insights MCP server. It signs in once through the user's browser, then exposes every tool the server offers to the signed-in user.
|
|
9
|
+
|
|
10
|
+
## Rules
|
|
11
|
+
|
|
12
|
+
1. **List tools first.** Run `hgi tools list --json` before your first call in a session. The list depends on the user, their organization and the server version, so never assume a tool exists and never reuse a tool list from memory. Each tool is marked `call` or `run`, and `required` shows the mandatory input fields.
|
|
13
|
+
2. **Use `hgi call <tool> --input '<json>'` for lookups.** It only runs tools the server marks read-only. It is safe to run without asking.
|
|
14
|
+
3. **Use `hgi run <tool> --input '<json>'` only with the user's approval.** It runs tools that change state or start work (for example starting an agent run, uploading an artifact by URL, or starting a customer-data discovery). It also runs tools that do not declare themselves read-only. Ask the user, say what the tool will do, then run it.
|
|
15
|
+
4. **Report the credit cost after every call.** The cost is printed on stderr (`credit_cost: N`, or `{"credit_cost":N}` when stderr is not a terminal). `unknown` or `null` means the server did not report one. Tell the user what the call cost; credits are billed to their organization.
|
|
16
|
+
5. **Never read, print or copy the credentials file** under `~/.config/hgi/`, and do not put tokens in commands. If `hgi` says the login is missing or expired, ask the user to run `hgi auth login` themselves. It opens their browser.
|
|
17
|
+
6. **Using the wrong verb fails safely.** `hgi call` on a state-changing tool, or `hgi run` on a read-only tool, exits 10, names the right verb, and sends nothing.
|
|
18
|
+
|
|
19
|
+
## Recommended permissions (Claude Code)
|
|
20
|
+
|
|
21
|
+
Allow lookups, ask for everything that can change state. Put this in your user settings (`~/.claude/settings.json`) or a trusted project's `.claude/settings.json` (headless runs ignore the settings file of a directory that was never trusted):
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"permissions": {
|
|
26
|
+
"allow": ["Bash(hgi call *)", "Bash(hgi tools list *)", "Bash(hgi auth whoami)"],
|
|
27
|
+
"ask": ["Bash(hgi run *)"]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
hgi tools list --json # what can I call?
|
|
36
|
+
hgi call company_enrich --input '{"domain":"acme.com"}' # lookup, JSON on stdout
|
|
37
|
+
hgi call search_companies --input '{"query":"saas"}' --select name,domain -f csv
|
|
38
|
+
hgi call <tool> --input '{"limit":100}' --out result.json # big result to a new file
|
|
39
|
+
hgi run <tool> --input '{...}' # only after the user approves
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- `--input` takes a JSON object. `@file.json` reads a file and `-` reads stdin.
|
|
43
|
+
- Output is JSON when piped and a table on a terminal. Use `-f json|jsonl|csv|yaml|table`.
|
|
44
|
+
- `--select a,b.c` keeps only those fields (dotted paths work through arrays). Prefer it, or `--out <new file>`, for large results; results are never truncated.
|
|
45
|
+
- `--meta` prints `{ "result": ..., "credit_cost": ..., "mcp_version": ... }` on stdout.
|
|
46
|
+
|
|
47
|
+
## Exit codes
|
|
48
|
+
|
|
49
|
+
**If an error from `hgi run` has `details.outcome_unknown: true`, whatever its exit code (1, 7 or 9), the work may already have started and been billed. Check state first; never just retry.**
|
|
50
|
+
|
|
51
|
+
| Code | Meaning | What to do |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| 0 | success | |
|
|
54
|
+
| 1 | internal error in hgi | report it; check state before re-running a `run` (see `outcome_unknown`) |
|
|
55
|
+
| 2 | invalid input or usage | fix the input; the JSON error lists the problem fields |
|
|
56
|
+
| 3 | the tool reported an error | read the message; do not blindly retry |
|
|
57
|
+
| 4 | not signed in, or login expired | ask the user to run `hgi auth login` |
|
|
58
|
+
| 5 | rate limited | wait `retry_after_seconds` from the error, then retry |
|
|
59
|
+
| 6 | out of credits | stop; tell the user. Retrying will not help |
|
|
60
|
+
| 7 | server unreachable | retry later. If `outcome_unknown` is `true`, check state before re-running a `run` |
|
|
61
|
+
| 8 | OAuth or sign-in failure | ask the user to run `hgi auth login` again |
|
|
62
|
+
| 9 | proxy or TLS problem | the error names the cause (see `NODE_EXTRA_CA_CERTS`, `HTTPS_PROXY`). After a `run`, check `outcome_unknown` before retrying |
|
|
63
|
+
| 10 | wrong verb | use the verb the error names |
|
|
64
|
+
| 11 | forbidden | the account or organization lacks access |
|
|
65
|
+
| 12 | local credential or file problem | follow the hint. If `details.tool_ran` is `true`, the tool already ran and its result is on stdout: do not re-run it |
|
|
66
|
+
|
|
67
|
+
Errors are JSON on stderr when it is not a terminal: `{"schema":1,"error":{"code","exit_code","message","hint","details"}}`.
|