@revfleet/hscli 0.8.6 → 0.8.10
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/CHANGELOG.md +240 -0
- package/CONTRIBUTING.md +120 -0
- package/README.md +14 -6
- package/brand/readme-hero.svg +25 -0
- package/dist/cli.js +10 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/account/index.js +5 -6
- package/dist/commands/account/index.js.map +1 -1
- package/dist/commands/api/index.js +43 -3
- package/dist/commands/api/index.js.map +1 -1
- package/dist/commands/auth/index.js +32 -6
- package/dist/commands/auth/index.js.map +1 -1
- package/dist/commands/cms/hubdb.js +64 -1
- package/dist/commands/cms/hubdb.js.map +1 -1
- package/dist/commands/cms/index.js +27 -0
- package/dist/commands/cms/index.js.map +1 -1
- package/dist/commands/cms/source-code.js +21 -0
- package/dist/commands/cms/source-code.js.map +1 -1
- package/dist/commands/communication-preferences/index.js +11 -12
- package/dist/commands/communication-preferences/index.js.map +1 -1
- package/dist/commands/crm/shared.d.ts +1 -0
- package/dist/commands/crm/shared.js +3 -4
- package/dist/commands/crm/shared.js.map +1 -1
- package/dist/commands/events/index.js +7 -8
- package/dist/commands/events/index.js.map +1 -1
- package/dist/commands/marketing/index.js +58 -3
- package/dist/commands/marketing/index.js.map +1 -1
- package/dist/commands/settings/index.js +12 -13
- package/dist/commands/settings/index.js.map +1 -1
- package/dist/commands/workflows/index.js +43 -0
- package/dist/commands/workflows/index.js.map +1 -1
- package/dist/core/http.d.ts +27 -0
- package/dist/core/http.js +102 -18
- package/dist/core/http.js.map +1 -1
- package/dist/core/plugins.d.ts +5 -2
- package/dist/core/plugins.js +18 -1
- package/dist/core/plugins.js.map +1 -1
- package/dist/core/telemetry-context.d.ts +13 -0
- package/dist/core/telemetry-context.js +30 -0
- package/dist/core/telemetry-context.js.map +1 -0
- package/dist/mcp/hubspot-modules.d.ts +30 -0
- package/dist/mcp/hubspot-modules.js +305 -0
- package/dist/mcp/hubspot-modules.js.map +1 -0
- package/dist/mcp/server.d.ts +2 -0
- package/dist/mcp/server.js +30 -26
- package/dist/mcp/server.js.map +1 -1
- package/docs/ARCHITECTURE.md +39 -0
- package/docs/CAPABILITY_LIBRARY.md +638 -0
- package/docs/CMS_SETUP.md +349 -0
- package/docs/COMMAND_COMPATIBILITY.md +24 -0
- package/docs/COMMAND_TREE.md +183 -0
- package/docs/COMMERCE_SETUP.md +400 -0
- package/docs/COMPARISON.md +146 -0
- package/docs/COOKBOOK.md +800 -0
- package/docs/INTEGRATIONS_NOTIFICATIONS_SETUP.md +352 -0
- package/docs/MARKETING_SETUP.md +503 -0
- package/docs/MCP.md +171 -0
- package/docs/OPERATIONAL_PLAYBOOKS.md +322 -0
- package/docs/OPERATIONS_SETUP.md +362 -0
- package/docs/PLUGIN_GUIDE.md +158 -0
- package/docs/POLICY_EXAMPLE.json +57 -0
- package/docs/PORTAL_SETUP.md +683 -0
- package/docs/PUBLISHING.md +154 -0
- package/docs/RELEASE_GOVERNANCE.md +34 -0
- package/docs/REPORTING_SETUP.md +310 -0
- package/docs/ROADMAP-DATE-BASED-API.md +103 -0
- package/docs/ROADMAP_PHASE1_TO_3.md +96 -0
- package/docs/SAFETY_MODEL.md +37 -0
- package/docs/SALES_SETUP.md +369 -0
- package/docs/SERVICE_SETUP.md +403 -0
- package/docs/TESTING_PLAN.md +89 -0
- package/docs/TIERS.md +320 -0
- package/docs/TUTORIALS/audit-portal-writes.md +150 -0
- package/docs/TUTORIALS/secure-agent-writes.md +177 -0
- package/docs/TUTORIALS/trace-replay-repro.md +147 -0
- package/docs/WHY_HOW_WHAT.md +81 -0
- package/package.json +7 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,245 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.10 - 2026-04-24
|
|
4
|
+
|
|
5
|
+
**Polish follow-up to 0.8.9.** Five small fixes from the PR #43 review —
|
|
6
|
+
no behavior change on the safety rails landed in 0.8.9, just closing
|
|
7
|
+
gaps around product claim honesty, packaging, regression coverage,
|
|
8
|
+
first-call hublet UX, and doc freshness.
|
|
9
|
+
|
|
10
|
+
### Changed — README claim wording aligned with package.json
|
|
11
|
+
|
|
12
|
+
The README's "What '1,180 endpoints' means" block previously said
|
|
13
|
+
"Every one of HubSpot's documented public API endpoints has a
|
|
14
|
+
corresponding CLI subcommand." Rewritten to "covers **~all** of
|
|
15
|
+
HubSpot's documented public API endpoints" with an explicit list of
|
|
16
|
+
reachability gates (tier, scope, auth model, deprecation, UI-only)
|
|
17
|
+
and a pointer to the ❌/⚠️/✅ matrix in `docs/CAPABILITY_LIBRARY.md`.
|
|
18
|
+
The "Full surface coverage" details summary also softened to
|
|
19
|
+
"Surface coverage".
|
|
20
|
+
|
|
21
|
+
### Fixed — more packaged-docs link breakage on npm
|
|
22
|
+
|
|
23
|
+
0.8.9 caught `docs/TUTORIALS/*.md` and `docs/POLICY_EXAMPLE.json`.
|
|
24
|
+
Review flagged a second batch: `brand/readme-hero.svg`,
|
|
25
|
+
`CONTRIBUTING.md`, `scripts/demo.sh`, `scripts/demo.tape`, and
|
|
26
|
+
`scripts/README.md` were still relative and not in the tarball.
|
|
27
|
+
|
|
28
|
+
- `brand/readme-hero.svg` + `CONTRIBUTING.md` added to `files`
|
|
29
|
+
(small, make sense in-package).
|
|
30
|
+
- `scripts/*` links rewritten to absolute
|
|
31
|
+
`github.com/revfleet/hscli/blob/main/...` URLs since the
|
|
32
|
+
`scripts/` directory also contains ~200KB of Python helpers, a
|
|
33
|
+
`__pycache__/`, and release tooling that don't belong in npm.
|
|
34
|
+
|
|
35
|
+
### Added — security regression tests (`tests/bugfixes-v0.8.9.test.ts`)
|
|
36
|
+
|
|
37
|
+
Locking in 0.8.9's hardening so future refactors don't silently
|
|
38
|
+
re-open the leaks:
|
|
39
|
+
|
|
40
|
+
- **`auth token-info` never writes the raw token to telemetry**
|
|
41
|
+
(verifies the `/oauth/v1/access-tokens/{token}` path is redacted
|
|
42
|
+
to `/oauth/v1/access-tokens/[REDACTED]`).
|
|
43
|
+
- **`--include-bodies` redacts secrets in request + response**
|
|
44
|
+
(posts a `pat-na1-…` in the request body and receives it in the
|
|
45
|
+
response body, asserts the raw value never appears in the JSONL
|
|
46
|
+
and `[REDACTED]` does).
|
|
47
|
+
- **CLI path surfaces `changeTicket` in telemetry**
|
|
48
|
+
(covers the env-bridge fallback — the MCP-only ALS test from
|
|
49
|
+
0.8.9 didn't exercise the non-MCP code path).
|
|
50
|
+
|
|
51
|
+
### Changed — `auth login` uses hublet-aware verification URL
|
|
52
|
+
|
|
53
|
+
`fetchPortalDetails()` previously always hit `api.hubapi.com` for
|
|
54
|
+
the initial `/account-info/v3/details` probe. For EU/AP portals
|
|
55
|
+
this first call fails and the code falls through to another probe
|
|
56
|
+
before the hublet gets saved. Now the token prefix (`pat-eu1-…`,
|
|
57
|
+
`pat-ap1-…`) is passed through the existing `detectHublet()`
|
|
58
|
+
helper before the first fetch, so EU/AP users get a 2xx on the
|
|
59
|
+
first try instead of a silent fallback.
|
|
60
|
+
|
|
61
|
+
### Changed — stale doc references to `~/.hscli`
|
|
62
|
+
|
|
63
|
+
Some operational docs still pointed to the pre-rebrand config dir:
|
|
64
|
+
|
|
65
|
+
- `docs/MCP.md` — example `HSCLI_HOME` value corrected to
|
|
66
|
+
`/absolute/path/to/.revfleet`.
|
|
67
|
+
- `docs/OPERATIONAL_PLAYBOOKS.md` — 7 shell snippets rewritten from
|
|
68
|
+
`~/.hscli/` → `~/.revfleet/`. The single reference to
|
|
69
|
+
HubSpot's official `@hubspot/cli` (which *does* use
|
|
70
|
+
`~/.hscli.config.yml`) is now explicitly flagged as such.
|
|
71
|
+
- `docs/ROADMAP_PHASE1_TO_3.md` — plugin discovery entry updated to
|
|
72
|
+
reflect 0.8.9's opt-in `HSCLI_PLUGIN_AUTO_DISCOVER` model.
|
|
73
|
+
|
|
74
|
+
## 0.8.9 - 2026-04-23
|
|
75
|
+
|
|
76
|
+
**Security hardening + hublet routing completeness.** Addresses five
|
|
77
|
+
audit findings against 0.8.8 (Codex review on `revfleet/hscli@2e169f0`).
|
|
78
|
+
|
|
79
|
+
### Fixed — P1: trace/audit logs could leak tokens
|
|
80
|
+
|
|
81
|
+
- `src/core/http.ts` now redacts the telemetry event before writing to
|
|
82
|
+
the JSONL. Request bodies, response bodies, and error strings pass
|
|
83
|
+
through `redactSensitive()` from `core/output.ts`. The request path
|
|
84
|
+
is also run through a new `redactTokenPath()` helper that replaces
|
|
85
|
+
the token segment on `/oauth/v1/access-tokens/{token}` and
|
|
86
|
+
`/oauth/v1/refresh-tokens/{token}`, so `hscli auth token-info`
|
|
87
|
+
traces no longer capture the raw secret.
|
|
88
|
+
- The trace-help text (`hscli trace start --include-bodies` —
|
|
89
|
+
"redacted for secrets") now matches actual behavior.
|
|
90
|
+
|
|
91
|
+
### Fixed — P1: several commands bypassed hublet routing
|
|
92
|
+
|
|
93
|
+
Commands instantiating `new HubSpotClient(getToken(profile))` directly
|
|
94
|
+
fell back to `api.hubapi.com` regardless of the profile's `hublet`
|
|
95
|
+
setting, so EU1/AP portal writes silently hit the wrong base URL.
|
|
96
|
+
|
|
97
|
+
Swapped to `createClient(profile)` (which resolves `getApiBaseUrl`)
|
|
98
|
+
across: `commands/account`, `commands/auth` (`token-info`),
|
|
99
|
+
`commands/communication-preferences`, `commands/events`,
|
|
100
|
+
`commands/marketing` (helper path), `commands/settings`,
|
|
101
|
+
`mcp/server` (`executeTool`), `mcp/hubspot-modules`.
|
|
102
|
+
|
|
103
|
+
### Fixed — P2: MCP cannot provide change tickets (and audit it)
|
|
104
|
+
|
|
105
|
+
`baseArgsSchema` and `McpBaseArgs` now include an optional
|
|
106
|
+
`changeTicket` field. `mcpContext()` threads it into the `CliContext`
|
|
107
|
+
so policies with `requireChangeTicket: true` accept MCP writes.
|
|
108
|
+
|
|
109
|
+
The ticket is **also written into the trace/audit JSONL** — the first
|
|
110
|
+
iteration of this PR only threaded it into the policy check but
|
|
111
|
+
left telemetry blind to it (review feedback). `TelemetryContext`
|
|
112
|
+
now carries `changeTicket`, `executeTool()` extends the ALS scope
|
|
113
|
+
with it via a new `withTelemetryContext()` helper, and
|
|
114
|
+
`emitTelemetry()` emits it on every event. For CLI (non-MCP), the
|
|
115
|
+
preAction hook sets `HSCLI_CHANGE_TICKET` so the HTTP layer picks
|
|
116
|
+
it up as an env fallback (CLI is single-invocation per process, so
|
|
117
|
+
env is race-safe). `HSCLI_POLICY_FILE` + `HSCLI_CHANGE_TICKET` are
|
|
118
|
+
also honored on MCP so agents can inject without a code change.
|
|
119
|
+
|
|
120
|
+
Regression test: `changeTicket from MCP args is written into the
|
|
121
|
+
telemetry event` in `tests/bugfixes-v0.7.1.test.ts`.
|
|
122
|
+
|
|
123
|
+
### Fixed — P2: MCP tool-name attribution was process-global
|
|
124
|
+
|
|
125
|
+
`registerMcpTool()` previously mutated `process.env.HSCLI_MCP_TOOL_NAME`
|
|
126
|
+
around the async handler, so two concurrent MCP calls would clobber
|
|
127
|
+
each other's tool name. Replaced with `AsyncLocalStorage` in a new
|
|
128
|
+
`core/telemetry-context.ts` module. `emitTelemetry()` in `http.ts`
|
|
129
|
+
reads `toolName` from the ALS store, which is scoped to each
|
|
130
|
+
invocation's async chain.
|
|
131
|
+
|
|
132
|
+
### Fixed — P2: plugin auto-discovery is now opt-in
|
|
133
|
+
|
|
134
|
+
`core/plugins.ts` no longer imports every `node_modules` package with
|
|
135
|
+
keyword `hscli-plugin` by default. Auto-discovery runs only when
|
|
136
|
+
`HSCLI_PLUGIN_AUTO_DISCOVER=1`, and when it does, hscli prints the
|
|
137
|
+
resolved package list to stderr before loading. Explicit `HSCLI_PLUGINS`
|
|
138
|
+
allowlist is always honored. Documented in `docs/PLUGIN_GUIDE.md`.
|
|
139
|
+
|
|
140
|
+
### Added — `auth login` portal verification warning
|
|
141
|
+
|
|
142
|
+
`hscli auth login` now warns loudly on stderr when the token was saved
|
|
143
|
+
but `/account-info/v3/details` and `/integrations/v1/me` both failed —
|
|
144
|
+
previously the command succeeded silently with an unverifiable token.
|
|
145
|
+
`--no-verify` skips the check for offline/restricted-network setups.
|
|
146
|
+
|
|
147
|
+
### Changed — packaging
|
|
148
|
+
|
|
149
|
+
`files` in `package.json` now includes `docs/*.md`,
|
|
150
|
+
`docs/TUTORIALS/*.md`, and `docs/POLICY_EXAMPLE.json` so the
|
|
151
|
+
README's doc links resolve after `npm install`. Previously only
|
|
152
|
+
`docs/policy-templates/` was shipped. The top-level `docs/*.md`
|
|
153
|
+
glob is non-recursive, so `TUTORIALS/` needed its own explicit
|
|
154
|
+
entry (review feedback). The README's `demo-*.gif` references were
|
|
155
|
+
switched to absolute GitHub raw URLs since the 14 MB of demo
|
|
156
|
+
assets don't belong in the tarball.
|
|
157
|
+
|
|
158
|
+
### Changed — product positioning
|
|
159
|
+
|
|
160
|
+
`package.json.description` rewritten: "~all documented public
|
|
161
|
+
endpoints" instead of "100% public API coverage". Reachability is
|
|
162
|
+
tier/scope/auth-model/deprecation-gated; see `docs/CAPABILITY_LIBRARY.md`
|
|
163
|
+
for the ❌/⚠️/✅ matrix.
|
|
164
|
+
|
|
165
|
+
## 0.8.8 - 2026-04-23
|
|
166
|
+
|
|
167
|
+
**Multipart HTTP support + MCP drag-and-drop module tools.** Two
|
|
168
|
+
complementary unlocks that close the last major capability gaps from
|
|
169
|
+
the re-audit series.
|
|
170
|
+
|
|
171
|
+
### Added — multipart HTTP (Node 20+ native FormData)
|
|
172
|
+
|
|
173
|
+
`src/core/http.ts` now accepts `RequestOptions.multipart` — a field-name
|
|
174
|
+
→ (string | `{path, contentType?, filename?}`) record. Internally it
|
|
175
|
+
builds a native `FormData` and lets the runtime emit the correct
|
|
176
|
+
`multipart/form-data; boundary=…` Content-Type. Manually setting the
|
|
177
|
+
header without a boundary was the root cause of every 415 we hit
|
|
178
|
+
(confirmed via reading HubSpot's own [nodejs SDK source](https://github.com/HubSpot/hubspot-api-nodejs)).
|
|
179
|
+
|
|
180
|
+
Three new CLI commands:
|
|
181
|
+
|
|
182
|
+
- `hscli cms source-code upload <env> <destPath> --file <localPath> [--content-type <mime>]` — PUT a local file to a CMS source-code path. Verified live.
|
|
183
|
+
- `hscli cms hubdb import <tableId> --file <csv> --config '<json>'` — import rows into a HubDB draft table (multipart: `config` + `file` parts). Transport verified; CSV imports themselves require a Content-Hub plan tier that supports them.
|
|
184
|
+
- `hscli cms upload <destPath> --file <localPath> [--content-type <mime>]` — mirrors the legacy `content/filemapper/v1/upload/{dest}` endpoint that HubSpot's own `hs upload` command uses under the hood (not in public dev-docs). Verified live.
|
|
185
|
+
|
|
186
|
+
New flags on raw passthrough:
|
|
187
|
+
|
|
188
|
+
- `hscli api request --file <field>=<path>[:<contentType>]` — repeatable file part attachment.
|
|
189
|
+
- `hscli api request --part <field>=<value>` — repeatable text part attachment.
|
|
190
|
+
|
|
191
|
+
Combined: any multipart endpoint is reachable without a dedicated wrapper command.
|
|
192
|
+
|
|
193
|
+
### Added — MCP drag-and-drop module tools
|
|
194
|
+
|
|
195
|
+
Three new MCP tools wire HubSpot's full `@hubspot/*` module library into the agent surface:
|
|
196
|
+
|
|
197
|
+
- **`hubspot_module_list`** — enumerate built-in modules on the caller's portal, with `--schemas` for inline field definitions.
|
|
198
|
+
- **`hubspot_module_describe`** — fetch one module's `fields.json` (types, required, defaults, choices, nested groups). The same schema a UI user sees when they click a module.
|
|
199
|
+
- **`hubspot_module_compose`** — given a module path + field values, returns a validated widget body ready to embed in `content.widgets[widgetId]`. Rejects unknown fields + type mismatches before the widget is posted to HubSpot.
|
|
200
|
+
|
|
201
|
+
Design: one dynamic compose tool instead of auto-generating 55 per-module tools, matching how a drag-drop user actually works (browse → describe → fill).
|
|
202
|
+
|
|
203
|
+
### Fixes
|
|
204
|
+
|
|
205
|
+
- [docs/CAPABILITY_LIBRARY.md](docs/CAPABILITY_LIBRARY.md) §6 CMS source-code + §6 HubDB import + §13 multipart table — all ⚠️ rows for multipart endpoints flip to ✅. Appendix B gains a subsection describing the 3 new MCP tools and the agent "browse → describe → fill" flow.
|
|
206
|
+
|
|
207
|
+
## 0.8.7 - 2026-04-23
|
|
208
|
+
|
|
209
|
+
**Third docs pass + HubSpot open-source scan.** Reviewed
|
|
210
|
+
[HubSpot/hubspot-local-dev-lib](https://github.com/HubSpot/hubspot-local-dev-lib),
|
|
211
|
+
[HubSpot/hubspot-api-nodejs](https://github.com/HubSpot/hubspot-api-nodejs),
|
|
212
|
+
and the official `hs` CLI source to find API paths HubSpot's own
|
|
213
|
+
tooling hits but their public docs don't navigate to. Each discovery
|
|
214
|
+
was probed live on portal 147975758.
|
|
215
|
+
|
|
216
|
+
### Added
|
|
217
|
+
|
|
218
|
+
- **`hscli cms hubdb export <tableId> --format CSV|XLSX|XLS [--output <path>]`** — export a HubDB table; writes to disk when `--output` is set, returns inline content otherwise.
|
|
219
|
+
- **`hscli marketing emails revisions <emailId>`** — full revision history (`GET /marketing/v3/emails/{id}/revisions`).
|
|
220
|
+
- **`hscli marketing emails revision-restore <emailId> <revisionId>`** — restore a past revision to DRAFT (surfaced from SDK, not in public dev-docs nav).
|
|
221
|
+
- **`hscli marketing emails unpublish <emailId>`** — unpublish a published email.
|
|
222
|
+
- **`hscli marketing emails draft-reset <emailId>`** — reset draft to the last-published state.
|
|
223
|
+
- **`hscli workflows id-map <id>`** — resolve the v3 `workflowId` ↔ v4 `flowId` pair (reads `migrationStatus` from either API).
|
|
224
|
+
|
|
225
|
+
### Fixes
|
|
226
|
+
|
|
227
|
+
- **Endpoint allowlist expanded** to 6 more path families (hscli's own `INVALID_PATH_SCOPE` guard was blocking HubSpot-served paths):
|
|
228
|
+
- `/apps-dev/external/public/v3/*` — app install analytics
|
|
229
|
+
- `/apps-hublets/external/static-token/v3` — hublet app install
|
|
230
|
+
- `/dfs/v1/*`, `/dfs/deploy/v1/*`, `/dfs/deploy/v3/*`, `/dfs/logging/v1/*`, `/dfs/migrations/v1/*` — developer file system (used by `hs project upload`)
|
|
231
|
+
- `/project-components-external/v3/*` — new-in-2026 project upload-with-IR endpoint
|
|
232
|
+
- `/file-transport/v1/hubfiles/*` — HubFiles schemas (used by `hs hubfiles`)
|
|
233
|
+
- `/localdevauth/v1/*` — local-dev account linking
|
|
234
|
+
|
|
235
|
+
### Known gap (⚠️)
|
|
236
|
+
|
|
237
|
+
- **Multipart/form-data uploads** — hscli's HTTP client currently sends everything as `application/json`. HubSpot requires real multipart (with FormData-generated boundary) for 5 endpoint families: `cms/v3/source-code/*` uploads, `hubdb/*/draft/import`, `content/filemapper/v1/upload/*` (the legacy endpoint `hs upload` actually uses), `file-transport/v1/hubfiles/*`, `project-components-external/v3/upload/new-api`. One HTTP-client change unblocks all five. Called out in §12 roadmap + §13 of the capability library.
|
|
238
|
+
|
|
239
|
+
### Docs
|
|
240
|
+
|
|
241
|
+
- [docs/CAPABILITY_LIBRARY.md](docs/CAPABILITY_LIBRARY.md) gains a new §13 "Undocumented endpoints surfaced from HubSpot's open-source repos" — maps the GitHub findings to allowlist entries + multipart-required entries.
|
|
242
|
+
|
|
3
243
|
## 0.8.6 - 2026-04-23
|
|
4
244
|
|
|
5
245
|
**Docs re-audit finds 4 more endpoints previously flagged as blocked.**
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Contributing to hscli
|
|
2
|
+
|
|
3
|
+
Thanks for considering a contribution. hscli is built to a high bar — security, safety, and rigor first. Please read this doc before opening issues or PRs.
|
|
4
|
+
|
|
5
|
+
## Ground rules
|
|
6
|
+
|
|
7
|
+
1. **Security-first.** hscli handles HubSpot private app tokens. Any change must preserve:
|
|
8
|
+
- Secret redaction in output and error paths
|
|
9
|
+
- File permissions on the auth store (0700 dir, 0600 file)
|
|
10
|
+
- Path scope allowlisting
|
|
11
|
+
- No plaintext tokens in logs, telemetry, or error traces
|
|
12
|
+
2. **Type-safety.** TypeScript strict mode is mandatory. `any` is allowed only with an inline comment justifying it.
|
|
13
|
+
3. **Tests required.** New commands need at least a CLI smoke test. New transport paths need an http.test.ts case. MCP tools need an mcp.test.ts case.
|
|
14
|
+
4. **Backwards compatibility.** Don't rename or remove existing commands / flags in a minor release. If you must, open a discussion first.
|
|
15
|
+
5. **100% surface coverage is the contract.** hscli claims to cover every public HubSpot endpoint. If HubSpot publishes a new endpoint, there's a gap to fill. PRs adding a new endpoint are welcome and merged fast. See [docs/TIERS.md](docs/TIERS.md) for the current mapping of endpoints → required HubSpot plan tier.
|
|
16
|
+
|
|
17
|
+
## When an endpoint doesn't work for you
|
|
18
|
+
|
|
19
|
+
First, check [docs/TIERS.md](docs/TIERS.md) — most "it doesn't work" cases are because the endpoint requires a paid HubSpot tier or specific app context:
|
|
20
|
+
|
|
21
|
+
| Symptom | Likely cause | Fix |
|
|
22
|
+
|---|---|---|
|
|
23
|
+
| 401 / *"requires hapikey="* | [Zombie endpoint](docs/TIERS.md#zombie-endpoints) — HubSpot's legacy Developer API Key | Not fixable in hscli; HubSpot must migrate. Track with label `hubspot-platform` |
|
|
24
|
+
| 403 / *"not available on your account"* | Tier-locked | Upgrade the HubSpot plan or test on a portal that has it |
|
|
25
|
+
| 404 on a `{revisionId}` path | No revision history | Edit a page first to create a revision |
|
|
26
|
+
| 404 on a `{appId}` path | Need OAuth Developer App | See [OAuth setup](docs/TIERS.md#developer-platform-hubspot-developer-account-free) |
|
|
27
|
+
| 400 / validation error | Body payload incomplete | Check HubSpot docs for required fields; pass via `--data` |
|
|
28
|
+
|
|
29
|
+
If the endpoint **should** work on your tier but doesn't, open an [endpoint issue](https://github.com/revfleet/hscli/issues/new?template=endpoint_not_working.md) with:
|
|
30
|
+
- The `hscli` command you ran
|
|
31
|
+
- Your portal's tier per hub
|
|
32
|
+
- The HubSpot correlation ID from the response
|
|
33
|
+
- Whether the same operation works in the HubSpot UI
|
|
34
|
+
|
|
35
|
+
These issues are triaged quickly. If the cause is a bug in hscli's payload construction or path handling, we fix it in a patch release.
|
|
36
|
+
|
|
37
|
+
## Running the portal probes
|
|
38
|
+
|
|
39
|
+
hscli ships two probe scripts that test the portal's reachable surface:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Read probe (GET + safe POST /search endpoints)
|
|
43
|
+
HSCLI_PROFILE=default HSCLI_DEV_APP_ID=<optional> \
|
|
44
|
+
node scripts/test-portal-coverage.mjs > coverage.md
|
|
45
|
+
|
|
46
|
+
# Write probe (POST / PUT / PATCH / DELETE endpoints)
|
|
47
|
+
HSCLI_PROFILE=default HSCLI_DEV_APP_ID=<optional> \
|
|
48
|
+
node scripts/test-portal-writes.mjs > writes.md
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Both scripts:
|
|
52
|
+
- Discover real IDs from the portal dynamically
|
|
53
|
+
- Classify responses as PASS / VALIDATION / AUTH / ZOMBIE / TIER / 404
|
|
54
|
+
- Auto-retry 405 Method Not Allowed with the Allow-header's suggested verb
|
|
55
|
+
- Skip scrape artifacts (paths like `/{0}`)
|
|
56
|
+
|
|
57
|
+
If your probe run surfaces endpoints that are reachable on a different tier or region than what hscli's capability cache claims, open an issue — it's valuable telemetry.
|
|
58
|
+
|
|
59
|
+
## Development workflow
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
git clone https://github.com/revfleet/hscli.git
|
|
63
|
+
cd hscli
|
|
64
|
+
npm install
|
|
65
|
+
npm run typecheck
|
|
66
|
+
npm test
|
|
67
|
+
npm run build
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Watch mode:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm run dev -- crm contacts list --limit 3
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Run a command against a real sandbox (you need a HubSpot sandbox token):
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
export HSCLI_HOME="$(mktemp -d)"
|
|
80
|
+
printf '%s' "$SANDBOX_TOKEN" | node dist/cli.js auth login --token-stdin
|
|
81
|
+
node dist/cli.js crm contacts list --limit 3
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Run the contract tests against a sandbox:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
export HSCLI_ENABLE_SANDBOX_CONTRACT=1
|
|
88
|
+
export HSCLI_SANDBOX_TOKEN="pat-..."
|
|
89
|
+
npm run test:contract
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Adding a new command
|
|
93
|
+
|
|
94
|
+
1. Put the command under `src/commands/<domain>/` (e.g. `src/commands/crm/`)
|
|
95
|
+
2. Follow the existing pattern — use `registerResource()` for CRUD or hand-roll with `commander` for special endpoints
|
|
96
|
+
3. Use `encodePathSegment()` on every dynamic path part
|
|
97
|
+
4. Route writes through `maybeWrite()` so the safety gate is enforced
|
|
98
|
+
5. Validate JSON payloads with `parseJsonPayload()` and numeric flags with `parseNumberFlag()`
|
|
99
|
+
6. Add a CLI test in `tests/cli.test.ts`
|
|
100
|
+
7. If the command should also be callable from MCP, register it in `src/mcp/server.ts`
|
|
101
|
+
8. Update `docs/COMMAND_TREE.md`
|
|
102
|
+
|
|
103
|
+
## Reporting security issues
|
|
104
|
+
|
|
105
|
+
Do **not** open a public issue for security vulnerabilities. Email the maintainer directly (see SECURITY.md) or use GitHub Security Advisories on this repository.
|
|
106
|
+
|
|
107
|
+
## Style
|
|
108
|
+
|
|
109
|
+
- Biome handles lint + format: `npm run lint:fix`
|
|
110
|
+
- Prefer `import type` for type-only imports
|
|
111
|
+
- Don't use default exports except where required
|
|
112
|
+
- Keep functions small, side-effects explicit
|
|
113
|
+
|
|
114
|
+
## Release process
|
|
115
|
+
|
|
116
|
+
See [docs/RELEASE_GOVERNANCE.md](docs/RELEASE_GOVERNANCE.md).
|
|
117
|
+
|
|
118
|
+
## Licensing
|
|
119
|
+
|
|
120
|
+
All contributions are licensed MIT, the same as the project. By opening a PR you agree your contribution is MIT-licensed and you have the right to submit it.
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
15
|
<p align="center">
|
|
16
|
-
<img src="docs/demo-hubspot.gif" alt="hscli writing into a HubSpot portal in real time — records appear in the UI as hscli creates them" width="100%">
|
|
16
|
+
<img src="https://raw.githubusercontent.com/revfleet/hscli/main/docs/demo-hubspot.gif" alt="hscli writing into a HubSpot portal in real time — records appear in the UI as hscli creates them" width="100%">
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
19
|
<p align="center">
|
|
@@ -107,7 +107,7 @@ Every request hscli makes is append-only JSONL. Pair `trace` with `audit` for fu
|
|
|
107
107
|
## What's in the box
|
|
108
108
|
|
|
109
109
|
<details>
|
|
110
|
-
<summary><strong>
|
|
110
|
+
<summary><strong>Surface coverage</strong> — click to expand</summary>
|
|
111
111
|
|
|
112
112
|
- **CRM** — contacts, companies, deals, tickets, leads, quotes, products, line items, orders, carts, discounts, fees, taxes, invoices, subscriptions, payments, goals, communications, users, custom objects, properties, pipelines, associations v4, owners, imports, exports, engagements, sync, describe/validate, timeline, CRM Cards
|
|
113
113
|
- **Marketing** — emails (v3 + legacy v1), campaigns, ads, social, SEO, landing pages, transactional, subscriptions, events, behavioral events, forms
|
|
@@ -127,9 +127,17 @@ Enterprise defaults: `--dry-run`, `--force`, policy files, change tickets, capab
|
|
|
127
127
|
|
|
128
128
|
### What "1,180 endpoints" means
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
hscli covers **~all** of HubSpot's documented public API endpoints — a CLI subcommand or MCP tool per endpoint, verified against an automated scrape of HubSpot's developer documentation. A small residue stays out of reach because it's UI-only, deprecated, or requires a developer-app auth model rather than a private-app bearer token; see [docs/CAPABILITY_LIBRARY.md](docs/CAPABILITY_LIBRARY.md) for the ❌/⚠️/✅ matrix.
|
|
131
131
|
|
|
132
|
-
|
|
132
|
+
Even within the reachable set, actual 2xx responses on your portal depend on:
|
|
133
|
+
|
|
134
|
+
- **Tier/plan gates** — hundreds of endpoints are locked to Marketing/Sales/Service/CMS/Ops/Commerce Pro/Enterprise or add-ons.
|
|
135
|
+
- **Scope gates** — the private-app token must carry the right scopes; some scopes have no public endpoint surface.
|
|
136
|
+
- **Auth-model gates** — a subset (developer-platform, app-install) require a Developer Account + `appId` + developer API key, not a bearer token.
|
|
137
|
+
- **Deprecated surfaces** — HubDB v2, CMS performance, legacy ecommerce bridge, accounting extension, marketing calendar etc. are shipped for continuity but HubSpot may 4xx them.
|
|
138
|
+
- **UI-only surfaces** — chatflow decision trees, SLA policies, quote e-signature, social-inbox reactions, scoring formulas and similar authoring flows have no public endpoint (covered in the library as ❌ hard-locks).
|
|
139
|
+
|
|
140
|
+
HubSpot's own tier map, projected onto hscli's surface:
|
|
133
141
|
|
|
134
142
|
| Portal profile | Reachable endpoints |
|
|
135
143
|
|---|---:|
|
|
@@ -161,10 +169,10 @@ hscli --format table crm contacts list --limit 5 # table (default)
|
|
|
161
169
|
The HubSpot-UI recording at the top shows the *outcome*. Here's the *cause* — the same fixture built and torn down entirely from the shell:
|
|
162
170
|
|
|
163
171
|
<p align="center">
|
|
164
|
-
<img src="docs/demo-terminal.gif" alt="hscli terminal walkthrough — blank → create → associate → read → update → archive → blank" width="100%">
|
|
172
|
+
<img src="https://raw.githubusercontent.com/revfleet/hscli/main/docs/demo-terminal.gif" alt="hscli terminal walkthrough — blank → create → associate → read → update → archive → blank" width="100%">
|
|
165
173
|
</p>
|
|
166
174
|
|
|
167
|
-
[Source script](scripts/demo.sh) · [recording config](scripts/demo.tape) · [how the recordings are made](scripts/README.md)
|
|
175
|
+
[Source script](https://github.com/revfleet/hscli/blob/main/scripts/demo.sh) · [recording config](https://github.com/revfleet/hscli/blob/main/scripts/demo.tape) · [how the recordings are made](https://github.com/revfleet/hscli/blob/main/scripts/README.md)
|
|
168
176
|
|
|
169
177
|
## Caches
|
|
170
178
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 220" width="1280" height="220">
|
|
3
|
+
<title>hscli readme hero</title>
|
|
4
|
+
<rect width="1280" height="220" fill="#0F172A"></rect>
|
|
5
|
+
|
|
6
|
+
<!-- Dotted texture for depth -->
|
|
7
|
+
<defs>
|
|
8
|
+
<pattern id="dots" x="16" y="16" width="32" height="32" patternUnits="userSpaceOnUse">
|
|
9
|
+
<circle cx="0" cy="0" r="1.2" fill="#22D3EE" fill-opacity="0.07"></circle>
|
|
10
|
+
</pattern>
|
|
11
|
+
</defs>
|
|
12
|
+
<rect width="1280" height="220" fill="url(#dots)"></rect>
|
|
13
|
+
|
|
14
|
+
<!-- Monogram -->
|
|
15
|
+
<g transform="translate(56,62)">
|
|
16
|
+
<rect width="96" height="96" rx="17.3" fill="#0F172A" stroke="#22D3EE" stroke-width="1.5" stroke-opacity="0.4"></rect>
|
|
17
|
+
<text x="48" y="48" font-family="'JetBrains Mono', 'Berkeley Mono', ui-monospace, monospace" font-weight="700" font-size="41" letter-spacing="-1" fill="#22D3EE" text-anchor="middle" dominant-baseline="central">[hs]</text>
|
|
18
|
+
</g>
|
|
19
|
+
|
|
20
|
+
<!-- Wordmark -->
|
|
21
|
+
<text x="176" y="96" font-family="'JetBrains Mono', 'Berkeley Mono', ui-monospace, monospace" font-weight="700" font-size="72" letter-spacing="-2" fill="#F8FAFC" dominant-baseline="central">hscli</text>
|
|
22
|
+
|
|
23
|
+
<!-- Tagline -->
|
|
24
|
+
<text x="176" y="148" font-family="'JetBrains Mono', 'Berkeley Mono', ui-monospace, monospace" font-weight="400" font-size="20" letter-spacing="0.3" fill="#22D3EE" dominant-baseline="central">agentic HubSpot CLI + MCP server</text>
|
|
25
|
+
</svg>
|
package/dist/cli.js
CHANGED
|
@@ -84,6 +84,16 @@ export function createProgram() {
|
|
|
84
84
|
process.env.HSCLI_REQUEST_ID = runId;
|
|
85
85
|
if (telemetryFile)
|
|
86
86
|
process.env.HSCLI_TELEMETRY_FILE = telemetryFile;
|
|
87
|
+
// CLI is single-invocation per process, so env is safe here (no
|
|
88
|
+
// concurrency). emitTelemetry() reads this as a fallback when the
|
|
89
|
+
// AsyncLocalStorage changeTicket isn't set — which is the CLI case,
|
|
90
|
+
// since only MCP runs inside runWithTelemetryContext.
|
|
91
|
+
if (ctx.changeTicket) {
|
|
92
|
+
process.env.HSCLI_CHANGE_TICKET = ctx.changeTicket;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
delete process.env.HSCLI_CHANGE_TICKET;
|
|
96
|
+
}
|
|
87
97
|
});
|
|
88
98
|
registerAuth(program, () => ctx);
|
|
89
99
|
registerDoctor(program, () => ctx);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAA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
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HubSpotClient } from "../../core/http.js";
|
|
1
|
+
import { createClient } from "../../core/http.js";
|
|
3
2
|
import { printResult } from "../../core/output.js";
|
|
4
3
|
import { parseNumberFlag } from "../crm/shared.js";
|
|
5
4
|
export function registerAccount(program, getCtx) {
|
|
@@ -9,7 +8,7 @@ export function registerAccount(program, getCtx) {
|
|
|
9
8
|
.description("Get account details and usage")
|
|
10
9
|
.action(async () => {
|
|
11
10
|
const ctx = getCtx();
|
|
12
|
-
const client =
|
|
11
|
+
const client = createClient(ctx.profile);
|
|
13
12
|
const res = await client.request("/account-info/v3/details");
|
|
14
13
|
printResult(ctx, res);
|
|
15
14
|
});
|
|
@@ -25,7 +24,7 @@ export function registerAccount(program, getCtx) {
|
|
|
25
24
|
.option("--occurred-before <iso>", "Only events before ISO datetime")
|
|
26
25
|
.action(async (opts) => {
|
|
27
26
|
const ctx = getCtx();
|
|
28
|
-
const client =
|
|
27
|
+
const client = createClient(ctx.profile);
|
|
29
28
|
const params = new URLSearchParams();
|
|
30
29
|
params.set("limit", String(parseNumberFlag(opts.limit, "--limit")));
|
|
31
30
|
if (opts.after)
|
|
@@ -48,7 +47,7 @@ export function registerAccount(program, getCtx) {
|
|
|
48
47
|
.description("List private apps installed in the portal (integration audit proxy)")
|
|
49
48
|
.action(async () => {
|
|
50
49
|
const ctx = getCtx();
|
|
51
|
-
const client =
|
|
50
|
+
const client = createClient(ctx.profile);
|
|
52
51
|
const res = await client.request("/account-info/v3/api-usage/daily/private-apps");
|
|
53
52
|
printResult(ctx, res);
|
|
54
53
|
});
|
|
@@ -57,7 +56,7 @@ export function registerAccount(program, getCtx) {
|
|
|
57
56
|
.description("Daily API usage totals (portal-wide)")
|
|
58
57
|
.action(async () => {
|
|
59
58
|
const ctx = getCtx();
|
|
60
|
-
const client =
|
|
59
|
+
const client = createClient(ctx.profile);
|
|
61
60
|
const res = await client.request("/account-info/v3/api-usage/daily");
|
|
62
61
|
printResult(ctx, res);
|
|
63
62
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/account/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/account/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,UAAU,eAAe,CAAC,OAAgB,EAAE,MAAwB;IACxE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,uCAAuC,CAAC,CAAC;IAEhG,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,+BAA+B,CAAC;SAC5C,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACzC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;QAC7D,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEL,OAAO;SACJ,OAAO,CAAC,YAAY,CAAC;SACrB,WAAW,CAAC,yCAAyC,CAAC;SACtD,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,IAAI,CAAC;SAC1C,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC;SAC3C,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC;SAC7C,MAAM,CAAC,qBAAqB,EAAE,sBAAsB,CAAC;SACrD,MAAM,CAAC,sBAAsB,EAAE,uBAAuB,CAAC;SACvD,MA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,CAAC,cAAc,CAAC;SACvB,WAAW,CAAC,qEAAqE,CAAC;SAClF,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACzC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,+CAA+C,CAAC,CAAC;QAClF,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;IAEL,OAAO;SACJ,OAAO,CAAC,WAAW,CAAC;SACpB,WAAW,CAAC,sCAAsC,CAAC;SACnD,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;QACrB,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACzC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;QACrE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACxB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -19,19 +19,57 @@ export function registerApi(program, getCtx) {
|
|
|
19
19
|
.option("--data <payload>", "JSON payload for write/read body")
|
|
20
20
|
.option("--raw-body <body>", "Raw body string (sent verbatim, no JSON serialization). Use with --content-type.")
|
|
21
21
|
.option("--content-type <type>", "Content-Type header. Defaults to application/json. Required for non-JSON bodies (e.g. text/plain for CMS source-code uploads).")
|
|
22
|
+
.option("--file <field=path>", "Attach a local file as a multipart field. Repeatable. " +
|
|
23
|
+
"Format: <fieldName>=<localPath>[:<contentType>]. Example: --file file=./theme.html:text/html", (value, previous = []) => {
|
|
24
|
+
const [fieldName, rest] = value.split("=", 2);
|
|
25
|
+
if (!fieldName || !rest)
|
|
26
|
+
throw new CliError("INVALID_FILE", "--file must be <field>=<path>[:<contentType>]");
|
|
27
|
+
const lastColon = rest.lastIndexOf(":");
|
|
28
|
+
let pathPart = rest;
|
|
29
|
+
let ctype;
|
|
30
|
+
// Content-type suffix is optional; only treat last colon as
|
|
31
|
+
// separator when the suffix looks like a MIME (contains `/`).
|
|
32
|
+
if (lastColon > 0 && rest.slice(lastColon + 1).includes("/")) {
|
|
33
|
+
pathPart = rest.slice(0, lastColon);
|
|
34
|
+
ctype = rest.slice(lastColon + 1);
|
|
35
|
+
}
|
|
36
|
+
return [...previous, [fieldName, pathPart, ctype]];
|
|
37
|
+
})
|
|
38
|
+
.option("--part <field=value>", "Attach a text field to the multipart body. Repeatable. Format: <fieldName>=<value>. " +
|
|
39
|
+
"Use --part for JSON sub-objects — pass the JSON as the <value> string.", (value, previous = []) => {
|
|
40
|
+
const [fieldName, ...rest] = value.split("=");
|
|
41
|
+
if (!fieldName || rest.length === 0)
|
|
42
|
+
throw new CliError("INVALID_PART", "--part must be <field>=<value>");
|
|
43
|
+
return [...previous, [fieldName, rest.join("=")]];
|
|
44
|
+
})
|
|
22
45
|
.action(async (opts) => {
|
|
23
46
|
const ctx = getCtx();
|
|
24
47
|
const client = createClient(ctx.profile);
|
|
25
48
|
const method = parseMethod(opts.method);
|
|
26
49
|
const path = String(opts.path).trim();
|
|
50
|
+
const fileFlags = opts.file ?? [];
|
|
51
|
+
const partFlags = opts.part ?? [];
|
|
52
|
+
const hasMultipart = fileFlags.length > 0 || partFlags.length > 0;
|
|
27
53
|
if (opts.data !== undefined && opts.rawBody !== undefined) {
|
|
28
54
|
throw new CliError("INVALID_BODY", "--data and --raw-body cannot be combined");
|
|
29
55
|
}
|
|
56
|
+
if (hasMultipart && (opts.data !== undefined || opts.rawBody !== undefined)) {
|
|
57
|
+
throw new CliError("INVALID_BODY", "--file/--part cannot be combined with --data or --raw-body");
|
|
58
|
+
}
|
|
30
59
|
const body = opts.data !== undefined ? parseJsonPayload(opts.data) : undefined;
|
|
31
60
|
const rawBody = opts.rawBody !== undefined ? String(opts.rawBody) : undefined;
|
|
32
61
|
const contentType = opts.contentType !== undefined ? String(opts.contentType).trim() : undefined;
|
|
33
|
-
|
|
34
|
-
|
|
62
|
+
const multipart = hasMultipart
|
|
63
|
+
? Object.fromEntries([
|
|
64
|
+
...partFlags.map(([name, value]) => [name, value]),
|
|
65
|
+
...fileFlags.map(([name, filePath, ctype]) => [
|
|
66
|
+
name,
|
|
67
|
+
{ path: filePath, contentType: ctype },
|
|
68
|
+
]),
|
|
69
|
+
])
|
|
70
|
+
: undefined;
|
|
71
|
+
if (method === "GET" && (body !== undefined || rawBody !== undefined || hasMultipart)) {
|
|
72
|
+
throw new CliError("INVALID_GET_BODY", "GET requests do not accept --data, --raw-body, --file, or --part");
|
|
35
73
|
}
|
|
36
74
|
const requestOptions = { method };
|
|
37
75
|
if (body !== undefined)
|
|
@@ -40,8 +78,10 @@ export function registerApi(program, getCtx) {
|
|
|
40
78
|
requestOptions.rawBody = rawBody;
|
|
41
79
|
if (contentType !== undefined)
|
|
42
80
|
requestOptions.contentType = contentType;
|
|
81
|
+
if (multipart !== undefined)
|
|
82
|
+
requestOptions.multipart = multipart;
|
|
43
83
|
const res = WRITE_METHODS.has(method)
|
|
44
|
-
? await maybeWrite(ctx, client, method, path, body, { rawBody, contentType })
|
|
84
|
+
? await maybeWrite(ctx, client, method, path, body, { rawBody, contentType, multipart })
|
|
45
85
|
: await client.request(path, requestOptions);
|
|
46
86
|
printResult(ctx, res);
|
|
47
87
|
});
|