@revfleet/hscli 0.8.12 → 0.9.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.
Files changed (158) hide show
  1. package/CHANGELOG.md +197 -1
  2. package/README.md +243 -10
  3. package/dist/cli.js +27 -3
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/agent/contracts.d.ts +3 -0
  6. package/dist/commands/agent/contracts.js +139 -0
  7. package/dist/commands/agent/contracts.js.map +1 -0
  8. package/dist/commands/agent/evidence.d.ts +68 -0
  9. package/dist/commands/agent/evidence.js +358 -0
  10. package/dist/commands/agent/evidence.js.map +1 -0
  11. package/dist/commands/agent/index.d.ts +3 -0
  12. package/dist/commands/agent/index.js +223 -0
  13. package/dist/commands/agent/index.js.map +1 -0
  14. package/dist/commands/agent/recipes.d.ts +13 -0
  15. package/dist/commands/agent/recipes.js +108 -0
  16. package/dist/commands/agent/recipes.js.map +1 -0
  17. package/dist/commands/agent/runner.d.ts +16 -0
  18. package/dist/commands/agent/runner.js +165 -0
  19. package/dist/commands/agent/runner.js.map +1 -0
  20. package/dist/commands/audit/index.js +4 -0
  21. package/dist/commands/audit/index.js.map +1 -1
  22. package/dist/commands/auth/index.js +64 -7
  23. package/dist/commands/auth/index.js.map +1 -1
  24. package/dist/commands/automation/index.js +30 -0
  25. package/dist/commands/automation/index.js.map +1 -1
  26. package/dist/commands/backup/index.d.ts +12 -0
  27. package/dist/commands/backup/index.js +459 -0
  28. package/dist/commands/backup/index.js.map +1 -0
  29. package/dist/commands/cms/content-ops.js +1 -1
  30. package/dist/commands/cms/content-ops.js.map +1 -1
  31. package/dist/commands/communication-preferences/index.js +207 -7
  32. package/dist/commands/communication-preferences/index.js.map +1 -1
  33. package/dist/commands/content-permissions/index.d.ts +22 -0
  34. package/dist/commands/content-permissions/index.js +141 -0
  35. package/dist/commands/content-permissions/index.js.map +1 -0
  36. package/dist/commands/context/index.d.ts +3 -0
  37. package/dist/commands/context/index.js +182 -0
  38. package/dist/commands/context/index.js.map +1 -0
  39. package/dist/commands/crm/associations.js +38 -0
  40. package/dist/commands/crm/associations.js.map +1 -1
  41. package/dist/commands/crm/custom-objects.js +39 -2
  42. package/dist/commands/crm/custom-objects.js.map +1 -1
  43. package/dist/commands/crm/dated.js +3 -3
  44. package/dist/commands/crm/dated.js.map +1 -1
  45. package/dist/commands/crm/migration.js +210 -2
  46. package/dist/commands/crm/migration.js.map +1 -1
  47. package/dist/commands/crm/properties.js +2 -1
  48. package/dist/commands/crm/properties.js.map +1 -1
  49. package/dist/commands/crm/property-batch.d.ts +1 -0
  50. package/dist/commands/crm/property-batch.js +44 -5
  51. package/dist/commands/crm/property-batch.js.map +1 -1
  52. package/dist/commands/crm/shared.js +21 -2
  53. package/dist/commands/crm/shared.js.map +1 -1
  54. package/dist/commands/crm/sync.js +1 -1
  55. package/dist/commands/crm/sync.js.map +1 -1
  56. package/dist/commands/doctor/index.js +193 -0
  57. package/dist/commands/doctor/index.js.map +1 -1
  58. package/dist/commands/email-tracking/index.d.ts +16 -0
  59. package/dist/commands/email-tracking/index.js +314 -0
  60. package/dist/commands/email-tracking/index.js.map +1 -0
  61. package/dist/commands/extensions/index.js +1 -1
  62. package/dist/commands/extensions/index.js.map +1 -1
  63. package/dist/commands/forms/index.js +15 -2
  64. package/dist/commands/forms/index.js.map +1 -1
  65. package/dist/commands/forms/legacy-v2.d.ts +7 -2
  66. package/dist/commands/forms/legacy-v2.js +103 -7
  67. package/dist/commands/forms/legacy-v2.js.map +1 -1
  68. package/dist/commands/guide/index.d.ts +1 -1
  69. package/dist/commands/guide/index.js +37 -4
  70. package/dist/commands/guide/index.js.map +1 -1
  71. package/dist/commands/internal/catalog.d.ts +1 -0
  72. package/dist/commands/internal/catalog.js +2 -0
  73. package/dist/commands/internal/catalog.js.map +1 -0
  74. package/dist/commands/internal/index.d.ts +26 -0
  75. package/dist/commands/internal/index.js +823 -0
  76. package/dist/commands/internal/index.js.map +1 -0
  77. package/dist/commands/internal-session.d.ts +15 -0
  78. package/dist/commands/internal-session.js +152 -0
  79. package/dist/commands/internal-session.js.map +1 -0
  80. package/dist/commands/lists/index.js +1 -1
  81. package/dist/commands/lists/index.js.map +1 -1
  82. package/dist/commands/marketing/email-audit.d.ts +32 -0
  83. package/dist/commands/marketing/email-audit.js +121 -0
  84. package/dist/commands/marketing/email-audit.js.map +1 -0
  85. package/dist/commands/marketing/index.js +2 -0
  86. package/dist/commands/marketing/index.js.map +1 -1
  87. package/dist/commands/mcp.js +5 -3
  88. package/dist/commands/mcp.js.map +1 -1
  89. package/dist/commands/playbooks/index.d.ts +3 -0
  90. package/dist/commands/playbooks/index.js +228 -0
  91. package/dist/commands/playbooks/index.js.map +1 -0
  92. package/dist/commands/portals/index.d.ts +3 -0
  93. package/dist/commands/portals/index.js +132 -0
  94. package/dist/commands/portals/index.js.map +1 -0
  95. package/dist/commands/reports/index.d.ts +3 -0
  96. package/dist/commands/reports/index.js +479 -0
  97. package/dist/commands/reports/index.js.map +1 -0
  98. package/dist/commands/sales-content/index.d.ts +13 -0
  99. package/dist/commands/sales-content/index.js +59 -0
  100. package/dist/commands/sales-content/index.js.map +1 -0
  101. package/dist/commands/sales-templates/index.d.ts +3 -0
  102. package/dist/commands/sales-templates/index.js +88 -0
  103. package/dist/commands/sales-templates/index.js.map +1 -0
  104. package/dist/commands/seed/cms.js +28 -45
  105. package/dist/commands/seed/cms.js.map +1 -1
  106. package/dist/commands/sequences/index.d.ts +18 -0
  107. package/dist/commands/sequences/index.js +263 -0
  108. package/dist/commands/sequences/index.js.map +1 -0
  109. package/dist/commands/settings/index.js +450 -102
  110. package/dist/commands/settings/index.js.map +1 -1
  111. package/dist/commands/settings/site-settings.d.ts +3 -0
  112. package/dist/commands/settings/site-settings.js +106 -0
  113. package/dist/commands/settings/site-settings.js.map +1 -0
  114. package/dist/commands/ui/index.js +14 -4
  115. package/dist/commands/ui/index.js.map +1 -1
  116. package/dist/commands/workflows/index.js +2 -0
  117. package/dist/commands/workflows/index.js.map +1 -1
  118. package/dist/commands/workflows/preflight.d.ts +23 -0
  119. package/dist/commands/workflows/preflight.js +295 -0
  120. package/dist/commands/workflows/preflight.js.map +1 -0
  121. package/dist/core/action-contract.d.ts +43 -0
  122. package/dist/core/action-contract.js +207 -0
  123. package/dist/core/action-contract.js.map +1 -0
  124. package/dist/core/auth.d.ts +6 -0
  125. package/dist/core/auth.js +85 -0
  126. package/dist/core/auth.js.map +1 -1
  127. package/dist/core/http.d.ts +8 -0
  128. package/dist/core/http.js +37 -5
  129. package/dist/core/http.js.map +1 -1
  130. package/dist/core/id-maps.d.ts +27 -0
  131. package/dist/core/id-maps.js +204 -0
  132. package/dist/core/id-maps.js.map +1 -0
  133. package/dist/core/output.d.ts +2 -1
  134. package/dist/core/output.js +34 -0
  135. package/dist/core/output.js.map +1 -1
  136. package/dist/mcp/profiles.d.ts +14 -0
  137. package/dist/mcp/profiles.js +68 -0
  138. package/dist/mcp/profiles.js.map +1 -0
  139. package/dist/mcp/server.d.ts +5 -3
  140. package/dist/mcp/server.js +22 -5
  141. package/dist/mcp/server.js.map +1 -1
  142. package/docs/CAPABILITY_LIBRARY.md +29 -8
  143. package/docs/COMMAND_TREE.md +99 -17
  144. package/docs/COMPARISON.md +8 -5
  145. package/docs/COOKBOOK.md +124 -5
  146. package/docs/INTERNAL-ENDPOINTS-DISCOVERY.md +813 -0
  147. package/docs/INTERNAL-ENDPOINTS.md +371 -0
  148. package/docs/INTERNAL_ENDPOINTS.md +243 -0
  149. package/docs/MARKETING_SETUP.md +21 -1
  150. package/docs/MCP.md +28 -89
  151. package/docs/MCP_TOOL_CATALOG.md +192 -0
  152. package/docs/MIGRATION_ADAPTERS.md +115 -0
  153. package/docs/PORTAL_BACKUP.md +212 -0
  154. package/docs/PUBLISHING.md +1 -1
  155. package/docs/SALES_CONTENT_INTERNAL_PUNCH_LIST.md +504 -0
  156. package/docs/TUTORIALS/secure-agent-writes.md +49 -0
  157. package/docs/WHY_HOW_WHAT.md +10 -4
  158. package/package.json +4 -2
@@ -0,0 +1,212 @@
1
+ # Portal Backup
2
+
3
+ Use `hscli /backup` to start from intent, then `hscli backup plan` when a
4
+ HubSpot portal needs to be preserved before a downgrade, migration,
5
+ consolidation, or forensic audit.
6
+
7
+ The command is plan-only. It does not call HubSpot and it does not write local
8
+ files. It renders a public-API-first runbook plus an explicit internal API
9
+ capture brief for browser-session tools such as a Claude extension.
10
+ When `--include-internal` is set, it also renders an `internalCapturePlan`
11
+ section with executable `hscli internal capture` commands derived from the
12
+ versioned internal allowlist.
13
+
14
+ See [`INTERNAL_ENDPOINTS.md`](./INTERNAL_ENDPOINTS.md) for the condensed
15
+ allowlisted browser-session endpoint map. The full catalogue and discovery log
16
+ live in [`INTERNAL-ENDPOINTS.md`](./INTERNAL-ENDPOINTS.md) and
17
+ [`INTERNAL-ENDPOINTS-DISCOVERY.md`](./INTERNAL-ENDPOINTS-DISCOVERY.md).
18
+
19
+ ```bash
20
+ hscli --profile source-readonly backup plan \
21
+ --portal-id "$PORTAL_ID" \
22
+ --out-dir "$HOME/client-migration-assets/portal-$PORTAL_ID-full-backup" \
23
+ --include-internal \
24
+ --snapshot-id "portal-$PORTAL_ID-full-backup" \
25
+ --json
26
+ ```
27
+
28
+ ## Safety Model
29
+
30
+ - Source profiles must be set to read-only before capture.
31
+ - The plan never includes `--force` in executable commands.
32
+ - Public API capture comes first.
33
+ - Browser-session capture is explicit and allowlisted.
34
+ - `backup plan` is the orchestrator; `internal capture` is the adapter that
35
+ executes only the allowlisted read/read-like internal endpoints.
36
+ - `hscli internal capture` turns allowlisted catalogue surfaces into concrete
37
+ read-only JSON captures. It is not a generic internal API passthrough.
38
+ - The internal capture allowlist is versioned in
39
+ `src/commands/internal/catalog.ts`; add endpoints there with tests before
40
+ relying on them in a client backup.
41
+ - Internal capture should stay GET-only, except documented read-only search or
42
+ preview POST calls where the request body is saved.
43
+ - Backup assets must stay outside the hscli git repository.
44
+ - `migration/` is ignored because local capture data is client data.
45
+
46
+ ## HubSpot 360 Coverage
47
+
48
+ The JSON output includes a `coverageModel` with explicit domain coverage:
49
+
50
+ - account identity, private apps, API usage, and audit logs
51
+ - CRM records, custom objects, properties, pipelines, association labels, and
52
+ engagements
53
+ - marketing assets, campaigns, forms, lists, subscription types, email
54
+ fallbacks, and consent surfaces
55
+ - sales, service, CMS, commerce, files, operations, automation, reporting,
56
+ settings, integrations, and governance
57
+ - UI-only surfaces such as business units, permission sets, custom views,
58
+ datasets, dashboard layouts, report filters, and full workflow action graphs
59
+
60
+ The plan should not pretend that public APIs cover everything. Public API
61
+ capture comes first; browser-session/internal capture then documents the
62
+ remaining HubSpot UI-only surfaces and blockers.
63
+
64
+ ## What the Plan Captures
65
+
66
+ Public API capture:
67
+
68
+ - account info, private apps, API usage
69
+ - users, teams, owners, currencies
70
+ - CRM schemas, property groups, properties, pipelines, stages
71
+ - association labels
72
+ - lists, forms, workflows, marketing emails, campaigns
73
+ - sales sequences, meetings, calling, goals
74
+ - service conversations, feedback submissions, chatflows, ticket pipelines
75
+ - CMS pages, blogs, HubDB tables, redirects, domains, audit logs, SEO audit
76
+ - files and file folders
77
+ - communication preferences
78
+ - public reporting/dashboard inventory
79
+ - records smoke-test commands for standard CRM objects
80
+
81
+ Internal/browser-session capture brief:
82
+
83
+ - business units
84
+ - full app-users payloads
85
+ - permission sets
86
+ - permission-set assignments, atomic role catalog, role categories, scope
87
+ buckets, permission templates, seat catalog, and seat assignments
88
+ - datasets, SQL reporting metadata, reportable sources, and join metadata
89
+ - reports, report history/audit, dashboard definitions, dashboard permissions,
90
+ widgets, report favorites, report templates, reporting-frontend report lists,
91
+ and report-list views when public APIs omit details
92
+ - custom views, pinned views, CRM index views, visualization settings, and UI
93
+ search snapshots
94
+ - full workflow hybrid definitions, action graph details, validation output,
95
+ action catalog, CRM object snapshots, canvas errors, access checks,
96
+ filter-description previews, card positions, and bulk-processing metadata
97
+ - property v4 metadata, v1/v2 legacy fallbacks, property groups, grouped
98
+ property listings, recycled properties, quota/count metadata, fill-rate
99
+ snapshots, validation constraints, conditional options, and conditional rule
100
+ RPC reads
101
+ - CRM search, CRM GraphQL, object preview, and single-object UI payload helpers
102
+ used by report builders, quotes, help desk, and object index pages
103
+ - list/segment definitions from overlapping list v3, list v2, contacts-list,
104
+ contact-list-management, ILS segment, segments UI, and legacy segment-search
105
+ surfaces
106
+ - per-object audit logs for lists, dashboards, reports, and workflows
107
+ - field-level permissions and report permissions
108
+ - field-level permission bypass users
109
+ - marketing email body/settings fallbacks
110
+ - all communication subscription channels, including non-email definitions
111
+ - brand kits, brand colors, logos, favicons, fonts, and brand voice metadata
112
+ - internal marketing-email definitions from `cosemail`, including
113
+ drag-and-drop layout/theme/flex area metadata
114
+ - CTA placements from the new CTA builder
115
+ - Design Manager templates, content v2 templates/pages, themes, modules,
116
+ layouts, global groups, built-in module mapping, site settings, and
117
+ content-copy job status
118
+ - social broadcasts, connected social channels, and read-only ads account/UI
119
+ metadata RPCs
120
+ - sales snippets with body/htmlBody and shortcut metadata
121
+ - sequence usage/health, sales template bodies/usage, playbook count/version,
122
+ and playbook question metadata
123
+ - payment-account eligibility and connected-account status
124
+ - schema/object metadata, portal-scoped object types, event object types, and
125
+ framework-builder UI metadata
126
+ - allowlisted read-only Chirp RPC fallbacks for metadata services only
127
+
128
+ ## Downgrade Checklist
129
+
130
+ 1. Render the plan.
131
+ 2. Create the output directory outside the repo.
132
+ 3. Set the source profile to read-only.
133
+ 4. Start a trace/no-write log.
134
+ 5. Run public metadata capture.
135
+ 6. Run public record capture until each object has no next cursor.
136
+ 7. Run `hscli internal surfaces` and `hscli internal capture --all` with an
137
+ authenticated HubSpot browser session.
138
+ 8. Produce `capture-manifest.json`.
139
+ 9. Verify the no-write log contains only GET and approved read-only POST calls.
140
+ 10. Scan the archive for secrets before sharing it.
141
+
142
+ ## Claude / Browser-Session Handoff
143
+
144
+ The `claudeExtensionBrief` field in the JSON output is designed to be pasted
145
+ directly into a browser-session agent. It includes the portal ID, output
146
+ directory, no-write rule, required endpoints, optional endpoints, and logging
147
+ requirements.
148
+
149
+ Prefer the native hscli capture adapter first:
150
+
151
+ ```bash
152
+ hscli --profile source-readonly --json internal surfaces
153
+ hscli --profile source-readonly --json internal capture \
154
+ --all \
155
+ --portal-id "$PORTAL_ID" \
156
+ --cookie-file "$HUBSPOT_COOKIE_FILE" \
157
+ --out-dir "$OUT_DIR/internal-api/allowlisted-capture"
158
+ ```
159
+
160
+ For large or sensitive portals, prefer the surface-by-surface commands emitted
161
+ by `backup plan`:
162
+
163
+ ```bash
164
+ hscli --profile source-readonly --json backup plan \
165
+ --portal-id "$PORTAL_ID" \
166
+ --include-internal \
167
+ --out-dir "$OUT_DIR" \
168
+ > "$OUT_DIR/backup-plan.json"
169
+
170
+ # Then copy reviewed commands from:
171
+ # internalCapturePlan.surfaceCommands
172
+ # internalCapturePlan.parameterizedExamples
173
+ ```
174
+
175
+ When a surface contains a read-only POST that needs a specific request body,
176
+ capture it explicitly instead of guessing:
177
+
178
+ ```bash
179
+ hscli --profile source-readonly --json internal capture \
180
+ --surface permission-access \
181
+ --endpoint app-users-batch \
182
+ --portal-id "$PORTAL_ID" \
183
+ --cookie-file "$HUBSPOT_COOKIE_FILE" \
184
+ --body-file app-users-batch="$OUT_DIR/internal-api/bodies/app-users-batch.json" \
185
+ --out-dir "$OUT_DIR/internal-api/permission-access"
186
+ ```
187
+
188
+ The body file is parsed as JSON, redacted into
189
+ `<endpoint>.request.json`, and hashed in `capture-manifest.json`. This keeps
190
+ Claude/browser-session captures reproducible without turning hscli into a
191
+ generic internal API client.
192
+
193
+ Use a browser-session agent for endpoints that need user interaction, per-asset
194
+ request bodies, or feature-gated pages that the generic allowlisted capture
195
+ cannot parameterize safely.
196
+
197
+ If an endpoint returns `401`, `403`, or `404`, document the blocker and continue.
198
+ Do not modify source permissions or retry write-like endpoints during backup.
199
+
200
+ For HubSpot internal browser-session endpoints, prefer the `hubspotapi-csrf`
201
+ cookie value as the `X-HubSpot-CSRF-hubspotapi` header. `csrf.app` is accepted
202
+ for older internal surfaces, but many modern endpoints require
203
+ `hubspotapi-csrf`.
204
+
205
+ The internal endpoint catalog is intentionally generic. Do not paste client
206
+ portal IDs, session IDs, browser cookies, CSRF tokens, or raw migration files
207
+ into hscli docs or commits. Keep that material in the local backup archive only.
208
+
209
+ Read-only POST endpoints are allowed only for search, preview, batch hydration,
210
+ or metadata RPC calls where HubSpot uses POST for reads. Log the request body
211
+ hash and save the exact body next to the response so the no-write proof remains
212
+ auditable.
@@ -14,7 +14,7 @@ How to cut a new release of `@revfleet/hscli` on npm. Written for the maintainer
14
14
  ### 1. Land all changes on a feature branch
15
15
 
16
16
  ```bash
17
- cd /Users/louisv/Pro-Desktop/Projets/hscli-main
17
+ cd /path/to/hscli
18
18
  git checkout -b <branch-name>
19
19
  # ... commits ...
20
20
  git push -u origin <branch-name>