@revfleet/hscli 0.9.7 → 0.10.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.
Files changed (87) hide show
  1. package/CHANGELOG.md +106 -0
  2. package/README.md +117 -10
  3. package/SECURITY.md +14 -3
  4. package/dist/cli.js +14 -1
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/auth/index.d.ts +14 -0
  7. package/dist/commands/auth/index.js +208 -39
  8. package/dist/commands/auth/index.js.map +1 -1
  9. package/dist/commands/crm/describe.js +3 -3
  10. package/dist/commands/crm/describe.js.map +1 -1
  11. package/dist/commands/crm/index.js +2 -0
  12. package/dist/commands/crm/index.js.map +1 -1
  13. package/dist/commands/crm/record-layouts.d.ts +3 -0
  14. package/dist/commands/crm/record-layouts.js +246 -0
  15. package/dist/commands/crm/record-layouts.js.map +1 -0
  16. package/dist/commands/doctor/index.js +5 -5
  17. package/dist/commands/doctor/index.js.map +1 -1
  18. package/dist/commands/guide/index.js +1 -1
  19. package/dist/commands/guide/index.js.map +1 -1
  20. package/dist/commands/internal/index.js +20 -6
  21. package/dist/commands/internal/index.js.map +1 -1
  22. package/dist/commands/internal-session.d.ts +4 -0
  23. package/dist/commands/internal-session.js +27 -0
  24. package/dist/commands/internal-session.js.map +1 -1
  25. package/dist/commands/lists/index.js +18 -0
  26. package/dist/commands/lists/index.js.map +1 -1
  27. package/dist/commands/marketing/index.js +5 -5
  28. package/dist/commands/marketing/index.js.map +1 -1
  29. package/dist/commands/mcp.d.ts +2 -1
  30. package/dist/commands/mcp.js +49 -5
  31. package/dist/commands/mcp.js.map +1 -1
  32. package/dist/commands/settings/index.js +20 -0
  33. package/dist/commands/settings/index.js.map +1 -1
  34. package/dist/commands/ui/index.js +2 -2
  35. package/dist/commands/ui/index.js.map +1 -1
  36. package/dist/commands/workflows/index.js +2 -0
  37. package/dist/commands/workflows/index.js.map +1 -1
  38. package/dist/commands/workflows/internal.d.ts +3 -0
  39. package/dist/commands/workflows/internal.js +332 -0
  40. package/dist/commands/workflows/internal.js.map +1 -0
  41. package/dist/core/auth.d.ts +18 -2
  42. package/dist/core/auth.js +96 -3
  43. package/dist/core/auth.js.map +1 -1
  44. package/dist/core/capabilities.d.ts +8 -0
  45. package/dist/core/capabilities.js +31 -3
  46. package/dist/core/capabilities.js.map +1 -1
  47. package/dist/core/http.d.ts +6 -0
  48. package/dist/core/http.js +14 -3
  49. package/dist/core/http.js.map +1 -1
  50. package/dist/core/output.js +20 -4
  51. package/dist/core/output.js.map +1 -1
  52. package/dist/core/permissions.js +15 -1
  53. package/dist/core/permissions.js.map +1 -1
  54. package/dist/core/schema-cache.js +6 -2
  55. package/dist/core/schema-cache.js.map +1 -1
  56. package/dist/core/vault.js +10 -5
  57. package/dist/core/vault.js.map +1 -1
  58. package/dist/mcp/compat-hubspot.d.ts +5 -14
  59. package/dist/mcp/compat-hubspot.js +17 -14
  60. package/dist/mcp/compat-hubspot.js.map +1 -1
  61. package/dist/mcp/diagnostics.d.ts +157 -0
  62. package/dist/mcp/diagnostics.js +199 -0
  63. package/dist/mcp/diagnostics.js.map +1 -0
  64. package/dist/mcp/ecosystem.d.ts +107 -0
  65. package/dist/mcp/ecosystem.js +127 -0
  66. package/dist/mcp/ecosystem.js.map +1 -0
  67. package/dist/mcp/ext-tools.d.ts +4 -3
  68. package/dist/mcp/ext-tools.js +20 -8
  69. package/dist/mcp/ext-tools.js.map +1 -1
  70. package/dist/mcp/profiles.d.ts +9 -0
  71. package/dist/mcp/profiles.js +38 -4
  72. package/dist/mcp/profiles.js.map +1 -1
  73. package/dist/mcp/server.d.ts +118 -1
  74. package/dist/mcp/server.js +64 -7
  75. package/dist/mcp/server.js.map +1 -1
  76. package/docs/CAPABILITY_LIBRARY.md +1 -1
  77. package/docs/COMMAND_TREE.md +8 -4
  78. package/docs/COMPARISON.md +14 -6
  79. package/docs/COOKBOOK.md +51 -4
  80. package/docs/INTERNAL-ENDPOINTS-DISCOVERY.md +59 -0
  81. package/docs/INTERNAL-ENDPOINTS.md +13 -0
  82. package/docs/INTERNAL_ENDPOINTS.md +22 -4
  83. package/docs/MCP.md +48 -6
  84. package/docs/MCP_TOOL_CATALOG.md +188 -186
  85. package/docs/OPERATIONAL_PLAYBOOKS.md +9 -8
  86. package/docs/PORTAL_SETUP.md +2 -2
  87. package/package.json +1 -1
@@ -58,7 +58,7 @@ read-like surfaces into JSON backup assets:
58
58
  | `permission-access` | App users, teams, permission sets, assignment maps, roles, seats, templates, FLP, and access-audit RPCs |
59
59
  | `datasets-reporting` | Data Studio datasets, reportable sources, joins, formulas, previews, async resolve calls, and async result polling |
60
60
  | `reports-dashboards` | Report definitions, favorites, report audit/history, record-view metadata, report permissions, report template discovery, dashboard layouts, widgets, dashboard grants, and report-list views |
61
- | `workflows-hybrid` | Workflow inventories, hybrid action graphs, validation, output fields, action catalog, CRM object context, canvas errors, access checks, filter-description previews, and card-position RPCs |
61
+ | `workflows-hybrid` | Workflow inventories, current hybrid action graphs, full revision history, validation previews, output fields, action catalog, CRM object context, canvas errors, access checks, filter-description previews, and card-position RPCs |
62
62
  | `properties-metadata` | Internal property metadata, legacy v1/v2 fallbacks, property groups, grouped-property listings, named property reads, recycled properties, quotas, fill rates, validation, dynamic options, and conditional options |
63
63
  | `crm-search` | Read-only CRM search, CRM GraphQL, object preview, and single-object UI payload helpers used by report builders, help desk, quotes, and object indexes |
64
64
  | `object-metadata` | Schema metadata, framework-builder metadata, portal-scoped object types, event object types, and object-type batch reads |
@@ -107,6 +107,24 @@ for research and migration design, but they are not included in
107
107
  be implemented as explicit product commands with policy checks, dry-run,
108
108
  `--force`, and audit trails.
109
109
 
110
+ The sole promoted workflow write adapter is
111
+ `hscli workflows update-internal <flowId>`. It targets the undocumented
112
+ `POST /api/automationplatform/v1/hybrid/batch` editor endpoint and is never
113
+ part of `internal capture` or MCP. It is plan-only by default and adds stronger
114
+ gates than normal writes: one disabled flow, matching requested/input/live ID,
115
+ same-session portal proof, live-version optimistic locking, validation,
116
+ owner-only snapshot, one request with retries disabled, and post-save proof
117
+ from both current state and revision history. Operators must also provide a
118
+ change ticket, sealed action contract, explicit experimental opt-in, `--force`,
119
+ and an ID-bound acknowledgement.
120
+
121
+ Record-card writes are similarly promoted only through
122
+ `crm record-layouts update-card`. The command reads the live card, replaces
123
+ only `configuration.propertyNames`, snapshots the full before/after payload,
124
+ uses one non-retried `PUT /api/crm-record-cards/v4/crm-cards/{cardId}`, and
125
+ verifies the exact ordered property list. It is not available to generic
126
+ capture or MCP.
127
+
110
128
  ## Browser Session Auth Pattern
111
129
 
112
130
  Most internal endpoints require the HubSpot browser cookies plus the modern
@@ -189,9 +207,9 @@ commands. hscli exposes only the allowlisted reads below through
189
207
  | Reports | `/api/dashboard/v2/reports/*`, `/reporting-migration/v2/reports/migrate` |
190
208
  | Reporting data | `/api/reporting/v3/dataset/resolve/async` |
191
209
  | Datasets | `/sql-reporting/v1/datasets/*`, `/sql-reporting/v1/extended-reportable-options/*` |
192
- | Workflows | `/api/automationplatform/v1/hybrid/{flowId}`, validation, output fields, action catalog |
210
+ | Workflows | `/api/automationplatform/v1/flows/{flowId}`, `/api/automationplatform/v1/hybrid/{flowId}`, `/api/automationplatform/v1/hybrid/revisions/{flowId}`, validation, canvas errors, output fields, action catalog; guarded CLI-only full replacement via `/api/automationplatform/v1/hybrid/batch` |
193
211
  | Properties | `/api/properties/v4/{typeId}`, `/api/properties/v4/groups/{typeId}`, v2 fallbacks |
194
- | Lists / segments | Legacy contacts lists, ILS segments, list search, and UI list views |
212
+ | Lists / segments | Legacy contacts lists, ILS segments, list search, UI list views, and `/api/inbounddb-lists/v1/lists/{listId}` complete filter trees |
195
213
  | Sales content | `/api/templates/v1`, `/api/sales-content/v1`, `/api/sales-content-libraries/v2` |
196
214
  | Sequences | `/api/salescontentsearch/v2/search`, `/api/sequences/v3/sequences/{id}` |
197
215
  | Playbooks | Chirp RPC `com.hubspot.playbooks.rpc.PlaybooksRpc` |
@@ -206,7 +224,7 @@ commands. hscli exposes only the allowlisted reads below through
206
224
  | Social and ads | `/api/broadcast/v2/*` plus read-only `com.hubspot.ads.rpc.*` Chirp RPCs |
207
225
  | CRM search and previews | `/api/crm-search/*`, `/api/graphql/crm`, and `/inbounddb-objects/v1/*` |
208
226
  | Conditional properties | `/api/conditional-properties/v2/rules/*` plus unified RPC reads |
209
- | Record cards | `/api/crm-record-cards/v4/container-views/*` |
227
+ | Record cards | `/api/crm-record-cards/v4/container-views/search`, `/get-view/CRM_RECORD_PAGE/{layoutId}`, `/api/crm-record-cards/v4/crm-cards/all`, and `/crm-cards/{cardId}` |
210
228
  | Conversations / help desk | Custom views and Chirp RPC help desk services |
211
229
  | Chatflows | Chirp RPC `com.hubspot.chatflows.rpc.*` |
212
230
  | Payments / quotes / forecast | Feature-gated internal setup and eligibility endpoints |
package/docs/MCP.md CHANGED
@@ -18,6 +18,11 @@ hscli mcp # minimal: essential CRM reads
18
18
  hscli mcp --surface crm # curated CRM reads + writes
19
19
  hscli mcp --surface migration # cross-product migration tools
20
20
  hscli mcp --surface full # all tools, including raw API
21
+ hscli --json mcp manifest --surface minimal # protocol + transport + tool metadata
22
+ hscli --profile prod --json mcp doctor # local profile and safety diagnostics
23
+ hscli --profile prod --json mcp doctor --all # external checks, clearly marked not live-run
24
+ hscli --profile prod --json mcp setup --client codex # plan only; no credential/config write
25
+ hscli --json mcp matrix # intended use + trust boundaries
21
26
  ```
22
27
 
23
28
  The default `minimal` surface keeps agent context and write exposure small.
@@ -26,10 +31,12 @@ pass command arguments.
26
31
 
27
32
  ## Profile isolation and safety defaults
28
33
 
29
- - **Profile isolation**: set `HSCLI_MCP_PROFILE=<profile>` to hard-lock the MCP server to one auth profile.
34
+ - **Profile isolation**: `hscli --profile <profile> mcp serve` hard-locks the server to that startup profile by default.
30
35
  - If a tool call requests a different profile, the server rejects it.
36
+ - Cross-profile selection is available only with the operator-controlled `--allow-cross-profile` startup flag.
31
37
  - **Write tools are dry-run by default**:
32
- - `force: true` is required to execute actual writes.
38
+ - `force: true` on the tool call is necessary but not sufficient.
39
+ - The operator must also start the server with `--allow-writes` (or explicitly set `HSCLI_MCP_ALLOW_WRITES=1`).
33
40
  - Without `force`, write tools return a dry-run payload (`{ dryRun: true, method, path, body }`).
34
41
  - **Lifecycle coverage for CRM objects**:
35
42
  - standard object tools now include delete, merge, batch read/upsert/archive.
@@ -39,6 +46,20 @@ pass command arguments.
39
46
  - Pipeline object types: `deals`, `tickets`
40
47
  - **Secrets redaction**:
41
48
  - Token-like fields and bearer strings are redacted in MCP tool outputs and errors.
49
+ - **Conservative tool annotations**:
50
+ - Every registered tool publishes `readOnlyHint`, `destructiveHint`,
51
+ `idempotentHint`, and `openWorldHint`.
52
+ - Unknown or mixed-operation tools default to write/destructive metadata.
53
+ - `manage_crm_objects` and raw `hub_api_request` are destructive because
54
+ their runtime arguments can select delete operations.
55
+ - **Stable diagnostic schemas**:
56
+ - `hscli_mcp_manifest` and `hscli_mcp_doctor` publish MCP `outputSchema`
57
+ declarations and return validated structured content.
58
+ - The 11-tool HubSpot name-compatible subset also publishes object-level
59
+ output schemas so clients can rely on structured content without assuming
60
+ HubSpot Remote MCP authorization or transport equivalence.
61
+ - Raw HubSpot tools deliberately do not claim stable output schemas because
62
+ their response shapes vary by endpoint, product tier, and portal state.
42
63
 
43
64
  ## Claude Desktop setup
44
65
 
@@ -84,14 +105,29 @@ If your client accepts env vars, set:
84
105
  - `HSCLI_HOME` to the auth profile directory containing `auth.json`
85
106
  - `HSCLI_MCP_PROFILE` to force strict profile isolation
86
107
 
108
+ ## Three-server setup
109
+
110
+ The products are complementary and should be configured side by side:
111
+
112
+ | Server | Transport / auth | Best use |
113
+ |---|---|---|
114
+ | HubSpot Remote MCP | Streamable HTTP, OAuth 2.1 + PKCE, HubSpot user permissions | User-authorized CRM, activities, content, and marketing operations |
115
+ | HubSpot Developer MCP | stdio via HubSpot CLI 8.2+ | HubSpot app and CMS development (`hs mcp setup`) |
116
+ | hscli MCP | local stdio, hscli profile | Bulk operations, migrations, backups, internal adapters, policy, tickets, audit evidence |
117
+
118
+ Run `hscli --profile <name> --json mcp setup --client <client>` for a
119
+ secret-free plan. The command does not perform OAuth, write client config, or
120
+ store credentials. Run `mcp doctor --all` afterward; external checks remain
121
+ `external-check-required` until the owning client completes them.
122
+
87
123
  ## Tool surfaces
88
124
 
89
125
  | Surface | Tools | Intended use | Raw API |
90
126
  |---|---:|---|---|
91
- | `minimal` | 29 | Agent discovery and essential CRM reads | No |
92
- | `crm` | 136 | CRM objects, schemas, properties, associations, imports | No |
93
- | `migration` | 179 | Curated cross-product backup and migration work | No |
94
- | `full` | 180 | Explicit operator access to every registered tool | Yes |
127
+ | `minimal` | 31 | Agent diagnostics, discovery, and essential CRM reads | No |
128
+ | `crm` | 138 | CRM objects, schemas, properties, associations, imports | No |
129
+ | `migration` | 181 | Curated cross-product backup and migration work | No |
130
+ | `full` | 182 | Explicit operator access to every registered tool | Yes |
95
131
 
96
132
  The exact catalog is generated from runtime registration metadata, including
97
133
  domain, inferred risk, surfaces, and description:
@@ -107,5 +143,11 @@ npm run docs:mcp:check
107
143
  ## Notes
108
144
 
109
145
  - MCP transport is stdio only in this implementation.
146
+ - The packaged SDK currently negotiates MCP `2025-11-25`. Streamable HTTP,
147
+ MCP Tasks, MCP Apps, and explicit `2026-07-28` opt-in are not enabled.
148
+ They require a separate SDK-v2 migration and transport compatibility gate.
110
149
  - Existing auth + HTTP core logic is reused (`getToken`, `HubSpotClient`, `maybeWrite`, redaction).
111
150
  - `hub_api_request` is exposed only by `--surface full`.
151
+ - MCP writes use the startup write gate, dry-run, force, policy, portal-pin, and change-ticket gates,
152
+ but are not yet bound to sealed `hscli agent contract` prepare/apply/verify
153
+ workflows. `mcp doctor` reports this limitation explicitly.